|
|
@@ -76,9 +76,6 @@ import java.math.BigDecimal;
|
|
|
import java.rmi.RemoteException;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.time.LocalDateTime;
|
|
|
-import java.time.ZoneId;
|
|
|
-import java.time.temporal.ChronoUnit;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -455,12 +452,12 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
failureHandling(type, boxDynamicsRecord, "未查到箱号:" + recordItems.getBoxCode() + "箱档案数据");
|
|
|
return false;
|
|
|
}
|
|
|
- if (!archives.getTypeName().equals(recordItems.getBoxType())){
|
|
|
+ if (!archives.getTypeName().equals(recordItems.getBoxType())) {
|
|
|
failureHandling(type, boxDynamicsRecord, "箱号:" + recordItems.getBoxCode() + "箱型与箱档案不符");
|
|
|
return false;
|
|
|
}
|
|
|
//箱档案数据处理
|
|
|
- archives = ArchivesUtils.dataAssembly(archives,recordItems,BoxDynamicsEnums.getName(recordItems.getObjective()),"退租",null);
|
|
|
+ archives = ArchivesUtils.dataAssembly(archives, recordItems, BoxDynamicsEnums.getName(recordItems.getObjective()), "退租", null);
|
|
|
archivesArrayList.add(archives);
|
|
|
archivesDateleList.add(archives.getId());
|
|
|
//原放箱号数据处理
|
|
|
@@ -477,8 +474,8 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(recordItems.getBoxCode()))
|
|
|
.findFirst().orElse(null);
|
|
|
if (putBoxItem != null) {
|
|
|
- putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem,recordItems,putBox1,false,
|
|
|
- null,BoxDynamicsEnums.getName(recordItems.getObjective()),"退租","7");
|
|
|
+ putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem, recordItems, putBox1, false,
|
|
|
+ null, BoxDynamicsEnums.getName(recordItems.getObjective()), "退租", "7", false);
|
|
|
putBoxItemsOldList.add(putBoxItem);
|
|
|
} else {
|
|
|
failureHandling(type, boxDynamicsRecord, "未查到放箱号:" + recordItems.getContainerNumber() + "下箱号:" + recordItems.getBoxCode() + "明细");
|
|
|
@@ -520,6 +517,8 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
archivesTrajectory.setBillType(putBox1.getBoxClass());
|
|
|
archivesTrajectory.setCode(recordItems.getBoxCode());
|
|
|
archivesTrajectory.setNewDate(recordItems.getApproachExitDate());
|
|
|
+ archivesTrajectory.setMblno(recordItems.getHblno());
|
|
|
+ archivesTrajectory.setHblno(recordItems.getHblno());
|
|
|
archivesTrajectory.setCreateTime(new Date());
|
|
|
archivesTrajectory.setCreateUser(AuthUtil.getUserId());
|
|
|
archivesTrajectory.setCreateUserName(AuthUtil.getUserName());
|
|
|
@@ -550,13 +549,14 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
if (!tradingBoxItemList.isEmpty()) {
|
|
|
tradingBoxItem = tradingBoxItemList.stream().filter(e -> e.getCode().equals(recordItems.getBoxCode()))
|
|
|
.findFirst().orElse(null);
|
|
|
- tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(tradingBoxItem,recordItems,tradingBox,false,
|
|
|
- null,BoxDynamicsEnums.getName(recordItems.getObjective()),"退租","7");
|
|
|
+ tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(tradingBoxItem, recordItems, tradingBox, false,
|
|
|
+ null, BoxDynamicsEnums.getName(recordItems.getObjective()), "退租", "7");
|
|
|
+ tradingBoxItemOldList.add(tradingBoxItem);
|
|
|
} else {
|
|
|
- tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(null,recordItems,tradingBox,false,
|
|
|
- null,BoxDynamicsEnums.getName(recordItems.getObjective()),"退租","7");
|
|
|
+ tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(null, recordItems, tradingBox, false,
|
|
|
+ null, BoxDynamicsEnums.getName(recordItems.getObjective()), "退租", "7");
|
|
|
+ tradingBoxItemOldList.add(tradingBoxItem);
|
|
|
}
|
|
|
- tradingBoxItemOldList.add(tradingBoxItem);
|
|
|
} else {
|
|
|
failureHandling(type, boxDynamicsRecord, "未查到放箱号:" + recordItems.getContainerNumber() + "对应退租单据");
|
|
|
return false;
|
|
|
@@ -1468,13 +1468,13 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
}
|
|
|
//存储上一步数据
|
|
|
BoxNumUtils.storagePreviousStepData(archives, item);
|
|
|
- archives = ArchivesUtils.dataAssembly(archives,item,"空箱提箱进场","待使用",putBox.getBoxClass());
|
|
|
+ archives = ArchivesUtils.dataAssembly(archives, item, "空箱提箱进场", "待使用", putBox.getBoxClass());
|
|
|
} else {
|
|
|
if (!"OW(拿),代理箱,租箱".contains(putBox.getBoxClass())) {
|
|
|
failureHandling(type, boxDynamicsRecord, "箱档案中未查到箱号:" + item.getBoxCode());
|
|
|
return false;
|
|
|
}
|
|
|
- archives = ArchivesUtils.dataAssembly(null,item,"空箱提箱进场","待使用",putBox.getBoxClass());
|
|
|
+ archives = ArchivesUtils.dataAssembly(null, item, "空箱提箱进场", "待使用", putBox.getBoxClass());
|
|
|
archives.setTenantId(tenantId);
|
|
|
}
|
|
|
archives.setTemporaryId(item.getTemporaryId());
|
|
|
@@ -1488,16 +1488,17 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
if (!putBoxItemsList.isEmpty()) {
|
|
|
putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(item.getBoxCode()))
|
|
|
.findFirst().orElse(null);
|
|
|
- putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem,item,putBox,false,null,"空箱提箱进场","待使用","1");
|
|
|
+ putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem, item, putBox, false, null, "空箱提箱进场", "待使用", "1", false);
|
|
|
+ if (putBoxItem.getTemporaryStatus()) {
|
|
|
+ failureHandling(type, boxDynamicsRecord, "放箱号:" + item.getContainerNumber() + "箱号:" +
|
|
|
+ item.getBoxCode() + "状态为使用中,请先还箱");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ putBoxItems.add(putBoxItem);
|
|
|
} else {
|
|
|
- putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(null,item,putBox,false,null,"空箱提箱进场","待使用","1");
|
|
|
- }
|
|
|
- if (putBoxItem.getTemporaryStatus()) {
|
|
|
- failureHandling(type, boxDynamicsRecord, "放箱号:" + item.getContainerNumber() + "箱号:" +
|
|
|
- item.getBoxCode() + "状态为使用中,请先还箱");
|
|
|
- return false;
|
|
|
+ putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(null, item, putBox, false, null, "空箱提箱进场", "待使用", "1", false);
|
|
|
+ putBoxItems.add(putBoxItem);
|
|
|
}
|
|
|
- putBoxItems.add(putBoxItem);
|
|
|
if ("OW(拿)".equals(putBox.getBoxClass())) {
|
|
|
if (!tradingBoxList.isEmpty()) {
|
|
|
TradingBox tradingBox = tradingBoxList.stream().filter(e -> e.getId().equals(putBox.getSrcId()))
|
|
|
@@ -1515,11 +1516,12 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
if (!tradingBoxItemList.isEmpty()) {
|
|
|
tradingBoxItem = tradingBoxItemList.stream().filter(e -> e.getCode().equals(item.getBoxCode()))
|
|
|
.findFirst().orElse(null);
|
|
|
- tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(tradingBoxItem,item,tradingBox,false,null,"空箱提箱进场","待使用","1");
|
|
|
+ tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(tradingBoxItem, item, tradingBox, false, null, "空箱提箱进场", "待使用", "1");
|
|
|
+ tradingBoxItems.add(tradingBoxItem);
|
|
|
} else {
|
|
|
- tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(null,item,tradingBox,false,null,"空箱提箱进场","待使用","1");
|
|
|
+ tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(null, item, tradingBox, false, null, "空箱提箱进场", "待使用", "1");
|
|
|
+ tradingBoxItems.add(tradingBoxItem);
|
|
|
}
|
|
|
- tradingBoxItems.add(tradingBoxItem);
|
|
|
} else {
|
|
|
failureHandling(type, boxDynamicsRecord, "放箱号:" + item.getContainerNumber() + "未查到来源单据");
|
|
|
return false;
|
|
|
@@ -2150,19 +2152,65 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
}
|
|
|
}
|
|
|
//客户还箱
|
|
|
- List<BoxDynamicsRecordItems> itemsListFCs = itemsList.stream().filter(e -> "C".equals(e.getObjective())).collect(Collectors.toList());
|
|
|
- if (!itemsListFCs.isEmpty()) {
|
|
|
- List<String> boxNum = itemsListFCs.stream().map(BoxDynamicsRecordItems::getBoxCode).filter(Objects::nonNull)
|
|
|
+ List<BoxDynamicsRecordItems> itemsListKHHX = itemsList.stream().filter(e -> "C".equals(e.getObjective())).collect(Collectors.toList());
|
|
|
+ if (!itemsListKHHX.isEmpty()) {
|
|
|
+ //OW(放)放箱号前缀参数
|
|
|
+ String fixedPrefix = sysClient.getParamService("fixed.prefix.numbering");
|
|
|
+ if (ObjectUtils.isNull(fixedPrefix) || "获取数据失败".equals(fixedPrefix)) {
|
|
|
+ failureHandling(type, boxDynamicsRecord, "请先维护放箱号固定前缀参数!");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ List<String> boxNum = itemsListKHHX.stream().map(BoxDynamicsRecordItems::getBoxCode).filter(Objects::nonNull)
|
|
|
.collect(Collectors.toList());
|
|
|
if (boxNum.isEmpty()) {
|
|
|
failureHandling(type, boxDynamicsRecord, "所选配箱信息箱号不能为空");
|
|
|
return false;
|
|
|
}
|
|
|
//箱档案数据
|
|
|
- List<Archives> archivesList = archivesService.list(new LambdaQueryWrapper<Archives>()
|
|
|
+ List<Archives> archivesListFXHX = archivesService.list(new LambdaQueryWrapper<Archives>()
|
|
|
.eq(Archives::getTenantId, boxDynamicsRecord.getTenantId())
|
|
|
.eq(Archives::getIsDeleted, 0)
|
|
|
.in(Archives::getCode, boxNum));
|
|
|
+ List<BoxDynamicsRecordItems> itemsListFXHX = new ArrayList<>();
|
|
|
+ List<BoxDynamicsRecordItems> itemsListFCs = new ArrayList<>();
|
|
|
+ //区分正常还箱还是OW放还箱 只有箱档案存在,箱档案中提单号不为空并且符合前缀匹配的才是OW放还箱箱号,其余都是正常还箱
|
|
|
+ for (BoxDynamicsRecordItems item : itemsListKHHX) {
|
|
|
+ if (!archivesListFXHX.isEmpty()) {
|
|
|
+ Archives archives = archivesListFXHX.stream().filter(e -> e.getCode().equals(item.getBoxCode())).findFirst().orElse(null);
|
|
|
+ if (archives != null) {
|
|
|
+ if (ObjectUtils.isNotNull(archives.getBillNo())) {
|
|
|
+ //截取提单号前缀,判断是否是OW(放)放箱号
|
|
|
+ String data = archives.getBillNo().substring(0, fixedPrefix.length());
|
|
|
+ if (fixedPrefix.equals(data)) {
|
|
|
+ itemsListFXHX.add(item);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ itemsListFCs.add(item);
|
|
|
+ }
|
|
|
+ //OW放-客户还箱
|
|
|
+ if (!itemsListFXHX.isEmpty()) {
|
|
|
+ Boolean status = this.synchronizationFXHX(itemsListFXHX, boxDynamicsRecord, type);
|
|
|
+ if (!status) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (itemsListFCs.isEmpty()) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ List<String> boxNumFC = itemsListFCs.stream().map(BoxDynamicsRecordItems::getBoxCode).filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (boxNumFC.isEmpty()) {
|
|
|
+ failureHandling(type, boxDynamicsRecord, "所选配箱信息箱号不能为空");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ //箱档案数据
|
|
|
+ List<Archives> archivesList = archivesService.list(new LambdaQueryWrapper<Archives>()
|
|
|
+ .eq(Archives::getTenantId, boxDynamicsRecord.getTenantId())
|
|
|
+ .eq(Archives::getIsDeleted, 0)
|
|
|
+ .in(Archives::getCode, boxNumFC));
|
|
|
List<BoxDynamicsRecordItems> itemsListFC = new ArrayList<>();
|
|
|
//判断是否有未查到箱档案数据的箱号 未查到的一律按照新箱进场逻辑走
|
|
|
if (boxNum.size() != archivesList.size()) {
|
|
|
@@ -2295,8 +2343,8 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(recordItems.getBoxCode())
|
|
|
&& e.getPid().equals(putBoxOld.getId())).findFirst().orElse(null);
|
|
|
if (putBoxItem != null) {
|
|
|
- putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem,recordItems,putBoxOld,
|
|
|
- false,null,"已返场","已还箱","5");
|
|
|
+ putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem, recordItems, putBoxOld,
|
|
|
+ false, null, "已返场", "已还箱", "5", false);
|
|
|
if (putBoxItem.getTemporaryStatus()) {
|
|
|
failureHandling(type, boxDynamicsRecord, "放箱号:" + recordItems.getContainerNumber() + "中箱号:" +
|
|
|
recordItems.getBoxCode() + "未出场,不允许直接还箱");
|
|
|
@@ -2362,8 +2410,8 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
tradingBoxItem = tradingBoxItemList.stream().filter(e -> e.getCode().equals(recordItems.getBoxCode()))
|
|
|
.findFirst().orElse(null);
|
|
|
if (tradingBoxItem != null) {
|
|
|
- tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(tradingBoxItem,recordItems,tradingBox,
|
|
|
- false,bills,"已返场","已还箱","5");
|
|
|
+ tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(tradingBoxItem, recordItems, tradingBox,
|
|
|
+ false, bills, "已返场", "已还箱", "5");
|
|
|
tradingBoxItemOldList.add(tradingBoxItem);
|
|
|
}
|
|
|
}
|
|
|
@@ -2377,7 +2425,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
}
|
|
|
}
|
|
|
//箱档案数据处理
|
|
|
- archives = ArchivesUtils.dataAssembly(archives,recordItems,"空箱提箱进场","待使用",null);
|
|
|
+ archives = ArchivesUtils.dataAssembly(archives, recordItems, "空箱提箱进场", "待使用", null);
|
|
|
archivesArrayList.add(archives);
|
|
|
if (!containerNumberType.equals("OW(拿)")) {
|
|
|
//新放箱号数据处理
|
|
|
@@ -2390,13 +2438,14 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
if (!putBoxItemsList.isEmpty()) {
|
|
|
putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(recordItems.getBoxCode())
|
|
|
&& putBox.getId().equals(e.getPid())).findFirst().orElse(null);
|
|
|
- putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem,recordItems,putBox,
|
|
|
- false,null,"空箱提箱进场","待使用","5");
|
|
|
+ putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem, recordItems, putBox,
|
|
|
+ false, null, "空箱提箱进场", "待使用", "9", false);
|
|
|
+ putBoxItemsNewList.add(putBoxItem);
|
|
|
} else {
|
|
|
- putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(null,recordItems,putBox,
|
|
|
- false,null,"空箱提箱进场","待使用","5");
|
|
|
+ putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(null, recordItems, putBox,
|
|
|
+ false, null, "空箱提箱进场", "待使用", "9", false);
|
|
|
+ putBoxItemsNewList.add(putBoxItem);
|
|
|
}
|
|
|
- putBoxItemsNewList.add(putBoxItem);
|
|
|
recordItems.setSrcPutBoxPodId(putBox.getId());
|
|
|
if (putBoxNewList.isEmpty()) {
|
|
|
putBoxNewList.add(putBox);
|
|
|
@@ -2715,16 +2764,16 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(item.getBoxCode()) &&
|
|
|
e.getPid().equals(putBox.getId()))
|
|
|
.findFirst().orElse(null);
|
|
|
- putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem,item,putBox,
|
|
|
- false,null,"调箱进场","待使用","2");
|
|
|
+ putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem, item, putBox,
|
|
|
+ false, null, "调箱进场", "待使用", "2", false);
|
|
|
if (putBoxItem.getTemporaryStatus()) {
|
|
|
failureHandling(type, boxDynamicsRecord, "放箱号:" + item.getContainerNumber() + "箱号:" +
|
|
|
item.getBoxCode() + "状态为使用中,请先还箱");
|
|
|
return false;
|
|
|
}
|
|
|
} else {
|
|
|
- putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(null,item,putBox,
|
|
|
- false,null,"调箱进场","待使用","2");
|
|
|
+ putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(null, item, putBox,
|
|
|
+ false, null, "调箱进场", "待使用", "2", false);
|
|
|
}
|
|
|
putBoxItems.add(putBoxItem);
|
|
|
boolean samePort = true;
|
|
|
@@ -2747,12 +2796,12 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
if (!tradingBoxItemList.isEmpty()) {
|
|
|
tradingBoxItem = tradingBoxItemList.stream().filter(e -> e.getCode().equals(item.getBoxCode()))
|
|
|
.findFirst().orElse(null);
|
|
|
- tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(tradingBoxItem,item,tradingBox,
|
|
|
- false,null,"调箱进场","待使用","2");
|
|
|
+ tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(tradingBoxItem, item, tradingBox,
|
|
|
+ false, null, "调箱进场", "待使用", "2");
|
|
|
|
|
|
} else {
|
|
|
- tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(null,item,tradingBox,
|
|
|
- false,null,"调箱进场","待使用","2");
|
|
|
+ tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(null, item, tradingBox,
|
|
|
+ false, null, "调箱进场", "待使用", "2");
|
|
|
}
|
|
|
tradingBoxItems.add(tradingBoxItem);
|
|
|
}
|
|
|
@@ -2766,13 +2815,13 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
}
|
|
|
//存储上一步数据
|
|
|
BoxNumUtils.storagePreviousStepData(archives, item);
|
|
|
- archives = ArchivesUtils.dataAssembly(archives,item,"调箱进场","待使用",putBox.getBoxClass());
|
|
|
+ archives = ArchivesUtils.dataAssembly(archives, item, "调箱进场", "待使用", putBox.getBoxClass());
|
|
|
} else {
|
|
|
if (!"OW(拿),代理箱,租箱".contains(putBox.getBoxClass())) {
|
|
|
failureHandling(type, boxDynamicsRecord, "箱档案中未查到箱号:" + item.getBoxCode());
|
|
|
return false;
|
|
|
}
|
|
|
- archives = ArchivesUtils.dataAssembly(archives,item,"调箱进场","待使用",putBox.getBoxClass());
|
|
|
+ archives = ArchivesUtils.dataAssembly(archives, item, "调箱进场", "待使用", putBox.getBoxClass());
|
|
|
}
|
|
|
if (samePort) {
|
|
|
archives.setWhetherTransfer("1");
|
|
|
@@ -3073,8 +3122,8 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
recordItems.getBoxCode() + "未出场,不允许直接还箱");
|
|
|
return false;
|
|
|
}
|
|
|
- putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem,recordItems,putBox,
|
|
|
- false,null,"空箱提箱进场","待使用","6");
|
|
|
+ putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem, recordItems, putBox,
|
|
|
+ false, null, "空箱提箱进场", "待使用", "6", false);
|
|
|
putBoxItemsNewList.add(putBoxItem);
|
|
|
} else {
|
|
|
failureHandling(type, boxDynamicsRecord, "放箱号:" + recordItems.getContainerNumber() + "中,箱号:"
|
|
|
@@ -3103,8 +3152,8 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
tradingBoxItem = tradingBoxItemList.stream().filter(e -> e.getCode().equals(recordItems.getBoxCode()))
|
|
|
.findFirst().orElse(null);
|
|
|
if (tradingBoxItem != null) {
|
|
|
- tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(tradingBoxItem,recordItems,tradingBox,
|
|
|
- false,null,"空箱提箱进场","待使用","6");
|
|
|
+ tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(tradingBoxItem, recordItems, tradingBox,
|
|
|
+ false, null, "空箱提箱进场", "待使用", "6");
|
|
|
tradingBoxItemOldList.add(tradingBoxItem);
|
|
|
} else {
|
|
|
failureHandling(type, boxDynamicsRecord, "放箱号:" + recordItems.getContainerNumber() + "来源单据中,箱号:"
|
|
|
@@ -3133,7 +3182,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
failureHandling(type, boxDynamicsRecord, "放箱号:" + recordItems.getContainerNumber() + "未查到");
|
|
|
return false;
|
|
|
}
|
|
|
- ArchivesUtils.dataAssembly(archives,recordItems,"","",null);
|
|
|
+ ArchivesUtils.dataAssembly(archives, recordItems, "", "", null);
|
|
|
archivesArrayList.add(archives);
|
|
|
}
|
|
|
if (!archivesArrayList.isEmpty()) {
|
|
|
@@ -3646,7 +3695,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
}
|
|
|
}
|
|
|
//箱档案数据处理
|
|
|
- archives = ArchivesUtils.dataAssembly(archives,item,"调箱出场","使用中",putBoxData.getBoxClass());
|
|
|
+ archives = ArchivesUtils.dataAssembly(archives, item, "调箱出场", "使用中", putBoxData.getBoxClass());
|
|
|
archives.setTemporaryId(item.getTemporaryId());
|
|
|
archivesArrayList.add(archives);
|
|
|
if (ObjectUtils.isNotNull(putBoxData.getBoxType()) && !putBoxData.getBoxType().equals(item.getBoxType())) {
|
|
|
@@ -3658,11 +3707,11 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
if (!putBoxItemsList.isEmpty()) {
|
|
|
putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(item.getBoxCode()) &&
|
|
|
e.getPid().equals(putBoxData.getId())).findFirst().orElse(null);
|
|
|
- putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem,item,putBoxData,false,null,
|
|
|
- "调箱出场","使用中","4");
|
|
|
+ putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem, item, putBoxData, false, null,
|
|
|
+ "调箱出场", "使用中", "4", false);
|
|
|
} else {
|
|
|
- putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(null,item,putBoxData,false,null,
|
|
|
- "调箱出场","使用中","4");
|
|
|
+ putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(null, item, putBoxData, false, null,
|
|
|
+ "调箱出场", "使用中", "4", false);
|
|
|
}
|
|
|
putBoxItems.add(putBoxItem);
|
|
|
if (!tradingBoxList.isEmpty()) {
|
|
|
@@ -3681,11 +3730,11 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
if (!tradingBoxItemList.isEmpty()) {
|
|
|
tradingBoxItem = tradingBoxItemList.stream().filter(e -> e.getCode().equals(item.getBoxCode()))
|
|
|
.findFirst().orElse(null);
|
|
|
- tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(tradingBoxItem,item,tradingBox,false,null,
|
|
|
- "调箱出场","使用中","4");
|
|
|
+ tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(tradingBoxItem, item, tradingBox, false, null,
|
|
|
+ "调箱出场", "使用中", "4");
|
|
|
} else {
|
|
|
- tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(null,item,tradingBox,false,null,
|
|
|
- "调箱出场","使用中","4");
|
|
|
+ tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(null, item, tradingBox, false, null,
|
|
|
+ "调箱出场", "使用中", "4");
|
|
|
}
|
|
|
tradingBoxItems.add(tradingBoxItem);
|
|
|
}
|
|
|
@@ -4007,7 +4056,9 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
}
|
|
|
//截取提单号前缀,判断是否是OW(放)放箱号
|
|
|
String data = item.getHblno().substring(0, fixedPrefix.length());
|
|
|
+ boolean whetherFX = false;
|
|
|
if (fixedPrefix.equals(data)) {
|
|
|
+ whetherFX = true;
|
|
|
PutBox putBox = putBoxList.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber())
|
|
|
&& ObjectUtils.isNotNull(e.getPolId()) && item.getHblno().equals(e.getSrcContainerNumber())).findFirst().orElse(null);
|
|
|
if (putBox != null) {
|
|
|
@@ -4022,7 +4073,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
PutBoxItems putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(item.getBoxCode()) &&
|
|
|
e.getPid().equals(putBox.getId())).findFirst().orElse(null);
|
|
|
if (putBoxItem == null) {
|
|
|
- putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem,item,putBox,false,null,"空箱出场","使用中","8");
|
|
|
+ putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem, item, putBox, false, null, "空箱出场", "使用中", "8", false);
|
|
|
putBoxItemsOwf.add(putBoxItem);
|
|
|
} else {
|
|
|
failureHandling(type, boxDynamicsRecord, "放箱号:" + item.getContainerNumber() + "中箱号:" + item.getBoxCode() + "已存在");
|
|
|
@@ -4073,7 +4124,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
}
|
|
|
//海运单据
|
|
|
Bills bills;
|
|
|
- if (!billsList.isEmpty()) {
|
|
|
+ if (!billsList.isEmpty() && !whetherFX) {
|
|
|
//只查分单加直单
|
|
|
bills = billsList.stream().filter(e -> "MH,DD".contains(e.getBillType())
|
|
|
&& ObjectUtils.isNotNull(item.getHblno()) && item.getHblno().equals(e.getHblno())).findFirst().orElse(null);
|
|
|
@@ -4124,12 +4175,14 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
}
|
|
|
} else {
|
|
|
bills = null;
|
|
|
- //判断出场港口是否国内或越南港口,是提单号必须存在 否需提示但箱正常出场
|
|
|
- if (intercept) {
|
|
|
- failureHandling(type, boxDynamicsRecord, "未查到提单号:" + item.getHblno() + "对应海运出口单据");
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- failureHandling("3", boxDynamicsRecord, "未查到提单号:" + item.getHblno() + "对应海运出口单据");
|
|
|
+ if (!whetherFX) {
|
|
|
+ //判断出场港口是否国内或越南港口,是提单号必须存在 否需提示但箱正常出场
|
|
|
+ if (intercept) {
|
|
|
+ failureHandling(type, boxDynamicsRecord, "未查到提单号:" + item.getHblno() + "对应海运出口单据");
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ failureHandling("3", boxDynamicsRecord, "未查到提单号:" + item.getHblno() + "对应海运出口单据");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//放箱号明细数据处理
|
|
|
@@ -4138,7 +4191,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(item.getBoxCode()) &&
|
|
|
e.getPid().equals(putBoxData.getId())).findFirst().orElse(null);
|
|
|
if (putBoxItem != null) {
|
|
|
- putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem,item,putBoxData,whetherExistence,bills,"空箱出场","使用中","3");
|
|
|
+ putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem, item, putBoxData, whetherExistence, bills, "空箱出场", "使用中", "3", whetherFX);
|
|
|
putBoxItems.add(putBoxItem);
|
|
|
} else {
|
|
|
failureHandling(type, boxDynamicsRecord, "放箱号:" + item.getContainerNumber() + "未查到箱号:" + item.getBoxCode() + "进场记录");
|
|
|
@@ -4189,8 +4242,8 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
tradingBoxItem = tradingBoxItemList.stream().filter(e -> e.getCode().equals(item.getBoxCode()))
|
|
|
.findFirst().orElse(null);
|
|
|
if (tradingBoxItem != null) {
|
|
|
- tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(tradingBoxItem,item,tradingBox,whetherExistence
|
|
|
- ,bills,"空箱出场","使用中","3");
|
|
|
+ tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(tradingBoxItem, item, tradingBox, whetherExistence
|
|
|
+ , bills, "空箱出场", "使用中", "3");
|
|
|
tradingBoxItems.add(tradingBoxItem);
|
|
|
} else {
|
|
|
failureHandling(type, boxDynamicsRecord, "OW(拿)放箱号:" + item.getContainerNumber() + "未查到箱号:" + item.getBoxCode() + "进场记录");
|
|
|
@@ -4212,7 +4265,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
//存储上一步数据
|
|
|
BoxNumUtils.storagePreviousStepData(archives, item);
|
|
|
//箱档案数据处理
|
|
|
- archives = ArchivesUtils.dataAssembly(archives,item,"空箱出场","使用中",putBoxData.getBoxClass());
|
|
|
+ archives = ArchivesUtils.dataAssembly(archives, item, "空箱出场", "使用中", putBoxData.getBoxClass());
|
|
|
archivesArrayList.add(archives);
|
|
|
//海运单据配箱数据处理
|
|
|
if (!"OW(放)".equals(putBoxData.getBoxClass()) && ObjectUtils.isNotNull(item.getHblno())) {
|
|
|
@@ -4551,9 +4604,9 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
if (!archivesArrayList.isEmpty()) {
|
|
|
archivesService.saveOrUpdateBatch(archivesArrayList);
|
|
|
}
|
|
|
- if (!putBoxItemsOwf.isEmpty()){
|
|
|
+ if (!putBoxItemsOwf.isEmpty()) {
|
|
|
putBoxItemsService.saveOrUpdateBatch(putBoxItemsOwf);
|
|
|
- if (!putBoxesOwf.isEmpty()){
|
|
|
+ if (!putBoxesOwf.isEmpty()) {
|
|
|
for (PutBox item : putBoxesOwf) {
|
|
|
//主表增加本次出场箱号数据
|
|
|
if (ObjectUtils.isNotNull(item.getCode())) {
|
|
|
@@ -4616,6 +4669,381 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ private Boolean synchronizationFXHX(List<BoxDynamicsRecordItems> itemsListFXHX, BoxDynamicsRecord boxDynamicsRecord, String type) throws IOException {
|
|
|
+ List<String> boxNum = itemsListFXHX.stream().map(BoxDynamicsRecordItems::getBoxCode).filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (boxNum.isEmpty()) {
|
|
|
+ failureHandling(type, boxDynamicsRecord, "所选配箱信息箱号不能为空");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ //箱档案数据
|
|
|
+ List<Archives> archivesList = archivesService.list(new LambdaQueryWrapper<Archives>()
|
|
|
+ .eq(Archives::getTenantId, boxDynamicsRecord.getTenantId())
|
|
|
+ .eq(Archives::getIsDeleted, 0)
|
|
|
+ .in(Archives::getCode, boxNum));
|
|
|
+ if (archivesList.isEmpty()) {
|
|
|
+ failureHandling(type, boxDynamicsRecord, "未查到客户还箱箱档案数据");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ List<String> containerNumberList = itemsListFXHX.stream().map(BoxDynamicsRecordItems::getContainerNumber)
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
+ List<String> billNoList = archivesList.stream().map(Archives::getBillNo)
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
+ List<PutBox> putBoxList = putBoxService.list(new LambdaQueryWrapper<PutBox>()
|
|
|
+ .eq(PutBox::getTenantId, boxDynamicsRecord.getTenantId())
|
|
|
+ .eq(PutBox::getIsDeleted, 0)
|
|
|
+ .and(i -> i.in(PutBox::getContainerNumber, containerNumberList).or()
|
|
|
+ .in(PutBox::getContainerNumber, billNoList)));
|
|
|
+ if (putBoxList.isEmpty()) {
|
|
|
+ failureHandling(type, boxDynamicsRecord, "未查到放箱号单据");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ List<Long> putBoxIdList = putBoxList.stream().map(PutBox::getId).collect(Collectors.toList());
|
|
|
+ List<PutBoxItems> putBoxItemsList = putBoxItemsService.list(new LambdaQueryWrapper<PutBoxItems>()
|
|
|
+ .eq(PutBoxItems::getIsDeleted, 0)
|
|
|
+ .eq(PutBoxItems::getTenantId, boxDynamicsRecord.getTenantId())
|
|
|
+ .in(PutBoxItems::getPid, putBoxIdList));
|
|
|
+ List<Long> srcIdList = putBoxList.stream().map(PutBox::getSrcId).collect(Collectors.toList());
|
|
|
+ List<TradingBox> tradingBoxList = new ArrayList<>();
|
|
|
+ if (!srcIdList.isEmpty()) {
|
|
|
+ tradingBoxList = tradingBoxMapper.selectList(new LambdaQueryWrapper<TradingBox>()
|
|
|
+ .eq(TradingBox::getTenantId, boxDynamicsRecord.getTenantId())
|
|
|
+ .eq(TradingBox::getIsDeleted, 0)
|
|
|
+ .in(TradingBox::getId, srcIdList));
|
|
|
+ }
|
|
|
+ List<TradingBoxItem> tradingBoxItemList = new ArrayList<>();
|
|
|
+ if (!tradingBoxList.isEmpty()) {
|
|
|
+ List<Long> tradingBoxIdList = tradingBoxList.stream().map(TradingBox::getId).collect(Collectors.toList());
|
|
|
+ tradingBoxItemList = tradingBoxItemService.list(new LambdaQueryWrapper<TradingBoxItem>()
|
|
|
+ .eq(TradingBoxItem::getIsDeleted, 0)
|
|
|
+ .eq(TradingBoxItem::getTenantId, boxDynamicsRecord.getTenantId())
|
|
|
+ .in(TradingBoxItem::getPid, tradingBoxIdList));
|
|
|
+ }
|
|
|
+ //自有箱-箱档案数据更新
|
|
|
+ List<Archives> archivesArrayList = new ArrayList<>();
|
|
|
+ //新放箱号单据
|
|
|
+ List<PutBox> putBoxNewList = new ArrayList<>();
|
|
|
+ //新放箱号单据
|
|
|
+ List<PutBox> putBoxes = new ArrayList<>();
|
|
|
+ //新放箱号单据明细数据
|
|
|
+ List<PutBoxItems> putBoxItemsNewList = new ArrayList<>();
|
|
|
+ //原放箱号单据明细数据
|
|
|
+ List<PutBoxItems> putBoxItemsOldFXList = new ArrayList<>();
|
|
|
+ //原放箱号单据明细数据
|
|
|
+ List<PutBoxItems> putBoxItemsOldList = new ArrayList<>();
|
|
|
+ //原OW单据明细数据
|
|
|
+ List<TradingBoxItem> tradingBoxItemOldList = new ArrayList<>();
|
|
|
+ List<TradingBox> tradingBoxes = new ArrayList<>();
|
|
|
+ for (BoxDynamicsRecordItems recordItems : itemsListFXHX) {
|
|
|
+ if (ObjectUtils.isNull(recordItems.getApproachExitDate())) {
|
|
|
+ recordItems.setApproachExitDate(new Date());
|
|
|
+ }
|
|
|
+ recordItems.setTemporaryId(StringTools.generateRandomString(32));
|
|
|
+ //箱档案信息处理
|
|
|
+ Archives archives = archivesList.stream().filter(e -> e.getCode().equals(recordItems.getBoxCode())).findFirst().orElse(null);
|
|
|
+ if (archives == null) {
|
|
|
+ failureHandling(type, boxDynamicsRecord, "未查到箱号:" + recordItems.getBoxCode() + "箱档案数据");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ //存储上一步数据
|
|
|
+ BoxNumUtils.storagePreviousStepData(archives, recordItems);
|
|
|
+
|
|
|
+ //原OW放-放箱号数据处理
|
|
|
+ Archives finalArchives = archives;
|
|
|
+ PutBox putBoxOldFX = putBoxList.stream().filter(e -> e.getContainerNumber().equals(finalArchives.getBillNo()))
|
|
|
+ .findFirst().orElse(null);
|
|
|
+ if (putBoxOldFX != null) {
|
|
|
+ PutBoxItems putBoxItem;
|
|
|
+ if (!putBoxItemsList.isEmpty()) {
|
|
|
+ putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(recordItems.getBoxCode())
|
|
|
+ && e.getPid().equals(putBoxOldFX.getId())).findFirst().orElse(null);
|
|
|
+ if (putBoxItem != null) {
|
|
|
+ putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem, recordItems, putBoxOldFX,
|
|
|
+ false, null, "已返场", "已还箱", "5", false);
|
|
|
+ if (putBoxItem.getTemporaryStatus()) {
|
|
|
+ failureHandling(type, boxDynamicsRecord, "放箱号:" + recordItems.getContainerNumber() + "中箱号:" +
|
|
|
+ recordItems.getBoxCode() + "未出场,不允许直接还箱");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ putBoxItemsOldFXList.add(putBoxItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!tradingBoxList.isEmpty()) {
|
|
|
+ TradingBox tradingBox = tradingBoxList.stream().filter(e -> e.getId().equals(putBoxOldFX.getSrcId()))
|
|
|
+ .findFirst().orElse(null);
|
|
|
+ if (tradingBox != null) {
|
|
|
+ recordItems.setSrcTradingBoxId(tradingBox.getId());
|
|
|
+ if (!tradingBoxes.isEmpty()) {
|
|
|
+ if (!tradingBoxes.stream().map(TradingBox::getId).collect(Collectors.toList()).contains(tradingBox.getId())) {
|
|
|
+ tradingBoxes.add(tradingBox);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ tradingBoxes.add(tradingBox);
|
|
|
+ }
|
|
|
+ TradingBoxItem tradingBoxItem;
|
|
|
+ if (!tradingBoxItemList.isEmpty()) {
|
|
|
+ tradingBoxItem = tradingBoxItemList.stream().filter(e -> e.getCode().equals(recordItems.getBoxCode()))
|
|
|
+ .findFirst().orElse(null);
|
|
|
+ if (tradingBoxItem != null) {
|
|
|
+ tradingBoxItem = EntryExitDataHandleUtils.tradingBoxItemDataHandle(tradingBoxItem, recordItems, tradingBox,
|
|
|
+ false, null, "已返场", "已还箱", "5");
|
|
|
+ tradingBoxItemOldList.add(tradingBoxItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //原自有箱放箱号数据处理
|
|
|
+ PutBox putBoxOld = putBoxList.stream().filter(e -> e.getContainerNumber().equals(recordItems.getContainerNumber())
|
|
|
+ && e.getPolId().equals(finalArchives.getAddressId()) && e.getPolStationId().equals(finalArchives.getStationId())
|
|
|
+ && e.getBoxType().equals(finalArchives.getTypeName())).findFirst().orElse(null);
|
|
|
+ if (putBoxOld != null) {
|
|
|
+ if (putBoxes.isEmpty()) {
|
|
|
+ putBoxes.add(putBoxOld);
|
|
|
+ } else {
|
|
|
+ PutBox putBox1 = putBoxes.stream().filter(e -> e.getId().equals(putBoxOld.getId())).findFirst().orElse(null);
|
|
|
+ if (putBox1 == null) {
|
|
|
+ putBoxes.add(putBoxOld);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ PutBoxItems putBoxItem;
|
|
|
+ if (!putBoxItemsList.isEmpty()) {
|
|
|
+ putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(recordItems.getBoxCode())
|
|
|
+ && e.getPid().equals(putBoxOld.getId())).findFirst().orElse(null);
|
|
|
+ if (putBoxItem != null) {
|
|
|
+ putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem, recordItems, putBoxOld,
|
|
|
+ false, null, "已返场", "已还箱", "5", false);
|
|
|
+ if (putBoxItem.getTemporaryStatus()) {
|
|
|
+ failureHandling(type, boxDynamicsRecord, "放箱号:" + recordItems.getContainerNumber() + "中箱号:" +
|
|
|
+ recordItems.getBoxCode() + "未出场,不允许直接还箱");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ putBoxItemsOldList.add(putBoxItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //箱档案数据处理
|
|
|
+ archives = ArchivesUtils.dataAssembly(archives, recordItems, "空箱提箱进场", "待使用", null);
|
|
|
+ archivesArrayList.add(archives);
|
|
|
+ //新放箱号数据处理
|
|
|
+ PutBox putBox = putBoxList.stream().filter(e -> e.getContainerNumber().equals(recordItems.getContainerNumber())
|
|
|
+ && e.getPolId().equals(recordItems.getPortId()) && e.getPolStationId().equals(recordItems.getStationId())
|
|
|
+ && e.getBoxType().equals(recordItems.getBoxType())).findFirst().orElse(null);
|
|
|
+ if (putBox != null) {
|
|
|
+ //放箱号明细数据处理
|
|
|
+ PutBoxItems putBoxItem;
|
|
|
+ if (!putBoxItemsList.isEmpty()) {
|
|
|
+ putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(recordItems.getBoxCode())
|
|
|
+ && putBox.getId().equals(e.getPid())).findFirst().orElse(null);
|
|
|
+ if (putBoxItem != null) {
|
|
|
+ putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(putBoxItem, recordItems, putBox,
|
|
|
+ false, null, "空箱提箱进场", "待使用", "5", false);
|
|
|
+ putBoxItemsNewList.add(putBoxItem);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ putBoxItem = EntryExitDataHandleUtils.putBoxItemDataHandle(null, recordItems, putBox,
|
|
|
+ false, null, "空箱提箱进场", "待使用", "5", false);
|
|
|
+ putBoxItemsNewList.add(putBoxItem);
|
|
|
+ }
|
|
|
+ recordItems.setSrcPutBoxPodId(putBox.getId());
|
|
|
+ if (putBoxNewList.isEmpty()) {
|
|
|
+ putBoxNewList.add(putBox);
|
|
|
+ } else {
|
|
|
+ PutBox putBox1 = putBoxNewList.stream().filter(e -> e.getId().equals(putBox.getId())).findFirst().orElse(null);
|
|
|
+ if (putBox1 == null) {
|
|
|
+ putBoxNewList.add(putBox);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ failureHandling(type, boxDynamicsRecord, "放箱号:" + recordItems.getContainerNumber() + "未查到");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!archivesArrayList.isEmpty()) {
|
|
|
+ archivesService.updateBatchById(archivesArrayList);
|
|
|
+ }
|
|
|
+ if (!putBoxItemsOldFXList.isEmpty()) {
|
|
|
+ putBoxItemsService.updateBatchById(putBoxItemsOldFXList);
|
|
|
+ }
|
|
|
+ if (!putBoxNewList.isEmpty()) {
|
|
|
+ for (PutBox item : putBoxNewList) {
|
|
|
+ if (!putBoxItemsNewList.isEmpty()) {
|
|
|
+ List<PutBoxItems> putBoxItems = putBoxItemsNewList.stream().filter(e -> e.getPid().equals(item.getId())).collect(Collectors.toList());
|
|
|
+ if (!putBoxItems.isEmpty()) {
|
|
|
+ item.setTotalNum((ObjectUtils.isNull(item.getTotalNum()) ? 0 : item.getTotalNum())
|
|
|
+ + putBoxItems.size());
|
|
|
+ item.setRemainingNum((ObjectUtils.isNull(item.getRemainingNum()) ? 0 : item.getRemainingNum()) + putBoxItems.size());
|
|
|
+ item.setStorageNum((ObjectUtils.isNull(item.getStorageNum()) ? 0 : item.getStorageNum()) + putBoxItems.size());
|
|
|
+ for (PutBoxItems boxItems : putBoxItems) {
|
|
|
+ if (ObjectUtils.isNotNull(item.getCode())) {
|
|
|
+ item.setCode(item.getCode() + "," + boxItems.getBoxCode());
|
|
|
+ } else {
|
|
|
+ item.setCode(boxItems.getBoxCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ item.setVersion(ObjectUtils.isNull(item.getVersion()) ? 1 : item.getVersion() + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ putBoxService.saveOrUpdateBatch(putBoxNewList);
|
|
|
+ }
|
|
|
+ if (!putBoxItemsNewList.isEmpty()) {
|
|
|
+ putBoxItemsService.saveOrUpdateBatch(putBoxItemsNewList);
|
|
|
+ for (PutBoxItems item : putBoxItemsNewList) {
|
|
|
+ PutBox putBox = putBoxNewList.stream().filter(e -> e.getId().equals(item.getPid())).findFirst().orElse(null);
|
|
|
+ if (putBox != null) {
|
|
|
+ //记录箱轨迹信息
|
|
|
+ ArchivesTrajectory archivesTrajectory = new ArchivesTrajectory();
|
|
|
+ archivesTrajectory.setPortId(putBox.getPolId());
|
|
|
+ archivesTrajectory.setPortCode(putBox.getPolCode());
|
|
|
+ archivesTrajectory.setPortCname(putBox.getPolCname());
|
|
|
+ archivesTrajectory.setPortEname(putBox.getPolEname());
|
|
|
+ archivesTrajectory.setStationId(putBox.getPolStationId());
|
|
|
+ archivesTrajectory.setStationCode(putBox.getPolStationCode());
|
|
|
+ archivesTrajectory.setStationCname(putBox.getPolStationCname());
|
|
|
+ archivesTrajectory.setStationEname(putBox.getPolStationEname());
|
|
|
+ archivesTrajectory.setContainerNumber(item.getContainerNumber());
|
|
|
+ archivesTrajectory.setBoxStatus(item.getBoxStatus());
|
|
|
+ archivesTrajectory.setBoxType(item.getBoxType());
|
|
|
+ archivesTrajectory.setBoxCategory(item.getBoxClass());
|
|
|
+ archivesTrajectory.setBoxEastId(item.getBoxEastId());
|
|
|
+ archivesTrajectory.setBoxEastName(item.getBoxEastName());
|
|
|
+ archivesTrajectory.setMblno(item.getMblno());
|
|
|
+ archivesTrajectory.setHblno(item.getHblno());
|
|
|
+ BoxDynamicsRecordItems dynamicsRecordItems = itemsListFXHX.stream().filter(e -> e.getBoxCode().equals(item.getBoxCode())).findFirst().orElse(null);
|
|
|
+ if (dynamicsRecordItems != null) {
|
|
|
+ archivesTrajectory.setBoxDynamics(BoxDynamicsEnums.getName(dynamicsRecordItems.getObjective()));
|
|
|
+ archivesTrajectory.setNewDate(dynamicsRecordItems.getApproachExitDate());
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(putBox.getPodId()) && !putBox.getPodId().contains(",")) {
|
|
|
+ archivesTrajectory.setPodId(Long.parseLong(putBox.getPodId()));
|
|
|
+ archivesTrajectory.setPodCode(putBox.getPodCode());
|
|
|
+ archivesTrajectory.setPodCname(putBox.getPodCname());
|
|
|
+ archivesTrajectory.setPodEname(putBox.getPodEname());
|
|
|
+ }
|
|
|
+ archivesTrajectory.setStatus(archivesTrajectory.getBoxDynamics());
|
|
|
+ archivesTrajectory.setBillType(putBox.getBoxClass());
|
|
|
+ archivesTrajectory.setCode(item.getBoxCode());
|
|
|
+ archivesTrajectory.setCreateTime(new Date());
|
|
|
+ archivesTrajectory.setCreateUser(AuthUtil.getUserId());
|
|
|
+ archivesTrajectory.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ archivesTrajectory.setTenantId(AuthUtil.getTenantId());
|
|
|
+ archivesTrajectory.setSrcId(putBox.getId());
|
|
|
+ archivesTrajectory.setEtd(item.getEtd());
|
|
|
+ archivesTrajectory.setPolCyId(item.getPolCyId());
|
|
|
+ archivesTrajectory.setPolCyCode(item.getPolCyCode());
|
|
|
+ archivesTrajectory.setPolCyCname(item.getPolCyCname());
|
|
|
+ archivesTrajectory.setPolCyEname(item.getPolCyEname());
|
|
|
+ archivesTrajectory.setPolFreeBoxUseDays(item.getPolFreeBoxUseDays());
|
|
|
+ archivesTrajectory.setPolPreAppearanceDate(item.getPolPreAppearanceDate());
|
|
|
+ archivesTrajectory.setPolStationEmptyContainerExitDate(item.getPolStationEmptyContainerExitDate());
|
|
|
+ archivesTrajectory.setPolReturnDate(item.getPolReturnDate());
|
|
|
+ archivesTrajectory.setPolOverdueBoxUseDays(item.getPolOverdueBoxUseDays());
|
|
|
+ archivesTrajectory.setEta(item.getEta());
|
|
|
+ archivesTrajectory.setPodEmptyContainerReturnDate(item.getPodEmptyContainerReturnDate());
|
|
|
+ archivesTrajectory.setPodStationId(item.getPodStationId());
|
|
|
+ archivesTrajectory.setPodStationCode(item.getPodStationCode());
|
|
|
+ archivesTrajectory.setPodStationCname(item.getPodStationCname());
|
|
|
+ archivesTrajectory.setPodStationEname(item.getPodStationEname());
|
|
|
+ archivesTrajectory.setPodFreeBoxUseDays(item.getPodFreeBoxUseDays());
|
|
|
+ archivesTrajectory.setPodBoxUseDays(item.getPodBoxUseDays());
|
|
|
+ archivesTrajectory.setShipNameId(item.getShipNameId());
|
|
|
+ archivesTrajectory.setShipCname(item.getShipCname());
|
|
|
+ archivesTrajectory.setShipEname(item.getShipEname());
|
|
|
+ archivesTrajectory.setShipCode(item.getShipCode());
|
|
|
+ archivesTrajectory.setVoyage(item.getVoyage());
|
|
|
+ archivesTrajectoryMapper.insert(archivesTrajectory);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!putBoxItemsOldList.isEmpty()) {
|
|
|
+ for (PutBoxItems item : putBoxItemsOldList) {
|
|
|
+ PutBox putBox = putBoxes.stream().filter(e -> e.getId().equals(item.getPid())).findFirst().orElse(null);
|
|
|
+ if (putBox != null) {
|
|
|
+ //记录箱轨迹信息
|
|
|
+ ArchivesTrajectory archivesTrajectory = new ArchivesTrajectory();
|
|
|
+ archivesTrajectory.setPortId(putBox.getPolId());
|
|
|
+ archivesTrajectory.setPortCode(putBox.getPolCode());
|
|
|
+ archivesTrajectory.setPortCname(putBox.getPolCname());
|
|
|
+ archivesTrajectory.setPortEname(putBox.getPolEname());
|
|
|
+ archivesTrajectory.setStationId(putBox.getPolStationId());
|
|
|
+ archivesTrajectory.setStationCode(putBox.getPolStationCode());
|
|
|
+ archivesTrajectory.setStationCname(putBox.getPolStationCname());
|
|
|
+ archivesTrajectory.setStationEname(putBox.getPolStationEname());
|
|
|
+ archivesTrajectory.setContainerNumber(item.getContainerNumber());
|
|
|
+ archivesTrajectory.setBoxStatus(item.getBoxStatus());
|
|
|
+ archivesTrajectory.setBoxType(item.getBoxType());
|
|
|
+ archivesTrajectory.setBoxCategory(item.getBoxClass());
|
|
|
+ archivesTrajectory.setBoxEastId(item.getBoxEastId());
|
|
|
+ archivesTrajectory.setBoxEastName(item.getBoxEastName());
|
|
|
+ archivesTrajectory.setMblno(item.getMblno());
|
|
|
+ archivesTrajectory.setHblno(item.getHblno());
|
|
|
+ BoxDynamicsRecordItems dynamicsRecordItems = itemsListFXHX.stream().filter(e -> e.getBoxCode().equals(item.getBoxCode())).findFirst().orElse(null);
|
|
|
+ if (dynamicsRecordItems != null) {
|
|
|
+ archivesTrajectory.setBoxDynamics(BoxDynamicsEnums.getName(dynamicsRecordItems.getObjective()));
|
|
|
+ archivesTrajectory.setNewDate(dynamicsRecordItems.getApproachExitDate());
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(putBox.getPodId()) && !putBox.getPodId().contains(",")) {
|
|
|
+ archivesTrajectory.setPodId(Long.parseLong(putBox.getPodId()));
|
|
|
+ archivesTrajectory.setPodCode(putBox.getPodCode());
|
|
|
+ archivesTrajectory.setPodCname(putBox.getPodCname());
|
|
|
+ archivesTrajectory.setPodEname(putBox.getPodEname());
|
|
|
+ }
|
|
|
+ archivesTrajectory.setStatus(archivesTrajectory.getBoxDynamics());
|
|
|
+ archivesTrajectory.setBillType(putBox.getBoxClass());
|
|
|
+ archivesTrajectory.setCode(item.getBoxCode());
|
|
|
+ archivesTrajectory.setCreateTime(new Date());
|
|
|
+ archivesTrajectory.setCreateUser(AuthUtil.getUserId());
|
|
|
+ archivesTrajectory.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ archivesTrajectory.setTenantId(AuthUtil.getTenantId());
|
|
|
+ archivesTrajectory.setSrcId(putBox.getId());
|
|
|
+ archivesTrajectory.setEtd(item.getEtd());
|
|
|
+ archivesTrajectory.setPolCyId(item.getPolCyId());
|
|
|
+ archivesTrajectory.setPolCyCode(item.getPolCyCode());
|
|
|
+ archivesTrajectory.setPolCyCname(item.getPolCyCname());
|
|
|
+ archivesTrajectory.setPolCyEname(item.getPolCyEname());
|
|
|
+ archivesTrajectory.setPolFreeBoxUseDays(item.getPolFreeBoxUseDays());
|
|
|
+ archivesTrajectory.setPolPreAppearanceDate(item.getPolPreAppearanceDate());
|
|
|
+ archivesTrajectory.setPolStationEmptyContainerExitDate(item.getPolStationEmptyContainerExitDate());
|
|
|
+ archivesTrajectory.setPolReturnDate(item.getPolReturnDate());
|
|
|
+ archivesTrajectory.setPolOverdueBoxUseDays(item.getPolOverdueBoxUseDays());
|
|
|
+ archivesTrajectory.setEta(item.getEta());
|
|
|
+ archivesTrajectory.setPodEmptyContainerReturnDate(item.getPodEmptyContainerReturnDate());
|
|
|
+ archivesTrajectory.setPodStationId(item.getPodStationId());
|
|
|
+ archivesTrajectory.setPodStationCode(item.getPodStationCode());
|
|
|
+ archivesTrajectory.setPodStationCname(item.getPodStationCname());
|
|
|
+ archivesTrajectory.setPodStationEname(item.getPodStationEname());
|
|
|
+ archivesTrajectory.setPodFreeBoxUseDays(item.getPodFreeBoxUseDays());
|
|
|
+ archivesTrajectory.setPodBoxUseDays(item.getPodBoxUseDays());
|
|
|
+ archivesTrajectory.setShipNameId(item.getShipNameId());
|
|
|
+ archivesTrajectory.setShipCname(item.getShipCname());
|
|
|
+ archivesTrajectory.setShipEname(item.getShipEname());
|
|
|
+ archivesTrajectory.setShipCode(item.getShipCode());
|
|
|
+ archivesTrajectory.setVoyage(item.getVoyage());
|
|
|
+ archivesTrajectoryMapper.insert(archivesTrajectory);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!putBoxItemsOldList.isEmpty()) {
|
|
|
+ putBoxItemsService.updateBatchById(putBoxItemsOldList);
|
|
|
+ }
|
|
|
+ if (!tradingBoxItemOldList.isEmpty()) {
|
|
|
+ tradingBoxItemService.updateBatchById(tradingBoxItemOldList);
|
|
|
+ }
|
|
|
+ for (BoxDynamicsRecordItems item : itemsListFXHX) {
|
|
|
+ item.setWhetherSynchronous("1");
|
|
|
+ if (!putBoxItemsNewList.isEmpty()) {
|
|
|
+ putBoxItemsNewList.stream().filter(e -> item.getTemporaryId().equals(e.getTemporaryId())).findFirst().ifPresent(putBox -> item.setSrcPutBoxItemsPodId(putBox.getId()));
|
|
|
+ }
|
|
|
+ if (!archivesArrayList.isEmpty()) {
|
|
|
+ archivesArrayList.stream().filter(e -> item.getTemporaryId().equals(e.getTemporaryId())).findFirst().ifPresent(putBox -> item.setSrcArchivesId(putBox.getId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ boxDynamicsRecordItemsService.updateBatchById(itemsListFXHX);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 进出场数据错误统一处理
|
|
|
*
|