Browse Source

MES功能处理

oyq28 2 weeks ago
parent
commit
71aa7bb8cf

+ 15 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskNodeServiceImpl.java

@@ -33,6 +33,7 @@ import com.github.zuihou.business.edgeLibrary.service.StockLogService;
 import com.github.zuihou.business.edgeLibrary.service.StorgeService;
 import com.github.zuihou.business.externalApi.dto.ManualInfo;
 import com.github.zuihou.business.externalApi.entity.MesNotice;
+import com.github.zuihou.business.externalApi.entity.MesNoticeLog;
 import com.github.zuihou.business.operationManagementCenter.dao.*;
 import com.github.zuihou.business.operationManagementCenter.dto.TaskNodeCallBackDTO;
 import com.github.zuihou.business.operationManagementCenter.entity.*;
@@ -209,6 +210,9 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
     @Autowired
     private MesNoticeService mesNoticeService;
 
+    @Autowired
+    private MesNoticeLogService mesNoticeLogService;
+
     //总控IP
     private String ZK_ip = "192.168.1.41";
 
@@ -1974,6 +1978,14 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
                         order.setCompleteNum((order.getCompleteNum() == null ? 0 : order.getCompleteNum()) + 1);
                         order.setProduceStatus("3");//完成
                         orderMapper.updateAllById(order);
+                        if(order.getSource().equals("2")){
+                            MesNotice mesNotice = mesNoticeService.getOne(new LbqWrapper<MesNotice>().eq(MesNotice::getBatchNo, order.getBatchNo()).eq(MesNotice::getBuType, "TASKDISTRIBUTE").ne(MesNotice::getStatus, "3").last("limit 1"));
+                            mesNotice.setStatus("3");
+                            mesNoticeService.updateAllById(mesNotice);
+                            MesNoticeLog mesNoticeLog = MesNoticeLog.builder().build();
+                            BeanUtil.copyProperties(mesNotice, mesNoticeLog);
+                            mesNoticeLogService.save(mesNoticeLog);
+                        }
                     }
 
                     //设置计划结束
@@ -3312,7 +3324,10 @@ planId));
             jsonObject.put("srcPosition", currStorage.getId());
             jsonObject.put("targetPostion", "");
             jsonObject.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_METERIAL_CK);
+            Order order = orderMapper.selectById(tTask.getOrderId());
+            taskService.mesProcessReport(order, false);
         }
+
         this.taskNodeCallbackBiz(hisTask, tTask, taskNodeList, lg, jsonObject.toJSONString());
         return R.success("");
     }

+ 10 - 9
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskServiceImpl.java

@@ -1346,10 +1346,11 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
                         //入库
                         jsonObject.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_METERIAL_JIAJU_RK);
                     }
+                    //报工完成上料
+                    this.mesProcessReport(order, true);
                     //节点完成业务
                     taskNodeService.taskNodeCallbackBiz(taskNode, tTask, taskNodeList, lg, jsonObject.toJSONString());
-                    //报工完成下料
-                    this.mesProcessReport(order, true);
+
                 }else if("2".equals(processType)){
                     jsonObject.put(DemoLineConstant.DEMOLINE_STOCK_TYPE,"");
                     // 翻面 根据原型不做出入库操作
@@ -1366,11 +1367,9 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
                     }else{
                         jsonObject.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_METERIAL_CK);
                     }
-                    taskNodeService.taskNodeCallbackBiz(taskNode, tTask, taskNodeList, lg, jsonObject.toJSONString());
-
                     //报工完成下料
                     this.mesProcessReport(order, false);
-
+                    taskNodeService.taskNodeCallbackBiz(taskNode, tTask, taskNodeList, lg, jsonObject.toJSONString());
                 }else if("4".equals(processType)){
                     //热处理上料申请
                     //动态获取指定工装库位
@@ -1418,6 +1417,8 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
                         nextTask.setProcedureOrder(tTask.getProcedureOrder());
                         baseMapper.updateAllById(nextTask);
                     }
+                    //报工完成下料
+                    this.mesProcessReport(order, false);
                     taskNodeService.taskNodeCallbackBiz(taskNode, tTask, taskNodeList, lg, jsonObject.toJSONString());
                 }
             }
@@ -1760,10 +1761,10 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
             if(null == mesNotice) return;
             //报工判断处理
             String hostSystemUrl = parameterService.getValue(ParameterKey.ECSSYSTEMURL, null);
-            String mesTaskCompletionURL = mesNotice.getApiType().equals("QUALITYREPORT")? hostSystemUrl + "/externalApi/qualityResultReport" : hostSystemUrl + "/externalApi/order/mesProcessReports";
+            String mesTaskCompletionURL = mesNotice.getApiType().equals("QUALITYTASK")? hostSystemUrl + "/mesNotice/externalApi/qualityResultReport" : hostSystemUrl + "/mesNotice/externalApi/order/mesProcessReports";
             JSONObject dataInfo = new JSONObject();
             //任务加工结束报工
-            if(mesNotice.getApiType().equals("MESPROCESSREPORT")){
+            if(mesNotice.getApiType().equals("MESTASK")){
                 String status = bool? "KS":"JS";
                 JSONObject acceptPar = JSONObject.parseObject(mesNotice.getAcceptPar());
                 dataInfo.put("finr", "407");
@@ -1775,9 +1776,9 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
                 dataInfo.put("plmenge", acceptPar.getString("plmenge"));
                 dataInfo.put("pnr", mesNotice.getUserCode());
                 dataInfo.put("status", status);
-            }else if(mesNotice.getApiType().equals("QUALITYREPORT") && !bool){
+            }else if(mesNotice.getApiType().equals("QUALITYTASK") && !bool){
                 dataInfo = JSONObject.parseObject(mesNotice.getAcceptPar());
-                OrderQuality orderQuality = orderQualityService.getOne(new LbqWrapper<OrderQuality>().eq(OrderQuality::getOrderId, order.getId()).eq(OrderQuality::getMeasuringReport, "1").last("limit 1"));
+                OrderQuality orderQuality = orderQualityService.getOne(new LbqWrapper<OrderQuality>().eq(OrderQuality::getOrderId, order.getId()).eq(OrderQuality::getMeasuringType, "1").last("limit 1"));
                 JSONArray jsonArray = JSONArray.parseArray(orderQuality.getMeasuringReport());
                 dataInfo.put("resultList", jsonArray);
             }

+ 1 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/util/MsgUtil.java

@@ -380,6 +380,7 @@ public class MsgUtil implements ApplicationContextAware {
                         }
                     }else{
                         //fileContents.add("NG");
+                        orderQuality = OrderQuality.builder().build();
                         orderQuality.setOkFlag("NG");
                         workpiece.setTestResult("0");
                         taskTestUnqualifiedBom.setTestResult("0");

+ 4 - 4
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/externalApi/MesController.java

@@ -175,7 +175,7 @@ public class MesController extends SuperController<MesNoticeService, Long, MesNo
             log.error("质检结果上报失败:" + e);
             return R.fail(e.getMessage());
         }
-        if(!autoPostEnable){
+        if(autoPostEnable){
             mesNotice.setStatus("0");
             baseService.updateById(mesNotice);
             String returnData = msgUtil.httpForPost(instructionUrl, data);
@@ -351,7 +351,7 @@ public class MesController extends SuperController<MesNoticeService, Long, MesNo
         } catch (Exception e) {
             return R.fail(e.getMessage());
         }
-        if(!autoPostEnable){
+        if(autoPostEnable){
             mesNotice.setStatus("0");
             baseService.updateById(mesNotice);
             String returnData = msgUtil.httpForPost(instructionUrl, data);
@@ -382,7 +382,7 @@ public class MesController extends SuperController<MesNoticeService, Long, MesNo
         } catch (Exception e) {
             return R.fail(e.getMessage());
         }
-        if(!autoPostEnable){
+        if(autoPostEnable){
             mesNotice.setStatus("0");
             baseService.updateById(mesNotice);
             String returnData = msgUtil.httpForPost(instructionUrl, data);
@@ -1158,7 +1158,7 @@ public class MesController extends SuperController<MesNoticeService, Long, MesNo
                 .setStatus("1").setSingleTaskFlag(0).setOrderStatus("1").setBatchNo(workOrder.getString("batchNo"));
         //产品编码+ 密级编码 + 批次号 + 工艺版本
         String orderName = "MES_" + workOrder.getString("materialCode") + "_" + workOrder.getString("planSecretLevel").toUpperCase() + "_" + workOrder.getString("batchNo") + "_" + workOrder.getString("processRouteVersion");
-        order.setCustId(0L).setOrderName(orderName).setZoneId(zone.getId()).setAuditStatus("0");
+        order.setCustId(0L).setOrderName(orderName).setZoneId(zone.getId()).setAuditStatus("1");
         orderService.save(order);
 
         OrderProduct orderProduct = OrderProduct.builder().build();