Quellcode durchsuchen

2024年11月4日18:19:49

纪新园 vor 1 Jahr
Ursprung
Commit
7a438cfaf9

+ 6 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjOrderItems.java

@@ -304,6 +304,12 @@ public class PjOrderItems implements Serializable {
 	private BigDecimal primaryGoodsTotalNum;
 
 	/**
+	 * 返利后单价
+	 */
+	@ApiModelProperty(value = "返利后单价")
+	private BigDecimal rebatePrice;
+
+	/**
 	 * 附件
 	 */
 	@TableField(exist = false)

+ 6 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjShipItems.java

@@ -214,6 +214,12 @@ public class PjShipItems implements Serializable {
 	@ApiModelProperty(value = "融资出库记录")
 	private String srcFinancing;
 
+	/**
+	 * 返利后单价
+	 */
+	@ApiModelProperty(value = "返利后单价")
+	private BigDecimal rebatePrice;
+
 	@TableField(exist = false)
 	private List<ShipItemsRecord> recordList;
 

+ 11 - 2
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjStockDesc.java

@@ -16,9 +16,7 @@
  */
 package org.springblade.salesPart.entity;
 
-import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -227,6 +225,17 @@ public class PjStockDesc implements Serializable {
 	 */
 	@ApiModelProperty(value = "版本")
 	private Integer version;
+	/**
+	 * 返利后单价
+	 */
+	@ApiModelProperty(value = "返利后单价")
+	private BigDecimal rebatePrice;
+
+	/**
+	 * 返利后单价库存金额
+	 */
+	@ApiModelProperty(value = "返利后单价库存金额")
+	private BigDecimal rebateInventoryAmount;
 
 	@TableField(exist = false)
 	private List<Long> goodsIds;

+ 6 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/excel/ShipItemImportCodeExcel.java

@@ -55,4 +55,10 @@ public class ShipItemImportCodeExcel implements Serializable {
 	 */
 	@ExcelProperty(value = "备注")
 	private String remarks;
+
+	/**
+	 * 返利后单价
+	 */
+	@ExcelProperty(value = "返利后单价")
+	private BigDecimal rebatePrice;
 }

+ 6 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/excel/ShipItemImportExcel.java

@@ -50,4 +50,10 @@ public class ShipItemImportExcel implements Serializable {
 	 */
 	@ExcelProperty(value = "备注")
 	private String remarks;
+
+	/**
+	 * 返利后单价
+	 */
+	@ExcelProperty(value = "返利后单价")
+	private BigDecimal rebatePrice;
 }

+ 286 - 1
blade-service/blade-los/src/main/java/org/springblade/los/finance/genleg/controller/FinPeriodController.java

@@ -16,7 +16,9 @@
  */
 package org.springblade.los.finance.genleg.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -24,18 +26,43 @@ 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.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.basic.acc.service.IAccountsService;
+import org.springblade.los.business.aea.entity.AeaBills;
+import org.springblade.los.business.aea.service.IAeaBillsService;
+import org.springblade.los.business.amends.entity.Amends;
+import org.springblade.los.business.amends.service.IAmendsService;
+import org.springblade.los.business.customsDeclaration.entity.CustomsDeclaration;
+import org.springblade.los.business.customsDeclaration.service.ICustomsDeclarationService;
+import org.springblade.los.business.sea.entity.Bills;
+import org.springblade.los.business.sea.service.IBillsService;
+import org.springblade.los.excel.ReviewFailedExcel;
+import org.springblade.los.excel.UnbookkeptExcel;
 import org.springblade.los.finance.genleg.dto.PeriodVouchersTemplate;
 import org.springblade.los.finance.genleg.entity.FinPeriod;
+import org.springblade.los.finance.genleg.service.IFinGenlegCalcService;
+import org.springblade.los.finance.genleg.service.IFinGenlegService;
 import org.springblade.los.finance.genleg.service.IFinPeriodService;
 import org.springblade.los.finance.genleg.vo.FinPeriodVO;
+import org.springblade.los.finance.stl.entity.FinStlBills;
+import org.springblade.los.finance.stl.service.IFinStlBillsService;
+import org.springblade.los.finance.vouchers.entity.FinVouchers;
+import org.springblade.los.finance.vouchers.service.IFinVouchersService;
+import org.springblade.system.feign.ISysClient;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 业务-财务期间 控制器
@@ -51,6 +78,20 @@ public class FinPeriodController extends BladeController {
 
 	private final IFinPeriodService finPeriodService;
 
+	private final IBillsService billsService;
+
+	private final IAeaBillsService aeaBillsService;
+
+	private final IAmendsService amendsService;
+
+	private final ICustomsDeclarationService customsDeclarationService;
+
+	private final IFinStlBillsService finStlBillsService;
+
+	private final IFinVouchersService finVouchersService;
+
+	private final ISysClient sysClient;
+
 	/**
 	 * 详情
 	 */
@@ -193,7 +234,251 @@ public class FinPeriodController extends BladeController {
 	@ApiOperationSupport(order = 3)
 	@ApiOperation(value = "导出", notes = "finPeriod")
 	public void export(FinPeriod finPeriod, HttpServletResponse response) {
-		finPeriodService.export(finPeriod, response);
+//		finPeriodService.export(finPeriod, response);
+		if (finPeriod.getId() == null) {
+			throw new RuntimeException("缺少必要参数");
+		}
+		FinPeriod detail = finPeriodService.getById(finPeriod.getId());
+		if (1 == detail.getLockingStatus()) {
+			throw new RuntimeException("该期间已锁定,请勿重复锁定!");
+		}
+		List<ReviewFailedExcel> reviewFailedExcelList = new ArrayList<>();
+		List<UnbookkeptExcel> unbookkeptExcelList = new ArrayList<>();
+		String beginDate = "";
+		String endDate = "";
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		if (null != detail.getBeginDate()) {
+			beginDate = sdf.format(detail.getBeginDate());
+		} else {
+			throw new RuntimeException("该期间缺少开始时间,操作失败");
+		}
+		if (null != detail.getEndDate()) {
+			endDate = sdf.format(detail.getEndDate());
+		} else {
+			throw new RuntimeException("该期间缺少结束时间,操作失败");
+		}
+		List<Bills> billsList = billsService.list(new LambdaQueryWrapper<Bills>()
+			.eq(Bills::getTenantId, AuthUtil.getTenantId())
+			.eq(Bills::getIsDeleted, 0)
+			.eq(Bills::getBranchId, detail.getBranchId())
+			.apply("not find_in_set(bill_status,'1,3')")
+			.apply("((business_type = 'SE' and etd >='" + beginDate + "' and etd <= '" + endDate + "' ) " +
+				"or (business_type = 'SI' and eta >='" + beginDate + "' and eta <= '" + endDate + "'))"));
+		if (!billsList.isEmpty()) {
+			for (Bills item : billsList) {
+				ReviewFailedExcel reviewFailedExcel = new ReviewFailedExcel();
+				if ("SE".equals(item.getBusinessType())) {
+					reviewFailedExcel.setBusinessType("海运出口");
+				} else {
+					reviewFailedExcel.setBusinessType("海运进口");
+				}
+				reviewFailedExcel.setBillNo(item.getBillNo());
+				reviewFailedExcel.setBusinessDate(item.getBillDate());
+				reviewFailedExcel.setMblno(item.getMblno());
+				reviewFailedExcel.setOperator(item.getOperatorName());
+				if ("SALES".equals(item.getSrcType())) {
+					reviewFailedExcel.setSalesperson(item.getSrcCnName());
+				}
+				reviewFailedExcelList.add(reviewFailedExcel);
+			}
+		}
+		List<AeaBills> aeaBillsList = aeaBillsService.list(new LambdaQueryWrapper<AeaBills>()
+			.eq(AeaBills::getTenantId, AuthUtil.getTenantId())
+			.eq(AeaBills::getIsDeleted, 0)
+			.eq(AeaBills::getBranchId, detail.getBranchId())
+			.apply("not find_in_set(bill_status,'1,3')")
+			.apply("((business_type = 'AE' and etd >='" + beginDate + "' and etd <= '" + endDate + "' ) " +
+				"or (business_type = 'AI' and eta >='" + beginDate + "' and eta <= '" + endDate + "'))"));
+		if (!aeaBillsList.isEmpty()) {
+			for (AeaBills item : aeaBillsList) {
+				ReviewFailedExcel reviewFailedExcel = new ReviewFailedExcel();
+				if ("AE".equals(item.getBusinessType())) {
+					reviewFailedExcel.setBusinessType("空运出口");
+				} else {
+					reviewFailedExcel.setBusinessType("空运进口");
+				}
+				reviewFailedExcel.setBillNo(item.getBillNo());
+				reviewFailedExcel.setBusinessDate(item.getBillDate());
+				reviewFailedExcel.setMblno(item.getMblno());
+				reviewFailedExcel.setOperator(item.getOperatorName());
+				if ("SALES".equals(item.getSrcType())) {
+					reviewFailedExcel.setSalesperson(item.getSrcCnName());
+				}
+				reviewFailedExcelList.add(reviewFailedExcel);
+			}
+		}
+		List<Amends> amendsList = amendsService.list(new LambdaQueryWrapper<Amends>()
+			.eq(Amends::getTenantId, AuthUtil.getTenantId())
+			.eq(Amends::getIsDeleted, 0)
+			.eq(Amends::getBranchId, detail.getBranchId())
+			.apply("not find_in_set(bill_status,'3')")
+			.apply("((business_type = 'SEA' and etd >='" + beginDate + "' and etd <= '" + endDate + "' ) " +
+				"or (business_type = 'SIA' and eta >='" + beginDate + "' and eta <= '" + endDate + "')" +
+				"or (business_type = 'AEA' and etd >='" + beginDate + "' and etd <= '" + endDate + "')" +
+				"or (business_type = 'AIA' and eta >='" + beginDate + "' and eta <= '" + endDate + "'))"
+			));
+		List<Bills> billsList1 = new ArrayList<>();
+		List<AeaBills> aeaBillsList1 = new ArrayList<>();
+		if (!amendsList.isEmpty()) {
+			List<Long> billsId = amendsList.stream().map(Amends::getOrigId).collect(Collectors.toList());
+			if (!billsId.isEmpty()) {
+				billsList1 = billsService.list(new LambdaQueryWrapper<Bills>()
+					.eq(Bills::getTenantId, AuthUtil.getTenantId())
+					.eq(Bills::getIsDeleted, 0)
+					.eq(Bills::getBranchId, detail.getBranchId())
+					.in(Bills::getId, billsId)
+				);
+			}
+			List<Long> aeaBillsId = amendsList.stream().map(Amends::getOrigId).collect(Collectors.toList());
+			if (!aeaBillsId.isEmpty()) {
+				aeaBillsList1 = aeaBillsService.list(new LambdaQueryWrapper<AeaBills>()
+					.eq(AeaBills::getTenantId, AuthUtil.getTenantId())
+					.eq(AeaBills::getIsDeleted, 0)
+					.eq(AeaBills::getBranchId, detail.getBranchId())
+					.in(AeaBills::getId, aeaBillsId));
+			}
+		}
+		for (Amends item : amendsList) {
+			ReviewFailedExcel reviewFailedExcel = new ReviewFailedExcel();
+			if ("AEA".equals(item.getBusinessType())) {
+				if (!aeaBillsList1.isEmpty()) {
+					AeaBills aeaBills = aeaBillsList1.stream().filter(e -> e.getId().equals(item.getOrigId())).findFirst().orElse(null);
+					if (aeaBills != null && "SALES".equals(aeaBills.getSrcType())) {
+						reviewFailedExcel.setSalesperson(aeaBills.getSrcCnName());
+					}
+				}
+				reviewFailedExcel.setBusinessType("空运出口Amends");
+			} else if ("AIA".equals(item.getBusinessType())) {
+				if (!aeaBillsList1.isEmpty()) {
+					AeaBills aeaBills = aeaBillsList1.stream().filter(e -> e.getId().equals(item.getOrigId())).findFirst().orElse(null);
+					if (aeaBills != null && "SALES".equals(aeaBills.getSrcType())) {
+						reviewFailedExcel.setSalesperson(aeaBills.getSrcCnName());
+					}
+				}
+				reviewFailedExcel.setBusinessType("空运进口Amends");
+			} else if ("SIA".equals(item.getBusinessType())) {
+				if (!billsList1.isEmpty()) {
+					Bills aeaBills = billsList1.stream().filter(e -> e.getId().equals(item.getOrigId())).findFirst().orElse(null);
+					if (aeaBills != null && "SALES".equals(aeaBills.getSrcType())) {
+						reviewFailedExcel.setSalesperson(aeaBills.getSrcCnName());
+					}
+				}
+				reviewFailedExcel.setBusinessType("海运进口Amends");
+			} else if ("SEA".equals(item.getBusinessType())) {
+				if (!billsList1.isEmpty()) {
+					Bills aeaBills = billsList1.stream().filter(e -> e.getId().equals(item.getOrigId())).findFirst().orElse(null);
+					if (aeaBills != null && "SALES".equals(aeaBills.getSrcType())) {
+						reviewFailedExcel.setSalesperson(aeaBills.getSrcCnName());
+					}
+				}
+				reviewFailedExcel.setBusinessType("海运出口Amends");
+			}
+			reviewFailedExcel.setBillNo(item.getBillNo());
+			reviewFailedExcel.setBusinessDate(item.getBillDate());
+			reviewFailedExcel.setMblno(item.getMblno());
+			reviewFailedExcel.setOperator(item.getOperatorName());
+			reviewFailedExcelList.add(reviewFailedExcel);
+		}
+		List<CustomsDeclaration> customsDeclarationList = customsDeclarationService.list(new LambdaQueryWrapper<CustomsDeclaration>()
+			.eq(CustomsDeclaration::getTenantId, AuthUtil.getTenantId())
+			.eq(CustomsDeclaration::getIsDeleted, 0)
+			.apply("not find_in_set(bill_status,'3')")
+			.eq(CustomsDeclaration::getBranchId, detail.getBranchId())
+			.gt(CustomsDeclaration::getDeclareDate, detail.getBeginDate())
+			.lt(CustomsDeclaration::getDeclareDate, detail.getEndDate())
+		);
+		if (!customsDeclarationList.isEmpty()) {
+			for (CustomsDeclaration item : customsDeclarationList) {
+				ReviewFailedExcel reviewFailedExcel = new ReviewFailedExcel();
+				if ("BGSE".equals(item.getBusinessType())) {
+					reviewFailedExcel.setBusinessType("海运报关");
+				} else if ("BGSI".equals(item.getBusinessType())) {
+					reviewFailedExcel.setBusinessType("海运报关");
+				} else if ("BGAE".equals(item.getBusinessType())) {
+					reviewFailedExcel.setBusinessType("空运报关");
+				} else if ("BGAI".equals(item.getBusinessType())) {
+					reviewFailedExcel.setBusinessType("空运报关");
+				}
+				reviewFailedExcel.setBillNo(item.getBillNo());
+				reviewFailedExcel.setBusinessDate(item.getBillDate());
+				reviewFailedExcel.setMblno(item.getMblno());
+				reviewFailedExcel.setOperator(item.getCreateUserName());
+				if ("SALES".equals(item.getSrcType())) {
+					reviewFailedExcel.setSalesperson(item.getSrcCnName());
+				}
+				reviewFailedExcelList.add(reviewFailedExcel);
+			}
+		}
+		List<FinStlBills> finStlBillsList = finStlBillsService.list(new LambdaQueryWrapper<FinStlBills>()
+			.eq(FinStlBills::getTenantId, AuthUtil.getTenantId())
+			.eq(FinStlBills::getIsDeleted, 0)
+			.eq(FinStlBills::getBusinessType, "STL")
+			.notIn(FinStlBills::getStatus, 3)
+			.eq(FinStlBills::getBranchId, detail.getBranchId())
+			.gt(FinStlBills::getBillDate, beginDate)
+			.lt(FinStlBills::getBillDate, endDate)
+		);
+		if (!finStlBillsList.isEmpty()) {
+			List<Long> ids = finStlBillsList.stream().map(FinStlBills::getId).collect(Collectors.toList());
+			if (!ids.isEmpty()) {
+				List<FinVouchers> finVouchersList = finVouchersService.list(new LambdaQueryWrapper<FinVouchers>()
+					.eq(FinVouchers::getTenantId, AuthUtil.getTenantId())
+					.eq(FinVouchers::getIsDeleted, 0)
+					.eq(FinVouchers::getBranchId, detail.getBranchId())
+					.in(FinVouchers::getSrcId, ids)
+					.gt(FinVouchers::getVoucherDate, beginDate)
+					.lt(FinVouchers::getVoucherDate, endDate));
+				for (FinStlBills item : finStlBillsList) {
+					FinVouchers finVouchers = finVouchersList.stream().filter(e -> e.getSrcId().equals(item.getId())).findFirst().orElse(null);
+					if (finVouchers == null) {
+						ReviewFailedExcel reviewFailedExcel = new ReviewFailedExcel();
+						reviewFailedExcel.setBusinessType("结算中心");
+						reviewFailedExcel.setBillNo(item.getBillNo());
+						reviewFailedExcel.setBusinessDate(item.getBillDate());
+						reviewFailedExcel.setMblno(item.getMblno());
+						reviewFailedExcel.setOperator(item.getCreateUserName());
+						reviewFailedExcel.setSalesperson(item.getSalesName());
+						reviewFailedExcelList.add(reviewFailedExcel);
+					} else {
+						if (3 != finVouchers.getStatus()) {
+							UnbookkeptExcel unbookkeptExcel = new UnbookkeptExcel();
+							unbookkeptExcel.setYear(finVouchers.getAccountYear() + "");
+							unbookkeptExcel.setMonth(finVouchers.getAccountMonth() + "");
+							unbookkeptExcel.setVoucherNumber(finVouchers.getVoucherNo());
+							unbookkeptExcel.setVoucherDate(finVouchers.getVoucherDate());
+							unbookkeptExcel.setOperator(finVouchers.getCreateUserName());
+							unbookkeptExcelList.add(unbookkeptExcel);
+						}
+					}
+				}
+			}
+		}
+		String status = sysClient.getParamService("whether.open");
+		if (ObjectUtils.isNull(status) || !"0".equals(status)) {
+			List<FinVouchers> finVouchersList = finVouchersService.list(new LambdaQueryWrapper<FinVouchers>()
+				.eq(FinVouchers::getTenantId, AuthUtil.getTenantId())
+				.eq(FinVouchers::getIsDeleted, 0)
+				.eq(FinVouchers::getBranchId, detail.getBranchId())
+				.gt(FinVouchers::getVoucherDate, beginDate)
+				.lt(FinVouchers::getVoucherDate, endDate));
+			for (FinVouchers item : finVouchersList) {
+				if (3 != item.getStatus()) {
+					UnbookkeptExcel unbookkeptExcel = new UnbookkeptExcel();
+					unbookkeptExcel.setYear(item.getAccountYear() + "");
+					unbookkeptExcel.setMonth(item.getAccountMonth() + "");
+					unbookkeptExcel.setVoucherNumber(item.getVoucherNo());
+					unbookkeptExcel.setVoucherDate(item.getVoucherDate());
+					unbookkeptExcel.setOperator(item.getCreateUserName());
+					unbookkeptExcelList.add(unbookkeptExcel);
+				}
+			}
+		}
+		if (!reviewFailedExcelList.isEmpty()) {
+			ExcelUtil.export(response, "审核未通过", "审核未通过", BeanUtil.copy(reviewFailedExcelList, ReviewFailedExcel.class), ReviewFailedExcel.class);
+		}
+		if (!unbookkeptExcelList.isEmpty()) {
+			ExcelUtil.export(response, "凭证未记账", "凭证未记账", BeanUtil.copy(unbookkeptExcelList, UnbookkeptExcel.class), UnbookkeptExcel.class);
+		}
 	}
 
 }

+ 1 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/genleg/service/impl/FinPeriodServiceImpl.java

@@ -38,6 +38,7 @@ import org.springblade.los.business.customsDeclaration.entity.CustomsDeclaration
 import org.springblade.los.business.customsDeclaration.service.ICustomsDeclarationService;
 import org.springblade.los.business.sea.entity.Bills;
 import org.springblade.los.business.sea.service.IBillsService;
+import org.springblade.los.excel.BCorpsExcel;
 import org.springblade.los.excel.ReviewFailedExcel;
 import org.springblade.los.excel.UnbookkeptExcel;
 import org.springblade.los.finance.genleg.dto.PeriodExchangeRate;

+ 5 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/impl/OrderServiceImpl.java

@@ -2839,6 +2839,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 	}
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public R confirmWarehouse(PjOrder detatil) {
 		List<PjShip> shipList = shipMapper.selectList(new LambdaQueryWrapper<PjShip>()
 			.eq(PjShip::getOrdId, detatil.getId())
@@ -2980,6 +2981,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 	}
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public R revokeWarehouse(PjOrder detatil) {
 		PjOrder order = baseMapper.selectById(detatil.getId());
 		order.setConfirmWarehouse("0");
@@ -3127,6 +3129,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 		String financingBrand = sysClient.getParamService("financing.brand");
 		if (ObjectUtils.isNotNull(status) && "1".equals(status)) {
 			PjOrder pjOrder = baseMapper.selectById(order.getId());
+			if (ObjectUtils.isNull(pjOrder.getStorageId())){
+				throw new RuntimeException("请先维护发货仓库");
+			}
 			if (OrderTypeEnum.SCRW.getType().equals(pjOrder.getGenerateTask())) {
 				throw new RuntimeException("订单数据已生成出库,请刷新数据重新操作!");
 			}

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

@@ -1897,10 +1897,13 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 					stockDesc.setBalanceQuantity(item.getSendNum());
 					stockDesc.setStoreInventory(item.getSendNum());
 					stockDesc.setInventoryAmount(item.getSendNum().multiply(item.getPrice()));
+					stockDesc.setRebateInventoryAmount(item.getSendNum().multiply(item.getRebatePrice()));
 					if (stockDesc.getBalanceQuantity().compareTo(new BigDecimal("0")) != 0) {
 						stockDesc.setInventoryCostPrice(stockDesc.getInventoryAmount().divide(stockDesc.getBalanceQuantity(), MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP));
+						stockDesc.setRebatePrice(stockDesc.getRebateInventoryAmount().divide(stockDesc.getBalanceQuantity(), MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP));
 					} else {
 						stockDesc.setInventoryCostPrice(item.getPrice());
+						stockDesc.setRebatePrice(item.getRebatePrice());
 					}
 					pjStockDescArrayListSave.add(stockDesc);
 				} else {
@@ -2300,6 +2303,11 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 						count = 1;
 					}
 				}
+				if (ObjectUtils.isNull(itemExcel.getRebatePrice()) || new BigDecimal("0.00").compareTo(itemExcel.getRebatePrice()) == 0) {
+					item.setRebatePrice(item.getPrice());
+				} else {
+					item.setRebatePrice(itemExcel.getRebatePrice());
+				}
 				item.setUnits(goodsDesc.getUnit());
 				item.setSendNum(new BigDecimal("0"));
 				if (count == 0) {
@@ -2408,8 +2416,12 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 
 					BigDecimal inventoryAmount = item.getSendNum().multiply(item.getPrice());
 					stockOne.setInventoryAmount(stockOne.getInventoryAmount().add(inventoryAmount));
-
 					stockOne.setInventoryCostPrice(stockOne.getInventoryAmount().divide(stockOne.getBalanceQuantity(), MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP));
+
+					BigDecimal RebateInventoryAmount = item.getSendNum().multiply(item.getRebatePrice());
+					stockOne.setRebateInventoryAmount(stockOne.getRebateInventoryAmount().add(RebateInventoryAmount));
+					stockOne.setRebatePrice(stockOne.getRebateInventoryAmount().divide(stockOne.getBalanceQuantity(), MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP));
+
 					pjStockDescArrayList.add(stockOne);
 				}
 				/* ----------------------修改上架库存---------------------- */
@@ -2520,11 +2532,17 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 					stockOne.setBalanceQuantity(stockOne.getBalanceQuantity().subtract(item.getSendNum()));
 					stockOne.setStoreInventory(stockOne.getBalanceQuantity());
 					stockOne.setInventoryAmount(stockOne.getInventoryAmount().subtract(item.getSendNum().multiply(item.getPrice())));
+					stockOne.setRebateInventoryAmount(stockOne.getRebateInventoryAmount().subtract(item.getSendNum().multiply(item.getRebatePrice())));
 					if (new BigDecimal("0.00").compareTo(stockOne.getInventoryAmount()) == 0 && new BigDecimal("0.00").compareTo(stockOne.getBalanceQuantity()) == 0) {
 						stockOne.setInventoryCostPrice(new BigDecimal("0.00"));
 					} else {
 						stockOne.setInventoryCostPrice(stockOne.getInventoryAmount().divide(stockOne.getBalanceQuantity(), MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP));
 					}
+					if (new BigDecimal("0.00").compareTo(stockOne.getRebateInventoryAmount()) == 0 && new BigDecimal("0.00").compareTo(stockOne.getBalanceQuantity()) == 0) {
+						stockOne.setRebatePrice(new BigDecimal("0.00"));
+					} else {
+						stockOne.setRebatePrice(stockOne.getRebateInventoryAmount().divide(stockOne.getBalanceQuantity(), MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP));
+					}
 					stockOne.setVersion(stockOne.getVersion());
 					/*R res = iStockDescService.updateByIdNew(stockOne);
 					if (!res.isSuccess()) {
@@ -3198,6 +3216,11 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 						count = 1;
 					}
 				}
+				if (ObjectUtils.isNull(itemExcel.getRebatePrice()) || new BigDecimal("0.00").compareTo(itemExcel.getRebatePrice()) == 0) {
+					item.setRebatePrice(item.getPrice());
+				} else {
+					item.setRebatePrice(itemExcel.getRebatePrice());
+				}
 				item.setUnits(goodsDesc.getUnit());
 				item.setSendNum(new BigDecimal("0"));
 				if (count == 0) {