Browse Source

1.测试计算起运港,目的港超期箱使费及修改
2.箱池动态-pod导入接口生成放箱号单据判断修改
3.箱管复制单据金额合计未清空bug修改
4.放箱号明细导出字段不对修改
5.生成账单-操作员,业务员没值bug修改
6.结算中心获取的本次结算结算金额等于总金额减付费申请金额
7.箱池动态-空箱出场,pod返场提单号必填

纪新园 7 months ago
parent
commit
a7460a812d
15 changed files with 265 additions and 165 deletions
  1. 1 1
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/excel/EmptyContainerAppearance.java
  2. 1 1
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/excel/GiveAnEncore.java
  3. 0 5
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/excel/PutBoxItemExcel.java
  4. 63 0
      blade-service/blade-los/src/main/java/org/springblade/los/Util/BoxNumUtils.java
  5. 11 0
      blade-service/blade-los/src/main/java/org/springblade/los/box/controller/PutBoxItemsController.java
  6. 3 0
      blade-service/blade-los/src/main/java/org/springblade/los/box/controller/TradingBoxItemController.java
  7. 153 139
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/PutBoxServiceImpl.java
  8. 1 1
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/TradingBoxItemServiceImpl.java
  9. 9 0
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/TradingBoxServiceImpl.java
  10. 2 0
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/BillsServiceImpl.java
  11. 3 0
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/ContainersServiceImpl.java
  12. 2 0
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/PreContainersServiceImpl.java
  13. 2 0
      blade-service/blade-los/src/main/java/org/springblade/los/check/service/impl/AuditProecessServiceImpl.java
  14. 10 14
      blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/controller/FinAccBillsController.java
  15. 4 4
      blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/service/impl/FinAccBillsServiceImpl.java

+ 1 - 1
blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/excel/EmptyContainerAppearance.java

@@ -51,7 +51,7 @@ public class EmptyContainerAppearance {
 	/**
 	 * 提单号
 	 */
-	@ExcelProperty(value = "提单号")
+	@ExcelProperty(value = "提单号*")
 	private String mblno;
 
 	/**

+ 1 - 1
blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/excel/GiveAnEncore.java

@@ -51,7 +51,7 @@ public class GiveAnEncore {
 	/**
 	 * 提单号
 	 */
-	@ExcelProperty(value = "提单号")
+	@ExcelProperty(value = "提单号*")
 	private String mblno;
 
 	/**

+ 0 - 5
blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/excel/PutBoxItemExcel.java

@@ -45,11 +45,6 @@ public class PutBoxItemExcel {
 	 * 箱东
 	 */
 	@ExcelProperty(value = "箱东")
-	private Long boxEastId;
-	/**
-	 * 箱东
-	 */
-	@ExcelProperty(value = "箱东")
 	private String boxEastName;
 	/**
 	 * 箱种类

+ 63 - 0
blade-service/blade-los/src/main/java/org/springblade/los/Util/BoxNumUtils.java

@@ -0,0 +1,63 @@
+package org.springblade.los.Util;
+
+import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils;
+
+/**
+ * @author :jixinyuan
+ * @date : 2025/6/12
+ */
+public class BoxNumUtils {
+
+
+	/**
+	 * 集装箱箱号验证
+	 *
+	 * @param cntrNo 箱号
+	 * @return 结果
+	 */
+	public static String containerNumberVerification(String cntrNo){
+
+//		result.setAck(EnumAck.Failure);
+		if (StringUtils.isEmpty(cntrNo)) {
+			return null;
+		}
+		int length = cntrNo.length();
+		if (length != 11) {
+			throw new RuntimeException("总长度非11位长!");
+		}
+		String sub1 = StringUtils.substring(cntrNo, 0, 4);
+		if (!sub1.matches("[A-Z]+")) {
+			throw new RuntimeException("第一部分非大写字母!");
+		}
+		String sub2 = StringUtils.substring(cntrNo, 4, length - 1);
+		if (!sub2.matches("[0-9]*")) {
+			throw new RuntimeException("第二部分非数字!");
+
+		}
+		String sub3 = StringUtils.substring(cntrNo, length - 1, length);
+		if (!sub3.matches("[0-9]*")) {
+			throw new RuntimeException("第二部分非数字!");
+
+		}
+		//定义一个字符串,集装箱编号的每个字符必定出自这串字符,其中11,22,33用?代替,获取对应值,满足0-38
+		String charCode = "0123456789A?BCDEFGHIJK?LMNOPQRSTU?VWXYZ";
+		char[] codeChars = cntrNo.toCharArray();//将接收到的字符串转换为字符数组,方便后续遍历
+		int num = 0;//初始化用于规则计算后累计的变量,用于计算结束后%第11位
+
+		for (int i = 0; i < 10; i++) {
+			int idx = charCode.indexOf(codeChars[i]);//遍历取出第i个字符,并从charCode字符串中查找这个字符所在位置,这个位置的值就是对应值
+			if (idx == -1 || charCode.charAt(idx) == '?') {//如果查找不到或者找到替代符号(?)一样,那么这个字符不是规则中所要求的字符,需要校验的字符串不符合集装箱号的规则,退出循环
+				throw new RuntimeException("不符合集装箱号的规则");
+			}
+			idx = (int) (idx * Math.pow(2, i));//这里的意思应该是说对应值*2的(n-1)次方;原文表达(2、第N位的箱号对应值再分别乘以2N-1 (N=1,2,3………..10))是误导的关键
+			num += idx;//累加
+		}
+		num = (num % 11) % 10;//取模11
+
+		if (!(Integer.parseInt(String.valueOf(codeChars[10])) == num)) {
+			throw new RuntimeException("第11位校验码未通过验证");
+		}
+		return null;
+	}
+
+}

+ 11 - 0
blade-service/blade-los/src/main/java/org/springblade/los/box/controller/PutBoxItemsController.java

@@ -32,8 +32,10 @@ import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.los.box.entity.PutBox;
 import org.springblade.los.box.entity.PutBoxItems;
 import org.springblade.los.box.excel.PutBoxItemExcel;
+import org.springblade.los.box.mapper.PutBoxMapper;
 import org.springblade.los.box.service.IPutBoxItemsService;
 import org.springframework.web.bind.annotation.*;
 
@@ -56,6 +58,8 @@ public class PutBoxItemsController extends BladeController {
 
 	private final IPutBoxItemsService putBoxItemsService;
 
+	private final PutBoxMapper putBoxMapper;
+
 	/**
 	 * 详情
 	 */
@@ -133,10 +137,17 @@ public class PutBoxItemsController extends BladeController {
 	 */
 	@GetMapping("/exportBoxItem")
 	public void exportBoxItem(HttpServletResponse response, Long pid) {
+		PutBox putBox = putBoxMapper.selectById(pid);
+		if (putBox == null) {
+			throw new RuntimeException("未查到单据信息");
+		}
 		List<PutBoxItems> list = putBoxItemsService.list(new LambdaQueryWrapper<PutBoxItems>()
 			.eq(PutBoxItems::getTenantId, AuthUtil.getTenantId())
 			.eq(PutBoxItems::getIsDeleted, 0)
 			.eq(PutBoxItems::getPid, pid));
+		for (PutBoxItems items : list) {
+			items.setContainerNumber(putBox.getContainerNumber());
+		}
 		ExcelUtil.export(response, "放箱号-箱明细", "箱明细", BeanUtil.copy(list, PutBoxItemExcel.class), PutBoxItemExcel.class);
 	}
 

+ 3 - 0
blade-service/blade-los/src/main/java/org/springblade/los/box/controller/TradingBoxItemController.java

@@ -305,6 +305,9 @@ public class TradingBoxItemController extends BladeController {
 		}else if ("2".equals(type)){
 			List<RentalBoxItemExcel> list = new ArrayList<>();
 			ExcelUtil.export(response, "导入箱明细模板-租箱", "箱明细", list, RentalBoxItemExcel.class);
+		}else if ("4".equals(type)){
+			List<RentalBoxItemExcel> list = new ArrayList<>();
+			ExcelUtil.export(response, "导入箱明细模板-箱管费用", "箱明细", list, RentalBoxItemExcel.class);
 		}
 	}
 

+ 153 - 139
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/PutBoxServiceImpl.java

@@ -263,18 +263,12 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				List<PutBoxItems> putBoxItems = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(item.getBoxCode()))
 					.collect(Collectors.toList());
 				if (item.getId() == null) {
-					if (!putBoxItems.isEmpty()) {
-						throw new RuntimeException("箱号" + item.getBoxCode() + "已在其他放箱号中存在,请勿重复添加");
-					}
 					item.setCreateUser(AuthUtil.getUserId());
 					item.setCreateTime(new Date());
 					item.setCreateUserName(AuthUtil.getUserName());
 					item.setTenantId(AuthUtil.getTenantId());
 					item.setPid(putBox.getId());
 				} else {
-					if (putBoxItems.stream().anyMatch(e -> !e.getId().equals(item.getId()))) {
-						throw new RuntimeException("箱号" + item.getBoxCode() + "已在其他放箱号中存在,请勿重复添加");
-					}
 					item.setUpdateTime(new Date());
 					item.setUpdateUser(AuthUtil.getUserId());
 					item.setUpdateUserName(AuthUtil.getUserName());
@@ -742,6 +736,9 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 			if (ObjectUtils.isNull(item.getBoxStatusDate())) {
 				throw new RemoteException("动态日期不能为空");
 			}
+			if (ObjectUtils.isNull(item.getMblno())) {
+				throw new RemoteException("提单号不能为空");
+			}
 			BCntrTypes cntrTypes = cntrTypesList.stream().filter(e -> e.getCnName().equals(item.getBoxType())).findFirst().orElse(null);
 			if (cntrTypes == null) {
 				throw new RemoteException("请先维护箱型:" + item.getBoxType() + "基础资料");
@@ -1258,6 +1255,9 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 			if (ObjectUtils.isNull(item.getBoxStatusDate())) {
 				throw new RemoteException("动态日期不能为空");
 			}
+			if (ObjectUtils.isNull(item.getMblno())) {
+				throw new RemoteException("提单号不能为空");
+			}
 			BPorts ports = portsList.stream().filter(e -> e.getCnName().equals(item.getPortName())).findFirst().orElse(null);
 			if (ports == null) {
 				throw new RemoteException("请先维护港口:" + item.getPortName() + "基础资料");
@@ -1474,7 +1474,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 			tradingBoxItemService.updateBatchById(tradingBoxItemOldList);
 		}
 		//计算超期箱使费
-		this.countOverdueFee(tradingBoxList, tradingBoxItemOldList, "2");
+		this.countOverdueFee(tradingBoxList, tradingBoxItemOldList);
 		ArchivesFiles archivesFiles = new ArchivesFiles();
 		archivesFiles.setCreateUser(AuthUtil.getUserId());
 		archivesFiles.setCreateTime(new Date());
@@ -1491,8 +1491,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 		return R.data("操作成功");
 	}
 
-	private void countOverdueFee(List<TradingBox> tradingBoxList, List<TradingBoxItem> tradingBoxItemOldList,
-								 String type) {
+	private void countOverdueFee(List<TradingBox> tradingBoxList, List<TradingBoxItem> tradingBoxItemOldList) {
 		List<FeeCenter> feeCenterList = new ArrayList<>();
 		List<String> mblnoList = tradingBoxItemOldList.stream().map(TradingBoxItem::getMblno).collect(Collectors.toList());
 		if (!mblnoList.isEmpty()) {
@@ -1548,7 +1547,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				//对应海运进出口单据所属公司所有币别
 				List<BCurExrate> curExrateList = currencyUtils.obtainRate(new Date(), "1", bills.getBranchId());
 				//所属公司具体超期标准
-				StorageFees storageFees = new StorageFees();
+				StorageFees storageFees;
 				if ("SE".equals(bills.getBusinessType())) {
 					storageFees = storageFeesList.stream().filter(e -> e.getBranchId().equals(bills.getBranchId()) &&
 						"出口超期箱".equals(e.getType())).findFirst().orElse(null);
@@ -1569,136 +1568,42 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				if (storageFeesItems.isEmpty()) {
 					throw new RuntimeException("请先维护基础资料-超期标准");
 				}
-				//超期天数
-				int overdueDays = 0;
-				if ("1".equals(type)) {
-					//起运港超期天数
-					if (ObjectUtils.isNotNull(item.getPolPickUpDate()) && ObjectUtils.isNotNull(bills.getEtd())) {
-						LocalDateTime ldt1 = bills.getEtd().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
-						LocalDateTime ldt2 = item.getPolPickUpDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
-						long days = ChronoUnit.DAYS.between(ldt1, ldt2);
-						if (ObjectUtils.isNull(bills.getPolFreeBoxUseDays()) || 0 == bills.getPolFreeBoxUseDays() ||
-							days > bills.getPolFreeBoxUseDays()) {
-							overdueDays = (int) (days - bills.getPolFreeBoxUseDays());
-						}
+				//起运港超期天数
+				if (ObjectUtils.isNotNull(item.getPolPickUpDate()) && ObjectUtils.isNotNull(bills.getEtd())) {
+					LocalDateTime ldt1 = bills.getEtd().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+					LocalDateTime ldt2 = item.getPolPickUpDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+					long days = ChronoUnit.DAYS.between(ldt2, ldt1);
+					//超期天数
+					int overdueDays = 0;
+					if (ObjectUtils.isNull(bills.getPolFreeBoxUseDays()) || 0 == bills.getPolFreeBoxUseDays() ||
+						days > bills.getPolFreeBoxUseDays()) {
+						overdueDays = (int) (days - bills.getPolFreeBoxUseDays());
 					}
-				} else if ("2".equals(type)) {
-					//目的港超期天数
-					if (ObjectUtils.isNotNull(item.getPodEmptyContainerReturnDate()) &&
-						ObjectUtils.isNotNull(bills.getEta())) {
-						LocalDateTime ldt1 = item.getPodEmptyContainerReturnDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
-						LocalDateTime ldt2 = bills.getEta().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
-						long days = ChronoUnit.DAYS.between(ldt1, ldt2);
-						if (ObjectUtils.isNull(bills.getPodFreeBoxUseDays()) || 0 == bills.getPodFreeBoxUseDays() ||
-							days > bills.getPodFreeBoxUseDays()) {
-							overdueDays = (int) (days - bills.getPodFreeBoxUseDays());
+					if (overdueDays != 0) {
+						FeeCenter feeCenter = this.addFeeCenter(tradingBox, item, bills, fees, storageFeesItems, curExrateList, overdueDays, exrateType);
+						if (feeCenter != null) {
+							feeCenterList.add(feeCenter);
 						}
 					}
-				} else {
-					throw new RuntimeException("业务类型错误,请联系管理员");
 				}
-				if (overdueDays != 0) {
-					FeeCenter feeCenter = new FeeCenter();
-					feeCenter.setBillType("箱东");
-					feeCenter.setCorpId(tradingBox.getPurchaseCompanyId());
-					feeCenter.setCorpCnName(tradingBox.getPurchaseCompanyName());
-					feeCenter.setCorpEnName(tradingBox.getPurchaseCompanyName());
-					feeCenter.setCreateTime(new Date());
-					feeCenter.setCreateUser(AuthUtil.getUserId());
-					feeCenter.setCreateUserName(AuthUtil.getUserName());
-					feeCenter.setPid(item.getPid());
-					if ("OW(拿)".equals(tradingBox.getType())) {
-						feeCenter.setDc("C");
-					} else {
-						feeCenter.setDc("D");
-					}
-					feeCenter.setFeeId(fees.getId());
-					feeCenter.setFeeCode(fees.getCode());
-					feeCenter.setFeeCnName(fees.getCnName());
-					feeCenter.setFeeEnName(fees.getEnName());
-					feeCenter.setCurCode(storageFeesItems.get(0).getCurCode());
-					feeCenter.setCntrNo(item.getCode());
-					feeCenter.setUnitNo(item.getBoxType());
-					//计算天数
-					int days = overdueDays + 1;
-					int earlySumDays = 0;
-					String text = "";
-					int dayLength;
-					BigDecimal amount = new BigDecimal("0.00");
-					for (StorageFeesItems term : storageFeesItems) {
-						BigDecimal rate;
-						//根据箱型获取具体超期单价
-						if ("20GP".equals(item.getBoxType())) {
-							rate = term.getPrice20gp();
-						} else if ("40HC".equals(item.getBoxType())) {
-							rate = term.getPrice40hc();
-						} else if ("40GP".equals(item.getBoxType())) {
-							rate = term.getPrice40gp();
-						} else {
-							continue;
-						}
-						dayLength = term.getEndDay() - term.getStartDay() + 1;
-						if (earlySumDays >= dayLength) {
-							earlySumDays -= dayLength;
-							continue;
-						}
-						if (earlySumDays + days > dayLength) {
-							int tempDays = dayLength - earlySumDays;
-							earlySumDays = 0;
-							days -= tempDays;
-							BigDecimal calculate = rate.multiply(new BigDecimal(tempDays + ""));
-							amount = amount.add(calculate);
-							text = text + tempDays + "天*" + rate + "元=" + calculate + "元,";
-						} else {
-							BigDecimal calculate = rate.multiply(new BigDecimal(days + ""));
-							amount = amount.add(calculate);
-							text = text + days + "天*" + rate + "元=" + calculate + "元";
-							days = 0;
-							break;
-						}
+				//目的港超期天数
+				if (ObjectUtils.isNotNull(item.getPodEmptyContainerReturnDate()) &&
+					ObjectUtils.isNotNull(bills.getEta())) {
+					LocalDateTime ldt1 = item.getPodEmptyContainerReturnDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+					LocalDateTime ldt2 = bills.getEta().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+					long days = ChronoUnit.DAYS.between(ldt2, ldt1);
+					//超期天数
+					int overdueDays = 0;
+					if (ObjectUtils.isNull(bills.getPodFreeBoxUseDays()) || 0 == bills.getPodFreeBoxUseDays() ||
+						days > bills.getPodFreeBoxUseDays()) {
+						overdueDays = (int) (days - bills.getPodFreeBoxUseDays());
 					}
-					if (days != 0) {
-						if ("20GP".equals(item.getBoxType())) {
-							BigDecimal calculate = storageFeesItems.get(storageFeesItems.size() - 1).getPrice20gp().multiply(new BigDecimal(days + ""));
-							amount = amount.add(calculate);
-							text = text + "超出费用:" + days + "天*" + storageFeesItems.get(storageFeesItems.size() - 1).getPrice20gp() + "元=" + calculate + "元,";
-						} else if ("40HC".equals(item.getBoxType())) {
-							BigDecimal calculate = storageFeesItems.get(storageFeesItems.size() - 1).getPrice40hc().multiply(new BigDecimal(days + ""));
-							amount = amount.add(calculate);
-							text = text + "超出费用:" + days + "天*" + storageFeesItems.get(storageFeesItems.size() - 1).getPrice40hc() + "元=" + calculate + "元,";
-						} else if ("40GP".equals(item.getBoxType())) {
-							BigDecimal calculate = storageFeesItems.get(storageFeesItems.size() - 1).getPrice40gp().multiply(new BigDecimal(days + ""));
-							amount = amount.add(calculate);
-							text = text + "超出费用:" + days + "天*" + storageFeesItems.get(storageFeesItems.size() - 1).getPrice40gp() + "元=" + calculate + "元,";
-						} else {
-							continue;
+					if (overdueDays != 0) {
+						FeeCenter feeCenter = this.addFeeCenter(tradingBox, item, bills, fees, storageFeesItems, curExrateList, overdueDays, exrateType);
+						if (feeCenter != null) {
+							feeCenterList.add(feeCenter);
 						}
 					}
-					if (exrateType.equals(feeCenter.getCurCode())) {
-						feeCenter.setExrate(new BigDecimal("1.00"));
-					} else {
-						feeCenter.setExrate(currencyUtils.obtainExrate("C", curExrateList, feeCenter.getCurCode(), "1"));
-					}
-					feeCenter.setAmount(amount);
-					feeCenter.setAmountLoc(amount.multiply(feeCenter.getExrate()));
-					feeCenter.setPrice(amount);
-					feeCenter.setRemarks(text);
-					feeCenter.setQuantity(new BigDecimal("1"));
-					feeCenter.setOutboundDate(tradingBox.getRentDate());
-					feeCenter.setBillNo(tradingBox.getSysNo());
-					feeCenter.setBusinessType(tradingBox.getType());
-					feeCenter.setBillDate(tradingBox.getPurchaseDate());
-					feeCenter.setBillCorpId(tradingBox.getPurchaseCompanyId());
-					feeCenter.setBillCorpCnName(tradingBox.getPurchaseCompanyName());
-					feeCenter.setBillCorpEnName(tradingBox.getPurchaseCompanyName());
-					feeCenter.setBillShortName(tradingBox.getPurchaseCompanyName());
-					feeCenter.setMblno(tradingBox.getContainerNumber());
-					feeCenter.setPolId(tradingBox.getPolId());
-					feeCenter.setPolCode(tradingBox.getPolCode());
-					feeCenter.setPolCnName(tradingBox.getPolCname());
-					feeCenter.setPolEnName(tradingBox.getPolEname());
-					feeCenter.setAutomaticGenerated("1");
-					feeCenterList.add(feeCenter);
 				}
 			}
 		}
@@ -1707,6 +1612,110 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 		}
 	}
 
+	private FeeCenter addFeeCenter(TradingBox tradingBox, TradingBoxItem item, Bills bills, BFees fees,
+								   List<StorageFeesItems> storageFeesItems, List<BCurExrate> curExrateList,
+								   int overdueDays, String exrateType) {
+		FeeCenter feeCenter = new FeeCenter();
+		feeCenter.setBillType(bills.getBillType());
+		feeCenter.setCorpType("箱东");
+		feeCenter.setCorpId(tradingBox.getPurchaseCompanyId());
+		feeCenter.setCorpCnName(tradingBox.getPurchaseCompanyName());
+		feeCenter.setCorpEnName(tradingBox.getPurchaseCompanyName());
+		feeCenter.setCreateTime(new Date());
+		feeCenter.setCreateUser(AuthUtil.getUserId());
+		feeCenter.setCreateUserName(AuthUtil.getUserName());
+		feeCenter.setPid(bills.getId());
+		feeCenter.setDc("D");
+		feeCenter.setFeeId(fees.getId());
+		feeCenter.setFeeCode(fees.getCode());
+		feeCenter.setFeeCnName(fees.getCnName());
+		feeCenter.setFeeEnName(fees.getEnName());
+		feeCenter.setCurCode(storageFeesItems.get(0).getCurCode());
+		feeCenter.setCntrNo(item.getCode());
+		feeCenter.setUnitNo(item.getBoxType());
+		//计算天数
+		int days = overdueDays + 1;
+		int earlySumDays = 0;
+		String text = "";
+		int dayLength;
+		BigDecimal amount = new BigDecimal("0.00");
+		for (StorageFeesItems term : storageFeesItems) {
+			BigDecimal rate;
+			//根据箱型获取具体超期单价
+			if ("20GP".equals(item.getBoxType())) {
+				rate = term.getPrice20gp();
+			} else if ("40HC".equals(item.getBoxType())) {
+				rate = term.getPrice40hc();
+			} else if ("40GP".equals(item.getBoxType())) {
+				rate = term.getPrice40gp();
+			} else {
+				continue;
+			}
+			dayLength = term.getEndDay() - term.getStartDay() + 1;
+			if (earlySumDays >= dayLength) {
+				earlySumDays -= dayLength;
+				continue;
+			}
+			if (earlySumDays + days > dayLength) {
+				int tempDays = dayLength - earlySumDays;
+				earlySumDays = 0;
+				days -= tempDays;
+				BigDecimal calculate = rate.multiply(new BigDecimal(tempDays + ""));
+				amount = amount.add(calculate);
+				text = text + tempDays + "天*" + rate + "元=" + calculate + "元,";
+			} else {
+				BigDecimal calculate = rate.multiply(new BigDecimal(days + ""));
+				amount = amount.add(calculate);
+				text = text + days + "天*" + rate + "元=" + calculate + "元";
+				days = 0;
+				break;
+			}
+		}
+		if (days != 0) {
+			if ("20GP".equals(item.getBoxType())) {
+				BigDecimal calculate = storageFeesItems.get(storageFeesItems.size() - 1).getPrice20gp().multiply(new BigDecimal(days + ""));
+				amount = amount.add(calculate);
+				text = text + "超出费用:" + days + "天*" + storageFeesItems.get(storageFeesItems.size() - 1).getPrice20gp() + "元=" + calculate + "元,";
+			} else if ("40HC".equals(item.getBoxType())) {
+				BigDecimal calculate = storageFeesItems.get(storageFeesItems.size() - 1).getPrice40hc().multiply(new BigDecimal(days + ""));
+				amount = amount.add(calculate);
+				text = text + "超出费用:" + days + "天*" + storageFeesItems.get(storageFeesItems.size() - 1).getPrice40hc() + "元=" + calculate + "元,";
+			} else if ("40GP".equals(item.getBoxType())) {
+				BigDecimal calculate = storageFeesItems.get(storageFeesItems.size() - 1).getPrice40gp().multiply(new BigDecimal(days + ""));
+				amount = amount.add(calculate);
+				text = text + "超出费用:" + days + "天*" + storageFeesItems.get(storageFeesItems.size() - 1).getPrice40gp() + "元=" + calculate + "元,";
+			} else {
+				return null;
+			}
+		}
+		if (exrateType.equals(feeCenter.getCurCode())) {
+			feeCenter.setExrate(new BigDecimal("1.00"));
+		} else {
+			feeCenter.setExrate(currencyUtils.obtainExrate("C", curExrateList, feeCenter.getCurCode(), "1"));
+		}
+		feeCenter.setAmount(amount);
+		feeCenter.setAmountLoc(amount.multiply(feeCenter.getExrate()));
+		feeCenter.setPrice(amount);
+		feeCenter.setRemarks(text);
+		feeCenter.setQuantity(new BigDecimal("1"));
+		feeCenter.setBillNo(bills.getBillNo());
+		feeCenter.setBusinessType(bills.getBusinessType());
+		feeCenter.setBillDate(bills.getBillDate());
+		feeCenter.setBillCorpId(bills.getCorpId());
+		feeCenter.setBillCorpCnName(bills.getCorpCnName());
+		feeCenter.setBillCorpEnName(bills.getCorpEnName());
+		feeCenter.setBillShortName(bills.getCorpShortName());
+		feeCenter.setMblno(bills.getMblno());
+		feeCenter.setPolId(bills.getPolId());
+		feeCenter.setPolCode(bills.getPolCode());
+		feeCenter.setPolCnName(bills.getPolCnName());
+		feeCenter.setPolEnName(bills.getPolEnName());
+		feeCenter.setAutomaticGenerated("1");
+		feeCenter.setBranchId(bills.getBranchId());
+		feeCenter.setBranchName(bills.getBranchName());
+		return feeCenter;
+	}
+
 	private Archives updateArchives(Archives archives, GiveAnEncore item, BPorts ports, BCorps corps) {
 		archives.setUpdateTime(new Date());
 		archives.setUpdateUser(AuthUtil.getUserId());
@@ -1730,7 +1739,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 														  List<TradingBoxItem> tradingBoxItemList, BPorts ports, String status) {
 		PutBox putBoxOld;
 		if ("1".equals(status)) {
-			putBoxOld = putBoxList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumberOw())).findFirst().orElse(null);
+			putBoxOld = putBoxList.stream().filter(e -> ObjectUtils.isNotNull(e.getSrcContainerNumber()) && e.getSrcContainerNumber().equals(archives.getContainerNumberOw())).findFirst().orElse(null);
 		} else {
 			putBoxOld = putBoxList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumber())
 				&& ObjectUtils.isNotNull(e.getPolId()) && e.getPolId().equals(archives.getAddressId())
@@ -1789,7 +1798,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 												BCorps corps, List<PutBoxItems> putBoxItemsList, String status) {
 		PutBox putBoxOld;
 		if ("1".equals(status)) {
-			putBoxOld = putBoxList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumberOw())).findFirst().orElse(null);
+			putBoxOld = putBoxList.stream().filter(e -> ObjectUtils.isNotNull(e.getSrcContainerNumber()) && e.getSrcContainerNumber().equals(archives.getContainerNumberOw())).findFirst().orElse(null);
 		} else {
 			putBoxOld = putBoxList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumber())
 				&& ObjectUtils.isNotNull(e.getPolId()) && e.getPolId().equals(archives.getAddressId())
@@ -1830,9 +1839,10 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 	private List<PutBox> create(List<PutBox> putBoxList, Archives archives, BPorts ports, BCorps corps, List<PutBox> putBoxNewList, Long id, String status) {
 		PutBox putBox;
 		if ("1".equals(status)) {
-			putBox = putBoxList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumberOw())
+			putBox = putBoxList.stream().filter(e -> ObjectUtils.isNotNull(e.getSrcContainerNumber()) && e.getSrcContainerNumber().equals(archives.getContainerNumberOw())
 				&& e.getPolId().equals(ports.getId()) && e.getPolStationId().equals(corps.getId())
-				&& e.getBusType().equals(archives.getContainerNumberTypeOw())).findFirst().orElse(null);
+				&& ObjectUtils.isNotNull(e.getSrcType()) && e.getSrcType().equals(archives.getContainerNumberTypeOw()))
+				.findFirst().orElse(null);
 		} else {
 			putBox = putBoxList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumber())
 				&& e.getPolId().equals(ports.getId()) && e.getPolStationId().equals(corps.getId())
@@ -1861,6 +1871,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 					}
 					putBox1.setSysNo((String) clientBillNo.getData());
 					putBox1.setContainerNumber(archives.getContainerNumber());
+					putBox1.setSrcContainerNumber(archives.getContainerNumberOw());
+					putBox1.setSrcType(archives.getContainerNumberTypeOw());
 					BusinessBillNo businessBillNo1 = new BusinessBillNo();
 					businessBillNo1.setBusinessTypeId(id);
 					businessBillNo1.setCode("FXH-N");
@@ -1909,6 +1921,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				putBox.setBoxBelongsTo("SOC");
 				putBox.setBoxEastId(archives.getBoxEastId() + "");
 				putBox.setBoxEastName(archives.getBoxEastName());
+				putBox.setSrcContainerNumber(archives.getContainerNumberOw());
+				putBox.setSrcType(archives.getContainerNumberTypeOw());
 				BusinessBillNo businessBillNo1 = new BusinessBillNo();
 				businessBillNo1.setBusinessTypeId(id);
 				businessBillNo1.setCode("FXH-N");
@@ -2758,8 +2772,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				}
 			}
 		}
-		//计算超期箱使费
-		this.countOverdueFee(tradingBoxList, tradingBoxItemList, "1");
+		/*//计算超期箱使费
+		this.countOverdueFee(tradingBoxList, tradingBoxItemList);*/
 		ArchivesFiles archivesFiles = new ArchivesFiles();
 		archivesFiles.setCreateUser(AuthUtil.getUserId());
 		archivesFiles.setCreateTime(new Date());

+ 1 - 1
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/TradingBoxItemServiceImpl.java

@@ -105,7 +105,7 @@ public class TradingBoxItemServiceImpl extends ServiceImpl<TradingBoxItemMapper,
 		String stationName = "";
 		String cyCname = "";
 		List<TradingBoxItem> tradingBoxItemList = new ArrayList<>();
-		if ("1".equals(type)) {
+		if ("1,4".contains(type)) {
 			//导入数据
 			List<TradingBoxItemExcel> excelList = ExcelUtil.read(file, TradingBoxItemExcel.class);
 			if (CollectionUtils.isEmpty(excelList)) {

+ 9 - 0
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/TradingBoxServiceImpl.java

@@ -1090,6 +1090,15 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 		details.setRemainingBoxNumber(0);
 		details.setRentEndDate(null);
 		details.setPurchaseDate(null);
+		details.setAmountD(new BigDecimal("0.00"));
+		details.setAmountC(new BigDecimal("0.00"));
+		details.setProfit(new BigDecimal("0.00"));
+		details.setAmountDUsd(new BigDecimal("0.00"));
+		details.setAmountCUsd(new BigDecimal("0.00"));
+		details.setProfitUsd(new BigDecimal("0.00"));
+		details.setTotalAmountD(new BigDecimal("0.00"));
+		details.setTotalAmountC(new BigDecimal("0.00"));
+		details.setTotalProfit(new BigDecimal("0.00"));
 		return details;
 	}
 

+ 2 - 0
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/BillsServiceImpl.java

@@ -31,6 +31,7 @@ import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.los.Util.BoxNumUtils;
 import org.springblade.los.Util.CurrencyUtils;
 import org.springblade.los.Util.StringTools;
 import org.springblade.los.Util.ZrUtil;
@@ -381,6 +382,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 					.eq(Containers::getIsDeleted, 0));
 				if (!containersList.isEmpty()) {
 					for (Containers item : containersList) {
+						BoxNumUtils.containerNumberVerification(item.getCntrNo());
 						item.setUpdateUser(AuthUtil.getUserId());
 						item.setUpdateUserName(AuthUtil.getUserName());
 						item.setUpdateTime(new Date());

+ 3 - 0
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/ContainersServiceImpl.java

@@ -24,6 +24,7 @@ import lombok.AllArgsConstructor;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.los.Util.BoxNumUtils;
 import org.springblade.los.business.sea.dto.WaitingBox;
 import org.springblade.los.business.sea.entity.Bills;
 import org.springblade.los.business.sea.entity.Containers;
@@ -84,6 +85,7 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
 		if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
 			deptName = String.join(",", res.getData());
 		}
+		BoxNumUtils.containerNumberVerification(containers.getCntrNo());
 		String sealNo = ObjectUtils.isNotNull(containers.getSealNo()) ? containers.getSealNo().toUpperCase() : "";
 		// 普柜可以设定为,铅封不能重复,但框架 FR  FH这一类的,HMM要求录入NIL,MSK要求录入000000
 		Boolean isNilSealNo = "".equals(sealNo) || "NIL".equals(sealNo) || "000000".equals(sealNo);
@@ -492,6 +494,7 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
 		List<ContainersBills> subtractContainersBillsList = new ArrayList<>();
 		List<ContainersCommodity> containersCommodityList = new ArrayList<>();
 		for (Containers containers : list) {
+			BoxNumUtils.containerNumberVerification(containers.getCntrNo());
 			String sealNo = ObjectUtils.isNotNull(containers.getSealNo()) ? containers.getSealNo().toUpperCase() : "";
 			// 普柜可以设定为,铅封不能重复,但框架 FR  FH这一类的,HMM要求录入NIL,MSK要求录入000000
 			Boolean isNilSealNo = "".equals(sealNo) || "NIL".equals(sealNo) || "000000".equals(sealNo);

+ 2 - 0
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/PreContainersServiceImpl.java

@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.AllArgsConstructor;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
+import org.springblade.los.Util.BoxNumUtils;
 import org.springblade.los.Util.RegularUtils;
 import org.springblade.los.basic.cntr.entity.BCntrTypes;
 import org.springblade.los.basic.cntr.service.IBCntrTypesService;
@@ -318,6 +319,7 @@ public class PreContainersServiceImpl extends ServiceImpl<PreContainersMapper, P
 			.eq(Containers::getIsDeleted, 0));
 		if (!containersList.isEmpty()) {
 			for (Containers item : containersList) {
+				BoxNumUtils.containerNumberVerification(item.getCntrNo());
 				item.setUpdateUser(AuthUtil.getUserId());
 				item.setUpdateUserName(AuthUtil.getUserName());
 				item.setUpdateTime(new Date());

+ 2 - 0
blade-service/blade-los/src/main/java/org/springblade/los/check/service/impl/AuditProecessServiceImpl.java

@@ -1604,6 +1604,8 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
 				data.setSrcCnName(item.getSrcCnName());
 				data.setSrcEnName(item.getSrcEnName());
 				data.setSrcType(item.getSrcType());
+				data.setOperatorId(expenseApplication.getCreateUser());
+				data.setOperatorName(expenseApplication.getCreateUserName());
 				data.setPaymode(item.getPaymode());
 				data.setCorpId(item.getCorpId());
 				data.setCorpCnName(item.getCorpCnName());

+ 10 - 14
blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/controller/FinAccBillsController.java

@@ -137,7 +137,7 @@ public class FinAccBillsController extends BladeController {
 		lambdaQueryWrapper.le(ObjectUtils.isNotNull(finAccBills.getOutboundDateEnd()), FinAccBills::getOutboundDate, finAccBills.getOutboundDateEnd());
 		lambdaQueryWrapper.orderByDesc(FinAccBills::getCreateTime);
 		if (!AuthUtil.getUserRole().contains("总部") && !AuthUtil.getUserRole().contains("admin")) {
-			lambdaQueryWrapper.eq( FinAccBills::getBranchId, AuthUtil.getDeptId());
+			lambdaQueryWrapper.eq(FinAccBills::getBranchId, AuthUtil.getDeptId());
 		} else {
 			lambdaQueryWrapper.eq(ObjectUtils.isNotNull(finAccBills.getBranchId()), FinAccBills::getBranchId, finAccBills.getBranchId());
 		}
@@ -308,7 +308,7 @@ public class FinAccBillsController extends BladeController {
 		lambdaQueryWrapper.le(ObjectUtils.isNotNull(finAccBills.getApprovedDateEnd()), FinAccBills::getApprovedDate, finAccBills.getApprovedDateEnd());
 		lambdaQueryWrapper.orderByDesc(FinAccBills::getCreateTime);
 		if (!AuthUtil.getUserRole().contains("总部") && !AuthUtil.getUserRole().contains("admin")) {
-			lambdaQueryWrapper.eq( FinAccBills::getBranchId, AuthUtil.getDeptId());
+			lambdaQueryWrapper.eq(FinAccBills::getBranchId, AuthUtil.getDeptId());
 		} else {
 			lambdaQueryWrapper.eq(ObjectUtils.isNotNull(finAccBills.getBranchId()), FinAccBills::getBranchId, finAccBills.getBranchId());
 		}
@@ -353,12 +353,8 @@ public class FinAccBillsController extends BladeController {
 		List<FinAccBillsVO> list = finAccBillsService.listAccBill(listAccBillVO);
 		for (FinAccBillsVO item : list) {
 			item.setQuantityCntrTypesDescr(item.getQuantityCntrDescr());
-			if("C".equals(listAccBillVO.getDc())){
-				BigDecimal amount = item.getAppliedAmount().subtract(item.getAppliedAmountStl());
-				item.setAppliedCurrentStlAmount(item.getAmount().subtract(amount).subtract(item.getStlTtlAmount()));
-			}else{
-				item.setAppliedCurrentStlAmount(item.getAmount().subtract(item.getStlTtlAmount()));
-			}
+			BigDecimal amount = item.getAppliedAmount().subtract(item.getAppliedAmountStl());
+			item.setAppliedCurrentStlAmount(item.getAmount().subtract(amount).subtract(item.getStlTtlAmount()));
 			item.setAppliedInvoiceCurrentStlAmount(item.getAmount().subtract(item.getStlTtlAmount()));
 			item.setReconciliationCurrentAmount(item.getAmount().subtract(item.getReconciliationAmount()));
 			BigDecimal invoice = item.getAppliedInvoiceAmount().subtract(item.getAppliedInvoiceAmountStl());
@@ -482,19 +478,19 @@ public class FinAccBillsController extends BladeController {
 	@GetMapping("/listFeeCountByCorp")
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "类别", notes = "传入finAccBills")
-	public R<List<Map<String,Object>>> listFeeCountByCorp(String dc,Long corpId) {
-		List<Map<String,Object>> mapList = finAccBillsService.listFeeCountByCorp(dc,corpId);
+	public R<List<Map<String, Object>>> listFeeCountByCorp(String dc, Long corpId) {
+		List<Map<String, Object>> mapList = finAccBillsService.listFeeCountByCorp(dc, corpId);
 		return R.data(mapList);
 	}
 
 	@GetMapping("/listFeeCountByCorpExport")
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "类别", notes = "传入finAccBills")
-	public void listFeeCountByCorpExport(String dc,Long corpId, HttpServletResponse response) {
-		List<FeeCountByCorpExcel> mapList = finAccBillsService.listFeeCountByCorpExport(dc,corpId);
-		if ("D".equals(dc)){
+	public void listFeeCountByCorpExport(String dc, Long corpId, HttpServletResponse response) {
+		List<FeeCountByCorpExcel> mapList = finAccBillsService.listFeeCountByCorpExport(dc, corpId);
+		if ("D".equals(dc)) {
 			ExcelUtil.export(response, "客户应收明细", "客户应收明细", BeanUtil.copy(mapList, FeeCountByCorpDExcel.class), FeeCountByCorpDExcel.class);
-		}else if ("C".equals(dc)){
+		} else if ("C".equals(dc)) {
 			ExcelUtil.export(response, "客户应付明细", "客户应付明细", BeanUtil.copy(mapList, FeeCountByCorpCExcel.class), FeeCountByCorpCExcel.class);
 		}
 	}

+ 4 - 4
blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/service/impl/FinAccBillsServiceImpl.java

@@ -219,10 +219,10 @@ public class FinAccBillsServiceImpl extends ServiceImpl<FinAccBillsMapper, FinAc
 				data.setBusinessBillNo(item.getBillNo());
 				data.setBusinessDate(item.getBillDate());
 			}
-			data.setSrcId(item.getSrcId());
-			data.setSrcCnName(item.getSrcCnName());
-			data.setSrcEnName(item.getSrcEnName());
-			data.setSrcType(item.getSrcType());
+			data.setSrcId(bills.getSrcId());
+			data.setSrcCnName(bills.getSrcCnName());
+			data.setSrcEnName(bills.getSrcEnName());
+			data.setSrcType(bills.getSrcType());
 			data.setOperatorId(bills.getOperatorId());
 			data.setOperatorName(bills.getOperatorName());
 			data.setQuantityCntrDescr(bills.getQuantityCntrDescr());