admin
2024-07-12 ddb65a64a50e3304dc14ae4a19677e2924c808ed
jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/controller/OmProductionOrdeInfoController.java
@@ -141,7 +141,7 @@
        if(code.equals("success")){
            logger.info("请求工厂MES工单:入参pack{}出参pack:{}",paramProductNum,dataObject.getStr("productNum"));
            List<OmProductionOrdeInfo> check = omProductionOrdeInfoService.list(new LambdaQueryWrapper<OmProductionOrdeInfo>().eq(OmProductionOrdeInfo::getProductNum,dataObject.getStr("productNum")));
            if(check.size() == 0){
            if(check.isEmpty()){
                try {
                    log.info("请求工厂MES工单:入参pack{}出参pack:{}", paramProductNum, dataObject.getStr("productNum"));
                    OmProductionOrdeInfo omProductionOrdeInfo = new OmProductionOrdeInfo();
@@ -156,12 +156,15 @@
                    omProductionOrdeInfo.setCreateTime(new Date());
                    omProductionOrdeInfo.setCreateUser("工厂MES");
                    omProductionOrdeInfoService.save(omProductionOrdeInfo);
                    //写PLC
                    miloService.writeToOpcUa(ReadWriteEntity.builder().identifier("MOZU1." + paramOrder.getLineCode() + ".MES_WorkOrderNumber").value(dataObject.getStr("productionOrderNum")).build());
                    miloService.writeToOpcUa(ReadWriteEntity.builder().identifier("MOZU1." + paramOrder.getLineCode() + ".MES_ModuleCode").value(dataObject.getStr("productNum")).build());
                    miloService.writeToOpcUa(ReadWriteEntity.builder().identifier("MOZU1." + paramOrder.getLineCode() + ".WorkOrderNumber").value(dataObject.getStr("productionOrderNum")).build());
                    miloService.writeToOpcUa(ReadWriteEntity.builder().identifier("MOZU1." + paramOrder.getLineCode() + ".ModuleCode").value(dataObject.getStr("productNum")).build());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }else{
                return AjaxResult.error("工单重复,请重新接收");
            }
        }else {
            return AjaxResult.error("接单失败,请联系管理员");