|
@@ -2,15 +2,20 @@ package com.github.zuihou.business.productionResourceCenter.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.github.zuihou.authority.service.common.DictionaryItemService;
|
|
|
import com.github.zuihou.business.DemoLine.DemoLineConstant;
|
|
|
import com.github.zuihou.business.operationManagementCenter.dao.TTaskMapper;
|
|
|
+import com.github.zuihou.business.operationManagementCenter.dao.TaskNodeMapper;
|
|
|
import com.github.zuihou.business.operationManagementCenter.dao.WorkpieceMapper;
|
|
|
import com.github.zuihou.business.operationManagementCenter.entity.TTask;
|
|
|
import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
|
|
|
+import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
|
|
|
import com.github.zuihou.business.operationManagementCenter.service.OrderService;
|
|
|
import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.dao.BBomMapper;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.entity.BBom;
|
|
|
import com.github.zuihou.business.productionResourceCenter.dao.ZZoneMapper;
|
|
|
import com.github.zuihou.business.productionResourceCenter.dao.ZZoneProductionresourceMapper;
|
|
|
import com.github.zuihou.business.productionResourceCenter.dto.ZZoneSaveDTO;
|
|
@@ -23,6 +28,7 @@ import com.github.zuihou.business.productionResourceCenter.service.ZZoneProducti
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
|
|
|
import com.github.zuihou.base.service.SuperServiceImpl;
|
|
|
|
|
|
+import com.github.zuihou.business.util.DynamicRabbitMq;
|
|
|
import com.github.zuihou.common.constant.BizConstant;
|
|
|
import com.github.zuihou.common.constant.CacheKey;
|
|
|
import com.github.zuihou.common.constant.CodeRuleModule;
|
|
@@ -99,9 +105,18 @@ public class ZZoneServiceImpl extends SuperServiceImpl<ZZoneMapper, ZZone> imple
|
|
|
@Autowired
|
|
|
private TTaskMapper taskMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TaskNodeMapper taskNodeMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BBomMapper bomMapper;
|
|
|
+
|
|
|
@Autowired
|
|
|
private WorkpieceService workpieceService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DynamicRabbitMq dynamicRabbitMq;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ProductionresourceviewMapper productionresourceviewMapper;
|
|
|
|
|
@@ -142,15 +157,59 @@ public class ZZoneServiceImpl extends SuperServiceImpl<ZZoneMapper, ZZone> imple
|
|
|
|
|
|
updateById(zZone);
|
|
|
|
|
|
+// //重新排产
|
|
|
+// orderService.reschedulingPlanTasks();
|
|
|
+//
|
|
|
+// //修改workpiece当前正在执行的工序
|
|
|
+// //先查出
|
|
|
+// List<TWorkpiece>workpieceList = workpieceService.list(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getIsEnd, "0"));
|
|
|
+//
|
|
|
+// if(CollectionUtil.isNotEmpty(workpieceList)){
|
|
|
+// workpieceList.stream().map((t) -> {
|
|
|
+// t.setExchangeProcedureId(t.getProcedureId());
|
|
|
+// t.setExchangeZoneFlag("1");
|
|
|
+// return t;
|
|
|
+// }).collect(Collectors.toList());
|
|
|
+//
|
|
|
+// workpieceService.saveBatch(workpieceList);
|
|
|
+// }
|
|
|
+ return zZone;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ZZone changeZone(ZZoneUpdateDTO data) {
|
|
|
+ ZZone zZone = BeanPlusUtil.toBean(data, ZZone.class);
|
|
|
+ ZZone oriZone = baseMapper.selectById(zZone.getId());
|
|
|
+
|
|
|
+ String oriRunMode = oriZone.getRunMode();
|
|
|
+ String runMode = zZone.getRunMode();
|
|
|
+ isFalse(oriRunMode.equals(runMode), "切换的产线不能和原产线雷同");
|
|
|
+
|
|
|
+
|
|
|
+ updateById(zZone);
|
|
|
//重新排产
|
|
|
orderService.reschedulingPlanTasks();
|
|
|
|
|
|
//修改workpiece当前正在执行的工序
|
|
|
- //先查出
|
|
|
- List<TWorkpiece>workpieceList = workpieceService.list(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getIsEnd, "0"));
|
|
|
+ //先查出当前产线的零件
|
|
|
+ List<BBom>bBomList = bomMapper.selectList(Wraps.<BBom>lbQ().eq(BBom::getZoneId, data.getId()));
|
|
|
+
|
|
|
+ List<TWorkpiece>workpieceList = workpieceService.list(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getIsEnd, "0").in(TWorkpiece::getBomId,bBomList));
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(workpieceList)){
|
|
|
workpieceList.stream().map((t) -> {
|
|
|
+ //由手动切换自动,会唤起自动
|
|
|
+ if("2".equals(oriZone.getRunMode())) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ List<TaskNode> taskNodeList = taskNodeMapper.selectList(Wraps.<TaskNode>lbQ().eq(TaskNode::getCompleteBatchNo, t.getCompleteBatchNo()).eq(TaskNode::getExeStatus,"1").orderByAsc(TaskNode::getCompleteBatchSort));
|
|
|
+ TaskNode taskNode = taskNodeList.get(0);
|
|
|
+ jsonObject.put("taskNodeId",taskNode.getId().toString());
|
|
|
+ jsonObject.put("bizType", BizConstant.MQ_TASK_NODE_TYPE_COMMON);
|
|
|
+ log.info("推送mq队列{}消息{}",taskNode.getResourceId().toString(),jsonObject.toString());
|
|
|
+ dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(),jsonObject.toString());
|
|
|
+ }
|
|
|
+
|
|
|
t.setExchangeProcedureId(t.getProcedureId());
|
|
|
t.setExchangeZoneFlag("1");
|
|
|
return t;
|
|
@@ -158,6 +217,7 @@ public class ZZoneServiceImpl extends SuperServiceImpl<ZZoneMapper, ZZone> imple
|
|
|
|
|
|
workpieceService.saveBatch(workpieceList);
|
|
|
}
|
|
|
+
|
|
|
return zZone;
|
|
|
}
|
|
|
|