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 abacus.springboot.example.api.view.ApiBillHg;
import abacus.springboot.example.api.view.ApiBillHgItem;
import abacus.springboot.example.api.view.ApiBillHgPayment;
import abacus.springboot.example.api.view.ApiJcBill;
import abacus.springboot.example.api.view.ApiJcBillHgSearchItem;
import abacus.springboot.example.api.view.ApiJcBillItem;
import abacus.springboot.example.api.view.ApiJcBillSearch;
import abacus.springboot.example.api.view.ApiReqJcBill;
import abacus.springboot.example.api.view.JcBillCount;
import abacus.springboot.example.api.view.JcCodeFlow;
import abacus.springboot.example.api.view.JcProduct;
import abacus.springboot.example.api.view.JcProductBillSouce;
import abacus.springboot.example.dao.JcBill;
import abacus.springboot.example.dao.JcBillHg;
import abacus.springboot.example.dao.JcBillHgPay;
import abacus.springboot.example.dao.JcBillInItem;
import abacus.springboot.example.dao.JcBillPhoto;
import abacus.springboot.example.dao.JcBillSourceItem;
import abacus.springboot.example.dao.JcSourceItem;

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

	/**
	 * 	稽查收货查询
	 * @param keyword
	 * @param status
	 * @param pageable
	 * @return
	 * @throws RuntimeException
	 */
	public Page<ApiJcBillSearch> queryApiJcBillSearch(String keyword, String employee, String status, Pageable pageable) throws RuntimeException;


	/**
	 * 	稽查收货主单查询
	 * @param id
	 * @return
	 * @throws RuntimeException
	 */
	public ApiJcBill queryApiJcBillById(String id) throws RuntimeException;
	
	/**
	 * 	稽查收货明细
	 * @param billId
	 * @return
	 * @throws RuntimeException
	 */
	public List<ApiJcBillItem> queryApiJcBillItemByBIllId(String billId) throws RuntimeException;
	
	/**
	 * 	根据条件查询图片
	 * @param srcid
	 * @param srcitemid
	 * @param typephoto
	 * @return
	 * @throws RuntimeException
	 */
	public Map<String, List<JcBillPhoto>> queryJcBillPhoto(String srcid) throws RuntimeException;
	
	/**
	 * 	根据条件查询图片
	 * @param srcid
	 * @param srcitemid
	 * @param typephoto
	 * @return
	 * @throws RuntimeException
	 */
	public Map<String, List<JcBillPhoto>> queryJcBillPhotoIn(List<String> srcids) throws RuntimeException;

	/**
	 * 保存
	 * @param reqJcBill
	 * @param jcBill
	 * @param createItems
	 * @return
	 * @throws RuntimeException
	 */
	public ApiReqJcBill saveApiReqJcBill(ApiReqJcBill reqJcBill, JcBill jcBill, List<JcBillSourceItem> createItems) throws RuntimeException;
	
	/**
	 * 修改
	 * @param reqJcBill
	 * @param jcBill
	 * @param createItems
	 * @param updateItems
	 * @return
	 * @throws RuntimeException
	 */
	public ApiReqJcBill updateApiReqJcBill(ApiReqJcBill reqJcBill, JcBill jcBill, List<JcBillSourceItem> createItems, List<JcBillSourceItem> updateItems) throws RuntimeException;

	/**
	 * 当前明细行号
	 * @param billId
	 * @return
	 * @throws RuntimeException
	 */
	public int countJcBillItemIndexno(String billId) 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 id
	 * @return
	 * @throws RuntimeException
	 */
	public JcBillSourceItem queryJcBillSourceItembyId(Long id) throws RuntimeException;
	
	/**
	 * 查询o
	 * @param id
	 * @return
	 * @throws RuntimeException
	 */
	public JcBillInItem queryJcBillInItemById(Long id) throws RuntimeException;
	
	/**
	 * 修改状态:待提交>>>待溯源
	 * @param jcBill
	 * @throws RuntimeException
	 */
	public void updateStatusJcBill(JcBill jcBill, int oldStatus) throws RuntimeException;
	
	
	/**
	 * 	回购列表查询
	 * @param keyword
	 * @param status
	 * @param pageable
	 * @return
	 * @throws RuntimeException
	 */
	public Page<ApiJcBillHgSearchItem> queryApiJcBillHgSearchItem(String keyword, String employee, String status, Pageable pageable) throws RuntimeException;

	
	/**
	 * 回购；查询品种和件数汇总
	 * @param ids
	 * @return
	 * @throws RuntimeException
	 */
	public Map<String, JcBillCount> queryJcBillCount(List<String> ids) throws RuntimeException;
	
	/**
	 * 	回购：主单查询
	 * @param id
	 * @return
	 * @throws RuntimeException
	 */
	public ApiBillHg queryApiBillHgById(String hgId) throws RuntimeException;

	/**
	 * 	回购：明细查询
	 * @param billId
	 * @return
	 * @throws RuntimeException
	 */
	public List<ApiBillHgItem> queryApiBillHgItemByHgId(String hgId) throws RuntimeException;

	/**
	 * 	回购：支付明细查询
	 * @param billId
	 * @return
	 * @throws RuntimeException
	 */
	public List<ApiBillHgPayment> queryApiBillHgPaymentByHgId(String hgId) throws RuntimeException;
	
	public List<ApiBillHgPayment> queryApiBillHgPaymentByHgId(List<String> hgIds) throws RuntimeException;
	
	/**
	 * 查询
	 * @param billHg
	 * @return
	 * @throws RuntimeException
	 */
	public JcBillHg queryJcBillHg(String billHg) throws RuntimeException;
	
	/**
	 * 修改
	 * @param bill
	 * @throws RuntimeException
	 */
	public void updateJcBillHg(JcBillHg entity, List<JcBillHgPay> pays) throws RuntimeException;
	
	/**
	 * 查询图片
	 * @param srcid
	 * @param srcitemid
	 * @param typephoto
	 * @return
	 * @throws RuntimeException
	 */
	public JcBillPhoto queryJcBillPhoto(String srcid, String srcitemid, String typephoto) throws RuntimeException;
	
	/**
	 * 查询图片
	 * @param srcid
	 * @param srcitemid
	 * @param typephoto
	 * @return
	 * @throws RuntimeException
	 */
	public List<JcBillPhoto> queryJcBillPhoto(String srcid, String typephoto) throws RuntimeException;
	
	/**
	 * 删除或保存图片
	 * @param photos
	 * @param billHg
	 * @throws RuntimeException
	 */
	public void saveAndDeletePhoto(List<JcBillPhoto> photos, JcBillHg billHg) throws RuntimeException;
	
	/**
	 * 删除或保存图片
	 * @param photos
	 * @param billHg
	 * @throws RuntimeException
	 */
	public void saveAndDeletePhoto(List<JcBillPhoto> photos, String billId) throws RuntimeException;
	
	/**
	 * 查询：下一单待提交的回购单号
	 * @return
	 * @throws RuntimeException
	 */
	public String lastBillHgId() throws RuntimeException;
	
	/**
	 * 	根据物流码，查询出库相关信息
	 * @param code
	 * @return
	 * @throws RuntimeException
	 */
	public List<JcCodeFlow> queryJcCodeFlow(List<String> codes) throws RuntimeException;
	
	/**
	 * 	查询朔源明细
	 * @param billId
	 * @return
	 */
	public List<JcSourceItem> queryJcSourceItemByBillId(String billId) throws RuntimeException;
	
	/**
	 * 	更新收货明细，以及保存溯源明细
	 * @param items
	 * @param sourceItems
	 * @throws RuntimeException
	 */
	public void saveJcSourceItem(List<JcBillSourceItem> items, List<JcSourceItem> sourceItems, JcBill jcBill) throws RuntimeException;

	/**
	 *	 查询图片
	 * @param srcid
	 * @param srcitemid
	 * @param typephoto
	 * @return
	 * @throws RuntimeException
	 */
	public JcBillPhoto queryJcBillPhotoById(String id) throws RuntimeException;
	
	/**
	 * 	删除图片
	 * @param entity
	 * @throws RuntimeException
	 */
	public void deleteJcBillPhotoById(JcBillPhoto entity) throws RuntimeException;
	
	/**
	 * 删除订单详情以及对应的图片
	 * @param billid
	 * @param itemid
	 * @throws RuntimeException
	 */
	public void deleteJcSourceItem(String billid, String itemid) throws RuntimeException;
	
	/**
	 * 	获取百度token
	 * @return
	 * @throws RuntimeException
	 */
	public String getBaiduToken() throws RuntimeException;
	
	/**
	 * 	稽查货品查询-单号查询
	 * @param product
	 * @param stockInId
	 * @param hgId
	 * @return
	 * @throws RuntimeException
	 */
	public List<JcProduct> queryJcProduct(String product, String stockInId, String hgId) throws RuntimeException;
	
	/**
	 * 	稽查货品查询-单号查询
	 * @param product
	 * @param stockInId
	 * @param hgId
	 * @return
	 * @throws RuntimeException
	 */
	public List<JcProduct> queryJcProduct(String product, String stockInId) throws RuntimeException;
	
	/**
	 * 	根据稽查单号，查询对应的货品编号
	 * @param billIds
	 * @return
	 * @throws RuntimeException
	 */
	public Map<String, List<JcProductBillSouce>> queryJcProductBillSouce(List<String> billIds)throws RuntimeException;
	
	/**
	 * 	修改状态
	 * @param jcBill
	 * @throws RuntimeException
	 */
	public void updateStatusByJcBill(JcBill jcBill, int status) throws RuntimeException;
	
	public List<JcBillHg> qeryJcBillHgs(List<String> billids) throws RuntimeException;
}










