|
|
@@ -33,6 +33,8 @@ import org.springblade.los.basic.business.service.IBusinessTypeService;
|
|
|
import org.springblade.los.basic.cur.entity.BCurExrate;
|
|
|
import org.springblade.los.basic.fees.entity.BFees;
|
|
|
import org.springblade.los.basic.fees.service.IBFeesService;
|
|
|
+import org.springblade.los.basic.ports.entity.BPorts;
|
|
|
+import org.springblade.los.basic.ports.service.IBPortsService;
|
|
|
import org.springblade.los.billno.entity.BusinessBillNo;
|
|
|
import org.springblade.los.billno.service.IBusinessBillNoService;
|
|
|
import org.springblade.los.box.dto.ExportTradingBoxItemOut;
|
|
|
@@ -122,6 +124,8 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
|
|
|
private final IAuditProecessService auditProecessService;
|
|
|
|
|
|
+ private final IBPortsService bPortsService;
|
|
|
+
|
|
|
@Override
|
|
|
public TradingBox getDetail(TradingBox tradingBox) {
|
|
|
if (tradingBox.getId() == null) {
|
|
|
@@ -187,7 +191,12 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
if ("OW-N,OW-F".contains(tradingBox.getType())) {
|
|
|
lambdaQueryWrapper.eq(TradingBox::getContainerNumber, tradingBox.getContainerNumber());
|
|
|
} else {
|
|
|
- lambdaQueryWrapper.eq(TradingBox::getContractNo, tradingBox.getContractNo());
|
|
|
+ if ("ZR,DL".contains(tradingBox.getType())) {
|
|
|
+ lambdaQueryWrapper.eq(ObjectUtils.isNotNull(tradingBox.getContainerNumber()), TradingBox::getContainerNumber, tradingBox.getContainerNumber());
|
|
|
+ lambdaQueryWrapper.eq(TradingBox::getContractNo, tradingBox.getContractNo());
|
|
|
+ } else {
|
|
|
+ lambdaQueryWrapper.eq(TradingBox::getContractNo, tradingBox.getContractNo());
|
|
|
+ }
|
|
|
}
|
|
|
tradingBoxList = baseMapper.selectList(lambdaQueryWrapper);
|
|
|
if (ObjectUtils.isNotNull(tradingBox.getActualBoxNumber())) {
|
|
|
@@ -412,6 +421,8 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
|
tradingBox.setCode(String.join(",", codes));
|
|
|
tradingBox.setTradingBoxItemsList(tradingBox.getTradingBoxItemsList());
|
|
|
+ }else{
|
|
|
+ tradingBox.setCode("");
|
|
|
}
|
|
|
//费用数据
|
|
|
if (ObjectUtils.isNotNull(tradingBox.getFeeCenterList()) && !tradingBox.getFeeCenterList().isEmpty()) {
|
|
|
@@ -547,6 +558,12 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
if (boxTypeList.size() != boxType.size()) {
|
|
|
throw new RuntimeException("本单据明细存在重复箱型,操作失败!");
|
|
|
}
|
|
|
+ if ("ZR,DL".contains(tradingBox.getType())) {
|
|
|
+ if (1 != boxType.size()) {
|
|
|
+ throw new RuntimeException("箱型不支持多个");
|
|
|
+ }
|
|
|
+ tradingBox.setBoxTypeQuantityOne(boxTypeList.get(0).getBoxType());
|
|
|
+ }
|
|
|
StringBuilder boxTypeText = new StringBuilder();
|
|
|
for (TradingBoxType item : boxTypeList) {
|
|
|
boxTypeText.append(item.getBoxType()).append("*").append(item.getNumber()).append(",");
|
|
|
@@ -563,9 +580,13 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
item.setPid(tradingBox.getId());
|
|
|
}
|
|
|
}
|
|
|
- if (!"XGDX,CCSQ".contains(tradingBox.getType())) {
|
|
|
+ if (!"XGDX,CCSQ,ZR,DL".contains(tradingBox.getType())) {
|
|
|
tradingBox.setBoxTypeQuantityOne(boxTypeText.toString());
|
|
|
}
|
|
|
+ tradingBox.setBoxNumber(boxTypeList.stream().mapToInt(TradingBoxType::getNumber).sum());
|
|
|
+ tradingBox.setRemainingBoxNumber(tradingBox.getBoxNumber());
|
|
|
+ tradingBox.setNotSuitcaseNum(tradingBox.getBoxNumber());
|
|
|
+ tradingBox.setSuitcaseNum(0);
|
|
|
tradingBoxTypeService.saveOrUpdateBatch(boxTypeList);
|
|
|
tradingBox.setBoxTypeList(boxTypeList);
|
|
|
}
|
|
|
@@ -671,6 +692,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
tradingBoxItem.setUpdateTime(new Date());
|
|
|
tradingBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
tradingBoxItem.setStatus("待使用");
|
|
|
+ tradingBoxItem.setBuxStaus("已启租");
|
|
|
tradingBoxItem.setLeaseCommencementDate(tradingBox.getRentDate());
|
|
|
if (ObjectUtils.isNotNull(tradingBoxItem.getCode())) {
|
|
|
//更新箱档案信息
|
|
|
@@ -879,6 +901,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
archivesTrajectory.setBoxDynamics(tradingBoxItem.getBoxDynamics());
|
|
|
archivesTrajectory.setNewDate(tradingBox.getRentDate());
|
|
|
tradingBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ tradingBoxItem.setBuxStaus("已退租");
|
|
|
tradingBoxItem.setUpdateTime(new Date());
|
|
|
tradingBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
if (ObjectUtils.isNotNull(tradingBoxItem.getCode())) {
|
|
|
@@ -1654,18 +1677,6 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
putBox.setEffectiveEndDate(tradingBox.getExpiryDate());
|
|
|
putBox.setEffectiveStartDate(tradingBox.getEffectiveDate());
|
|
|
putBox.setBoxType(tradingBox.getBoxTypeQuantityOne());
|
|
|
- if (ObjectUtils.isNotNull(tradingBox.getInternalContainerNumber())) {
|
|
|
- putBox.setInternalContainerNumber(tradingBox.getInternalContainerNumber());
|
|
|
- } else {
|
|
|
- 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.setPolStationId(detail.getPolStationId());
|
|
|
putBox.setPolStationCode(detail.getPolStationCode());
|
|
|
putBox.setPolStationCname(detail.getPolStationCname());
|
|
|
@@ -2008,18 +2019,6 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
putBox.setContainerNumber(detail.getContainerNumber());
|
|
|
putBox.setBusType("自有箱");
|
|
|
putBox.setBoxClass("自有箱");
|
|
|
- if (ObjectUtils.isNotNull(tradingBox.getInternalContainerNumber())) {
|
|
|
- putBox.setInternalContainerNumber(tradingBox.getInternalContainerNumber());
|
|
|
- } else {
|
|
|
- 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.setBoxBelongsTo("SOC");
|
|
|
putBox.setPolId(detail.getPolId());
|
|
|
putBox.setPolCname(detail.getPolCname());
|
|
|
@@ -3450,8 +3449,9 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
.eq(TradingBox::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(TradingBox::getIsDeleted, 0)
|
|
|
.eq(TradingBox::getWhetherEnable, "是")
|
|
|
- .lt(TradingBox::getEffectiveDate, calendar.getTime())
|
|
|
- .apply("find_in_set(type,'OW-N,OW-F') and suitcase_num = 0")
|
|
|
+ .le(TradingBox::getEffectiveDate, calendar.getTime())
|
|
|
+ .ge(TradingBox::getExpiryDate, new Date())
|
|
|
+ .apply("find_in_set(type,'OW-N,OW-F') and not_suitcase_num != 0")
|
|
|
.orderByDesc(TradingBox::getExpiryDate));
|
|
|
for (TradingBox item : tradingBoxList) {
|
|
|
BoxReminderExcel excel = new BoxReminderExcel();
|
|
|
@@ -3494,7 +3494,6 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
.eq(TradingBox::getWhetherEnable, "是")
|
|
|
.ge(TradingBox::getExpiryDate, calendar.getTime())
|
|
|
.le(TradingBox::getExpiryDate, calendar1.getTime())
|
|
|
- .apply("find_in_set(type,'OW-N,OW-F') and suitcase_num != 0")
|
|
|
.orderByAsc(TradingBox::getExpiryDate));
|
|
|
for (TradingBox item : tradingBoxList) {
|
|
|
BoxReminderExcel excel = new BoxReminderExcel();
|
|
|
@@ -3696,4 +3695,58 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
return R.data(detail);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public R batchAddPod(String ids, String podIds) {
|
|
|
+ if (ObjectUtils.isNull(ids) || ObjectUtils.isNull(podIds)) {
|
|
|
+ throw new RuntimeException("缺少必要请求参数");
|
|
|
+ }
|
|
|
+ List<BPorts> bPortsList = bPortsService.list(new LambdaQueryWrapper<BPorts>()
|
|
|
+ .eq(BPorts::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(BPorts::getIsDeleted, 0)
|
|
|
+ .apply("find_in_set(id,'" + podIds + "')"));
|
|
|
+ List<TradingBox> tradingBoxList = baseMapper.selectList(new LambdaQueryWrapper<TradingBox>()
|
|
|
+ .eq(TradingBox::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(TradingBox::getIsDeleted, 0)
|
|
|
+ .apply("find_in_set(id,'" + ids + "')"));
|
|
|
+ if (tradingBoxList.isEmpty()) {
|
|
|
+ throw new RuntimeException("未查到对应单据");
|
|
|
+ }
|
|
|
+ String[] podIdArr = podIds.split(",");
|
|
|
+ for (String item : podIdArr) {
|
|
|
+ BPorts ports = bPortsList.stream().filter(e -> e.getId().equals(Long.parseLong(item))).findFirst().orElse(null);
|
|
|
+ if (ports != null) {
|
|
|
+ for (TradingBox detail : tradingBoxList) {
|
|
|
+ if (!detail.getPodId().contains(item)) {
|
|
|
+ detail.setPodId(detail.getPodId() + "," + item);
|
|
|
+ detail.setPodCname(detail.getPodCname() + "," + ports.getCode());
|
|
|
+ detail.setPodEname(detail.getPodEname() + "," + ports.getCode());
|
|
|
+ detail.setPodCode(detail.getPodCode() + "," + ports.getCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.updateBatchById(tradingBoxList);
|
|
|
+ List<PutBox> putBoxList = putBoxService.list(new LambdaQueryWrapper<PutBox>()
|
|
|
+ .eq(PutBox::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(PutBox::getIsDeleted, 0)
|
|
|
+ .apply("find_in_set(src_id,'" + ids + "')"));
|
|
|
+ if (!putBoxList.isEmpty()) {
|
|
|
+ for (String item : podIdArr) {
|
|
|
+ BPorts ports = bPortsList.stream().filter(e -> e.getId().equals(Long.parseLong(item))).findFirst().orElse(null);
|
|
|
+ if (ports != null) {
|
|
|
+ for (PutBox putBox : putBoxList) {
|
|
|
+ if (!putBox.getPodId().contains(item)) {
|
|
|
+ putBox.setPodId(putBox.getPodId() + "," + item);
|
|
|
+ putBox.setPodCname(putBox.getPodCname() + "," + ports.getCode());
|
|
|
+ putBox.setPodEname(putBox.getPodEname() + "," + ports.getCode());
|
|
|
+ putBox.setPodCode(putBox.getPodCode() + "," + ports.getCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ putBoxService.updateBatchById(putBoxList);
|
|
|
+ }
|
|
|
+ return R.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
}
|