|
|
@@ -43,11 +43,17 @@ import org.springblade.los.box.dto.BoxPoolItemDTO;
|
|
|
import org.springblade.los.box.dto.BoxPoolPortDTO;
|
|
|
import org.springblade.los.box.entity.*;
|
|
|
import org.springblade.los.box.excel.EmptyContainerAppearance;
|
|
|
+import org.springblade.los.box.excel.GiveAnEncore;
|
|
|
import org.springblade.los.box.mapper.ArchivesTrajectoryMapper;
|
|
|
import org.springblade.los.box.mapper.PutBoxMapper;
|
|
|
import org.springblade.los.box.mapper.TradingBoxMapper;
|
|
|
import org.springblade.los.box.service.*;
|
|
|
import org.springblade.los.box.vo.PutBoxVO;
|
|
|
+import org.springblade.los.business.sea.entity.Bills;
|
|
|
+import org.springblade.los.business.sea.entity.Containers;
|
|
|
+import org.springblade.los.business.sea.mapper.BillsMapper;
|
|
|
+import org.springblade.los.business.sea.service.IBillsService;
|
|
|
+import org.springblade.los.business.sea.service.IContainersService;
|
|
|
import org.springblade.los.excel.RouteCostProfitExcel;
|
|
|
import org.springblade.resource.feign.IOssClient;
|
|
|
import org.springblade.system.feign.ISysClient;
|
|
|
@@ -97,6 +103,10 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
|
|
|
private final IBCorpsService bCorpsService;
|
|
|
|
|
|
+ private final BillsMapper billsMapper;
|
|
|
+
|
|
|
+ private final IContainersService containersService;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<PutBoxVO> selectPutBoxPage(IPage<PutBoxVO> page, PutBoxVO putBox) {
|
|
|
return null;
|
|
|
@@ -640,6 +650,22 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
.eq(BCorps::getIsDeleted, 0)
|
|
|
.in(BCorps::getCnName, stationName));
|
|
|
}
|
|
|
+ List<String> mblno = excelList.stream().map(EmptyContainerAppearance::getMblno).filter(Objects::nonNull)
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
+ List<Containers> containersList = new ArrayList<>();
|
|
|
+ List<Containers> containersListNew = new ArrayList<>();
|
|
|
+ if (!mblno.isEmpty()) {
|
|
|
+ List<Bills> billsList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
+ .eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Bills::getIsDeleted, 0)
|
|
|
+ .in(Bills::getMblno, portName));
|
|
|
+ if (!billsList.isEmpty()) {
|
|
|
+ containersList = containersService.list(new LambdaQueryWrapper<Containers>()
|
|
|
+ .eq(Containers::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Containers::getIsDeleted, 0)
|
|
|
+ .in(Containers::getMblno, billsList.stream().map(Bills::getId).collect(Collectors.toList())));
|
|
|
+ }
|
|
|
+ }
|
|
|
List<PutBox> putBoxList = baseMapper.selectList(new LambdaQueryWrapper<PutBox>()
|
|
|
.eq(PutBox::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(PutBox::getIsDeleted, 0)
|
|
|
@@ -860,10 +886,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
tradingBoxItem.setPolCyCname(corps.getCnName());
|
|
|
tradingBoxItem.setPolCyEname(corps.getEnName());
|
|
|
if (ObjectUtils.isNotNull(item.getBoxStatusDate())) {
|
|
|
- tradingBoxItem.setRentEndDate(item.getBoxStatusDate());
|
|
|
tradingBoxItem.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
|
|
|
} else {
|
|
|
- tradingBoxItem.setRentEndDate(new Date());
|
|
|
tradingBoxItem.setPolStationEmptyContainerExitDate(new Date());
|
|
|
}
|
|
|
tradingBoxItem.setStatus("待使用");
|
|
|
@@ -899,10 +923,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
tradingBoxItem.setPolCyEname(corps.getEnName());
|
|
|
tradingBoxItem.setActivationDate(tradingBox.getActivationDate());
|
|
|
if (ObjectUtils.isNotNull(item.getBoxStatusDate())) {
|
|
|
- tradingBoxItem.setRentEndDate(item.getBoxStatusDate());
|
|
|
tradingBoxItem.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
|
|
|
} else {
|
|
|
- tradingBoxItem.setRentEndDate(new Date());
|
|
|
tradingBoxItem.setPolStationEmptyContainerExitDate(new Date());
|
|
|
}
|
|
|
tradingBoxItem.setStatus("待使用");
|
|
|
@@ -938,10 +960,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
tradingBoxItem.setPolCyEname(corps.getEnName());
|
|
|
tradingBoxItem.setActivationDate(tradingBox.getActivationDate());
|
|
|
if (ObjectUtils.isNotNull(item.getBoxStatusDate())) {
|
|
|
- tradingBoxItem.setRentEndDate(item.getBoxStatusDate());
|
|
|
tradingBoxItem.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
|
|
|
} else {
|
|
|
- tradingBoxItem.setRentEndDate(new Date());
|
|
|
tradingBoxItem.setPolStationEmptyContainerExitDate(new Date());
|
|
|
}
|
|
|
tradingBoxItem.setStatus("待使用");
|
|
|
@@ -959,6 +979,18 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
} else {
|
|
|
throw new RuntimeException("未查到放箱号:" + item.getContainerNumber() + "单据");
|
|
|
}
|
|
|
+ if (!containersList.isEmpty()) {
|
|
|
+ Containers containers = containersList.stream().filter(e -> ObjectUtils.isNotNull(item.getMblno()) &&
|
|
|
+ item.getMblno().equals(e.getMblno()) && item.getBoxCode().equals(e.getCntrNo())).findFirst().orElse(null);
|
|
|
+ if (containers != null) {
|
|
|
+ containers.setPolCyId(corps.getId());
|
|
|
+ containers.setPolCyCode(corps.getCode());
|
|
|
+ containers.setPolCyCname(corps.getCnName());
|
|
|
+ containers.setPolCyEname(corps.getEnName());
|
|
|
+ containers.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
|
|
|
+ containersListNew.add(containers);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if (!putBoxes.isEmpty()) {
|
|
|
for (PutBox item : putBoxes) {
|
|
|
@@ -1005,6 +1037,9 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
if (!putBoxItems.isEmpty()) {
|
|
|
putBoxItemsService.saveOrUpdateBatch(putBoxItems);
|
|
|
}
|
|
|
+ if (!containersListNew.isEmpty()) {
|
|
|
+ containersService.saveOrUpdateBatch(containersListNew);
|
|
|
+ }
|
|
|
if (!archivesArrayList.isEmpty()) {
|
|
|
archivesService.saveOrUpdateBatch(archivesArrayList);
|
|
|
}
|
|
|
@@ -1077,11 +1112,11 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public R giveAnEncore(MultipartFile file) throws IOException {
|
|
|
//导入数据
|
|
|
- List<EmptyContainerAppearance> excelList = ExcelUtil.read(file, EmptyContainerAppearance.class);
|
|
|
+ List<GiveAnEncore> excelList = ExcelUtil.read(file, GiveAnEncore.class);
|
|
|
if (CollectionUtils.isEmpty(excelList)) {
|
|
|
throw new SecurityException("数据不能为空");
|
|
|
}
|
|
|
- List<String> boxCodeList = excelList.stream().map(EmptyContainerAppearance::getBoxCode)
|
|
|
+ List<String> boxCodeList = excelList.stream().map(GiveAnEncore::getBoxCode)
|
|
|
.distinct().collect(Collectors.toList());
|
|
|
//箱档案数据
|
|
|
List<Archives> archivesList = archivesService.list(new LambdaQueryWrapper<Archives>()
|
|
|
@@ -1105,13 +1140,13 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
if (!containerNumberOwList.isEmpty()) {
|
|
|
containerNumberList.addAll(containerNumberOwList);
|
|
|
}
|
|
|
- List<String> boxType = excelList.stream().map(EmptyContainerAppearance::getBoxType).filter(Objects::nonNull)
|
|
|
+ List<String> boxType = excelList.stream().map(GiveAnEncore::getBoxType).filter(Objects::nonNull)
|
|
|
.distinct().collect(Collectors.toList());
|
|
|
List<BCntrTypes> cntrTypesList = bCntrTypesService.list(new LambdaQueryWrapper<BCntrTypes>()
|
|
|
.eq(BCntrTypes::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(BCntrTypes::getIsDeleted, 0)
|
|
|
.in(BCntrTypes::getCnName, boxType));
|
|
|
- List<String> portName = excelList.stream().map(EmptyContainerAppearance::getPortName).filter(Objects::nonNull)
|
|
|
+ List<String> portName = excelList.stream().map(GiveAnEncore::getPortName).filter(Objects::nonNull)
|
|
|
.distinct().collect(Collectors.toList());
|
|
|
List<BPorts> portsList = new ArrayList<>();
|
|
|
if (!portName.isEmpty()) {
|
|
|
@@ -1120,7 +1155,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
.eq(BPorts::getIsDeleted, 0)
|
|
|
.in(BPorts::getCnName, portName));
|
|
|
}
|
|
|
- List<String> stationName = excelList.stream().map(EmptyContainerAppearance::getStationName).filter(Objects::nonNull)
|
|
|
+ List<String> stationName = excelList.stream().map(GiveAnEncore::getStationName).filter(Objects::nonNull)
|
|
|
.distinct().collect(Collectors.toList());
|
|
|
List<BCorps> corpsList = new ArrayList<>();
|
|
|
if (!stationName.isEmpty()) {
|
|
|
@@ -1129,6 +1164,22 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
.eq(BCorps::getIsDeleted, 0)
|
|
|
.in(BCorps::getCnName, stationName));
|
|
|
}
|
|
|
+ List<String> mblno = excelList.stream().map(GiveAnEncore::getMblno).filter(Objects::nonNull)
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
+ List<Containers> containersList = new ArrayList<>();
|
|
|
+ List<Containers> containersListNew = new ArrayList<>();
|
|
|
+ if (!mblno.isEmpty()) {
|
|
|
+ List<Bills> billsList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
+ .eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Bills::getIsDeleted, 0)
|
|
|
+ .in(Bills::getMblno, portName));
|
|
|
+ if (!billsList.isEmpty()) {
|
|
|
+ containersList = containersService.list(new LambdaQueryWrapper<Containers>()
|
|
|
+ .eq(Containers::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Containers::getIsDeleted, 0)
|
|
|
+ .in(Containers::getMblno, billsList.stream().map(Bills::getId).collect(Collectors.toList())));
|
|
|
+ }
|
|
|
+ }
|
|
|
List<PutBox> putBoxList = baseMapper.selectList(new LambdaQueryWrapper<PutBox>()
|
|
|
.eq(PutBox::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(PutBox::getIsDeleted, 0)
|
|
|
@@ -1178,7 +1229,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
if (businessType == null) {
|
|
|
throw new RuntimeException("未找到可用业务类型");
|
|
|
}
|
|
|
- for (EmptyContainerAppearance item : excelList) {
|
|
|
+ for (GiveAnEncore item : excelList) {
|
|
|
BPorts ports = portsList.stream().filter(e -> e.getCnName().equals(item.getPortName())).findFirst().orElse(null);
|
|
|
if (ports == null) {
|
|
|
throw new RemoteException("请先维护港口:" + item.getPortName() + "基础资料");
|
|
|
@@ -1254,11 +1305,23 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
throw new RemoteException("箱号:" + item.getBoxCode() + "放箱号类型错误");
|
|
|
}
|
|
|
}
|
|
|
+ if (!containersList.isEmpty()) {
|
|
|
+ Containers containers = containersList.stream().filter(e -> ObjectUtils.isNotNull(item.getMblno()) &&
|
|
|
+ item.getMblno().equals(e.getMblno()) && item.getBoxCode().equals(e.getCntrNo())).findFirst().orElse(null);
|
|
|
+ if (containers != null) {
|
|
|
+ containers.setPodStationId(corps.getId());
|
|
|
+ containers.setPodStationCode(corps.getCode());
|
|
|
+ containers.setPodStationCname(corps.getCnName());
|
|
|
+ containers.setPodStationEname(corps.getEnName());
|
|
|
+ containers.setPodEmptyContainerReturnDate(item.getBoxStatusDate());
|
|
|
+ containersListNew.add(containers);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if (!putBoxNewList.isEmpty()) {
|
|
|
this.saveOrUpdateBatch(putBoxNewList);
|
|
|
}
|
|
|
- for (EmptyContainerAppearance item : excelList) {
|
|
|
+ for (GiveAnEncore item : excelList) {
|
|
|
BCntrTypes cntrTypes = cntrTypesList.stream().filter(e -> e.getCnName().equals(item.getBoxType())).findFirst().orElse(null);
|
|
|
if (cntrTypes == null) {
|
|
|
throw new RemoteException("请先维护箱型:" + item.getBoxType() + "基础资料");
|
|
|
@@ -1373,6 +1436,9 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
if (!archivesDateleList.isEmpty()) {
|
|
|
archivesService.removeByIds(archivesDateleList);
|
|
|
}
|
|
|
+ if (!containersListNew.isEmpty()) {
|
|
|
+ containersService.removeByIds(containersListNew);
|
|
|
+ }
|
|
|
if (!putBoxItemsOldList.isEmpty()) {
|
|
|
putBoxItemsService.updateBatchById(putBoxItemsOldList);
|
|
|
}
|
|
|
@@ -1395,7 +1461,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
return R.data("操作成功");
|
|
|
}
|
|
|
|
|
|
- private Archives updateArchives(Archives archives, EmptyContainerAppearance item, BPorts ports, BCorps corps) {
|
|
|
+ private Archives updateArchives(Archives archives, GiveAnEncore item, BPorts ports, BCorps corps) {
|
|
|
archives.setUpdateTime(new Date());
|
|
|
archives.setUpdateUser(AuthUtil.getUserId());
|
|
|
archives.setUpdateUserName(AuthUtil.getUserName());
|
|
|
@@ -1413,7 +1479,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
return archives;
|
|
|
}
|
|
|
|
|
|
- private List<TradingBoxItem> updatePutBoxItemsTrading(List<PutBox> putBoxList, Archives archives, EmptyContainerAppearance item,
|
|
|
+ private List<TradingBoxItem> updatePutBoxItemsTrading(List<PutBox> putBoxList, Archives archives, GiveAnEncore item,
|
|
|
BCorps corps, List<TradingBox> tradingBoxList,
|
|
|
List<TradingBoxItem> tradingBoxItemList, BPorts ports, String status) {
|
|
|
PutBox putBoxOld;
|
|
|
@@ -1473,7 +1539,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
return tradingBoxItemOldList;
|
|
|
}
|
|
|
|
|
|
- private List<PutBoxItems> updatePutBoxItems(List<PutBox> putBoxList, Archives archives, EmptyContainerAppearance item,
|
|
|
+ private List<PutBoxItems> updatePutBoxItems(List<PutBox> putBoxList, Archives archives, GiveAnEncore item,
|
|
|
BCorps corps, List<PutBoxItems> putBoxItemsList, String status) {
|
|
|
PutBox putBoxOld;
|
|
|
if ("1".equals(status)) {
|
|
|
@@ -1633,11 +1699,11 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public R returnEmpty(MultipartFile file) throws IOException {
|
|
|
//导入数据
|
|
|
- List<EmptyContainerAppearance> excelList = ExcelUtil.read(file, EmptyContainerAppearance.class);
|
|
|
+ List<GiveAnEncore> excelList = ExcelUtil.read(file, GiveAnEncore.class);
|
|
|
if (CollectionUtils.isEmpty(excelList)) {
|
|
|
throw new SecurityException("数据不能为空");
|
|
|
}
|
|
|
- List<String> boxCodeList = excelList.stream().map(EmptyContainerAppearance::getBoxCode)
|
|
|
+ List<String> boxCodeList = excelList.stream().map(GiveAnEncore::getBoxCode)
|
|
|
.distinct().collect(Collectors.toList());
|
|
|
//箱档案数据
|
|
|
List<Archives> archivesList = archivesService.list(new LambdaQueryWrapper<Archives>()
|
|
|
@@ -1656,13 +1722,13 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
}
|
|
|
List<String> containerNumberList = archivesList.stream().map(Archives::getContainerNumber)
|
|
|
.distinct().collect(Collectors.toList());
|
|
|
- List<String> boxType = excelList.stream().map(EmptyContainerAppearance::getBoxType).filter(Objects::nonNull)
|
|
|
+ List<String> boxType = excelList.stream().map(GiveAnEncore::getBoxType).filter(Objects::nonNull)
|
|
|
.distinct().collect(Collectors.toList());
|
|
|
List<BCntrTypes> cntrTypesList = bCntrTypesService.list(new LambdaQueryWrapper<BCntrTypes>()
|
|
|
.eq(BCntrTypes::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(BCntrTypes::getIsDeleted, 0)
|
|
|
.in(BCntrTypes::getCnName, boxType));
|
|
|
- List<String> portName = excelList.stream().map(EmptyContainerAppearance::getPortName).filter(Objects::nonNull)
|
|
|
+ List<String> portName = excelList.stream().map(GiveAnEncore::getPortName).filter(Objects::nonNull)
|
|
|
.distinct().collect(Collectors.toList());
|
|
|
List<BPorts> portsList = new ArrayList<>();
|
|
|
if (!portName.isEmpty()) {
|
|
|
@@ -1671,7 +1737,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
.eq(BPorts::getIsDeleted, 0)
|
|
|
.in(BPorts::getCnName, portName));
|
|
|
}
|
|
|
- List<String> stationName = excelList.stream().map(EmptyContainerAppearance::getStationName).filter(Objects::nonNull)
|
|
|
+ List<String> stationName = excelList.stream().map(GiveAnEncore::getStationName).filter(Objects::nonNull)
|
|
|
.distinct().collect(Collectors.toList());
|
|
|
List<BCorps> corpsList = new ArrayList<>();
|
|
|
if (!stationName.isEmpty()) {
|
|
|
@@ -1680,6 +1746,22 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
.eq(BCorps::getIsDeleted, 0)
|
|
|
.in(BCorps::getCnName, stationName));
|
|
|
}
|
|
|
+ List<String> mblno = excelList.stream().map(GiveAnEncore::getMblno).filter(Objects::nonNull)
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
+ List<Containers> containersList = new ArrayList<>();
|
|
|
+ List<Containers> containersListNew = new ArrayList<>();
|
|
|
+ if (!mblno.isEmpty()) {
|
|
|
+ List<Bills> billsList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
+ .eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Bills::getIsDeleted, 0)
|
|
|
+ .in(Bills::getMblno, portName));
|
|
|
+ if (!billsList.isEmpty()) {
|
|
|
+ containersList = containersService.list(new LambdaQueryWrapper<Containers>()
|
|
|
+ .eq(Containers::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Containers::getIsDeleted, 0)
|
|
|
+ .in(Containers::getMblno, billsList.stream().map(Bills::getId).collect(Collectors.toList())));
|
|
|
+ }
|
|
|
+ }
|
|
|
List<PutBox> putBoxList = baseMapper.selectList(new LambdaQueryWrapper<PutBox>()
|
|
|
.eq(PutBox::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(PutBox::getIsDeleted, 0)
|
|
|
@@ -1729,7 +1811,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
if (businessType == null) {
|
|
|
throw new RuntimeException("未找到可用业务类型");
|
|
|
}
|
|
|
- for (EmptyContainerAppearance item : excelList) {
|
|
|
+ for (GiveAnEncore item : excelList) {
|
|
|
BPorts ports = portsList.stream().filter(e -> e.getCnName().equals(item.getPortName())).findFirst().orElse(null);
|
|
|
if (ports == null) {
|
|
|
throw new RemoteException("请先维护港口:" + item.getPortName() + "基础资料");
|
|
|
@@ -1800,13 +1882,25 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
} else {
|
|
|
throw new RemoteException("箱号:" + item.getBoxCode() + "放箱号类型错误");
|
|
|
}
|
|
|
+ if (!containersList.isEmpty()) {
|
|
|
+ Containers containers = containersList.stream().filter(e -> ObjectUtils.isNotNull(item.getMblno()) &&
|
|
|
+ item.getMblno().equals(e.getMblno()) && item.getBoxCode().equals(e.getCntrNo())).findFirst().orElse(null);
|
|
|
+ if (containers != null) {
|
|
|
+ containers.setPolCyId(corps.getId());
|
|
|
+ containers.setPolCyCode(corps.getCode());
|
|
|
+ containers.setPolCyCname(corps.getCnName());
|
|
|
+ containers.setPolCyEname(corps.getEnName());
|
|
|
+ containers.setPolReturnDate(item.getBoxStatusDate());
|
|
|
+ containersListNew.add(containers);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if (!putBoxNewList.isEmpty()) {
|
|
|
this.saveOrUpdateBatch(putBoxNewList);
|
|
|
} else {
|
|
|
throw new RemoteException("保存放箱号单据失败");
|
|
|
}
|
|
|
- for (EmptyContainerAppearance item : excelList) {
|
|
|
+ for (GiveAnEncore item : excelList) {
|
|
|
BCntrTypes cntrTypes = cntrTypesList.stream().filter(e -> e.getCnName().equals(item.getBoxType())).findFirst().orElse(null);
|
|
|
if (cntrTypes == null) {
|
|
|
throw new RemoteException("请先维护箱型:" + item.getBoxType() + "基础资料");
|
|
|
@@ -1911,13 +2005,24 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
if (!archivesArrayList.isEmpty()) {
|
|
|
archivesService.saveOrUpdateBatch(archivesArrayList);
|
|
|
}
|
|
|
+ if (!containersListNew.isEmpty()) {
|
|
|
+ containersService.saveOrUpdateBatch(containersListNew);
|
|
|
+ }
|
|
|
if (!archivesDateleList.isEmpty()) {
|
|
|
archivesService.removeByIds(archivesDateleList);
|
|
|
}
|
|
|
if (!putBoxItemsOldList.isEmpty()) {
|
|
|
+ for (PutBoxItems item : putBoxItemsOldList){
|
|
|
+ item.setPolReturnDate(item.getPodEmptyContainerReturnDate());
|
|
|
+ item.setPodEmptyContainerReturnDate(null);
|
|
|
+ }
|
|
|
putBoxItemsService.updateBatchById(putBoxItemsOldList);
|
|
|
}
|
|
|
if (!tradingBoxItemOldList.isEmpty()) {
|
|
|
+ for (TradingBoxItem item : tradingBoxItemOldList){
|
|
|
+ item.setPolReturnDate(item.getPodEmptyContainerReturnDate());
|
|
|
+ item.setPodEmptyContainerReturnDate(null);
|
|
|
+ }
|
|
|
tradingBoxItemService.updateBatchById(tradingBoxItemOldList);
|
|
|
}
|
|
|
ArchivesFiles archivesFiles = new ArchivesFiles();
|
|
|
@@ -1954,4 +2059,467 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
details.setInternalContainerNumber("");
|
|
|
return details;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R emptyContainerEntry(MultipartFile file) throws IOException {
|
|
|
+ //导入数据
|
|
|
+ List<EmptyContainerAppearance> excelList = ExcelUtil.read(file, EmptyContainerAppearance.class);
|
|
|
+ if (CollectionUtils.isEmpty(excelList)) {
|
|
|
+ throw new SecurityException("数据不能为空");
|
|
|
+ }
|
|
|
+ List<String> boxCodeList = excelList.stream().map(EmptyContainerAppearance::getBoxCode)
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
+ //箱档案数据
|
|
|
+ List<Archives> archivesList = archivesService.list(new LambdaQueryWrapper<Archives>()
|
|
|
+ .eq(Archives::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Archives::getIsDeleted, 0)
|
|
|
+ .in(Archives::getCode, boxCodeList));
|
|
|
+ List<String> containerNumberList = excelList.stream().map(EmptyContainerAppearance::getContainerNumber)
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
+ List<String> boxType = excelList.stream().map(EmptyContainerAppearance::getBoxType).filter(Objects::nonNull)
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
+ List<BCntrTypes> cntrTypesList = bCntrTypesService.list(new LambdaQueryWrapper<BCntrTypes>()
|
|
|
+ .eq(BCntrTypes::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(BCntrTypes::getIsDeleted, 0)
|
|
|
+ .in(BCntrTypes::getCnName, boxType));
|
|
|
+ List<String> portName = excelList.stream().map(EmptyContainerAppearance::getPortName).filter(Objects::nonNull)
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
+ List<BPorts> portsList = new ArrayList<>();
|
|
|
+ if (!portName.isEmpty()) {
|
|
|
+ portsList = bPortsService.list(new LambdaQueryWrapper<BPorts>()
|
|
|
+ .eq(BPorts::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(BPorts::getIsDeleted, 0)
|
|
|
+ .in(BPorts::getCnName, portName));
|
|
|
+ }
|
|
|
+ List<String> stationName = excelList.stream().map(EmptyContainerAppearance::getStationName).filter(Objects::nonNull)
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
+ List<BCorps> corpsList = new ArrayList<>();
|
|
|
+ if (!stationName.isEmpty()) {
|
|
|
+ corpsList = bCorpsService.list(new LambdaQueryWrapper<BCorps>()
|
|
|
+ .eq(BCorps::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(BCorps::getIsDeleted, 0)
|
|
|
+ .in(BCorps::getCnName, stationName));
|
|
|
+ }
|
|
|
+ List<PutBox> putBoxList = baseMapper.selectList(new LambdaQueryWrapper<PutBox>()
|
|
|
+ .eq(PutBox::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(PutBox::getIsDeleted, 0)
|
|
|
+ .in(PutBox::getContainerNumber, containerNumberList));
|
|
|
+ if (putBoxList.isEmpty()) {
|
|
|
+ throw new RuntimeException("未查到放箱号单据");
|
|
|
+ }
|
|
|
+ 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, AuthUtil.getTenantId())
|
|
|
+ .in(PutBoxItems::getPid, putBoxIdList));
|
|
|
+
|
|
|
+ String blacklist = sysClient.getParamService("box.blacklist");
|
|
|
+ if (ObjectUtils.isNotNull(blacklist)) {
|
|
|
+ StringBuilder text = new StringBuilder();
|
|
|
+ for (String item : boxCodeList) {
|
|
|
+ if (item.length() > 3) {
|
|
|
+ String head = item.substring(0, 3);
|
|
|
+ if (blacklist.contains(head)) {
|
|
|
+ text.append(item).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(text.toString())) {
|
|
|
+ throw new RuntimeException("箱号:" + text + "为黑名单箱,请修改数据后再操作");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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, AuthUtil.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, AuthUtil.getTenantId())
|
|
|
+ .in(TradingBoxItem::getPid, tradingBoxIdList));
|
|
|
+ }
|
|
|
+ List<PutBoxItems> putBoxItems = new ArrayList<>();
|
|
|
+ List<TradingBoxItem> tradingBoxItems = new ArrayList<>();
|
|
|
+ List<Archives> archivesArrayList = new ArrayList<>();
|
|
|
+ List<PutBox> putBoxes = new ArrayList<>();
|
|
|
+ List<TradingBox> tradingBoxes = new ArrayList<>();
|
|
|
+ for (EmptyContainerAppearance item : excelList) {
|
|
|
+ BCntrTypes cntrTypes = cntrTypesList.stream().filter(e -> e.getCnName().equals(item.getBoxType())).findFirst().orElse(null);
|
|
|
+ if (cntrTypes == null) {
|
|
|
+ throw new RemoteException("请先维护箱型:" + item.getBoxType() + "基础资料");
|
|
|
+ }
|
|
|
+ BPorts ports = portsList.stream().filter(e -> e.getCnName().equals(item.getPortName())).findFirst().orElse(null);
|
|
|
+ if (ports == null) {
|
|
|
+ throw new RemoteException("请先维护港口:" + item.getPortName() + "基础资料");
|
|
|
+ }
|
|
|
+ BCorps corps = corpsList.stream().filter(e -> e.getCnName().equals(item.getStationName())).findFirst().orElse(null);
|
|
|
+ if (corps == null) {
|
|
|
+ throw new RemoteException("请先维护场站:" + item.getStationName() + "基础资料");
|
|
|
+ }
|
|
|
+ PutBox putBox = putBoxList.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber())
|
|
|
+ && ObjectUtils.isNotNull(e.getPolId()) && e.getPolId().equals(ports.getId())
|
|
|
+ && ObjectUtils.isNotNull(e.getPolStationId()) && e.getPolStationId().equals(corps.getId())).findFirst().orElse(null);
|
|
|
+ if (putBox != null) {
|
|
|
+ if (!putBoxes.isEmpty()) {
|
|
|
+ if (!putBoxes.stream().map(PutBox::getId).collect(Collectors.toList()).contains(putBox.getId())) {
|
|
|
+ putBoxes.add(putBox);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ putBoxes.add(putBox);
|
|
|
+ }
|
|
|
+ //箱档案数据处理
|
|
|
+ Archives archives = archivesList.stream().filter(e -> e.getCode().equals(item.getBoxCode())).findFirst().orElse(null);
|
|
|
+ if (archives != null) {
|
|
|
+ if ("OW(放)".equals(putBox.getBusType())) {
|
|
|
+ archives.setContainerNumberOw(item.getContainerNumber());
|
|
|
+ archives.setContainerNumberTypeOw("OW(放)");
|
|
|
+ }
|
|
|
+ if (!archives.getTypeName().equals(item.getBoxType())) {
|
|
|
+ throw new RemoteException("箱号:" + item.getBoxCode() + "与箱档案中箱型不符");
|
|
|
+ }
|
|
|
+ if ("使用中".equals(archives.getStatus())) {
|
|
|
+ throw new RemoteException("箱号:" + item.getBoxCode() + "状态为使用中");
|
|
|
+ }
|
|
|
+ archives.setUpdateTime(new Date());
|
|
|
+ archives.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ archives.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ archives.setStatus("待使用");
|
|
|
+ archives.setNewDate(item.getBoxStatusDate());
|
|
|
+ archives.setBoxDynamics("空箱提箱进场");
|
|
|
+ archives.setAddressId(ports.getId());
|
|
|
+ archives.setAddressCode(ports.getCode());
|
|
|
+ archives.setAddressCname(ports.getCnName());
|
|
|
+ archives.setAddressEname(ports.getEnName());
|
|
|
+ archives.setStationId(corps.getId());
|
|
|
+ archives.setStationCode(corps.getCode());
|
|
|
+ archives.setStationCname(corps.getCnName());
|
|
|
+ archives.setStationEname(corps.getEnName());
|
|
|
+ } else {
|
|
|
+ if (!"OW(拿)".equals(putBox.getBusType())) {
|
|
|
+ throw new RuntimeException("箱档案中未查到箱号:" + item.getBoxCode());
|
|
|
+ }
|
|
|
+ archives = new Archives();
|
|
|
+ archives.setCode(item.getBoxCode());
|
|
|
+ archives.setCreateTime(new Date());
|
|
|
+ archives.setCreateUser(AuthUtil.getUserId());
|
|
|
+ archives.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ archives.setStatus("待使用");
|
|
|
+ archives.setNewDate(item.getBoxStatusDate());
|
|
|
+ archives.setBoxDynamics("空箱提箱进场");
|
|
|
+ archives.setBoxBelongsTo("SOC");
|
|
|
+ archives.setContainerNumber(item.getContainerNumber());
|
|
|
+ archives.setContainerNumberType(putBox.getBusType());
|
|
|
+ archives.setTypeId(cntrTypes.getId());
|
|
|
+ archives.setTypeName(cntrTypes.getCnName());
|
|
|
+ archives.setBoxType(putBox.getBusType());
|
|
|
+ archives.setAddressId(ports.getId());
|
|
|
+ archives.setAddressCode(ports.getCode());
|
|
|
+ archives.setAddressCname(ports.getCnName());
|
|
|
+ archives.setAddressEname(ports.getEnName());
|
|
|
+ archives.setStationId(corps.getId());
|
|
|
+ archives.setStationCode(corps.getCode());
|
|
|
+ archives.setStationCname(corps.getCnName());
|
|
|
+ archives.setStationEname(corps.getEnName());
|
|
|
+ }
|
|
|
+ archivesArrayList.add(archives);
|
|
|
+ if (ObjectUtils.isNotNull(putBox.getBoxType()) && !putBox.getBoxType().equals(item.getBoxType())) {
|
|
|
+ throw new RemoteException("放箱号:" + item.getContainerNumber() + "箱型不符合");
|
|
|
+ }
|
|
|
+ //放箱号明细数据处理
|
|
|
+ PutBoxItems putBoxItem;
|
|
|
+ if (!putBoxItemsList.isEmpty()) {
|
|
|
+ putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(item.getBoxCode()))
|
|
|
+ .findFirst().orElse(null);
|
|
|
+ if (putBoxItem != null) {
|
|
|
+ putBoxItem.setPid(putBox.getId());
|
|
|
+ putBoxItem.setMblno(item.getMblno());
|
|
|
+ putBoxItem.setBoxDynamics(item.getBoxStatus());
|
|
|
+ putBoxItem.setPolCyId(corps.getId());
|
|
|
+ putBoxItem.setPolCyCode(corps.getCode());
|
|
|
+ putBoxItem.setPolCyCname(corps.getCnName());
|
|
|
+ putBoxItem.setPolCyEname(corps.getEnName());
|
|
|
+ putBoxItem.setStatus("待使用");
|
|
|
+ putBoxItem.setPolPickUpDate(item.getBoxStatusDate());
|
|
|
+ } else {
|
|
|
+ putBoxItem = new PutBoxItems();
|
|
|
+ putBoxItem.setBoxClass(putBox.getBusType());
|
|
|
+ putBoxItem.setBoxBelongsTo("SOC");
|
|
|
+ putBoxItem.setBoxCondition("新");
|
|
|
+ putBoxItem.setBoxStatus("好");
|
|
|
+ putBoxItem.setStatus("待使用");
|
|
|
+ putBoxItem.setPid(putBox.getId());
|
|
|
+ putBoxItem.setContainerNumber(item.getContainerNumber());
|
|
|
+ putBoxItem.setBoxCode(item.getBoxCode());
|
|
|
+ putBoxItem.setBoxType(item.getBoxType());
|
|
|
+ putBoxItem.setMblno(item.getMblno());
|
|
|
+ putBoxItem.setBoxDynamics(item.getBoxStatus());
|
|
|
+ putBoxItem.setPolCyId(corps.getId());
|
|
|
+ putBoxItem.setPolCyCode(corps.getCode());
|
|
|
+ putBoxItem.setPolCyCname(corps.getCnName());
|
|
|
+ putBoxItem.setPolCyEname(corps.getEnName());
|
|
|
+ putBoxItem.setPolPickUpDate(item.getBoxStatusDate());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ putBoxItem = new PutBoxItems();
|
|
|
+ putBoxItem.setBoxClass(putBox.getBusType());
|
|
|
+ putBoxItem.setBoxBelongsTo("SOC");
|
|
|
+ putBoxItem.setBoxCondition("新");
|
|
|
+ putBoxItem.setBoxStatus("好");
|
|
|
+ putBoxItem.setStatus("待使用");
|
|
|
+ putBoxItem.setPid(putBox.getId());
|
|
|
+ putBoxItem.setContainerNumber(item.getContainerNumber());
|
|
|
+ putBoxItem.setBoxCode(item.getBoxCode());
|
|
|
+ putBoxItem.setBoxType(item.getBoxType());
|
|
|
+ putBoxItem.setMblno(item.getMblno());
|
|
|
+ putBoxItem.setBoxDynamics(item.getBoxStatus());
|
|
|
+ putBoxItem.setPolCyId(corps.getId());
|
|
|
+ putBoxItem.setPolCyCode(corps.getCode());
|
|
|
+ putBoxItem.setPolCyCname(corps.getCnName());
|
|
|
+ putBoxItem.setPolCyEname(corps.getEnName());
|
|
|
+ putBoxItem.setPolPickUpDate(item.getBoxStatusDate());
|
|
|
+ }
|
|
|
+ putBoxItem.setBoxEastId(Long.parseLong(putBox.getBoxEastId()));
|
|
|
+ putBoxItem.setBoxEastName(putBox.getBoxEastName());
|
|
|
+ putBoxItems.add(putBoxItem);
|
|
|
+ if ("OW(拿),OW(放)".contains(putBox.getBusType())) {
|
|
|
+ if (!tradingBoxList.isEmpty()) {
|
|
|
+ TradingBox tradingBox = tradingBoxList.stream().filter(e -> e.getId().equals(putBox.getSrcId()))
|
|
|
+ .findFirst().orElse(null);
|
|
|
+ if (tradingBox != null) {
|
|
|
+ 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(item.getBoxCode()))
|
|
|
+ .findFirst().orElse(null);
|
|
|
+ if (tradingBoxItem != null) {
|
|
|
+ tradingBoxItem.setPid(tradingBox.getId());
|
|
|
+ tradingBoxItem.setMblno(item.getMblno());
|
|
|
+ tradingBoxItem.setBoxDynamics(item.getBoxStatus());
|
|
|
+ tradingBoxItem.setPortId(ports.getId());
|
|
|
+ tradingBoxItem.setPortCode(ports.getCode());
|
|
|
+ tradingBoxItem.setPortCname(ports.getCnName());
|
|
|
+ tradingBoxItem.setPortEname(ports.getEnName());
|
|
|
+ tradingBoxItem.setStationId(corps.getId());
|
|
|
+ tradingBoxItem.setStationCode(corps.getCode());
|
|
|
+ tradingBoxItem.setStationCname(corps.getCnName());
|
|
|
+ tradingBoxItem.setStationEname(corps.getEnName());
|
|
|
+ tradingBoxItem.setPolCyId(corps.getId());
|
|
|
+ tradingBoxItem.setPolCyCode(corps.getCode());
|
|
|
+ tradingBoxItem.setPolCyCname(corps.getCnName());
|
|
|
+ tradingBoxItem.setPolCyEname(corps.getEnName());
|
|
|
+ if (ObjectUtils.isNotNull(item.getBoxStatusDate())) {
|
|
|
+ tradingBoxItem.setRentEndDate(item.getBoxStatusDate());
|
|
|
+ tradingBoxItem.setPolPickUpDate(item.getBoxStatusDate());
|
|
|
+ } else {
|
|
|
+ tradingBoxItem.setRentEndDate(new Date());
|
|
|
+ tradingBoxItem.setPolPickUpDate(new Date());
|
|
|
+ }
|
|
|
+ tradingBoxItem.setStatus("待使用");
|
|
|
+ } else {
|
|
|
+ tradingBoxItem = new TradingBoxItem();
|
|
|
+ tradingBoxItem.setBoxBelongsTo("SOC");
|
|
|
+ if ("OW-N".equals(tradingBox.getType())) {
|
|
|
+ tradingBoxItem.setBoxCategory("OW(拿)");
|
|
|
+ } else if ("OW-F".equals(tradingBox.getType())) {
|
|
|
+ tradingBoxItem.setBoxCategory("OW(放)");
|
|
|
+ }
|
|
|
+ putBoxItem.setBoxClass(putBox.getBusType());
|
|
|
+ tradingBoxItem.setBoxCondition("新");
|
|
|
+ tradingBoxItem.setBoxStatus("好");
|
|
|
+ tradingBoxItem.setPid(tradingBox.getId());
|
|
|
+ tradingBoxItem.setContainerNumber(item.getContainerNumber());
|
|
|
+ tradingBoxItem.setCode(item.getBoxCode());
|
|
|
+ tradingBoxItem.setMblno(item.getMblno());
|
|
|
+ tradingBoxItem.setBoxDynamics(item.getBoxStatus());
|
|
|
+ tradingBoxItem.setBoxType(cntrTypes.getCnName());
|
|
|
+ tradingBoxItem.setBoxTypeId(cntrTypes.getId());
|
|
|
+ tradingBoxItem.setPortId(ports.getId());
|
|
|
+ tradingBoxItem.setPortCode(ports.getCode());
|
|
|
+ tradingBoxItem.setPortCname(ports.getCnName());
|
|
|
+ tradingBoxItem.setPortEname(ports.getEnName());
|
|
|
+ tradingBoxItem.setStationId(corps.getId());
|
|
|
+ tradingBoxItem.setStationCode(corps.getCode());
|
|
|
+ tradingBoxItem.setStationCname(corps.getCnName());
|
|
|
+ tradingBoxItem.setStationEname(corps.getEnName());
|
|
|
+ tradingBoxItem.setPolCyId(corps.getId());
|
|
|
+ tradingBoxItem.setPolCyCode(corps.getCode());
|
|
|
+ tradingBoxItem.setPolCyCname(corps.getCnName());
|
|
|
+ tradingBoxItem.setPolCyEname(corps.getEnName());
|
|
|
+ tradingBoxItem.setActivationDate(tradingBox.getActivationDate());
|
|
|
+ if (ObjectUtils.isNotNull(item.getBoxStatusDate())) {
|
|
|
+ tradingBoxItem.setRentEndDate(item.getBoxStatusDate());
|
|
|
+ tradingBoxItem.setPolPickUpDate(item.getBoxStatusDate());
|
|
|
+ } else {
|
|
|
+ tradingBoxItem.setRentEndDate(new Date());
|
|
|
+ tradingBoxItem.setPolPickUpDate(new Date());
|
|
|
+ }
|
|
|
+ tradingBoxItem.setStatus("待使用");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ tradingBoxItem = new TradingBoxItem();
|
|
|
+ if ("OW-N".equals(tradingBox.getType())) {
|
|
|
+ tradingBoxItem.setBoxCategory("OW(拿)");
|
|
|
+ } else if ("OW-F".equals(tradingBox.getType())) {
|
|
|
+ tradingBoxItem.setBoxCategory("OW(放)");
|
|
|
+ }
|
|
|
+ tradingBoxItem.setBoxBelongsTo("SOC");
|
|
|
+ tradingBoxItem.setBoxCondition("新");
|
|
|
+ tradingBoxItem.setBoxStatus("好");
|
|
|
+ tradingBoxItem.setPid(tradingBox.getId());
|
|
|
+ tradingBoxItem.setContainerNumber(item.getContainerNumber());
|
|
|
+ tradingBoxItem.setCode(item.getBoxCode());
|
|
|
+ tradingBoxItem.setMblno(item.getMblno());
|
|
|
+ tradingBoxItem.setBoxDynamics(item.getBoxStatus());
|
|
|
+ tradingBoxItem.setBoxType(cntrTypes.getCnName());
|
|
|
+ tradingBoxItem.setBoxTypeId(cntrTypes.getId());
|
|
|
+ tradingBoxItem.setPortId(ports.getId());
|
|
|
+ tradingBoxItem.setPortCode(ports.getCode());
|
|
|
+ tradingBoxItem.setPortCname(ports.getCnName());
|
|
|
+ tradingBoxItem.setPortEname(ports.getEnName());
|
|
|
+ tradingBoxItem.setStationId(corps.getId());
|
|
|
+ tradingBoxItem.setStationCode(corps.getCode());
|
|
|
+ tradingBoxItem.setStationCname(corps.getCnName());
|
|
|
+ tradingBoxItem.setStationEname(corps.getEnName());
|
|
|
+ tradingBoxItem.setPolCyId(corps.getId());
|
|
|
+ tradingBoxItem.setPolCyCode(corps.getCode());
|
|
|
+ tradingBoxItem.setPolCyCname(corps.getCnName());
|
|
|
+ tradingBoxItem.setPolCyEname(corps.getEnName());
|
|
|
+ tradingBoxItem.setActivationDate(tradingBox.getActivationDate());
|
|
|
+ if (ObjectUtils.isNotNull(item.getBoxStatusDate())) {
|
|
|
+ tradingBoxItem.setRentEndDate(item.getBoxStatusDate());
|
|
|
+ tradingBoxItem.setPolPickUpDate(item.getBoxStatusDate());
|
|
|
+ } else {
|
|
|
+ tradingBoxItem.setRentEndDate(new Date());
|
|
|
+ tradingBoxItem.setPolPickUpDate(new Date());
|
|
|
+ }
|
|
|
+ tradingBoxItem.setStatus("待使用");
|
|
|
+ }
|
|
|
+ tradingBoxItem.setBoxEastId(tradingBox.getPurchaseCompanyId());
|
|
|
+ tradingBoxItem.setBoxEastName(tradingBox.getPurchaseCompanyName());
|
|
|
+ tradingBoxItems.add(tradingBoxItem);
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("放箱号:" + item.getContainerNumber() + "未查到OW单据");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("放箱号:" + item.getContainerNumber() + "未查到OW单据");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("未查到放箱号:" + item.getContainerNumber() + "单据");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!putBoxes.isEmpty()) {
|
|
|
+ for (PutBox item : putBoxes) {
|
|
|
+ if (ObjectUtils.isNotNull(item.getCode())) {
|
|
|
+ for (EmptyContainerAppearance e : excelList) {
|
|
|
+ if (e.getContainerNumber().equals(item.getContainerNumber()) && ObjectUtils.isNotNull(item.getCode())
|
|
|
+ && !item.getCode().contains(e.getBoxCode())) {
|
|
|
+ item.setCode(item.getCode() + "," + e.getBoxCode());
|
|
|
+ } else {
|
|
|
+ item.setCode(e.getBoxCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ item.setCode(excelList.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber()))
|
|
|
+ .map(EmptyContainerAppearance::getBoxCode).collect(Collectors.joining(",")));
|
|
|
+ }
|
|
|
+ if (!tradingBoxes.isEmpty()) {
|
|
|
+ TradingBox tradingBox = tradingBoxes.stream().filter(e -> e.getId().equals(item.getSrcId())).findFirst().orElse(null);
|
|
|
+ if (tradingBox != null) {
|
|
|
+ if (ObjectUtils.isNotNull(item.getCode())) {
|
|
|
+ for (EmptyContainerAppearance e : excelList) {
|
|
|
+ if (e.getContainerNumber().equals(item.getContainerNumber()) && ObjectUtils.isNotNull(tradingBox.getCode())
|
|
|
+ && !tradingBox.getCode().contains(e.getBoxCode())) {
|
|
|
+ tradingBox.setCode(tradingBox.getCode() + "," + e.getBoxCode());
|
|
|
+ } else {
|
|
|
+ tradingBox.setCode(e.getBoxCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ tradingBox.setCode(excelList.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber()))
|
|
|
+ .map(EmptyContainerAppearance::getBoxCode).collect(Collectors.joining(",")));
|
|
|
+ }
|
|
|
+ tradingBoxMapper.updateById(tradingBox);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.saveOrUpdateBatch(putBoxes);
|
|
|
+ }
|
|
|
+ if (!putBoxItems.isEmpty()) {
|
|
|
+ putBoxItemsService.saveOrUpdateBatch(putBoxItems);
|
|
|
+ }
|
|
|
+ if (!archivesArrayList.isEmpty()) {
|
|
|
+ archivesService.saveOrUpdateBatch(archivesArrayList);
|
|
|
+ }
|
|
|
+ if (!tradingBoxItems.isEmpty()) {
|
|
|
+ tradingBoxItemService.saveOrUpdateBatch(tradingBoxItems);
|
|
|
+ for (TradingBoxItem item : tradingBoxItems) {
|
|
|
+ TradingBox tradingBox = tradingBoxList.stream().filter(e -> e.getId().equals(item.getPid())).findFirst().orElse(null);
|
|
|
+ if (tradingBox != null) {
|
|
|
+ //记录箱轨迹信息
|
|
|
+ ArchivesTrajectory archivesTrajectory = new ArchivesTrajectory();
|
|
|
+ archivesTrajectory.setPortId(tradingBox.getAddressId());
|
|
|
+ archivesTrajectory.setPortCode(tradingBox.getAddressCode());
|
|
|
+ archivesTrajectory.setPortCname(tradingBox.getAddressCname());
|
|
|
+ archivesTrajectory.setPortEname(tradingBox.getAddressEname());
|
|
|
+ archivesTrajectory.setStationId(tradingBox.getAddressId());
|
|
|
+ archivesTrajectory.setStationCode(tradingBox.getAddressCode());
|
|
|
+ archivesTrajectory.setStationCname(tradingBox.getAddressCname());
|
|
|
+ archivesTrajectory.setStationEname(tradingBox.getAddressEname());
|
|
|
+ archivesTrajectory.setContainerNumber(item.getContainerNumber());
|
|
|
+ archivesTrajectory.setBoxType(item.getBoxType());
|
|
|
+ archivesTrajectory.setBoxCategory(item.getBoxCategory());
|
|
|
+ archivesTrajectory.setBoxEastId(item.getBoxEastId());
|
|
|
+ archivesTrajectory.setBoxEastName(item.getBoxEastName());
|
|
|
+ archivesTrajectory.setMblno(item.getMblno());
|
|
|
+ archivesTrajectory.setBoxDynamics(item.getBoxDynamics());
|
|
|
+ archivesTrajectory.setNewDate(tradingBox.getRentDate());
|
|
|
+ if ("OW-N".equals(tradingBox.getType())) {
|
|
|
+ archivesTrajectory.setStatus("OW-拿");
|
|
|
+ } else if ("OW-F".equals(tradingBox.getType())) {
|
|
|
+ archivesTrajectory.setStatus("OW-放");
|
|
|
+ }
|
|
|
+ archivesTrajectory.setCorpId(tradingBox.getPurchaseCompanyId());
|
|
|
+ archivesTrajectory.setCorpName(tradingBox.getPurchaseCompanyName());
|
|
|
+ archivesTrajectory.setContractNo(tradingBox.getContractNo());
|
|
|
+ archivesTrajectory.setBillType(tradingBox.getType());
|
|
|
+ archivesTrajectory.setCode(item.getCode());
|
|
|
+ archivesTrajectory.setPortCname(tradingBox.getAddressCname());
|
|
|
+ archivesTrajectory.setNewDate(new Date());
|
|
|
+ archivesTrajectory.setCreateTime(new Date());
|
|
|
+ archivesTrajectory.setCreateUser(AuthUtil.getUserId());
|
|
|
+ archivesTrajectory.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ archivesTrajectory.setTenantId(AuthUtil.getTenantId());
|
|
|
+ archivesTrajectory.setSrcId(tradingBox.getId());
|
|
|
+ archivesTrajectoryMapper.insert(archivesTrajectory);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ArchivesFiles archivesFiles = new ArchivesFiles();
|
|
|
+ archivesFiles.setCreateUser(AuthUtil.getUserId());
|
|
|
+ archivesFiles.setCreateTime(new Date());
|
|
|
+ archivesFiles.setTenantId(AuthUtil.getTenantId());
|
|
|
+ archivesFiles.setType("0");
|
|
|
+ R<BladeFile> res = ossClient.putFile(file);
|
|
|
+ if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
|
|
|
+ archivesFiles.setUrl(res.getData().getLink());
|
|
|
+ archivesFiles.setFileName(res.getData().getOriginalName());
|
|
|
+ } else {
|
|
|
+ throw new RemoteException("文件保存失败");
|
|
|
+ }
|
|
|
+ archivesFilesService.save(archivesFiles);
|
|
|
+ return R.data("操作成功");
|
|
|
+ }
|
|
|
}
|