package nc.itf.bd.bom.bom0202;

import nc.vo.bd.bom.bom0202.entity.AggBomVO;
import nc.vo.pub.BusinessException;

import java.util.Map;

/**
 * <b> 生产bom维护的持久化接口 </b>
 * <p>
 * 继承自默认的IAggMaintainService
 * </p>
 * 创建日期:2010-1-15 有事务的服务
 *
 * @author:zhoujuna
 */
public interface IBomBillMaintainService {
    /**
     * BOM批量删除接口
     *
     * @param aggvos
     * @throws BusinessException
     */
    void deleteBoms(AggBomVO[] aggvos) throws BusinessException;

    /**
     * BOM新增接口
     *
     * @param aggvos 新增BOM数组
     * @return 保存后的BOM
     * @throws BusinessException
     */
    AggBomVO[] insertBom(AggBomVO[] aggvos) throws BusinessException;

    /**
     * BOM新增接口（带参数：是否支持ECN，是否支持审批流）
     *
     * @param aggvos
     * @param isCheckEcn
     * @param isOnApprove
     * @return
     * @throws BusinessException
     */
    AggBomVO[] insertBomWithParam(AggBomVO[] aggvos, boolean isCheckEcn, boolean isOnApprove) throws BusinessException;


    AggBomVO[] insertCommitBomWithParam(AggBomVO[] aggvos, boolean isCheckEcn, boolean isOnApprove) throws BusinessException;
    AggBomVO[] insertCommitBomWithParam_RequiresNew(AggBomVO[] aggvos, boolean isCheckEcn, boolean isOnApprove) throws BusinessException;

    /**
     * BOM修改接口
     *
     * @param aggvos 修改BOM数组
     * @return 保存后的BOM数组
     * @throws BusinessException
     */
    AggBomVO[] updateBom(AggBomVO[] aggvos) throws BusinessException;

    /**
     * BOM修改接口 （带参数：是否支持ECN；是否支持审批流）
     *
     * @param aggvos
     * @return
     * @throws BusinessException
     */
    AggBomVO[] updateBomWithParam(AggBomVO[] aggvos, boolean isFromBom, boolean isecn, boolean isCheckEcn,
                                  boolean isOnApprove) throws BusinessException;

    AggBomVO[] updateCommitBomWithParam(AggBomVO[] aggvos, boolean isFromBom, boolean isecn, boolean isCheckEcn,
                                        boolean isOnApprove) throws BusinessException;

    /**
     * Bom提供给工程变更单的对话框在点击确定后进行数据校验
     *
     * @param aggvos
     * @throws BusinessException
     */
    void validateBom(AggBomVO[] aggvos) throws BusinessException;

    /**
     * BOM新增接口,是否需要考虑检查启用工程变更
     *
     * @param aggvos
     * @param checkEcn
     * @return
     * @throws BusinessException
     */
    AggBomVO[] insertBomForEcn(AggBomVO[] aggvos, boolean checkEcn) throws BusinessException;

    /**
     * BOM新增接口,是否需要考虑检查启用工程变更,替代方案替代物料是否分配
     *
     * @param aggvos
     * @param checkEcn
     * @return
     * @throws BusinessException
     */
    AggBomVO[] insertBomForEcnAndRepls(AggBomVO[] aggvos, boolean checkEcn, String[] orgins) throws BusinessException;

    /**
     * BOM修改接口,是否需要考虑检查启用工程变更
     *
     * @param aggvos 修改BOM数组
     * @return 保存后的BOM数组
     * @throws BusinessException
     */
    AggBomVO[] updateBomForEcn(AggBomVO[] aggVO, boolean checkEcn) throws BusinessException;

    AggBomVO[] updateBomForEcn(AggBomVO[] aggVO, Map<String,String> rownoMap, boolean checkEcn) throws BusinessException;


    /**
     * BOM修改接口,是否需要考虑来自bom和bomtree修改保存
     *
     * @param aggVO           修改BOM数组
     * @param 保存时是否判断启用工程变更
     * @param 是否来自bom
     * @param 界面录入的组织是否启用工程变更
     * @return 保存后的BOM数组
     * @throws BusinessException
     */
    AggBomVO[] updateBomForBomTree(AggBomVO[] aggVO, boolean checkEcn, boolean isFromBom, boolean isEcn)
            throws BusinessException;

    AggBomVO[] updateBomForBomTree(AggBomVO[] aggVO,Map<String,String> rownoMap,  boolean checkEcn, boolean isFromBom, boolean isEcn)
            throws BusinessException;

    /**
     * 提交BOM
     *
     * @param clientFullVOs
     * @param originBills
     * @return
     * @throws BusinessException
     */
    public AggBomVO[] commitBom(AggBomVO[] clientFullVOs, AggBomVO[] originBills) throws BusinessException;

    /**
     * 收回BOM
     *
     * @param clientFullVOs
     * @param originBills
     * @return
     * @throws BusinessException
     */
    public AggBomVO[] uncommitBom(AggBomVO[] clientFullVOs, AggBomVO[] originBills) throws BusinessException;

    /**
     * 审批BOM
     *
     * @param clientFullVOs
     * @param originBills
     * @return
     * @throws BusinessException
     */
    public AggBomVO[] auditBom(AggBomVO[] clientFullVOs, AggBomVO[] originBills) throws BusinessException;

    /**
     * 弃审BOM
     *
     * @param clientFullVOs
     * @param originBills
     * @return
     * @throws BusinessException
     */
    public AggBomVO[] unauditBom(AggBomVO[] clientFullVOs, AggBomVO[] originBills) throws BusinessException;

    /**
     * BOM的停用
     *
     * @param aggvos
     * @return
     * @throws BusinessException
     */
    AggBomVO[] seal(AggBomVO[] aggvos) throws BusinessException;

    /**
     * BOM的启用
     *
     * @param aggvos
     * @return
     * @throws BusinessException
     */
    AggBomVO[] unSeal(AggBomVO[] aggvos) throws BusinessException;

    /**
     * BOM批量删除接口(带参数：是否支持ECN，是否支持审批流)
     *
     * @param aggvos
     */
    void deleteBomsWithParam(AggBomVO[] aggvos, boolean isCheckEcn, boolean isOnApprove) throws BusinessException;

    /**
     * 由于业务日志需要，调整跨组织bom复制覆盖原版本走该接口
     *
     * @param aggvos
     * @param origins
     * @param isCheckEcn
     */
    void updateBomForBomCopy0214(AggBomVO[] aggvos, AggBomVO[] origins, boolean isCheckEcn);
    /**
     * 定制BOM删除
     */
    void deleteCustomizedBom(AggBomVO[] aggvos)throws BusinessException;;
}
