Browse Source

2025年3月12日16:55:52

纪新园 9 months ago
parent
commit
cf28110c5e

+ 23 - 5
blade-service/blade-los/src/main/java/org/springblade/los/basic/units/service/impl/BUnitsServiceImpl.java

@@ -25,6 +25,7 @@ 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.IDeptUtils;
+import org.springblade.los.basic.fees.entity.LosBFeesTemplate;
 import org.springblade.los.basic.units.entity.BUnits;
 import org.springblade.los.basic.units.mapper.UnitsMapper;
 import org.springblade.los.basic.units.service.IBUnitsService;
@@ -69,13 +70,22 @@ public class BUnitsServiceImpl extends ServiceImpl<UnitsMapper, BUnits> implemen
 	}
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public R submit(BUnits bUnits) {
+		List<BUnits> list = baseMapper.selectList(new LambdaQueryWrapper<BUnits>()
+			.eq(BUnits::getTenantId, AuthUtil.getTenantId())
+			.eq(BUnits::getIsDeleted, 0)
+			.eq(BUnits::getCode, bUnits.getCode()));
+		List<BUnits> nameList = baseMapper.selectList(new LambdaQueryWrapper<BUnits>()
+			.eq(BUnits::getTenantId, AuthUtil.getTenantId())
+			.eq(BUnits::getIsDeleted, 0)
+			.eq(BUnits::getCnName, bUnits.getCnName()));
 		if (bUnits.getId() == null) {
-			if (baseMapper.selectCount(new LambdaQueryWrapper<BUnits>()
-				.eq(BUnits::getTenantId, AuthUtil.getTenantId())
-				.eq(BUnits::getIsDeleted, 0)
-				.eq(BUnits::getCnName, bUnits.getCnName())) > 0) {
-				throw new RuntimeException("名称已存在");
+			if (!list.isEmpty()) {
+				throw new RuntimeException("编码不允许重复");
+			}
+			if (!nameList.isEmpty()) {
+				throw new RuntimeException("中文名称不允许重复");
 			}
 			bUnits.setCreateTime(new Date());
 			bUnits.setCreateUser(AuthUtil.getUserId());
@@ -89,6 +99,14 @@ public class BUnitsServiceImpl extends ServiceImpl<UnitsMapper, BUnits> implemen
 				}
 			}
 		} else {
+			List<Long> ids = list.stream().map(BUnits::getId).filter(e -> !e.equals(bUnits.getId())).collect(Collectors.toList());
+			if (!ids.isEmpty()) {
+				throw new RuntimeException("编码不允许重复");
+			}
+			List<Long> idList = nameList.stream().map(BUnits::getId).filter(e -> !e.equals(bUnits.getId())).collect(Collectors.toList());
+			if (!idList.isEmpty()) {
+				throw new RuntimeException("中文名称不允许重复");
+			}
 			bUnits.setUpdateUser(AuthUtil.getUserId());
 			bUnits.setUpdateTime(new Date());
 			bUnits.setUpdateUserName(AuthUtil.getUserName());

+ 1 - 1
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/mapper/BillsMapper.xml

@@ -328,7 +328,7 @@
         fee.signfor_id as signforId,
         fee.signfor_name as signforName,
         fee.signfor_date as signforDate,
-
+        acc.quantity_cntr_descr as quantityCntrDescr,
         corp.account_period_type as accountPeriodType
         FROM
         los_fee_center fee

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

@@ -482,18 +482,16 @@ public class PreContainersServiceImpl extends ServiceImpl<PreContainersMapper, P
 				throw new RuntimeException("未找到派车信息");
 			}
 		} else {
-			if (1 == preContainers.getWhetherWarehousing()) {
-				DispatchVehicles dispatchVehicles = dispatchVehiclesService.getOne(new LambdaQueryWrapper<DispatchVehicles>()
-					.eq(DispatchVehicles::getBoxItemsId, preContainers.getId())
-					.eq(DispatchVehicles::getPid, preContainers.getPid()));
-				if (dispatchVehicles != null) {
-					if ("1".equals(dispatchVehicles.getWhetherDispatchVehicles())) {
-						throw new RuntimeException("已确认派车,撤销失败");
-					}
-					dispatchVehiclesService.removeById(dispatchVehicles.getId());
-				} else {
-					throw new RuntimeException("未找到派车信息");
+			DispatchVehicles dispatchVehicles = dispatchVehiclesService.getOne(new LambdaQueryWrapper<DispatchVehicles>()
+				.eq(DispatchVehicles::getBoxItemsId, preContainers.getId())
+				.eq(DispatchVehicles::getPid, preContainers.getPid()));
+			if (dispatchVehicles != null) {
+				if ("1".equals(dispatchVehicles.getWhetherDispatchVehicles())) {
+					throw new RuntimeException("已确认派车,撤销失败");
 				}
+				dispatchVehiclesService.removeById(dispatchVehicles.getId());
+			} else {
+				throw new RuntimeException("未找到派车信息");
 			}
 		}
 		Bills bills = billsMapper.selectById(preContainers.getPid());

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

@@ -347,6 +347,7 @@ public class FinAccBillsController extends BladeController {
 		List<FinAccBillsVO> finAccBillsVOList = new ArrayList<>();
 		List<FinAccBillsVO> list = finAccBillsService.listAccBill(listAccBillVO);
 		for (FinAccBillsVO item : list) {
+			item.setQuantityCntrTypesDescr(item.getQuantityCntrDescr());
 			BigDecimal amount = item.getAppliedAmount().subtract(item.getAppliedAmountStl());
 			item.setAppliedCurrentStlAmount(item.getAmount().subtract(amount).subtract(item.getStlTtlAmount()));
 			item.setAppliedInvoiceCurrentStlAmount(item.getAmount().subtract(item.getStlTtlAmount()));

+ 17 - 2
blade-service/blade-los/src/main/java/org/springblade/los/finance/invoices/controller/FinInvoicesController.java

@@ -31,6 +31,7 @@ import org.springblade.core.mp.support.Query;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.los.business.sea.entity.Bills;
 import org.springblade.los.finance.invoices.entity.FinInvoices;
 import org.springblade.los.finance.invoices.service.IFinInvoicesService;
 import org.springblade.los.finance.invoices.vo.FinInvoicesVO;
@@ -74,12 +75,26 @@ public class FinInvoicesController extends BladeController {
 		LambdaQueryWrapper<FinInvoices> lambdaQueryWrapper = new LambdaQueryWrapper<>();
 		lambdaQueryWrapper.eq(FinInvoices::getTenantId, AuthUtil.getTenantId())
 			.eq(FinInvoices::getIsDeleted, 0)
-			.eq(ObjectUtils.isNotNull(finInvoices.getBillNo()), FinInvoices::getBillNo, finInvoices.getBillNo())
+			.like(ObjectUtils.isNotNull(finInvoices.getBillNo()), FinInvoices::getBillNo, finInvoices.getBillNo())
+			.and(ObjectUtils.isNotNull(finInvoices.getCorpCnName()), i -> i.like(FinInvoices::getCorpCnName, finInvoices.getCorpCnName()).or()
+				.like(FinInvoices::getCorpEnName, finInvoices.getCorpCnName()))
+			.and(ObjectUtils.isNotNull(finInvoices.getInvCorpCnName()), i -> i.like(FinInvoices::getInvCorpCnName, finInvoices.getInvCorpCnName()).or()
+				.like(FinInvoices::getInvCorpEnName, finInvoices.getInvCorpCnName()))
+			.like(ObjectUtils.isNotNull(finInvoices.getInvoiceNo()), FinInvoices::getInvoiceNo, finInvoices.getInvoiceNo())
+			.eq(ObjectUtils.isNotNull(finInvoices.getTaxType()), FinInvoices::getTaxType, finInvoices.getTaxType())
+			.like(ObjectUtils.isNotNull(finInvoices.getBusinessNo()), FinInvoices::getBusinessNo, finInvoices.getBusinessNo())
+			.like(ObjectUtils.isNotNull(finInvoices.getMblno()), FinInvoices::getMblno, finInvoices.getMblno())
+			.like(ObjectUtils.isNotNull(finInvoices.getHblno()), FinInvoices::getHblno, finInvoices.getHblno())
+			.like(ObjectUtils.isNotNull(finInvoices.getCheckNo()), FinInvoices::getCheckNo, finInvoices.getCheckNo())
+			.and(ObjectUtils.isNotNull(finInvoices.getVesselCnName()), i -> i.like(FinInvoices::getVesselCnName, finInvoices.getVesselCnName()).or()
+				.like(FinInvoices::getVesselEnName, finInvoices.getVesselCnName()))
+			.like(ObjectUtils.isNotNull(finInvoices.getVoyageNo()), FinInvoices::getVoyageNo, finInvoices.getVoyageNo())
 			.eq(ObjectUtils.isNotNull(finInvoices.getType()), FinInvoices::getType, finInvoices.getType())
 			.eq(ObjectUtils.isNotNull(finInvoices.getStatus()), FinInvoices::getStatus, finInvoices.getStatus())
-			.like(ObjectUtils.isNotNull(finInvoices.getMblno()), FinInvoices::getMblno, finInvoices.getMblno())
 			.like(ObjectUtils.isNotNull(finInvoices.getFeeCnName()), FinInvoices::getFeeCnName, finInvoices.getFeeCnName())
+			.like(ObjectUtils.isNotNull(finInvoices.getBookingNo()), FinInvoices::getBookingNo, finInvoices.getBookingNo())
 			.eq(ObjectUtils.isNotNull(finInvoices.getBillStatus()), FinInvoices::getBillStatus, finInvoices.getBillStatus())
+			.eq(ObjectUtils.isNotNull(finInvoices.getInvCurCode()), FinInvoices::getInvCurCode, finInvoices.getInvCurCode())
 			.ge(ObjectUtils.isNotNull(finInvoices.getInvoiceDateStart()), FinInvoices::getBillDate, finInvoices.getInvoiceDateStart())
 			.le(ObjectUtils.isNotNull(finInvoices.getInvoiceDateEnd()), FinInvoices::getBillDate, finInvoices.getInvoiceDateEnd())
 			.ge(ObjectUtils.isNotNull(finInvoices.getAccountDateFrom()), FinInvoices::getAccountDateFrom, finInvoices.getAccountDateFrom())

+ 7 - 1
blade-service/blade-los/src/main/java/org/springblade/los/finance/invoices/service/impl/FinInvoicesServiceImpl.java

@@ -48,6 +48,7 @@ import org.springblade.los.finance.invoices.service.IFinInvoiceItemDetailService
 import org.springblade.los.finance.invoices.service.IFinInvoicesItemsService;
 import org.springblade.los.finance.invoices.service.IFinInvoicesService;
 import org.springblade.los.finance.invoices.vo.FinInvoicesVO;
+import org.springblade.los.finance.stl.entity.FinStlBillsItems;
 import org.springblade.system.feign.ISysClient;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -289,7 +290,9 @@ public class FinInvoicesServiceImpl extends ServiceImpl<FinInvoicesMapper, FinIn
 			detail.setBusinessNo(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getBillNo).distinct().collect(Collectors.joining(",")));
 			detail.setMblno(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getMblno).distinct().collect(Collectors.joining(",")));
 			detail.setHblno(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getHblno).distinct().collect(Collectors.joining(",")));
-
+			detail.setFeeCnName(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getFeeCnName).distinct().collect(Collectors.joining(",")));
+			detail.setFeeEnName(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getFeeEnName).distinct().collect(Collectors.joining(",")));
+			detail.setFeeCode(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getFeeCode).distinct().collect(Collectors.joining(",")));
 			//明细状态修改  已开发票
 			List<FinAccBills> finAccBillsList = new ArrayList<>();
 			List<FeeCenter> feeCenterList = new ArrayList<>();
@@ -893,6 +896,9 @@ public class FinInvoicesServiceImpl extends ServiceImpl<FinInvoicesMapper, FinIn
 			detail.setBusinessNo(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getBillNo).distinct().collect(Collectors.joining(",")));
 			detail.setMblno(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getMblno).distinct().collect(Collectors.joining(",")));
 			detail.setHblno(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getHblno).distinct().collect(Collectors.joining(",")));
+			detail.setFeeCnName(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getFeeCnName).distinct().collect(Collectors.joining(",")));
+			detail.setFeeEnName(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getFeeEnName).distinct().collect(Collectors.joining(",")));
+			detail.setFeeCode(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getFeeCode).distinct().collect(Collectors.joining(",")));
 			for (FinInvoicesItems item : finInvoices.getFinInvoicesItemsList()) {
 				FinAccBills finAccBills = finAccBillsService.getById(item.getAccBillId());
 				if (finAccBills == null) {

+ 6 - 1
blade-service/blade-los/src/main/java/org/springblade/los/finance/stl/service/impl/FinStlBillsServiceImpl.java

@@ -972,7 +972,9 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 			detail.setMblno(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getMblno).distinct().collect(Collectors.joining(",")));
 			detail.setHblno(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getHblno).distinct().collect(Collectors.joining(",")));
 			detail.setInvoiceNo(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getInvoiceNo).distinct().collect(Collectors.joining(",")));
-
+			detail.setFeeCnName(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getFeeCnName).distinct().collect(Collectors.joining(",")));
+			detail.setFeeEnName(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getFeeEnName).distinct().collect(Collectors.joining(",")));
+			detail.setFeeCode(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getFeeCode).distinct().collect(Collectors.joining(",")));
 			List<Long> ids = finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getSrcIdInvoices).filter(Objects::nonNull).collect(Collectors.toList());
 			if (!ids.isEmpty()) {
 				if ("D".equals(finStlBills.getDc())) {
@@ -1806,6 +1808,9 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 			detail.setMblno(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getMblno).distinct().collect(Collectors.joining(",")));
 			detail.setHblno(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getHblno).distinct().collect(Collectors.joining(",")));
 			detail.setInvoiceNo(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getInvoiceNo).distinct().collect(Collectors.joining(",")));
+			detail.setFeeCnName(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getFeeCnName).distinct().collect(Collectors.joining(",")));
+			detail.setFeeEnName(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getFeeEnName).distinct().collect(Collectors.joining(",")));
+			detail.setFeeCode(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getFeeCode).distinct().collect(Collectors.joining(",")));
 
 			List<FeeCenter> feeCenterList = new ArrayList<>();
 			List<FinAccBills> finAccBillsList = new ArrayList<>();

+ 1 - 1
blade-service/blade-los/src/main/java/org/springblade/los/trade/controller/PayableStorageFeesController.java

@@ -83,7 +83,7 @@ public class PayableStorageFeesController extends BladeController {
 			.like(ObjectUtils.isNotNull(payableStorageFees.getWarehouseName()), PayableStorageFees::getWarehouseName, payableStorageFees.getWarehouseName())
 			.like(ObjectUtils.isNotNull(payableStorageFees.getStatus()), PayableStorageFees::getStatus, payableStorageFees.getStatus())
 			.orderByDesc(PayableStorageFees::getChargingEndDate);
-		IPage<PayableStorageFees> pages = payableStorageFeesService.page(Condition.getPage(query), Condition.getQueryWrapper(payableStorageFees));
+		IPage<PayableStorageFees> pages = payableStorageFeesService.page(Condition.getPage(query), lambdaQueryWrapper);
 		if (!pages.getRecords().isEmpty()) {
 			List<User> userList = userClient.userListGetByIds(pages.getRecords().stream().map(PayableStorageFees::getCreateUser).collect(Collectors.toList()));
 			for (PayableStorageFees item : pages.getRecords()) {

+ 6 - 7
blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/InOutStorageServiceImpl.java

@@ -866,7 +866,7 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 			.eq(InOutStorage::getTenantId, AuthUtil.getTenantId())
 			.eq(InOutStorage::getIsDeleted, 0)
 			.eq(InOutStorage::getBillType, "RK")
-			.eq(InOutStorage::getPid, pidList));
+			.in(InOutStorage::getPid, pidList));
 		List<FeeCenter> feeCenterList = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
 			.in(FeeCenter::getPid, pidList)
 			.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
@@ -879,15 +879,14 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 		if (!feeCenterList.isEmpty()) {
 			amount = feeCenterList.stream().map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
 		}
-		if (!feeCenterList.isEmpty()) {
+		if (!inOutStorageList.isEmpty()) {
 			surplusGoodsAmount = inOutStorageList.stream().map(InOutStorage::getSurplusGoodsAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
 		}
-		BigDecimal thisGoodsAmount = outGoodsAmount.multiply(inStorage.getPrice());
-		if (amount.compareTo(surplusGoodsAmount.subtract(thisGoodsAmount)) >= 0) {
+		if (amount.compareTo(surplusGoodsAmount.subtract(outGoodsAmount)) >= 0) {
 			map.put("status", true);
-			map.put("content", "客户未收金额:" + amount + "大于剩余货值:" + surplusGoodsAmount.subtract(thisGoodsAmount) + "(" +
-				(surplusGoodsAmount.subtract(thisGoodsAmount)).divide(surplusGoodsAmount, 2, RoundingMode.HALF_UP) + "%)" +
-				",本次出库货值:" + thisGoodsAmount + "(" + thisGoodsAmount.divide(surplusGoodsAmount, 2, RoundingMode.HALF_UP) + ")");
+			map.put("content", "客户未收金额:" + amount + "大于剩余货值:" + surplusGoodsAmount.subtract(outGoodsAmount) + "(" +
+				(surplusGoodsAmount.subtract(outGoodsAmount)).divide(surplusGoodsAmount, 2, RoundingMode.HALF_UP) + "%)" +
+				",本次出库货值:" + outGoodsAmount + "(" + outGoodsAmount.divide(surplusGoodsAmount, 2, RoundingMode.HALF_UP) + ")");
 			map.put("feeCenterList", feeCenterList);
 		} else {
 			map.put("status", false);

+ 47 - 8
blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/PayableStorageFeesServiceImpl.java

@@ -181,6 +181,9 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 				throw new RuntimeException("未找到到进口单据信息");
 			}
 			for (InOutStorage inOutStorage : inOutStorageList) {
+				if ("CK".equals(inOutStorage.getBillType()) && inOutStorage.getOutStorageDate().compareTo(inOutStorage.getChargingDate()) == 0) {
+					continue;
+				}
 				PayableStorageFeesItems storageFeesItems = new PayableStorageFeesItemsVO();
 				Bills bills = billsList.stream().filter(e -> e.getId().equals(inOutStorage.getPid())).findFirst().orElse(null);
 				if (bills == null) {
@@ -191,10 +194,17 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 				storageFeesItems.setBillType(inOutStorage.getBillType());
 				storageFeesItems.setContractNumber(bills.getBookingNo());
 				storageFeesItems.setBillNo(bills.getMblno());
-				storageFeesItems.setStorageDate(inOutStorage.getStorageDate());
-				storageFeesItems.setSurplusQuantity(inOutStorage.getSurplusQuantity());
-				storageFeesItems.setSurplusNetWeight(inOutStorage.getSurplusNetWeight());
-				storageFeesItems.setSurplusWeight(inOutStorage.getSurplusWeight());
+				if ("CK".equals(inOutStorage.getBillType())) {
+					storageFeesItems.setStorageDate(inOutStorage.getOutStorageDate());
+					storageFeesItems.setSurplusQuantity(inOutStorage.getOutQuantity());
+					storageFeesItems.setSurplusNetWeight(inOutStorage.getOutNetWeight());
+					storageFeesItems.setSurplusWeight(inOutStorage.getOutWeight());
+				} else {
+					storageFeesItems.setStorageDate(inOutStorage.getStorageDate());
+					storageFeesItems.setSurplusQuantity(inOutStorage.getSurplusQuantity());
+					storageFeesItems.setSurplusNetWeight(inOutStorage.getSurplusNetWeight());
+					storageFeesItems.setSurplusWeight(inOutStorage.getSurplusWeight());
+				}
 				storageFeesItems.setFeeId(fees.getId());
 				storageFeesItems.setFeeCode(fees.getCode());
 				storageFeesItems.setFeeCnName(fees.getCnName());
@@ -210,9 +220,9 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 					} else {
 						dateEnd = payableStorageFees.getChargingEndDate();
 					}
-					if (inOutStorage.getChargingDate().compareTo(inOutStorage.getOutStorageDate()) != 0) {
+				/*	if (inOutStorage.getChargingDate().compareTo(inOutStorage.getOutStorageDate()) != 0) {
 						inOutStorage.setChargingDate(calendar.getTime());
-					}
+					}*/
 					diff = dateEnd.getTime() - inOutStorage.getChargingDate().getTime();
 				} else {
 					if (new BigDecimal("0.00").compareTo(inOutStorage.getSurplusQuantity()) == 0) {
@@ -236,9 +246,17 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 				BigDecimal weight;
 				BigDecimal amountSum;
 				if (billingRules) {
-					weight = inOutStorage.getSurplusNetWeight().divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+					if ("CK".equals(inOutStorage.getBillType())) {
+						weight = inOutStorage.getOutNetWeight().divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+					} else {
+						weight = inOutStorage.getSurplusNetWeight().divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+					}
 				} else {
-					weight = inOutStorage.getSurplusWeight().divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+					if ("CK".equals(inOutStorage.getBillType())) {
+						weight = inOutStorage.getOutWeight().divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+					} else {
+						weight = inOutStorage.getSurplusWeight().divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+					}
 				}
 				BigDecimal dayDecimal = new BigDecimal(day);
 				amountSum = dayDecimal.multiply(storageFeeItems.getPriceC()).multiply(weight);
@@ -254,6 +272,15 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public R confirmSettlement(PayableStorageFees payableStorageFees) {
+		List<PayableStorageFees> lastFeesList = baseMapper.selectList(new LambdaQueryWrapper<PayableStorageFees>()
+			.eq(PayableStorageFees::getTenantId, AuthUtil.getTenantId())
+			.eq(PayableStorageFees::getIsDeleted, 0)
+			.eq(PayableStorageFees::getWarehouseId, payableStorageFees.getWarehouseId())
+			.eq(PayableStorageFees::getStatus, "录入")
+			.ne(PayableStorageFees::getId, payableStorageFees.getId()));
+		if (!lastFeesList.isEmpty()) {
+			throw new RuntimeException("操作失败,为了仓储费计算精准,每个仓库只允许存在一个录入单据。");
+		}
 		if (payableStorageFees.getStorageFeesItemsList().isEmpty()) {
 			throw new RuntimeException("明细不能为空");
 		}
@@ -550,6 +577,18 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public R revokeSettlement(PayableStorageFees payableStorageFees) {
+		List<PayableStorageFees> lastFeesList = baseMapper.selectList(new LambdaQueryWrapper<PayableStorageFees>()
+			.eq(PayableStorageFees::getTenantId, AuthUtil.getTenantId())
+			.eq(PayableStorageFees::getIsDeleted, 0)
+			.eq(PayableStorageFees::getWarehouseId, payableStorageFees.getWarehouseId())
+			.ne(PayableStorageFees::getId, payableStorageFees.getId()));
+		if (!lastFeesList.isEmpty()) {
+			for (PayableStorageFees item : lastFeesList) {
+				if (payableStorageFees.getChargingEndDate().compareTo(item.getChargingEndDate()) < 0) {
+					throw new RuntimeException("撤销失败,请按仓储费计费截止时间操作");
+				}
+			}
+		}
 		if (payableStorageFees.getStorageFeesItemsList().isEmpty()) {
 			throw new RuntimeException("明细不能为空");
 		}

+ 12 - 2
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/ship/service/impl/ShipServiceImpl.java

@@ -963,6 +963,11 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				if (new BigDecimal("0.00").compareTo(sendNumFinancing) != 0) {
 					String firstProportion = sysClient.getParamService("first.month.proportion");
 					String secondProportion = sysClient.getParamService("second.month.proportion");
+					String financingDays = sysClient.getParamService("financing.days");
+					int days = -90;
+					if(ObjectUtils.isNotNull(financingDays) && !"获取数据失败".equals(financingDays)){
+						days = -Integer.parseInt(financingDays);
+					}
 					PjpfFunding pjpfFunding = pjpfFundingService.getOne(new LambdaQueryWrapper<PjpfFunding>()
 						.eq(PjpfFunding::getTenantId, AuthUtil.getTenantId())
 						.eq(PjpfFunding::getIsDeleted, 0));
@@ -972,7 +977,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 					Date date = new Date();
 					Calendar calendarDate = Calendar.getInstance();
 					calendarDate.setTime(date);
-					calendarDate.add(Calendar.DAY_OF_MONTH, -90);
+					calendarDate.add(Calendar.DAY_OF_MONTH, days);
 					Date dateTime = calendarDate.getTime();
 					//获取融资采购单主表数据
 					List<PjOrder> orderList = orderMapper.selectList(new LambdaQueryWrapper<PjOrder>()
@@ -3892,6 +3897,11 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 		if (ObjectUtils.isNotNull(status) && "1".equals(status) && "1".equals(storageDesc.getWhetherFinancing())) {
 			String firstProportion = sysClient.getParamService("first.month.proportion");
 			String secondProportion = sysClient.getParamService("second.month.proportion");
+			String financingDays = sysClient.getParamService("financing.days");
+			int days = -90;
+			if(ObjectUtils.isNotNull(financingDays) && !"获取数据失败".equals(financingDays)){
+				days = -Integer.parseInt(financingDays);
+			}
 			PjpfFunding pjpfFunding = pjpfFundingService.getOne(new LambdaQueryWrapper<PjpfFunding>()
 				.eq(PjpfFunding::getTenantId, AuthUtil.getTenantId())
 				.eq(PjpfFunding::getIsDeleted, 0));
@@ -3901,7 +3911,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 			Date date = new Date();
 			Calendar calendarDate = Calendar.getInstance();
 			calendarDate.setTime(date);
-			calendarDate.add(Calendar.DAY_OF_MONTH, -90);
+			calendarDate.add(Calendar.DAY_OF_MONTH, days);
 			Date dateTime = calendarDate.getTime();
 			//获取融资采购单主表数据
 			List<PjOrder> orderList = orderMapper.selectList(new LambdaQueryWrapper<PjOrder>()