Browse Source

贸易代理 2024年8月13日11:48:14

纪新园 1 year ago
parent
commit
5b1163953a

+ 1 - 1
blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/AgentView.java

@@ -269,7 +269,7 @@ public class AgentView implements Serializable {
 	private String whetherReceivedBalancePayment;
 
 	/**
-	 * 订单状态  正本/草稿
+	 * 订单状态
 	 */
 	@ApiModelProperty(value = "订单状态")
 	private String orderStatus;

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

@@ -175,5 +175,25 @@ public class Record implements Serializable {
 	@ApiModelProperty(value = "来源类型")
 	private String srcType;
 
+	/**
+	 * 结算单位
+	 */
+	@TableField(exist = false)
+	private String corpName;
+
+	/**
+	 * 金额USD
+	 */
+	@TableField(exist = false)
+	private BigDecimal amountUsd;
+
+	/**
+	 * 当天汇率
+	 */
+	@TableField(exist = false)
+	private BigDecimal exchangeRate;
+
+
+
 
 }

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

@@ -2935,7 +2935,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 				feeCenter.setStlTtlAmount(item.getAmount());
 				feeCenter.setUnsettledAmount(new BigDecimal("0.00"));
 				feeCenter.setAuditStatus("0");
-				feeCenter.setRemarks("转押数据,不生成账单,金额已结算");
+				feeCenter.setRemarks("押箱来源提单号:" + item.getMblno());
 			}
 			item.setRemarks("押箱转入提单号:" + bills.getMblno());
 			item.setStatus(1);
@@ -2998,7 +2998,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 			if (0 == item.getStatus()) {
 				throw new RuntimeException("已撤销,操作失败");
 			}
-			if ("D".equals(item.getDc())){
+			if ("D".equals(item.getDc())) {
 				if (!finAccBillsList.isEmpty()) {
 					FinAccBills accBills = finAccBillsList.stream().filter(e -> e.getId().equals(item.getAccBillId())).findFirst().orElse(null);
 					if (accBills != null) {
@@ -3037,6 +3037,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 				item.setStlTtlAmount(new BigDecimal("0.00"));
 				item.setStlStatus(0);
 			}
+			item.setRemarks("");
 			item.setStatus(0);
 			feeCenterArrayList.add(item);
 		}

+ 33 - 9
blade-service/blade-los/src/main/java/org/springblade/los/trade/controller/AgentItemsController.java

@@ -16,26 +16,31 @@
  */
 package org.springblade.los.trade.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.seata.spring.annotation.GlobalTransactional;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
-import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
-import javax.validation.Valid;
-
+import org.springblade.core.boot.ctrl.BladeController;
 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.Func;
-import org.springblade.los.trade.service.IRecordService;
-import org.springframework.web.bind.annotation.*;
-import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.los.finance.fee.entity.FeeCenter;
+import org.springblade.los.finance.fee.service.IFeeCenterService;
 import org.springblade.los.trade.entity.AgentItems;
-import org.springblade.los.trade.vo.AgentItemsVO;
 import org.springblade.los.trade.service.IAgentItemsService;
-import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.los.trade.vo.AgentItemsVO;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
 
+import javax.validation.Valid;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 贸易代理明细表 控制器
@@ -50,6 +55,7 @@ import java.util.List;
 public class AgentItemsController extends BladeController {
 
 	private final IAgentItemsService agentItemsService;
+	private final IFeeCenterService feeCenterService;
 
 	/**
 	 * 详情
@@ -131,8 +137,26 @@ public class AgentItemsController extends BladeController {
 	@PostMapping("/remove")
 	@ApiOperationSupport(order = 8)
 	@ApiOperation(value = "删除", notes = "传入ids")
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
 	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
-		return R.status(agentItemsService.removeByIds(Func.toLongList(ids)));
+		List<Long> idList = Func.toLongList(ids);
+		List<AgentItems> agentItemsList = agentItemsService.list(new LambdaQueryWrapper<AgentItems>()
+			.eq(AgentItems::getTenantId, AuthUtil.getTenantId())
+			.eq(AgentItems::getIsDeleted, 0)
+			.in(AgentItems::getId, idList)
+		);
+		if (!agentItemsList.isEmpty()) {
+			List<Long> idArr = agentItemsList.stream().map(AgentItems::getPid).distinct().collect(Collectors.toList());
+			int count = feeCenterService.count(new LambdaQueryWrapper<FeeCenter>()
+				.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
+				.eq(FeeCenter::getIsDeleted, 0)
+				.eq(FeeCenter::getPid, idArr));
+			if (count > 0) {
+				throw new RuntimeException("已生成首款,尾款费用信息,删除失败");
+			}
+		}
+		return R.status(agentItemsService.removeByIds(idList));
 	}
 
 

+ 52 - 55
blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/AgentServiceImpl.java

@@ -202,9 +202,13 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 							record.setAmount(item.getActualAmount());
 							record.setDate(item.getBusinessDate());
 							record.setBillNo(item.getBillNoJoin());
-							record.setBillNo(item.getContractNo());
+							record.setContractNo(item.getContractNo());
 							record.setRemarks(item.getRemarks());
 							record.setCustomsDeclarationNo(item.getDeclarationNumber());
+							record.setAmount(item.getPaymentInUsd());
+							record.setCorpName(item.getCorpName());
+							record.setAmountUsd(item.getActualAmount());
+							record.setExchangeRate(item.getExchangeRate());
 							if ("D".equals(item.getDc())) {
 								record.setStatus("付汇已结算");
 								record.setSrcType("STL-D-FH");
@@ -788,7 +792,6 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 			}
 		}
 		declare.setBusinessStatus("提交审核");
-		declare.setOrderStatus("单据提交审核");
 		baseMapper.updateById(declare);
 		return declare;
 	}
@@ -809,7 +812,6 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 			throw new SecurityException("操作失败,请联系管理员");
 		}
 		declare.setBusinessStatus("录入");
-		declare.setOrderStatus("单据审核撤销");
 		baseMapper.updateById(declare);
 		return declare;
 	}
@@ -1054,7 +1056,6 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 		Agent detail = baseMapper.selectById(agent.getId());
 		detail.setExchangeRate(agent.getExchangeRate());
 		detail.setDownPayment("1");
-		detail.setOrderStatus("首款账单生成");
 		List<BFees> feesList = bFeesService.list(new LambdaQueryWrapper<BFees>()
 			.eq(BFees::getTenantId, AuthUtil.getTenantId())
 			.eq(BFees::getIsDeleted, 0)
@@ -1126,7 +1127,6 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 			}
 		}
 		Agent detail = baseMapper.selectById(agent.getId());
-		detail.setOrderStatus("尾款账单已生成");
 		detail.setExchangeRate(agent.getExchangeRate());
 		List<BFees> feesList = bFeesService.list(new LambdaQueryWrapper<BFees>()
 			.eq(BFees::getTenantId, AuthUtil.getTenantId())
@@ -1275,8 +1275,8 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 				}
 				item.setFirstPaidInPayment(amount);
 				item.setFirstPaidInPaymentDate(date);
-				item.setOrderStatus("部分货款");
-				item.setWhetherReceivedDownPayments("部分货款");
+				item.setOrderStatus("已收首款未收尾款");
+				item.setWhetherReceivedDownPayments("已收首款未收尾款");
 			}
 			if (new BigDecimal("0").compareTo(finalPaymentReceived) != 0) {
 				BigDecimal amount = feeCenterList.stream().filter(e -> "WK".equals(e.getFeeCode()) && item.getContractNo().equals(e.getBillNo()))
@@ -1286,9 +1286,9 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 				}
 				item.setFinalPaymentReceived(item.getFinalPaymentReceived().add(amount));
 				item.setFinalPaymentReceivedDate(date);
-				item.setOrderStatus("已收款");
+				item.setOrderStatus("已收款");
 				if (item.getFinalPaymentReceived().add(amount).compareTo(item.getFinalPaymentReceivable()) == 0) {
-					item.setWhetherReceivedDownPayments("已收款");
+					item.setWhetherReceivedDownPayments("已收款");
 				}
 			}
 		}
@@ -1302,14 +1302,14 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 			String formattedDate = sdf.format(now);
 			for (AgentItems items : agentItemsList) {
 				if (ObjectUtils.isNull(items.getPaymentRecord())) {
-					items.setPaymentRecord("【收首款】,【收尾款】,【付首款】,【付尾款】");
+					items.setPaymentRecord("【收首款】,【收尾款】,【付首款】,【付尾款】");
 				}
 				if (new BigDecimal("0").compareTo(firstPaidInPayment) != 0) {
-					String msg = "收首款:收款-时间:" + formattedDate;
-					items.setPaymentRecord(items.getPaymentRecord().replaceAll("收首款", msg));
+					String msg = "收首款:收款时间:" + formattedDate;
+					items.setPaymentRecord(items.getPaymentRecord().replaceAll("收首款", msg));
 				} else if (new BigDecimal("0").compareTo(finalPaymentReceived) != 0) {
-					String msg = "收尾款:收款-时间:" + formattedDate;
-					items.setPaymentRecord(items.getPaymentRecord().replaceAll("收尾款", msg));
+					String msg = "收尾款:收款时间:" + formattedDate;
+					items.setPaymentRecord(items.getPaymentRecord().replaceAll("收尾款", msg));
 				}
 			}
 			agentItemsService.updateBatchById(agentItemsList);
@@ -1857,8 +1857,8 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 					item.setPrepaidAmountStl(item.getPrepaidAmount());
 					item.setFirstActualPayment(item.getPrepaidAmount());
 					item.setFirstActualPaymentDate(date);
-					item.setOrderStatus("部分付汇");
-					item.setWhetherReceivedBalancePayment("部分付汇");
+					item.setOrderStatus("首款已付未付尾款");
+					item.setWhetherReceivedBalancePayment("首款已付未付尾款");
 				}
 			}
 			if (new BigDecimal("0").compareTo(finalPaymentInFull) != 0) {
@@ -1870,9 +1870,9 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 				item.setGoodsValueStl(item.getGoodsValueStl().add(amountWk));
 				item.setFinalPaymentInFull(item.getFinalPaymentInFull().add(amountWk));
 				item.setFinalPaymentInFullDate(date);
-				item.setOrderStatus("已付");
+				item.setOrderStatus("已付尾款");
 				if (item.getFinalPaymentInFull().add(amountWk).compareTo(item.getFinalPaymentPayable()) == 0) {
-					item.setWhetherReceivedBalancePayment("已付");
+					item.setWhetherReceivedBalancePayment("已付尾款");
 				}
 			}
 		}
@@ -1886,14 +1886,14 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 			String formattedDate = sdf.format(now);
 			for (AgentItems items : agentItemsList) {
 				if (ObjectUtils.isNull(items.getPaymentRecord())) {
-					items.setPaymentRecord("【收首款】,【收尾款】,【付首款】,【付尾款】");
+					items.setPaymentRecord("【收首款】,【收尾款】,【付首款】,【付尾款】");
 				}
 				if (new BigDecimal("0").compareTo(firstActualPayment) != 0) {
-					String msg = "付首款:付款-时间:" + formattedDate;
-					items.setPaymentRecord(items.getPaymentRecord().replaceAll("付首款", msg));
+					String msg = "付首款:付款时间:" + formattedDate;
+					items.setPaymentRecord(items.getPaymentRecord().replaceAll("付首款", msg));
 				} else if (new BigDecimal("0").compareTo(finalPaymentInFull) != 0) {
-					String msg = "付尾款:付款-时间:" + formattedDate;
-					items.setPaymentRecord(items.getPaymentRecord().replaceAll("付尾款", msg));
+					String msg = "付尾款:付款时间:" + formattedDate;
+					items.setPaymentRecord(items.getPaymentRecord().replaceAll("付尾款", msg));
 				}
 			}
 			agentItemsService.updateBatchById(agentItemsList);
@@ -1993,7 +1993,8 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 					data.setStlAmountCrLoc(item.getAmount());
 				}
 				finAccBillsService.saveOrUpdate(data);
-			} else {
+			}
+			else {
 				if ("D".equals(item.getDc())) {
 					data.setStlAmountDr(item.getAmount());
 					data.setStlAmountCr(new BigDecimal("0.00"));
@@ -2022,7 +2023,7 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 				stlBillsItems.setCreateDeptName(deptName);
 			}
 			stlBillsItems.setLineNo(1);
-			stlBillsItems.setBusinessType(agentList.get(0).getBusinessType());
+			stlBillsItems.setBusinessType(item.getBusinessType());
 			stlBillsItems.setBillNo(billNo);
 			stlBillsItems.setBillDate(date);
 			stlBillsItems.setAccountDate(data.getAccountDate());
@@ -2057,13 +2058,13 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 			stlBillsItems.setItemType("STL");
 			stlBillsItems.setQuantity(new BigDecimal("1"));
 			stlBillsItems.setUnitNo(item.getUnitNo());
-			stlBillsItems.setPrice(data.getAmountDr());
+			stlBillsItems.setPrice(data.getAmountCr());
 			stlBillsItems.setCurCode("CNY");
-			stlBillsItems.setAmount(data.getAmountDr());
+			stlBillsItems.setAmount(data.getAmountCr());
 			stlBillsItems.setCurrentStlCurCode("CNY");
 			stlBillsItems.setCurrentStlExrate(item.getStlExrate());
-			stlBillsItems.setCurrentStlAmount(data.getAmountDr());
-			stlBillsItems.setCurrentStlAmountLoc(data.getAmountDr());
+			stlBillsItems.setCurrentStlAmount(data.getAmountCr());
+			stlBillsItems.setCurrentStlAmountLoc(data.getAmountCr());
 			stlBillsItems.setStatus(3);
 			stlBillsItems.setIsCleared(1);
 			stlBillsItemsList.add(stlBillsItems);
@@ -2116,12 +2117,10 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 			finStlBills.setCreateDeptName(deptName);
 		}
 		finStlBills.setBusinessType("STL");
-		finStlBills.setCorpId(agentList.get(0).getCorpId());
-		finStlBills.setCorpCnName(agentList.get(0).getCorpName());
-		finStlBills.setBusinessTypes(agentList.get(0).getBusinessType());
+		finStlBills.setCorpId(feeCenterList.get(0).getCorpId());
+		finStlBills.setCorpCnName(feeCenterList.get(0).getCorpCnName());
+		finStlBills.setBusinessTypes(feeCenterList.get(0).getBusinessType());
 		finStlBills.setBusinessNo(billNo);
-		finStlBills.setDeptId(agentList.get(0).getCreateDept());
-		finStlBills.setDeptName(agentList.get(0).getCreateDeptName());
 		finStlBills.setOperatorId(AuthUtil.getUserId());
 		finStlBills.setOperatorName(AuthUtil.getUserName());
 		finStlBills.setDc("C");
@@ -2136,7 +2135,7 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 		List<BCorpsBank> corpsBankList = bCorpsBankService.list(new LambdaQueryWrapper<BCorpsBank>()
 			.eq(BCorpsBank::getTenantId, AuthUtil.getTenantId())
 			.eq(BCorpsBank::getIsDeleted, 0)
-			.eq(BCorpsBank::getPid, agentList.get(0).getCorpId()));
+			.eq(BCorpsBank::getPid, feeCenterList.get(0).getCorpId()));
 		if (!corpsBankList.isEmpty()) {
 			finStlBills.setBankId(corpsBankList.get(0).getId());
 			finStlBills.setBankAccountName(corpsBankList.get(0).getAccountName());
@@ -2744,7 +2743,6 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 		List<FeeCenter> feeCenterList = new ArrayList<>();
 		if ("FFSQ-SK".equals(agent.getPaidApplication())) {
 			declare.setApplyForPayment("1");
-			declare.setOrderStatus("已生成应付首付款");
 			if (feeCenterService.count(new LambdaQueryWrapper<FeeCenter>()
 				.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
 				.eq(FeeCenter::getIsDeleted, 0)
@@ -2824,7 +2822,6 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 			} else {
 				throw new RuntimeException("请选择明细");
 			}
-			declare.setOrderStatus("已生成应付尾款");
 		}
 		if (!feeCenterList.isEmpty()) {
 			feeCenterService.saveBatch(feeCenterList);
@@ -2930,8 +2927,8 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 		}
 		Agent agent = baseMapper.selectById(feeCenterList.get(0).getPid());
 		Agent stlAgent = new Agent();
-		stlAgent.setCorpId(agent.getCorpId());
-		stlAgent.setCorpName(agent.getCorpName());
+		stlAgent.setCorpId(feeCenterList.get(0).getCorpId());
+		stlAgent.setCorpName(feeCenterList.get(0).getCorpCnName());
 		stlAgent.setBusinessType("MYDL-STL");
 		stlAgent.setDc(feeCenterList.get(0).getDc());
 		stlAgent.setBusinessDate(date);
@@ -3828,15 +3825,15 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 			if (new BigDecimal("0").compareTo(firstPaidInPayment) != 0) {
 				item.setFirstPaidInPayment(new BigDecimal("0.00"));
 				item.setFirstPaidInPaymentDate(null);
-				item.setOrderStatus("未收款");
-				item.setWhetherReceivedDownPayments("未收款");
+				item.setOrderStatus("未收款");
+				item.setWhetherReceivedDownPayments("未收款");
 			}
 			if (new BigDecimal("0").compareTo(finalPaymentReceived) != 0) {
 				BigDecimal amount = feeCenterList.stream().filter(e -> "WK".equals(e.getFeeCode()) && item.getContractNo().equals(e.getBillNo()))
 					.map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
 				item.setFinalPaymentReceived(item.getFinalPaymentReceived().add(amount));
 				item.setFinalPaymentReceivedDate(null);
-				item.setOrderStatus("部分货款");
+				item.setOrderStatus("已收首款未收尾款");
 			}
 		}
 		List<AgentItems> agentItemsList = agentItemsService.list(new LambdaQueryWrapper<AgentItems>()
@@ -3850,12 +3847,12 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 					String[] newArr = new String[arr.length];
 					for (int i = 0; i < arr.length; i++) {
 						if (new BigDecimal("0").compareTo(firstPaidInPayment) != 0) {
-							if (arr[i].contains("收首款")) {
-								arr[i] = "【收首款】";
+							if (arr[i].contains("收首款")) {
+								arr[i] = "【收首款】";
 							}
 						} else if (new BigDecimal("0").compareTo(finalPaymentReceived) != 0) {
-							if (arr[i].contains("收尾款")) {
-								arr[i] = "【收尾款】";
+							if (arr[i].contains("收尾款")) {
+								arr[i] = "【收尾款】";
 							}
 						}
 						newArr[i] = arr[i];
@@ -4034,8 +4031,8 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 					item.setPrepaidAmountStl(new BigDecimal("0.00"));
 					item.setFirstActualPayment(new BigDecimal("0.00"));
 					item.setFirstActualPaymentDate(null);
-					item.setOrderStatus("未付");
-					item.setWhetherReceivedBalancePayment("未付");
+					item.setOrderStatus("未付首款");
+					item.setWhetherReceivedBalancePayment("未付首款");
 				}
 			}
 			if (new BigDecimal("0").compareTo(finalPaymentInFull) != 0) {
@@ -4045,8 +4042,8 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 				item.setGoodsValueStl(item.getGoodsValueStl().subtract(amountWk));
 				item.setFinalPaymentInFullDate(null);
 				if (item.getFinalPaymentInFull().add(amountWk).compareTo(item.getFinalPaymentPayable()) == 0) {
-					item.setOrderStatus("未付汇");
-					item.setWhetherReceivedBalancePayment("未付汇");
+					item.setOrderStatus("首款已付未付尾款");
+					item.setWhetherReceivedBalancePayment("首款已付未付尾款");
 				}
 			}
 		}
@@ -4064,18 +4061,18 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 					String[] newArr = new String[arr.length];
 					for (int i = 0; i < arr.length; i++) {
 						if (new BigDecimal("0").compareTo(firstActualPayment) != 0) {
-							if (arr[i].contains("付首款")) {
-								arr[i] = "【付首款】";
+							if (arr[i].contains("付首款")) {
+								arr[i] = "【付首款】";
 							}
 						} else if (new BigDecimal("0").compareTo(finalPaymentInFull) != 0) {
-							if (arr[i].contains("付尾款")) {
-								arr[i] = "【付尾款】";
+							if (arr[i].contains("付尾款")) {
+								arr[i] = "【付尾款】";
 							}
 						}
 						newArr[i] = arr[i];
 					}
 					items.setPaymentRecord(String.join(",", newArr));
-					items.setPaymentRecord("【收首款】,【收尾款】,【付首款】,【付尾款】");
+					items.setPaymentRecord("【收首款】,【收尾款】,【付首款】,【付尾款】");
 				}
 			}
 			agentItemsService.updateBatchById(agentItemsList);

+ 5 - 2
blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/InOutStorageServiceImpl.java

@@ -105,7 +105,7 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 		inOutStorage.setUpdateUser(AuthUtil.getUserId());
 		inOutStorage.setUpdateUserName(AuthUtil.getUserName());
 		if ("RK".equals(inOutStorage.getBillType())) {
-			if (ObjectUtils.isNull(inOutStorage.getStorageDate())){
+			if (ObjectUtils.isNull(inOutStorage.getStorageDate())) {
 				inOutStorage.setStorageDate(new Date());
 			}
 			Bills bills = billsMapper.selectById(inOutStorage.getPid());
@@ -349,6 +349,7 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 				feeCenter.setDays(Integer.parseInt(day + ""));
 				feeCenter.setStorageDate(inOutStorage.getOutStorageDate());
 				feeCenter.setOutboundDate(inStorage.getStorageDate());
+				feeCenter.setSrcItemId(inOutStorage.getId());
 				feeCenterMapper.insert(feeCenter);
 				inOutStorage.setStorageDays(Integer.parseInt(day + ""));
 				inOutStorage.setStorageFeesAmount(amount);
@@ -394,7 +395,9 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 		outStorage.setSurplusGoodsAmount(inOutStorage.getSurplusWeight().multiply(inOutStorage.getPrice()));
 		outStorage.setConfirmDispatchVehicles("0");
 		baseMapper.insert(outStorage);
-		inOutStorage.setWhetherInOutStorage("1");
+		if (new BigDecimal("0.00").compareTo((inOutStorage.getQuantity().subtract(inOutStorage.getOutQuantity()))) == 0) {
+			inOutStorage.setWhetherInOutStorage("1");
+		}
 		baseMapper.updateById(inOutStorage);
 		return R.data(inOutStorage);
 	}