package cn.net.caoyao.cpzshandset.db.presenter;

import java.util.List;

import android.database.Cursor;
import cn.net.caoyao.cpzshandset.bean.TrainInvoiceBean;

public interface TrainInvoiceDal {

	/**
	 * 生成火车订单信息
	 * 
	 * @param trainInvoice
	 */
	public int insertTrainInvoice(TrainInvoiceBean trainInvoice);
	/**
	 * 插入时检测已经数据库中已经存在该订单
	 * @param trainInvoice
	 * @return
	 */
	public boolean insertHasExist(TrainInvoiceBean trainInvoice);
	/**
	 * 修改时检测数据库中已经存在该订单
	 * @param trainInvoice
	 * @return
	 */
	public boolean updateHasExist(TrainInvoiceBean trainInvoice);
	//UPDATE `tbl_label_info_358000000` SET ISPRODUCT=(-1)*ISPRODUCT WHERE label_id=100215130712
	/**
	 * 修改当前订单单个标签的上传类型
	 * @param invoice
	 * @return
	 */
	public TrainInvoiceBean updateTrainLabelMode(TrainInvoiceBean invoice);

	/**
	 * 修改火车订单信息
	 * 
	 * @param trainInvoice
	 */
	public void updateTrainInvoice(TrainInvoiceBean trainInvoice);

	/**
	 * 根据订单Id,修改火车订单状态
	 * 
	 * @param status
	 * @param id
	 */
	public void updateTrainErrorStatus(int status, int errorCode,int id);

	/**
	 * 根据运单ID获取订单信息
	 * @param id
	 * @return
	 */
	public TrainInvoiceBean queryTrainInvoiceById(int id);

	/**
	 * 根据订单状态获取订单列表
	 * @param status 0:有效    1:无效
	 * @return
	 */
	public List<TrainInvoiceBean> queryAllTrainInvoices();
	
	/**
	 * 查询所有的火车发货信息
	 * @return
	 */
	List<TrainInvoiceBean> queryAllTrainInvoicesASC();
	
	/**
	 * 根据订单状态删除订单
	 * @param status
	 */
	public void deleteInvalidInvoice(int status);
	
	/**
	 * 删除数据表中所有的无效订单
	 * @param status
	 */
	public void deleteAllInvalidInvoice();
	
	/**
	 * 根据火车订单信息，删除本地订单及其对应的标签
	 * @param trainInvoice
	 */
	public void deleteTrainInvoiceById(TrainInvoiceBean trainInvoice);

	public TrainInvoiceBean getTrainInvoice(Cursor cursor);

}
