package abacus.springboot.example.wsi;

import java.util.List;
import java.util.Map;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import com.alibaba.fastjson.JSONObject;

import abacus.springboot.example.dao.JcBill;
import abacus.springboot.example.dao.JcBillHg;
import abacus.springboot.example.dao.JcBillInItem;
import abacus.springboot.example.dao.JcBillPhoto;
import abacus.springboot.example.dao.JcBillSourceItem;
import abacus.springboot.example.dao.JcSourceItem;
import abacus.springboot.example.vo.SiDepositlocation;

/**
 * <p>Title:JcBillServiceIF</p>
   <p>Description: service服务</p>
   @author chuanZeng 
   @date 2026年8月18日
 */
public interface JcBillServiceIF {

	/**
	 *	 稽查收货查询
	 * @param fromDate
	 * @param thruDate
	 * @param id
	 * @param applicant
	 * @param goods
	 * @param billin
	 * @param goodsid
	 * @param product
	 * @param status
	 * @param pageable
	 * @param typ 1-溯源入库  2-回购通知
	 * @return
	 * @throws RuntimeException
	 */
	public Page<JcBill> queryJcBill(String fromDate, String thruDate, String id,
			String applicant, String goods, String billin, String goodsid, String product,
			String status, int typ, Pageable pageable) throws RuntimeException;
	
	/**
	 * 查询
	 * @param billId
	 * @return
	 * @throws RuntimeException
	 */
	public JcBill queryJcBillById(String billId) throws RuntimeException;
	
	/**
	 * 查询
	 * @param billId
	 * @return
	 * @throws RuntimeException
	 */
	public List<JcBillSourceItem> queryJcBillSourceItemByBillId(String billId) throws RuntimeException;
	
	/**
	 * 查询
	 * @param billHg
	 * @return
	 * @throws RuntimeException
	 */
	public JcBillHg queryJcBillHg(String billHg) throws RuntimeException;
	
	/**
	 * 	查询朔源明细
	 * @param billId
	 * @return
	 */
	public List<JcSourceItem> queryJcSourceItemByBillId(String billId) throws RuntimeException;
	
	/**
	 * 	查询朔源明细
	 * @param billId
	 * @return
	 */
	public List<JcSourceItem> queryJcSourceItemByBillId(String billId, String srcitemid) throws RuntimeException;
	
	/**
	 * 	查询朔源明细
	 * @param billId
	 * @return
	 */
	public List<JcSourceItem> queryJcSourceItemByBillId(String billId, String srcitemid, int status) throws RuntimeException;
	
	
	/**
	 * 	根据条件查询图片
	 * @param srcid
	 * @param srcitemid
	 * @param typephoto
	 * @return
	 * @throws RuntimeException
	 */
	public Map<String, List<JcBillPhoto>> queryJcBillPhoto(String srcid) throws RuntimeException;
	
	/**
	 * 	查询稽查收货明细
	 * @param id
	 * @return
	 * @throws RuntimeException
	 */
	public JcBillSourceItem queryJcBillSourceItemById(Long id) throws RuntimeException;
	
	/**
	 * 	稽查溯源明细
	 * @param id
	 * @return
	 * @throws RuntimeException
	 */
	public JcSourceItem queryJcSourceItemById(Long id) throws RuntimeException;
	
	/**
	 * 	确认溯源
	 * @param billItem
	 * @param sourceItem
	 * @throws RuntimeException
	 */
	public void saveQuerenBillSourceItem(JcBillSourceItem billItem, JcSourceItem sourceItem) throws RuntimeException;
	
	/**
	 * 	溯源信息驳回
	 * @param billItem
	 * @param sourceItem
	 * @throws RuntimeException
	 */
	public void saveRejectJcSourceItems(JcBillSourceItem billItem, JcBill jcBill) throws RuntimeException;
	
	/**
	 * 	溯源完成
	 * @param billItem
	 * @param sourceItem
	 * @throws RuntimeException
	 */
	public void saveCompleteJcBill(List<JcBillInItem> inItems, JcBill jcBill) throws RuntimeException;
	
	/**
	 * 	稽查收货：仓库修改
	 * @param jcBill
	 * @throws RuntimeException
	 */
	public void updateWarehouse(JcBill jcBill) throws RuntimeException;
	
	/**
	 * 
	 * @param billId
	 * @return
	 * @throws RuntimeException
	 */
	public List<JcBillInItem> queryJcBillInItemByBillId(String billId) throws RuntimeException;
	
	public List<JcBillInItem> queryJcBillInItemByBillId(String billId, int status) throws RuntimeException;
	
	/**
	 * 	稽查收货：生成入库单
	 * @param jcBill
	 * @throws RuntimeException
	 */
	public void createStockIn(JcBill jcBill) throws RuntimeException;
	
	/**
	 * 	查询回购单明细
	 * @param id
	 * @return
	 */
	public JcBillInItem queryJcBillInItemById(Long id) throws RuntimeException;
	
	/**
	 * 	终止回购
	 * @param inItem
	 * @throws RuntimeException
	 */
	public void saveTerminateHgInItem(JcBillInItem inItem) throws RuntimeException;
	
	/**
	 * 	批量查询回购单明细
	 * @param ids
	 * @return
	 * @throws RuntimeException
	 */
	public List<JcBillInItem> findAllById(List<Long> ids)  throws RuntimeException;
	
	/**
	 * 	确定通知
	 * @param inItems
	 * @throws RuntimeException
	 */
	public void saveInformHg(List<JcBillInItem> inItems, JcBill jcBill, JcBillHg jcBillHg, String photoUrl) throws RuntimeException;
	
	/**
	 * 	分页查询 回购订单
	 * @param typ 1-回购认款，2-回购分仓
	 * @return
	 * @throws RuntimeException
	 */
	public Page<JcBillHg> queryJcBillHg(String fromDate, String thruDate, String account,
			String salearea, String id, String billId, String status, String product,
			String manager, 
			int typ, Pageable pageable) throws RuntimeException;
	
	/**
	 * 
	 * @param billId
	 * @return
	 * @throws RuntimeException
	 */
	public List<JcBillInItem> queryJcBillInItemByBillHg(String billHgId) throws RuntimeException;
	
	/**
	 * 	回购驳回
	 * @throws RuntimeException
	 */
	public void saveRejectBillHg(int status, int typ, JcBill jcBill, JcBillHg billHg, List<JcBillInItem> inItems) throws RuntimeException;
	
	/**
	 * 	确认收款
	 * @param billHg
	 * @throws RuntimeException
	 */
	public void saveQuerenSk(JcBillHg billHg, boolean fcFlag) throws RuntimeException;
	
	/**
	 * 	分仓
	 * @param billHg
	 * @param fcFlag
	 * @throws RuntimeException
	 */
	public void savecreateFc(JcBillHg billHg) throws RuntimeException;
	
	/**
	 * 	修改分仓仓库
	 * @param oldJsonStr
	 * @param billHg
	 * @throws RuntimeException
	 */
	public void updateFcWarehouse(String oldJsonStr, JcBillHg billHg) throws RuntimeException;
	
	/**
	 * 	修改运营备注
	 * @param oldJsonStr
	 * @param billHg
	 * @throws RuntimeException
	 */
	public void updateRemark(String oldJsonStr, JcBillHg billHg) throws RuntimeException;
	
	/**
	 * 	修改收货地址
	 * @param oldJsonStr
	 * @param billHg
	 * @throws RuntimeException
	 */
	public void updatePac(String oldJsonStr, JcBillHg billHg) throws RuntimeException;
	
	/**
	 * 保存溯源明细信息
	 * @param item
	 * @throws RuntimeException
	 */
	public JcSourceItem saveJcSourceItem(JcSourceItem item) throws RuntimeException;
	
	/**
	 * 删除溯源明细信息
	 * @param ids
	 * @throws RuntimeException
	 */
	public void deleteJcSourceItem(List<Long> ids) throws RuntimeException;
	
	/**
	 * 	修改回购单价
	 * @param inItem
	 * @throws RuntimeException
	 */
	public void updateHgprice(JcBillInItem inItem)throws RuntimeException;
	
	/**
	 * 	修改回购单价
	 * @param inItem
	 * @throws RuntimeException
	 */
	public void updateOperatorname(JcBillInItem inItem, String oldStr)throws RuntimeException;
	
	public void saveJcBillInItem(List<JcBillInItem> items)throws RuntimeException;
	
	public List<JcBillSourceItem> queryJcBillSourceItemInBillId(List<String> billIds) throws RuntimeException;
	
	
	/**
	 * 	待入库撤回
	 * @throws RuntimeException
	 */
	public void saveRejectBill(int status, JcBill jcBill, List<JcBillInItem> inItems, List<JcBillSourceItem> sourceItems) throws RuntimeException;

	/**
	 * 修改溯源信息客户
	 * @param inItems
	 * @throws RuntimeException
	 */
	public void updateSourceItemAccount(String sourceItemLogJson, String billSourceItemLogJson, String billSourceItemNewLogJson, JcSourceItem sourceItem, List<JcBillSourceItem> billSourceItems,
			List<JcBillInItem> oldInItems, List<JcBillInItem> inItems)throws RuntimeException;

	/**
	 * 稽查：根据稽查单号，稽查单关联物理仓管理策略
	 * @param dept
	 * @return
	 * @throws Exception
	 */
	public SiDepositlocation querySiDepositlocation(String srcid) throws Exception;
	
	/**
	 * 回购：根据回购单号，回购单关联物理仓管理策略
	 * @param dept
	 * @return
	 * @throws Exception
	 */
	public SiDepositlocation querySiDepositlocationHGfc(String srcid) throws Exception;
	
	/**
	 * WMS取消订单接口
	 * @param orderCode
	 * @param orderType
	 * @return
	 * @throws Exception
	 */
	public JSONObject gwisSubCancelOrder(String orderCode, String orderType) throws Exception;
}










