|
@@ -2527,6 +2527,10 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
containers.setPodStationCname(tradingBox.getPodStationCname());
|
|
containers.setPodStationCname(tradingBox.getPodStationCname());
|
|
|
containers.setPodStationCode(tradingBox.getPodStationCode());
|
|
containers.setPodStationCode(tradingBox.getPodStationCode());
|
|
|
containers.setPodStationEname(tradingBox.getPodStationEname());
|
|
containers.setPodStationEname(tradingBox.getPodStationEname());
|
|
|
|
|
+ containers.setPodCyAddress(tradingBox.getPodCyAddress());
|
|
|
|
|
+ containers.setPodCyContact(tradingBox.getPodCyContact());
|
|
|
|
|
+ containers.setPodCyEmail(tradingBox.getPodCyEmail());
|
|
|
|
|
+ containers.setPodCyTel(tradingBox.getPodCyTel());
|
|
|
containersListNew.add(containers);
|
|
containersListNew.add(containers);
|
|
|
}
|
|
}
|
|
|
if (!containersListNew.isEmpty()) {
|
|
if (!containersListNew.isEmpty()) {
|
|
@@ -2534,6 +2538,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ baseMapper.updateById(tradingBox);
|
|
|
return R.data(tradingBox);
|
|
return R.data(tradingBox);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2741,9 +2746,13 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
String exrateType = currencyUtils.standardCurrency(AuthUtil.getDeptId());
|
|
String exrateType = currencyUtils.standardCurrency(AuthUtil.getDeptId());
|
|
|
List<BCurExrate> curExrateList = currencyUtils.obtainRate(new Date(), "1", AuthUtil.getDeptId());
|
|
List<BCurExrate> curExrateList = currencyUtils.obtainRate(new Date(), "1", AuthUtil.getDeptId());
|
|
|
for (TradingBoxItem item : putBoxItemsList) {
|
|
for (TradingBoxItem item : putBoxItemsList) {
|
|
|
|
|
+ Date endDate;
|
|
|
if (ObjectUtils.isNotNull(item.getPodEmptyContainerReturnDate())
|
|
if (ObjectUtils.isNotNull(item.getPodEmptyContainerReturnDate())
|
|
|
&& tradingBox.getRentDate().compareTo(item.getPodEmptyContainerReturnDate()) > 0) {
|
|
&& tradingBox.getRentDate().compareTo(item.getPodEmptyContainerReturnDate()) > 0) {
|
|
|
- throw new RuntimeException("箱号:" + item.getCode() + "租金计算截止时间大于pod还箱日期");
|
|
|
|
|
|
|
+ endDate = item.getPodEmptyContainerReturnDate();
|
|
|
|
|
+// throw new RuntimeException("箱号:" + item.getCode() + "租金计算截止时间大于pod还箱日期");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ endDate = tradingBox.getRentDate();
|
|
|
}
|
|
}
|
|
|
FeeCenterItems feeCenterItems = new FeeCenterItems();
|
|
FeeCenterItems feeCenterItems = new FeeCenterItems();
|
|
|
feeCenterItems.setBranchId(AuthUtil.getDeptId());
|
|
feeCenterItems.setBranchId(AuthUtil.getDeptId());
|
|
@@ -2766,7 +2775,6 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
feeCenterItems.setPodCode(detail.getPodCode());
|
|
feeCenterItems.setPodCode(detail.getPodCode());
|
|
|
feeCenterItems.setPodCnName(detail.getPodCname());
|
|
feeCenterItems.setPodCnName(detail.getPodCname());
|
|
|
feeCenterItems.setPodEnName(detail.getPodEname());
|
|
feeCenterItems.setPodEnName(detail.getPodEname());
|
|
|
- feeCenterItems.setFreeDay(detail.getFreeDay());
|
|
|
|
|
feeCenterItems.setMblno(item.getMblno());
|
|
feeCenterItems.setMblno(item.getMblno());
|
|
|
feeCenterItems.setHblno(item.getHblno());
|
|
feeCenterItems.setHblno(item.getHblno());
|
|
|
feeCenterItems.setEtd(item.getEtd());
|
|
feeCenterItems.setEtd(item.getEtd());
|
|
@@ -2786,7 +2794,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
feeCenterItems.setCurCode(rentTermList.get(0).getCurCode());
|
|
feeCenterItems.setCurCode(rentTermList.get(0).getCurCode());
|
|
|
feeCenterItems.setFeeType("2");
|
|
feeCenterItems.setFeeType("2");
|
|
|
Instant instant1 = item.getRentEndDate().toInstant();
|
|
Instant instant1 = item.getRentEndDate().toInstant();
|
|
|
- Instant instant2 = tradingBox.getRentDate().toInstant();
|
|
|
|
|
|
|
+ Instant instant2 = endDate.toInstant();
|
|
|
LocalDate date1 = instant1.atZone(ZoneId.systemDefault()).toLocalDate();
|
|
LocalDate date1 = instant1.atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
LocalDate date2 = instant2.atZone(ZoneId.systemDefault()).toLocalDate();
|
|
LocalDate date2 = instant2.atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
Duration duration = Duration.between(date1.atStartOfDay(), date2.atStartOfDay());
|
|
Duration duration = Duration.between(date1.atStartOfDay(), date2.atStartOfDay());
|
|
@@ -2816,6 +2824,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
int dayLength;
|
|
int dayLength;
|
|
|
BigDecimal amount = new BigDecimal("0.00");
|
|
BigDecimal amount = new BigDecimal("0.00");
|
|
|
String price = "";
|
|
String price = "";
|
|
|
|
|
+ int freeDays = 0;
|
|
|
for (RentTerm term : rentTermList) {
|
|
for (RentTerm term : rentTermList) {
|
|
|
dayLength = term.getStopDays() - term.getRiseDays() + 1;
|
|
dayLength = term.getStopDays() - term.getRiseDays() + 1;
|
|
|
if (earlySumDays >= dayLength) {
|
|
if (earlySumDays >= dayLength) {
|
|
@@ -2830,10 +2839,16 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
amount = amount.add(calculate);
|
|
amount = amount.add(calculate);
|
|
|
text = text + tempDays + "天*" + term.getRate() + "元=" + calculate + "元,";
|
|
text = text + tempDays + "天*" + term.getRate() + "元=" + calculate + "元,";
|
|
|
price = price + term.getRate() + ",";
|
|
price = price + term.getRate() + ",";
|
|
|
|
|
+ if (new BigDecimal("0.00").compareTo(term.getRate()) == 0) {
|
|
|
|
|
+ freeDays += tempDays;
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
BigDecimal calculate = term.getRate().multiply(new BigDecimal(days + ""));
|
|
BigDecimal calculate = term.getRate().multiply(new BigDecimal(days + ""));
|
|
|
amount = amount.add(calculate);
|
|
amount = amount.add(calculate);
|
|
|
text = text + days + "天*" + term.getRate() + "元=" + calculate + "元";
|
|
text = text + days + "天*" + term.getRate() + "元=" + calculate + "元";
|
|
|
|
|
+ if (new BigDecimal("0.00").compareTo(term.getRate()) == 0) {
|
|
|
|
|
+ freeDays += days;
|
|
|
|
|
+ }
|
|
|
days = 0;
|
|
days = 0;
|
|
|
price = price + term.getRate() + ",";
|
|
price = price + term.getRate() + ",";
|
|
|
break;
|
|
break;
|
|
@@ -2845,6 +2860,8 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
text = text + "超出费用:" + days + "天*" + rentTermList.get(rentTermList.size() - 1).getRate() + "元=" + calculate + "元,";
|
|
text = text + "超出费用:" + days + "天*" + rentTermList.get(rentTermList.size() - 1).getRate() + "元=" + calculate + "元,";
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ feeCenterItems.setFreeDay(freeDays);
|
|
|
|
|
+ feeCenterItems.setDays(feeCenterItems.getDays() - freeDays);
|
|
|
text = text + "+ gateInFee费用:" + detail.getGateInFee();
|
|
text = text + "+ gateInFee费用:" + detail.getGateInFee();
|
|
|
if (exrateType.equals(feeCenterItems.getCurCode())) {
|
|
if (exrateType.equals(feeCenterItems.getCurCode())) {
|
|
|
feeCenterItems.setExrate(new BigDecimal("1.00"));
|
|
feeCenterItems.setExrate(new BigDecimal("1.00"));
|
|
@@ -2855,12 +2872,12 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
feeCenterItems.setPrice(price);
|
|
feeCenterItems.setPrice(price);
|
|
|
feeCenterItems.setGateInFee(detail.getGateInFee());
|
|
feeCenterItems.setGateInFee(detail.getGateInFee());
|
|
|
feeCenterItems.setRemarks(text);
|
|
feeCenterItems.setRemarks(text);
|
|
|
- feeCenterItems.setOutboundDate(tradingBox.getRentDate());
|
|
|
|
|
|
|
+ feeCenterItems.setOutboundDate(endDate);
|
|
|
feeCenterItemsList.add(feeCenterItems);
|
|
feeCenterItemsList.add(feeCenterItems);
|
|
|
item.setUpdateTime(new Date());
|
|
item.setUpdateTime(new Date());
|
|
|
item.setUpdateUserName(AuthUtil.getUserName());
|
|
item.setUpdateUserName(AuthUtil.getUserName());
|
|
|
item.setUpdateUser(AuthUtil.getUserId());
|
|
item.setUpdateUser(AuthUtil.getUserId());
|
|
|
- item.setRentEndDate(tradingBox.getRentDate());
|
|
|
|
|
|
|
+ item.setRentEndDate(endDate);
|
|
|
item.setCount(item.getCount() + 1);
|
|
item.setCount(item.getCount() + 1);
|
|
|
}
|
|
}
|
|
|
tradingBoxItemService.updateBatchById(putBoxItemsList);
|
|
tradingBoxItemService.updateBatchById(putBoxItemsList);
|
|
@@ -3133,4 +3150,60 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
return R.data(tradingBox);
|
|
return R.data(tradingBox);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public R revokEnable(TradingBox detail) {
|
|
|
|
|
+ if (ObjectUtils.isNull(detail.getPolId())
|
|
|
|
|
+ || ObjectUtils.isNull(detail.getContainerNumber()) || ObjectUtils.isNull(detail.getPolStationId())) {
|
|
|
|
|
+ throw new RuntimeException("必要参数未填写");
|
|
|
|
|
+ }
|
|
|
|
|
+ TradingBox tradingBox = baseMapper.selectById(detail.getId());
|
|
|
|
|
+ tradingBox.setWhetherEnable("否");
|
|
|
|
|
+ tradingBox.setContainerNumber(detail.getContainerNumber());
|
|
|
|
|
+ tradingBox.setActivationDate(detail.getActivationDate());
|
|
|
|
|
+ baseMapper.updateById(tradingBox);
|
|
|
|
|
+ List<TradingBoxItem> itemList = tradingBoxItemService.list(new LambdaQueryWrapper<TradingBoxItem>()
|
|
|
|
|
+ .eq(TradingBoxItem::getPid, tradingBox.getId())
|
|
|
|
|
+ .eq(TradingBoxItem::getTenantId, AuthUtil.getTenantId())
|
|
|
|
|
+ .eq(TradingBoxItem::getIsDeleted, 0));
|
|
|
|
|
+ if (!itemList.isEmpty()) {
|
|
|
|
|
+ for (TradingBoxItem item : itemList) {
|
|
|
|
|
+ item.setUpdateUser(AuthUtil.getUserId());
|
|
|
|
|
+ item.setUpdateUserName(AuthUtil.getUserName());
|
|
|
|
|
+ item.setUpdateTime(new Date());
|
|
|
|
|
+ item.setWhetherEnable("否");
|
|
|
|
|
+ item.setContainerNumber(detail.getContainerNumber());
|
|
|
|
|
+ item.setActivationDate(detail.getActivationDate());
|
|
|
|
|
+ }
|
|
|
|
|
+ tradingBoxItemService.updateBatchById(itemList);
|
|
|
|
|
+ }
|
|
|
|
|
+ PutBox putBox = putBoxService.getOne(new LambdaQueryWrapper<PutBox>()
|
|
|
|
|
+ .eq(PutBox::getTenantId, AuthUtil.getTenantId())
|
|
|
|
|
+ .eq(PutBox::getIsDeleted, 0)
|
|
|
|
|
+ .eq(PutBox::getSrcContainerNumber, tradingBox.getContainerNumber())
|
|
|
|
|
+ .eq(PutBox::getSrcNo, tradingBox.getId())
|
|
|
|
|
+ .eq(PutBox::getSrcId, tradingBox.getSysNo())
|
|
|
|
|
+ .eq(PutBox::getWhetherManuallyCreate, "1")
|
|
|
|
|
+ );
|
|
|
|
|
+ if (putBox != null) {
|
|
|
|
|
+ if (putBox.getOccupyNum() > 0) {
|
|
|
|
|
+ throw new RuntimeException("放箱号:" + putBox.getContainerNumber() + "操作已占用,撤销失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+ List<PutBoxItems> boxItemsList = putBoxItemsService.list(new LambdaQueryWrapper<PutBoxItems>()
|
|
|
|
|
+ .eq(PutBoxItems::getTenantId, AuthUtil.getTenantId())
|
|
|
|
|
+ .eq(PutBoxItems::getIsDeleted, 0)
|
|
|
|
|
+ .eq(PutBoxItems::getPid, putBox.getId()));
|
|
|
|
|
+ if ("OW-N,OW-F".contains(tradingBox.getType())) {
|
|
|
|
|
+ if (!boxItemsList.isEmpty()) {
|
|
|
|
|
+ throw new RuntimeException("放箱号:" + putBox.getContainerNumber() + "已导入箱号,撤销失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (!boxItemsList.isEmpty()) {
|
|
|
|
|
+ putBoxItemsService.removeByIds(boxItemsList.stream().map(PutBoxItems::getId).collect(Collectors.toList()));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ putBoxService.removeById(putBox.getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ return R.success("操作成功");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|