//package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.busi.bu;
//
//import cn.estsh.i3plus.ext.mes.pcn.api.busi.IWorkOrderProcessBomService;
//import cn.estsh.i3plus.ext.mes.pcn.api.busi.bu.IBuWorkOrderProcessBomService;
//import cn.estsh.i3plus.ext.mes.pcn.pojo.bean.MesProcessBom;
//import cn.estsh.i3plus.ext.mes.pcn.pojo.bean.MesWorkOrderProcessBom;
//import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
//import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
//import cn.estsh.i3plus.platform.common.util.CommonConstWords;
//import cn.estsh.i3plus.pojo.base.common.Pager;
//import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
//import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
//import cn.estsh.impp.framework.base.controller.MesPcnBaseController;
//import cn.estsh.impp.framework.boot.exception.ImppBusiException;
//import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
//import cn.estsh.impp.framework.boot.util.ResultBean;
//import cn.estsh.impp.framework.boot.util.ValidatorBean;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.util.StringUtils;
//import org.springframework.web.bind.annotation.*;
//
///**
// * @Author: xinwang.yi
// * @CreateDate: 2022/09/30 14:46
// * @Description:
// **/
//@RestController
//@RequestMapping(CommonConstWords.BASE_URL_MES_PCN + "/bu")
//@Api(tags = "BU工单工序BOM")
//public class BuWorkOrderProcessBomController extends MesPcnBaseController {
//
//    @Autowired
//    private IBuWorkOrderProcessBomService workOrderProcessBomService;
//
//    @GetMapping(value = "/work-order-process-bom/query")
//    @ApiOperation(value = "按条件分页查询工单工序BOM信息")
//    public ResultBean queryWorkOrderProcessBomByPager(MesWorkOrderProcessBom workOrderProcessBom, Pager pager) {
//        try {
//            ValidatorBean.beginValid(workOrderProcessBom)
//                    .notNull(MesPcnExtConstWords.ORGANIZE_CODE, workOrderProcessBom.getOrganizeCode())
//                    .notNull(MesPcnExtConstWords.WORK_ORDER_NO, workOrderProcessBom.getWorkOrderNo());
//            return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode())
//                    .setListPager(workOrderProcessBomService.queryWorkOrderProcessBomByPager(workOrderProcessBom, pager));
//        } catch (ImppBusiException busExcep) {
//            return ResultBean.fail(busExcep);
//        } catch (Exception e) {
//            return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
//        }
//    }
//
//    @PostMapping(value = "/work-order-process-bom/insert")
//    @ApiOperation(value = "新增工单工序BOM信息")
//    public ResultBean insertWorkOrderProcessBom(MesWorkOrderProcessBom workOrderProcessBom) {
//        try {
//            ValidatorBean.beginValid(workOrderProcessBom)
//                    .notNull(MesPcnExtConstWords.ORGANIZE_CODE, workOrderProcessBom.getOrganizeCode())
//                    .notNull(MesPcnExtConstWords.WORK_ORDER_NO, workOrderProcessBom.getWorkOrderNo())
//                    .notNull(MesPcnExtConstWords.PART_NO, workOrderProcessBom.getPartNo())
//                    .notNull(MesPcnExtConstWords.PART_NAME_RDD, workOrderProcessBom.getPartNameRdd())
//                    .notNull(MesPcnExtConstWords.ITEM_PART_NO, workOrderProcessBom.getItemPartNo())
//                    .notNull(MesPcnExtConstWords.ITEM_PART_NAME, workOrderProcessBom.getItemPartName())
//                    .notNull(MesPcnExtConstWords.PROCESS_CODE, workOrderProcessBom.getProcessCode())
//                    .notNull(MesPcnExtConstWords.PROCESS_NAME, workOrderProcessBom.getProcessName())
//                    .notNull(MesPcnExtConstWords.QTY, workOrderProcessBom.getQty())
//                    .notNull(MesPcnExtConstWords.MODIFY_USER, workOrderProcessBom.getModifyUser());
//
//            workOrderProcessBomService.insertWorkOrderProcessBom(workOrderProcessBom);
//            return ResultBean.success("添加成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
//        } catch (ImppBusiException busExcep) {
//            return ResultBean.fail(busExcep);
//        } catch (Exception e) {
//            return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
//        }
//    }
//
//    @PostMapping(value = "/work-order-process-bom/update")
//    @ApiOperation(value = "更新工单工序BOM信息")
//    public ResultBean updateWorkOrderProcessBom(MesWorkOrderProcessBom workOrderProcessBom) {
//        try {
//            ValidatorBean.beginValid(workOrderProcessBom)
//                    .notNull(MesPcnExtConstWords.ID, workOrderProcessBom.getId())
//                    .notNull(MesPcnExtConstWords.QTY, workOrderProcessBom.getQty())
//                    .notNull(MesPcnExtConstWords.MODIFY_USER, workOrderProcessBom.getModifyUser());
//
//            workOrderProcessBomService.updateWorkOrderProcessBom(workOrderProcessBom);
//            return ResultBean.success("修改成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
//        } catch (ImppBusiException busExcep) {
//            return ResultBean.fail(busExcep);
//        } catch (Exception e) {
//            return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
//        }
//    }
//
//    @PutMapping(value = "/work-order-process-bom/status-update")
//    @ApiOperation(value = "根据id启用或禁用工单工序BOM信息")
//    public ResultBean updateWorkOrderProcessBomValidById(Long id, Integer status, String modifyUser) {
//        try {
//            if (StringUtils.isEmpty(id)) {
//                throw ImppExceptionBuilder.newInstance()
//                        .setSystemID(CommonEnumUtil.SOFT_TYPE.MES_PCN.getCode())
//                        .setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
//                        .setErrorDetail("请选择需要操作的资源。")
//                        .build();
//            }
//            workOrderProcessBomService.updateWorkOrderProcessBomValidById(id, status, modifyUser);
//            return ResultBean.success("修改成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
//        } catch (ImppBusiException busExcep) {
//            return ResultBean.fail(busExcep);
//        } catch (Exception e) {
//            return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
//        }
//    }
//
//    @GetMapping(value = "/work-order-process-bom/process-bom/query")
//    @ApiOperation(value = "按条件分页查询查询工序BOM信息集合")
//    public ResultBean queryProcessBomByPager(MesProcessBom processBom, Pager pager, String workOrderNo, String processCode, String partNo) {
//        try {
//            ValidatorBean.beginValid(processBom)
//                    .notNull(MesPcnExtConstWords.ORGANIZE_CODE, processBom.getOrganizeCode())
//                    .notNull(MesPcnExtConstWords.PROCESS_CODE, processBom.getProcessCode())
//                    .notNull(MesPcnExtConstWords.PART_NO, processBom.getPartNo());
//            return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode())
//                    .setListPager(workOrderProcessBomService.queryProcessBomByPager(processBom, pager, workOrderNo, processCode, partNo));
//        } catch (ImppBusiException busExcep) {
//            return ResultBean.fail(busExcep);
//        } catch (Exception e) {
//            return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
//        }
//    }
//
//}
