|
|
@@ -451,7 +451,8 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
if (ObjectUtils.isNull(recordItems.getApproachExitDate())) {
|
|
|
recordItems.setApproachExitDate(new Date());
|
|
|
}
|
|
|
- recordItems.setTemporaryId(System.currentTimeMillis());
|
|
|
+ Random random = new Random();
|
|
|
+ recordItems.setTemporaryId(System.currentTimeMillis() + random.nextInt(100));
|
|
|
//箱档案信息处理
|
|
|
Archives archives = archivesList.stream().filter(e -> e.getCode().equals(recordItems.getBoxCode())).findFirst().orElse(null);
|
|
|
if (archives == null) {
|
|
|
@@ -1043,6 +1044,19 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
item.setUpdateTime(new Date());
|
|
|
}
|
|
|
containersService.updateBatchById(containersList);
|
|
|
+ List<Archives> archivesList = archivesService.list(new LambdaQueryWrapper<Archives>()
|
|
|
+ .eq(Archives::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Archives::getIsDeleted, 0)
|
|
|
+ .in(Archives::getCode, boxCode));
|
|
|
+ if (!archivesList.isEmpty()) {
|
|
|
+ for (Archives archives : archivesList) {
|
|
|
+ archives.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ archives.setUpdateTime(new Date());
|
|
|
+ archives.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ archives.setBillNo(billsNew.getHblno());
|
|
|
+ }
|
|
|
+ archivesService.updateBatchById(archivesList);
|
|
|
+ }
|
|
|
List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
|
|
|
.eq(PreContainers::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(PreContainers::getIsDeleted, 0)
|
|
|
@@ -1071,7 +1085,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
List<SeaContainerNumberItem> containerNumberItems = new ArrayList<>();
|
|
|
for (PreContainers item : preContainersList) {
|
|
|
//判断箱量是否大于箱型箱量和
|
|
|
- int boxNumber = containersList.stream().filter(e -> e.getCntrTypeCode().equals(item.getCntrTypeCode())).collect(Collectors.toList()).size();
|
|
|
+ int boxNumber = (int) containersList.stream().filter(e -> e.getCntrTypeCode().equals(item.getCntrTypeCode())).count();
|
|
|
if (boxNumber > item.getQuantity()) {
|
|
|
throw new RuntimeException("本次拆分箱型:" + item.getCntrTypeCode() + "箱量大于箱型中箱量");
|
|
|
}
|
|
|
@@ -1081,6 +1095,9 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
item.setUpdateUser(AuthUtil.getUserId());
|
|
|
item.setUpdateUserName(AuthUtil.getUserName());
|
|
|
item.setUpdateTime(new Date());
|
|
|
+ if (item.getQuantity() == 0){
|
|
|
+ item.setContainerNumberStatus("录入");
|
|
|
+ }
|
|
|
preContainers.add(item);
|
|
|
//修改原箱型占用放箱号记录数量
|
|
|
List<SeaContainerNumberItem> seaContainerNumberItems = containerNumberItemList.stream().filter(e -> e.getBoxType().equals(item.getCntrTypeCode()))
|
|
|
@@ -1100,9 +1117,9 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
SeaContainerNumberItem seaContainerNumberItem = containerNumberItemListNew.stream()
|
|
|
.filter(e -> e.getSrcId().equals(containerNumberItem.getSrcId())).findFirst().orElse(null);
|
|
|
if (seaContainerNumberItem != null) {
|
|
|
- seaContainerNumberItem.setOccupyNum(containerNumberItem.getOccupyNum() + containerNumberSum);
|
|
|
- seaContainerNumberItem.setActualOccupyNum(containerNumberItem.getActualOccupyNum() + containerNumberSum);
|
|
|
- seaContainerNumberItem.setOutNum(containerNumberItem.getOutNum() + containerNumberSum);
|
|
|
+ seaContainerNumberItem.setOccupyNum(seaContainerNumberItem.getOccupyNum() + containerNumberSum);
|
|
|
+ seaContainerNumberItem.setActualOccupyNum(seaContainerNumberItem.getActualOccupyNum() + containerNumberSum);
|
|
|
+ seaContainerNumberItem.setOutNum(seaContainerNumberItem.getOutNum() + containerNumberSum);
|
|
|
seaContainerNumberItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
seaContainerNumberItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
seaContainerNumberItem.setUpdateTime(new Date());
|
|
|
@@ -1135,6 +1152,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
preContainers1.setUpdateUser(AuthUtil.getUserId());
|
|
|
preContainers1.setUpdateUserName(AuthUtil.getUserName());
|
|
|
preContainers1.setUpdateTime(new Date());
|
|
|
+ preContainers1.setContainerNumberStatus("已选择");
|
|
|
preContainers.add(preContainers1);
|
|
|
} else {
|
|
|
throw new RuntimeException("提单号:" + billsNew.getHblno() + "未查到" + item.getCntrTypeCode() + "箱型");
|
|
|
@@ -1255,7 +1273,17 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
.in(PutBoxItems::getPid, srcIdList)
|
|
|
.in(PutBoxItems::getBoxCode, boxCode));
|
|
|
if (!putBoxItemsList.isEmpty()) {
|
|
|
+ List<PutBox> putBoxList = putBoxService.list(new LambdaQueryWrapper<PutBox>()
|
|
|
+ .eq(PutBox::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(PutBox::getIsDeleted, 0)
|
|
|
+ .in(PutBox::getId, srcIdList));
|
|
|
+ if (putBoxList.isEmpty()) {
|
|
|
+ throw new RuntimeException("未查到放箱号单据");
|
|
|
+ }
|
|
|
for (PutBoxItems putBoxItem : putBoxItemsList) {
|
|
|
+ if ("已还箱".equals(putBoxItem.getStatus())) {
|
|
|
+ throw new RuntimeException("箱号:" + putBoxItem.getBoxCode() + "已还箱");
|
|
|
+ }
|
|
|
putBoxItem.setMblno(billsNew.getMblno());
|
|
|
putBoxItem.setHblno(billsNew.getHblno());
|
|
|
putBoxItem.setAgentName(billsNew.getForeignAgencyCnName());
|
|
|
@@ -1269,12 +1297,68 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
putBoxItem.setUpdateTime(new Date());
|
|
|
putBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
putBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ PutBox putBox = putBoxList.stream().filter(e -> e.getId().equals(putBoxItem.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(putBoxItem.getContainerNumber());
|
|
|
+ archivesTrajectory.setBoxStatus(putBoxItem.getBoxStatus());
|
|
|
+ archivesTrajectory.setBoxType(putBoxItem.getBoxType());
|
|
|
+ archivesTrajectory.setBoxCategory(putBoxItem.getBoxClass());
|
|
|
+ archivesTrajectory.setBoxEastId(putBoxItem.getBoxEastId());
|
|
|
+ archivesTrajectory.setBoxEastName(putBoxItem.getBoxEastName());
|
|
|
+ archivesTrajectory.setMblno(putBoxItem.getMblno());
|
|
|
+ archivesTrajectory.setHblno(putBoxItem.getHblno());
|
|
|
+ archivesTrajectory.setBoxDynamics("海运出来-拆单");
|
|
|
+ archivesTrajectory.setNewDate(putBoxItem.getPolStationEmptyContainerExitDate());
|
|
|
+ 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.setBillType(putBox.getBoxClass());
|
|
|
+ archivesTrajectory.setCode(putBoxItem.getBoxCode());
|
|
|
+ archivesTrajectory.setCreateTime(new Date());
|
|
|
+ archivesTrajectory.setCreateUser(AuthUtil.getUserId());
|
|
|
+ archivesTrajectory.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ archivesTrajectory.setTenantId(AuthUtil.getTenantId());
|
|
|
+ archivesTrajectory.setSrcId(putBox.getId());
|
|
|
+ archivesTrajectory.setEtd(putBoxItem.getEtd());
|
|
|
+ archivesTrajectory.setPolCyId(putBoxItem.getPolCyId());
|
|
|
+ archivesTrajectory.setPolCyCode(putBoxItem.getPolCyCode());
|
|
|
+ archivesTrajectory.setPolCyCname(putBoxItem.getPolCyCname());
|
|
|
+ archivesTrajectory.setPolCyEname(putBoxItem.getPolCyEname());
|
|
|
+ archivesTrajectory.setPolFreeBoxUseDays(putBoxItem.getPolFreeBoxUseDays());
|
|
|
+ archivesTrajectory.setPolPreAppearanceDate(putBoxItem.getPolPreAppearanceDate());
|
|
|
+ archivesTrajectory.setPolStationEmptyContainerExitDate(putBoxItem.getPolStationEmptyContainerExitDate());
|
|
|
+ archivesTrajectory.setPolReturnDate(putBoxItem.getPolReturnDate());
|
|
|
+ archivesTrajectory.setPolOverdueBoxUseDays(putBoxItem.getPolOverdueBoxUseDays());
|
|
|
+ archivesTrajectory.setEta(putBoxItem.getEta());
|
|
|
+ archivesTrajectory.setPodEmptyContainerReturnDate(putBoxItem.getPodEmptyContainerReturnDate());
|
|
|
+ archivesTrajectory.setPodStationId(putBoxItem.getPodStationId());
|
|
|
+ archivesTrajectory.setPodStationCode(putBoxItem.getPodStationCode());
|
|
|
+ archivesTrajectory.setPodStationCname(putBoxItem.getPodStationCname());
|
|
|
+ archivesTrajectory.setPodStationEname(putBoxItem.getPodStationEname());
|
|
|
+ archivesTrajectory.setPodFreeBoxUseDays(putBoxItem.getPodFreeBoxUseDays());
|
|
|
+ archivesTrajectory.setPodBoxUseDays(putBoxItem.getPodBoxUseDays());
|
|
|
+ archivesTrajectory.setShipNameId(putBoxItem.getShipNameId());
|
|
|
+ archivesTrajectory.setShipCname(putBoxItem.getShipCname());
|
|
|
+ archivesTrajectory.setShipEname(putBoxItem.getShipEname());
|
|
|
+ archivesTrajectory.setShipCode(putBoxItem.getShipCode());
|
|
|
+ archivesTrajectory.setVoyage(putBoxItem.getVoyage());
|
|
|
+ archivesTrajectoryMapper.insert(archivesTrajectory);
|
|
|
+ }
|
|
|
}
|
|
|
putBoxItemsService.updateBatchById(putBoxItemsList);
|
|
|
- List<PutBox> putBoxList = putBoxService.list(new LambdaQueryWrapper<PutBox>()
|
|
|
- .eq(PutBox::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(PutBox::getIsDeleted, 0)
|
|
|
- .in(PutBox::getId, srcIdList));
|
|
|
if (!putBoxList.isEmpty()) {
|
|
|
List<Long> srcIdOWList = putBoxList.stream().map(PutBox::getSrcId)
|
|
|
.filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
@@ -1284,7 +1368,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
.eq(TradingBoxItem::getIsDeleted, 0)
|
|
|
.in(TradingBoxItem::getPid, srcIdOWList)
|
|
|
.in(TradingBoxItem::getCode, boxCode));
|
|
|
- if (!putBoxItemsList.isEmpty()) {
|
|
|
+ if (!tradingBoxItemList.isEmpty()) {
|
|
|
for (TradingBoxItem tradingBoxItem : tradingBoxItemList) {
|
|
|
tradingBoxItem.setAgentName(billsNew.getForeignAgencyCnName());
|
|
|
tradingBoxItem.setActualEtd(billsNew.getActualEtd());
|
|
|
@@ -1303,9 +1387,37 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
tradingBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
}
|
|
|
tradingBoxItemService.updateBatchById(tradingBoxItemList);
|
|
|
+ TradingBox tradingBox = tradingBoxMapper.selectById(tradingBoxItemList.get(0).getPid());
|
|
|
+ if (tradingBox != null){
|
|
|
+ tradingBox.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ tradingBox.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ tradingBox.setUpdateTime(new Date());
|
|
|
+ int version = StringUtil.isBlank(tradingBox.getVersion()) ? 1 : Integer.parseInt(tradingBox.getVersion());
|
|
|
+ tradingBox.setVersion(String.valueOf(version + 1));
|
|
|
+ tradingBox.setCode(tradingBox.getCode().replaceAll(bills.getHblno(),""));
|
|
|
+ tradingBox.setCode(tradingBox.getCode().replaceAll(",,",","));
|
|
|
+ tradingBoxMapper.updateById(tradingBox);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ List<Long> putBoxItemsIdList = putBoxItemsList.stream().map(PutBoxItems::getId).collect(Collectors.toList());
|
|
|
+ List<BoxDynamicsRecordItems> dynamicsRecordItemsList = boxDynamicsRecordItemsService.list(new LambdaQueryWrapper<BoxDynamicsRecordItems>()
|
|
|
+ .eq(BoxDynamicsRecordItems::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(BoxDynamicsRecordItems::getIsDeleted, 0)
|
|
|
+ .in(BoxDynamicsRecordItems::getBoxCode, boxCode)
|
|
|
+ .in(BoxDynamicsRecordItems::getSrcPutBoxItemsId, putBoxItemsIdList)
|
|
|
+ .apply("find_in_set(objective,'BX,WD,Q,QZ,XO')"));
|
|
|
+ if (!dynamicsRecordItemsList.isEmpty()) {
|
|
|
+ for (BoxDynamicsRecordItems item : dynamicsRecordItemsList) {
|
|
|
+ item.setUpdateTime(new Date());
|
|
|
+ item.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ item.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ item.setHblno(billsNew.getHblno());
|
|
|
+ logUtils.saveOperationLog("海运出口拆单", "提单号:" + bills.getHblno() + "=>" + billsNew.getHblno(), item.getId());
|
|
|
+ }
|
|
|
+ boxDynamicsRecordItemsService.updateBatchById(dynamicsRecordItemsList);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1381,7 +1493,8 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
if (ObjectUtils.isNull(item.getApproachExitDate())) {
|
|
|
item.setApproachExitDate(new Date());
|
|
|
}
|
|
|
- item.setTemporaryId(System.currentTimeMillis());
|
|
|
+ Random random = new Random();
|
|
|
+ item.setTemporaryId(System.currentTimeMillis() + random.nextInt(100));
|
|
|
PutBox putBox = putBoxList.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber())
|
|
|
&& ObjectUtils.isNotNull(e.getPolId()) && e.getPolId().equals(item.getPortId())
|
|
|
&& ObjectUtils.isNotNull(e.getPolStationId()) && e.getPolStationId().equals(item.getStationId())).findFirst().orElse(null);
|
|
|
@@ -1728,7 +1841,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
}
|
|
|
tradingBox.setSuitcaseNum(tradingBox.getSuitcaseNum() + Integer.parseInt(count1 + ""));
|
|
|
if ("OW(拿)".contains(item.getBoxClass())) {
|
|
|
- if (tradingBox.getSuitcaseNum() > tradingBox.getBoxNumber()) {
|
|
|
+ if (tradingBox.getSuitcaseNum() > tradingBox.getBoxNumber()-tradingBox.getCancelNumber()) {
|
|
|
failureHandling(type, boxDynamicsRecord, "OW(拿)已提箱数量大于协议数量");
|
|
|
return false;
|
|
|
}
|
|
|
@@ -1922,6 +2035,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
List<String> hblno = itemsListJC.stream().map(BoxDynamicsRecordItems::getHblno).filter(Objects::nonNull)
|
|
|
.distinct().collect(Collectors.toList());
|
|
|
List<Containers> containersList = new ArrayList<>();
|
|
|
+ List<Containers> containersListNew = new ArrayList<>();
|
|
|
List<PreContainers> preContainersList = new ArrayList<>();
|
|
|
List<PreContainers> preContainersListNew = new ArrayList<>();
|
|
|
List<SeaContainerNumberItem> containerNumberItemList = new ArrayList<>();
|
|
|
@@ -2090,6 +2204,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
tradingBoxItem.setShipCname("");
|
|
|
tradingBoxItem.setShipEname("");
|
|
|
tradingBoxItem.setPolFreeBoxUseDays(0);
|
|
|
+ tradingBoxItem.setPolOverdueBoxUseDays(0);
|
|
|
tradingBoxItem.setEtd(null);
|
|
|
}
|
|
|
if ("HX".equals(type)) {
|
|
|
@@ -2122,12 +2237,12 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
item.setVersion(item.getVersion() + 1);
|
|
|
if ("JC,DBJ,TG".contains(type)) {
|
|
|
if (!"OW(拿)".equals(item.getBoxClass()) && !"DBJ".equals(type)) {
|
|
|
- if (item.getRemainingNum()<count){
|
|
|
+ if (item.getRemainingNum() < count) {
|
|
|
throw new RemoteException("可用数量不足,撤销失败");
|
|
|
}
|
|
|
item.setRemainingNum(item.getRemainingNum() - Integer.parseInt(count + ""));
|
|
|
}
|
|
|
- if (item.getStorageNum()<count){
|
|
|
+ if (item.getStorageNum() < count) {
|
|
|
throw new RemoteException("盘存数量不足,撤销失败");
|
|
|
}
|
|
|
item.setStorageNum(item.getStorageNum() - Integer.parseInt(count + ""));
|
|
|
@@ -2150,30 +2265,40 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
|
|
|
Comparator.comparing(f -> f.getContainerNumber() + f.getCntrNo()))), ArrayList::new));
|
|
|
if (!containers.isEmpty()) {
|
|
|
- long size = containers.stream().filter(e -> ObjectUtils.isNotNull(e.getContainerNumber()) &&
|
|
|
- e.getContainerNumber().equals(item.getContainerNumber()) && boxList.contains(e.getCntrNo())).count();
|
|
|
- boolean whetherAppearStatus = false;
|
|
|
- if (!containerNumberItemList.isEmpty()) {
|
|
|
- SeaContainerNumberItem containerNumberItems = containerNumberItemList.stream()
|
|
|
- .filter(e -> e.getSrcId().equals(item.getId())).findFirst().orElse(null);
|
|
|
- if (containerNumberItems != null) {
|
|
|
- containerNumberItems.setOutNum(containerNumberItems.getOutNum() - Integer.parseInt(size + ""));
|
|
|
- if (!containerNumberItems.getOutNum().equals(containerNumberItems.getOccupyNum())) {
|
|
|
- containerNumberItems.setWhetherAppearStatus("0");
|
|
|
- whetherAppearStatus = true;
|
|
|
+ List<Containers> containers1 = containers.stream().filter(e -> ObjectUtils.isNotNull(e.getContainerNumber()) &&
|
|
|
+ e.getContainerNumber().equals(item.getContainerNumber()) && boxList.contains(e.getCntrNo())).collect(Collectors.toList());
|
|
|
+ if (!containers1.isEmpty()){
|
|
|
+ boolean whetherAppearStatus = false;
|
|
|
+ if (!containerNumberItemList.isEmpty()) {
|
|
|
+ SeaContainerNumberItem containerNumberItems = containerNumberItemList.stream()
|
|
|
+ .filter(e -> e.getSrcId().equals(item.getId())).findFirst().orElse(null);
|
|
|
+ if (containerNumberItems != null) {
|
|
|
+ containerNumberItems.setOutNum(containerNumberItems.getOutNum() - Integer.parseInt(containers1.size() + ""));
|
|
|
+ if (!containerNumberItems.getOutNum().equals(containerNumberItems.getOccupyNum())) {
|
|
|
+ containerNumberItems.setWhetherAppearStatus("0");
|
|
|
+ whetherAppearStatus = true;
|
|
|
+ }
|
|
|
+ containerNumberItemListNew.add(containerNumberItems);
|
|
|
}
|
|
|
- containerNumberItemListNew.add(containerNumberItems);
|
|
|
}
|
|
|
- }
|
|
|
- if (!preContainersList.isEmpty()) {
|
|
|
- PreContainers preContainers = preContainersList.stream().filter(e -> e.getPid().equals(containers.get(0).getPid()) &&
|
|
|
- item.getBoxType().equals(e.getCntrTypeCode())).findFirst().orElse(null);
|
|
|
- if (preContainers != null) {
|
|
|
- if (whetherAppearStatus) {
|
|
|
- preContainers.setWhetherAppearStatus("0");
|
|
|
- preContainersListNew.add(preContainers);
|
|
|
+ if (!preContainersList.isEmpty()) {
|
|
|
+ PreContainers preContainers = preContainersList.stream().filter(e -> e.getPid().equals(containers.get(0).getPid()) &&
|
|
|
+ item.getBoxType().equals(e.getCntrTypeCode())).findFirst().orElse(null);
|
|
|
+ if (preContainers != null) {
|
|
|
+ if (whetherAppearStatus) {
|
|
|
+ preContainers.setWhetherAppearStatus("0");
|
|
|
+ preContainersListNew.add(preContainers);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ for (Containers containers2 : containers1){
|
|
|
+ containers2.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ containers2.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ containers2.setUpdateTime(new Date());
|
|
|
+ containers2.setContainerNumber("");
|
|
|
+ containers2.setBoxSrcType("");
|
|
|
+ containersListNew.add(containers2);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -2190,6 +2315,9 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
if (!containerNumberItemListNew.isEmpty()) {
|
|
|
seaContainerNumberItemService.updateBatchById(containerNumberItemListNew);
|
|
|
}
|
|
|
+ if (!containersListNew.isEmpty()) {
|
|
|
+ containersService.updateBatchById(containersListNew);
|
|
|
+ }
|
|
|
} else {
|
|
|
throw new RemoteException("撤销失败未查到原放箱号数据,请联系管理员");
|
|
|
}
|
|
|
@@ -2398,7 +2526,8 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
if (ObjectUtils.isNull(recordItems.getApproachExitDate())) {
|
|
|
recordItems.setApproachExitDate(new Date());
|
|
|
}
|
|
|
- recordItems.setTemporaryId(System.currentTimeMillis());
|
|
|
+ Random random = new Random();
|
|
|
+ recordItems.setTemporaryId(System.currentTimeMillis() + random.nextInt(100));
|
|
|
//箱档案信息处理
|
|
|
Archives archives = archivesList.stream().filter(e -> e.getCode().equals(recordItems.getBoxCode())).findFirst().orElse(null);
|
|
|
if (archives == null) {
|
|
|
@@ -2951,7 +3080,8 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
if (ObjectUtils.isNull(item.getApproachExitDate())) {
|
|
|
item.setApproachExitDate(new Date());
|
|
|
}
|
|
|
- item.setTemporaryId(System.currentTimeMillis());
|
|
|
+ Random random = new Random();
|
|
|
+ item.setTemporaryId(System.currentTimeMillis() + random.nextInt(100));
|
|
|
PutBox putBox = putBoxList.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber())
|
|
|
&& ObjectUtils.isNotNull(e.getPolId()) && e.getPolId().equals(item.getPortId())
|
|
|
&& ObjectUtils.isNotNull(e.getPolStationId()) && e.getPolStationId().equals(item.getStationId())).findFirst().orElse(null);
|
|
|
@@ -3450,7 +3580,8 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
if (ObjectUtils.isNull(recordItems.getApproachExitDate())) {
|
|
|
recordItems.setApproachExitDate(new Date());
|
|
|
}
|
|
|
- recordItems.setTemporaryId(System.currentTimeMillis());
|
|
|
+ Random random = new Random();
|
|
|
+ recordItems.setTemporaryId(System.currentTimeMillis() + random.nextInt(100));
|
|
|
//箱档案信息处理
|
|
|
Archives archives = archivesList.stream().filter(e -> e.getCode().equals(recordItems.getBoxCode())).findFirst().orElse(null);
|
|
|
if (archives == null) {
|
|
|
@@ -3876,7 +4007,8 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
//OW单据明细数据
|
|
|
List<TradingBoxItem> tradingBoxItemOldList = new ArrayList<>();
|
|
|
for (BoxDynamicsRecordItems recordItems : itemsListRC) {
|
|
|
- recordItems.setTemporaryId(System.currentTimeMillis());
|
|
|
+ Random random = new Random();
|
|
|
+ recordItems.setTemporaryId(System.currentTimeMillis() + random.nextInt(100));
|
|
|
//箱档案信息处理
|
|
|
Archives archives = archivesList.stream().filter(e -> e.getCode().equals(recordItems.getBoxCode())).findFirst().orElse(null);
|
|
|
if (archives == null) {
|
|
|
@@ -4113,7 +4245,8 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
if (ObjectUtils.isNull(item.getApproachExitDate())) {
|
|
|
item.setApproachExitDate(new Date());
|
|
|
}
|
|
|
- item.setTemporaryId(System.currentTimeMillis());
|
|
|
+ Random random = new Random();
|
|
|
+ item.setTemporaryId(System.currentTimeMillis() + random.nextInt(100));
|
|
|
PutBox putBoxData;
|
|
|
PutBox putBox = putBoxList.stream().filter(e -> e.getContainerNumber().equals(item.getHblno())
|
|
|
&& ObjectUtils.isNotNull(e.getPolId()) && e.getPolId().equals(item.getPortId())
|
|
|
@@ -4342,13 +4475,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
tradingBoxItem.setBoxEastName(tradingBox.getPurchaseCompanyName());
|
|
|
tradingBoxItem.setTemporaryId(item.getTemporaryId());
|
|
|
tradingBoxItems.add(tradingBoxItem);
|
|
|
- } else {
|
|
|
- failureHandling(type, boxDynamicsRecord, "放箱号:" + item.getContainerNumber() + "未查到OW单据");
|
|
|
- return false;
|
|
|
}
|
|
|
- } else {
|
|
|
- failureHandling(type, boxDynamicsRecord, "放箱号:" + item.getContainerNumber() + "未查到OW单据");
|
|
|
- return false;
|
|
|
}
|
|
|
} else {
|
|
|
failureHandling(type, boxDynamicsRecord, "未查到放箱号:" + item.getContainerNumber() + "单据");
|
|
|
@@ -4379,14 +4506,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
failureHandling(type, boxDynamicsRecord, "放箱号:" + item.getContainerNumber() + "剩余场地盘存小于本次导入箱数");
|
|
|
return false;
|
|
|
}
|
|
|
- if (tradingBoxes.isEmpty()) {
|
|
|
- item.setTotalNum(item.getTotalNum() - Integer.parseInt(count + ""));
|
|
|
- item.setRemainingNum(item.getRemainingNum() - Integer.parseInt(count + ""));
|
|
|
- if (item.getRemainingNum() < 0) {
|
|
|
- failureHandling(type, boxDynamicsRecord, "放箱号:" + item.getContainerNumber() + "剩余可用小于本次导入箱数");
|
|
|
- return false;
|
|
|
- }
|
|
|
- } else {
|
|
|
+ if (!tradingBoxes.isEmpty()){
|
|
|
TradingBox tradingBox = tradingBoxes.stream().filter(e -> e.getId().equals(item.getSrcId())).findFirst().orElse(null);
|
|
|
if (tradingBox != null) {
|
|
|
if (ObjectUtils.isNotNull(tradingBox.getCode())) {
|
|
|
@@ -4407,6 +4527,14 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
tradingBoxMapper.updateById(tradingBox);
|
|
|
}
|
|
|
}
|
|
|
+ /*if (tradingBoxes.isEmpty()) {
|
|
|
+ item.setTotalNum(item.getTotalNum() - Integer.parseInt(count + ""));
|
|
|
+ item.setRemainingNum(item.getRemainingNum() - Integer.parseInt(count + ""));
|
|
|
+ if (item.getRemainingNum() < 0) {
|
|
|
+ failureHandling(type, boxDynamicsRecord, "放箱号:" + item.getContainerNumber() + "剩余可用小于本次导入箱数");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }*/
|
|
|
item.setVersion(ObjectUtils.isNull(item.getVersion()) ? 1 : item.getVersion() + 1);
|
|
|
putBoxList1.add(item);
|
|
|
}
|
|
|
@@ -4610,7 +4738,8 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
if (ObjectUtils.isNull(item.getApproachExitDate())) {
|
|
|
item.setApproachExitDate(new Date());
|
|
|
}
|
|
|
- item.setTemporaryId(System.currentTimeMillis());
|
|
|
+ Random random = new Random();
|
|
|
+ item.setTemporaryId(System.currentTimeMillis() + random.nextInt(100));
|
|
|
PutBox putBoxData;
|
|
|
PutBox putBox = putBoxList.stream().filter(e -> e.getContainerNumber().equals(item.getHblno())
|
|
|
&& ObjectUtils.isNotNull(e.getPolId()) && e.getPolId().equals(item.getPortId())
|
|
|
@@ -4635,6 +4764,10 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
//箱档案数据处理
|
|
|
Archives archives = archivesList.stream().filter(e -> e.getCode().equals(item.getBoxCode())).findFirst().orElse(null);
|
|
|
if (archives != null) {
|
|
|
+ if (!archives.getContainerNumber().equals(item.getContainerNumber())){
|
|
|
+ failureHandling(type, boxDynamicsRecord, "箱号:" + archives.getCode()+"在箱档案中放箱号与本次出场放箱号不符");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
//存储上一步数据
|
|
|
BoxNumUtils.storagePreviousStepData(archives, item);
|
|
|
if (!archives.getTypeName().equals(item.getBoxType())) {
|
|
|
@@ -4649,7 +4782,9 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
archives.setUpdateUser(AuthUtil.getUserId());
|
|
|
archives.setUpdateUserName(AuthUtil.getUserName());
|
|
|
} else {
|
|
|
- if (!"OW(拿),代理箱,租箱".contains(putBoxData.getBoxClass())) {
|
|
|
+ failureHandling(type, boxDynamicsRecord, "箱档案中未查到箱号:" + item.getBoxCode());
|
|
|
+ return false;
|
|
|
+ /*if (!"OW(拿),代理箱,租箱".contains(putBoxData.getBoxClass())) {
|
|
|
failureHandling(type, boxDynamicsRecord, "箱档案中未查到箱号:" + item.getBoxCode());
|
|
|
return false;
|
|
|
}
|
|
|
@@ -4662,7 +4797,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
archives.setContainerNumber(item.getContainerNumber());
|
|
|
archives.setContainerNumberType(putBoxData.getBoxClass());
|
|
|
archives.setTypeName(item.getBoxType());
|
|
|
- archives.setBoxType(putBoxData.getBoxClass());
|
|
|
+ archives.setBoxType(putBoxData.getBoxClass());*/
|
|
|
}
|
|
|
archives.setContainerNumberOw(item.getContainerNumber());
|
|
|
archives.setContainerNumberTypeOw(putBoxData.getBoxClass());
|
|
|
@@ -4705,6 +4840,18 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
failureHandling(type, boxDynamicsRecord, "提单号:" + bills.getHblno() + "对应海运出口单据,箱型:" + item.getBoxType() + "未生占用放箱号");
|
|
|
return false;
|
|
|
}
|
|
|
+ if (!containerNumberItemList.isEmpty()){
|
|
|
+ List<SeaContainerNumberItem> seaContainerNumberItems = containerNumberItemList.stream().filter(e->
|
|
|
+ e.getPid().equals(bills.getId()) && e.getBoxType().equals(preContainers.getCntrTypeCode())
|
|
|
+ && e.getContainerNumber().equals(putBoxData.getContainerNumber())).collect(Collectors.toList());
|
|
|
+ if (seaContainerNumberItems.isEmpty()){
|
|
|
+ failureHandling(type, boxDynamicsRecord, "提单号:"+bills.getHblno()+"与本次出场放箱号:"+putBoxData.getContainerNumber()+"不符");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ failureHandling(type, boxDynamicsRecord, "未查到占用放箱号数据");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
failureHandling(type, boxDynamicsRecord, "提单号:" + bills.getHblno() + "对应海运出口单据未生成配箱列表");
|
|
|
@@ -4738,7 +4885,9 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
putBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
putBoxItem.setUpdateTime(new Date());
|
|
|
} else {
|
|
|
- if ("OW(拿)".equals(putBoxData.getBoxClass())) {
|
|
|
+ failureHandling(type, boxDynamicsRecord, "OW(拿)放箱号:" + item.getContainerNumber() + "未查到进场记录");
|
|
|
+ return false;
|
|
|
+ /*if ("OW(拿)".equals(putBoxData.getBoxClass())) {
|
|
|
failureHandling(type, boxDynamicsRecord, "OW(拿)放箱号:" + item.getContainerNumber() + "未查到进场记录");
|
|
|
return false;
|
|
|
}
|
|
|
@@ -4753,10 +4902,12 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
putBoxItem.setBoxType(item.getBoxType());
|
|
|
putBoxItem.setCreateUser(AuthUtil.getUserId());
|
|
|
putBoxItem.setCreateUserName(AuthUtil.getUserName());
|
|
|
- putBoxItem.setCreateTime(new Date());
|
|
|
+ putBoxItem.setCreateTime(new Date());*/
|
|
|
}
|
|
|
} else {
|
|
|
- if ("OW(拿)".equals(putBoxData.getBoxClass())) {
|
|
|
+ failureHandling(type, boxDynamicsRecord, "OW(拿)放箱号:" + item.getContainerNumber() + "未查到进场记录");
|
|
|
+ return false;
|
|
|
+ /*if ("OW(拿)".equals(putBoxData.getBoxClass())) {
|
|
|
failureHandling(type, boxDynamicsRecord, "OW(拿)放箱号:" + item.getContainerNumber() + "未查到进场记录");
|
|
|
return false;
|
|
|
}
|
|
|
@@ -4771,7 +4922,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
putBoxItem.setBoxType(item.getBoxType());
|
|
|
putBoxItem.setCreateUser(AuthUtil.getUserId());
|
|
|
putBoxItem.setCreateUserName(AuthUtil.getUserName());
|
|
|
- putBoxItem.setCreateTime(new Date());
|
|
|
+ putBoxItem.setCreateTime(new Date());*/
|
|
|
}
|
|
|
if (ObjectUtils.isNotNull(putBoxData.getPodId()) && !putBoxData.getPodId().contains(",")) {
|
|
|
putBoxItem.setPodStationId(putBoxData.getPodStationId());
|
|
|
@@ -4985,12 +5136,12 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
if (recordItems != null) {
|
|
|
containers.setCntrNo(recordItems.getBoxCode());
|
|
|
containers.setContainerNumber(recordItems.getContainerNumber());
|
|
|
- recordItems.setAssigned("1");
|
|
|
containers.setPolCyId(recordItems.getStationId());
|
|
|
containers.setPolCyCode(recordItems.getStationCode());
|
|
|
containers.setPolCyCname(recordItems.getStationCname());
|
|
|
containers.setPolCyEname(recordItems.getStationEname());
|
|
|
containers.setPolStationEmptyContainerExitDate(recordItems.getApproachExitDate());
|
|
|
+ containers.setBoxSrcType(putBoxData.getBoxClass());
|
|
|
if (!tradingBoxItemList.isEmpty()) {
|
|
|
TradingBoxItem tradingBoxItem = tradingBoxItemList.stream().filter(e -> e.getCode().equals(recordItems.getBoxCode()))
|
|
|
.findFirst().orElse(null);
|
|
|
@@ -5006,17 +5157,25 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
}
|
|
|
}
|
|
|
logUtils.saveOperationLog(OperatorType.API_DATA_SYNCHRONIZATION, OperatorType.CC, containers.getId());
|
|
|
+ recordItems.setAssigned("1");
|
|
|
+ containers.setWhetherAppearStatus("1");
|
|
|
+ int version = StringUtil.isBlank(containers.getVersion()) ? 1 : Integer.parseInt(containers.getVersion());
|
|
|
+ containers.setVersion(String.valueOf(version + 1));
|
|
|
+ containers.setUpdateTime(new Date());
|
|
|
+ containers.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ containers.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ containersListNew.add(containers);
|
|
|
}
|
|
|
} else {
|
|
|
BoxDynamicsRecordItems recordItems = hblnoList.stream().filter(e -> containers.getCntrNo().equals(e.getBoxCode())).findFirst().orElse(null);
|
|
|
if (recordItems != null) {
|
|
|
- containers.setCntrNo(recordItems.getBoxCode());
|
|
|
containers.setContainerNumber(recordItems.getContainerNumber());
|
|
|
containers.setPolCyId(recordItems.getStationId());
|
|
|
containers.setPolCyCode(recordItems.getStationCode());
|
|
|
containers.setPolCyCname(recordItems.getStationCname());
|
|
|
containers.setPolCyEname(recordItems.getStationEname());
|
|
|
containers.setPolStationEmptyContainerExitDate(recordItems.getApproachExitDate());
|
|
|
+ containers.setBoxSrcType(putBoxData.getBoxClass());
|
|
|
if (!tradingBoxItemList.isEmpty()) {
|
|
|
TradingBoxItem tradingBoxItem = tradingBoxItemList.stream().filter(e -> e.getCode().equals(recordItems.getBoxCode()))
|
|
|
.findFirst().orElse(null);
|
|
|
@@ -5031,14 +5190,19 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
|
|
|
containers.setPodCyTel(tradingBoxItem.getPodCyTel());
|
|
|
}
|
|
|
}
|
|
|
- logUtils.saveOperationLog(OperatorType.API_DATA_SYNCHRONIZATION, OperatorType.CC, containers.getId());
|
|
|
+ if (!"1".equals(recordItems.getAssigned())) {
|
|
|
+ logUtils.saveOperationLog(OperatorType.API_DATA_SYNCHRONIZATION, OperatorType.CC, containers.getId());
|
|
|
+ }
|
|
|
+ recordItems.setAssigned("1");
|
|
|
+ containers.setWhetherAppearStatus("1");
|
|
|
+ int version = StringUtil.isBlank(containers.getVersion()) ? 1 : Integer.parseInt(containers.getVersion());
|
|
|
+ containers.setVersion(String.valueOf(version + 1));
|
|
|
+ containers.setUpdateTime(new Date());
|
|
|
+ containers.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ containers.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ containersListNew.add(containers);
|
|
|
}
|
|
|
}
|
|
|
- containers.setBoxSrcType(putBoxData.getBoxClass());
|
|
|
- containers.setWhetherAppearStatus("1");
|
|
|
- int version = StringUtil.isBlank(containers.getVersion()) ? 1 : Integer.parseInt(containers.getVersion());
|
|
|
- containers.setVersion(String.valueOf(version + 1));
|
|
|
- containersListNew.add(containers);
|
|
|
}
|
|
|
} else {
|
|
|
failureHandling(type, boxDynamicsRecord, "未查到对应提单号:" + item.getMblno() + "配箱单据");
|