|
|
@@ -31,7 +31,8 @@ import org.springblade.los.basic.business.entity.BusinessType;
|
|
|
import org.springblade.los.basic.business.service.IBusinessTypeService;
|
|
|
import org.springblade.los.basic.cntr.entity.BCntrTypes;
|
|
|
import org.springblade.los.basic.cntr.service.IBCntrTypesService;
|
|
|
-import org.springblade.los.basic.locations.entity.BLocations;
|
|
|
+import org.springblade.los.basic.corps.entity.BCorps;
|
|
|
+import org.springblade.los.basic.corps.service.IBCorpsService;
|
|
|
import org.springblade.los.basic.locations.service.IBLocationsService;
|
|
|
import org.springblade.los.basic.ports.entity.BPorts;
|
|
|
import org.springblade.los.basic.ports.service.IBPortsService;
|
|
|
@@ -46,10 +47,7 @@ import org.springblade.los.box.excel.EmptyContainerAppearance;
|
|
|
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.IArchivesFilesService;
|
|
|
-import org.springblade.los.box.service.IPutBoxItemsService;
|
|
|
-import org.springblade.los.box.service.IPutBoxService;
|
|
|
-import org.springblade.los.box.service.ITradingBoxItemService;
|
|
|
+import org.springblade.los.box.service.*;
|
|
|
import org.springblade.los.box.vo.PutBoxVO;
|
|
|
import org.springblade.los.excel.RouteCostProfitExcel;
|
|
|
import org.springblade.resource.feign.IOssClient;
|
|
|
@@ -98,6 +96,10 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
|
|
|
private final IOssClient ossClient;
|
|
|
|
|
|
+ private final IArchivesService archivesService;
|
|
|
+
|
|
|
+ private final IBCorpsService bCorpsService;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<PutBoxVO> selectPutBoxPage(IPage<PutBoxVO> page, PutBoxVO putBox) {
|
|
|
return null;
|
|
|
@@ -130,18 +132,15 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
}
|
|
|
String businessTypeCode = "FXH";
|
|
|
String billNoFormat;
|
|
|
- String billNoFormatInternal;
|
|
|
- if ("自有".equals(putBox.getBoxClass())) {
|
|
|
- billNoFormat = "FXH";
|
|
|
- billNoFormatInternal = "FXH-N";
|
|
|
- } else if ("代理".equals(putBox.getBoxClass())) {
|
|
|
+ String billNoFormatInternal = "FXH-N";
|
|
|
+ if ("自有箱".equals(putBox.getBoxClass())) {
|
|
|
+ billNoFormat = "FXH-ZY";
|
|
|
+ } else if ("代理箱".equals(putBox.getBoxClass())) {
|
|
|
billNoFormat = "FXH-DL";
|
|
|
- billNoFormatInternal = "FXHN-DL";
|
|
|
- } else if ("OW".equals(putBox.getBoxClass())) {
|
|
|
+ } else if ("OW(拿),OW(放)".contains(putBox.getBoxClass())) {
|
|
|
billNoFormat = "FXH-OW";
|
|
|
- billNoFormatInternal = "FXHN-OW";
|
|
|
} else {
|
|
|
- billNoFormat = "FXH";
|
|
|
+ billNoFormat = "FXH-ZY";
|
|
|
billNoFormatInternal = "FXH-N";
|
|
|
}
|
|
|
BusinessType businessType = bBusinessTypeService.getOne(new LambdaQueryWrapper<BusinessType>()
|
|
|
@@ -220,7 +219,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
item.setBoxBelongsTo(putBox.getBoxBelongsTo());
|
|
|
item.setBoxCondition(putBox.getBoxCondition());
|
|
|
item.setBoxClass(putBox.getBoxClass());
|
|
|
- if ("OW".equals(putBox.getBusType()) && ObjectUtils.isNotNull(putBox.getBoxEastId())
|
|
|
+ if ("OW(拿),OW(放)".contains(putBox.getBusType()) && ObjectUtils.isNotNull(putBox.getBoxEastId())
|
|
|
&& !"null".equals(putBox.getBoxEastId()) && ObjectUtils.isNull(item.getBoxEastId())) {
|
|
|
item.setBoxEastId(Long.parseLong(putBox.getBoxEastId()));
|
|
|
item.setBoxEastName(putBox.getBoxEastName());
|
|
|
@@ -276,19 +275,31 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
putBoxItemsService.updateBatchById(putBoxItemsList);
|
|
|
if (!putBoxItems.isEmpty()) {
|
|
|
putBoxItems.addAll(putBoxItemsList);
|
|
|
- StringBuilder boxEastId = new StringBuilder();
|
|
|
+ String boxEastId = "";
|
|
|
for (PutBoxItems item : putBoxItems) {
|
|
|
- boxEastId.append(item.getBoxEastId()).append(",");
|
|
|
+ if (ObjectUtils.isNull(boxEastId)) {
|
|
|
+ boxEastId = item.getBoxEastId() + ",";
|
|
|
+ } else {
|
|
|
+ if (!boxEastId.contains(item.getBoxEastId() + "")) {
|
|
|
+ boxEastId = boxEastId + item.getBoxEastId() + ",";
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- String boxEastName = putBoxItems.stream().map(PutBoxItems::getBoxEastName).collect(Collectors.joining(","));
|
|
|
+ String boxEastName = putBoxItems.stream().map(PutBoxItems::getBoxEastName).distinct().collect(Collectors.joining(","));
|
|
|
detail.setBoxEastId(boxEastId.substring(0, boxEastId.length() - 1));
|
|
|
detail.setBoxEastName(boxEastName);
|
|
|
} else {
|
|
|
- StringBuilder boxEastId = new StringBuilder();
|
|
|
+ String boxEastId = "";
|
|
|
for (PutBoxItems item : putBoxItemsList) {
|
|
|
- boxEastId.append(item.getBoxEastId()).append(",");
|
|
|
+ if (ObjectUtils.isNull(boxEastId)) {
|
|
|
+ boxEastId = item.getBoxEastId() + ",";
|
|
|
+ } else {
|
|
|
+ if (!boxEastId.contains(item.getBoxEastId() + "")) {
|
|
|
+ boxEastId = boxEastId + item.getBoxEastId() + ",";
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- String boxEastName = putBoxItemsList.stream().map(PutBoxItems::getBoxEastName).collect(Collectors.joining(","));
|
|
|
+ String boxEastName = putBoxItemsList.stream().map(PutBoxItems::getBoxEastName).distinct().collect(Collectors.joining(","));
|
|
|
detail.setBoxEastId(boxEastId.substring(0, boxEastId.length() - 1));
|
|
|
detail.setBoxEastName(boxEastName);
|
|
|
}
|
|
|
@@ -315,16 +326,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
detail.setCreateTime(new Date());
|
|
|
detail.setContainerNumber(putBox.getContainerNumber());
|
|
|
String businessTypeCode = "FXH";
|
|
|
- String billNoFormatInternal;
|
|
|
- if ("自有".equals(putBox.getBoxClass())) {
|
|
|
- billNoFormatInternal = "FXH-N";
|
|
|
- } else if ("代理".equals(putBox.getBoxClass())) {
|
|
|
- billNoFormatInternal = "FXHN-DL";
|
|
|
- } else if ("OW".equals(putBox.getBoxClass())) {
|
|
|
- billNoFormatInternal = "FXHN-OW";
|
|
|
- } else {
|
|
|
- billNoFormatInternal = "FXH-N";
|
|
|
- }
|
|
|
+ String billNoFormatInternal = "FXH-N";
|
|
|
BusinessType businessType = bBusinessTypeService.getOne(new LambdaQueryWrapper<BusinessType>()
|
|
|
.select(BusinessType::getId)
|
|
|
.eq(BusinessType::getTenantId, AuthUtil.getTenantId())
|
|
|
@@ -371,16 +373,28 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
long gP40Bad = 0;
|
|
|
long hG40Bad = 0;
|
|
|
long otherBad = 0;
|
|
|
- for (Map<String, Long> map : mapList) {
|
|
|
- if (!mapList.isEmpty()) {
|
|
|
- gP20Good = gP20Good + map.get("gP20Good");
|
|
|
- gP40Good = gP40Good + map.get("gP40Good");
|
|
|
- hG40Good = hG40Good + map.get("hG40Good");
|
|
|
- otherGood = otherGood + map.get("otherGood");
|
|
|
- gP20Bad = gP20Bad + map.get("gP20Bad");
|
|
|
- gP40Bad = gP40Bad + map.get("gP40Bad");
|
|
|
- hG40Bad = hG40Bad + map.get("hG40Bad");
|
|
|
- otherBad = otherBad + map.get("otherBad");
|
|
|
+ if ("OW(拿),OW(放)".contains(item.getBusType())) {
|
|
|
+ if ("20GP".equals(item.getBoxType())) {
|
|
|
+ gP20Good = gP20Good + item.getRemainingNum();
|
|
|
+ } else if ("40GP".equals(item.getBoxType())) {
|
|
|
+ gP40Good = gP40Good + item.getRemainingNum();
|
|
|
+ } else if ("40HG".equals(item.getBoxType())) {
|
|
|
+ hG40Good = hG40Good + item.getRemainingNum();
|
|
|
+ } else {
|
|
|
+ otherGood = otherGood + item.getRemainingNum();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (Map<String, Long> map : mapList) {
|
|
|
+ if (!map.isEmpty()) {
|
|
|
+ gP20Good = gP20Good + map.get("gP20Good");
|
|
|
+ gP40Good = gP40Good + map.get("gP40Good");
|
|
|
+ hG40Good = hG40Good + map.get("hG40Good");
|
|
|
+ otherGood = otherGood + map.get("otherGood");
|
|
|
+ gP20Bad = gP20Bad + map.get("gP20Bad");
|
|
|
+ gP40Bad = gP40Bad + map.get("gP40Bad");
|
|
|
+ hG40Bad = hG40Bad + map.get("hG40Bad");
|
|
|
+ otherBad = otherBad + map.get("otherBad");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
item.setGP20Good(gP20Good);
|
|
|
@@ -408,8 +422,11 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
.apply(ObjectUtils.isNotNull(boxPoolDTO.getBusType()), "find_in_set(bus_type,'" + boxPoolDTO.getBusType() + "')")
|
|
|
.like(ObjectUtils.isNotNull(boxPoolDTO.getContainerNumber()), PutBox::getContainerNumber, boxPoolDTO.getContainerNumber())
|
|
|
.like(ObjectUtils.isNotNull(boxPoolDTO.getPodId()), PutBox::getPodId, boxPoolDTO.getPodId())
|
|
|
+ .like(ObjectUtils.isNotNull(boxPoolDTO.getPodName()), PutBox::getPodCname, boxPoolDTO.getPodName())
|
|
|
.like(ObjectUtils.isNotNull(boxPoolDTO.getPolId()), PutBox::getPolId, boxPoolDTO.getPolId())
|
|
|
+ .like(ObjectUtils.isNotNull(boxPoolDTO.getPolName()), PutBox::getPolCname, boxPoolDTO.getPolName())
|
|
|
.like(ObjectUtils.isNotNull(boxPoolDTO.getBoxEastId()), PutBox::getBoxEastId, boxPoolDTO.getBoxEastId())
|
|
|
+ .like(ObjectUtils.isNotNull(boxPoolDTO.getBoxEastName()), PutBox::getBoxEastName, boxPoolDTO.getBoxEastName())
|
|
|
.like(ObjectUtils.isNotNull(boxPoolDTO.getStationId()), PutBox::getPolStationId, boxPoolDTO.getStationId());
|
|
|
if (ObjectUtils.isNotNull(boxPoolDTO.getWhetherLoseEfficacy())) {
|
|
|
lambdaQueryWrapper.ge(PutBox::getEffectiveStartDate, new Date())
|
|
|
@@ -423,13 +440,21 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
.eq(PutBoxItems::getIsDeleted, 0)
|
|
|
.in(PutBoxItems::getPid, ids));
|
|
|
for (BoxPoolContainerNumberDTO item : putBoxList) {
|
|
|
- if (!boxItemsList.isEmpty()) {
|
|
|
- List<PutBoxItems> itemsList = boxItemsList.stream().filter(e -> e.getPid().equals(item.getId())).collect(Collectors.toList());
|
|
|
- if (!itemsList.isEmpty()) {
|
|
|
- item.setGood(itemsList.stream().filter(e -> "好".equals(e.getBoxStatus()) && item.getBoxType().equals(e.getBoxType())).count());
|
|
|
- item.setBad(itemsList.stream().filter(e -> "坏".equals(e.getBoxStatus()) && item.getBoxType().equals(e.getBoxType())).count());
|
|
|
- item.setTotal(item.getGood() + item.getBad());
|
|
|
- item.setRemainingTotal(item.getTotal());
|
|
|
+ if ("OW(拿),OW(放)".contains(item.getBusType())){
|
|
|
+ item.setGood(item.getRemainingNum());
|
|
|
+ item.setTotal(item.getRemainingNum());
|
|
|
+ item.setOccupyNum(item.getOccupyNum());
|
|
|
+ item.setRemainingTotal(item.getTotalNum());
|
|
|
+ }else{
|
|
|
+ if (!boxItemsList.isEmpty()) {
|
|
|
+ List<PutBoxItems> itemsList = boxItemsList.stream().filter(e -> e.getPid().equals(item.getId())).collect(Collectors.toList());
|
|
|
+ if (!itemsList.isEmpty()) {
|
|
|
+ item.setGood(itemsList.stream().filter(e -> "好".equals(e.getBoxStatus()) && item.getBoxType().equals(e.getBoxType())).count());
|
|
|
+ item.setBad(itemsList.stream().filter(e -> "坏".equals(e.getBoxStatus()) && item.getBoxType().equals(e.getBoxType())).count());
|
|
|
+ item.setTotal(item.getGood() + item.getBad());
|
|
|
+ item.setOccupyNum(item.getOccupyNum());
|
|
|
+ item.setRemainingTotal(item.getTotal());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -501,6 +526,13 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
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)
|
|
|
@@ -517,10 +549,10 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
.in(BPorts::getCnName, portName));
|
|
|
List<String> stationName = excelList.stream().map(EmptyContainerAppearance::getStationName).filter(Objects::nonNull)
|
|
|
.distinct().collect(Collectors.toList());
|
|
|
- List<BLocations> locationsList = bLocationsService.list(new LambdaQueryWrapper<BLocations>()
|
|
|
- .eq(BLocations::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(BLocations::getIsDeleted, 0)
|
|
|
- .in(BLocations::getCnName, stationName));
|
|
|
+ List<BCorps> 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)
|
|
|
@@ -533,25 +565,22 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
.eq(PutBoxItems::getIsDeleted, 0)
|
|
|
.eq(PutBoxItems::getTenantId, AuthUtil.getTenantId())
|
|
|
.in(PutBoxItems::getPid, putBoxIdList));
|
|
|
- List<String> boxCodeList = excelList.stream().map(EmptyContainerAppearance::getBoxCode)
|
|
|
- .distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
String blacklist = sysClient.getParamService("box.blacklist");
|
|
|
if (ObjectUtils.isNotNull(blacklist)) {
|
|
|
StringBuilder text = new StringBuilder();
|
|
|
for (String item : boxCodeList) {
|
|
|
- String head = item.substring(0, 3);
|
|
|
- if (blacklist.contains(head)) {
|
|
|
- text.append(item).append(",");
|
|
|
+ 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<PutBoxItems> putBoxItemsCodeList = putBoxItemsService.list(new LambdaQueryWrapper<PutBoxItems>()
|
|
|
- .eq(PutBoxItems::getIsDeleted, 0)
|
|
|
- .eq(PutBoxItems::getTenantId, AuthUtil.getTenantId())
|
|
|
- .in(PutBoxItems::getBoxCode, boxCodeList));
|
|
|
List<TradingBox> tradingBoxList = tradingBoxMapper.selectList(new LambdaQueryWrapper<TradingBox>()
|
|
|
.eq(TradingBox::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(TradingBox::getIsDeleted, 0)
|
|
|
@@ -566,19 +595,74 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
.in(TradingBoxItem::getPid, tradingBoxIdList));
|
|
|
List<PutBoxItems> putBoxItems = new ArrayList<>();
|
|
|
List<TradingBoxItem> tradingBoxItems = new ArrayList<>();
|
|
|
+ List<Archives> archivesArrayList = new ArrayList<>();
|
|
|
+ List<PutBox> putBoxes = 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);
|
|
|
- BLocations locations = locationsList.stream().filter(e -> e.getCnName().equals(item.getStationName())).findFirst().orElse(null);
|
|
|
- PutBox putBox = putBoxList.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber())).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())
|
|
|
+ && e.getPolId().equals(ports.getId()) && e.getPolStationId().equals(corps.getId())).findFirst().orElse(null);
|
|
|
if (putBox != null) {
|
|
|
+ long count = excelList.stream().filter(e -> e.getContainerNumber().equals(putBox.getContainerNumber())).count();
|
|
|
+ putBox.setOccupyNum(putBox.getOccupyNum() + Integer.parseInt(count + ""));
|
|
|
+ putBox.setRemainingNum(putBox.getTotalNum() - putBox.getOccupyNum());
|
|
|
+ putBoxes.add(putBox);
|
|
|
+ //箱档案数据处理
|
|
|
+ Archives archives = archivesList.stream().filter(e -> e.getCode().equals(item.getBoxCode())).findFirst().orElse(null);
|
|
|
+ if (archives != null) {
|
|
|
+ archives.setUpdateTime(new Date());
|
|
|
+ archives.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ archives.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ archives.setStatus("使用中");
|
|
|
+ archives.setNewDate(item.getBoxStatusDate());
|
|
|
+ archives.setBoxAccessStatus("空箱出场");
|
|
|
+ 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 {
|
|
|
+ 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.setBoxAccessStatus("空箱出场");
|
|
|
+ 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() + "箱型不符合");
|
|
|
}
|
|
|
- if (!putBoxItemsCodeList.isEmpty() && putBoxItemsCodeList.stream()
|
|
|
- .anyMatch(e -> !e.getPid().equals(putBox.getId()) && item.getBoxCode().equals(e.getBoxCode()))) {
|
|
|
- throw new RuntimeException("箱号:" + item.getBoxCode() + "已在其他放箱号中存在,请修改后再操作");
|
|
|
- }
|
|
|
+ //放箱号明细数据处理
|
|
|
PutBoxItems putBoxItem;
|
|
|
if (!putBoxItemsList.isEmpty()) {
|
|
|
putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(item.getBoxCode()))
|
|
|
@@ -587,6 +671,11 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
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.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
|
|
|
} else {
|
|
|
putBoxItem = new PutBoxItems();
|
|
|
putBoxItem.setBoxClass(putBox.getBusType());
|
|
|
@@ -599,6 +688,11 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
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.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
|
|
|
}
|
|
|
} else {
|
|
|
putBoxItem = new PutBoxItems();
|
|
|
@@ -612,13 +706,23 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
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.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
|
|
|
}
|
|
|
- if ("OW,OW-F".contains(putBox.getBusType())) {
|
|
|
+ if ("OW(拿),OW(放)".contains(putBox.getBusType())) {
|
|
|
putBoxItem.setBoxEastId(Long.parseLong(putBox.getBoxEastId()));
|
|
|
putBoxItem.setBoxEastName(putBox.getBoxEastName());
|
|
|
- TradingBox tradingBox = tradingBoxList.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber()))
|
|
|
+ TradingBox tradingBox = tradingBoxList.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber())
|
|
|
+ && e.getPolId().equals(ports.getId()) && e.getPolStationId().equals(corps.getId()))
|
|
|
.findFirst().orElse(null);
|
|
|
if (tradingBox != null) {
|
|
|
+ long count1 = excelList.stream().filter(e -> e.getContainerNumber().equals(putBox.getContainerNumber())).count();
|
|
|
+ tradingBox.setActualBoxNumber(tradingBox.getActualBoxNumber() + Integer.parseInt(count1 + ""));
|
|
|
+ tradingBox.setRemainingBoxNumber(tradingBox.getBoxNumber() - tradingBox.getActualBoxNumber());
|
|
|
+ tradingBoxMapper.updateById(tradingBox);
|
|
|
TradingBoxItem tradingBoxItem;
|
|
|
if (!tradingBoxItemList.isEmpty()) {
|
|
|
tradingBoxItem = tradingBoxItemList.stream().filter(e -> e.getCode().equals(item.getBoxCode()))
|
|
|
@@ -627,13 +731,26 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
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());
|
|
|
+ tradingBoxItem.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
|
|
|
} else {
|
|
|
tradingBoxItem = new TradingBoxItem();
|
|
|
tradingBoxItem.setBoxBelongsTo("SOC");
|
|
|
if ("OW-N".equals(tradingBox.getType())) {
|
|
|
- tradingBoxItem.setBoxCategory("OW");
|
|
|
+ tradingBoxItem.setBoxCategory("OW(拿)");
|
|
|
} else if ("OW-F".equals(tradingBox.getType())) {
|
|
|
- tradingBoxItem.setBoxCategory("OW-F");
|
|
|
+ tradingBoxItem.setBoxCategory("OW(放)");
|
|
|
}
|
|
|
putBoxItem.setBoxClass(putBox.getBusType());
|
|
|
tradingBoxItem.setBoxCondition("新");
|
|
|
@@ -643,29 +760,28 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
tradingBoxItem.setCode(item.getBoxCode());
|
|
|
tradingBoxItem.setMblno(item.getMblno());
|
|
|
tradingBoxItem.setBoxDynamics(item.getBoxStatus());
|
|
|
- if (cntrTypes != null) {
|
|
|
- tradingBoxItem.setBoxType(cntrTypes.getCnName());
|
|
|
- tradingBoxItem.setBoxTypeId(cntrTypes.getId());
|
|
|
- }
|
|
|
- if (ports != null) {
|
|
|
- tradingBoxItem.setPortId(ports.getId());
|
|
|
- tradingBoxItem.setPortCode(ports.getCode());
|
|
|
- tradingBoxItem.setPortCname(ports.getCnName());
|
|
|
- tradingBoxItem.setPortEname(ports.getEnName());
|
|
|
- }
|
|
|
- if (locations != null) {
|
|
|
- tradingBoxItem.setStationId(locations.getId());
|
|
|
- tradingBoxItem.setStationCode(locations.getCode());
|
|
|
- tradingBoxItem.setStationCname(locations.getCnName());
|
|
|
- tradingBoxItem.setStationEname(locations.getEnName());
|
|
|
- }
|
|
|
+ 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.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
|
|
|
}
|
|
|
} else {
|
|
|
tradingBoxItem = new TradingBoxItem();
|
|
|
if ("OW-N".equals(tradingBox.getType())) {
|
|
|
- tradingBoxItem.setBoxCategory("OW");
|
|
|
+ tradingBoxItem.setBoxCategory("OW(拿)");
|
|
|
} else if ("OW-F".equals(tradingBox.getType())) {
|
|
|
- tradingBoxItem.setBoxCategory("OW-F");
|
|
|
+ tradingBoxItem.setBoxCategory("OW(放)");
|
|
|
}
|
|
|
tradingBoxItem.setBoxBelongsTo("SOC");
|
|
|
tradingBoxItem.setBoxCondition("新");
|
|
|
@@ -675,22 +791,21 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
tradingBoxItem.setCode(item.getBoxCode());
|
|
|
tradingBoxItem.setMblno(item.getMblno());
|
|
|
tradingBoxItem.setBoxDynamics(item.getBoxStatus());
|
|
|
- if (cntrTypes != null) {
|
|
|
- tradingBoxItem.setBoxType(cntrTypes.getCnName());
|
|
|
- tradingBoxItem.setBoxTypeId(cntrTypes.getId());
|
|
|
- }
|
|
|
- if (ports != null) {
|
|
|
- tradingBoxItem.setPortId(ports.getId());
|
|
|
- tradingBoxItem.setPortCode(ports.getCode());
|
|
|
- tradingBoxItem.setPortCname(ports.getCnName());
|
|
|
- tradingBoxItem.setPortEname(ports.getEnName());
|
|
|
- }
|
|
|
- if (locations != null) {
|
|
|
- tradingBoxItem.setStationId(locations.getId());
|
|
|
- tradingBoxItem.setStationCode(locations.getCode());
|
|
|
- tradingBoxItem.setStationCname(locations.getCnName());
|
|
|
- tradingBoxItem.setStationEname(locations.getEnName());
|
|
|
- }
|
|
|
+ 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.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
|
|
|
}
|
|
|
tradingBoxItem.setBoxEastId(tradingBox.getPurchaseCompanyId());
|
|
|
tradingBoxItem.setBoxEastName(tradingBox.getPurchaseCompanyName());
|
|
|
@@ -704,8 +819,14 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
throw new RuntimeException("未查到放箱号:" + item.getContainerNumber() + "单据");
|
|
|
}
|
|
|
}
|
|
|
+ if (!putBoxes.isEmpty()) {
|
|
|
+ this.saveOrUpdateBatch(putBoxes);
|
|
|
+ }
|
|
|
if (!putBoxItems.isEmpty()) {
|
|
|
- putBoxItemsService.saveOrUpdateBatch(putBoxItems);
|
|
|
+ putBoxItemsService.updateBatchById(putBoxItems);
|
|
|
+ }
|
|
|
+ if (!archivesArrayList.isEmpty()) {
|
|
|
+ archivesService.saveOrUpdateBatch(archivesArrayList);
|
|
|
}
|
|
|
if (!tradingBoxItems.isEmpty()) {
|
|
|
tradingBoxItemService.saveOrUpdateBatch(tradingBoxItems);
|
|
|
@@ -772,4 +893,331 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
return baseMapper.getBoxNumber(routeCost);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public R giveAnEncore(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)
|
|
|
+ .eq(Archives::getStatus, "使用中")
|
|
|
+ );
|
|
|
+ if (archivesList.isEmpty()) {
|
|
|
+ throw new RemoteException("未查到对应箱档案信息");
|
|
|
+ }
|
|
|
+ if (boxCodeList.size() > archivesList.size()) {
|
|
|
+ List<String> boxCode = archivesList.stream().map(Archives::getCode).collect(Collectors.toList());
|
|
|
+ throw new RemoteException("箱号:" + boxCodeList.stream().filter(e -> !boxCode.contains(e)).collect(Collectors.joining(","))
|
|
|
+ + "未查到对应箱档案信息");
|
|
|
+ }
|
|
|
+ List<String> containerNumberList = archivesList.stream().map(Archives::getContainerNumber)
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
+ List<String> portName = excelList.stream().map(EmptyContainerAppearance::getPortName).filter(Objects::nonNull)
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
+ List<BPorts> 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 = 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<PutBox> putBoxNewList = new ArrayList<>();
|
|
|
+ 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));
|
|
|
+ List<PutBoxItems> putBoxItems = new ArrayList<>();
|
|
|
+ List<Archives> archivesArrayList = new ArrayList<>();
|
|
|
+ List<Long> archivesDateleList = new ArrayList<>();
|
|
|
+ BusinessType businessType = bBusinessTypeService.getOne(new LambdaQueryWrapper<BusinessType>()
|
|
|
+ .select(BusinessType::getId)
|
|
|
+ .eq(BusinessType::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(BusinessType::getIsDeleted, 0)
|
|
|
+ .eq(BusinessType::getStatus, 0)
|
|
|
+ .eq(BusinessType::getCode, "FXH"));
|
|
|
+ if (businessType == null) {
|
|
|
+ throw new RuntimeException("未找到可用业务类型");
|
|
|
+ }
|
|
|
+ for (EmptyContainerAppearance item : excelList) {
|
|
|
+ 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() + "基础资料");
|
|
|
+ }
|
|
|
+ //箱档案数据处理
|
|
|
+ Archives archives = archivesList.stream().filter(e -> e.getCode().equals(item.getBoxCode())).findFirst().orElse(null);
|
|
|
+ if (archives != null) {
|
|
|
+ if ("OW(拿),代理箱".contains(archives.getContainerNumberType())) {
|
|
|
+ archivesDateleList.add(archives.getId());
|
|
|
+ continue;
|
|
|
+ } else {
|
|
|
+ archives.setUpdateTime(new Date());
|
|
|
+ archives.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ archives.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ archives.setStatus("待使用");
|
|
|
+ archives.setNewDate(item.getBoxStatusDate());
|
|
|
+ archives.setBoxAccessStatus("空箱进场");
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new RemoteException("箱号:" + item.getBoxCode() + "未查到数据");
|
|
|
+ }
|
|
|
+ PutBox putBox = putBoxList.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber())
|
|
|
+ && e.getPolId().equals(ports.getId()) && e.getPolStationId().equals(corps.getId())).findFirst().orElse(null);
|
|
|
+ if (putBox == null) {
|
|
|
+ if (!putBoxNewList.isEmpty()) {
|
|
|
+ PutBox putBox1 = putBoxNewList.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber())
|
|
|
+ && e.getPolId().equals(ports.getId()) && e.getPolStationId().equals(corps.getId())).findFirst().orElse(null);
|
|
|
+ if (putBox1 == null) {
|
|
|
+ putBox1 = new PutBox();
|
|
|
+ putBox1.setCreateUser(AuthUtil.getUserId());
|
|
|
+ putBox1.setCreateTime(new Date());
|
|
|
+ putBox1.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ putBox1.setBusType("自有箱");
|
|
|
+ putBox1.setBoxClass("自有箱");
|
|
|
+ putBox1.setBoxBelongsTo("SOC");
|
|
|
+ putBox1.setBoxEastId(archives.getBoxEastId() + "");
|
|
|
+ putBox1.setBoxEastName(archives.getBoxEastName());
|
|
|
+ String code = "FXH-ZY";
|
|
|
+ BusinessBillNo businessBillNo = new BusinessBillNo();
|
|
|
+ businessBillNo.setBusinessTypeId(businessType.getId());
|
|
|
+ businessBillNo.setCode(code);
|
|
|
+ R clientBillNo = businessBillNoService.getBillNoLos(businessBillNo);
|
|
|
+ if (!clientBillNo.isSuccess()) {
|
|
|
+ throw new RuntimeException("生成订单编号失败");
|
|
|
+ }
|
|
|
+ putBox1.setSysNo((String) clientBillNo.getData());
|
|
|
+ putBox1.setContainerNumber(item.getContainerNumber());
|
|
|
+ BusinessBillNo businessBillNo1 = new BusinessBillNo();
|
|
|
+ businessBillNo1.setBusinessTypeId(businessType.getId());
|
|
|
+ businessBillNo1.setCode("FXH-N");
|
|
|
+ R clientBillNo1 = businessBillNoService.getBillNoLos(businessBillNo1);
|
|
|
+ if (!clientBillNo1.isSuccess()) {
|
|
|
+ throw new RuntimeException("生成订单编号失败");
|
|
|
+ }
|
|
|
+ putBox1.setInternalContainerNumber((String) clientBillNo1.getData());
|
|
|
+ putBox1.setPolId(ports.getId());
|
|
|
+ putBox1.setPolCode(ports.getCode());
|
|
|
+ putBox1.setPolCname(ports.getCnName());
|
|
|
+ putBox1.setPolEname(ports.getEnName());
|
|
|
+ putBox1.setPolStationId(corps.getId());
|
|
|
+ putBox1.setPolStationCode(corps.getCode());
|
|
|
+ putBox1.setPolStationCname(corps.getCnName());
|
|
|
+ putBox1.setPolStationEname(corps.getEnName());
|
|
|
+ putBox1.setBoxCondition("好");
|
|
|
+ putBox1.setBoxType(item.getBoxType());
|
|
|
+ putBox1.setBoxClass("自有箱");
|
|
|
+ putBox1.setTotalNum(1);
|
|
|
+ putBox1.setOccupyNum(0);
|
|
|
+ putBox1.setRemainingNum(1);
|
|
|
+ putBoxNewList.add(putBox1);
|
|
|
+ } else {
|
|
|
+ putBox1.setTotalNum(putBox1.getTotalNum() + 1);
|
|
|
+ putBox1.setOccupyNum(0);
|
|
|
+ putBox1.setRemainingNum(putBox1.getRemainingNum() + 1);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ putBox = new PutBox();
|
|
|
+ putBox.setCreateUser(AuthUtil.getUserId());
|
|
|
+ putBox.setCreateTime(new Date());
|
|
|
+ putBox.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ putBox.setBusType("自有箱");
|
|
|
+ putBox.setBoxClass("自有箱");
|
|
|
+ String code = "FXH-ZY";
|
|
|
+ BusinessBillNo businessBillNo = new BusinessBillNo();
|
|
|
+ businessBillNo.setBusinessTypeId(businessType.getId());
|
|
|
+ businessBillNo.setCode(code);
|
|
|
+ R clientBillNo = businessBillNoService.getBillNoLos(businessBillNo);
|
|
|
+ if (!clientBillNo.isSuccess()) {
|
|
|
+ throw new RuntimeException("生成订单编号失败");
|
|
|
+ }
|
|
|
+ putBox.setSysNo((String) clientBillNo.getData());
|
|
|
+ putBox.setContainerNumber(item.getContainerNumber());
|
|
|
+ putBox.setBoxBelongsTo("SOC");
|
|
|
+ putBox.setBoxEastId(archives.getBoxEastId() + "");
|
|
|
+ putBox.setBoxEastName(archives.getBoxEastName());
|
|
|
+ BusinessBillNo businessBillNo1 = new BusinessBillNo();
|
|
|
+ businessBillNo1.setBusinessTypeId(businessType.getId());
|
|
|
+ businessBillNo1.setCode("FXH-N");
|
|
|
+ R clientBillNo1 = businessBillNoService.getBillNoLos(businessBillNo1);
|
|
|
+ if (!clientBillNo1.isSuccess()) {
|
|
|
+ throw new RuntimeException("生成订单编号失败");
|
|
|
+ }
|
|
|
+ putBox.setInternalContainerNumber((String) clientBillNo1.getData());
|
|
|
+ putBox.setPolId(ports.getId());
|
|
|
+ putBox.setPolCode(ports.getCode());
|
|
|
+ putBox.setPolCname(ports.getCnName());
|
|
|
+ putBox.setPolEname(ports.getEnName());
|
|
|
+ putBox.setPolStationId(corps.getId());
|
|
|
+ putBox.setPolStationCode(corps.getCode());
|
|
|
+ putBox.setPolStationCname(corps.getCnName());
|
|
|
+ putBox.setPolStationEname(corps.getEnName());
|
|
|
+ putBox.setBoxCondition("好");
|
|
|
+ putBox.setBoxType(item.getBoxType());
|
|
|
+ putBox.setBoxClass("自有箱");
|
|
|
+ putBox.setTotalNum(1);
|
|
|
+ putBox.setOccupyNum(0);
|
|
|
+ putBox.setRemainingNum(1);
|
|
|
+ putBoxNewList.add(putBox);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ putBox.setTotalNum(putBox.getTotalNum() + 1);
|
|
|
+ putBox.setRemainingNum(putBox.getTotalNum() + 1 - putBox.getOccupyNum());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!putBoxNewList.isEmpty()) {
|
|
|
+ this.saveOrUpdateBatch(putBoxNewList);
|
|
|
+ } else {
|
|
|
+ throw new RemoteException("保存放箱号单据失败");
|
|
|
+ }
|
|
|
+ for (EmptyContainerAppearance item : excelList) {
|
|
|
+ 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 = putBoxNewList.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber())
|
|
|
+ && e.getPolId().equals(ports.getId()) && e.getPolStationId().equals(corps.getId())).findFirst().orElse(null);
|
|
|
+ if (putBox == null) {
|
|
|
+ throw new RuntimeException("未查到放箱号:" + 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());
|
|
|
+ } else {
|
|
|
+ putBoxItem = new PutBoxItems();
|
|
|
+ putBoxItem.setBoxClass(putBox.getBusType());
|
|
|
+ putBoxItem.setBoxBelongsTo("SOC");
|
|
|
+ putBoxItem.setBoxCondition("新");
|
|
|
+ putBoxItem.setBoxStatus("好");
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ putBoxItem = new PutBoxItems();
|
|
|
+ putBoxItem.setBoxClass(putBox.getBusType());
|
|
|
+ putBoxItem.setBoxBelongsTo("SOC");
|
|
|
+ putBoxItem.setBoxCondition("新");
|
|
|
+ putBoxItem.setBoxStatus("好");
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+ putBoxItems.add(putBoxItem);
|
|
|
+ }
|
|
|
+ if (!putBoxItems.isEmpty()) {
|
|
|
+ putBoxItemsService.saveOrUpdateBatch(putBoxItems);
|
|
|
+ for (PutBoxItems item : putBoxItems) {
|
|
|
+ PutBox putBox = putBoxList.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.setBoxType(item.getBoxType());
|
|
|
+ archivesTrajectory.setBoxCategory(item.getBoxClass());
|
|
|
+ archivesTrajectory.setBoxEastId(item.getBoxEastId());
|
|
|
+ archivesTrajectory.setBoxEastName(item.getBoxEastName());
|
|
|
+ archivesTrajectory.setMblno(item.getMblno());
|
|
|
+ archivesTrajectory.setBoxDynamics(item.getBoxDynamics());
|
|
|
+ archivesTrajectory.setStatus(item.getBoxDynamics());
|
|
|
+ archivesTrajectory.setBillType(putBox.getBusType());
|
|
|
+ archivesTrajectory.setCode(item.getBoxCode());
|
|
|
+ archivesTrajectory.setNewDate(new Date());
|
|
|
+ archivesTrajectory.setCreateTime(new Date());
|
|
|
+ archivesTrajectory.setCreateUser(AuthUtil.getUserId());
|
|
|
+ archivesTrajectory.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ archivesTrajectory.setTenantId(AuthUtil.getTenantId());
|
|
|
+ archivesTrajectory.setSrcId(putBox.getId());
|
|
|
+ archivesTrajectoryMapper.insert(archivesTrajectory);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!archivesArrayList.isEmpty()) {
|
|
|
+ archivesService.saveOrUpdateBatch(archivesArrayList);
|
|
|
+ }
|
|
|
+ if (!archivesDateleList.isEmpty()) {
|
|
|
+ archivesService.removeByIds(archivesDateleList);
|
|
|
+ }
|
|
|
+ ArchivesFiles archivesFiles = new ArchivesFiles();
|
|
|
+ archivesFiles.setCreateUser(AuthUtil.getUserId());
|
|
|
+ archivesFiles.setCreateTime(new Date());
|
|
|
+ archivesFiles.setTenantId(AuthUtil.getTenantId());
|
|
|
+ archivesFiles.setType("2");
|
|
|
+ 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("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
}
|