Преглед изворни кода

手动版数据结构调整及增加托板的出入库,TODO 待优化,出入库可以和订单改成通用方法

yejian016332 пре 3 година
родитељ
комит
2f432c5f33

+ 2 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/StockInfoService.java

@@ -171,4 +171,6 @@ public interface StockInfoService extends SuperService<StockInfo> {
     LinkedHashMap <String,Map <String,List<Map>>> demoLineAllStock();
 
     R manualStockOut(String goodsId, Long storgeId, String category);
+
+    R procedurePlateStockIn(BigDecimal uniqueCode, Long valueOf, Long storgeId);
 }

+ 17 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/impl/StockInfoServiceImpl.java

@@ -428,7 +428,7 @@ public class StockInfoServiceImpl extends SuperServiceImpl<StockInfoMapper, Stoc
         save(infoBean);
         //库存日志
         stockLogService.saveLog(infoBean,BizConstant.STOCK_TYPE_IN);
-        return R.success("");
+        return R.success();
     }
 
 
@@ -655,4 +655,20 @@ public class StockInfoServiceImpl extends SuperServiceImpl<StockInfoMapper, Stoc
 
         return R.success();
     }
+
+    @Override
+    public R procedurePlateStockIn(BigDecimal uniqueCode, Long goodsId, Long storgeId){
+        StockInfo infoBean = new StockInfo();
+        infoBean.setStorgeId(storgeId);
+        infoBean.setLockStatus("1");
+        infoBean.setGoodsId(goodsId);
+        infoBean.setGoodsType("5");
+        infoBean.setNum(1);
+        infoBean.setUniqueCode(String.valueOf(uniqueCode));
+        infoBean.setCompleteBatchNo("");
+        save(infoBean);
+        //库存日志
+        stockLogService.saveLog(infoBean,BizConstant.STOCK_TYPE_IN);
+        return R.success();
+    }
 }

+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/WorkpieceService.java

@@ -39,7 +39,7 @@ public interface WorkpieceService extends SuperService<TWorkpiece> {
 
     public List getOrderInfo();
 
-    public Map getAllStockInfo();
+    public List getAllStockInfo();
 
     //执行非订单物品
     public String execute(Map map);

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

@@ -27,11 +27,9 @@ import com.github.zuihou.business.operationManagementCenter.service.*;
 import com.github.zuihou.business.productionReadyCenter.dao.*;
 import com.github.zuihou.business.productionReadyCenter.entity.*;
 import com.github.zuihou.business.productionReadyCenter.service.*;
+import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourcePositionMapper;
-import com.github.zuihou.business.productionResourceCenter.entity.ProductionresourceConf;
-import com.github.zuihou.business.productionResourceCenter.entity.ProductionresourcePosition;
-import com.github.zuihou.business.productionResourceCenter.entity.ResourceAutoCode;
-import com.github.zuihou.business.productionResourceCenter.entity.ZZoneProductionresource;
+import com.github.zuihou.business.productionResourceCenter.entity.*;
 import com.github.zuihou.business.productionResourceCenter.service.ProductionresourcePositionService;
 import com.github.zuihou.business.productionResourceCenter.service.ResourceAutoCodeService;
 import com.github.zuihou.business.productionResourceCenter.service.ResourceBusinessService;
@@ -208,6 +206,11 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
     private TrayMapper trayMapper;
     @Autowired
     private MToolClampMapper mToolClampMapper;
+    @Autowired
+    private ProductionresourceBizMapper productionresourceBizMapper;
+    @Autowired
+    private PlateMapper plateMapper;
+
 
     private static Logger logger = LoggerFactory.getLogger(TaskNodeServiceImpl.class);
 
@@ -1643,9 +1646,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
                 System.out.println("returnEndStockList=" + returnEndStockList.size());
                 allReturnList.addAll(returnEndStockList);
 
-                Map<String, Object> retStockInfo = new HashMap<String, Object>();
-                retStockInfo.put("data",allReturnList);
-                HttpEntity<String> formEntity = new HttpEntity<String>(JSON.toJSON(R.success(retStockInfo)).toString(), headers);
+                HttpEntity<String> formEntity = new HttpEntity<String>(JSON.toJSON(R.success(allReturnList)).toString(), headers);
                 //调用接口
                 try {
                     JSONObject returnDataObject = new JSONObject();
@@ -1793,6 +1794,31 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
                         return R.fail("当前夹具数量已用完");
                     }
                     result = stockInfoService.procedureToolClampStockIn(uniqueCode, Long.valueOf(goodsId), list.get(0).getStorgeId());
+                }else if ("5".equals(category)){
+                    // 查询上下料站
+                    List<Productionresource> productionresources = productionresourceBizMapper.selectList(Wraps.<Productionresource>lbQ().like(Productionresource::getName, "上下料站"));
+                    List<Long> resourceIds = productionresources.stream().map(resource -> resource.getId()).collect(Collectors.toList());
+                    if(!resourceIds.contains(Long.valueOf(resourceId))){
+                        return R.fail("托板只能在agv上下料站上存放");
+                    }
+
+                    Plate plate = plateMapper.selectById(goodsId);
+                    String maxPlate = stockInfoMapper.selectMaxNoByProductId(queryMap);
+                    int maxPlateNo = 0;
+                    if(StringUtils.isBlank(maxPlate)){
+                        maxPlateNo = 0;
+                    }else{
+                        maxPlateNo = Integer.parseInt(maxPlate);
+                    }
+                    int sumPlate = stockInfoMapper.selectSumInStockByProductId(queryMap);
+                    BigDecimal uniqueCode;
+                    if(sumPlate < plate.getNumber()){
+                        uniqueCode = BigDecimal.valueOf(maxPlateNo).add(new BigDecimal(1));;
+                    }else{
+                        return R.fail("当前托盘数量已用完");
+                    }
+                    result = stockInfoService.procedurePlateStockIn(uniqueCode, Long.valueOf(goodsId), list.get(0).getStorgeId());
+
                 }
             }
         }

+ 25 - 30
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/WorkpieceServiceImpl.java

@@ -224,7 +224,7 @@ public class WorkpieceServiceImpl extends SuperServiceImpl<WorkpieceMapper, TWor
     }
 
     @Override
-    public Map getAllStockInfo() {
+    public List getAllStockInfo() {
         BaseContextHandler.setTenant("0000");
 
         // 查询产线列表、遍历产线查询设备资源
@@ -266,8 +266,7 @@ public class WorkpieceServiceImpl extends SuperServiceImpl<WorkpieceMapper, TWor
             }
         }
 
-        retStockInfo.put("data",returnList);
-        return retStockInfo;
+        return returnList;
 
     }
 
@@ -298,24 +297,26 @@ public class WorkpieceServiceImpl extends SuperServiceImpl<WorkpieceMapper, TWor
                     m.put("uniqueCode", p.getUniqueCode());
                     m.put("storgeId", p.getStorgeId());
                     m.put("category", p.getCategory());
-                    if ("5".equals(p.getCategory())) {//如果是托板。
-                        List<Map> childL = new ArrayList<>();
-                        //根据托盘ID,找到对应的点位
-                        Map queryMap = new HashMap();
-                        queryMap.put("plateId", p.getGoodsId() == null ? "" : p.getGoodsId().toString());
-                        List<ProductionresourcePosition> childList = productionresourcePositionMapper.getProductlineStockInfo(queryMap);
-                        for (ProductionresourcePosition c : childList) {
-                            Map childMap = new HashMap();
-                            childMap.put("pointId", c.getPointId());
-                            childMap.put("goodsName", c.getGoodsName());
-                            childMap.put("goodsId", c.getGoodsId());
-                            childMap.put("uniqueCode", c.getUniqueCode());
-                            childMap.put("storgeId", c.getStorgeId());
-                            childMap.put("category", c.getCategory());
-                            childL.add(childMap);
-                        }
-                        m.put("childList", childL);
-                    }
+//                    if ("5".equals(p.getCategory())) {//如果是托板。
+//                        List<Map> childL = new ArrayList<>();
+//                        //根据托盘ID,找到对应的点位
+//                        Map queryMap = new HashMap();
+//                        queryMap.put("plateId", p.getGoodsId() == null ? "" : p.getGoodsId().toString());
+//                        queryMap.put("resourceId", p.getResourceId());
+//                        queryMap.put("pointId", p.getPointId());
+//                        List<ProductionresourcePosition> childList = productionresourcePositionMapper.getProductlineStockInfo(queryMap);
+//                        for (ProductionresourcePosition c : childList) {
+//                            Map childMap = new HashMap();
+//                            childMap.put("pointId", c.getPointId());
+//                            childMap.put("goodsName", c.getGoodsName());
+//                            childMap.put("goodsId", c.getGoodsId());
+//                            childMap.put("uniqueCode", c.getUniqueCode());
+//                            childMap.put("storgeId", c.getStorgeId());
+//                            childMap.put("category", c.getCategory());
+//                            childL.add(childMap);
+//                        }
+//                        m.put("childList", childL);
+//                    }
                     l.add(m);
                 }
             }
@@ -416,9 +417,7 @@ public class WorkpieceServiceImpl extends SuperServiceImpl<WorkpieceMapper, TWor
         List<Map> allReturnList = new ArrayList<>();
         List<Map> returnStockList =  processStockInfo(deviceUnit ,resourceId, pointId);
         allReturnList.addAll(returnStockList);
-        Map<String, Object> retStockInfo = new HashMap<String, Object>();
-        retStockInfo.put("data",allReturnList);
-        result.setData(retStockInfo);
+        result.setData(allReturnList);
         return result;
     }
 
@@ -456,10 +455,8 @@ public class WorkpieceServiceImpl extends SuperServiceImpl<WorkpieceMapper, TWor
         List<Map> allReturnList = new ArrayList<>();
         List<Map> returnStockList =  processStockInfo(deviceUnit ,resourceId, pointId);
         allReturnList.addAll(returnStockList);
-        Map<String, Object> retStockInfo = new HashMap<String, Object>();
-        retStockInfo.put("data",allReturnList);
 
-        return R.success(retStockInfo);
+        return R.success(allReturnList);
 
     }
 
@@ -475,9 +472,7 @@ public class WorkpieceServiceImpl extends SuperServiceImpl<WorkpieceMapper, TWor
         List<Map> allReturnList = new ArrayList<>();
         List<Map> returnStockList =  processStockInfo(deviceUnit ,resourceId, pointId);
         allReturnList.addAll(returnStockList);
-        Map<String, Object> retStockInfo = new HashMap<String, Object>();
-        retStockInfo.put("data",allReturnList);
-        result.setData(retStockInfo);
+        result.setData(allReturnList);
         return result;
     }
 

+ 2 - 2
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/operationManagementCenter/WorkpieceController.java

@@ -148,8 +148,8 @@ public class WorkpieceController extends SuperController<WorkpieceService, Long,
 
     @ApiOperation(value = "获取所有有库位的点位", notes = "获取所有有库位的点位")
     @PostMapping("/handMode/getAllStockInfo")
-    public R<Map>  getAllStockInfo() {
-        Map data = baseService.getAllStockInfo();
+    public R  getAllStockInfo() {
+        List data = baseService.getAllStockInfo();
         return success(data);
     }