|
@@ -1,6 +1,7 @@
|
|
|
package com.github.zuihou.business.operationManagementCenter.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -17,7 +18,6 @@ import com.github.zuihou.business.operationManagementCenter.service.TaskNodeServ
|
|
|
import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
|
|
|
import com.github.zuihou.business.productionReadyCenter.dao.BBomMapper;
|
|
|
import com.github.zuihou.business.productionReadyCenter.dao.BomProcedureMapper;
|
|
|
-import com.github.zuihou.business.productionReadyCenter.entity.BomProcedure;
|
|
|
import com.github.zuihou.business.productionReadyCenter.entity.MToolClamp;
|
|
|
import com.github.zuihou.business.productionReadyCenter.entity.Tray;
|
|
|
import com.github.zuihou.business.productionReadyCenter.service.MToolClampService;
|
|
@@ -37,8 +37,6 @@ import com.github.zuihou.context.BaseContextHandler;
|
|
|
import com.github.zuihou.database.mybatis.conditions.Wraps;
|
|
|
import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
|
|
|
import com.github.zuihou.tenant.dao.ProductionresourceMapper;
|
|
|
-import com.github.zuihou.tenant.dto.ProductionresourcePageDTO;
|
|
|
-import com.github.zuihou.tenant.entity.Productionresource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpEntity;
|
|
@@ -47,7 +45,10 @@ import org.springframework.http.MediaType;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static java.util.stream.Collectors.groupingBy;
|
|
@@ -325,6 +326,64 @@ public class WorkpieceServiceImpl extends SuperServiceImpl<WorkpieceMapper, TWor
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private List<Map> processStockInfo(String zZoneCode, String resourceId, String pointId) {
|
|
|
+ List<Map> returnList = new ArrayList<>();
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("resourceId", resourceId);
|
|
|
+ map.put("pointId", pointId);
|
|
|
+ List<ProductionresourcePosition> list = productionresourcePositionMapper.getProductlineStockInfo(map);
|
|
|
+ Map<String, List<ProductionresourcePosition>> pointMap = list.stream().collect(groupingBy(ProductionresourcePosition::getPointId));
|
|
|
+ for (String key : pointMap.keySet()) {
|
|
|
+ Map returnMap = new HashMap();
|
|
|
+ List<ProductionresourcePosition> subList = pointMap.get(key);
|
|
|
+ if (CollectionUtil.isEmpty(subList)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ ProductionresourcePosition position0 = subList.get(0);
|
|
|
+ returnMap.put("unitename", zZoneCode);
|
|
|
+ returnMap.put("pointId", key);
|
|
|
+ returnMap.put("storgeId", position0.getStorgeId());
|
|
|
+ returnMap.put("name", position0.getName());
|
|
|
+ returnMap.put("lockStatus", position0.getLockStatus());
|
|
|
+ returnMap.put("resourceId", position0.getResourceId());
|
|
|
+ List<Map> l = new ArrayList<>();
|
|
|
+ for (ProductionresourcePosition p : subList) {
|
|
|
+ if (p.getGoodsId() != null) {
|
|
|
+ Map m = new HashMap();
|
|
|
+ m.put("goodsName", p.getGoodsName());
|
|
|
+ m.put("goodsId", p.getGoodsId());
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ l.add(m);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (CollectionUtil.isNotEmpty(l)) {
|
|
|
+ returnMap.put("goodsList", l);
|
|
|
+ }
|
|
|
+ returnList.add(returnMap);
|
|
|
+ }
|
|
|
+ return returnList;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public String execute(Map map) {
|
|
|
BaseContextHandler.setTenant("0000");
|
|
@@ -349,12 +408,25 @@ public class WorkpieceServiceImpl extends SuperServiceImpl<WorkpieceMapper, TWor
|
|
|
@Override
|
|
|
public R delete(Map conMap) {
|
|
|
BaseContextHandler.setTenant("0000");
|
|
|
- return taskNodeService.handModeStockOut(conMap);
|
|
|
+ String deviceUnit = conMap.get("deviceUnit").toString();
|
|
|
+ String pointId = conMap.get("pointId").toString();
|
|
|
+ String resourceId = conMap.get("resourceId").toString();
|
|
|
+ R result = taskNodeService.handModeStockOut(conMap);
|
|
|
+
|
|
|
+ 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);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public R lock(Map map) {
|
|
|
BaseContextHandler.setTenant("0000");
|
|
|
+
|
|
|
+ String deviceUnit = map.get("deviceUnit").toString();
|
|
|
String resourceId = map.get("resourceId").toString();
|
|
|
String pointId = map.get("pointId").toString();
|
|
|
String lockType = map.get("lockType").toString();
|
|
@@ -381,7 +453,13 @@ public class WorkpieceServiceImpl extends SuperServiceImpl<WorkpieceMapper, TWor
|
|
|
storgeMapper.updateById(storge);
|
|
|
}
|
|
|
|
|
|
- return R.success();
|
|
|
+ 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);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -389,7 +467,18 @@ public class WorkpieceServiceImpl extends SuperServiceImpl<WorkpieceMapper, TWor
|
|
|
@Override
|
|
|
public R add(Map map) {
|
|
|
BaseContextHandler.setTenant("0000");
|
|
|
- return taskNodeService.handModeStockIn(map);
|
|
|
+ String deviceUnit = map.get("deviceUnit").toString();
|
|
|
+ String pointId = map.get("pointId").toString();
|
|
|
+ String resourceId = map.get("resourceId").toString();
|
|
|
+ R result = taskNodeService.handModeStockIn(map);
|
|
|
+
|
|
|
+ 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);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
|