Browse Source

2025年3月5日17:07:43

纪新园 9 months ago
parent
commit
1258533b4b
21 changed files with 808 additions and 101 deletions
  1. 16 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/check/entity/LosAuditProecess.java
  2. 164 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/InOutStorageStatistics.java
  3. 2 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/PayableStorageFees.java
  4. 18 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/PayableStorageFeesItems.java
  5. 40 31
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/controller/BillsController.java
  6. 3 0
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/BillsServiceImpl.java
  7. 6 11
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/TemplateImportServiceImpl.java
  8. 3 0
      blade-service/blade-los/src/main/java/org/springblade/los/check/controller/AuditProecessController.java
  9. 3 1
      blade-service/blade-los/src/main/java/org/springblade/los/check/service/impl/AuditProecessServiceImpl.java
  10. 4 3
      blade-service/blade-los/src/main/java/org/springblade/los/finance/stl/service/impl/FinStlBillsServiceImpl.java
  11. 85 0
      blade-service/blade-los/src/main/java/org/springblade/los/trade/controller/InventoryAccountStatisticsController.java
  12. 16 0
      blade-service/blade-los/src/main/java/org/springblade/los/trade/controller/PayableStorageFeesController.java
  13. 5 0
      blade-service/blade-los/src/main/java/org/springblade/los/trade/mapper/InOutStorageMapper.java
  14. 116 0
      blade-service/blade-los/src/main/java/org/springblade/los/trade/mapper/InOutStorageMapper.xml
  15. 8 0
      blade-service/blade-los/src/main/java/org/springblade/los/trade/service/IInOutStorageService.java
  16. 4 0
      blade-service/blade-los/src/main/java/org/springblade/los/trade/service/IPayableStorageFeesService.java
  17. 83 8
      blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/InOutStorageServiceImpl.java
  18. 173 2
      blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/PayableStorageFeesServiceImpl.java
  19. 2 2
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/statistics/service/impl/StatisticsServiceImpl.java
  20. 37 37
      blade-service/blade-sales-part/src/main/resources/log/logback-dev.xml
  21. 20 6
      blade-service/trade-finance/src/main/java/org/springblade/finance/service/impl/SettlementServiceImpl.java

+ 16 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/check/entity/LosAuditProecess.java

@@ -342,5 +342,21 @@ public class LosAuditProecess implements Serializable {
 	@TableField(exist = false)
 	private long level;
 
+	/**
+	 * 来源 id
+	 */
+	@ApiModelProperty(value = "来源 id")
+	private Long srcId;
+	/**
+	 * 来源中文
+	 */
+	@ApiModelProperty(value = "来源中文")
+	private String srcCnName;
+	/**
+	 * 来源英文
+	 */
+	@ApiModelProperty(value = "来源英文")
+	private String srcEnName;
+
 
 }

+ 164 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/InOutStorageStatistics.java

@@ -0,0 +1,164 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.trade.entity;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 贸易代理-出入库明细表实体类
+ *
+ * @author BladeX
+ * @since 2024-07-12
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class InOutStorageStatistics implements Serializable {
+
+
+	/**
+	 * 提单号
+	 */
+	@ExcelProperty(value = "提单号")
+	private String mblNo;
+
+	/**
+	 * 合同号
+	 */
+	@ExcelProperty(value = "合同号")
+	private String contractNo;
+
+	/**
+	 * 委托编号
+	 */
+	@ExcelProperty(value = "委托编号")
+	private String billNo;
+
+	/**
+	 * 箱号
+	 */
+	@ExcelProperty(value = "箱号")
+	private String boxNo;
+
+	/**
+	 * 客户名
+	 */
+	@ExcelProperty(value = "客户名")
+	private String corpName;
+
+	/**
+	 * 入库时间
+	 */
+	@ExcelProperty(value = "入库时间")
+	private Date storageDate;
+
+	/**
+	 * 货物名称
+	 */
+	@ExcelProperty(value = "货物名称")
+	private String goodsName;
+
+	/**
+	 * 仓库
+	 */
+	@ExcelProperty(value = "仓库")
+	private String warehouseName;
+
+	/**
+	 * 件数
+	 */
+	@ExcelProperty(value = "入库件数")
+	private BigDecimal quantity;
+	/**
+	 * 毛重
+	 */
+	@ExcelProperty(value = "入库毛重")
+	private BigDecimal grossWeight;
+	/**
+	 * 净重 (KGM)
+	 */
+	@ExcelProperty(value = "入库净重")
+	private BigDecimal netWeight;
+
+	/**
+	 * 出库件数
+	 */
+	@ExcelProperty(value = "出库件数")
+	private BigDecimal outQuantity;
+	/**
+	 * 出库毛重
+	 */
+	@ExcelProperty(value = "出库毛重")
+	private BigDecimal outWeight;
+	/**
+	 * 出库净重
+	 */
+	@ExcelProperty(value = "出库净重")
+	private BigDecimal outNetWeight;
+
+	/**
+	 * 剩余件数
+	 */
+	@ExcelProperty(value = "结余件数")
+	private BigDecimal surplusQuantity;
+	/**
+	 * 剩余毛重
+	 */
+	@ExcelProperty(value = "结余毛重")
+	private BigDecimal surplusWeight;
+	/**
+	 * 剩余净重
+	 */
+	@ExcelProperty(value = "结余净重")
+	private BigDecimal surplusNetWeight;
+	/**
+	 * 剩余货值
+	 */
+	@ExcelProperty(value = "结余金额")
+	private BigDecimal surplusGoodsAmount;
+
+	/**
+	 * 备注
+	 */
+	@ExcelProperty(value = "备注")
+	private String remarks;
+
+	@ExcelIgnore
+	private Long corpId;
+
+	@ExcelIgnore
+	private Long warehouseId;
+
+	@ExcelIgnore
+	private String inventory;
+
+
+
+
+}

+ 2 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/PayableStorageFees.java

@@ -98,6 +98,8 @@ public class PayableStorageFees implements Serializable {
 	private BigDecimal amount;
 	@ApiModelProperty(value = "租户")
 	private String tenantId;
+	@ApiModelProperty(value = "状态")
+	private String status;
 
 	/**
 	 * 仓储费明细

+ 18 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/PayableStorageFeesItems.java

@@ -150,5 +150,23 @@ public class PayableStorageFeesItems implements Serializable {
 	@ApiModelProperty(value = "费用英文名称")
 	private String feeEnName;
 
+	/**
+	 * 来源出入库id
+	 */
+	@ApiModelProperty(value = "来源出入库id")
+	private Long itemId;
+
+	/**
+	 * 入库/出库类型
+	 */
+	@ApiModelProperty(value = "入库/出库类型")
+	private String billType;
+
+	/**
+	 * 单价
+	 */
+	@ApiModelProperty(value = "单价")
+	private BigDecimal price;
+
 
 }

+ 40 - 31
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/controller/BillsController.java

@@ -101,16 +101,16 @@ public class BillsController extends BladeController {
 			Bills::getMeasurement, Bills::getQuantityV20, Bills::getQuantityV40, Bills::getQuantityV40hc, Bills::getQuantityV45,
 			Bills::getQuantityV48, Bills::getIsNeedLand, Bills::getIsNeedDeclare, Bills::getIsNeedIq, Bills::getAmountDr,
 			Bills::getAmountCr, Bills::getAmountProfit, Bills::getAmountDrUsd, Bills::getAmountCrUsd, Bills::getAmountProfitUsd,
-			Bills::getCheckCrStatus, Bills::getCheckDrStatus, Bills::getStlCrStatus, Bills::getStlDrStatus, Bills::getInvoiceCrStatus,Bills::getInvoiceDrStatus,
+			Bills::getCheckCrStatus, Bills::getCheckDrStatus, Bills::getStlCrStatus, Bills::getStlDrStatus, Bills::getInvoiceCrStatus, Bills::getInvoiceDrStatus,
 			Bills::getAmountDrLoc, Bills::getAmountCrLoc, Bills::getAmountProfitLoc, Bills::getCheckCrStatusDescr, Bills::getCheckDrStatusDescr,
 			Bills::getStlCrStatusDescr, Bills::getStlDrStatusDescr, Bills::getInvoiceCrStatusDescr, Bills::getInvoiceDrStatusDescr, Bills::getCreateUserName,
 			Bills::getCreateTime, Bills::getUpdateUserName, Bills::getUpdateTime, Bills::getStatus, Bills::getBillStatus,
 			Bills::getAccountStatus, Bills::getRemarks, Bills::getPackingUnit, Bills::getBillDate, Bills::getTeamName,
 			Bills::getCreateUser, Bills::getTeu, Bills::getIssueType, Bills::getBookingNo, Bills::getQuantityCntrDescr,
 			Bills::getCreateDeptName, Bills::getLineCnName, Bills::getCarrierCnName, Bills::getCyCnName, Bills::getSrcType,
-			Bills::getSrcCnName, Bills::getBookingAgentCnName, Bills::getPodCnName, Bills::getPolCnName,Bills::getCorpSource,
-			Bills::getVesselEnName,Bills::getCarrierShortName,Bills::getCarrierEnName,Bills::getCyShortName,Bills::getCyEnName,Bills::getMpaymode,Bills::getHpaymode,
-			Bills::getShortName,Bills::getPlaceDeliveryName,Bills::getDestinationName);
+			Bills::getSrcCnName, Bills::getBookingAgentCnName, Bills::getPodCnName, Bills::getPolCnName, Bills::getCorpSource,
+			Bills::getVesselEnName, Bills::getCarrierShortName, Bills::getCarrierEnName, Bills::getCyShortName, Bills::getCyEnName, Bills::getMpaymode, Bills::getHpaymode,
+			Bills::getShortName, Bills::getPlaceDeliveryName, Bills::getDestinationName);
 		lambdaQueryWrapper.eq(Bills::getIsDeleted, 0)
 			.eq(Bills::getTenantId, AuthUtil.getTenantId())
 			.and(i -> i.isNull(Bills::getMasterId).or()
@@ -149,6 +149,15 @@ public class BillsController extends BladeController {
 		}
 		String jurisdiction = sysClient.getParamService("data.jurisdiction");
 		if ("1".equals(jurisdiction)) {
+			lambdaQueryWrapper.eq(ObjectUtils.isNotNull(bills.getSrcType()), Bills::getSrcType, bills.getSrcType())
+				.and(ObjectUtils.isNotNull(bills.getSrcCnName()), i -> i.like(Bills::getSrcCnName, bills.getSrcCnName()).or()
+					.like(Bills::getSrcEnName, bills.getSrcCnName()));
+			if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("财务")) {
+				lambdaQueryWrapper.apply("find_in_set(team_id,'" + AuthUtil.getPostId() + "')");
+			}
+			if (!AuthUtil.getUserRole().contains("admin")) {
+				lambdaQueryWrapper.eq(Bills::getBranchId, deptUtils.getDeptPid());
+			}
 			if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("老板")
 				&& !AuthUtil.getUserRole().contains("副总") && !AuthUtil.getUserRole().contains("财务")
 				&& !AuthUtil.getUserRole().contains("经理")) {
@@ -192,32 +201,32 @@ public class BillsController extends BladeController {
 			.eq(ObjectUtils.isNotNull(bills.getAccountStatus()), Bills::getAccountStatus, bills.getAccountStatus())
 			.eq(ObjectUtils.isNotNull(bills.getStatus()), Bills::getStatus, bills.getStatus());
 		if ("SE".equals(bills.getBusinessType())) {
-			if ("1".equals(bills.getBillSort())){
+			if ("1".equals(bills.getBillSort())) {
 				lambdaQueryWrapper.orderByDesc(Bills::getEtd);
-			}else if ("2".equals(bills.getBillSort())){
+			} else if ("2".equals(bills.getBillSort())) {
 				lambdaQueryWrapper.orderByDesc(Bills::getMblno);
-			}else{
+			} else {
 				lambdaQueryWrapper.orderByDesc(Bills::getEtd);
 			}
 		} else {
-			if ("1".equals(bills.getBillSort())){
+			if ("1".equals(bills.getBillSort())) {
 				lambdaQueryWrapper.orderByDesc(Bills::getEta);
-			}else if ("2".equals(bills.getBillSort())){
+			} else if ("2".equals(bills.getBillSort())) {
 				lambdaQueryWrapper.orderByDesc(Bills::getMblno);
-			}else{
+			} else {
 				lambdaQueryWrapper.orderByDesc(Bills::getEta);
 			}
 		}
 		IPage<Bills> pages = billsService.page(Condition.getPage(query), lambdaQueryWrapper);
-		if (!pages.getRecords().isEmpty()){
+		if (!pages.getRecords().isEmpty()) {
 			List<Long> ids = pages.getRecords().stream().map(Bills::getId).collect(Collectors.toList());
 			List<SeaBillsDetail> seaBillsDetailList = seaBillsDetailService.list(new LambdaQueryWrapper<SeaBillsDetail>()
-				.eq(SeaBillsDetail::getTenantId,AuthUtil.getTenantId())
-				.in(SeaBillsDetail::getPid,ids));
-			for (Bills item : pages.getRecords()){
-				if (!seaBillsDetailList.isEmpty()){
-					SeaBillsDetail seaBillsDetail = seaBillsDetailList.stream().filter(e-> e.getPid().equals(item.getId())).findFirst().orElse(null);
-					if (seaBillsDetail != null){
+				.eq(SeaBillsDetail::getTenantId, AuthUtil.getTenantId())
+				.in(SeaBillsDetail::getPid, ids));
+			for (Bills item : pages.getRecords()) {
+				if (!seaBillsDetailList.isEmpty()) {
+					SeaBillsDetail seaBillsDetail = seaBillsDetailList.stream().filter(e -> e.getPid().equals(item.getId())).findFirst().orElse(null);
+					if (seaBillsDetail != null) {
 						item.setHconsigneeCnName(seaBillsDetail.getHconsigneeCnName());
 						item.setMconsigneeCntyCode(seaBillsDetail.getMconsigneeCntyCode());
 						item.setHshipperCnName(seaBillsDetail.getHshipperCnName());
@@ -319,19 +328,19 @@ public class BillsController extends BladeController {
 			.eq(ObjectUtils.isNotNull(bills.getMasterId()), Bills::getMasterId, bills.getMasterId())
 			.eq(ObjectUtils.isNotNull(bills.getBillStatus()), Bills::getBillStatus, bills.getBillStatus());
 		if ("SE".equals(bills.getBusinessType())) {
-			if ("1".equals(bills.getBillSort())){
+			if ("1".equals(bills.getBillSort())) {
 				lambdaQueryWrapper.orderByDesc(Bills::getEtd);
-			}else if ("2".equals(bills.getBillSort())){
+			} else if ("2".equals(bills.getBillSort())) {
 				lambdaQueryWrapper.orderByDesc(Bills::getMblno);
-			}else{
+			} else {
 				lambdaQueryWrapper.orderByDesc(Bills::getEtd);
 			}
 		} else {
-			if ("1".equals(bills.getBillSort())){
+			if ("1".equals(bills.getBillSort())) {
 				lambdaQueryWrapper.orderByDesc(Bills::getEta);
-			}else if ("2".equals(bills.getBillSort())){
+			} else if ("2".equals(bills.getBillSort())) {
 				lambdaQueryWrapper.orderByDesc(Bills::getMblno);
-			}else{
+			} else {
 				lambdaQueryWrapper.orderByDesc(Bills::getEta);
 			}
 		}
@@ -454,7 +463,7 @@ public class BillsController extends BladeController {
 	 */
 	@GetMapping("/removeHblNo")
 	@RepeatSubmit
-	public R removeHblNo( @RequestParam("id") Long id) {
+	public R removeHblNo(@RequestParam("id") Long id) {
 		billsService.removeHblNo(id);
 		return R.data("操作成功");
 	}
@@ -591,16 +600,16 @@ public class BillsController extends BladeController {
 			Bills::getMeasurement, Bills::getQuantityV20, Bills::getQuantityV40, Bills::getQuantityV40hc, Bills::getQuantityV45,
 			Bills::getQuantityV48, Bills::getIsNeedLand, Bills::getIsNeedDeclare, Bills::getIsNeedIq, Bills::getAmountDr,
 			Bills::getAmountCr, Bills::getAmountProfit, Bills::getAmountDrUsd, Bills::getAmountCrUsd, Bills::getAmountProfitUsd,
-			Bills::getCheckCrStatus, Bills::getCheckDrStatus, Bills::getStlCrStatus, Bills::getStlDrStatus, Bills::getInvoiceCrStatus,Bills::getInvoiceDrStatus,
+			Bills::getCheckCrStatus, Bills::getCheckDrStatus, Bills::getStlCrStatus, Bills::getStlDrStatus, Bills::getInvoiceCrStatus, Bills::getInvoiceDrStatus,
 			Bills::getAmountDrLoc, Bills::getAmountCrLoc, Bills::getAmountProfitLoc, Bills::getCheckCrStatusDescr, Bills::getCheckDrStatusDescr,
 			Bills::getStlCrStatusDescr, Bills::getStlDrStatusDescr, Bills::getInvoiceCrStatusDescr, Bills::getInvoiceDrStatusDescr, Bills::getCreateUserName,
 			Bills::getCreateTime, Bills::getUpdateUserName, Bills::getUpdateTime, Bills::getStatus, Bills::getBillStatus,
 			Bills::getAccountStatus, Bills::getRemarks, Bills::getPackingUnit, Bills::getBillDate, Bills::getTeamName,
 			Bills::getCreateUser, Bills::getTeu, Bills::getIssueType, Bills::getBookingNo, Bills::getQuantityCntrDescr,
 			Bills::getCreateDeptName, Bills::getLineCnName, Bills::getCarrierCnName, Bills::getCyCnName, Bills::getSrcType,
-			Bills::getSrcCnName, Bills::getBookingAgentCnName, Bills::getPodCnName, Bills::getPolCnName,Bills::getCorpSource,
-			Bills::getVesselEnName,Bills::getCarrierEnName,Bills::getCyEnName,Bills::getMpaymode,Bills::getHpaymode,
-			Bills::getShortName,Bills::getPlaceDeliveryName,Bills::getDestinationName);
+			Bills::getSrcCnName, Bills::getBookingAgentCnName, Bills::getPodCnName, Bills::getPolCnName, Bills::getCorpSource,
+			Bills::getVesselEnName, Bills::getCarrierEnName, Bills::getCyEnName, Bills::getMpaymode, Bills::getHpaymode,
+			Bills::getShortName, Bills::getPlaceDeliveryName, Bills::getDestinationName);
 		lambdaQueryWrapper.eq(Bills::getIsDeleted, 0)
 			.eq(Bills::getTenantId, AuthUtil.getTenantId())
 			.and(i -> i.isNull(Bills::getMasterId).or()
@@ -669,9 +678,9 @@ public class BillsController extends BladeController {
 				.eq(SeaBillsDetail::getTenantId, AuthUtil.getTenantId())
 				.in(SeaBillsDetail::getPid, ids));
 			for (Bills item : list) {
-				if (!seaBillsDetailList.isEmpty()){
-					SeaBillsDetail seaBillsDetail = seaBillsDetailList.stream().filter(e-> e.getPid().equals(item.getId())).findFirst().orElse(null);
-					if (seaBillsDetail != null){
+				if (!seaBillsDetailList.isEmpty()) {
+					SeaBillsDetail seaBillsDetail = seaBillsDetailList.stream().filter(e -> e.getPid().equals(item.getId())).findFirst().orElse(null);
+					if (seaBillsDetail != null) {
 						item.setHconsigneeCnName(seaBillsDetail.getHconsigneeCnName());
 					}
 				}

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

@@ -1409,6 +1409,9 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 			auditProecessDTO.setGrossProfitUsd(amountUsdD.subtract(amountUsdC));
 			auditProecessDTO.setGrossProfitLoc(auditProecessDTO.getGrossProfit().add(bCurrencyService.converterCny("USD", auditProecessDTO.getGrossProfitUsd(), "", "1")));
 			auditProecessDTO.setSalesCompanyName(declare.getCreateDeptName());
+			auditProecessDTO.setSrcId(declare.getSrcId());
+			auditProecessDTO.setSrcCnName(declare.getSrcCnName());
+			auditProecessDTO.setSrcEnName(declare.getSrcEnName());
 			R financeProcess = auditProecessService.createFinanceProcess(auditProecessDTO);
 			if (!financeProcess.isSuccess()) {
 				throw new SecurityException("操作失败,请联系管理员");

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

@@ -5,11 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.sun.org.apache.xpath.internal.operations.Bool;
 import lombok.AllArgsConstructor;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.ss.usermodel.CellType;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
@@ -223,10 +219,9 @@ public class TemplateImportServiceImpl implements ITemplateImportService {
 		Path tempFile = Files.createTempFile("prefix", "suffix");
 		// 将MultipartFile的内容复制到临时文件
 		Files.copy(file.getInputStream(), tempFile, StandardCopyOption.REPLACE_EXISTING);
-
 		// 创建FileInputStream来读取临时文件
 		FileInputStream fis = new FileInputStream(tempFile.toFile());
-		Workbook workbook = new HSSFWorkbook(fis);
+		Workbook workbook = WorkbookFactory.create(fis);
 		Sheet sheet = workbook.getSheetAt(0); // 获取第一个工作表
 
 		String stringCellValue = "";
@@ -531,7 +526,7 @@ public class TemplateImportServiceImpl implements ITemplateImportService {
 
 		// 创建FileInputStream来读取临时文件
 		FileInputStream fis = new FileInputStream(tempFile.toFile());
-		Workbook workbook = new HSSFWorkbook(fis);
+		Workbook workbook = WorkbookFactory.create(fis);
 		Sheet sheet = workbook.getSheetAt(0); // 获取第一个工作表
 
 		//SHIPPER
@@ -798,7 +793,7 @@ public class TemplateImportServiceImpl implements ITemplateImportService {
 
 		// 创建FileInputStream来读取临时文件
 		FileInputStream fis = new FileInputStream(tempFile.toFile());
-		Workbook workbook = new HSSFWorkbook(fis);
+		Workbook workbook = WorkbookFactory.create(fis);
 		Sheet sheet = workbook.getSheetAt(0); // 获取第一个工作表
 
 		//SHIPPER
@@ -1066,7 +1061,7 @@ public class TemplateImportServiceImpl implements ITemplateImportService {
 
 		// 创建FileInputStream来读取临时文件
 		FileInputStream fis = new FileInputStream(tempFile.toFile());
-		Workbook workbook = new HSSFWorkbook(fis);
+		Workbook workbook = WorkbookFactory.create(fis);
 		Sheet sheet = workbook.getSheetAt(0); // 获取第一个工作表
 
 		String header = getSheetCellValueAsString(sheet, 0, 0);
@@ -1265,7 +1260,7 @@ public class TemplateImportServiceImpl implements ITemplateImportService {
 
 		// 创建FileInputStream来读取临时文件
 		FileInputStream fis = new FileInputStream(tempFile.toFile());
-		Workbook workbook = new XSSFWorkbook(fis);
+		Workbook workbook = WorkbookFactory.create(fis);
 		Sheet sheet = workbook.getSheetAt(0); // 获取第一个工作表
 
 		for (int i = 1; i <= sheet.getLastRowNum(); i++) {

+ 3 - 0
blade-service/blade-los/src/main/java/org/springblade/los/check/controller/AuditProecessController.java

@@ -38,6 +38,7 @@ import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.los.Util.IDeptUtils;
 import org.springblade.los.basic.corps.entity.BCorps;
 import org.springblade.los.basic.corps.service.IBCorpsService;
+import org.springblade.los.business.sea.entity.Bills;
 import org.springblade.los.check.dto.LosAuditProecessDTO;
 import org.springblade.los.check.entity.LosAuditProecess;
 import org.springblade.los.check.service.IAuditProecessService;
@@ -93,6 +94,8 @@ public class AuditProecessController extends BladeController {
 			lambdaQueryWrapper.ge(LosAuditProecess::getBillTime, auditProecess.getBillTimeList().get(0));
 			lambdaQueryWrapper.le(LosAuditProecess::getBillTime, auditProecess.getBillTimeList().get(1));
 		}
+		lambdaQueryWrapper.and(ObjectUtils.isNotNull(auditProecess.getSrcCnName()), i -> i.like(LosAuditProecess::getSrcCnName,
+				auditProecess.getSrcCnName()).or().like(LosAuditProecess::getSrcEnName, auditProecess.getSrcCnName()));
 		lambdaQueryWrapper.ne(StringUtils.isBlank(auditProecess.getAuditStatus()), LosAuditProecess::getAuditStatus, "N");
 		if (!AuthUtil.getUserRole().contains("admin")) {
 			lambdaQueryWrapper.eq(LosAuditProecess::getSalesCompanyId, deptUtils.getDeptPid());//公司

+ 3 - 1
blade-service/blade-los/src/main/java/org/springblade/los/check/service/impl/AuditProecessServiceImpl.java

@@ -201,11 +201,13 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
 			auditProecess.setStorage(auditProecessDTO.getStorage());
 			auditProecess.setSalesCompanyId(auditProecessDTO.getSalesCompanyId());
 			auditProecess.setSalesCompanyName(auditProecessDTO.getSalesCompanyName());
-
 			auditProecess.setPayAmount(auditProecessDTO.getPayAmount());
 			auditProecess.setReceivableAmount(auditProecessDTO.getReceivableAmount());
 			auditProecess.setGrossProfit(auditProecessDTO.getGrossProfitLoc());
 			auditProecess.setReferenceNumber(auditProecessDTO.getReferenceNumber());
+			auditProecess.setSrcId(auditProecessDTO.getSrcId());
+			auditProecess.setSrcCnName(auditProecessDTO.getSrcCnName());
+			auditProecess.setSrcEnName(auditProecessDTO.getSrcEnName());
 			//除了第一级是待审,其他都N
 			if (e.getLevelId() == 1) {
 				SimpleDateFormat simpleDateFormat = new SimpleDateFormat();

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

@@ -449,7 +449,7 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 			finStlBillsItemsService.saveOrUpdateBatch(finStlBills.getFinStlBillsItemsList());
 			feeCenterService.saveOrUpdateBatch(feeCenterList);
 			finAccBillsService.saveOrUpdateBatch(finAccBillsList);
-			updateBillsStatus(finStlBills.getFinStlBillsItemsList(), 1, null);
+			updateBillsStatus(finStlBills.getFinStlBillsItemsList(), 1, feeCenterList);
 		} else {
 			throw new RuntimeException("请选择明细");
 		}
@@ -924,7 +924,7 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 			finStlBillsItemsService.saveOrUpdateBatch(finStlBills.getFinStlBillsItemsList());
 			feeCenterService.saveOrUpdateBatch(feeCenterList);
 			finAccBillsService.saveOrUpdateBatch(finAccBillsList);
-			updateBillsStatus(finStlBills.getFinStlBillsItemsList(), 1, null);
+			updateBillsStatus(finStlBills.getFinStlBillsItemsList(), 1, feeCenterList);
 		} else {
 			throw new RuntimeException("请选择明细");
 		}
@@ -1083,7 +1083,8 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 						finAccBills.getAmountDrUsd().compareTo(finAccBills.getStlAmountDrUsd()) == 0) {
 						status = true;
 					}
-				} else if ("C".equals(item.getDc())) {
+				}
+				else if ("C".equals(item.getDc())) {
 					if (finAccBills.getStlAmountCr().compareTo(finAccBills.getAmountCr()) > 0 ||
 						finAccBills.getStlAmountCrUsd().compareTo(finAccBills.getAmountCrUsd()) > 0
 					) {

+ 85 - 0
blade-service/blade-los/src/main/java/org/springblade/los/trade/controller/InventoryAccountStatisticsController.java

@@ -0,0 +1,85 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.trade.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.common.annotation.RepeatSubmit;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.excel.util.ExcelUtil;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+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.excel.BCountrysExcel;
+import org.springblade.los.trade.entity.InOutStorage;
+import org.springblade.los.trade.entity.InOutStorageStatistics;
+import org.springblade.los.trade.service.IInOutStorageService;
+import org.springblade.los.trade.vo.InOutStorageVO;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 库存账统计 控制器
+ *
+ * @author BladeX
+ * @since 2024-07-12
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/inventoryAccountStatistics")
+@Api(value = "库存账统计", tags = "库存账统计接口")
+public class InventoryAccountStatisticsController extends BladeController {
+
+	private final IInOutStorageService inOutStorageService;
+
+	/**
+	 * 合计
+	 */
+	@GetMapping("/sum")
+	public R sum(InOutStorageStatistics outStorageStatistics) {
+		return inOutStorageService.inventoryAccountStatisticsSum(outStorageStatistics);
+	}
+
+	/**
+	 * 列表
+	 */
+	@GetMapping("/list")
+	public R<IPage<InOutStorageStatistics>> list(InOutStorageStatistics outStorageStatistics, Query query) {
+		return inOutStorageService.inventoryAccountStatisticsPage(outStorageStatistics,Condition.getPage(query));
+	}
+
+	/**
+	 * 导出
+	 */
+	@GetMapping("/export")
+	public void export(InOutStorageStatistics outStorageStatistics, HttpServletResponse response) {
+		List<InOutStorageStatistics> inOutStorageStatistics = inOutStorageService.export(outStorageStatistics);
+		ExcelUtil.export(response, "库存账统计", "库存账统计", inOutStorageStatistics, InOutStorageStatistics.class);
+	}
+
+
+}

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

@@ -142,5 +142,21 @@ public class PayableStorageFeesController extends BladeController {
 		return payableStorageFeesService.calculateStorageFees(payableStorageFees);
 	}
 
+	/**
+	 * 确认结算仓储费
+	 */
+	@PostMapping("/confirmSettlement")
+	public R confirmSettlement(@Valid @RequestBody PayableStorageFees payableStorageFees) {
+		return payableStorageFeesService.confirmSettlement(payableStorageFees);
+	}
+
+	/**
+	 * 撤销仓储费
+	 */
+	@PostMapping("/revokeSettlement")
+	public R revokeSettlement(@Valid @RequestBody PayableStorageFees payableStorageFees) {
+		return payableStorageFeesService.revokeSettlement(payableStorageFees);
+	}
+
 
 }

+ 5 - 0
blade-service/blade-los/src/main/java/org/springblade/los/trade/mapper/InOutStorageMapper.java

@@ -16,7 +16,9 @@
  */
 package org.springblade.los.trade.mapper;
 
+import org.apache.ibatis.annotations.Param;
 import org.springblade.los.trade.entity.InOutStorage;
+import org.springblade.los.trade.entity.InOutStorageStatistics;
 import org.springblade.los.trade.vo.InOutStorageVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -39,4 +41,7 @@ public interface InOutStorageMapper extends BaseMapper<InOutStorage> {
 	 */
 	List<InOutStorageVO> selectInOutStoragePage(IPage page, InOutStorageVO inOutStorage);
 
+    List<InOutStorageStatistics> inventoryAccountStatisticsList(@Param("data") InOutStorageStatistics outStorageStatistics);
+
+	List<InOutStorageStatistics> inventoryAccountStatisticsPage(IPage<InOutStorageStatistics> page, @Param("data")InOutStorageStatistics outStorageStatistics);
 }

+ 116 - 0
blade-service/blade-los/src/main/java/org/springblade/los/trade/mapper/InOutStorageMapper.xml

@@ -49,5 +49,121 @@
     <select id="selectInOutStoragePage" resultMap="inOutStorageResultMap">
         select * from trade_in_out_storage where is_deleted = 0
     </select>
+    <select id="inventoryAccountStatisticsList"
+            resultType="org.springblade.los.trade.entity.InOutStorageStatistics">
+        SELECT
+            lsb.mblno as mblno,
+            lsb.booking_no as contractNo,
+            lsb.hblno as billNo,
+            tio.box_no as boxNo,
+            lsb.corp_cn_name as corpName,
+            tio.goods_name as goodsName,
+            tio.storage_date as storageDate,
+            tio.warehouse_name as warehouseName,
+            tio.quantity as quantity,
+            tio.gross_weight as grossWeight,
+            tio.net_weight as netWeight,
+            tio.out_quantity as outQuantity,
+            tio.out_weight as outWeight,
+            tio.out_net_weight as outNetWeight,
+            tio.surplus_quantity as surplusQuantity,
+            tio.surplus_weight as surplusWeight,
+            tio.surplus_net_weight as surplusNetWeight,
+            tio.surplus_goods_amount as surplusGoodsAmount,
+            tio.remarks as remarks
+        FROM
+            trade_in_out_storage tio
+                LEFT JOIN los_sea_bills lsb ON tio.pid = lsb.id
+        WHERE
+            tio.tenant_id = '263057'
+          and tio.is_deleted = '0'
+          and tio.bill_type = 'RK'
+          and lsb.tenant_id = '263057'
+          and lsb.is_deleted = '0'
+        <if test="data.goodsName !=null and data.goodsName != ''">
+            and tio.goods_name=#{data.goodsName}
+        </if>
+        <if test="data.warehouseId !=null">
+            and tio.goods_name=#{data.warehouseId}
+        </if>
+        <if test="data.warehouseId ==null or data.warehouseId ==''">
+            and tio.surplus_quantity != 0
+        </if>
+        <if test="data.mblno !=null and data.mblno != ''">
+            and lsb.mblno like concat('%', #{data.mblno}, '%')
+        </if>
+        <if test="data.contractNo !=null and data.contractNo != ''">
+            and lsb.booking_no like concat('%', #{data.contractNo}, '%')
+        </if>
+        <if test="data.billNo !=null and data.billNo != ''">
+            and lsb.hblno like concat('%', #{data.billNo}, '%')
+        </if>
+        <if test="data.boxNo !=null and data.boxNo != ''">
+            and tio.box_no like concat('%', #{data.boxNo}, '%')
+        </if>
+        <if test="data.corpId !=null">
+            and lsb.corp_id like concat('%', #{data.corpId}, '%')
+        </if>
+        ORDER BY
+        tio.storage_date
+    </select>
+    <select id="inventoryAccountStatisticsPage"
+            resultType="org.springblade.los.trade.entity.InOutStorageStatistics">
+        SELECT
+        lsb.mblno as mblno,
+        lsb.booking_no as contractNo,
+        lsb.hblno as billNo,
+        tio.box_no as boxNo,
+        lsb.corp_cn_name as corpName,
+        tio.goods_name as goodsName,
+        tio.storage_date as storageDate,
+        tio.warehouse_name as warehouseName,
+        tio.quantity as quantity,
+        tio.gross_weight as grossWeight,
+        tio.net_weight as netWeight,
+        tio.out_quantity as outQuantity,
+        tio.out_weight as outWeight,
+        tio.out_net_weight as outNetWeight,
+        tio.surplus_quantity as surplusQuantity,
+        tio.surplus_weight as surplusWeight,
+        tio.surplus_net_weight as surplusNetWeight,
+        tio.surplus_goods_amount as surplusGoodsAmount,
+        tio.remarks as remarks
+        FROM
+        trade_in_out_storage tio
+        LEFT JOIN los_sea_bills lsb ON tio.pid = lsb.id
+        WHERE
+        tio.tenant_id = '263057'
+        and tio.is_deleted = '0'
+        and tio.bill_type = 'RK'
+        and lsb.tenant_id = '263057'
+        and lsb.is_deleted = '0'
+        <if test="data.goodsName !=null and data.goodsName != ''">
+            and tio.goods_name=#{data.goodsName}
+        </if>
+        <if test="data.warehouseId !=null">
+            and tio.goods_name=#{data.warehouseId}
+        </if>
+        <if test="data.warehouseId ==null or data.warehouseId ==''">
+            and tio.surplus_quantity != 0
+        </if>
+        <if test="data.mblno !=null and data.mblno != ''">
+            and lsb.mblno like concat('%', #{data.mblno}, '%')
+        </if>
+        <if test="data.contractNo !=null and data.contractNo != ''">
+            and lsb.booking_no like concat('%', #{data.contractNo}, '%')
+        </if>
+        <if test="data.billNo !=null and data.billNo != ''">
+            and lsb.hblno like concat('%', #{data.billNo}, '%')
+        </if>
+        <if test="data.boxNo !=null and data.boxNo != ''">
+            and tio.box_no like concat('%', #{data.boxNo}, '%')
+        </if>
+        <if test="data.corpId !=null">
+            and lsb.corp_id like concat('%', #{data.corpId}, '%')
+        </if>
+        ORDER BY
+        tio.storage_date
+    </select>
 
 </mapper>

+ 8 - 0
blade-service/blade-los/src/main/java/org/springblade/los/trade/service/IInOutStorageService.java

@@ -16,8 +16,10 @@
  */
 package org.springblade.los.trade.service;
 
+import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
 import org.springblade.los.trade.entity.InOutStorage;
+import org.springblade.los.trade.entity.InOutStorageStatistics;
 import org.springblade.los.trade.vo.InOutStorageVO;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -52,4 +54,10 @@ public interface IInOutStorageService extends IService<InOutStorage> {
 	R revokeWarehouseEntry(InOutStorage inOutStorage);
 
 	R revokeOutbound(InOutStorage inOutStorage);
+
+    R inventoryAccountStatisticsSum(InOutStorageStatistics outStorageStatistics);
+
+	R<IPage<InOutStorageStatistics>> inventoryAccountStatisticsPage(InOutStorageStatistics outStorageStatistics, IPage<InOutStorageStatistics> page);
+
+	List<InOutStorageStatistics> export(InOutStorageStatistics outStorageStatistics);
 }

+ 4 - 0
blade-service/blade-los/src/main/java/org/springblade/los/trade/service/IPayableStorageFeesService.java

@@ -47,4 +47,8 @@ public interface IPayableStorageFeesService extends IService<PayableStorageFees>
 	PayableStorageFees detail(PayableStorageFees payableStorageFees);
 
 	R<List<PayableStorageFeesItems>> calculateStorageFees(PayableStorageFeesVO payableStorageFees);
+
+	R confirmSettlement(PayableStorageFees payableStorageFees);
+
+	R revokeSettlement(PayableStorageFees payableStorageFees);
 }

+ 83 - 8
blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/InOutStorageServiceImpl.java

@@ -35,10 +35,9 @@ import org.springblade.los.business.sea.mapper.BillsMapper;
 import org.springblade.los.business.sea.mapper.PreContainersMapper;
 import org.springblade.los.finance.fee.entity.FeeCenter;
 import org.springblade.los.finance.fee.mapper.FeeCenterMapper;
-import org.springblade.los.trade.entity.AgentItems;
-import org.springblade.los.trade.entity.InOutStorage;
-import org.springblade.los.trade.entity.Storage;
+import org.springblade.los.trade.entity.*;
 import org.springblade.los.trade.mapper.AgentItemsMapper;
+import org.springblade.los.trade.mapper.DispatchVehiclesMapper;
 import org.springblade.los.trade.mapper.InOutStorageMapper;
 import org.springblade.los.trade.service.IInOutStorageService;
 import org.springblade.los.trade.service.IStorageService;
@@ -52,9 +51,7 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.time.LocalDate;
 import java.time.ZoneId;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -85,6 +82,8 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 
 	private final IStorageService storageService;
 
+	private final DispatchVehiclesMapper dispatchVehiclesMapper;
+
 	@Override
 	public IPage<InOutStorageVO> selectInOutStoragePage(IPage<InOutStorageVO> page, InOutStorageVO inOutStorage) {
 		return page.setRecords(baseMapper.selectInOutStoragePage(page, inOutStorage));
@@ -470,8 +469,25 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 				deptName = res.getData().getDeptName();
 			}
 		}
+		List<Long> idList = inOutStorage.stream().map(InOutStorage::getDispatchVehiclesId).distinct().collect(Collectors.toList());
+		List<DispatchVehicles> dispatchVehiclesList = dispatchVehiclesMapper.selectList(new LambdaQueryWrapper<DispatchVehicles>()
+			.eq(DispatchVehicles::getTenantId, AuthUtil.getTenantId())
+			.eq(DispatchVehicles::getIsDeleted, 0)
+			.in(DispatchVehicles::getId, idList));
 		List<InOutStorage> inOutStorageList = new ArrayList<>();
+		List<DispatchVehicles> dispatchVehiclesArrayList = new ArrayList<>();
 		for (InOutStorage item : inOutStorage) {
+			DispatchVehicles dispatchVehicles = dispatchVehiclesList.stream().filter(e -> e.getId().equals(item.getDispatchVehiclesId()))
+				.findFirst().orElse(null);
+			if (dispatchVehicles != null) {
+				dispatchVehicles.setGrossWeight(item.getGrossWeight());
+				dispatchVehicles.setNetWeight(item.getNetWeight());
+				dispatchVehicles.setNumber(item.getQuantity());
+				dispatchVehiclesMapper.updateById(dispatchVehicles);
+				dispatchVehiclesArrayList.add(dispatchVehicles);
+			} else {
+				throw new RuntimeException("未查到派车信息,箱号:" + item.getBoxNo());
+			}
 			if (item.getId() == null) {
 				item.setCreateTime(new Date());
 				item.setCreateUser(AuthUtil.getUserId());
@@ -488,6 +504,25 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 			inOutStorageList.add(item);
 		}
 		this.saveOrUpdateBatch(inOutStorageList);
+		if (!dispatchVehiclesArrayList.isEmpty()) {
+			List<Long> boxIdList = dispatchVehiclesArrayList.stream().map(DispatchVehicles::getBoxItemsId).distinct().collect(Collectors.toList());
+			List<PreContainers> preContainersList = preContainersMapper.selectList(new LambdaQueryWrapper<PreContainers>()
+				.eq(PreContainers::getTenantId, AuthUtil.getTenantId())
+				.eq(PreContainers::getIsDeleted, 0)
+				.in(PreContainers::getId, boxIdList));
+			for (DispatchVehicles item : dispatchVehiclesArrayList) {
+				PreContainers preContainers = preContainersList.stream().filter(e -> e.getId().equals(item.getBoxItemsId()))
+					.findFirst().orElse(null);
+				if (preContainers != null) {
+					preContainers.setGrossWeight(item.getGrossWeight());
+					preContainers.setNetWeight(item.getNetWeight());
+					preContainers.setNumber(item.getNumber());
+					preContainersMapper.updateById(preContainers);
+				} else {
+					throw new RuntimeException("未查到箱信息,箱号:" + item.getBoxNo());
+				}
+			}
+		}
 		return R.data(inOutStorageList);
 	}
 
@@ -682,9 +717,9 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 			inStorage.setSurplusQuantity(quantity.add(inOutStorage.getOutQuantity()));
 			inStorage.setSurplusWeight(grossWeight.add(inOutStorage.getOutWeight()));
 			inStorage.setSurplusNetWeight(netWeight.add(inOutStorage.getOutNetWeight()));
-			if (billingRules){
+			if (billingRules) {
 				inStorage.setSurplusGoodsAmount(inStorage.getSurplusGoodsAmount().add(inStorage.getSurplusNetWeight().multiply(inOutStorage.getPrice())));
-			}else{
+			} else {
 				inStorage.setSurplusGoodsAmount(inStorage.getSurplusGoodsAmount().add(inStorage.getSurplusWeight().multiply(inOutStorage.getPrice())));
 			}
 			inStorage.setUpdateTime(new Date());
@@ -736,4 +771,44 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 		return R.data(inOutStorage);
 	}
 
+	@Override
+	public R inventoryAccountStatisticsSum(InOutStorageStatistics outStorageStatistics) {
+		Map<String, BigDecimal> map = new HashMap<>();
+		List<InOutStorageStatistics> inOutStorageStatisticsList = baseMapper.inventoryAccountStatisticsList(outStorageStatistics);
+		if (!inOutStorageStatisticsList.isEmpty()) {
+			map.put("quantity", inOutStorageStatisticsList.stream().map(InOutStorageStatistics::getQuantity).reduce(BigDecimal.ZERO, BigDecimal::add));
+			map.put("grossWeight", inOutStorageStatisticsList.stream().map(InOutStorageStatistics::getGrossWeight).reduce(BigDecimal.ZERO, BigDecimal::add));
+			map.put("netWeight", inOutStorageStatisticsList.stream().map(InOutStorageStatistics::getNetWeight).reduce(BigDecimal.ZERO, BigDecimal::add));
+			map.put("outQuantity", inOutStorageStatisticsList.stream().map(InOutStorageStatistics::getOutQuantity).reduce(BigDecimal.ZERO, BigDecimal::add));
+			map.put("outWeight", inOutStorageStatisticsList.stream().map(InOutStorageStatistics::getOutWeight).reduce(BigDecimal.ZERO, BigDecimal::add));
+			map.put("outNetWeight", inOutStorageStatisticsList.stream().map(InOutStorageStatistics::getOutNetWeight).reduce(BigDecimal.ZERO, BigDecimal::add));
+			map.put("surplusQuantity", inOutStorageStatisticsList.stream().map(InOutStorageStatistics::getSurplusQuantity).reduce(BigDecimal.ZERO, BigDecimal::add));
+			map.put("surplusWeight", inOutStorageStatisticsList.stream().map(InOutStorageStatistics::getSurplusWeight).reduce(BigDecimal.ZERO, BigDecimal::add));
+			map.put("surplusNetWeight", inOutStorageStatisticsList.stream().map(InOutStorageStatistics::getSurplusNetWeight).reduce(BigDecimal.ZERO, BigDecimal::add));
+			map.put("surplusGoodsAmount", inOutStorageStatisticsList.stream().map(InOutStorageStatistics::getSurplusGoodsAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
+		} else {
+			map.put("quantity", new BigDecimal("0.00"));
+			map.put("grossWeight", new BigDecimal("0.00"));
+			map.put("netWeight", new BigDecimal("0.00"));
+			map.put("outQuantity", new BigDecimal("0.00"));
+			map.put("outWeight", new BigDecimal("0.00"));
+			map.put("outNetWeight", new BigDecimal("0.00"));
+			map.put("surplusQuantity", new BigDecimal("0.00"));
+			map.put("surplusWeight", new BigDecimal("0.00"));
+			map.put("surplusNetWeight", new BigDecimal("0.00"));
+			map.put("surplusGoodsAmount", new BigDecimal("0.00"));
+		}
+		return R.data(map);
+	}
+
+	@Override
+	public R<IPage<InOutStorageStatistics>> inventoryAccountStatisticsPage(InOutStorageStatistics outStorageStatistics, IPage<InOutStorageStatistics> page) {
+		return R.data(page.setRecords(baseMapper.inventoryAccountStatisticsPage(page, outStorageStatistics)));
+	}
+
+	@Override
+	public List<InOutStorageStatistics> export(InOutStorageStatistics outStorageStatistics) {
+		return baseMapper.inventoryAccountStatisticsList(outStorageStatistics);
+	}
+
 }

+ 173 - 2
blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/PayableStorageFeesServiceImpl.java

@@ -27,6 +27,8 @@ import org.springblade.los.basic.fees.entity.BFees;
 import org.springblade.los.basic.fees.service.IBFeesService;
 import org.springblade.los.business.sea.entity.Bills;
 import org.springblade.los.business.sea.mapper.BillsMapper;
+import org.springblade.los.finance.fee.entity.FeeCenter;
+import org.springblade.los.finance.fee.service.IFeeCenterService;
 import org.springblade.los.trade.entity.*;
 import org.springblade.los.trade.mapper.PayableStorageFeesMapper;
 import org.springblade.los.trade.service.*;
@@ -38,6 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -64,6 +67,8 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 
 	private final IStorageFeeItemsService storageFeeItemsService;
 
+	private final IFeeCenterService feeCenterService;
+
 	@Override
 	public IPage<PayableStorageFeesVO> selectPayableStorageFeesPage(IPage<PayableStorageFeesVO> page, PayableStorageFeesVO payableStorageFees) {
 		return page.setRecords(baseMapper.selectPayableStorageFeesPage(page, payableStorageFees));
@@ -128,7 +133,6 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 			.eq(InOutStorage::getTenantId, AuthUtil.getTenantId())
 			.eq(InOutStorage::getIsDeleted, 0)
 			.eq(InOutStorage::getWarehouseId, payableStorageFees.getWarehouseId())
-			.gt(InOutStorage::getChargingDate, payableStorageFees.getChargingStartDate())
 			.lt(InOutStorage::getChargingDate, payableStorageFees.getChargingEndDate());
 		List<InOutStorage> inOutStorageList = inOutStorageService.list(lambdaQueryWrapper);
 		BFees fees = bFeesService.getOne(new LambdaQueryWrapper<BFees>()
@@ -156,6 +160,8 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 					throw new RuntimeException("未找到到进口单据信息");
 				}
 				storageFeesItems.setDocumentId(bills.getId());
+				storageFeesItems.setItemId(inOutStorage.getId());
+				storageFeesItems.setBillType(inOutStorage.getBillType());
 				storageFeesItems.setContractNumber(bills.getBookingNo());
 				storageFeesItems.setBillNo(bills.getMblno());
 				storageFeesItems.setStorageDate(inOutStorage.getStorageDate());
@@ -186,7 +192,7 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 				long day = diff / nd + 1L;
 				storageFeesItems.setChargingDay((int) day);
 				storageFeesItems.setChargingStartDate(inOutStorage.getChargingDate());
-				storageFeesItems.setChargingEndDate(payableStorageFees.getChargingEndDate());
+				storageFeesItems.setChargingEndDate(dateEnd);
 				StorageFeeItems storageFeeItems = storageFeeItemsList.stream().filter(e -> e.getGoodsType().equals(inOutStorage.getGoodsType())).findFirst().orElse(null);
 				if (storageFeeItems == null) {
 					throw new RuntimeException("请先维护商品类别" + inOutStorage.getGoodsType() + "仓储费单价");
@@ -202,10 +208,175 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 				amountSum = dayDecimal.multiply(storageFeeItems.getPriceC()).multiply(weight);
 				storageFeesItems.setRemarks("仓储费:" + day + "天*" + storageFeeItems.getPriceC() + "元*" + weight + "吨=" + amountSum + "元 ");
 				storageFeesItems.setAmount(amountSum);
+				storageFeesItems.setPrice(storageFeeItems.getPriceC());
 				storageFeesItemsList.add(storageFeesItems);
 			}
 		}
 		return R.data(storageFeesItemsList);
 	}
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public R confirmSettlement(PayableStorageFees payableStorageFees) {
+		if (payableStorageFees.getStorageFeesItemsList().isEmpty()) {
+			throw new RuntimeException("明细不能为空");
+		}
+		payableStorageFees.setStatus("已结算");
+		payableStorageFees.setUpdateTime(new Date());
+		payableStorageFees.setUpdateUser(AuthUtil.getUserId());
+		this.updateById(payableStorageFees);
+		Storage storage = storageService.getById(payableStorageFees.getWarehouseId());
+		if (storage == null) {
+			throw new RuntimeException("未查到仓库信息");
+		}
+		boolean billingRules = true;
+		if ("1".equals(storage.getBillingRules())) {
+			billingRules = false;
+		}
+		List<Long> idList = payableStorageFees.getStorageFeesItemsList().stream()
+			.map(PayableStorageFeesItems::getItemId).collect(Collectors.toList());
+		List<InOutStorage> inOutStorageList = inOutStorageService.list(new LambdaQueryWrapper<InOutStorage>()
+			.eq(InOutStorage::getIsDeleted, 0)
+			.eq(InOutStorage::getTenantId, AuthUtil.getTenantId())
+			.in(InOutStorage::getId, idList));
+		if (inOutStorageList.isEmpty()) {
+			throw new RuntimeException("未查到入出库明细数据");
+		}
+		List<Long> billIdList = payableStorageFees.getStorageFeesItemsList().stream()
+			.map(PayableStorageFeesItems::getDocumentId).collect(Collectors.toList());
+		List<Bills> billsList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
+			.eq(Bills::getIsDeleted, 0)
+			.eq(Bills::getTenantId, AuthUtil.getTenantId())
+			.in(Bills::getId, billIdList));
+		if (billsList.isEmpty()) {
+			throw new RuntimeException("未查到入出库明细数据");
+		}
+		List<InOutStorage> inOutStorageListNew = new ArrayList<>();
+		List<FeeCenter> feeCenterList = new ArrayList<>();
+		BFees fees = bFeesService.getOne(new LambdaQueryWrapper<BFees>()
+			.eq(BFees::getTenantId, AuthUtil.getTenantId())
+			.eq(BFees::getIsDeleted, 0)
+			.eq(BFees::getCode, "CCF"));
+		if (fees == null) {
+			throw new RuntimeException("请先维护仓储费用基础信息");
+		}
+		for (PayableStorageFeesItems item : payableStorageFees.getStorageFeesItemsList()) {
+			InOutStorage inOutStorage = inOutStorageList.stream().filter(e -> e.getId().equals(item.getItemId())).findFirst().orElse(null);
+			if (inOutStorage != null) {
+				inOutStorage.setChargingDate(item.getChargingEndDate());
+				inOutStorage.setUpdateTime(new Date());
+				inOutStorage.setUpdateUser(AuthUtil.getUserId());
+				inOutStorage.setUpdateUserName(AuthUtil.getUserName());
+				inOutStorageListNew.add(inOutStorage);
+			} else {
+				throw new RuntimeException("未查到单号:" + item.getBillNo() + "对应入出库记录");
+			}
+			Bills bills = billsList.stream().filter(e -> e.getId().equals(item.getDocumentId())).findFirst().orElse(null);
+			if (bills != null) {
+				FeeCenter feeCenter = new FeeCenter();
+				feeCenter.setCreateTime(new Date());
+				feeCenter.setCreateUser(AuthUtil.getUserId());
+				feeCenter.setCreateUserName(AuthUtil.getUserName());
+				if (ObjectUtils.isNotNull(AuthUtil.getDeptId())) {
+					feeCenter.setCreateDept(bills.getCreateDept());
+					feeCenter.setBranchId(bills.getBranchId());
+					feeCenter.setCreateDeptName(bills.getCreateDeptName());
+				}
+				feeCenter.setBusinessType(bills.getBusinessType());
+				feeCenter.setPid(bills.getId());
+				feeCenter.setLineNo(1L);
+				feeCenter.setBillNo(bills.getBillNo());
+				feeCenter.setBillDate(bills.getBillDate());
+				feeCenter.setCorpId(bills.getCorpId());
+				feeCenter.setCorpCnName(bills.getCorpCnName());
+				feeCenter.setBillCorpId(bills.getCorpId());
+				feeCenter.setBillCorpCnName(bills.getCorpCnName());
+				feeCenter.setMblno(bills.getMblno());
+				feeCenter.setPolId(bills.getPolId());
+				feeCenter.setPolCode(bills.getPolCode());
+				feeCenter.setPolCnName(bills.getPolCnName());
+				feeCenter.setPolEnName(bills.getPolEnName());
+				feeCenter.setPodId(bills.getPodId());
+				feeCenter.setPodCode(bills.getPodCode());
+				feeCenter.setPodCnName(bills.getPodCnName());
+				feeCenter.setPodEnName(bills.getPodEnName());
+				feeCenter.setFeeId(item.getFeeId());
+				feeCenter.setFeeCode(item.getFeeCode());
+				feeCenter.setFeeCnName(item.getFeeCnName());
+				feeCenter.setFeeEnName(item.getFeeEnName());
+				feeCenter.setDc("D");
+				feeCenter.setCurCode("CNY");
+				feeCenter.setSort(1);
+				feeCenter.setElementsId(fees.getAccElementId());
+				feeCenter.setElementsCode(fees.getElementsCode());
+				feeCenter.setElementsCnName(fees.getAccElementName());
+				feeCenter.setElementsEnName(fees.getElementsEnName());
+				feeCenter.setUnitNo("JOB");
+				if (billingRules){
+					feeCenter.setQuantity(item.getSurplusNetWeight());
+				}else{
+					feeCenter.setQuantity(item.getSurplusWeight());
+				}
+				feeCenter.setPrice(item.getPrice());
+				feeCenter.setAmount(item.getAmount());
+				feeCenter.setRemarks(item.getRemarks());
+				feeCenter.setDays(item.getChargingDay());
+				feeCenter.setStorageDate(item.getChargingStartDate());
+				feeCenter.setOutboundDate(item.getChargingEndDate());
+				feeCenter.setSrcItemId(item.getItemId());
+				feeCenterList.add(feeCenter);
+			} else {
+				throw new RuntimeException("未查到海运进口单据");
+			}
+		}
+		if (!inOutStorageListNew.isEmpty()) {
+			inOutStorageService.updateBatchById(inOutStorageListNew);
+		}
+		if (!feeCenterList.isEmpty()) {
+			feeCenterService.saveOrUpdateBatch(feeCenterList);
+		}
+		return R.data(payableStorageFees);
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public R revokeSettlement(PayableStorageFees payableStorageFees) {
+		if (payableStorageFees.getStorageFeesItemsList().isEmpty()) {
+			throw new RuntimeException("明细不能为空");
+		}
+		payableStorageFees.setStatus("录入");
+		payableStorageFees.setUpdateTime(new Date());
+		payableStorageFees.setUpdateUser(AuthUtil.getUserId());
+		this.updateById(payableStorageFees);
+		List<Long> idList = payableStorageFees.getStorageFeesItemsList().stream()
+			.map(PayableStorageFeesItems::getItemId).collect(Collectors.toList());
+		List<InOutStorage> inOutStorageList = inOutStorageService.list(new LambdaQueryWrapper<InOutStorage>()
+			.eq(InOutStorage::getIsDeleted, 0)
+			.eq(InOutStorage::getTenantId, AuthUtil.getTenantId())
+			.in(InOutStorage::getId, idList));
+		if (inOutStorageList.isEmpty()) {
+			throw new RuntimeException("未查到入出库明细数据");
+		}
+		List<InOutStorage> inOutStorageListNew = new ArrayList<>();
+		Calendar calendar = Calendar.getInstance();
+		for (PayableStorageFeesItems item : payableStorageFees.getStorageFeesItemsList()) {
+			InOutStorage inOutStorage = inOutStorageList.stream().filter(e -> e.getId().equals(item.getItemId())).findFirst().orElse(null);
+			if (inOutStorage != null) {
+				calendar.setTime(item.getChargingStartDate());
+				calendar.add(Calendar.DATE, -1); // 日期减一
+				inOutStorage.setChargingDate(calendar.getTime());
+				inOutStorage.setUpdateTime(new Date());
+				inOutStorage.setUpdateUser(AuthUtil.getUserId());
+				inOutStorage.setUpdateUserName(AuthUtil.getUserName());
+				inOutStorageListNew.add(inOutStorage);
+			} else {
+				throw new RuntimeException("未查到单号:" + item.getBillNo() + "对应入出库记录");
+			}
+		}
+		if (!inOutStorageListNew.isEmpty()) {
+			inOutStorageService.updateBatchById(inOutStorageListNew);
+		}
+		return R.data(payableStorageFees);
+	}
+
 }

+ 2 - 2
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/statistics/service/impl/StatisticsServiceImpl.java

@@ -252,8 +252,8 @@ public class StatisticsServiceImpl implements IStatisticsService {
 				BigDecimal stlAmountReturnsDay = saleDetailDayList.stream().filter(e -> "已完成".equals(e.getStatus()) &&
 						"外部销售".equals(e.getBusinessSource())).map(SaleDetailDto::getSubTotalMoney).filter(Objects::nonNull)
 					.reduce(BigDecimal.ZERO, BigDecimal::add).setScale(0, RoundingMode.HALF_UP);
-				map.put("dealAmountD", subTotalMoneyActualDay.subtract(goodsNumReturnsDay));
-				map.put("salesNumD", goodsNumActualDay.subtract(subTotalMoneyReturnsDay));
+				map.put("dealAmountD", subTotalMoneyActualDay.subtract(subTotalMoneyReturnsDay));
+				map.put("salesNumD", goodsNumActualDay.subtract(goodsNumReturnsDay));
 				map.put("stlAmountD", stlAmountActualDay.subtract(stlAmountReturnsDay));
 				map.put("profitD", profitActualDay.subtract(profitReturnsDay));
 			}

+ 37 - 37
blade-service/blade-sales-part/src/main/resources/log/logback-dev.xml

@@ -58,56 +58,56 @@
     </if>
 
     <!-- 日志输出级别 -->
-    <root level="info">
+    <root level="ERROR">
         <appender-ref ref="STDOUT"/>
         <appender-ref ref="${STDOUT_APPENDER}"/>
     </root>
 
-    <logger name="net.sf.ehcache" level="info"/>
-    <logger name="druid.sql" level="info"/>
+    <logger name="net.sf.ehcache" level="ERROR"/>
+    <logger name="druid.sql" level="ERROR"/>
 
 
     <!-- MyBatis log configure -->
-    <logger name="com.apache.ibatis" level="info"/>
-    <logger name="org.mybatis.spring" level="info"/>
-    <logger name="java.sql.Connection" level="info"/>
-    <logger name="java.sql.Statement" level="info"/>
-    <logger name="java.sql.PreparedStatement" level="info"/>
+    <logger name="com.apache.ibatis" level="ERROR"/>
+    <logger name="org.mybatis.spring" level="ERROR"/>
+    <logger name="java.sql.Connection" level="ERROR"/>
+    <logger name="java.sql.Statement" level="ERROR"/>
+    <logger name="java.sql.PreparedStatement" level="ERROR"/>
 
     <!-- 减少部分debug日志 -->
-    <logger name="druid.sql" level="info"/>
-    <logger name="org.apache.shiro" level="info"/>
-    <logger name="org.mybatis.spring" level="info"/>
-    <logger name="org.springframework" level="info"/>
-    <logger name="org.springframework.context" level="info"/>
-    <logger name="org.springframework.beans" level="info"/>
-    <logger name="com.baomidou.mybatisplus" level="info"/>
-    <logger name="org.apache.ibatis.io" level="info"/>
-    <logger name="org.apache.velocity" level="info"/>
-    <logger name="org.eclipse.jetty" level="info"/>
-    <logger name="io.undertow" level="info"/>
-    <logger name="org.xnio.nio" level="info"/>
-    <logger name="org.thymeleaf" level="info"/>
-    <logger name="springfox.documentation" level="info"/>
-    <logger name="org.hibernate.validator" level="info"/>
-    <logger name="com.netflix.loadbalancer" level="info"/>
-    <logger name="com.netflix.hystrix" level="info"/>
-    <logger name="com.netflix.zuul" level="info"/>
-    <logger name="de.codecentric" level="info"/>
-    <!-- cache info -->
-    <logger name="net.sf.ehcache" level="info"/>
-    <logger name="org.springframework.cache" level="info"/>
+    <logger name="druid.sql" level="ERROR"/>
+    <logger name="org.apache.shiro" level="ERROR"/>
+    <logger name="org.mybatis.spring" level="ERROR"/>
+    <logger name="org.springframework" level="ERROR"/>
+    <logger name="org.springframework.context" level="ERROR"/>
+    <logger name="org.springframework.beans" level="ERROR"/>
+    <logger name="com.baomidou.mybatisplus" level="ERROR"/>
+    <logger name="org.apache.ibatis.io" level="ERROR"/>
+    <logger name="org.apache.velocity" level="ERROR"/>
+    <logger name="org.eclipse.jetty" level="ERROR"/>
+    <logger name="io.undertow" level="ERROR"/>
+    <logger name="org.xnio.nio" level="ERROR"/>
+    <logger name="org.thymeleaf" level="ERROR"/>
+    <logger name="springfox.documentation" level="ERROR"/>
+    <logger name="org.hibernate.validator" level="ERROR"/>
+    <logger name="com.netflix.loadbalancer" level="ERROR"/>
+    <logger name="com.netflix.hystrix" level="ERROR"/>
+    <logger name="com.netflix.zuul" level="ERROR"/>
+    <logger name="de.codecentric" level="ERROR"/>
+    <!-- cache ERROR -->
+    <logger name="net.sf.ehcache" level="ERROR"/>
+    <logger name="org.springframework.cache" level="ERROR"/>
     <!-- cloud -->
-    <logger name="org.apache.http" level="info"/>
-    <logger name="com.netflix.discovery" level="info"/>
-    <logger name="com.netflix.eureka" level="info"/>
+    <logger name="org.apache.http" level="ERROR"/>
+    <logger name="com.netflix.discovery" level="ERROR"/>
+    <logger name="com.netflix.eureka" level="ERROR"/>
     <!-- 业务日志 -->
-    <Logger name="org.springblade" level="info"/>
-    <Logger name="org.springblade.core.tenant" level="info"/>
-    <Logger name="org.springblade.core.version" level="info"/>
+    <Logger name="org.springblade" level="ERROR"/>
+    <Logger name="org.springblade.core.tenant" level="ERROR"/>
+    <Logger name="org.springblade.core.version" level="ERROR"/>
 
     <!-- 减少nacos日志 -->
-    <logger name="com.alibaba.nacos" level="info"/>
+    <logger name="com.alibaba.nacos" level="ERROR"/>
 
 
 </configuration>

+ 20 - 6
blade-service/trade-finance/src/main/java/org/springblade/finance/service/impl/SettlementServiceImpl.java

@@ -3741,10 +3741,17 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
 	public Settlement modifyExpense(SettlementDTO settlementDTO) {
 		Long id = settlementDTO.getId();
 		Settlement settlement = baseMapper.selectById(id);
-		if ("结算完成".equals(settlement.getFinanceStatus())) {
-			throw new SecurityException("此结算单已结算过,禁止重复操作");
+		if ("收费".equals(settlement.getBillType()) || "付费".equals(settlement.getBillType())) {
+			if ("结算完成".equals(settlement.getFinanceStatus())) {
+				throw new SecurityException("此结算单已结算过,禁止重复操作");
+			}
+			settlement.setFinanceStatus("结算完成");
+		}  else if ("对账收".equals(settlement.getBillType()) || "对账付".equals(settlement.getBillType())) {
+			if ("已对账".equals(settlement.getFinanceStatus())) {
+				throw new SecurityException("此对账单已对账过,禁止重复操作");
+			}
+			settlement.setFinanceStatus("已对账");
 		}
-		settlement.setFinanceStatus("结算完成");
 		this.updateById(settlement);
 		List<Items> itemsList = settlementDTO.getItemsList();
 		List<Long> orderItemsIdList = itemsList.stream().filter(e -> 2 == e.getSrcType())
@@ -3870,10 +3877,17 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
 	public Settlement cancelModifyExpense(SettlementDTO settlementDTO) {
 		Long id = settlementDTO.getId();
 		Settlement settlement = baseMapper.selectById(id);
-		if ("待结算".equals(settlement.getFinanceStatus())) {
-			throw new SecurityException("此结算单未结算 或者 已经撤销,禁止重复操作");
+		if ("收费".equals(settlement.getBillType()) || "付费".equals(settlement.getBillType())) {
+			if ("待结算".equals(settlement.getFinanceStatus())) {
+				throw new SecurityException("此结算单未结算 或者 已经撤销,禁止重复操作");
+			}
+			settlement.setFinanceStatus("待结算");
+		}  else if ("对账收".equals(settlement.getBillType()) || "对账付".equals(settlement.getBillType())) {
+			if ("未对账".equals(settlement.getFinanceStatus())) {
+				throw new SecurityException("此对账单未对账 或者 已经撤销,禁止重复操作");
+			}
+			settlement.setFinanceStatus("未对账");
 		}
-		settlement.setFinanceStatus("待结算");
 		this.updateById(settlement);
 		List<Items> itemsList = settlementDTO.getItemsList();
 		List<Long> orderItemsIdList = itemsList.stream().filter(e -> 2 == e.getSrcType())