Forráskód Böngészése

Mes报工数据集成

oyq28 2 hete
szülő
commit
66195858cd

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

@@ -14,7 +14,9 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.beust.jcommander.internal.Maps;
 import com.github.zuihou.authority.dto.priority.TaskNodePriorityDto;
+import com.github.zuihou.authority.service.common.ParameterService;
 import com.github.zuihou.base.R;
 import com.github.zuihou.base.service.SuperServiceImpl;
 import com.github.zuihou.business.DemoLine.DemoCacheKey;
@@ -30,6 +32,7 @@ import com.github.zuihou.business.edgeLibrary.service.StockInfoService;
 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.operationManagementCenter.dao.*;
 import com.github.zuihou.business.operationManagementCenter.dto.TaskNodeCallBackDTO;
 import com.github.zuihou.business.operationManagementCenter.entity.*;
@@ -49,10 +52,7 @@ import com.github.zuihou.business.util.DynamicRabbitMq;
 import com.github.zuihou.business.util.ManualTaskOperatorUtil;
 import com.github.zuihou.business.util.MsgUtil;
 import com.github.zuihou.business.util.ZplPrinter;
-import com.github.zuihou.common.constant.BizConstant;
-import com.github.zuihou.common.constant.CacheKey;
-import com.github.zuihou.common.constant.CodeRuleModule;
-import com.github.zuihou.common.constant.DictionaryKey;
+import com.github.zuihou.common.constant.*;
 import com.github.zuihou.common.util.DateUtil;
 import com.github.zuihou.common.util.StringUtil;
 import com.github.zuihou.context.BaseContextHandler;
@@ -206,6 +206,9 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
     @Autowired
     private StockLogService stockLogService;
 
+    @Autowired
+    private MesNoticeService mesNoticeService;
+
     //总控IP
     private String ZK_ip = "192.168.1.41";
 
@@ -249,6 +252,9 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
     @Autowired
     private CutterTestDataService cutterTestDataService;
 
+    @Autowired
+    private ParameterService  parameterService;
+
     private static Logger logger = LoggerFactory.getLogger(TaskNodeServiceImpl.class);
 
     //获取子二级节点
@@ -1968,6 +1974,19 @@ 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()).last("limit 1"));
+                            //报工判断处理
+                            String hostSystemUrl = parameterService.getValue(ParameterKey.ECSSYSTEMURL, null);
+                            String mesTaskCompletionURL = mesNotice.getApiType().equals("QUALITYREPORT")? hostSystemUrl + "/externalApi/qualityResultReport" : hostSystemUrl + "/externalApi/order/mesProcessReports";
+                            Map<String, String> map = Maps.newHashMap();
+                            if(mesNotice.getApiType().equals("QUALITYREPORT")){
+
+                            }else{
+
+                            }
+                            msgUtil.httpForPost(mesTaskCompletionURL, JSONObject.toJSONString(map));
+                        }
                     }
 
                     //设置计划结束

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

@@ -136,6 +136,7 @@ public class MesController extends SuperController<MesNoticeService, Long, MesNo
                 lineCode("407109").
                 status("1").
                 userCode(threeCoordinateDto.getUserCode()).
+                batchNo(threeCoordinateDto.getBatchNo()).
                 source("数字化检测系统").
                 targetSource("产线管控单元").
                 acceptPar(data).build();
@@ -163,6 +164,7 @@ public class MesController extends SuperController<MesNoticeService, Long, MesNo
                 lineCode("407109").
                 status("1").
                 userCode(threeCoordinateDto.getUserCode()).
+                batchNo(threeCoordinateDto.getBatchNo()).
                 source("产线管控单元").
                 targetSource("数字化检测系统").
                 apiAddress(instructionUrl).
@@ -301,7 +303,7 @@ public class MesController extends SuperController<MesNoticeService, Long, MesNo
             StringBuilder stringBuilder = new StringBuilder();
             jsonArray.stream().forEach(item->{
                 JSONObject jsonObject = (JSONObject) JSONObject.toJSON(item);
-                MesNotice mesNotice = MesNotice.builder().orderNo(jsonObject.getString("auidnr")).userCode(jsonObject.getString("userno")).
+                MesNotice mesNotice = MesNotice.builder().orderNo(jsonObject.getString("auidnr")).userCode(jsonObject.getString("userno")).batchNo(jsonObject.getString("batchno")).
                         buType("TASKDISTRIBUTE").lineCode("407109").status("1").source("智能总控系统").apiType("MESTASK").apiSort(jsonObject.getInteger("prio"))
                         .targetSource("产线管控单元").acceptPar(jsonObject.toJSONString()).build();
                 if(!baseService.checkExists(mesNotice)) {

+ 11 - 1
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/externalApi/entity/MesNotice.java

@@ -131,9 +131,18 @@ public class MesNotice extends Entity<Long> {
     @Excel(name = "接受任务数据")
     private String acceptPar;
 
+    /**
+     * 产线编码
+     */
+    @ApiModelProperty(value = "批次号")
+    @Length(max = 128, message = "批次号长度不能超过128")
+    @TableField(value = "bath_no", condition = LIKE)
+    @Excel(name = "批次号")
+    private String batchNo;
+
 
     @Builder
-    public MesNotice(Long id, LocalDateTime createTime, Long createUser, LocalDateTime updateTime, Long updateUser, String buType, String lineCode, String apiAddress, String apiType, int apiSort, String orderNo, String status, String orderInfo,String source, String targetSource, String acceptPar, String  userCode) {
+    public MesNotice(Long id, LocalDateTime createTime, Long createUser, LocalDateTime updateTime, Long updateUser, String buType, String lineCode, String apiAddress, String apiType, int apiSort, String orderNo, String status, String orderInfo,String source, String targetSource, String acceptPar, String  userCode, String batchNo) {
         super(id, createTime, createUser, updateTime, updateUser);
         this.id = id;
         this.buType = buType;
@@ -148,5 +157,6 @@ public class MesNotice extends Entity<Long> {
         this.targetSource = targetSource;
         this.acceptPar = acceptPar;
         this.userCode = userCode;
+        this.batchNo = batchNo;
     }
 }