春风项目四线(合箱线、总装线)
懒羊羊
2024-01-24 5fc5876a94dcbd5e9a9fb91f5e3c01211e9c2d96
jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/controller/OmProductionOrdeInfoController.java
@@ -7,6 +7,8 @@
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.jcdm.main.bs.modelNumber.domain.BsModelNumber;
import com.jcdm.main.bs.modelNumber.service.IBsModelNumberService;
import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling;
import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService;
import com.jcdm.main.om.productionOrde.domain.OmProductionOrdeInfo;
@@ -47,6 +49,9 @@
    @Autowired
    private IBsOrderSchedulingService bsOrderSchedulingService;
    @Autowired
    private IBsModelNumberService bsModelNumberService;
    /**
     * 查询生产工单列表
@@ -106,24 +111,43 @@
        DateTimeFormatter formatter= DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        //将时间转化为对应格式的字符串
        String fomateDate=date.format(formatter).toString();
        Integer startCode = Integer.parseInt(omProductionOrdeInfo.getStartCode());//开始编号
        Integer planQty = Math.toIntExact(omProductionOrdeInfo.getPlanQty());//计划数量
        String dateTimeRule = omProductionOrdeInfo.getDateTimeRule();
        for(int i=0;i<planQty;i++){
            BsOrderScheduling bsOrderScheduling = new BsOrderScheduling();
            bsOrderScheduling.setOrderNo(omProductionOrdeInfo.getWorkOrderNo());
            bsOrderScheduling.setModel(omProductionOrdeInfo.getTypeZ());
            bsOrderScheduling.setEngineNo(omProductionOrdeInfo.getTypeZ() + " "+dateTimeRule+ StringUtils.leftPad(String.valueOf(startCode),3, "0"));
            bsOrderScheduling.setProductionStatus("1");
            bsOrderScheduling.setOperator(getUserName());
            bsOrderScheduling.setOperateTime(fomateDate);
            bsOrderSchedulingService.insertBsOrderScheduling(bsOrderScheduling);
            startCode ++;
        }
        String engineNo = "";
        if(planQty>0) {
            for (int i = 0; i < planQty; i++) {
                engineNo = omProductionOrdeInfo.getTypeZ() + " " + dateTimeRule + StringUtils.leftPad(String.valueOf(startCode), 3, "0");
                BsOrderScheduling bsOrderScheduling = new BsOrderScheduling();
                bsOrderScheduling.setOrderNo(omProductionOrdeInfo.getWorkOrderNo());
                bsOrderScheduling.setModel(omProductionOrdeInfo.getTypeZ());
                bsOrderScheduling.setEngineNo(engineNo);
                bsOrderScheduling.setProductionStatus("1");
                bsOrderScheduling.setOperator(getUserName());
                bsOrderScheduling.setOperateTime(fomateDate);
                bsOrderScheduling.setProductType(omProductionOrdeInfo.getTypeL());//产品类型
                bsOrderScheduling.setWhetherOrPrint("0");
                bsOrderSchedulingService.insertBsOrderScheduling(bsOrderScheduling);
                startCode++;
            }
        omProductionOrdeInfo.setOrderStatus("2");//更新工单状态
            //新增机型序号
            BsModelNumber bsModelNumber = new BsModelNumber();
            bsModelNumber.setModel(omProductionOrdeInfo.getTypeZ());
            bsModelNumber.setModelDate(dateTimeRule);
            bsModelNumber.setMaxnumValue((startCode - 1) + "");
            bsModelNumber.setSaveTime(fomateDate);
            bsModelNumber.setLastNumber((startCode - 1) + "");
            bsModelNumberService.insertBsModelNumber(bsModelNumber);
        }
        //更新工单状态
        omProductionOrdeInfo.setOrderStatus("2");
        return toAjax(omProductionOrdeInfoService.updateOmProductionOrdeInfo(omProductionOrdeInfo));
    }
    /**
@@ -159,12 +183,23 @@
    }
    /**
     * table列上移下移
     * 接收工单
     */
    @PreAuthorize("@ss.hasPermi('om:productionOrde:receive')")
    @GetMapping("/getProductionNotice")
    public AjaxResult getProductionNotice(OmProductionOrdeInfo omProductionOrdeInfo)
    {
        ReceivingServices.insertWebserviceData(omProductionOrdeInfo.getProductionNotice());
        return AjaxResult.success();
        String productionNotice = omProductionOrdeInfo.getProductionNotice();
        List<OmProductionOrdeInfo> omProductionOrdeInfos = omProductionOrdeInfoService.selectOmProductionOrdeInfoList(omProductionOrdeInfo);
        if(omProductionOrdeInfos.size() == 0){
            try {
                ReceivingServices.insertWebserviceData(productionNotice);
            } catch (Exception e) {
                return error("接收失败!请检查通知单号");
            }
        }else {
            return warn("该通知单已经接收完毕,不能重复接收!");
        }
        return AjaxResult.success("接收成功!");
    }
}