浏览代码

上下料站

姚云青 3 年之前
父节点
当前提交
d2e416d439

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

@@ -26,6 +26,7 @@ import com.github.zuihou.business.edgeLibrary.service.StorgeService;
 import com.github.zuihou.business.operationManagementCenter.dao.*;
 import com.github.zuihou.business.operationManagementCenter.entity.*;
 import com.github.zuihou.business.operationManagementCenter.service.TaskService;
+import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
 import com.github.zuihou.business.productionReadyCenter.dao.*;
 import com.github.zuihou.business.productionReadyCenter.entity.*;
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
@@ -128,6 +129,9 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
     @Autowired
     private AAutoNodeLogMapper autoNodeLogMapper;
 
+    @Autowired
+    private WorkpieceService workpieceService;
+
 
     @Override
     public List<TTask> createTaskByPlan(List<PlanProduct> planProductList, Map<Long,List<BomProcedure>> bomProcedureMap,String taskBatchNo) {
@@ -1048,27 +1052,27 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
             //把当前id存放入缓存
             msgUtil.redis_set(id, id, 1, TimeUnit.HOURS);
 
-            if(null == tTask.getEndTime()) {
-                tTask.setEndTime(Calendar.getInstance().getTime());
-                tTask.setStatus("3");
-                baseMapper.updateById(tTask);
-            }
+//            if(null == tTask.getEndTime()) {
+//                tTask.setEndTime(Calendar.getInstance().getTime());
+//                tTask.setStatus("3");
+//                baseMapper.updateById(tTask);
+//            }
             // 调用rfid读取接口判断rfid里面是否子盘信息,写入原材料信息
             String meterialId = map.get("meterialId").toString();
             String uniqueCode = map.get("uniqueCode").toString();
             // 判断当前工件是否存在夹具,没有夹具stock表插入夹具信息
-            List<StockInfo> stockInfos = stockInfoService.list(Wraps.<StockInfo>lbQ().eq(StockInfo::getCompleteBatchNo, tTask.getCompleteBatchNo()));
-
-            // 先插入夹具信息
-            StockInfo meterialIdStockInfo = new StockInfo();
-            meterialIdStockInfo.setStorgeId(stockInfos.get(0).getStorgeId());
-            meterialIdStockInfo.setLockStatus("1");
-            meterialIdStockInfo.setGoodsType("3");
-            meterialIdStockInfo.setGoodsId(Long.valueOf(meterialId));
-            meterialIdStockInfo.setUniqueCode(String.valueOf(uniqueCode));
-            meterialIdStockInfo.setCompleteBatchNo(tTask.getCompleteBatchNo());
-            stockInfoMapper.insert(meterialIdStockInfo);
-            stockLogService.saveLog(meterialIdStockInfo,BizConstant.STOCK_TYPE_IN);
+//            List<StockInfo> stockInfos = stockInfoService.list(Wraps.<StockInfo>lbQ().eq(StockInfo::getCompleteBatchNo, tTask.getCompleteBatchNo()));
+//
+//            // 先插入夹具信息
+//            StockInfo meterialIdStockInfo = new StockInfo();
+//            meterialIdStockInfo.setStorgeId(stockInfos.get(0).getStorgeId());
+//            meterialIdStockInfo.setLockStatus("1");
+//            meterialIdStockInfo.setGoodsType("3");
+//            meterialIdStockInfo.setGoodsId(Long.valueOf(meterialId));
+//            meterialIdStockInfo.setUniqueCode(String.valueOf(uniqueCode));
+//            meterialIdStockInfo.setCompleteBatchNo(tTask.getCompleteBatchNo());
+//            stockInfoMapper.insert(meterialIdStockInfo);
+//            stockLogService.saveLog(meterialIdStockInfo,BizConstant.STOCK_TYPE_IN);
 
             // 组织参数回调任务完成
             List<AAutoNodeLog> autoNodeLogList = autoNodeLogMapper.selectList(Wraps.<AAutoNodeLog>lbQ().eq(AAutoNodeLog::getTaskNodeId, taskNode.getId()));
@@ -1078,20 +1082,18 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
             //根据任务查出所有的自动化节点
             List<TaskNode> taskNodeList = taskNodeMapper.selectList(Wraps.<TaskNode>lbQ().eq(TaskNode::getCompleteBatchNo, tTask.getCompleteBatchNo()));
 
-            Storge jbwFromStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + tTask.getCompleteBatchNo());
-            //2、取出上下料站
-            Storge sxlzstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.SXLZ + taskNode.getId());
-            jsonObject.put("srcPosition", jbwFromStorge.getId());
-            jsonObject.put("targetPostion", sxlzstorge.getId());
-            jsonObject.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_METERIAL_CRK);
-
-            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + tTask.getCompleteBatchNo(), sxlzstorge, 1, TimeUnit.DAYS);
+//            Storge jbwFromStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + tTask.getCompleteBatchNo());
+//            //2、取出上下料站
+//            Storge sxlzstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.SXLZ + taskNode.getId());
+//            jsonObject.put("srcPosition", jbwFromStorge.getId());
 
+            Storge currstorge = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
+            jsonObject.put("targetPostion", currstorge.getId());
+            //入库
+            jsonObject.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_METERIAL_RK);
             //节点完成业务
             this.taskNodeCallbackBiz(taskNode, tTask, taskNodeList, lg, jsonObject.toJSONString());
 
-            msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_STATUS + "_" + taskNode.getId(), "1");
-
         }
         return  R.success();
     }