|
@@ -43,6 +43,7 @@ import org.springblade.los.box.mapper.TradingBoxMapper;
|
|
|
import org.springblade.los.box.service.*;
|
|
import org.springblade.los.box.service.*;
|
|
|
import org.springblade.los.business.sea.entity.Bills;
|
|
import org.springblade.los.business.sea.entity.Bills;
|
|
|
import org.springblade.los.business.sea.entity.Containers;
|
|
import org.springblade.los.business.sea.entity.Containers;
|
|
|
|
|
+import org.springblade.los.business.sea.entity.SeaContainerNumberItem;
|
|
|
import org.springblade.los.business.sea.service.IBillsService;
|
|
import org.springblade.los.business.sea.service.IBillsService;
|
|
|
import org.springblade.los.business.sea.service.IContainersService;
|
|
import org.springblade.los.business.sea.service.IContainersService;
|
|
|
import org.springblade.los.business.sea.service.ISeaContainerNumberItemService;
|
|
import org.springblade.los.business.sea.service.ISeaContainerNumberItemService;
|
|
@@ -191,8 +192,10 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
lambdaQueryWrapper.eq(TradingBox::getIsDeleted, 0)
|
|
lambdaQueryWrapper.eq(TradingBox::getIsDeleted, 0)
|
|
|
.eq(TradingBox::getTenantId, AuthUtil.getTenantId())
|
|
.eq(TradingBox::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(TradingBox::getType, tradingBox.getType());
|
|
.eq(TradingBox::getType, tradingBox.getType());
|
|
|
- if ("OW-N,OW-F".contains(tradingBox.getType())) {
|
|
|
|
|
|
|
+ if ("OW-N".equals(tradingBox.getType())) {
|
|
|
lambdaQueryWrapper.eq(TradingBox::getContainerNumber, tradingBox.getContainerNumber());
|
|
lambdaQueryWrapper.eq(TradingBox::getContainerNumber, tradingBox.getContainerNumber());
|
|
|
|
|
+ } else if ("OW-F".equals(tradingBox.getType())) {
|
|
|
|
|
+ lambdaQueryWrapper.eq(TradingBox::getInternalContainerNumber, tradingBox.getInternalContainerNumber());
|
|
|
} else {
|
|
} else {
|
|
|
if ("ZR,DL".contains(tradingBox.getType())) {
|
|
if ("ZR,DL".contains(tradingBox.getType())) {
|
|
|
lambdaQueryWrapper.eq(ObjectUtils.isNotNull(tradingBox.getContainerNumber()), TradingBox::getContainerNumber, tradingBox.getContainerNumber());
|
|
lambdaQueryWrapper.eq(ObjectUtils.isNotNull(tradingBox.getContainerNumber()), TradingBox::getContainerNumber, tradingBox.getContainerNumber());
|
|
@@ -278,7 +281,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
if (ObjectUtils.isNotNull(tradingBox.getContractNo())) {
|
|
if (ObjectUtils.isNotNull(tradingBox.getContractNo())) {
|
|
|
tradingBox.setContractNo(tradingBox.getContractNo().trim());
|
|
tradingBox.setContractNo(tradingBox.getContractNo().trim());
|
|
|
}
|
|
}
|
|
|
- if ("OW-N,OW-F".contains(tradingBox.getType()) && ObjectUtils.isNull(tradingBox.getInternalContainerNumber())) {
|
|
|
|
|
|
|
+ if ("OW-N".contains(tradingBox.getType()) && ObjectUtils.isNull(tradingBox.getInternalContainerNumber())) {
|
|
|
BusinessType businessType1 = bBusinessTypeService.getOne(new LambdaQueryWrapper<BusinessType>()
|
|
BusinessType businessType1 = bBusinessTypeService.getOne(new LambdaQueryWrapper<BusinessType>()
|
|
|
.select(BusinessType::getId)
|
|
.select(BusinessType::getId)
|
|
|
.eq(BusinessType::getTenantId, AuthUtil.getTenantId())
|
|
.eq(BusinessType::getTenantId, AuthUtil.getTenantId())
|
|
@@ -309,6 +312,16 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
text = "合同号已存在,请勿重复添加";
|
|
text = "合同号已存在,请勿重复添加";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ if ("OW-F".equals(tradingBox.getType())) {
|
|
|
|
|
+ String fixedPrefix = sysClient.getParamService("fixed.prefix.numbering");
|
|
|
|
|
+ if (ObjectUtils.isNull(fixedPrefix) || "获取数据失败".equals(fixedPrefix)) {
|
|
|
|
|
+ throw new RuntimeException("请先维护放箱号固定前缀参数");
|
|
|
|
|
+ }
|
|
|
|
|
+ String data = tradingBox.getInternalContainerNumber().substring(0, fixedPrefix.length());
|
|
|
|
|
+ if (!fixedPrefix.equals(data)) {
|
|
|
|
|
+ tradingBox.setInternalContainerNumber(fixedPrefix + tradingBox.getInternalContainerNumber());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
//判断id是否为空
|
|
//判断id是否为空
|
|
|
if (tradingBox.getId() == null) {
|
|
if (tradingBox.getId() == null) {
|
|
|
if (!tradingBoxList.isEmpty() && ObjectUtils.isNotNull(text)) {
|
|
if (!tradingBoxList.isEmpty() && ObjectUtils.isNotNull(text)) {
|
|
@@ -1624,14 +1637,18 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
throw new RuntimeException("请先维护箱型箱量明细");
|
|
throw new RuntimeException("请先维护箱型箱量明细");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- PutBox putBox = putBoxService.getOne(new LambdaQueryWrapper<PutBox>()
|
|
|
|
|
|
|
+ LambdaQueryWrapper<PutBox> lambdaQueryWrapper = new LambdaQueryWrapper<PutBox>()
|
|
|
.eq(PutBox::getTenantId, AuthUtil.getTenantId())
|
|
.eq(PutBox::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(PutBox::getIsDeleted, 0)
|
|
.eq(PutBox::getIsDeleted, 0)
|
|
|
- .eq(PutBox::getContainerNumber, detail.getContainerNumber())
|
|
|
|
|
.eq(PutBox::getPolId, detail.getPolId())
|
|
.eq(PutBox::getPolId, detail.getPolId())
|
|
|
.eq(ObjectUtils.isNotNull(boxType), PutBox::getBoxType, boxType)
|
|
.eq(ObjectUtils.isNotNull(boxType), PutBox::getBoxType, boxType)
|
|
|
- .eq(PutBox::getPolStationId, detail.getPolStationId())
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ .eq(PutBox::getPolStationId, detail.getPolStationId());
|
|
|
|
|
+ if ("OW-N".contains(tradingBox.getType())) {
|
|
|
|
|
+ lambdaQueryWrapper.eq(PutBox::getSrcContainerNumber, detail.getInternalContainerNumber());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ lambdaQueryWrapper.eq(PutBox::getContainerNumber, detail.getContainerNumber());
|
|
|
|
|
+ }
|
|
|
|
|
+ PutBox putBox = putBoxService.getOne(lambdaQueryWrapper);
|
|
|
if (putBox != null) {
|
|
if (putBox != null) {
|
|
|
throw new RuntimeException("OW类型放箱号:" + detail.getContainerNumber() + "已存在");
|
|
throw new RuntimeException("OW类型放箱号:" + detail.getContainerNumber() + "已存在");
|
|
|
/*if (!putBox.getBoxEastId().contains(tradingBox.getPurchaseCompanyId() + "")) {
|
|
/*if (!putBox.getBoxEastId().contains(tradingBox.getPurchaseCompanyId() + "")) {
|
|
@@ -1699,7 +1716,53 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
}
|
|
|
putBox.setSrcId(tradingBox.getId());
|
|
putBox.setSrcId(tradingBox.getId());
|
|
|
putBox.setSrcNo(tradingBox.getSysNo());
|
|
putBox.setSrcNo(tradingBox.getSysNo());
|
|
|
- putBox.setSrcContainerNumber(tradingBox.getContainerNumber());
|
|
|
|
|
|
|
+ if ("OW-N".contains(tradingBox.getType())) {
|
|
|
|
|
+ putBox.setSrcContainerNumber(tradingBox.getInternalContainerNumber());
|
|
|
|
|
+ PutBox putBoxOld = putBoxService.getById(tradingBox.getSrcContainerNumberId());
|
|
|
|
|
+ if (putBoxOld == null) {
|
|
|
|
|
+ throw new RuntimeException("未查到原放箱号数据");
|
|
|
|
|
+ }
|
|
|
|
|
+ SeaContainerNumberItem containerNumberItem = new SeaContainerNumberItem();
|
|
|
|
|
+ containerNumberItem.setPid(tradingBox.getId());
|
|
|
|
|
+ containerNumberItem.setBranchId(AuthUtil.getDeptId());
|
|
|
|
|
+ containerNumberItem.setCreateUser(AuthUtil.getUserId());
|
|
|
|
|
+ containerNumberItem.setCreateUserName(AuthUtil.getUserName());
|
|
|
|
|
+ containerNumberItem.setCreateTime(new Date());
|
|
|
|
|
+ containerNumberItem.setContainerNumber(putBoxOld.getContainerNumber());
|
|
|
|
|
+ containerNumberItem.setBusType(putBoxOld.getBoxClass());
|
|
|
|
|
+ containerNumberItem.setPolId(putBoxOld.getPolId());
|
|
|
|
|
+ containerNumberItem.setPolCname(putBoxOld.getPolCname());
|
|
|
|
|
+ containerNumberItem.setPodId(putBoxOld.getPodId());
|
|
|
|
|
+ containerNumberItem.setPodCname(putBoxOld.getPodCname());
|
|
|
|
|
+ containerNumberItem.setPolStationId(putBoxOld.getPolStationId());
|
|
|
|
|
+ containerNumberItem.setPolStationCname(putBoxOld.getPolStationCname());
|
|
|
|
|
+ containerNumberItem.setBoxType(putBoxOld.getBoxType());
|
|
|
|
|
+ containerNumberItem.setRemainingNum(putBoxOld.getRemainingNum());
|
|
|
|
|
+ containerNumberItem.setPodStationId(putBoxOld.getPodStationId());
|
|
|
|
|
+ containerNumberItem.setPodStationCname(putBoxOld.getPodStationCname());
|
|
|
|
|
+ containerNumberItem.setInternalContainerNumber(putBoxOld.getInternalContainerNumber());
|
|
|
|
|
+ containerNumberItem.setInternalBoxClass(putBoxOld.getInternalBoxClass());
|
|
|
|
|
+ containerNumberItem.setSrcId(putBoxOld.getId());
|
|
|
|
|
+ containerNumberItem.setOccupyNum(tradingBox.getBoxNumber());
|
|
|
|
|
+ containerNumberItem.setHblno(tradingBox.getInternalContainerNumber());
|
|
|
|
|
+ containerNumberItem.setMblno(tradingBox.getSysNo());
|
|
|
|
|
+ containerNumberItem.setActualOccupyNum(tradingBox.getBoxNumber());
|
|
|
|
|
+ containerNumberItem.setPriorityLevel(putBoxOld.getPriorityLevel());
|
|
|
|
|
+ containerNumberItem.setStorageNum(putBoxOld.getStorageNum());
|
|
|
|
|
+ seaContainerNumberItemService.save(containerNumberItem);
|
|
|
|
|
+ putBoxOld.setUpdateTime(new Date());
|
|
|
|
|
+ putBoxOld.setUpdateUser(AuthUtil.getUserId());
|
|
|
|
|
+ putBoxOld.setUpdateUserName(AuthUtil.getUserName());
|
|
|
|
|
+ putBoxOld.setOccupyNum(putBoxOld.getOccupyNum() + containerNumberItem.getOccupyNum());
|
|
|
|
|
+ putBoxOld.setRemainingNum(putBoxOld.getRemainingNum() - containerNumberItem.getOccupyNum());
|
|
|
|
|
+ if (putBoxOld.getRemainingNum() < 0) {
|
|
|
|
|
+ throw new RuntimeException("放箱号:" + putBoxOld.getContainerNumber() + "可用数量不足");
|
|
|
|
|
+ }
|
|
|
|
|
+ putBoxOld.setVersion(putBoxOld.getVersion()+1);
|
|
|
|
|
+ putBoxService.updateById(putBoxOld);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ putBox.setSrcContainerNumber(tradingBox.getContainerNumber());
|
|
|
|
|
+ }
|
|
|
putBox.setPolId(detail.getPolId());
|
|
putBox.setPolId(detail.getPolId());
|
|
|
putBox.setPolCname(detail.getPolCname());
|
|
putBox.setPolCname(detail.getPolCname());
|
|
|
putBox.setPolEname(detail.getPolEname());
|
|
putBox.setPolEname(detail.getPolEname());
|
|
@@ -1711,7 +1774,6 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
putBox.setBoxCondition(tradingBox.getBoxCondition());
|
|
putBox.setBoxCondition(tradingBox.getBoxCondition());
|
|
|
putBox.setTotalNum(tradingBox.getBoxNumber());
|
|
putBox.setTotalNum(tradingBox.getBoxNumber());
|
|
|
putBox.setRemainingNum(putBox.getTotalNum());
|
|
putBox.setRemainingNum(putBox.getTotalNum());
|
|
|
- putBox.setNotSuitcaseNum(putBox.getTotalNum());
|
|
|
|
|
putBox.setEffectiveEndDate(tradingBox.getExpiryDate());
|
|
putBox.setEffectiveEndDate(tradingBox.getExpiryDate());
|
|
|
putBox.setEffectiveStartDate(tradingBox.getEffectiveDate());
|
|
putBox.setEffectiveStartDate(tradingBox.getEffectiveDate());
|
|
|
putBox.setBoxType(tradingBox.getBoxTypeQuantityOne());
|
|
putBox.setBoxType(tradingBox.getBoxTypeQuantityOne());
|
|
@@ -2835,7 +2897,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
}
|
|
|
putBox.setTotalNum(tradingBox.getBoxNumber());
|
|
putBox.setTotalNum(tradingBox.getBoxNumber());
|
|
|
putBox.setRemainingNum(putBox.getTotalNum() - putBox.getOccupyNum() - alreadyAppeared);
|
|
putBox.setRemainingNum(putBox.getTotalNum() - putBox.getOccupyNum() - alreadyAppeared);
|
|
|
- putBox.setVersion(putBox.getVersion()+1);
|
|
|
|
|
|
|
+ putBox.setVersion(putBox.getVersion() + 1);
|
|
|
putBoxService.updateById(putBox);
|
|
putBoxService.updateById(putBox);
|
|
|
return R.data(tradingBox);
|
|
return R.data(tradingBox);
|
|
|
}
|
|
}
|