|
@@ -190,6 +190,9 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
|
|
|
@Autowired
|
|
|
private RestTemplate restTemplate;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TrayService trayService;
|
|
|
+
|
|
|
//总控IP
|
|
|
private String ZK_ip = "192.168.1.41";
|
|
|
|
|
@@ -893,7 +896,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
|
|
|
task.getProcedureId()));
|
|
|
List<TTaskStockUniqueCode> stockUniqueCodeList = new ArrayList<TTaskStockUniqueCode>();
|
|
|
TWorkpiece currWorkpiece = workpieceService.getWorkPiece(taskNode.getId());
|
|
|
- List<StockInfo> stockInfoList = this.getConnectTray(procedureTrayList, currWorkpiece.getIsReload());
|
|
|
+ List<StockInfo> stockInfoList = this.getConnectTray(procedureTrayList, currWorkpiece, null);
|
|
|
//获取
|
|
|
for (StockInfo b : stockInfoList) {
|
|
|
Long stockId = getStockId(taskNode, autoNode, "0");
|
|
@@ -1276,7 +1279,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
|
|
|
}
|
|
|
}
|
|
|
TWorkpiece currWorkpiece = workpieceService.getWorkPiece(bean.getId());
|
|
|
- List<StockInfo> stockInfoList = this.getConnectTray(trayList, currWorkpiece.getIsReload());
|
|
|
+ List<StockInfo> stockInfoList = this.getConnectTray(trayList, currWorkpiece, null);
|
|
|
List<StockInfo> trayStockList = stockInfoList.stream().filter(stockInfo->stockInfo.getGoodsId().equals(tray.getTrayId())).collect(Collectors.toList());
|
|
|
isFalse(trayStockList == null || trayStockList.size() == 0, "此码不在库中");
|
|
|
rkresult = stockInfoService.procedureTrayStockIn(trayStockList.get(0), storgeId, null, bean.getCompleteBatchNo());
|
|
@@ -1345,7 +1348,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
|
|
|
isFalse(oriStorgeId.longValue() == storgeId.longValue(), "此码已经在当前库位,无需移库");
|
|
|
}
|
|
|
TWorkpiece currWorkpiece = workpieceService.getWorkPiece(bean.getId());
|
|
|
- List<StockInfo> stockInfoList = this.getConnectTray(trayList, currWorkpiece.getIsReload());
|
|
|
+ List<StockInfo> stockInfoList = this.getConnectTray(trayList, currWorkpiece, null);
|
|
|
List<StockInfo> trayStockList = stockInfoList.stream().filter(stockInfo->stockInfo.getGoodsId().equals(tray.getTrayId())).collect(Collectors.toList());
|
|
|
isFalse(trayStockList == null || trayStockList.size() == 0, "此码不在库中");
|
|
|
|
|
@@ -1931,7 +1934,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
|
|
|
task.getProcedureId()).orderByAsc(BomProcedureTray::getBizType));
|
|
|
if (trayList != null && trayList.size() > 0) {
|
|
|
//毛料出库 清空子盘工装的批次信息
|
|
|
- List<StockInfo> stockInfoList = this.getConnectTray(trayList, currWorkpiece.getIsReload());
|
|
|
+ List<StockInfo> stockInfoList = this.getConnectTray(trayList, currWorkpiece, srcStorgeId);
|
|
|
stockInfoList.stream().forEach(stockInfo -> {
|
|
|
stockInfo.setCompleteBatchNo("");
|
|
|
});
|
|
@@ -1955,7 +1958,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
|
|
|
task.getProcedureId()).orderByAsc(BomProcedureTray::getBizType));
|
|
|
R<String> result = null;
|
|
|
if (trayList != null && trayList.size() > 0) {
|
|
|
- List<StockInfo> stockInfoList = this.getConnectTray(trayList, currWorkpiece.getIsReload());
|
|
|
+ List<StockInfo> stockInfoList = this.getConnectTray(trayList, currWorkpiece, srcStorgeId);
|
|
|
for (StockInfo tray : stockInfoList) {
|
|
|
//托盘不用入库
|
|
|
if ("1".equals(tray.getGoodsType())) {
|
|
@@ -1991,7 +1994,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
|
|
|
task.getProcedureId()).orderByAsc(BomProcedureTray::getBizType));
|
|
|
R<String> result = null;
|
|
|
if (trayList != null && trayList.size() > 0) {
|
|
|
- List<StockInfo> stockInfoList = this.getConnectTray(trayList, currWorkpiece.getIsReload());
|
|
|
+ List<StockInfo> stockInfoList = this.getConnectTray(trayList, currWorkpiece, srcStorgeId);
|
|
|
for (StockInfo tray : stockInfoList) {
|
|
|
if(StringUtil.isNotEmpty(srcStorgeId)) {
|
|
|
result = stockInfoService.procedureTrayStockOut(tray, Long.parseLong(srcStorgeId),
|
|
@@ -2021,7 +2024,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
|
|
|
task.getProcedureId()).orderByAsc(BomProcedureTray::getBizType));
|
|
|
R<String> result = null;
|
|
|
if (trayList != null && trayList.size() > 0) {
|
|
|
- List<StockInfo> stockInfoList = this.getConnectTray(trayList, currWorkpiece.getIsReload());
|
|
|
+ List<StockInfo> stockInfoList = this.getConnectTray(trayList, currWorkpiece, srcStorgeId);
|
|
|
for (StockInfo trayStock : stockInfoList) {
|
|
|
result = stockInfoService.procedureTrayStockOut(trayStock, Long.parseLong(srcStorgeId),
|
|
|
task.getCompleteBatchNo());
|
|
@@ -2060,7 +2063,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
|
|
|
task.getProcedureId()).orderByAsc(BomProcedureTray::getBizType));
|
|
|
R<String> result = null;
|
|
|
if (trayList != null && trayList.size() > 0) {
|
|
|
- List<StockInfo> stockInfoList = this.getConnectTray(trayList, currWorkpiece.getIsReload());
|
|
|
+ List<StockInfo> stockInfoList = this.getConnectTray(trayList, currWorkpiece, srcStorgeId);
|
|
|
for (StockInfo tray : stockInfoList) {
|
|
|
result = stockInfoService.procedureTrayStockOut(tray, Long.parseLong(srcStorgeId),
|
|
|
task.getCompleteBatchNo());
|
|
@@ -2103,7 +2106,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
|
|
|
task.getProcedureId()).orderByAsc(BomProcedureTray::getBizType));
|
|
|
R<String> result = null;
|
|
|
if (trayList != null && trayList.size() > 0) {
|
|
|
- List<StockInfo> stockInfoList = this.getConnectTray(trayList, currWorkpiece.getIsReload());
|
|
|
+ List<StockInfo> stockInfoList = this.getConnectTray(trayList, currWorkpiece, srcStorgeId);
|
|
|
for (StockInfo tray : stockInfoList) {
|
|
|
if ("1".equals(tray.getGoodsType())) {//托盘不用入库
|
|
|
break;
|
|
@@ -2787,22 +2790,28 @@ planId));
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- private List<StockInfo> getConnectTray(List<BomProcedureTray> bomProcedureTrayList, int isReload){
|
|
|
+ private List<StockInfo> getConnectTray(List<BomProcedureTray> bomProcedureTrayList, TWorkpiece tWorkpiece, String srcStorgeId){
|
|
|
List<StockInfo> stockInfoList = null;
|
|
|
List<Long> trayIds = bomProcedureTrayList.stream().map(tray->tray.getTrayId()).collect(Collectors.toList());
|
|
|
stockInfoList = stockInfoService.list(new LbqWrapper<StockInfo>().in(StockInfo::getGoodsId, trayIds).in(StockInfo::getGoodsType, new String[]{"1","2"}).last("limit 2").orderByAsc(StockInfo::getGoodsType));
|
|
|
-
|
|
|
- if(CollectionUtil.isNotEmpty(stockInfoList)) {
|
|
|
- boolean bool = stockInfoList.get(0).getStorgeId().equals(stockInfoList.get(1).getStorgeId());
|
|
|
- if (!bool) {
|
|
|
- //已经换装,以工装作为点位参考
|
|
|
- if (isReload > 0) {
|
|
|
- stockInfoList = stockInfoService.list(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, stockInfoList.get(1).getStorgeId()).lt(StockInfo::getGoodsType, "2").orderByAsc(StockInfo::getGoodsType));
|
|
|
- } else {
|
|
|
- //未换装,以子盘作为点位参考
|
|
|
- stockInfoList = stockInfoService.list(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, stockInfoList.get(0).getStorgeId()).lt(StockInfo::getGoodsType, "2").orderByAsc(StockInfo::getGoodsType));
|
|
|
+ int isReload = tWorkpiece.getIsReload();
|
|
|
+ boolean bool2 = true;
|
|
|
+ if(srcStorgeId!=null){
|
|
|
+ bool2 = stockInfoList.get(0).getStorgeId().equals(srcStorgeId) || stockInfoList.get(1).getStorgeId().equals(srcStorgeId);
|
|
|
+ }
|
|
|
+ if (CollectionUtil.isNotEmpty(stockInfoList) && bool2) {
|
|
|
+ boolean bool = stockInfoList.get(0).getStorgeId().equals(stockInfoList.get(1).getStorgeId());
|
|
|
+ if (!bool) {
|
|
|
+ //已经换装,以工装作为点位参考
|
|
|
+ if (isReload > 0) {
|
|
|
+ stockInfoList = stockInfoService.list(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, stockInfoList.get(1).getStorgeId()).le(StockInfo::getGoodsType, "2").orderByAsc(StockInfo::getGoodsType));
|
|
|
+ } else {
|
|
|
+ //未换装,以子盘作为点位参考
|
|
|
+ stockInfoList = stockInfoService.list(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, stockInfoList.get(0).getStorgeId()).le(StockInfo::getGoodsType, "2").orderByAsc(StockInfo::getGoodsType));
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ }else if(!bool2){
|
|
|
+ stockInfoList = stockInfoService.list(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, srcStorgeId).le(StockInfo::getGoodsType, "2").orderByAsc(StockInfo::getGoodsType));
|
|
|
}
|
|
|
return stockInfoList;
|
|
|
}
|