Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -55,4 +55,10 @@ public interface BmsServiceFeign {
|
||||
*/
|
||||
@PostMapping("/businessDocumentApi/wholeRentSynchronization")
|
||||
public AjaxResult businessDocumentApiSave(@RequestBody BusinessDataPushDTO businessDataPushDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务整租推送到bms
|
||||
*/
|
||||
@PostMapping("/businessDocumentApi/wholeRentSynchronizationZXF")
|
||||
public AjaxResult wholeRentSynchronizationZXF(@RequestBody BusinessDataPushDTO businessDataPushDTO);
|
||||
}
|
||||
@@ -201,6 +201,13 @@ public interface SystemServiceFeign {
|
||||
@GetMapping("/batchApi/getInfo/{batchId}")
|
||||
public AjaxResult getBatchInfoByBatchId(@PathVariable("batchId") Long batchId);
|
||||
|
||||
/**
|
||||
* 根据批次名称查询批次列表(导入用)
|
||||
*/
|
||||
@GetMapping("/batchApi/list")
|
||||
public Object getBatchListByName(@RequestParam("batchName") String batchName,
|
||||
@RequestParam("organizationId") Long organizationId);
|
||||
|
||||
/**
|
||||
* 根据batchId获取对应批次详情信息
|
||||
*/
|
||||
@@ -251,6 +258,14 @@ public interface SystemServiceFeign {
|
||||
@GetMapping("/packApi/getInfoByPackIdAndUnitCode/{packId}/{unitCode}")
|
||||
public AjaxResult getInfoByPackIdAndUnitCode(@PathVariable("packId") Long packId, @PathVariable("unitCode") String unitCode);
|
||||
|
||||
/**
|
||||
* 根据包装编码/名称查询包装(导入用)
|
||||
*/
|
||||
@GetMapping("/packApi/list")
|
||||
public Object getPackList(@RequestParam(value = "packCode", required = false) String packCode,
|
||||
@RequestParam(value = "packName", required = false) String packName,
|
||||
@RequestParam(value = "organizationId", required = false) Long organizationId);
|
||||
|
||||
/**
|
||||
* 根据platformId获取对应月台信息
|
||||
*/
|
||||
|
||||
+5
@@ -56,6 +56,11 @@ public class RemoteBmsFeignFallbackFactory implements FallbackFactory<BmsService
|
||||
public AjaxResult businessDocumentApiSave(BusinessDataPushDTO businessDataPushDTO) {
|
||||
return AjaxResult.error(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult wholeRentSynchronizationZXF(BusinessDataPushDTO businessDataPushDTO) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -154,6 +154,11 @@ public class RemoteSystemFeignFallbackFactory implements FallbackFactory<SystemS
|
||||
return AjaxResult.error("根据批次ID获取批次信息失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBatchListByName(String batchName, Long organizationId) {
|
||||
return AjaxResult.error("根据批次名称查询批次列表失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getBatchDetailListByBatchId(Long batchId) {
|
||||
return AjaxResult.error("根据batchId获取对应批次详情信息失败");
|
||||
@@ -199,6 +204,11 @@ public class RemoteSystemFeignFallbackFactory implements FallbackFactory<SystemS
|
||||
return AjaxResult.error("根据包装ID和单位编码获取信息失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPackList(String packCode, String packName, Long organizationId) {
|
||||
return AjaxResult.error("根据包装编码/名称查询包装列表失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getPlatformInfoByPlatformId(Long platformId) {
|
||||
return AjaxResult.error("根据platformId获取对应月台信息失败");
|
||||
|
||||
+5
-1
@@ -48,6 +48,9 @@ public class BusinessDataPushDTO{
|
||||
@ApiModelProperty("账单金额")
|
||||
private BigDecimal billAmount;
|
||||
|
||||
@ApiModelProperty("预计费金额")
|
||||
private BigDecimal estimatedCost;
|
||||
|
||||
@ApiModelProperty("费用科目")
|
||||
@NotBlank(message = "费用科目不能为空")
|
||||
private String secondSubjectCode;
|
||||
@@ -81,4 +84,5 @@ public class BusinessDataPushDTO{
|
||||
private String salesmanId;
|
||||
@ApiModelProperty("业务员名称")
|
||||
private String salesmanName;
|
||||
}
|
||||
private BigDecimal taxRate;
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package com.mhd.common.core.domain.po;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 计费参数对象 billing_params
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-12
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "计费参数对象", description = "计费参数响应对象")
|
||||
public class BillingParamsPO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("计费参数id")
|
||||
private Long billingParamsId;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("计费参数表名称")
|
||||
@Excel(name = "计费参数表名称")
|
||||
private String billingParamsName;
|
||||
|
||||
@ApiModelProperty("说明")
|
||||
@Excel(name = "说明")
|
||||
private String billingIllustrate;
|
||||
|
||||
/**
|
||||
* {
|
||||
* "fields":"参与字段",
|
||||
* "chargingId":"计费标识P1、P2",
|
||||
* "ladderType":"阶梯类型(1-固定参数,2-无阶梯,3-到达阶梯,4-累进阶梯)",
|
||||
* "ladderRule":"阶梯规则(1-左开右闭,2-左闭右开)",
|
||||
* "ladderNum":"阶梯值",
|
||||
* "sort":"排序"
|
||||
* }
|
||||
*/
|
||||
@ApiModelProperty("计费参数json串")
|
||||
@Excel(name = "计费参数json串")
|
||||
private String billingParamsJson;
|
||||
|
||||
/**
|
||||
*{
|
||||
* "outFields":"输出字段",
|
||||
* "outChargingId":"输出计费标识",
|
||||
* "fieIdsType":"字段类型(1-整数,2-浮点数,3-时间)",
|
||||
* "sort":"排序"
|
||||
* }
|
||||
*/
|
||||
@ApiModelProperty("计费参数输出json串")
|
||||
@Excel(name = "计费参数输出json串")
|
||||
private String billingOutputJson;
|
||||
|
||||
/**
|
||||
* {
|
||||
* "fieIds1":"字段1",
|
||||
* "fieIds2":"字段2",
|
||||
* "fieIdsn":"字段N",
|
||||
* "outFieIds1":"输出字段1",
|
||||
* "outFieIds2":"输出字段2",
|
||||
* "outFieIdsn":"输出字段n"
|
||||
* }
|
||||
*/
|
||||
@ApiModelProperty("预置规则json串")
|
||||
@Excel(name = "预置规则json串")
|
||||
private String preSetRules;
|
||||
|
||||
@ApiModelProperty("计费规则id")
|
||||
private Long billingRulesId;
|
||||
|
||||
}
|
||||
@@ -104,7 +104,12 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JEP 动态计算 -->
|
||||
<dependency>
|
||||
<groupId>jep</groupId>
|
||||
<artifactId>jep</artifactId>
|
||||
<version>2.24</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JPush推送 -->
|
||||
<!-- jpush极光推送导入start -->
|
||||
@@ -163,4 +168,4 @@
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
+186
-6
@@ -4,8 +4,11 @@ import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mhd.basic.domain.contractManage.entity.ContractManage;
|
||||
import com.mhd.basic.domain.contractManage.repository.mapper.ContractManageMapper;
|
||||
import com.mhd.basic.domain.contractManage.repository.po.ContractManagePO;
|
||||
import com.mhd.basic.domain.contractManage.repository.todo.ContractManageDO;
|
||||
import com.mhd.basic.domain.contractManage.service.ContractManageDomainService;
|
||||
@@ -16,12 +19,9 @@ import com.mhd.basic.domain.contractManageDetail.repository.todo.ContractManageD
|
||||
import com.mhd.basic.domain.contractManageDetail.service.ContractManageDetailDomainService;
|
||||
import com.mhd.basic.domain.expenseAccount.repository.po.ExpenseAccountPO;
|
||||
import com.mhd.basic.domain.expenseAccount.service.ExpenseAccountDomainService;
|
||||
import com.mhd.basic.interfaces.dto.contractManage.ContractManageDTO;
|
||||
import com.mhd.basic.interfaces.dto.contractManage.*;
|
||||
import com.mhd.basic.interfaces.dto.contractManageDetail.ContractManageDetailDTO;
|
||||
import com.mhd.common.core.domain.po.BillingRulesPO;
|
||||
import com.mhd.common.core.domain.po.DocumentTypePO;
|
||||
import com.mhd.common.core.domain.po.SettlementCustomersPO;
|
||||
import com.mhd.common.core.domain.po.SysDictDataVo;
|
||||
import com.mhd.common.core.domain.po.*;
|
||||
import com.mhd.common.core.enums.DictCode;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
@@ -42,6 +42,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -63,8 +65,10 @@ public class ContractManageApplicationService {
|
||||
private ExpenseAccountDomainService expenseAccountDomainService;
|
||||
@Autowired
|
||||
private ContractManageDetailDomainService contractManageDetailDomainService;
|
||||
@Autowired
|
||||
@Resource
|
||||
private ContractManageDetailMapper contractManageDetailMapper;
|
||||
@Resource
|
||||
private ContractManageMapper contractManageMapper;
|
||||
@Autowired
|
||||
private BmsServiceFeign bmsServiceFeign;
|
||||
|
||||
@@ -125,6 +129,182 @@ public class ContractManageApplicationService {
|
||||
return contractManageDomainService.queryList(contractManageDO);
|
||||
}
|
||||
|
||||
public BigDecimal getAmount(List<SubjectAndPriceReturn> subjectAndPriceReturnList) {
|
||||
if (subjectAndPriceReturnList == null || subjectAndPriceReturnList.size() == 1) {
|
||||
SubjectAndPriceReturn subjectAndPriceReturn = subjectAndPriceReturnList.get(0);
|
||||
Long billingRulesId = subjectAndPriceReturn.getBillingRulesId();
|
||||
String name = subjectAndPriceReturn.getName();
|
||||
BillingRulesPO billingRule = contractManageDetailMapper.getBillingRules(billingRulesId);
|
||||
List<BillingParamsPO> billingParams = contractManageDetailMapper.getBillingParams(billingRulesId);
|
||||
if (billingParams != null && billingParams.size() > 0) {
|
||||
BillingParamsPO billingParam = billingParams.get(0);
|
||||
String billingParamsJson = billingParam.getBillingParamsJson();
|
||||
String preSetRules = billingParam.getPreSetRules();
|
||||
List<Map<String, Object>> preSetRulesList = JSON.parseObject(preSetRules, new TypeReference<List<Map<String, Object>>>() {
|
||||
});
|
||||
List<Map<String, Object>> billingParamsList = JSON.parseObject(billingParamsJson, new TypeReference<List<Map<String, Object>>>() {
|
||||
});
|
||||
if (billingParamsList != null && billingParamsList.size() ==2) {
|
||||
Map<String, Object> targetMap = billingParamsList.stream()
|
||||
.filter(map -> name.equals(map.get("fieldsName"))) // 关键匹配条件
|
||||
.findFirst() // 取第一个
|
||||
.orElse(null); // 没找到返回null
|
||||
String chargingId = (String) targetMap.get("chargingId");
|
||||
Integer sort = (Integer) targetMap.get("sort");
|
||||
Map<String, Object> reles = preSetRulesList.get(0);
|
||||
String price = (String) reles.get("fields"+sort);
|
||||
String billingFormula = billingRule.getBillingFormula();
|
||||
billingFormula = billingFormula.replace(chargingId, price);
|
||||
//需要判断阶梯类型进行获取各计费标志的取值,拼接公式
|
||||
List<BillingParamsDetailDTO> billingParamsEntityList = JSON.parseArray(billingParamsJson, BillingParamsDetailDTO.class);
|
||||
//将计费参数实体分成两组,即:固定参数和条件参数
|
||||
List<BillingParamsDetailDTO> fixedParamsEntityList = billingParamsEntityList.stream().filter(item -> ObjectUtil.equal(item.getLadderType(),1)).collect(Collectors.toList());
|
||||
List<BillingParamsDetailDTO> ladderParamsEntityList = billingParamsEntityList.stream().filter(item -> !ObjectUtil.equal(item.getLadderType(),1)).collect(Collectors.toList());
|
||||
if (fixedParamsEntityList != null && fixedParamsEntityList.size() > 0) {
|
||||
if (subjectAndPriceReturn.getNum() != null) {
|
||||
for (BillingParamsDetailDTO ladderParamsEntity : fixedParamsEntityList) {
|
||||
String chargingId1 = ladderParamsEntity.getChargingId();
|
||||
if (chargingId1 != chargingId) {
|
||||
billingFormula = billingFormula.replace(chargingId1, subjectAndPriceReturn.getNum().toEngineeringString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return DynamicCalculationUtil.calculate(billingFormula);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SubjectAndPriceReturn aReturn = subjectAndPriceReturnList.get(0);
|
||||
Long id = aReturn.getBillingRulesId();
|
||||
BillingRulesPO Rule = contractManageDetailMapper.getBillingRules(id);
|
||||
String billingFormula = Rule.getBillingFormula();
|
||||
for (SubjectAndPriceReturn subjectAndPriceReturn : subjectAndPriceReturnList) {
|
||||
Long billingRulesId = subjectAndPriceReturn.getBillingRulesId();
|
||||
String name = subjectAndPriceReturn.getName();
|
||||
BillingRulesPO billingRule = contractManageDetailMapper.getBillingRules(billingRulesId);
|
||||
List<BillingParamsPO> billingParams = contractManageDetailMapper.getBillingParams(billingRulesId);
|
||||
if (billingParams != null && billingParams.size() > 0) {
|
||||
BillingParamsPO billingParam = billingParams.get(0);
|
||||
String billingParamsJson = billingParam.getBillingParamsJson();
|
||||
String preSetRules = billingParam.getPreSetRules();
|
||||
List<Map<String, Object>> preSetRulesList = JSON.parseObject(preSetRules, new TypeReference<List<Map<String, Object>>>() {
|
||||
});
|
||||
List<Map<String, Object>> billingParamsList = JSON.parseObject(billingParamsJson, new TypeReference<List<Map<String, Object>>>() {
|
||||
});
|
||||
if (billingParamsList != null && billingParamsList.size() ==2) {
|
||||
} else {
|
||||
Map<String, Object> targetMap = billingParamsList.stream()
|
||||
.filter(map -> name.equals(map.get("fieldsName"))) // 关键匹配条件
|
||||
.findFirst() // 取第一个
|
||||
.orElse(null); // 没找到返回null
|
||||
String chargingId = (String) targetMap.get("chargingId");
|
||||
Integer sort = (Integer) targetMap.get("sort");
|
||||
Map<String, Object> reles = preSetRulesList.get(0);
|
||||
String price = (String) reles.get("fields"+sort);
|
||||
//String billingFormula = billingRule.getBillingFormula();
|
||||
billingFormula = billingFormula.replace(chargingId, price);
|
||||
//需要判断阶梯类型进行获取各计费标志的取值,拼接公式
|
||||
List<BillingParamsDetailDTO> billingParamsEntityList = JSON.parseArray(billingParamsJson, BillingParamsDetailDTO.class);
|
||||
//将计费参数实体分成两组,即:固定参数和条件参数
|
||||
List<BillingParamsDetailDTO> fixedParamsEntityList = billingParamsEntityList.stream().filter(item -> ObjectUtil.equal(item.getLadderType(),1)).collect(Collectors.toList());
|
||||
List<BillingParamsDetailDTO> ladderParamsEntityList = billingParamsEntityList.stream().filter(item -> !ObjectUtil.equal(item.getLadderType(),1)).collect(Collectors.toList());
|
||||
if (fixedParamsEntityList != null && fixedParamsEntityList.size() > 0) {
|
||||
if (subjectAndPriceReturn.getNum() != null) {
|
||||
for (Map<String, Object> ladderParamsEntity : billingParamsList) {
|
||||
String chargingId1 = (String) ladderParamsEntity.get("chargingId");
|
||||
String fieldsName = (String) ladderParamsEntity.get("fieldsName");
|
||||
if ("纸箱贴标单价".equals(name)) {
|
||||
if ("纸箱数量".equals(fieldsName)) {
|
||||
billingFormula = billingFormula.replace(chargingId1, subjectAndPriceReturn.getNum().toEngineeringString());
|
||||
}
|
||||
} else if ("木箱贴标单价".equals(name)){
|
||||
if ("木箱数量".equals(fieldsName)) {
|
||||
billingFormula = billingFormula.replace(chargingId1, subjectAndPriceReturn.getNum().toEngineeringString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return DynamicCalculationUtil.calculate(billingFormula);
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
public List<SubjectAndPriceReturn> getSubjectAndPrice(SubjectAndPriceDTO contractManageDTO) {
|
||||
List<SubjectAndPriceReturn> result = new ArrayList<>();
|
||||
Long settlementCustomersId = contractManageDTO.getSettlementCustomersId();
|
||||
Long organizationId = contractManageDTO.getOrganizationId();
|
||||
String sunjectCode = contractManageDTO.getSubjectCode();
|
||||
Long topOrganizationId = contractManageDTO.getTopOrganizationId();
|
||||
List<ContractManage> UserContractManages = contractManageMapper.selectList(new LambdaQueryWrapper<ContractManage>()
|
||||
.eq(ContractManage::getSettlementCustomersId, settlementCustomersId)
|
||||
.eq(ContractManage::getDelFlag, 1)
|
||||
.eq(ContractManage::getOrganizationId, organizationId)
|
||||
.eq(ContractManage::getTopOrganizationId, topOrganizationId)
|
||||
.eq(ContractManage::getCommonContractFlag, 2));
|
||||
if (UserContractManages != null && UserContractManages.size() > 0) {
|
||||
}else{
|
||||
List<ContractManage> commonContractManages = contractManageMapper.selectList(new LambdaQueryWrapper<ContractManage>()
|
||||
.eq(ContractManage::getDelFlag, 1)
|
||||
.eq(ContractManage::getOrganizationId, organizationId)
|
||||
.eq(ContractManage::getTopOrganizationId, topOrganizationId)
|
||||
.eq(ContractManage::getCommonContractFlag, 1));
|
||||
if (commonContractManages != null && commonContractManages.size() > 0) {
|
||||
ContractManage contractManage = commonContractManages.get(0);
|
||||
Long contractManageId = contractManage.getContractManageId();
|
||||
List<ContractManageDetail> contractManageDetails = contractManageDetailMapper.selectList(new LambdaQueryWrapper<ContractManageDetail>()
|
||||
.eq(ContractManageDetail::getContractManageId, contractManageId)
|
||||
.eq(ContractManageDetail::getDelFlag, 1));
|
||||
if (contractManageDetails != null && contractManageDetails.size() > 0) {
|
||||
for (ContractManageDetail contractManageDetail : contractManageDetails) {
|
||||
String code = contractManageDetail.getFirstSubjectCode();
|
||||
if (sunjectCode.equals(code)) {
|
||||
Long accountingStrategyId = contractManageDetail.getAccountingStrategyId();
|
||||
BillingRulesPO billingRule = contractManageDetailMapper.getBillingRules(accountingStrategyId);
|
||||
if (billingRule != null) {
|
||||
Long billingRulesId = billingRule.getBillingRulesId();
|
||||
List<BillingParamsPO> billingParams = contractManageDetailMapper.getBillingParams(billingRulesId);
|
||||
if (billingParams != null && billingParams.size() > 0) {
|
||||
BillingParamsPO billingParam = billingParams.get(0);
|
||||
String billingParamsJson = billingParam.getBillingParamsJson();
|
||||
String preSetRules = billingParam.getPreSetRules();
|
||||
List<Map<String, Object>> preSetRulesList = JSON.parseObject(preSetRules, new TypeReference<List<Map<String, Object>>>() {});
|
||||
List<Map<String, Object>> billingParamsList = JSON.parseObject(billingParamsJson, new TypeReference<List<Map<String, Object>>>() {});
|
||||
Map<String, Object> stringObjectMap1 = preSetRulesList.get(0);
|
||||
for (Map<String, Object> stringObjectMap : billingParamsList) {
|
||||
String fieldsName = (String) stringObjectMap.get("fieldsName");
|
||||
if (fieldsName != null && ("装卸费单价".equals(fieldsName) ||
|
||||
"纸箱贴标单价".equals(fieldsName)||"木箱贴标单价".equals(fieldsName)
|
||||
|| "进出仓操作费单价".equals(fieldsName))) {
|
||||
Integer sort = (Integer) stringObjectMap.get("sort");
|
||||
String chargingId = (String) stringObjectMap.get("chargingId");
|
||||
String fields = (String) stringObjectMap.get("fields");
|
||||
String price = (String) stringObjectMap1.get("fields" + sort);
|
||||
SubjectAndPriceReturn subjectAndPriceReturn = new SubjectAndPriceReturn();
|
||||
subjectAndPriceReturn.setName(fieldsName);
|
||||
subjectAndPriceReturn.setPrice(new BigDecimal(price));
|
||||
subjectAndPriceReturn.setChargingId(chargingId);
|
||||
subjectAndPriceReturn.setFields(fields);
|
||||
subjectAndPriceReturn.setBillingRulesId(billingRulesId);
|
||||
result.add(subjectAndPriceReturn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增合同管理
|
||||
|
||||
+61
-1
@@ -408,6 +408,66 @@ public class ExpenseAccountApplicationService {
|
||||
expenseAccountDO.setUpdateByName(loginUser.getUsername());
|
||||
return expenseAccountDomainService.update(expenseAccountDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改创建订单是否固定显示 0-否 1-是
|
||||
* @param expenseAccountDTO
|
||||
* @return
|
||||
*/
|
||||
public boolean changeInOrderDisplay(ExpenseAccountDTO expenseAccountDTO) {
|
||||
//获取登录用户信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//根据id修改启用状态停用状态
|
||||
if(expenseAccountDTO.getExpenseAccountId() == null){
|
||||
throw new ServiceException("费用科目id不能为空");
|
||||
}
|
||||
if(expenseAccountDTO.getInOrderDisplay() == null){
|
||||
throw new ServiceException("状态不能为空");
|
||||
}
|
||||
if(expenseAccountDTO.getInOrderDisplay() != 0 && expenseAccountDTO.getInOrderDisplay()!=1){
|
||||
throw new ServiceException("状态错误");
|
||||
}
|
||||
ExpenseAccountDO expenseAccountDO = new ExpenseAccountDO();
|
||||
expenseAccountDO.setExpenseAccountId(expenseAccountDTO.getExpenseAccountId());
|
||||
expenseAccountDO.setInOrderDisplay(expenseAccountDTO.getInOrderDisplay());
|
||||
expenseAccountDO.setUpdateBy(loginUser.getUserid());
|
||||
expenseAccountDO.setUpdateTime(new Date());
|
||||
expenseAccountDO.setUpdateByName(loginUser.getUsername());
|
||||
return expenseAccountDomainService.update(expenseAccountDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改创建订单是否固定显示 0-否 1-是
|
||||
* @param expenseAccountDTO
|
||||
* @return
|
||||
*/
|
||||
public boolean changeOutOrderDisplay(ExpenseAccountDTO expenseAccountDTO) {
|
||||
//获取登录用户信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//根据id修改启用状态停用状态
|
||||
if(expenseAccountDTO.getExpenseAccountId() == null){
|
||||
throw new ServiceException("费用科目id不能为空");
|
||||
}
|
||||
if(expenseAccountDTO.getOutOrderDisplay() == null){
|
||||
throw new ServiceException("状态不能为空");
|
||||
}
|
||||
if(expenseAccountDTO.getOutOrderDisplay() != 0 && expenseAccountDTO.getOutOrderDisplay()!=1){
|
||||
throw new ServiceException("状态错误");
|
||||
}
|
||||
ExpenseAccountDO expenseAccountDO = new ExpenseAccountDO();
|
||||
expenseAccountDO.setExpenseAccountId(expenseAccountDTO.getExpenseAccountId());
|
||||
expenseAccountDO.setOutOrderDisplay(expenseAccountDTO.getOutOrderDisplay());
|
||||
expenseAccountDO.setUpdateBy(loginUser.getUserid());
|
||||
expenseAccountDO.setUpdateTime(new Date());
|
||||
expenseAccountDO.setUpdateByName(loginUser.getUsername());
|
||||
return expenseAccountDomainService.update(expenseAccountDO);
|
||||
}
|
||||
/**
|
||||
* 根据编码查询费用科目信息
|
||||
*/
|
||||
@@ -470,4 +530,4 @@ public class ExpenseAccountApplicationService {
|
||||
public List<QueryExpenseAccountPO> selectSocialVehicleExpenseAccount(){
|
||||
return expenseAccountDomainService.selectSocialVehicleExpenseAccount();
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.basic.domain.contractManageDetail.entity.ContractManageDetail;
|
||||
import com.mhd.basic.domain.contractManageDetail.repository.po.ContractManageDetailPO;
|
||||
import com.mhd.basic.domain.contractManageDetail.repository.todo.ContractManageDetailDO;
|
||||
import com.mhd.common.core.domain.po.BillingParamsPO;
|
||||
import com.mhd.common.core.domain.po.BillingRulesPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
/**
|
||||
* 合同管理详情Mapper接口
|
||||
@@ -20,4 +22,8 @@ public interface ContractManageDetailMapper extends BaseMapper<ContractManageDet
|
||||
public List<ContractManageDetailPO> queryList(@Param("contractManageDetailDO") ContractManageDetailDO contractManageDetailDO);
|
||||
|
||||
List<ContractManageDetailPO> getListByContractManageId(@Param("contractManageId") Long contractManageId);
|
||||
}
|
||||
|
||||
BillingRulesPO getBillingRules(@Param("id") Long id);
|
||||
|
||||
List<BillingParamsPO> getBillingParams(@Param("id") Long id);
|
||||
}
|
||||
+7
-1
@@ -104,7 +104,13 @@ public class ExpenseAccount extends BaseVOEntity{
|
||||
@ApiModelProperty(name = "创建订单是否固定显示 0-否 1-是")
|
||||
private Integer fixedOrderDisplay;
|
||||
|
||||
@ApiModelProperty(name = "入库单是否固定显示 0-否 1-是")
|
||||
private Integer inOrderDisplay;
|
||||
|
||||
@ApiModelProperty(name = "出库单是否固定显示 0-否 1-是")
|
||||
private Integer outOrderDisplay;
|
||||
|
||||
@ApiModelProperty("费率")
|
||||
private BigDecimal rate;
|
||||
|
||||
}
|
||||
}
|
||||
+8
-1
@@ -129,4 +129,11 @@ public class ExpenseAccountPO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty(name = "创建订单是否固定显示 0-否 1-是")
|
||||
private Integer fixedOrderDisplay;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(name = "入库单是否固定显示 0-否 1-是")
|
||||
private Integer inOrderDisplay;
|
||||
|
||||
@ApiModelProperty(name = "出库单是否固定显示 0-否 1-是")
|
||||
private Integer outOrderDisplay;
|
||||
}
|
||||
+8
-1
@@ -133,6 +133,13 @@ public class ExpenseAccountDO extends BaseVOEntity{
|
||||
@ApiModelProperty(name = "创建订单是否固定显示 0-否 1-是")
|
||||
private Integer fixedOrderDisplay;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "入库单是否固定显示 0-否 1-是")
|
||||
private Integer inOrderDisplay;
|
||||
|
||||
@ApiModelProperty(name = "出库单是否固定显示 0-否 1-是")
|
||||
private Integer outOrderDisplay;
|
||||
|
||||
@ApiModelProperty(name = "创建者姓名")
|
||||
private String createByName;
|
||||
|
||||
@@ -146,4 +153,4 @@ public class ExpenseAccountDO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty(name = "创建者姓名")
|
||||
private String updateByName;
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.mhd.basic.interfaces.dto.contractManage;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 计费参数json实体
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class BillingParamsDetailDTO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("字段名称")
|
||||
private String fields;
|
||||
|
||||
@ApiModelProperty("计费标识P1、P2")
|
||||
private String chargingId;
|
||||
|
||||
@ApiModelProperty("阶梯类型(1-固定参数,2-无阶梯,3-到达阶梯,4-累进阶梯)")
|
||||
private Integer ladderType;
|
||||
|
||||
@ApiModelProperty("1-左开右闭,2-左闭右开")
|
||||
private Integer ladderRule;
|
||||
|
||||
@ApiModelProperty("阶梯值")
|
||||
private String ladderNum;
|
||||
|
||||
@ApiModelProperty("标志值")
|
||||
private String flagValue;
|
||||
|
||||
@ApiModelProperty("排序")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.mhd.basic.interfaces.dto.contractManage;
|
||||
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nfunk.jep.JEP;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* JEP动态计算
|
||||
**/
|
||||
@Slf4j
|
||||
public class DynamicCalculationUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 动态计算
|
||||
* @param formula 计算公式
|
||||
* @return 计算结果
|
||||
*/
|
||||
public static BigDecimal calculate(String formula) {
|
||||
try {
|
||||
|
||||
// 创建 JEP 实例
|
||||
JEP jep = new JEP();
|
||||
// 设置要计算的表达式
|
||||
jep.parseExpression(formula);
|
||||
// 计算表达式的结果
|
||||
double result = jep.getValue();
|
||||
// 将结果转换为 BigDecimal
|
||||
return new BigDecimal(result);
|
||||
} catch (Exception e) {
|
||||
// 处理可能的异常
|
||||
log.error("动态计算失败:"+e.getMessage());
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.mhd.basic.interfaces.dto.contractManage;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SubjectAndPriceDTO extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("结算主体")
|
||||
@Excel(name = "结算主体")
|
||||
private Long settlementCustomersId;
|
||||
|
||||
@ApiModelProperty("价格")
|
||||
@Excel(name = "价格")
|
||||
private String subjectCode;
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.mhd.basic.interfaces.dto.contractManage;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@Data
|
||||
public class SubjectAndPriceReturn {
|
||||
|
||||
private String name;
|
||||
private BigDecimal price;
|
||||
private String chargingId;
|
||||
private Long billingRulesId;
|
||||
private String fields;
|
||||
private BigDecimal num;
|
||||
}
|
||||
+7
-1
@@ -132,4 +132,10 @@ public class ExpenseAccountDTO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty(name = "创建订单是否固定显示 0-否 1-是")
|
||||
private Integer fixedOrderDisplay;
|
||||
}
|
||||
|
||||
@ApiModelProperty(name = "入库单是否固定显示 0-否 1-是")
|
||||
private Integer inOrderDisplay;
|
||||
|
||||
@ApiModelProperty(name = "出库单是否固定显示 0-否 1-是")
|
||||
private Integer outOrderDisplay;
|
||||
}
|
||||
+25
-1
@@ -3,6 +3,8 @@ package com.mhd.basic.interfaces.facade.contractManage;
|
||||
import java.util.List;
|
||||
|
||||
import com.mhd.basic.interfaces.assember.contractManage.ContractManageAssembler;
|
||||
import com.mhd.basic.interfaces.dto.contractManage.SubjectAndPriceDTO;
|
||||
import com.mhd.basic.interfaces.dto.contractManage.SubjectAndPriceReturn;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -46,6 +48,28 @@ public class ContractManageApi extends BaseController{
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取科目和单价
|
||||
*/
|
||||
@ApiOperation("获取科目和单价")
|
||||
@GetMapping("/getSubjectAndPrice")
|
||||
public AjaxResult getSubjectAndPrice(SubjectAndPriceDTO subjectAndPriceDTO)
|
||||
{
|
||||
//转换实体
|
||||
return AjaxResult.success(contractManageApplicationService.getSubjectAndPrice(subjectAndPriceDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取科目和单价
|
||||
*/
|
||||
@ApiOperation("获取科目和单价")
|
||||
@PostMapping("/getAmount")
|
||||
public AjaxResult getAmount(@RequestBody List<SubjectAndPriceReturn> subjectAndPriceReturnList)
|
||||
{
|
||||
//转换实体
|
||||
return AjaxResult.success(contractManageApplicationService.getAmount(subjectAndPriceReturnList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存合同管理
|
||||
*/
|
||||
@@ -146,4 +170,4 @@ public class ContractManageApi extends BaseController{
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+23
-1
@@ -271,6 +271,28 @@ public class ExpenseAccountApi extends BaseController{
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("修改创建订单默认显示设置")
|
||||
@PostMapping("/changeInOrderDisplay")
|
||||
public AjaxResult changeInOrderDisplay(@RequestBody ExpenseAccountDTO expenseAccountDTO)
|
||||
{
|
||||
try {
|
||||
return toAjax(expenseAccountApplicationService.changeInOrderDisplay(expenseAccountDTO));
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("修改创建订单默认显示设置")
|
||||
@PostMapping("/changeOutOrderDisplay")
|
||||
public AjaxResult changeOutOrderDisplay(@RequestBody ExpenseAccountDTO expenseAccountDTO)
|
||||
{
|
||||
try {
|
||||
return toAjax(expenseAccountApplicationService.changeOutOrderDisplay(expenseAccountDTO));
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("根据code获取费用科目")
|
||||
@GetMapping(value = "/getInfoByCode")
|
||||
public AjaxResult getInfoByCode(@RequestParam("subjectCode") String subjectCode)
|
||||
@@ -288,4 +310,4 @@ public class ExpenseAccountApi extends BaseController{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,20 +14,20 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.33.0.129:6010
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
# server-addr: 10.102.192.5:6848
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
#线上正式环境
|
||||
# server-addr: 10.102.192.105:6848
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.33.0.129:6010
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
# server-addr: 10.102.192.5:6848
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
#线上正式环境
|
||||
# server-addr: 10.102.192.105:6848
|
||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||
|
||||
+9
-1
@@ -76,4 +76,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
WHERE
|
||||
contract_manage_id = #{contractManageId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
<select id="getBillingRules" resultType="com.mhd.common.core.domain.po.BillingRulesPO" parameterType="java.lang.Long">
|
||||
select * from "NGWL_TEST_BMS".billing_rules where billing_rules_id = #{id} and del_flag = 1
|
||||
</select>
|
||||
|
||||
<select id="getBillingParams" resultType="com.mhd.common.core.domain.po.BillingParamsPO" parameterType="java.lang.Long">
|
||||
select * from "NGWL_TEST_BMS".billing_params where billing_rules_id = #{id} and del_flag = 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -223,6 +223,12 @@
|
||||
<if test="expenseAccountDO.fixedOrderDisplay != null ">
|
||||
and a.fixed_order_display = #{expenseAccountDO.fixedOrderDisplay}
|
||||
</if>
|
||||
<if test="expenseAccountDO.inOrderDisplay != null ">
|
||||
and a.in_order_display = #{expenseAccountDO.inOrderDisplay}
|
||||
</if>
|
||||
<if test="expenseAccountDO.outOrderDisplay != null ">
|
||||
and a.out_order_display = #{expenseAccountDO.outOrderDisplay}
|
||||
</if>
|
||||
</sql>
|
||||
<select id="selectExpenseAccount" parameterType="com.mhd.basic.domain.expenseAccount.repository.todo.SearchExpenseAccountDO" resultType="com.mhd.basic.domain.expenseAccount.repository.po.QueryExpenseAccountPO">
|
||||
select
|
||||
@@ -288,4 +294,4 @@
|
||||
and a.del_flag=1
|
||||
order by show_seq
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
+48
@@ -997,4 +997,52 @@ public class BusinessDocumentApplicationService {
|
||||
this.auditByIdsBySystem(businessDocumentDTO);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean wholeRentSynchronizationZXF(BusinessDocumentDO businessDocumentDO) {
|
||||
log.info("定时任务进入BMS业务单据保存--开始");
|
||||
//根据结算主题id查询 结算对象编码
|
||||
Long settlementEntityId = businessDocumentDO.getSettlementEntityId();
|
||||
List<SettlementCustomers> settlementCustomersList = settlementCustomersService.list(new LambdaQueryWrapper<SettlementCustomers>()
|
||||
.eq(SettlementCustomers::getSettlementEntityId, settlementEntityId)
|
||||
.eq(SettlementCustomers::getDelFlag, 1)
|
||||
);
|
||||
if (settlementCustomersList != null && settlementCustomersList.size() > 0) {
|
||||
businessDocumentDO.setSettlementCustomersCode(settlementCustomersList.get(0).getSettlementCustomersCode());
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
//校验使用的表单是否必填校验
|
||||
//checkDoucumentType(businessDocumentDO);
|
||||
//处理数据
|
||||
handleDate(businessDocumentDO);
|
||||
businessDocumentDO.setDataSources(1);
|
||||
businessDocumentDO.setCreateTime(new Date());
|
||||
businessDocumentDO.setCreateByName("system");
|
||||
businessDocumentDO.setBusinessFlow(OrderSequence.getOrderCode("LS"));
|
||||
businessDocumentDO.setTopOrganizationId(businessDocumentDO.getTopOrganizationId());
|
||||
businessDocumentDO.setOrganizationId(businessDocumentDO.getOrganizationId());
|
||||
businessDocumentDO.setOrganizationName(businessDocumentDO.getOrganizationName());
|
||||
//调用费用计算,计算费用金额进行保存
|
||||
// CostCalculationDTO costCalculationDTO = new CostCalculationDTO();
|
||||
// costCalculationDTO.setOriginalBusinessNum(businessDocumentDO.getOriginalBusinessNum());
|
||||
// costCalculationDTO.setContractNumber(businessDocumentDO.getContractNumber());
|
||||
// costCalculationDTO.setFormJson(businessDocumentDO.getDocumentFormJson());
|
||||
// costCalculationDTO.setSubjectCode(StringUtils.isEmpty(businessDocumentDO.getSecondSubjectCode()) ? businessDocumentDO.getFirstSubjectCode():businessDocumentDO.getSecondSubjectCode());
|
||||
// costCalculationDTO.setDocumentTypeCode(businessDocumentDO.getDocumentTypeCode());
|
||||
// costCalculationDTO.setTopOrganizationId(businessDocumentDO.getTopOrganizationId());
|
||||
// costCalculationDTO.setOrganizationId(businessDocumentDO.getOrganizationId());
|
||||
// costCalculationDTO.setOrganizationName(businessDocumentDO.getOrganizationName());
|
||||
// BillingCostPo billingCostPo = costCalculationApplicationService.costCalculation(costCalculationDTO);
|
||||
// businessDocumentDO.setEstimatedCost(billingCostPo.getComputationalCost());
|
||||
// businessDocumentDO.setBillAmount(billingCostPo.getComputationalCost());//计费金额与计算金额一致
|
||||
log.info("定时任务进入BMS业务单据保存--结束");
|
||||
BusinessDocument businessDocument = businessDocumentDomainService.insertRetrun(businessDocumentDO);
|
||||
BusinessDocumentDTO businessDocumentDTO = new BusinessDocumentDTO();
|
||||
businessDocumentDTO.setBusinessDocumentIds(String.valueOf(businessDocument.getBusinessDocumentId()));
|
||||
businessDocumentDTO.setAuditOperation(1);
|
||||
this.takeEffectByIdsBySystem(businessDocumentDTO);
|
||||
this.auditByIdsBySystem(businessDocumentDTO);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -100,6 +100,25 @@ public class BusinessDocumentApi extends BaseController{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 整租推送
|
||||
*/
|
||||
@ApiOperation("装卸费推送")
|
||||
@PostMapping("/wholeRentSynchronizationZXF")
|
||||
public AjaxResult wholeRentSynchronizationZXF(@RequestBody BusinessDocumentDTO businessDocumentDTO)
|
||||
{
|
||||
try {
|
||||
//转换实体
|
||||
BusinessDocumentDO businessDocumentDO = new BusinessDocumentDO();
|
||||
// 拷贝
|
||||
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(businessDocumentDTO, businessDocumentDO, IgnoreNullUtil.getNullPropertyNames(businessDocumentDTO));
|
||||
return toAjax(businessDocumentApplicationService.wholeRentSynchronizationZXF(businessDocumentDO));
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error("保存业务单据失败" +e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 整租推送
|
||||
|
||||
@@ -18,17 +18,17 @@ spring:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.5:6848
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.5:6848
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||
file-extension: yml #默认properties
|
||||
# 开启nacos自动刷新,如果这个配置没有或者为false会导致配置不能自动刷新
|
||||
|
||||
@@ -19,20 +19,20 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.33.0.129:6010
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
# server-addr: 10.102.192.5:6848
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
#线上正式环境
|
||||
# server-addr: 10.33.0.129:6010
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.33.0.129:6010
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
# server-addr: 10.102.192.5:6848
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
#线上正式环境
|
||||
# server-addr: 10.33.0.129:6010
|
||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||
|
||||
+510
-10
@@ -1,14 +1,23 @@
|
||||
package com.mhd.wms.application.service.materialBaseInfo;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.enums.DictCode;
|
||||
import com.mhd.common.core.utils.poi.ExcelUtil;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.domain.BatchFeignPO;
|
||||
import com.mhd.system.api.domain.PackDetailFeignPO;
|
||||
import com.mhd.system.api.domain.SysDictData;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.materialBarCode.service.MaterialBarCodeDomainService;
|
||||
import com.mhd.wms.domain.materialBarCode.repository.todo.MaterialBarCodeDO;
|
||||
import com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo;
|
||||
import com.mhd.wms.domain.materialBaseInfo.repository.facade.IMaterialBaseInfoService;
|
||||
import com.mhd.wms.domain.materialBaseInfo.repository.po.MaterialBaseInfoPO;
|
||||
import com.mhd.wms.domain.materialBaseInfo.repository.todo.MaterialBaseInfoDO;
|
||||
import com.mhd.wms.domain.materialBaseInfo.service.MaterialBaseInfoDomainService;
|
||||
@@ -24,15 +33,23 @@ import com.mhd.wms.domain.materialInventoryWarning.repository.po.MaterialInvento
|
||||
import com.mhd.wms.domain.materialInventoryWarning.service.MaterialInventoryWarningDomainService;
|
||||
import com.mhd.wms.domain.materialWarehouseControl.repository.todo.MaterialWarehouseControlDO;
|
||||
import com.mhd.wms.domain.materialWarehouseControl.service.MaterialWarehouseControlDomainService;
|
||||
import com.mhd.wms.interfaces.dto.materialBaseInfo.MaterialBaseInfoDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -65,6 +82,8 @@ public class MaterialBaseInfoApplicationService {
|
||||
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
@Autowired
|
||||
private IMaterialBaseInfoService materialBaseInfoService;
|
||||
|
||||
/**
|
||||
* 分页查询物料基础信息列表
|
||||
@@ -189,20 +208,50 @@ public class MaterialBaseInfoApplicationService {
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insert(MaterialBaseInfoDO materialBaseInfoDO) {
|
||||
// 新增时如果前端未传 organizationName,则使用当前登录用户的组织名称补齐
|
||||
if (materialBaseInfoDO != null && StringUtils.isBlank(materialBaseInfoDO.getOrganizationName())) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null && loginUser.getUserPo() != null
|
||||
&& StringUtils.isNotBlank(loginUser.getUserPo().getOrganizationName())) {
|
||||
materialBaseInfoDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
}
|
||||
}
|
||||
// 新增时如果前端未传创建人/创建时间,则使用当前登录用户补齐
|
||||
if (materialBaseInfoDO != null
|
||||
&& (materialBaseInfoDO.getCreateBy() == null || materialBaseInfoDO.getCreateTime() == null)) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
if (materialBaseInfoDO.getCreateBy() == null) {
|
||||
materialBaseInfoDO.setCreateBy(loginUser.getUserid());
|
||||
}
|
||||
if (StringUtils.isBlank(materialBaseInfoDO.getCreateByName())) {
|
||||
materialBaseInfoDO.setCreateByName(loginUser.getUsername());
|
||||
}
|
||||
if (materialBaseInfoDO.getCreateTime() == null) {
|
||||
materialBaseInfoDO.setCreateTime(new Date());
|
||||
}
|
||||
}
|
||||
}
|
||||
Long materialBaseInfoId = materialBaseInfoDomainService.insert(materialBaseInfoDO);
|
||||
materialBaseInfoDO.setMaterialBaseInfoId(materialBaseInfoId);
|
||||
//商品规则
|
||||
MaterialGoodsRuleDO materialGoodsRuleDO = materialBaseInfoDO.getMaterialGoodsRule();
|
||||
materialGoodsRuleDO.setMaterialBaseInfoId(materialBaseInfoId);
|
||||
materialGoodsRuleDomainService.insert(materialGoodsRuleDO);
|
||||
if (materialGoodsRuleDO != null) {
|
||||
materialGoodsRuleDO.setMaterialBaseInfoId(materialBaseInfoId);
|
||||
materialGoodsRuleDomainService.insert(materialGoodsRuleDO);
|
||||
}
|
||||
//公共信息
|
||||
MaterialCommonDO materialCommonDO = materialBaseInfoDO.getMaterialCommon();
|
||||
materialCommonDO.setMaterialBaseInfoId(materialBaseInfoId);
|
||||
materialCommonDomainService.insert(materialCommonDO);
|
||||
if (materialCommonDO != null) {
|
||||
materialCommonDO.setMaterialBaseInfoId(materialBaseInfoId);
|
||||
materialCommonDomainService.insert(materialCommonDO);
|
||||
}
|
||||
//仓库控制信息
|
||||
MaterialWarehouseControlDO materialWarehouseControlDO = materialBaseInfoDO.getMaterialWarehouseControl();
|
||||
materialWarehouseControlDO.setMaterialBaseInfoId(materialBaseInfoId);
|
||||
materialWarehouseControlDomainService.insert(materialWarehouseControlDO);
|
||||
if (materialWarehouseControlDO != null) {
|
||||
materialWarehouseControlDO.setMaterialBaseInfoId(materialBaseInfoId);
|
||||
materialWarehouseControlDomainService.insert(materialWarehouseControlDO);
|
||||
}
|
||||
//库存预警
|
||||
materialInventoryWarningDomainService.batchInsertOrUpdate(materialBaseInfoDO);
|
||||
//条码信息
|
||||
@@ -217,13 +266,19 @@ public class MaterialBaseInfoApplicationService {
|
||||
materialBaseInfoDomainService.update(materialBaseInfoDO);
|
||||
//商品规则
|
||||
MaterialGoodsRuleDO materialGoodsRuleDO = materialBaseInfoDO.getMaterialGoodsRule();
|
||||
materialGoodsRuleDomainService.update(materialGoodsRuleDO);
|
||||
if (materialGoodsRuleDO != null) {
|
||||
materialGoodsRuleDomainService.update(materialGoodsRuleDO);
|
||||
}
|
||||
//公共信息
|
||||
MaterialCommonDO materialCommonDO = materialBaseInfoDO.getMaterialCommon();
|
||||
materialCommonDomainService.update(materialCommonDO);
|
||||
if (materialCommonDO != null) {
|
||||
materialCommonDomainService.update(materialCommonDO);
|
||||
}
|
||||
//仓库控制信息
|
||||
MaterialWarehouseControlDO materialWarehouseControlDO = materialBaseInfoDO.getMaterialWarehouseControl();
|
||||
materialWarehouseControlDomainService.update(materialWarehouseControlDO);
|
||||
if (materialWarehouseControlDO != null) {
|
||||
materialWarehouseControlDomainService.update(materialWarehouseControlDO);
|
||||
}
|
||||
//库存预警
|
||||
materialInventoryWarningDomainService.batchInsertOrUpdate(materialBaseInfoDO);
|
||||
//条码信息
|
||||
@@ -257,4 +312,449 @@ public class MaterialBaseInfoApplicationService {
|
||||
return materialBaseInfoDomainService.getInfoByNoOrderReceipt(materialBaseInfoDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入物料主数据(仅导入主表字段)
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult importData(MultipartFile file) {
|
||||
if (file == null || file.isEmpty()) {
|
||||
throw new ServiceException("上传文件不能为空");
|
||||
}
|
||||
String fileName = file.getOriginalFilename();
|
||||
if (StringUtils.isBlank(fileName) || (!fileName.endsWith(".xls") && !fileName.endsWith(".xlsx"))) {
|
||||
throw new ServiceException("请上传xls或xlsx格式文件");
|
||||
}
|
||||
|
||||
final List<MaterialBaseInfoDTO> rows;
|
||||
try (InputStream is = file.getInputStream()) {
|
||||
ExcelUtil<MaterialBaseInfoDTO> util = new ExcelUtil<>(MaterialBaseInfoDTO.class);
|
||||
rows = util.importExcel(is);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("导入模板解析失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(rows)) {
|
||||
throw new ServiceException("导入数据为空");
|
||||
}
|
||||
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Long loginOrgId = null;
|
||||
Long loginTopOrgId = null;
|
||||
if (loginUser != null && loginUser.getUserPo() != null) {
|
||||
loginOrgId = loginUser.getUserPo().getOrganizationId();
|
||||
loginTopOrgId = loginUser.getUserPo().getTopOrganizationId();
|
||||
}
|
||||
|
||||
StringBuilder errors = new StringBuilder();
|
||||
Set<String> duplicateInFile = new HashSet<>();
|
||||
int successCount = 0;
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
MaterialBaseInfoDTO row = rows.get(i);
|
||||
int rowNum = i + 2;
|
||||
if (row == null) {
|
||||
continue;
|
||||
}
|
||||
if (StringUtils.isBlank(row.getMaterialCode())) {
|
||||
errors.append("第").append(rowNum).append("行:物料编码不能为空;");
|
||||
continue;
|
||||
}
|
||||
if (StringUtils.isBlank(row.getMaterialName())) {
|
||||
errors.append("第").append(rowNum).append("行:物料名称不能为空;");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (row.getOrganizationId() == null && loginOrgId != null) {
|
||||
row.setOrganizationId(loginOrgId);
|
||||
}
|
||||
if (row.getTopOrganizationId() == null && loginTopOrgId != null) {
|
||||
row.setTopOrganizationId(loginTopOrgId);
|
||||
}
|
||||
if (row.getNullify() == null) {
|
||||
row.setNullify(2);
|
||||
}
|
||||
if (row.getCommon() == null) {
|
||||
row.setCommon(2);
|
||||
}
|
||||
if (StringUtils.isBlank(row.getHsCode()) && StringUtils.isNotBlank(row.getHsCodeImport())) {
|
||||
row.setHsCode(row.getHsCodeImport().trim());
|
||||
}
|
||||
fillOrganizationName(row, loginUser);
|
||||
|
||||
String shipperCode = StringUtils.defaultString(row.getShipperCode(), "");
|
||||
String duplicateKey = row.getOrganizationId() + "|" + shipperCode + "|" + row.getMaterialCode();
|
||||
if (!duplicateInFile.add(duplicateKey)) {
|
||||
errors.append("第").append(rowNum).append("行:文件内存在重复物料(组织+货主编码+物料编码);");
|
||||
continue;
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<MaterialBaseInfo> wrapper = new LambdaQueryWrapper<MaterialBaseInfo>()
|
||||
.eq(MaterialBaseInfo::getDelFlag, 1)
|
||||
.eq(MaterialBaseInfo::getOrganizationId, row.getOrganizationId())
|
||||
.eq(MaterialBaseInfo::getMaterialCode, row.getMaterialCode());
|
||||
if (StringUtils.isBlank(row.getShipperCode())) {
|
||||
wrapper.and(w -> w.isNull(MaterialBaseInfo::getShipperCode).or().eq(MaterialBaseInfo::getShipperCode, ""));
|
||||
} else {
|
||||
wrapper.eq(MaterialBaseInfo::getShipperCode, row.getShipperCode());
|
||||
}
|
||||
if (materialBaseInfoService.count(wrapper) > 0) {
|
||||
errors.append("第").append(rowNum).append("行:物料已存在(组织+货主编码+物料编码);");
|
||||
continue;
|
||||
}
|
||||
// 根据导入的名称/编码回填现有ID,避免要求模板传ID
|
||||
fillIdsFromExistingMasterData(row);
|
||||
fillClassifyTypeAndUnit(row);
|
||||
|
||||
MaterialBaseInfoDO materialBaseInfoDO = new MaterialBaseInfoDO();
|
||||
BeanUtils.copyProperties(row, materialBaseInfoDO);
|
||||
materialBaseInfoDO.setMaterialGoodsRule(buildImportMaterialGoodsRule(row));
|
||||
materialBaseInfoDO.setMaterialCommon(null);
|
||||
materialBaseInfoDO.setMaterialWarehouseControl(null);
|
||||
materialBaseInfoDO.setMaterialBarCodeList(buildImportBarCodeList(row));
|
||||
insert(materialBaseInfoDO);
|
||||
successCount++;
|
||||
}
|
||||
|
||||
if (errors.length() > 0) {
|
||||
return AjaxResult.error("导入完成:成功" + successCount + "条,失败" + (rows.size() - successCount) + "条。失败原因:" + errors);
|
||||
}
|
||||
return AjaxResult.success("导入成功,共" + successCount + "条");
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用已存在主数据按名称/编码反查并回填ID
|
||||
*/
|
||||
private void fillIdsFromExistingMasterData(MaterialBaseInfoDTO row) {
|
||||
if (StringUtils.isBlank(row.getPackName()) && StringUtils.isNotBlank(row.getPackImport())) {
|
||||
row.setPackName(row.getPackImport().trim());
|
||||
}
|
||||
// 货主
|
||||
if (row.getShipperId() == null && (StringUtils.isNotBlank(row.getShipperCode()) || StringUtils.isNotBlank(row.getShipperName()))) {
|
||||
MaterialBaseInfo matched = materialBaseInfoService.getOne(new LambdaQueryWrapper<MaterialBaseInfo>()
|
||||
.eq(MaterialBaseInfo::getDelFlag, 1)
|
||||
.eq(MaterialBaseInfo::getOrganizationId, row.getOrganizationId())
|
||||
.and(w -> {
|
||||
if (StringUtils.isNotBlank(row.getShipperCode())) {
|
||||
w.eq(MaterialBaseInfo::getShipperCode, row.getShipperCode());
|
||||
}
|
||||
if (StringUtils.isNotBlank(row.getShipperName())) {
|
||||
if (StringUtils.isNotBlank(row.getShipperCode())) {
|
||||
w.or();
|
||||
}
|
||||
w.eq(MaterialBaseInfo::getShipperName, row.getShipperName());
|
||||
}
|
||||
})
|
||||
.last("limit 1"));
|
||||
if (matched != null) {
|
||||
row.setShipperId(matched.getShipperId());
|
||||
if (StringUtils.isBlank(row.getShipperCode())) {
|
||||
row.setShipperCode(matched.getShipperCode());
|
||||
}
|
||||
if (StringUtils.isBlank(row.getShipperName())) {
|
||||
row.setShipperName(matched.getShipperName());
|
||||
}
|
||||
}
|
||||
}
|
||||
// 包装规格
|
||||
if (row.getPackId() == null && (StringUtils.isNotBlank(row.getPackCode()) || StringUtils.isNotBlank(row.getPackName()))) {
|
||||
Long packId = queryPackIdByCodeOrName(row.getPackCode(), row.getPackName(), row.getOrganizationId());
|
||||
if (packId != null) {
|
||||
row.setPackId(packId);
|
||||
}
|
||||
MaterialBaseInfo matched = materialBaseInfoService.getOne(new LambdaQueryWrapper<MaterialBaseInfo>()
|
||||
.eq(MaterialBaseInfo::getDelFlag, 1)
|
||||
.eq(MaterialBaseInfo::getOrganizationId, row.getOrganizationId())
|
||||
.and(w -> {
|
||||
if (StringUtils.isNotBlank(row.getPackCode())) {
|
||||
w.eq(MaterialBaseInfo::getPackCode, row.getPackCode());
|
||||
}
|
||||
if (StringUtils.isNotBlank(row.getPackName())) {
|
||||
if (StringUtils.isNotBlank(row.getPackCode())) {
|
||||
w.or();
|
||||
}
|
||||
w.eq(MaterialBaseInfo::getPackName, row.getPackName());
|
||||
}
|
||||
})
|
||||
.last("limit 1"));
|
||||
if (matched != null) {
|
||||
row.setPackId(matched.getPackId());
|
||||
if (StringUtils.isBlank(row.getPackCode())) {
|
||||
row.setPackCode(matched.getPackCode());
|
||||
}
|
||||
if (StringUtils.isBlank(row.getPackName())) {
|
||||
row.setPackName(matched.getPackName());
|
||||
}
|
||||
}
|
||||
}
|
||||
// 品牌
|
||||
if (row.getBrandId() == null && (StringUtils.isNotBlank(row.getBrandCode()) || StringUtils.isNotBlank(row.getBrandName()))) {
|
||||
MaterialBaseInfo matched = materialBaseInfoService.getOne(new LambdaQueryWrapper<MaterialBaseInfo>()
|
||||
.eq(MaterialBaseInfo::getDelFlag, 1)
|
||||
.eq(MaterialBaseInfo::getOrganizationId, row.getOrganizationId())
|
||||
.and(w -> {
|
||||
if (StringUtils.isNotBlank(row.getBrandCode())) {
|
||||
w.eq(MaterialBaseInfo::getBrandCode, row.getBrandCode());
|
||||
}
|
||||
if (StringUtils.isNotBlank(row.getBrandName())) {
|
||||
if (StringUtils.isNotBlank(row.getBrandCode())) {
|
||||
w.or();
|
||||
}
|
||||
w.eq(MaterialBaseInfo::getBrandName, row.getBrandName());
|
||||
}
|
||||
})
|
||||
.last("limit 1"));
|
||||
if (matched != null) {
|
||||
row.setBrandId(matched.getBrandId());
|
||||
if (StringUtils.isBlank(row.getBrandCode())) {
|
||||
row.setBrandCode(matched.getBrandCode());
|
||||
}
|
||||
if (StringUtils.isBlank(row.getBrandName())) {
|
||||
row.setBrandName(matched.getBrandName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fillOrganizationName(MaterialBaseInfoDTO row, LoginUser loginUser) {
|
||||
if (StringUtils.isNotBlank(row.getOrganizationName())) {
|
||||
return;
|
||||
}
|
||||
if (loginUser != null && loginUser.getUserPo() != null
|
||||
&& row.getOrganizationId() != null
|
||||
&& row.getOrganizationId().equals(loginUser.getUserPo().getOrganizationId())) {
|
||||
row.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
return;
|
||||
}
|
||||
MaterialBaseInfo matched = materialBaseInfoService.getOne(new LambdaQueryWrapper<MaterialBaseInfo>()
|
||||
.eq(MaterialBaseInfo::getDelFlag, 1)
|
||||
.eq(MaterialBaseInfo::getOrganizationId, row.getOrganizationId())
|
||||
.isNotNull(MaterialBaseInfo::getOrganizationName)
|
||||
.last("limit 1"));
|
||||
if (matched != null && StringUtils.isNotBlank(matched.getOrganizationName())) {
|
||||
row.setOrganizationName(matched.getOrganizationName());
|
||||
}
|
||||
}
|
||||
|
||||
private void fillClassifyTypeAndUnit(MaterialBaseInfoDTO row) {
|
||||
// 物料分类:模板常用“物料分类”单列,回填到名称列表
|
||||
if (CollectionUtils.isEmpty(row.getMaterialClassifyName()) && StringUtils.isNotBlank(row.getMaterialClassifyImport())) {
|
||||
List<String> names = new ArrayList<>();
|
||||
names.add(row.getMaterialClassifyImport().trim());
|
||||
row.setMaterialClassifyName(names);
|
||||
}
|
||||
|
||||
// 物料种类:可传编码或名称,统一回填编码+名称
|
||||
if ((StringUtils.isBlank(row.getMaterialType()) || StringUtils.isBlank(row.getMaterialTypeName()))
|
||||
&& StringUtils.isNotBlank(row.getMaterialTypeImport())) {
|
||||
AjaxResult dictResult = systemServiceFeign.selectListByDictType(DictCode.MATERIAL_TYPE.getCode());
|
||||
if ("200".equals(String.valueOf(dictResult.get("code"))) && dictResult.get("data") != null) {
|
||||
List<SysDictData> dictList = JSON.parseObject(JSONObject.toJSONString(dictResult.get("data")),
|
||||
new TypeReference<List<SysDictData>>() {});
|
||||
String input = row.getMaterialTypeImport().trim();
|
||||
if (!CollectionUtils.isEmpty(dictList)) {
|
||||
for (SysDictData d : dictList) {
|
||||
if (input.equals(d.getDictValue()) || input.equals(d.getDictLabel())) {
|
||||
row.setMaterialType(d.getDictValue());
|
||||
row.setMaterialTypeName(d.getDictLabel());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 物料单位:模板常用“物料单位”,按包装规格EA明细回填单位编码/名称
|
||||
String unitInput = StringUtils.isNotBlank(row.getUnitImport()) ? row.getUnitImport().trim() : StringUtils.trimToEmpty(row.getUnitImport2());
|
||||
if ((StringUtils.isBlank(row.getUnitCode()) || StringUtils.isBlank(row.getUnitName()))
|
||||
&& StringUtils.isNotBlank(unitInput)
|
||||
&& row.getPackId() != null) {
|
||||
String[] unitCodes = {"EA", "IP", "CS", "PL", "OT"};
|
||||
for (String unitCode : unitCodes) {
|
||||
AjaxResult packDetailResult = systemServiceFeign.getInfoByPackIdAndUnitCode(row.getPackId(), unitCode);
|
||||
if (!"200".equals(String.valueOf(packDetailResult.get("code"))) || packDetailResult.get("data") == null) {
|
||||
continue;
|
||||
}
|
||||
PackDetailFeignPO pd = JSON.parseObject(JSONObject.toJSONString(packDetailResult.get("data")), PackDetailFeignPO.class);
|
||||
if (pd == null) {
|
||||
continue;
|
||||
}
|
||||
if (unitInput.equals(pd.getUnitCode()) || unitInput.equals(pd.getName())) {
|
||||
row.setUnitCode(pd.getUnitCode());
|
||||
row.setUnitName(pd.getName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 模板未填写物料单位时,默认取包装规格中的 EA 单位
|
||||
if ((StringUtils.isBlank(row.getUnitCode()) || StringUtils.isBlank(row.getUnitName()))
|
||||
&& row.getPackId() != null) {
|
||||
AjaxResult packDetailResult = systemServiceFeign.getInfoByPackIdAndUnitCode(row.getPackId(), "EA");
|
||||
if ("200".equals(String.valueOf(packDetailResult.get("code"))) && packDetailResult.get("data") != null) {
|
||||
PackDetailFeignPO pd = JSON.parseObject(JSONObject.toJSONString(packDetailResult.get("data")), PackDetailFeignPO.class);
|
||||
if (pd != null) {
|
||||
if (StringUtils.isBlank(row.getUnitCode()) && StringUtils.isNotBlank(pd.getUnitCode())) {
|
||||
row.setUnitCode(pd.getUnitCode());
|
||||
}
|
||||
if (StringUtils.isBlank(row.getUnitName()) && StringUtils.isNotBlank(pd.getName())) {
|
||||
row.setUnitName(pd.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 兜底:导入模板给了“物料单位/单位”,但包装明细未命中时至少保留单位名称
|
||||
if (StringUtils.isBlank(row.getUnitName()) && StringUtils.isNotBlank(unitInput)) {
|
||||
row.setUnitName(unitInput);
|
||||
}
|
||||
if (StringUtils.isBlank(row.getUnitCode()) && StringUtils.isNotBlank(unitInput)
|
||||
&& ("EA".equalsIgnoreCase(unitInput) || "IP".equalsIgnoreCase(unitInput)
|
||||
|| "CS".equalsIgnoreCase(unitInput) || "PL".equalsIgnoreCase(unitInput)
|
||||
|| "OT".equalsIgnoreCase(unitInput))) {
|
||||
row.setUnitCode(unitInput.toUpperCase());
|
||||
}
|
||||
}
|
||||
|
||||
private List<MaterialBarCodeDO> buildImportBarCodeList(MaterialBaseInfoDTO row) {
|
||||
if (StringUtils.isBlank(row.getBarCode())) {
|
||||
return null;
|
||||
}
|
||||
MaterialBarCodeDO barCodeDO = new MaterialBarCodeDO();
|
||||
barCodeDO.setBarCode(row.getBarCode().trim());
|
||||
barCodeDO.setPackId(row.getPackId());
|
||||
barCodeDO.setPackCode(row.getPackCode());
|
||||
barCodeDO.setPackName(row.getPackName());
|
||||
barCodeDO.setUnitCode(row.getUnitCode());
|
||||
barCodeDO.setName(row.getUnitName());
|
||||
List<MaterialBarCodeDO> list = new ArrayList<>();
|
||||
list.add(barCodeDO);
|
||||
return list;
|
||||
}
|
||||
|
||||
private Long queryPackIdByCodeOrName(String packCode, String packName, Long organizationId) {
|
||||
Object result = systemServiceFeign.getPackList(StringUtils.trimToNull(packCode), StringUtils.trimToNull(packName), organizationId);
|
||||
if (result == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> resultMap = JSON.parseObject(JSONObject.toJSONString(result), new TypeReference<Map<String, Object>>() {});
|
||||
List<Map<String, Object>> rows = extractTableDataRows(resultMap);
|
||||
if (CollectionUtils.isEmpty(rows)) {
|
||||
return null;
|
||||
}
|
||||
String code = StringUtils.trimToEmpty(packCode);
|
||||
String name = StringUtils.trimToEmpty(packName);
|
||||
for (Map<String, Object> p : rows) {
|
||||
String c = p.get("packCode") == null ? "" : String.valueOf(p.get("packCode"));
|
||||
String n = p.get("packName") == null ? "" : String.valueOf(p.get("packName"));
|
||||
if ((StringUtils.isNotBlank(code) && code.equals(c)) || (StringUtils.isNotBlank(name) && name.equals(n))) {
|
||||
Object idObj = p.get("packId");
|
||||
return idObj == null ? null : Long.valueOf(String.valueOf(idObj));
|
||||
}
|
||||
}
|
||||
Object idObj = rows.get(0).get("packId");
|
||||
return idObj == null ? null : Long.valueOf(String.valueOf(idObj));
|
||||
}
|
||||
|
||||
private MaterialGoodsRuleDO buildImportMaterialGoodsRule(MaterialBaseInfoDTO row) {
|
||||
String batchName = StringUtils.isNotBlank(row.getBatchRuleNameImport())
|
||||
? row.getBatchRuleNameImport().trim()
|
||||
: (StringUtils.isNotBlank(row.getBatchName())
|
||||
? row.getBatchName().trim()
|
||||
: StringUtils.trimToEmpty(row.getBatchImport()));
|
||||
if (StringUtils.isBlank(batchName)) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder queryDebug = new StringBuilder();
|
||||
Long batchId = queryBatchIdByName(batchName, row.getOrganizationId(), queryDebug);
|
||||
if (batchId == null) {
|
||||
String normalizedBatchName = normalizeBatchKeyword(batchName);
|
||||
List<Long> orgCandidates = buildBatchOrgCandidates(row.getOrganizationId());
|
||||
throw new ServiceException("批次规则【" + batchName + "】不存在,请先在基础资料维护批次"
|
||||
+ "(匹配值:" + normalizedBatchName + ",组织范围:" + orgCandidates
|
||||
+ ",远端返回:" + (queryDebug.length() == 0 ? "无" : queryDebug.toString()) + ")");
|
||||
}
|
||||
MaterialGoodsRuleDO goodsRuleDO = new MaterialGoodsRuleDO();
|
||||
goodsRuleDO.setBatchId(batchId);
|
||||
return goodsRuleDO;
|
||||
}
|
||||
|
||||
private Long queryBatchIdByName(String batchName, Long organizationId, StringBuilder queryDebug) {
|
||||
String normalizedInput = normalizeBatchKeyword(batchName);
|
||||
if (StringUtils.isBlank(normalizedInput)) {
|
||||
return null;
|
||||
}
|
||||
List<String> debugTraces = new ArrayList<>();
|
||||
// 批次主数据通常维护在system模块,且可能挂在一级组织下;这里做组织维度兜底查询
|
||||
List<Long> orgCandidates = buildBatchOrgCandidates(organizationId);
|
||||
for (Long orgId : orgCandidates) {
|
||||
Object result = systemServiceFeign.getBatchListByName(batchName, orgId);
|
||||
if (result == null) {
|
||||
debugTraces.add("org=" + orgId + ",result=null");
|
||||
continue;
|
||||
}
|
||||
Map<String, Object> resultMap = JSON.parseObject(JSONObject.toJSONString(result), new TypeReference<Map<String, Object>>() {});
|
||||
Object codeObj = resultMap.get("code");
|
||||
Object totalObj = resultMap.get("total");
|
||||
List<Map<String, Object>> rows = extractTableDataRows(resultMap);
|
||||
if (CollectionUtils.isEmpty(rows)) {
|
||||
debugTraces.add("org=" + orgId + ",code=" + codeObj + ",total=" + totalObj + ",rows=0");
|
||||
continue;
|
||||
}
|
||||
debugTraces.add("org=" + orgId + ",code=" + codeObj + ",total=" + totalObj + ",rows=" + rows.size());
|
||||
for (Map<String, Object> p : rows) {
|
||||
if (p == null) {
|
||||
continue;
|
||||
}
|
||||
String rowBatchName = normalizeBatchKeyword(p.get("batchName") == null ? "" : String.valueOf(p.get("batchName")));
|
||||
if (StringUtils.equals(normalizedInput, rowBatchName)) {
|
||||
Object idObj = p.get("batchId");
|
||||
if (queryDebug != null) {
|
||||
queryDebug.append(String.join(" | ", debugTraces));
|
||||
}
|
||||
return idObj == null ? null : Long.valueOf(String.valueOf(idObj));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (queryDebug != null) {
|
||||
queryDebug.append(String.join(" | ", debugTraces));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String normalizeBatchKeyword(String text) {
|
||||
if (text == null) {
|
||||
return "";
|
||||
}
|
||||
return text.replace("\u3000", " ")
|
||||
.replaceAll("\\s+", "")
|
||||
.trim();
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> extractTableDataRows(Map<String, Object> resultMap) {
|
||||
if (resultMap == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Object listObj = resultMap.get("data");
|
||||
if (listObj == null) {
|
||||
listObj = resultMap.get("rows");
|
||||
}
|
||||
if (listObj == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<Map<String, Object>> rows = JSON.parseObject(JSONObject.toJSONString(listObj), new TypeReference<List<Map<String, Object>>>() {});
|
||||
return rows == null ? new ArrayList<>() : rows;
|
||||
}
|
||||
|
||||
private List<Long> buildBatchOrgCandidates(Long organizationId) {
|
||||
List<Long> orgCandidates = new ArrayList<>();
|
||||
if (organizationId != null) {
|
||||
orgCandidates.add(organizationId);
|
||||
}
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null && loginUser.getUserPo() != null && loginUser.getUserPo().getTopOrganizationId() != null) {
|
||||
Long topOrgId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (!orgCandidates.contains(topOrgId)) {
|
||||
orgCandidates.add(topOrgId);
|
||||
}
|
||||
}
|
||||
return orgCandidates;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+9
-2
@@ -491,8 +491,10 @@ public class PickingOrderApplicationService {
|
||||
public Boolean allDistribution(PickingOrderDO pickingOrderDO){
|
||||
//设置作业人员信息
|
||||
operatorsParam(pickingOrderDO);
|
||||
//设置集货库位
|
||||
setStorageLocation(pickingOrderDO);
|
||||
// 整单下发时集货位改为选填:仅在前端传入集货位时才补全库位信息
|
||||
if (pickingOrderDO.getStorageLocationId() != null) {
|
||||
setStorageLocation(pickingOrderDO);
|
||||
}
|
||||
return pickingOrderDomainService.allDistribution(pickingOrderDO);
|
||||
}
|
||||
|
||||
@@ -617,6 +619,11 @@ public class PickingOrderApplicationService {
|
||||
PickingMaterialDetailDO returnPickingMaterialDetailDO = new PickingMaterialDetailDO();
|
||||
BeanUtils.copyProperties(pickingMaterialDetailPO, returnPickingMaterialDetailDO);
|
||||
returnPickingMaterialDetailDO.setActualQuantity(pickingMaterialDetailDO.getActualQuantity());
|
||||
|
||||
// 尺寸:优先使用前端传递的值(允许拣货确认时修改);否则沿用数据库值
|
||||
if (StringUtils.isNotBlank(pickingMaterialDetailDO.getSize())) {
|
||||
returnPickingMaterialDetailDO.setSize(pickingMaterialDetailDO.getSize());
|
||||
}
|
||||
|
||||
// 毛重、净重、面积、体积:如果前端传递了值,使用前端传递的值(允许修改);否则从出库单明细中自动带出
|
||||
Long outUniqueId = pickingMaterialDetailPO.getOutUniqueId();
|
||||
|
||||
+29
@@ -125,6 +125,35 @@ public class StockInOrderApplicationService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 库管角色过滤:不展示已创建(status=1)的入库单
|
||||
// 说明:部分场景下角色码可能不在 userPo.roleCode 中,而在 loginUser.roles/roleList 中。
|
||||
if (loginUser != null) {
|
||||
String targetRoleCode = "KGY-001";
|
||||
boolean isKuGuan = false;
|
||||
|
||||
String roleCode = loginUser.getUserPo() != null ? loginUser.getUserPo().getRoleCode() : null;
|
||||
if (StringUtils.isNotBlank(roleCode) && roleCode.contains(targetRoleCode)) {
|
||||
isKuGuan = true;
|
||||
}
|
||||
|
||||
if (!isKuGuan && loginUser.getRoleList() != null) {
|
||||
isKuGuan = loginUser.getRoleList().stream()
|
||||
.anyMatch(rc -> StringUtils.isNotBlank(rc) && rc.contains(targetRoleCode));
|
||||
}
|
||||
|
||||
if (!isKuGuan && loginUser.getRoles() != null) {
|
||||
isKuGuan = loginUser.getRoles().stream()
|
||||
.anyMatch(rc -> StringUtils.isNotBlank(rc) && rc.contains(targetRoleCode));
|
||||
}
|
||||
|
||||
if (isKuGuan) {
|
||||
Integer currentGtStatus = stockInOrderDO.getGtStatus();
|
||||
if (currentGtStatus == null || currentGtStatus < 1) {
|
||||
stockInOrderDO.setGtStatus(1); // status > 1
|
||||
}
|
||||
}
|
||||
}
|
||||
return stockInOrderDomainService.queryList(stockInOrderDO);
|
||||
}
|
||||
|
||||
|
||||
+30
@@ -148,6 +148,36 @@ public class StockOutOrderApplicationService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 库管角色过滤:不展示已创建(status=1)的出库单
|
||||
// 出库状态: 1-已创建 ...
|
||||
if (loginUser != null) {
|
||||
String targetRoleCode = "KGY-001";
|
||||
boolean isKuGuan = false;
|
||||
|
||||
String roleCode = loginUser.getUserPo() != null ? loginUser.getUserPo().getRoleCode() : null;
|
||||
if (StringUtils.isNotBlank(roleCode) && roleCode.contains(targetRoleCode)) {
|
||||
isKuGuan = true;
|
||||
}
|
||||
|
||||
if (!isKuGuan && loginUser.getRoleList() != null) {
|
||||
isKuGuan = loginUser.getRoleList().stream()
|
||||
.anyMatch(rc -> StringUtils.isNotBlank(rc) && rc.contains(targetRoleCode));
|
||||
}
|
||||
|
||||
if (!isKuGuan && loginUser.getRoles() != null) {
|
||||
isKuGuan = loginUser.getRoles().stream()
|
||||
.anyMatch(rc -> StringUtils.isNotBlank(rc) && rc.contains(targetRoleCode));
|
||||
}
|
||||
|
||||
if (isKuGuan) {
|
||||
Integer currentGtStatus = stockOutOrderDO.getGtStatus();
|
||||
if (currentGtStatus == null || currentGtStatus < 1) {
|
||||
stockOutOrderDO.setGtStatus(1); // status > 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<StockOutOrderPO> stockOutOrderPOS = stockOutOrderDomainService.queryList(stockOutOrderDO);
|
||||
for (StockOutOrderPO stockOutOrderPO : stockOutOrderPOS) {
|
||||
StockOutOrderPO stockOutOrderPO1 = stockOutOrderDomainService.getInfoChildren(stockOutOrderPO.getOutOrderId());
|
||||
|
||||
+2
-1
@@ -251,7 +251,7 @@ public class StockOutTaskOrderApplicationService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 为拣货作业单的物料明细填充批次属性、净重、毛重、面积、体积
|
||||
* 为拣货作业单的物料明细填充批次属性、净重、毛重、面积、体积、尺寸
|
||||
*/
|
||||
private void enrichStockOutTaskOrderWithBatchAndWeight(StockOutTaskOrderPO stockOutTaskOrderPO) {
|
||||
if (stockOutTaskOrderPO == null) {
|
||||
@@ -331,6 +331,7 @@ public class StockOutTaskOrderApplicationService {
|
||||
detail.setTotalGrossWeight(pickingDetail.getTotalGrossWeight());
|
||||
detail.setTotalVolume(pickingDetail.getTotalVolume());
|
||||
detail.setTotalArea(pickingDetail.getTotalArea());
|
||||
detail.setSize(pickingDetail.getSize());
|
||||
}
|
||||
// 批次属性(根据物料绑定且isDisplay=1动态显示,无值也可展示)
|
||||
Long materialBaseInfoId = detail.getMaterialBaseInfoId();
|
||||
|
||||
+104
-53
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mhd.common.core.constant.SnowFlakeConstants;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.enums.DictCode;
|
||||
@@ -36,6 +37,8 @@ import com.mhd.wms.domain.materialMoreDetail.service.MaterialMoreDetailDomainSer
|
||||
import com.mhd.wms.domain.receiptMaterialDetail.repository.po.ReceiptMaterialDetailPO;
|
||||
import com.mhd.wms.domain.receiptMaterialDetail.repository.todo.ReceiptMaterialDetailDO;
|
||||
import com.mhd.wms.domain.receiptMaterialDetail.service.ReceiptMaterialDetailDomainService;
|
||||
import com.mhd.wms.domain.receiptOrderAccount.entity.ReceiptOrderAccount;
|
||||
import com.mhd.wms.domain.receiptOrderAccount.repository.facade.IReceiptOrderAccountService;
|
||||
import com.mhd.wms.domain.stockInOrder.repository.todo.StockInOrderDO;
|
||||
import com.mhd.wms.domain.stockReceiptOrder.repository.po.StockReceiptOrderPO;
|
||||
import com.mhd.wms.domain.stockReceiptOrder.repository.todo.NoReceiptOrderDO;
|
||||
@@ -91,6 +94,8 @@ public class StockReceiptOrderApplicationService {
|
||||
private UserServiceFeign userServiceFeign;
|
||||
@Autowired
|
||||
private IdGenerator idGenerator;
|
||||
@Autowired
|
||||
private IReceiptOrderAccountService receiptOrderAccountService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -159,7 +164,13 @@ public class StockReceiptOrderApplicationService {
|
||||
log.warn("获取用户关联仓库信息失败,将查询所有仓库数据,用户ID:{},错误:{}", loginUser.getUserid(), e.getMessage());
|
||||
}
|
||||
}
|
||||
return stockReceiptOrderDomainService.queryList(stockReceiptOrderDO);
|
||||
List<StockReceiptOrderPO> stockReceiptOrderPOS = stockReceiptOrderDomainService.queryList(stockReceiptOrderDO);
|
||||
for (StockReceiptOrderPO stockReceiptOrderPO : stockReceiptOrderPOS) {
|
||||
Long receiptOrderId = stockReceiptOrderPO.getReceiptOrderId();
|
||||
List<ReceiptOrderAccount> accounts = receiptOrderAccountService.list(new LambdaQueryWrapper<ReceiptOrderAccount>().eq(ReceiptOrderAccount::getOrderId, receiptOrderId));
|
||||
stockReceiptOrderPO.setReceiptOrderAccountList(accounts);
|
||||
}
|
||||
return stockReceiptOrderPOS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1663,8 +1674,9 @@ public class StockReceiptOrderApplicationService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 本次收货的毛/净重、体积、面积增量:优先 receipt*;否则 total*。
|
||||
* 本次收货的毛/净重、体积、面积增量:优先 receipt*(界面本次填写);否则 total*。
|
||||
* total* 与 PC 回显对齐后可能为「累计实绩」:若 total > 本单收货前累计则增量=差;相等则 0;小于累计则视为「本次增量」原值。
|
||||
* <p>主项/子项数量各自独立:主行 {@code receiptQuantity}、子行 {@code receiptQuantity} 即用户填写的件数,不做计划比例分摊。</p>
|
||||
*/
|
||||
private static BigDecimal pickThisReceiptMetricIncrement(BigDecimal receiptField, BigDecimal totalField,
|
||||
BigDecimal dbAlreadyBeforeThisReceipt) {
|
||||
@@ -1702,6 +1714,7 @@ public class StockReceiptOrderApplicationService {
|
||||
throw new ServiceException("收货单已完成收货");
|
||||
}
|
||||
StockReceiptOrderDO returnStockReceiptOrderDO = new StockReceiptOrderDO();
|
||||
returnStockReceiptOrderDO.setReceiptOrderAccountList(stockReceiptOrderDO.getReceiptOrderAccountList());
|
||||
returnStockReceiptOrderDO.setUpdateTime(stockReceiptOrderDO.getUpdateTime());
|
||||
returnStockReceiptOrderDO.setReceiptOrderId(stockReceiptOrderPO.getReceiptOrderId());
|
||||
returnStockReceiptOrderDO.setOrganizationId(stockReceiptOrderPO.getOrganizationId());
|
||||
@@ -1747,14 +1760,49 @@ public class StockReceiptOrderApplicationService {
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
}
|
||||
// 未传 receiptQuantity 但传了称重/体积(常见于 PC 子行):仍视为有收货,否则会走「无收货」分支不写主项累计
|
||||
BigDecimal dbParentNetForGate = receiptMaterialDetailPO.getAlreadyReceiptNetWeight() != null
|
||||
? receiptMaterialDetailPO.getAlreadyReceiptNetWeight() : BigDecimal.ZERO;
|
||||
BigDecimal dbParentGrossForGate = receiptMaterialDetailPO.getAlreadyReceiptGrossWeight() != null
|
||||
? receiptMaterialDetailPO.getAlreadyReceiptGrossWeight() : BigDecimal.ZERO;
|
||||
boolean hasReceiptByMetrics = pickThisReceiptMetricIncrement(
|
||||
receiptMaterialDetailDO.getReceiptNetWeight(),
|
||||
receiptMaterialDetailDO.getTotalNetWeight(),
|
||||
dbParentNetForGate).compareTo(BigDecimal.ZERO) > 0
|
||||
|| pickThisReceiptMetricIncrement(
|
||||
receiptMaterialDetailDO.getReceiptGrossWeight(),
|
||||
receiptMaterialDetailDO.getTotalGrossWeight(),
|
||||
dbParentGrossForGate).compareTo(BigDecimal.ZERO) > 0;
|
||||
if (!hasReceiptByMetrics && !CollectionUtils.isEmpty(children)) {
|
||||
for (ReceiptMaterialDetailDO c : children) {
|
||||
if (c == null) {
|
||||
continue;
|
||||
}
|
||||
ReceiptMaterialDetailPO cdb = receiptMaterialDetailDbMap.get(c.getMaterialDetailId());
|
||||
if (cdb == null && c.getUniqueId() != null) {
|
||||
cdb = receiptMaterialDetailDbMapByUniqueId.get(c.getUniqueId());
|
||||
}
|
||||
BigDecimal cDbNet = cdb != null && cdb.getAlreadyReceiptNetWeight() != null
|
||||
? cdb.getAlreadyReceiptNetWeight() : BigDecimal.ZERO;
|
||||
BigDecimal cDbGross = cdb != null && cdb.getAlreadyReceiptGrossWeight() != null
|
||||
? cdb.getAlreadyReceiptGrossWeight() : BigDecimal.ZERO;
|
||||
if (pickThisReceiptMetricIncrement(c.getReceiptNetWeight(), c.getTotalNetWeight(), cDbNet).compareTo(BigDecimal.ZERO) > 0
|
||||
|| pickThisReceiptMetricIncrement(c.getReceiptGrossWeight(), c.getTotalGrossWeight(), cDbGross).compareTo(BigDecimal.ZERO) > 0) {
|
||||
hasReceiptByMetrics = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 主项和子项收货数量均为 0 时仍保留该明细参与流程,避免多条平铺明细被“丢失”(batchReceiptUpdate、syncUpdateInMaterialDetail 等需感知全部明细)
|
||||
boolean hasReceipt = receiptQuantity.compareTo(BigDecimal.ZERO) > 0 || childrenTotalQuantity.compareTo(BigDecimal.ZERO) > 0;
|
||||
BigDecimal mainItemActualQuantity = BigDecimal.ZERO;//主项自身当前作业收货数(不包含子项)
|
||||
BigDecimal orderLevelQuantity = BigDecimal.ZERO;//主项+子项合计,用于收货单级汇总
|
||||
boolean hasReceipt = receiptQuantity.compareTo(BigDecimal.ZERO) > 0 || childrenTotalQuantity.compareTo(BigDecimal.ZERO) > 0
|
||||
|| hasReceiptByMetrics;
|
||||
BigDecimal mainItemActualQuantity = BigDecimal.ZERO;//主项自身当前作业收货数(不含子项合计)
|
||||
List<ReceiptMaterialDetailDO> returnReceiptMaterialDetailDOChildList = new ArrayList<>();
|
||||
if (hasReceipt) {
|
||||
//判断收否收货 第一次收货创建 更多属性 序列号
|
||||
if (receiptMaterialDetailPO.getReceiptQuantity().compareTo(BigDecimal.ZERO) == 0){
|
||||
BigDecimal poReceiptQty = receiptMaterialDetailPO.getReceiptQuantity() != null
|
||||
? receiptMaterialDetailPO.getReceiptQuantity() : BigDecimal.ZERO;
|
||||
if (poReceiptQty.compareTo(BigDecimal.ZERO) == 0){
|
||||
//收货后 设置该记录不允许被修改
|
||||
receiptMaterialDetailDO.setAllowModify(2);
|
||||
//设置物料状态及容器信息
|
||||
@@ -1764,14 +1812,6 @@ public class StockReceiptOrderApplicationService {
|
||||
// 统一口径:PDA 上传的 receiptQuantity 视为“本次收货量”,不再按累计值覆盖
|
||||
BigDecimal newChildrenTotalQuantity = BigDecimal.ZERO;
|
||||
BigDecimal existingChildrenIncrement = BigDecimal.ZERO;
|
||||
BigDecimal newChildrenGrossTotal = BigDecimal.ZERO;
|
||||
BigDecimal existingChildrenGrossIncrement = BigDecimal.ZERO;
|
||||
BigDecimal newChildrenNetTotal = BigDecimal.ZERO;
|
||||
BigDecimal existingChildrenNetIncrement = BigDecimal.ZERO;
|
||||
BigDecimal newChildrenVolTotal = BigDecimal.ZERO;
|
||||
BigDecimal existingChildrenVolIncrement = BigDecimal.ZERO;
|
||||
BigDecimal newChildrenAreaTotal = BigDecimal.ZERO;
|
||||
BigDecimal existingChildrenAreaIncrement = BigDecimal.ZERO;
|
||||
List<ReceiptMaterialDetailDO> receiptMaterialDetailDOChildList = receiptMaterialDetailDO.getChildren();
|
||||
if (!CollectionUtils.isEmpty(receiptMaterialDetailDOChildList)){
|
||||
for (ReceiptMaterialDetailDO receiptMaterialDetailDOChild : receiptMaterialDetailDOChildList){
|
||||
@@ -1794,22 +1834,20 @@ public class StockReceiptOrderApplicationService {
|
||||
BigDecimal childNet = pickThisReceiptMetricIncrement(receiptMaterialDetailDOChild.getReceiptNetWeight(), receiptMaterialDetailDOChild.getTotalNetWeight(), childDbAlreadyNet);
|
||||
BigDecimal childVol = pickThisReceiptMetricIncrement(receiptMaterialDetailDOChild.getReceiptVolume(), receiptMaterialDetailDOChild.getTotalVolume(), childDbAlreadyVol);
|
||||
BigDecimal childArea = pickThisReceiptMetricIncrement(receiptMaterialDetailDOChild.getReceiptArea(), receiptMaterialDetailDOChild.getTotalArea(), childDbAlreadyArea);
|
||||
// PC 端子行常只回填 totalNetWeight/totalGrossWeight,不回传 receiptQuantity;用本次称重增量兜底为件数(与千克等重量计量物料一致)
|
||||
if (childQty.compareTo(BigDecimal.ZERO) == 0 && childNet.compareTo(BigDecimal.ZERO) > 0) {
|
||||
childQty = childNet;
|
||||
}
|
||||
if (childQty.compareTo(BigDecimal.ZERO) == 0 && childGross.compareTo(BigDecimal.ZERO) > 0) {
|
||||
childQty = childGross;
|
||||
}
|
||||
if (receiptMaterialDetailPOChildDb == null) {
|
||||
// 新子项:累加其本次收货量
|
||||
// 新子项:累加其本次收货量(毛净重体面积仅落子行,不再汇总到主行)
|
||||
newChildrenTotalQuantity = newChildrenTotalQuantity.add(childQty);
|
||||
newChildrenGrossTotal = newChildrenGrossTotal.add(childGross);
|
||||
newChildrenNetTotal = newChildrenNetTotal.add(childNet);
|
||||
newChildrenVolTotal = newChildrenVolTotal.add(childVol);
|
||||
newChildrenAreaTotal = newChildrenAreaTotal.add(childArea);
|
||||
} else {
|
||||
// 已存在子项:累加其本次收货量
|
||||
existingChildrenIncrement = existingChildrenIncrement.add(childQty);
|
||||
existingChildrenGrossIncrement = existingChildrenGrossIncrement.add(childGross);
|
||||
existingChildrenNetIncrement = existingChildrenNetIncrement.add(childNet);
|
||||
existingChildrenVolIncrement = existingChildrenVolIncrement.add(childVol);
|
||||
existingChildrenAreaIncrement = existingChildrenAreaIncrement.add(childArea);
|
||||
}
|
||||
BigDecimal childReceiptQty = receiptMaterialDetailDOChild.getReceiptQuantity() != null ? receiptMaterialDetailDOChild.getReceiptQuantity() : BigDecimal.ZERO;
|
||||
ReceiptMaterialDetailDO returnReceiptMaterialDetailDOChild = new ReceiptMaterialDetailDO();
|
||||
if (receiptMaterialDetailPOChildDb != null){
|
||||
// 子项已存在:用 DB 数据 + PDA 收货数据组装,保证不同明细独立收货不被丢失
|
||||
@@ -1842,6 +1880,9 @@ public class StockReceiptOrderApplicationService {
|
||||
returnReceiptMaterialDetailDOChild.setAlreadyReceiptNetWeight(childNet);
|
||||
returnReceiptMaterialDetailDOChild.setAlreadyReceiptVolume(childVol);
|
||||
returnReceiptMaterialDetailDOChild.setAlreadyReceiptArea(childArea);
|
||||
// 与已存在子项分支一致:累计收货数量必须显式赋值。仅从父项 copy 会得到父项已收或 0;
|
||||
// batchReceiptUpdate 内 alignPersistedReceiptQuantityToCumulative 用 alreadyReceiptQuantity 写入 receipt_quantity。
|
||||
returnReceiptMaterialDetailDOChild.setAlreadyReceiptQuantity(childQty);
|
||||
}
|
||||
// PC 端读 total*:与累计实绩一致(与 already_receipt_* 同步)
|
||||
returnReceiptMaterialDetailDOChild.setTotalNetWeight(returnReceiptMaterialDetailDOChild.getAlreadyReceiptNetWeight());
|
||||
@@ -1856,16 +1897,17 @@ public class StockReceiptOrderApplicationService {
|
||||
}
|
||||
returnReceiptMaterialDetailDOChild.setMaterialDetailSerialNumberList(receiptMaterialDetailDOChild.getMaterialDetailSerialNumberList());
|
||||
returnReceiptMaterialDetailDOChild.setMaterialMoreDetailList(receiptMaterialDetailDOChild.getMaterialMoreDetailList());
|
||||
if (returnReceiptMaterialDetailDOChild.getAlreadyReceiptQuantity() != null) {
|
||||
returnReceiptMaterialDetailDOChild.setReceiptQuantity(returnReceiptMaterialDetailDOChild.getAlreadyReceiptQuantity());
|
||||
}
|
||||
// 子项不展示/不落库计划数量(与主项计划区分),避免与主行 1100 重复
|
||||
returnReceiptMaterialDetailDOChild.setQuantity(null);
|
||||
returnReceiptMaterialDetailDOChildList.add(returnReceiptMaterialDetailDOChild);
|
||||
orderLevelQuantity = orderLevelQuantity.add(childReceiptQty);
|
||||
}
|
||||
}
|
||||
// 主项本次收货增量 = 主项 receiptQuantity(含 assignFirstChildToParentAndRemove 合并的第一条子项)+ 其余子项合计
|
||||
// 无子项时使用主项 receiptQuantity
|
||||
// 主行本次收货量 = 仅主行填写的 receiptQuantity;子项各行单独一行落库,不累加到主行 RECEIPT/ALREADY_RECEIPT
|
||||
BigDecimal childrenTotalIncrement = newChildrenTotalQuantity.add(existingChildrenIncrement);
|
||||
mainItemActualQuantity = CollectionUtils.isEmpty(receiptMaterialDetailDOChildList)
|
||||
? receiptQuantity
|
||||
: receiptQuantity.add(childrenTotalIncrement);
|
||||
mainItemActualQuantity = receiptQuantity;
|
||||
BigDecimal dbParentBeforeGross = receiptMaterialDetailPO.getAlreadyReceiptGrossWeight() != null ? receiptMaterialDetailPO.getAlreadyReceiptGrossWeight() : BigDecimal.ZERO;
|
||||
BigDecimal dbParentBeforeNet = receiptMaterialDetailPO.getAlreadyReceiptNetWeight() != null ? receiptMaterialDetailPO.getAlreadyReceiptNetWeight() : BigDecimal.ZERO;
|
||||
BigDecimal dbParentBeforeVol = receiptMaterialDetailPO.getAlreadyReceiptVolume() != null ? receiptMaterialDetailPO.getAlreadyReceiptVolume() : BigDecimal.ZERO;
|
||||
@@ -1874,24 +1916,15 @@ public class StockReceiptOrderApplicationService {
|
||||
BigDecimal parentReceiptNet = pickThisReceiptMetricIncrement(receiptMaterialDetailDO.getReceiptNetWeight(), receiptMaterialDetailDO.getTotalNetWeight(), dbParentBeforeNet);
|
||||
BigDecimal parentReceiptVol = pickThisReceiptMetricIncrement(receiptMaterialDetailDO.getReceiptVolume(), receiptMaterialDetailDO.getTotalVolume(), dbParentBeforeVol);
|
||||
BigDecimal parentReceiptArea = pickThisReceiptMetricIncrement(receiptMaterialDetailDO.getReceiptArea(), receiptMaterialDetailDO.getTotalArea(), dbParentBeforeArea);
|
||||
BigDecimal childrenGrossIncrement = newChildrenGrossTotal.add(existingChildrenGrossIncrement);
|
||||
BigDecimal childrenNetIncrement = newChildrenNetTotal.add(existingChildrenNetIncrement);
|
||||
BigDecimal childrenVolIncrement = newChildrenVolTotal.add(existingChildrenVolIncrement);
|
||||
BigDecimal childrenAreaIncrement = newChildrenAreaTotal.add(existingChildrenAreaIncrement);
|
||||
BigDecimal mainGrossIncrement = CollectionUtils.isEmpty(receiptMaterialDetailDOChildList)
|
||||
? parentReceiptGross
|
||||
: parentReceiptGross.add(childrenGrossIncrement);
|
||||
BigDecimal mainNetIncrement = CollectionUtils.isEmpty(receiptMaterialDetailDOChildList)
|
||||
? parentReceiptNet
|
||||
: parentReceiptNet.add(childrenNetIncrement);
|
||||
BigDecimal mainVolIncrement = CollectionUtils.isEmpty(receiptMaterialDetailDOChildList)
|
||||
? parentReceiptVol
|
||||
: parentReceiptVol.add(childrenVolIncrement);
|
||||
BigDecimal mainAreaIncrement = CollectionUtils.isEmpty(receiptMaterialDetailDOChildList)
|
||||
? parentReceiptArea
|
||||
: parentReceiptArea.add(childrenAreaIncrement);
|
||||
//主项已收货数量 = 原有 + 主项本次收货增量
|
||||
receiptMaterialDetailDO.setAlreadyReceiptQuantity(receiptMaterialDetailPO.getAlreadyReceiptQuantity().add(mainItemActualQuantity));
|
||||
// 主行 already_* 只累计主行本行毛净重体面积;子行各自落子行记录,避免主行重复叠加子行导致与数量口径不一致
|
||||
BigDecimal mainGrossIncrement = parentReceiptGross;
|
||||
BigDecimal mainNetIncrement = parentReceiptNet;
|
||||
BigDecimal mainVolIncrement = parentReceiptVol;
|
||||
BigDecimal mainAreaIncrement = parentReceiptArea;
|
||||
//主项已收货数量 = 原有 + 主项本次收货增量(PO 字段可能为 null,须兜底否则落库 already/receipt_quantity 为空)
|
||||
BigDecimal dbParentAlreadyQty = receiptMaterialDetailPO.getAlreadyReceiptQuantity() != null
|
||||
? receiptMaterialDetailPO.getAlreadyReceiptQuantity() : BigDecimal.ZERO;
|
||||
receiptMaterialDetailDO.setAlreadyReceiptQuantity(dbParentAlreadyQty.add(mainItemActualQuantity));
|
||||
BigDecimal dbParentAlreadyGross = receiptMaterialDetailPO.getAlreadyReceiptGrossWeight() != null ? receiptMaterialDetailPO.getAlreadyReceiptGrossWeight() : BigDecimal.ZERO;
|
||||
receiptMaterialDetailDO.setAlreadyReceiptGrossWeight(dbParentAlreadyGross.add(mainGrossIncrement));
|
||||
BigDecimal dbParentAlreadyNet = receiptMaterialDetailPO.getAlreadyReceiptNetWeight() != null ? receiptMaterialDetailPO.getAlreadyReceiptNetWeight() : BigDecimal.ZERO;
|
||||
@@ -1905,18 +1938,32 @@ public class StockReceiptOrderApplicationService {
|
||||
receiptMaterialDetailDO.setTotalGrossWeight(receiptMaterialDetailDO.getAlreadyReceiptGrossWeight());
|
||||
receiptMaterialDetailDO.setTotalVolume(receiptMaterialDetailDO.getAlreadyReceiptVolume());
|
||||
receiptMaterialDetailDO.setTotalArea(receiptMaterialDetailDO.getAlreadyReceiptArea());
|
||||
//记录本次收货单收货总数(主项+子项合计,用于收货单级统计)
|
||||
orderLevelQuantity = mainItemActualQuantity;
|
||||
// 收货单级本次实收:主行 + 所有子行(与 stock_receipt_order.actualQuantity 一致)
|
||||
BigDecimal orderLevelQuantity = mainItemActualQuantity.add(childrenTotalIncrement);
|
||||
totalActualQuantity = totalActualQuantity.add(orderLevelQuantity);
|
||||
//判断收货数量是否大于计划数量
|
||||
Integer receiptStatus = judgeReceiptQuantity(receiptMaterialDetailDO.getAlreadyReceiptQuantity(), receiptMaterialDetailPO.getQuantity());
|
||||
// 主行收货状态:按「主行+子行」合计与计划数量比较(子行无单独计划数量)
|
||||
BigDecimal groupReceived = receiptMaterialDetailDO.getAlreadyReceiptQuantity() != null
|
||||
? receiptMaterialDetailDO.getAlreadyReceiptQuantity() : BigDecimal.ZERO;
|
||||
if (!CollectionUtils.isEmpty(returnReceiptMaterialDetailDOChildList)) {
|
||||
for (ReceiptMaterialDetailDO ch : returnReceiptMaterialDetailDOChildList) {
|
||||
BigDecimal ca = ch.getAlreadyReceiptQuantity() != null ? ch.getAlreadyReceiptQuantity() : BigDecimal.ZERO;
|
||||
groupReceived = groupReceived.add(ca);
|
||||
}
|
||||
}
|
||||
Integer receiptStatus = judgeReceiptQuantity(groupReceived, receiptMaterialDetailPO.getQuantity());
|
||||
receiptMaterialDetailDO.setReceiptStatus(receiptStatus);
|
||||
if (!CollectionUtils.isEmpty(returnReceiptMaterialDetailDOChildList)) {
|
||||
for (ReceiptMaterialDetailDO ch : returnReceiptMaterialDetailDOChildList) {
|
||||
ch.setReceiptStatus(receiptStatus);
|
||||
}
|
||||
}
|
||||
if (receiptStatus > 2){
|
||||
totalActualReceiptMaterialQuantity += 1;
|
||||
}
|
||||
} else {
|
||||
// 收货为 0 的明细:保持已收货数量和状态不变,仍加入列表以保持明细完整
|
||||
receiptMaterialDetailDO.setAlreadyReceiptQuantity(receiptMaterialDetailPO.getAlreadyReceiptQuantity());
|
||||
receiptMaterialDetailDO.setAlreadyReceiptQuantity(receiptMaterialDetailPO.getAlreadyReceiptQuantity() != null
|
||||
? receiptMaterialDetailPO.getAlreadyReceiptQuantity() : BigDecimal.ZERO);
|
||||
receiptMaterialDetailDO.setAlreadyReceiptGrossWeight(receiptMaterialDetailPO.getAlreadyReceiptGrossWeight());
|
||||
receiptMaterialDetailDO.setAlreadyReceiptNetWeight(receiptMaterialDetailPO.getAlreadyReceiptNetWeight());
|
||||
receiptMaterialDetailDO.setAlreadyReceiptVolume(receiptMaterialDetailPO.getAlreadyReceiptVolume());
|
||||
@@ -1930,6 +1977,10 @@ public class StockReceiptOrderApplicationService {
|
||||
returnReceiptMaterialDetailDO.setTotalGrossWeight(receiptMaterialDetailDO.getTotalGrossWeight());
|
||||
returnReceiptMaterialDetailDO.setTotalVolume(receiptMaterialDetailDO.getTotalVolume());
|
||||
returnReceiptMaterialDetailDO.setTotalArea(receiptMaterialDetailDO.getTotalArea());
|
||||
BigDecimal parentRetAlreadyQty = receiptMaterialDetailDO.getAlreadyReceiptQuantity() != null
|
||||
? receiptMaterialDetailDO.getAlreadyReceiptQuantity() : BigDecimal.ZERO;
|
||||
returnReceiptMaterialDetailDO.setAlreadyReceiptQuantity(parentRetAlreadyQty);
|
||||
returnReceiptMaterialDetailDO.setReceiptQuantity(parentRetAlreadyQty);
|
||||
if (receiptMaterialDetailPO.getReceiptStatus() == 1){
|
||||
//一级列表 首次收货
|
||||
//是否开启了序列号管理
|
||||
|
||||
+626
-13
@@ -20,6 +20,9 @@ import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO;
|
||||
import com.mhd.system.api.domain.cache.SystemServiceCacheUtil;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.inventoryAdjustmentRecord.entity.InventoryAdjustmentRecord;
|
||||
import com.mhd.wms.domain.receiptMaterialDetail.repository.po.ReceiptMaterialDetailPO;
|
||||
import com.mhd.wms.domain.receiptMaterialDetail.repository.todo.ReceiptMaterialDetailDO;
|
||||
import com.mhd.wms.domain.receiptMaterialDetail.service.ReceiptMaterialDetailDomainService;
|
||||
import com.mhd.wms.domain.materialBarCode.repository.facade.IMaterialBarCodeService;
|
||||
import com.mhd.wms.domain.materialBarCode.repository.po.MaterialBarCodePO;
|
||||
import com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo;
|
||||
@@ -36,6 +39,9 @@ import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryM
|
||||
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO;
|
||||
import com.mhd.system.api.domain.BatchDetailFeignPO;
|
||||
import com.mhd.wms.domain.materialMoreDetail.repository.po.MaterialMoreDetailPO;
|
||||
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
|
||||
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
|
||||
import com.mhd.wms.domain.inMaterialDetail.service.InMaterialDetailDomainService;
|
||||
import com.mhd.wms.domain.shelfMaterialDetail.repository.po.ShelfMaterialDetailPO;
|
||||
import com.mhd.wms.domain.shelfMaterialDetail.repository.todo.ShelfMaterialDetailDO;
|
||||
import com.mhd.wms.domain.shelfMaterialDetail.service.ShelfMaterialDetailDomainService;
|
||||
@@ -75,6 +81,10 @@ public class StockShelfOrderApplicationService {
|
||||
@Autowired
|
||||
private ShelfMaterialDetailDomainService shelfMaterialDetailDomainService;
|
||||
@Autowired
|
||||
private InMaterialDetailDomainService inMaterialDetailDomainService;
|
||||
@Autowired
|
||||
private ReceiptMaterialDetailDomainService receiptMaterialDetailDomainService;
|
||||
@Autowired
|
||||
private UserServiceFeign userServiceFeign;
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
@@ -320,6 +330,374 @@ public class StockShelfOrderApplicationService {
|
||||
return stockShelfOrderPO;
|
||||
}
|
||||
|
||||
/**
|
||||
* PDA 获取上架单详情:可按明细 shelvesStatus 做 tab 筛选(PC 不走该接口)
|
||||
*
|
||||
* @param shelfStatus 1=待上架(仅1/2),3=已上架(3/4/5),null 返回全部明细
|
||||
*/
|
||||
public StockShelfOrderPO getInfo(Long shelfOrderId, boolean addParentCopyWhenNoChildren, Integer shelfStatus) {
|
||||
StockShelfOrderPO stockShelfOrderPO = getInfo(shelfOrderId, addParentCopyWhenNoChildren);
|
||||
if (stockShelfOrderPO == null) {
|
||||
return stockShelfOrderPO;
|
||||
}
|
||||
// 只在 PDA 场景下生效(addParentCopyWhenNoChildren==true)
|
||||
if (!addParentCopyWhenNoChildren) {
|
||||
return stockShelfOrderPO;
|
||||
}
|
||||
List<ShelfMaterialDetailPO> materialDetailList = stockShelfOrderPO.getMaterialDetailList();
|
||||
if (CollectionUtils.isEmpty(materialDetailList)) {
|
||||
return stockShelfOrderPO;
|
||||
}
|
||||
if (shelfStatus != null) {
|
||||
materialDetailList = filterShelfMaterialDetailsByShelfStatus(materialDetailList, shelfStatus);
|
||||
}
|
||||
// 已上架完成(3/4/5):主项无子项时注入的 parent_copy 与主项为同一明细,子行可能仍带「本次提交」的 shelves_quantity=0,
|
||||
// 导致「上架数量」误显示为 0;与主项对齐累计已上架数量后再做展示计算
|
||||
alignParentCopyShelfQuantityWithParentForTerminal(materialDetailList);
|
||||
// PDA 待上架数量 = 计划数量 - 已上架数量,仅接口计算(不落库)
|
||||
fillPendingShelvesQuantityRecursively(materialDetailList);
|
||||
// PDA 展示:shelvesQuantity 显示为累计已上架数量(与 receipt 口径一致);已上架完成行不再用本次提交量
|
||||
syncShelvesQuantityCumulativeDisplayRecursively(materialDetailList);
|
||||
// PDA 展示:净重/毛重/体积/面积
|
||||
// - 待上架/上架中:展示 pending = 计划 - 已上架
|
||||
// - 已上架(3/4/5):展示累计已上架(不计算 pending)
|
||||
Map<Long, WeightMetrics> planWeightMetrics = loadReceiptPlanWeightMetrics(stockShelfOrderPO.getReceiptOrderNumber());
|
||||
overwriteTotalWithPendingForPdaWeightDisplayRecursively(materialDetailList, planWeightMetrics);
|
||||
syncMaterialMoreDetailWeightValuesRecursively(materialDetailList);
|
||||
stockShelfOrderPO.setMaterialDetailList(materialDetailList);
|
||||
return stockShelfOrderPO;
|
||||
}
|
||||
|
||||
private List<ShelfMaterialDetailPO> filterShelfMaterialDetailsByShelfStatus(List<ShelfMaterialDetailPO> source, Integer shelfStatus) {
|
||||
if (CollectionUtils.isEmpty(source) || shelfStatus == null) {
|
||||
return source;
|
||||
}
|
||||
List<ShelfMaterialDetailPO> result = new ArrayList<>();
|
||||
for (ShelfMaterialDetailPO item : source) {
|
||||
if (item == null) {
|
||||
continue;
|
||||
}
|
||||
List<ShelfMaterialDetailPO> filteredChildren = filterShelfMaterialDetailsByShelfStatus(item.getChildren(), shelfStatus);
|
||||
item.setChildren(filteredChildren == null ? new ArrayList<>() : filteredChildren);
|
||||
if (matchShelfDetailStatusFilter(item.getShelvesStatus(), shelfStatus) || !CollectionUtils.isEmpty(item.getChildren())) {
|
||||
result.add(item);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean matchShelfDetailStatusFilter(Integer detailShelvesStatus, Integer requestShelfStatus) {
|
||||
if (detailShelvesStatus == null || requestShelfStatus == null) {
|
||||
return false;
|
||||
}
|
||||
if (requestShelfStatus == 1) {
|
||||
return detailShelvesStatus == 1 || detailShelvesStatus == 2;
|
||||
}
|
||||
if (requestShelfStatus == 3) {
|
||||
return detailShelvesStatus == 3 || detailShelvesStatus == 4 || detailShelvesStatus == 5;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* PDA 待上架数量递归计算:待上架数量 = max(0, 计划数量 - 已上架数量)
|
||||
*/
|
||||
private void fillPendingShelvesQuantityRecursively(List<ShelfMaterialDetailPO> list) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
for (ShelfMaterialDetailPO d : list) {
|
||||
if (d == null) {
|
||||
continue;
|
||||
}
|
||||
BigDecimal plan = d.getQuantity() != null ? d.getQuantity() : BigDecimal.ZERO;
|
||||
BigDecimal already = d.getAlreadyShelvesQuantity() != null ? d.getAlreadyShelvesQuantity() : BigDecimal.ZERO;
|
||||
BigDecimal pending = plan.subtract(already);
|
||||
if (pending.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
pending = BigDecimal.ZERO;
|
||||
}
|
||||
d.setPendingShelvesQuantity(pending);
|
||||
fillPendingShelvesQuantityRecursively(d.getChildren());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PDA:已上架完成时,将 parent_copy 子行的累计已上架数量与主项对齐(仅接口展示,不落库)。
|
||||
* 否则详情页从 children 读数时「上架数量」仍为 0。
|
||||
*/
|
||||
private void alignParentCopyShelfQuantityWithParentForTerminal(List<ShelfMaterialDetailPO> list) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
for (ShelfMaterialDetailPO parent : list) {
|
||||
if (parent == null) {
|
||||
continue;
|
||||
}
|
||||
List<ShelfMaterialDetailPO> children = parent.getChildren();
|
||||
if (!CollectionUtils.isEmpty(children)) {
|
||||
ShelfMaterialDetailPO first = children.get(0);
|
||||
if (first != null
|
||||
&& isShelfParentCopyPo(parent, first)
|
||||
&& isShelfTerminalShelvesStatus(parent.getShelvesStatus())) {
|
||||
BigDecimal pAlready = parent.getAlreadyShelvesQuantity() != null
|
||||
? parent.getAlreadyShelvesQuantity()
|
||||
: BigDecimal.ZERO;
|
||||
first.setAlreadyShelvesQuantity(pAlready);
|
||||
first.setShelvesStatus(parent.getShelvesStatus());
|
||||
}
|
||||
alignParentCopyShelfQuantityWithParentForTerminal(children);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断子项是否为 getInfo 时注入的 parent_copy(与主项同 materialDetailId 或 uniqueId)
|
||||
*/
|
||||
private static boolean isShelfParentCopyPo(ShelfMaterialDetailPO parent, ShelfMaterialDetailPO child) {
|
||||
if (parent == null || child == null) {
|
||||
return false;
|
||||
}
|
||||
Long parentId = parent.getMaterialDetailId();
|
||||
Long childId = child.getMaterialDetailId();
|
||||
Long parentUid = parent.getUniqueId();
|
||||
Long childUid = child.getUniqueId();
|
||||
if (parentId != null && parentId.equals(childId)) {
|
||||
return true;
|
||||
}
|
||||
if (parentUid != null && parentUid.equals(childUid)) {
|
||||
return true;
|
||||
}
|
||||
if (childId != null && parentId != null && !childId.equals(parentId)) {
|
||||
return false;
|
||||
}
|
||||
if (childUid != null && parentUid != null && !childUid.equals(parentUid)) {
|
||||
return false;
|
||||
}
|
||||
return childId == null && childUid == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* PDA 展示把 shelvesQuantity 改为累计已上架数量(alreadyShelvesQuantity)
|
||||
* - 不落库:仅影响接口返回
|
||||
* - 让前端“上架数量”展示字段与累计字段一致
|
||||
* - 已上架完成(3/4/5):不再使用 DB 中「本次提交」的 shelves_quantity 语义,统一为已上架数量
|
||||
*/
|
||||
private void syncShelvesQuantityCumulativeDisplayRecursively(List<ShelfMaterialDetailPO> list) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
for (ShelfMaterialDetailPO d : list) {
|
||||
if (d == null) {
|
||||
continue;
|
||||
}
|
||||
BigDecimal already = d.getAlreadyShelvesQuantity() != null ? d.getAlreadyShelvesQuantity() : BigDecimal.ZERO;
|
||||
d.setShelvesQuantity(already);
|
||||
syncShelvesQuantityCumulativeDisplayRecursively(d.getChildren());
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isShelfTerminalShelvesStatus(Integer shelvesStatus) {
|
||||
return shelvesStatus != null && (shelvesStatus == 3 || shelvesStatus == 4 || shelvesStatus == 5);
|
||||
}
|
||||
|
||||
private static class WeightMetrics {
|
||||
private BigDecimal netWeight;
|
||||
private BigDecimal grossWeight;
|
||||
private BigDecimal volume;
|
||||
private BigDecimal area;
|
||||
|
||||
private WeightMetrics(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area) {
|
||||
this.netWeight = netWeight;
|
||||
this.grossWeight = grossWeight;
|
||||
this.volume = volume;
|
||||
this.area = area;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从收货单明细加载 PDA“计划净重/毛重/体积/面积”(用于 plan - already)
|
||||
* key:
|
||||
* - receipt_material_detail.unique_id
|
||||
* - receipt_material_detail.in_unique_id(兼容部分场景只传 inUniqueId)
|
||||
*/
|
||||
private Map<Long, WeightMetrics> loadReceiptPlanWeightMetrics(String receiptOrderNumber) {
|
||||
Map<Long, WeightMetrics> result = new HashMap<>();
|
||||
if (StringUtils.isBlank(receiptOrderNumber)) {
|
||||
return result;
|
||||
}
|
||||
ReceiptMaterialDetailDO query = new ReceiptMaterialDetailDO();
|
||||
query.setReceiptOrderNumber(receiptOrderNumber);
|
||||
List<ReceiptMaterialDetailPO> list = receiptMaterialDetailDomainService.queryList(query);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return result;
|
||||
}
|
||||
for (ReceiptMaterialDetailPO p : list) {
|
||||
if (p == null || p.getUniqueId() == null) {
|
||||
continue;
|
||||
}
|
||||
WeightMetrics metrics = new WeightMetrics(
|
||||
p.getTotalNetWeight(),
|
||||
p.getTotalGrossWeight(),
|
||||
p.getTotalVolume(),
|
||||
p.getTotalArea()
|
||||
);
|
||||
// key1:收货明细 unique_id
|
||||
result.put(p.getUniqueId(), metrics);
|
||||
// key2:兼容:有些上架明细可能只带 inUniqueId
|
||||
if (p.getInUniqueId() != null) {
|
||||
result.put(p.getInUniqueId(), metrics);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void overwriteTotalWithPendingForPdaWeightDisplayRecursively(
|
||||
List<ShelfMaterialDetailPO> list,
|
||||
Map<Long, WeightMetrics> planWeightMetrics
|
||||
) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
for (ShelfMaterialDetailPO d : list) {
|
||||
if (d == null) {
|
||||
continue;
|
||||
}
|
||||
// 已上架:不覆盖,展示累计已上架实绩(与 DB 同口径)
|
||||
if (isShelfTerminalShelvesStatus(d.getShelvesStatus())) {
|
||||
// 参考收货:已完成行不参与「计划−待收」,total* 直接展示累计 already
|
||||
if (d.getAlreadyShelvesNetWeight() != null) {
|
||||
d.setTotalNetWeight(d.getAlreadyShelvesNetWeight());
|
||||
}
|
||||
if (d.getAlreadyShelvesGrossWeight() != null) {
|
||||
d.setTotalGrossWeight(d.getAlreadyShelvesGrossWeight());
|
||||
}
|
||||
if (d.getAlreadyShelvesVolume() != null) {
|
||||
d.setTotalVolume(d.getAlreadyShelvesVolume());
|
||||
}
|
||||
if (d.getAlreadyShelvesArea() != null) {
|
||||
d.setTotalArea(d.getAlreadyShelvesArea());
|
||||
}
|
||||
overwriteTotalWithPendingForPdaWeightDisplayRecursively(d.getChildren(), planWeightMetrics);
|
||||
continue;
|
||||
}
|
||||
|
||||
Long planKey = d.getReceiptUniqueId() != null ? d.getReceiptUniqueId() : d.getInUniqueId();
|
||||
WeightMetrics plan = planWeightMetrics != null && planKey != null ? planWeightMetrics.get(planKey) : null;
|
||||
BigDecimal planNet = plan != null ? plan.netWeight : null;
|
||||
BigDecimal planGross = plan != null ? plan.grossWeight : null;
|
||||
BigDecimal planVol = plan != null ? plan.volume : null;
|
||||
BigDecimal planArea = plan != null ? plan.area : null;
|
||||
|
||||
BigDecimal alreadyNet = d.getAlreadyShelvesNetWeight() != null ? d.getAlreadyShelvesNetWeight() : BigDecimal.ZERO;
|
||||
BigDecimal alreadyGross = d.getAlreadyShelvesGrossWeight() != null ? d.getAlreadyShelvesGrossWeight() : BigDecimal.ZERO;
|
||||
BigDecimal alreadyVol = d.getAlreadyShelvesVolume() != null ? d.getAlreadyShelvesVolume() : BigDecimal.ZERO;
|
||||
BigDecimal alreadyArea = d.getAlreadyShelvesArea() != null ? d.getAlreadyShelvesArea() : BigDecimal.ZERO;
|
||||
|
||||
// 参考收货:只对「有计划值」的字段覆盖 total*,否则保留原 total*
|
||||
if (planNet == null && planGross == null && planVol == null && planArea == null) {
|
||||
overwriteTotalWithPendingForPdaWeightDisplayRecursively(d.getChildren(), planWeightMetrics);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 兜底:待上架(1/2) 且已上架数量为 0 时,
|
||||
// DB 里的 total_* 可能被初始化为“计划值”,此时不应把它当作 already。
|
||||
// 按“数量为准”把 already 权重当 0,使 pending 展示为计划值。
|
||||
BigDecimal alreadyShelvesQty = d.getAlreadyShelvesQuantity() != null ? d.getAlreadyShelvesQuantity() : BigDecimal.ZERO;
|
||||
boolean hasAlreadyQty = alreadyShelvesQty.compareTo(BigDecimal.ZERO) > 0;
|
||||
if (!hasAlreadyQty) {
|
||||
alreadyNet = BigDecimal.ZERO;
|
||||
alreadyGross = BigDecimal.ZERO;
|
||||
alreadyVol = BigDecimal.ZERO;
|
||||
alreadyArea = BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
if (planNet != null) {
|
||||
d.setTotalNetWeight(calcPendingMetric(planNet, alreadyNet));
|
||||
}
|
||||
if (planGross != null) {
|
||||
d.setTotalGrossWeight(calcPendingMetric(planGross, alreadyGross));
|
||||
}
|
||||
if (planVol != null) {
|
||||
d.setTotalVolume(calcPendingMetric(planVol, alreadyVol));
|
||||
}
|
||||
if (planArea != null) {
|
||||
d.setTotalArea(calcPendingMetric(planArea, alreadyArea));
|
||||
}
|
||||
|
||||
overwriteTotalWithPendingForPdaWeightDisplayRecursively(d.getChildren(), planWeightMetrics);
|
||||
}
|
||||
}
|
||||
|
||||
private static BigDecimal calcPendingMetric(BigDecimal plan, BigDecimal already) {
|
||||
if (plan == null) {
|
||||
return null;
|
||||
}
|
||||
BigDecimal pending = plan.subtract(already != null ? already : BigDecimal.ZERO);
|
||||
if (pending.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return normalizeDecimalForApi(pending);
|
||||
}
|
||||
|
||||
private static BigDecimal normalizeDecimalForApi(BigDecimal v) {
|
||||
if (v == null) {
|
||||
return null;
|
||||
}
|
||||
if (v.compareTo(BigDecimal.ZERO) == 0) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal stripped = v.stripTrailingZeros();
|
||||
return new BigDecimal(stripped.toPlainString());
|
||||
}
|
||||
|
||||
private void syncMaterialMoreDetailWeightValuesRecursively(List<ShelfMaterialDetailPO> list) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
for (ShelfMaterialDetailPO d : list) {
|
||||
if (d == null) {
|
||||
continue;
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(d.getMaterialMoreDetailList())) {
|
||||
String netStr = d.getTotalNetWeight() != null ? d.getTotalNetWeight().toPlainString() : null;
|
||||
String grossStr = d.getTotalGrossWeight() != null ? d.getTotalGrossWeight().toPlainString() : null;
|
||||
String volStr = d.getTotalVolume() != null ? d.getTotalVolume().toPlainString() : null;
|
||||
String areaStr = d.getTotalArea() != null ? d.getTotalArea().toPlainString() : null;
|
||||
for (MaterialMoreDetailPO m : d.getMaterialMoreDetailList()) {
|
||||
if (m == null || StringUtils.isBlank(m.getBatchLabels())) {
|
||||
continue;
|
||||
}
|
||||
String labels = m.getBatchLabels().trim();
|
||||
switch (labels) {
|
||||
case "总净重":
|
||||
case "净重(KG)":
|
||||
case "净重":
|
||||
m.setAttributeValue(netStr);
|
||||
break;
|
||||
case "总毛重":
|
||||
case "毛重(KG)":
|
||||
case "毛重":
|
||||
m.setAttributeValue(grossStr);
|
||||
break;
|
||||
case "总体积":
|
||||
case "体积(CBM)":
|
||||
case "体积":
|
||||
m.setAttributeValue(volStr);
|
||||
break;
|
||||
case "总面积":
|
||||
case "面积(SQM)":
|
||||
case "面积":
|
||||
m.setAttributeValue(areaStr);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
syncMaterialMoreDetailWeightValuesRecursively(d.getChildren());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取上架单详细信息
|
||||
*/
|
||||
@@ -363,6 +741,8 @@ public class StockShelfOrderApplicationService {
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean upShelfByApp(StockShelfOrderDO stockReceiptOrderDO){
|
||||
// 标记 PDA:权重/数量都按“累计”语义处理(与收货保持一致)
|
||||
stockReceiptOrderDO.setFromApp(Boolean.TRUE);
|
||||
List<ShelfMaterialDetailDO> shelfMaterialDetailDOList = stockReceiptOrderDO.getMaterialDetailList();
|
||||
boolean firstItemHadChildrenBefore = !CollectionUtils.isEmpty(shelfMaterialDetailDOList)
|
||||
&& !CollectionUtils.isEmpty(shelfMaterialDetailDOList.get(0).getChildren());
|
||||
@@ -599,6 +979,11 @@ public class StockShelfOrderApplicationService {
|
||||
if (stockShelfOrderPO.getStatus() > 2) {
|
||||
throw new ServiceException("上架单已完成上架");
|
||||
}
|
||||
// PDA:totalNetWeight/totalGrossWeight/totalVolume/totalArea 按“增量”回传,需要累加到 DB 的 total*(不超过计划)
|
||||
boolean fromApp = Boolean.TRUE.equals(stockShelfOrderDO.getFromApp());
|
||||
Map<Long, WeightMetrics> planWeightMetrics = fromApp
|
||||
? loadReceiptPlanWeightMetrics(stockShelfOrderPO.getReceiptOrderNumber())
|
||||
: new HashMap<>();
|
||||
StockShelfOrderDO returnStockShelfOrderDO = new StockShelfOrderDO();
|
||||
BeanUtils.copyProperties(stockShelfOrderDO, returnStockShelfOrderDO);
|
||||
returnStockShelfOrderDO.setShelfOrderId(stockShelfOrderPO.getShelfOrderId());
|
||||
@@ -648,7 +1033,13 @@ public class StockShelfOrderApplicationService {
|
||||
//未进行上架直接跳过
|
||||
continue;
|
||||
}
|
||||
BigDecimal actualQuantity = BigDecimal.ZERO;//当前作业上架数
|
||||
BigDecimal mainItemActualQuantity = shelvesQuantity;//主项本次上架数(不含子项)
|
||||
BigDecimal childrenActualQuantity = BigDecimal.ZERO;//子项本次上架总数
|
||||
// PDA 权重/体积/面积:记录“本次增量”
|
||||
BigDecimal netIncrement = BigDecimal.ZERO;
|
||||
BigDecimal grossIncrement = BigDecimal.ZERO;
|
||||
BigDecimal volIncrement = BigDecimal.ZERO;
|
||||
BigDecimal areaIncrement = BigDecimal.ZERO;
|
||||
//判断收否上架 第一次收货创建 更多属性 序列号
|
||||
if (shelfMaterialDetailPO.getShelvesQuantity().compareTo(BigDecimal.ZERO) == 0){
|
||||
//设置上架信息
|
||||
@@ -657,13 +1048,28 @@ public class StockShelfOrderApplicationService {
|
||||
// setContainerInfo(shelfMaterialDetailDO);
|
||||
//上架后 设置该记录不允许被修改
|
||||
shelfMaterialDetailDO.setAllowModify(2);
|
||||
//未上过架 统计到当前收货单作业收货数
|
||||
actualQuantity = shelfMaterialDetailDO.getShelvesQuantity();
|
||||
// 未上过架:主项本次上架数量已由 shelvesQuantity 表示
|
||||
}
|
||||
//判断是否存在子项
|
||||
List<ShelfMaterialDetailDO> returnShelfMaterialDetailDOChildList = new ArrayList<>();
|
||||
List<ShelfMaterialDetailDO> shelfMaterialDetailDOChildList = shelfMaterialDetailDO.getChildren();
|
||||
if (!CollectionUtils.isEmpty(shelfMaterialDetailDOChildList)){
|
||||
// 叶子节点在第二次上架时,DB 里的 shelves_quantity 可能不为 0,
|
||||
// 旧逻辑只依赖 children 来计算 actualQuantity,导致 actualQuantity=0,
|
||||
// 从而 alreadyShelvesQuantity 不累计(覆盖问题的根因)。
|
||||
// 当没有子项时,actualQuantity 应直接等于本次上架数量 shelvesQuantity。
|
||||
if (CollectionUtils.isEmpty(shelfMaterialDetailDOChildList)) {
|
||||
mainItemActualQuantity = shelvesQuantity;
|
||||
if (fromApp) {
|
||||
// 若本次未上架数量(shelvesQuantity=0),则不允许用 PDA 提交的重量更新累计值
|
||||
// 否则会出现:数量仍为 0,但 total_* 已经被累加到计划值 => pending 全 0
|
||||
if (shelvesQuantity.compareTo(BigDecimal.ZERO) > 0) {
|
||||
netIncrement = shelfMaterialDetailDO.getTotalNetWeight() != null ? shelfMaterialDetailDO.getTotalNetWeight() : BigDecimal.ZERO;
|
||||
grossIncrement = shelfMaterialDetailDO.getTotalGrossWeight() != null ? shelfMaterialDetailDO.getTotalGrossWeight() : BigDecimal.ZERO;
|
||||
volIncrement = shelfMaterialDetailDO.getTotalVolume() != null ? shelfMaterialDetailDO.getTotalVolume() : BigDecimal.ZERO;
|
||||
areaIncrement = shelfMaterialDetailDO.getTotalArea() != null ? shelfMaterialDetailDO.getTotalArea() : BigDecimal.ZERO;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (ShelfMaterialDetailDO shelfMaterialDetailDOChild : shelfMaterialDetailDOChildList){
|
||||
ShelfMaterialDetailPO shelfMaterialDetailPOChildDb = shelfMaterialDetailDbMap.get(shelfMaterialDetailDOChild.getMaterialDetailId());
|
||||
if (shelfMaterialDetailPOChildDb == null && shelfMaterialDetailDOChild.getUniqueId() != null) {
|
||||
@@ -673,16 +1079,111 @@ public class StockShelfOrderApplicationService {
|
||||
}
|
||||
}
|
||||
BigDecimal childShelvesQty = shelfMaterialDetailDOChild.getShelvesQuantity() != null ? shelfMaterialDetailDOChild.getShelvesQuantity() : BigDecimal.ZERO;
|
||||
if (fromApp) {
|
||||
// 子项未上架数量时,不累加重量增量
|
||||
BigDecimal childNetInc = childShelvesQty.compareTo(BigDecimal.ZERO) > 0
|
||||
? (shelfMaterialDetailDOChild.getTotalNetWeight() != null ? shelfMaterialDetailDOChild.getTotalNetWeight() : BigDecimal.ZERO)
|
||||
: BigDecimal.ZERO;
|
||||
BigDecimal childGrossInc = childShelvesQty.compareTo(BigDecimal.ZERO) > 0
|
||||
? (shelfMaterialDetailDOChild.getTotalGrossWeight() != null ? shelfMaterialDetailDOChild.getTotalGrossWeight() : BigDecimal.ZERO)
|
||||
: BigDecimal.ZERO;
|
||||
BigDecimal childVolInc = childShelvesQty.compareTo(BigDecimal.ZERO) > 0
|
||||
? (shelfMaterialDetailDOChild.getTotalVolume() != null ? shelfMaterialDetailDOChild.getTotalVolume() : BigDecimal.ZERO)
|
||||
: BigDecimal.ZERO;
|
||||
BigDecimal childAreaInc = childShelvesQty.compareTo(BigDecimal.ZERO) > 0
|
||||
? (shelfMaterialDetailDOChild.getTotalArea() != null ? shelfMaterialDetailDOChild.getTotalArea() : BigDecimal.ZERO)
|
||||
: BigDecimal.ZERO;
|
||||
// 汇总父项“本次增量”
|
||||
netIncrement = netIncrement.add(childNetInc);
|
||||
grossIncrement = grossIncrement.add(childGrossInc);
|
||||
volIncrement = volIncrement.add(childVolInc);
|
||||
areaIncrement = areaIncrement.add(childAreaInc);
|
||||
}
|
||||
if (shelfMaterialDetailPOChildDb != null){
|
||||
// 子项已存在:累加上架数量,并加入返回列表供 batchShelfUpdate 更新(与收货一致,避免重复提交/漏更新)
|
||||
actualQuantity = actualQuantity.add(childShelvesQty);
|
||||
// 子项已存在:仅累计到子项总量,不能并到主项累计
|
||||
childrenActualQuantity = childrenActualQuantity.add(childShelvesQty);
|
||||
ShelfMaterialDetailDO returnShelfMaterialDetailDOChild = new ShelfMaterialDetailDO();
|
||||
BeanUtils.copyProperties(shelfMaterialDetailPOChildDb, returnShelfMaterialDetailDOChild);
|
||||
BeanUtils.copyProperties(shelfMaterialDetailDOChild, returnShelfMaterialDetailDOChild, IgnoreNullUtil.getNullPropertyNames(shelfMaterialDetailDOChild));
|
||||
BigDecimal childDbAlreadyQty = shelfMaterialDetailPOChildDb.getAlreadyShelvesQuantity() != null
|
||||
? shelfMaterialDetailPOChildDb.getAlreadyShelvesQuantity()
|
||||
: BigDecimal.ZERO;
|
||||
// PC:already_shelves_quantity 使用本次上架量;PDA 保持累计口径
|
||||
returnShelfMaterialDetailDOChild.setAlreadyShelvesQuantity(fromApp ? childDbAlreadyQty.add(childShelvesQty) : childShelvesQty);
|
||||
if (fromApp) {
|
||||
// 子项已存在:total* 回传的是“本次增量”,需要累加到已有 already(并不超过计划)
|
||||
// oldAlready:优先用 DB 的累计值 total_*。
|
||||
// 但如果 DB 历史脏数据导致 already_shelves_quantity=0 时 total_* 也被初始化成“计划值”,
|
||||
// 那么这些 total_* 不应再当作 already 基数参与累加(否则会被 min(plan, ...) 直接卡死为 plan)。
|
||||
BigDecimal childOldAlreadyQty = shelfMaterialDetailPOChildDb.getAlreadyShelvesQuantity() != null
|
||||
? shelfMaterialDetailPOChildDb.getAlreadyShelvesQuantity()
|
||||
: BigDecimal.ZERO;
|
||||
boolean childHasAlreadyQty = childOldAlreadyQty.compareTo(BigDecimal.ZERO) > 0;
|
||||
|
||||
BigDecimal childOldAlreadyNet = childHasAlreadyQty && shelfMaterialDetailPOChildDb.getTotalNetWeight() != null
|
||||
? shelfMaterialDetailPOChildDb.getTotalNetWeight()
|
||||
: BigDecimal.ZERO;
|
||||
BigDecimal childOldAlreadyGross = childHasAlreadyQty && shelfMaterialDetailPOChildDb.getTotalGrossWeight() != null
|
||||
? shelfMaterialDetailPOChildDb.getTotalGrossWeight()
|
||||
: BigDecimal.ZERO;
|
||||
BigDecimal childOldAlreadyVol = childHasAlreadyQty && shelfMaterialDetailPOChildDb.getTotalVolume() != null
|
||||
? shelfMaterialDetailPOChildDb.getTotalVolume()
|
||||
: BigDecimal.ZERO;
|
||||
BigDecimal childOldAlreadyArea = childHasAlreadyQty && shelfMaterialDetailPOChildDb.getTotalArea() != null
|
||||
? shelfMaterialDetailPOChildDb.getTotalArea()
|
||||
: BigDecimal.ZERO;
|
||||
|
||||
WeightMetrics childPlan = shelfMaterialDetailPOChildDb.getInUniqueId() != null
|
||||
? planWeightMetrics.get(shelfMaterialDetailPOChildDb.getReceiptUniqueId() != null
|
||||
? shelfMaterialDetailPOChildDb.getReceiptUniqueId()
|
||||
: shelfMaterialDetailPOChildDb.getInUniqueId())
|
||||
: null;
|
||||
|
||||
// 子项未上架数量时,不累加重量增量(保持 DB already 不变)
|
||||
BigDecimal childNetInc = childShelvesQty.compareTo(BigDecimal.ZERO) > 0
|
||||
? (shelfMaterialDetailDOChild.getTotalNetWeight() != null ? shelfMaterialDetailDOChild.getTotalNetWeight() : BigDecimal.ZERO)
|
||||
: BigDecimal.ZERO;
|
||||
BigDecimal childGrossInc = childShelvesQty.compareTo(BigDecimal.ZERO) > 0
|
||||
? (shelfMaterialDetailDOChild.getTotalGrossWeight() != null ? shelfMaterialDetailDOChild.getTotalGrossWeight() : BigDecimal.ZERO)
|
||||
: BigDecimal.ZERO;
|
||||
BigDecimal childVolInc = childShelvesQty.compareTo(BigDecimal.ZERO) > 0
|
||||
? (shelfMaterialDetailDOChild.getTotalVolume() != null ? shelfMaterialDetailDOChild.getTotalVolume() : BigDecimal.ZERO)
|
||||
: BigDecimal.ZERO;
|
||||
BigDecimal childAreaInc = childShelvesQty.compareTo(BigDecimal.ZERO) > 0
|
||||
? (shelfMaterialDetailDOChild.getTotalArea() != null ? shelfMaterialDetailDOChild.getTotalArea() : BigDecimal.ZERO)
|
||||
: BigDecimal.ZERO;
|
||||
|
||||
BigDecimal childNewAlreadyNet = childOldAlreadyNet.add(childNetInc);
|
||||
BigDecimal childNewAlreadyGross = childOldAlreadyGross.add(childGrossInc);
|
||||
BigDecimal childNewAlreadyVol = childOldAlreadyVol.add(childVolInc);
|
||||
BigDecimal childNewAlreadyArea = childOldAlreadyArea.add(childAreaInc);
|
||||
|
||||
if (childPlan != null) {
|
||||
if (childPlan.netWeight != null && childNewAlreadyNet.compareTo(childPlan.netWeight) > 0) {
|
||||
childNewAlreadyNet = childPlan.netWeight;
|
||||
}
|
||||
if (childPlan.grossWeight != null && childNewAlreadyGross.compareTo(childPlan.grossWeight) > 0) {
|
||||
childNewAlreadyGross = childPlan.grossWeight;
|
||||
}
|
||||
if (childPlan.volume != null && childNewAlreadyVol.compareTo(childPlan.volume) > 0) {
|
||||
childNewAlreadyVol = childPlan.volume;
|
||||
}
|
||||
if (childPlan.area != null && childNewAlreadyArea.compareTo(childPlan.area) > 0) {
|
||||
childNewAlreadyArea = childPlan.area;
|
||||
}
|
||||
}
|
||||
|
||||
returnShelfMaterialDetailDOChild.setTotalNetWeight(childNewAlreadyNet);
|
||||
returnShelfMaterialDetailDOChild.setTotalGrossWeight(childNewAlreadyGross);
|
||||
returnShelfMaterialDetailDOChild.setTotalVolume(childNewAlreadyVol);
|
||||
returnShelfMaterialDetailDOChild.setTotalArea(childNewAlreadyArea);
|
||||
}
|
||||
setStorageLocationInfo(returnShelfMaterialDetailDOChild);
|
||||
returnShelfMaterialDetailDOChild.setAllowModify(2);
|
||||
returnShelfMaterialDetailDOChild.setLevel(2);
|
||||
returnShelfMaterialDetailDOChild.setParentUniqueId(shelfMaterialDetailPO.getUniqueId());
|
||||
// 子项不维护独立计划数量,计划量仅由主项承载
|
||||
returnShelfMaterialDetailDOChild.setQuantity(null);
|
||||
returnShelfMaterialDetailDOChild.setActualQuantity(childShelvesQty);
|
||||
returnShelfMaterialDetailDOChildList.add(returnShelfMaterialDetailDOChild);
|
||||
continue;
|
||||
@@ -691,12 +1192,55 @@ public class StockShelfOrderApplicationService {
|
||||
BeanUtils.copyProperties(shelfMaterialDetailPO, returnShelfMaterialDetailDOChild, "materialDetailId","createBy","createByName","createTime",
|
||||
"updateBy","updateByName","updateTime");
|
||||
BeanUtils.copyProperties(shelfMaterialDetailDOChild, returnShelfMaterialDetailDOChild, IgnoreNullUtil.getNullPropertyNames(shelfMaterialDetailDOChild));
|
||||
if (fromApp) {
|
||||
// 子项不存在:new already = 0 + 本次增量(并不超过计划)
|
||||
WeightMetrics childPlan = shelfMaterialDetailDOChild.getInUniqueId() != null
|
||||
? planWeightMetrics.get(shelfMaterialDetailDOChild.getReceiptUniqueId() != null
|
||||
? shelfMaterialDetailDOChild.getReceiptUniqueId()
|
||||
: shelfMaterialDetailDOChild.getInUniqueId())
|
||||
: null;
|
||||
|
||||
// 子项未上架数量时,不允许用 PDA 提交的 total_* 更新累计重量
|
||||
BigDecimal childNewAlreadyNet = childShelvesQty.compareTo(BigDecimal.ZERO) > 0
|
||||
? (shelfMaterialDetailDOChild.getTotalNetWeight() != null ? shelfMaterialDetailDOChild.getTotalNetWeight() : BigDecimal.ZERO)
|
||||
: BigDecimal.ZERO;
|
||||
BigDecimal childNewAlreadyGross = childShelvesQty.compareTo(BigDecimal.ZERO) > 0
|
||||
? (shelfMaterialDetailDOChild.getTotalGrossWeight() != null ? shelfMaterialDetailDOChild.getTotalGrossWeight() : BigDecimal.ZERO)
|
||||
: BigDecimal.ZERO;
|
||||
BigDecimal childNewAlreadyVol = childShelvesQty.compareTo(BigDecimal.ZERO) > 0
|
||||
? (shelfMaterialDetailDOChild.getTotalVolume() != null ? shelfMaterialDetailDOChild.getTotalVolume() : BigDecimal.ZERO)
|
||||
: BigDecimal.ZERO;
|
||||
BigDecimal childNewAlreadyArea = childShelvesQty.compareTo(BigDecimal.ZERO) > 0
|
||||
? (shelfMaterialDetailDOChild.getTotalArea() != null ? shelfMaterialDetailDOChild.getTotalArea() : BigDecimal.ZERO)
|
||||
: BigDecimal.ZERO;
|
||||
|
||||
if (childPlan != null) {
|
||||
if (childPlan.netWeight != null && childNewAlreadyNet.compareTo(childPlan.netWeight) > 0) {
|
||||
childNewAlreadyNet = childPlan.netWeight;
|
||||
}
|
||||
if (childPlan.grossWeight != null && childNewAlreadyGross.compareTo(childPlan.grossWeight) > 0) {
|
||||
childNewAlreadyGross = childPlan.grossWeight;
|
||||
}
|
||||
if (childPlan.volume != null && childNewAlreadyVol.compareTo(childPlan.volume) > 0) {
|
||||
childNewAlreadyVol = childPlan.volume;
|
||||
}
|
||||
if (childPlan.area != null && childNewAlreadyArea.compareTo(childPlan.area) > 0) {
|
||||
childNewAlreadyArea = childPlan.area;
|
||||
}
|
||||
}
|
||||
returnShelfMaterialDetailDOChild.setTotalNetWeight(childNewAlreadyNet);
|
||||
returnShelfMaterialDetailDOChild.setTotalGrossWeight(childNewAlreadyGross);
|
||||
returnShelfMaterialDetailDOChild.setTotalVolume(childNewAlreadyVol);
|
||||
returnShelfMaterialDetailDOChild.setTotalArea(childNewAlreadyArea);
|
||||
}
|
||||
setStorageLocationInfo(shelfMaterialDetailDOChild);
|
||||
returnShelfMaterialDetailDOChild.setAllowModify(2);
|
||||
returnShelfMaterialDetailDOChild.setMaterialDetailSerialNumberList(shelfMaterialDetailDOChild.getMaterialDetailSerialNumberList());
|
||||
returnShelfMaterialDetailDOChild.setUniqueId(idGenerator.snowflakeId(SnowFlakeConstants.wmsId));
|
||||
returnShelfMaterialDetailDOChild.setLevel(2);
|
||||
returnShelfMaterialDetailDOChild.setParentUniqueId(shelfMaterialDetailPO.getUniqueId());
|
||||
// 子项不维护独立计划数量,计划量仅由主项承载
|
||||
returnShelfMaterialDetailDOChild.setQuantity(null);
|
||||
if (shelfMaterialDetailPO.getSerialNumberManage() == 1){
|
||||
if (CollectionUtils.isEmpty(shelfMaterialDetailPO.getMaterialDetailSerialNumberList())){
|
||||
throw new ServiceException("物料【" + shelfMaterialDetailPO.getMaterialName() + "】开启了序列号管理的序列号不能为空");
|
||||
@@ -704,17 +1248,86 @@ public class StockShelfOrderApplicationService {
|
||||
}
|
||||
returnShelfMaterialDetailDOChild.setMaterialDetailSerialNumberList(shelfMaterialDetailDO.getMaterialDetailSerialNumberList());
|
||||
returnShelfMaterialDetailDOChild.setActualQuantity(returnShelfMaterialDetailDOChild.getShelvesQuantity());
|
||||
returnShelfMaterialDetailDOChild.setAlreadyShelvesQuantity(childShelvesQty);
|
||||
returnShelfMaterialDetailDOChildList.add(returnShelfMaterialDetailDOChild);
|
||||
actualQuantity = actualQuantity.add(returnShelfMaterialDetailDOChild.getShelvesQuantity());
|
||||
childrenActualQuantity = childrenActualQuantity.add(returnShelfMaterialDetailDOChild.getShelvesQuantity());
|
||||
}
|
||||
}
|
||||
//现在已上架数量=之前已上架数量+现在作业数量
|
||||
shelfMaterialDetailDO.setAlreadyShelvesQuantity(shelfMaterialDetailPO.getAlreadyShelvesQuantity().add(actualQuantity));
|
||||
//记录本次上架单上架总数
|
||||
totalActualQuantity = totalActualQuantity.add(actualQuantity);
|
||||
//判断上架数量是否大于计划数量
|
||||
Integer shelvesStatus = judgeShelfQuantity(shelfMaterialDetailDO.getAlreadyShelvesQuantity(), shelfMaterialDetailPO.getQuantity());
|
||||
BigDecimal dbParentAlready = shelfMaterialDetailPO.getAlreadyShelvesQuantity() != null
|
||||
? shelfMaterialDetailPO.getAlreadyShelvesQuantity() : BigDecimal.ZERO;
|
||||
// PC:already_shelves_quantity 使用本次上架量;PDA 保持累计口径
|
||||
shelfMaterialDetailDO.setAlreadyShelvesQuantity(fromApp ? dbParentAlready.add(mainItemActualQuantity) : mainItemActualQuantity);
|
||||
if (fromApp) {
|
||||
// 父项:total* 回传的是“本次增量”,需要累加到已有 already(并不超过计划)
|
||||
// oldAlready:优先用 DB 的累计值 total_*。
|
||||
// 但如果 DB 历史脏数据导致 already_shelves_quantity=0 时 total_* 也被初始化成“计划值”,
|
||||
// 那么这些 total_* 不应再当作 already 基数参与累加(否则会被 min(plan, ...) 直接卡死为 plan)。
|
||||
BigDecimal oldAlreadyQty = shelfMaterialDetailPO.getAlreadyShelvesQuantity() != null
|
||||
? shelfMaterialDetailPO.getAlreadyShelvesQuantity()
|
||||
: BigDecimal.ZERO;
|
||||
boolean hasAlreadyQty = oldAlreadyQty.compareTo(BigDecimal.ZERO) > 0;
|
||||
|
||||
BigDecimal oldAlreadyNet = hasAlreadyQty && shelfMaterialDetailPO.getTotalNetWeight() != null
|
||||
? shelfMaterialDetailPO.getTotalNetWeight()
|
||||
: BigDecimal.ZERO;
|
||||
BigDecimal oldAlreadyGross = hasAlreadyQty && shelfMaterialDetailPO.getTotalGrossWeight() != null
|
||||
? shelfMaterialDetailPO.getTotalGrossWeight()
|
||||
: BigDecimal.ZERO;
|
||||
BigDecimal oldAlreadyVol = hasAlreadyQty && shelfMaterialDetailPO.getTotalVolume() != null
|
||||
? shelfMaterialDetailPO.getTotalVolume()
|
||||
: BigDecimal.ZERO;
|
||||
BigDecimal oldAlreadyArea = hasAlreadyQty && shelfMaterialDetailPO.getTotalArea() != null
|
||||
? shelfMaterialDetailPO.getTotalArea()
|
||||
: BigDecimal.ZERO;
|
||||
|
||||
BigDecimal newAlreadyNet = oldAlreadyNet.add(netIncrement);
|
||||
BigDecimal newAlreadyGross = oldAlreadyGross.add(grossIncrement);
|
||||
BigDecimal newAlreadyVol = oldAlreadyVol.add(volIncrement);
|
||||
BigDecimal newAlreadyArea = oldAlreadyArea.add(areaIncrement);
|
||||
|
||||
WeightMetrics plan = shelfMaterialDetailPO.getInUniqueId() != null
|
||||
? planWeightMetrics.get(shelfMaterialDetailPO.getReceiptUniqueId() != null
|
||||
? shelfMaterialDetailPO.getReceiptUniqueId()
|
||||
: shelfMaterialDetailPO.getInUniqueId())
|
||||
: null;
|
||||
if (plan != null) {
|
||||
if (plan.netWeight != null && newAlreadyNet.compareTo(plan.netWeight) > 0) {
|
||||
newAlreadyNet = plan.netWeight;
|
||||
}
|
||||
if (plan.grossWeight != null && newAlreadyGross.compareTo(plan.grossWeight) > 0) {
|
||||
newAlreadyGross = plan.grossWeight;
|
||||
}
|
||||
if (plan.volume != null && newAlreadyVol.compareTo(plan.volume) > 0) {
|
||||
newAlreadyVol = plan.volume;
|
||||
}
|
||||
if (plan.area != null && newAlreadyArea.compareTo(plan.area) > 0) {
|
||||
newAlreadyArea = plan.area;
|
||||
}
|
||||
}
|
||||
shelfMaterialDetailDO.setTotalNetWeight(newAlreadyNet);
|
||||
shelfMaterialDetailDO.setTotalGrossWeight(newAlreadyGross);
|
||||
shelfMaterialDetailDO.setTotalVolume(newAlreadyVol);
|
||||
shelfMaterialDetailDO.setTotalArea(newAlreadyArea);
|
||||
}
|
||||
// 记录本次上架单上架总数:主项 + 子项(与收货口径一致)
|
||||
totalActualQuantity = totalActualQuantity.add(mainItemActualQuantity.add(childrenActualQuantity));
|
||||
// 主项上架状态按「主项 + 子项」组内累计与主项计划比较(子项不单独维护计划量)
|
||||
BigDecimal groupShelved = shelfMaterialDetailDO.getAlreadyShelvesQuantity() != null
|
||||
? shelfMaterialDetailDO.getAlreadyShelvesQuantity() : BigDecimal.ZERO;
|
||||
if (!CollectionUtils.isEmpty(returnShelfMaterialDetailDOChildList)) {
|
||||
for (ShelfMaterialDetailDO ch : returnShelfMaterialDetailDOChildList) {
|
||||
BigDecimal childAlready = ch.getAlreadyShelvesQuantity() != null ? ch.getAlreadyShelvesQuantity() : BigDecimal.ZERO;
|
||||
groupShelved = groupShelved.add(childAlready);
|
||||
}
|
||||
}
|
||||
Integer shelvesStatus = judgeShelfQuantity(groupShelved, shelfMaterialDetailPO.getQuantity());
|
||||
shelfMaterialDetailDO.setShelvesStatus(shelvesStatus);
|
||||
// 子项状态与所属主项一致(主子共用主项计划量)
|
||||
if (!CollectionUtils.isEmpty(returnShelfMaterialDetailDOChildList)) {
|
||||
for (ShelfMaterialDetailDO ch : returnShelfMaterialDetailDOChildList) {
|
||||
ch.setShelvesStatus(shelvesStatus);
|
||||
}
|
||||
}
|
||||
if (shelvesStatus > 2){
|
||||
totalActualShelfMaterialQuantity += 1;
|
||||
}
|
||||
|
||||
+29
-1
@@ -336,4 +336,32 @@ public class InMaterialDetail extends BaseVOEntity {
|
||||
@ApiModelProperty("总价")
|
||||
@Excel(name = "总价")
|
||||
private BigDecimal totalPrice;
|
||||
}
|
||||
|
||||
@ApiModelProperty("合同收费")
|
||||
@Excel(name = "合同收费")
|
||||
private BigDecimal contractFee;
|
||||
|
||||
@ApiModelProperty("每月仓租")
|
||||
@Excel(name = "每月仓租")
|
||||
private BigDecimal monthlyWarehouseFee;
|
||||
|
||||
@ApiModelProperty("半月仓租")
|
||||
@Excel(name = "半月仓租")
|
||||
private BigDecimal halfMonthWhFee;
|
||||
|
||||
@ApiModelProperty("折扣(%)")
|
||||
@Excel(name = "折扣(%)")
|
||||
private BigDecimal discountRate;
|
||||
|
||||
@ApiModelProperty("单体积(CBM)")
|
||||
@Excel(name = "单体积(CBM)")
|
||||
private BigDecimal singleVolume;
|
||||
|
||||
@ApiModelProperty("单毛重(KG)")
|
||||
@Excel(name = "单毛重(KG)")
|
||||
private BigDecimal singleGrossWeight;
|
||||
|
||||
@ApiModelProperty("lot编号")
|
||||
@Excel(name = "lot编号")
|
||||
private String lotNo;
|
||||
}
|
||||
+30
-1
@@ -381,4 +381,33 @@ public class InMaterialDetailPO extends StockInOrderBasePO {
|
||||
@Excel(name = "扩展属性4")
|
||||
private String extAttr4;
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty("合同收费")
|
||||
@Excel(name = "合同收费")
|
||||
private BigDecimal contractFee;
|
||||
|
||||
@ApiModelProperty("每月仓租")
|
||||
@Excel(name = "每月仓租")
|
||||
private BigDecimal monthlyWarehouseFee;
|
||||
|
||||
@ApiModelProperty("半月仓租")
|
||||
@Excel(name = "半月仓租")
|
||||
private BigDecimal halfMonthWhFee;
|
||||
|
||||
@ApiModelProperty("折扣(%)")
|
||||
@Excel(name = "折扣(%)")
|
||||
private BigDecimal discountRate;
|
||||
|
||||
@ApiModelProperty("单体积(CBM)")
|
||||
@Excel(name = "单体积(CBM)")
|
||||
private BigDecimal singleVolume;
|
||||
|
||||
@ApiModelProperty("单毛重(KG)")
|
||||
@Excel(name = "单毛重(KG)")
|
||||
private BigDecimal singleGrossWeight;
|
||||
|
||||
@ApiModelProperty("lot编号")
|
||||
@Excel(name = "lot编号")
|
||||
private String lotNo;
|
||||
|
||||
}
|
||||
+30
-1
@@ -343,4 +343,33 @@ public class InMaterialDetailDO extends StockInOrderBaseDO {
|
||||
@ApiModelProperty("总价(输入大于等于0的数字,可以为小数)")
|
||||
@Excel(name = "总价")
|
||||
private BigDecimal totalPrice;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty("合同收费")
|
||||
@Excel(name = "合同收费")
|
||||
private BigDecimal contractFee;
|
||||
|
||||
@ApiModelProperty("每月仓租")
|
||||
@Excel(name = "每月仓租")
|
||||
private BigDecimal monthlyWarehouseFee;
|
||||
|
||||
@ApiModelProperty("半月仓租")
|
||||
@Excel(name = "半月仓租")
|
||||
private BigDecimal halfMonthWhFee;
|
||||
|
||||
@ApiModelProperty("折扣(%)")
|
||||
@Excel(name = "折扣(%)")
|
||||
private BigDecimal discountRate;
|
||||
|
||||
@ApiModelProperty("单体积(CBM)")
|
||||
@Excel(name = "单体积(CBM)")
|
||||
private BigDecimal singleVolume;
|
||||
|
||||
@ApiModelProperty("单毛重(KG)")
|
||||
@Excel(name = "单毛重(KG)")
|
||||
private BigDecimal singleGrossWeight;
|
||||
|
||||
@ApiModelProperty("lot编号")
|
||||
@Excel(name = "lot编号")
|
||||
private String lotNo;
|
||||
}
|
||||
+11
-7
@@ -150,7 +150,11 @@ public class InOrderAbnormalImpl extends ServiceImpl<InOrderAbnormalMapper, InOr
|
||||
List<InOrderAbnormal> inOrderAbnormalList = new ArrayList<>();
|
||||
for (ShelfMaterialDetail shelfMaterialDetail : shelfMaterialDetailList){
|
||||
//上架
|
||||
if (shelfMaterialDetail.getShelvesQuantity().compareTo(shelfMaterialDetail.getQuantity()) != 0&&shelfMaterialDetail.getLevel() == 1){
|
||||
BigDecimal actualShelvesQty = shelfMaterialDetail.getAlreadyShelvesQuantity() != null
|
||||
? shelfMaterialDetail.getAlreadyShelvesQuantity()
|
||||
: (shelfMaterialDetail.getShelvesQuantity() != null ? shelfMaterialDetail.getShelvesQuantity() : BigDecimal.ZERO);
|
||||
BigDecimal planQty = shelfMaterialDetail.getQuantity() != null ? shelfMaterialDetail.getQuantity() : BigDecimal.ZERO;
|
||||
if (actualShelvesQty.compareTo(planQty) != 0){
|
||||
//判断是否存在异常 根据设置的是否允许超收 取值动态赋值 先默认写死 收货异常
|
||||
InOrderAbnormal inOrderAbnormal = new InOrderAbnormal();
|
||||
//赋值基础数据
|
||||
@@ -158,19 +162,19 @@ public class InOrderAbnormalImpl extends ServiceImpl<InOrderAbnormalMapper, InOr
|
||||
//赋值物料信息
|
||||
BeanUtils.copyProperties(shelfMaterialDetail, inOrderAbnormal, IgnoreNullUtil.getNullPropertyNames(shelfMaterialDetail));
|
||||
inOrderAbnormal.setAbnormalNumber(OrderSequence.getOrderCode("SHYC"));
|
||||
if (shelfMaterialDetail.getAlreadyShelvesQuantity().compareTo(shelfMaterialDetail.getQuantity()) > 0){
|
||||
if (actualShelvesQty.compareTo(planQty) > 0){
|
||||
//上架数量大于收货数量
|
||||
inOrderAbnormal.setAbnormalType(1);
|
||||
inOrderAbnormal.setActualQuantity(shelfMaterialDetail.getShelvesQuantity());
|
||||
inOrderAbnormal.setActualQuantity(actualShelvesQty);
|
||||
inOrderAbnormal.setAbnormalReason("上架数量大于收货数量");
|
||||
}else if (shelfMaterialDetail.getAlreadyShelvesQuantity().compareTo(shelfMaterialDetail.getQuantity()) < 0){
|
||||
}else if (actualShelvesQty.compareTo(planQty) < 0){
|
||||
//上架数量小于收货数量
|
||||
inOrderAbnormal.setAbnormalType(1);
|
||||
inOrderAbnormal.setActualQuantity(shelfMaterialDetail.getShelvesQuantity());
|
||||
inOrderAbnormal.setActualQuantity(actualShelvesQty);
|
||||
inOrderAbnormal.setAbnormalReason("上架数量小于收货数量");
|
||||
}
|
||||
inOrderAbnormal.setAllowActualQuantity(shelfMaterialDetail.getQuantity());
|
||||
inOrderAbnormal.setAbnormalActualQuantity(shelfMaterialDetail.getShelvesQuantity().subtract(shelfMaterialDetail.getQuantity()));
|
||||
inOrderAbnormal.setAllowActualQuantity(planQty);
|
||||
inOrderAbnormal.setAbnormalActualQuantity(actualShelvesQty.subtract(planQty));
|
||||
inOrderAbnormal.setCreateBy(loginUser.getUserid());
|
||||
inOrderAbnormal.setCreateByName(userRealName);
|
||||
inOrderAbnormal.setCreateTime(new Date());
|
||||
|
||||
+8
@@ -188,4 +188,12 @@ public class InventoryAdjustmentRecord extends BaseVOEntity {
|
||||
@Excel(name = "调整后面积")
|
||||
private BigDecimal adjustedArea;
|
||||
|
||||
@ApiModelProperty("入库单号")
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("LOT编号")
|
||||
@Excel(name = "LOT编号")
|
||||
private String lotNumber;
|
||||
|
||||
}
|
||||
+8
@@ -244,4 +244,12 @@ public class InventoryAdjustmentRecordPO extends BaseVOEntity {
|
||||
@ApiModelProperty("调整后面积")
|
||||
@Excel(name = "调整后面积")
|
||||
private BigDecimal adjustedArea;
|
||||
|
||||
@ApiModelProperty("入库单号")
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("LOT编号")
|
||||
@Excel(name = "LOT编号")
|
||||
private String LotNumber;
|
||||
}
|
||||
+1
-1
@@ -27,7 +27,7 @@ public class MaterialBaseInfo extends BaseVOEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("物料基础信息id")
|
||||
@TableId(type = IdType.INPUT)
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long materialBaseInfoId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
|
||||
+4
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo;
|
||||
import com.mhd.wms.domain.materialBaseInfo.repository.facade.IMaterialBaseInfoService;
|
||||
@@ -82,6 +83,9 @@ public class MaterialBaseInfoImpl extends ServiceImpl<MaterialBaseInfoMapper, Ma
|
||||
@Override
|
||||
public MaterialBaseInfoPO getInfo(Long materialBaseInfoId) {
|
||||
MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectOne(new QueryWrapper<MaterialBaseInfo>().lambda().eq(MaterialBaseInfo::getMaterialBaseInfoId, materialBaseInfoId));
|
||||
if (materialBaseInfo == null) {
|
||||
throw new ServiceException("物料基础信息不存在,materialBaseInfoId=" + materialBaseInfoId);
|
||||
}
|
||||
MaterialBaseInfoPO materialBaseInfoPO = new MaterialBaseInfoPO();
|
||||
BeanUtils.copyProperties(materialBaseInfo,materialBaseInfoPO);
|
||||
return materialBaseInfoPO;
|
||||
|
||||
+2
-2
@@ -46,8 +46,8 @@ public class MaterialGoodsRuleDO extends BaseVOEntity {
|
||||
@Excel(name = "批次编码")
|
||||
private String batchCode;
|
||||
|
||||
@ApiModelProperty("批次名称")
|
||||
@Excel(name = "批次名称")
|
||||
@ApiModelProperty("批次规则")
|
||||
@Excel(name = "批次规则")
|
||||
private String batchName;
|
||||
|
||||
@ApiModelProperty("上架库区id")
|
||||
|
||||
+5
-3
@@ -111,10 +111,12 @@ public class MaterialGoodsRuleDomainService {
|
||||
* @param materialGoodsRuleDO
|
||||
*/
|
||||
private void batchParam(MaterialGoodsRuleDO materialGoodsRuleDO){
|
||||
if (ObjectUtil.isNull(materialGoodsRuleDO.getBatchId())){
|
||||
throw new ServiceException("批次信息不能为空");
|
||||
// 批次信息允许为空:batchId 为空时不做封装,直接跳过即可
|
||||
Long batchId = materialGoodsRuleDO.getBatchId();
|
||||
if (ObjectUtil.isNull(batchId) || batchId <= 0) {
|
||||
return;
|
||||
}
|
||||
AjaxResult ajaxResult = systemServiceFeign.getBatchInfoByBatchId(materialGoodsRuleDO.getBatchId());
|
||||
AjaxResult ajaxResult = systemServiceFeign.getBatchInfoByBatchId(batchId);
|
||||
if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
throw new ServiceException("获取批次信息失败");
|
||||
}
|
||||
|
||||
+9
@@ -227,4 +227,13 @@ public class MaterialInventory extends BaseVOEntity {
|
||||
@ApiModelProperty("条码")
|
||||
@Excel(name = "条码")
|
||||
private String barCode;
|
||||
|
||||
@ApiModelProperty("入库单号")
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("LOT编号")
|
||||
@Excel(name = "LOT编号")
|
||||
private String lotNumber;
|
||||
|
||||
}
|
||||
+19
-1
@@ -1,10 +1,12 @@
|
||||
package com.mhd.wms.domain.materialInventory.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.materialInventory.entity.MaterialInventory;
|
||||
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryQueryListPO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryParamDO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryParentDO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryQueryListDO;
|
||||
import com.mhd.wms.domain.statementStatistics.po.ImmediateInventoryPO;
|
||||
@@ -98,4 +100,20 @@ public interface IMaterialInventoryService extends IService<MaterialInventory>
|
||||
public BigDecimal sumInventoryQuantityByShipperAndMaterialCode(Long shipperCode, Long materialBaseInfoId);
|
||||
|
||||
MaterialInventoryPO selectOneByWhere(MaterialInventoryDO materialInventoryDO);
|
||||
}
|
||||
|
||||
/*
|
||||
* 库存调整方法
|
||||
* netWeight 总净重
|
||||
* grossWeight 总毛重
|
||||
* volume 体积
|
||||
* area 面积
|
||||
* quantity 数量
|
||||
* type 类型(1:上架2:分配3:取消分配4:出库交接5:移位6:库存调整7:库存冻结)
|
||||
* materialInventoryId 物料库存ID
|
||||
* */
|
||||
public void xgkc(MaterialInventoryParamDO materialInventoryParamDO);
|
||||
|
||||
public void kctzjl(MaterialInventory materialInventory, String orderNumber, LoginUser loginUser,
|
||||
BigDecimal oldArea, BigDecimal oldGrossWeight, BigDecimal oldNetWeight, BigDecimal oldVolume
|
||||
,BigDecimal oldInventoryQuantity, BigDecimal oldAllocationQuantity, BigDecimal oldFreezeQuantity,String adjustAction);
|
||||
}
|
||||
+527
-1
@@ -5,11 +5,18 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.inventoryAdjustmentRecord.entity.InventoryAdjustmentRecord;
|
||||
import com.mhd.wms.domain.inventoryAdjustmentRecord.repository.mapper.InventoryAdjustmentRecordMapper;
|
||||
import com.mhd.wms.domain.materialBarCode.repository.facade.IMaterialBarCodeService;
|
||||
import com.mhd.wms.domain.materialBarCode.repository.po.MaterialBarCodePO;
|
||||
import com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo;
|
||||
import com.mhd.wms.domain.materialGoodsRule.repository.facade.IMaterialGoodsRuleService;
|
||||
import com.mhd.wms.domain.materialGoodsRule.repository.po.BatchDetailPO;
|
||||
import com.mhd.wms.domain.materialGoodsRule.repository.po.BatchPO;
|
||||
@@ -20,6 +27,7 @@ import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryM
|
||||
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryQueryListPO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryParamDO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryParentDO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryQueryListDO;
|
||||
import com.mhd.wms.domain.materialBaseInfo.repository.facade.IMaterialBaseInfoService;
|
||||
@@ -52,6 +60,10 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
private MaterialInventoryMapper materialInventoryMapper;
|
||||
@Autowired
|
||||
private IMaterialBaseInfoService materialBaseInfoService;
|
||||
@Autowired
|
||||
private IMaterialBarCodeService materialBarCodeService;
|
||||
@Autowired
|
||||
private InventoryAdjustmentRecordMapper inventoryAdjustmentRecordMapper;
|
||||
|
||||
/**
|
||||
* 查询物料库存列表
|
||||
@@ -269,7 +281,9 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
+ materialInventoryDO.getBatchRefNo() + "_"
|
||||
+ materialInventoryDO.getBatchNumber() + "_"
|
||||
+ materialInventoryDO.getMaterialStatusCode() + "_"
|
||||
+ materialInventoryDO.getContainerCode();
|
||||
+ materialInventoryDO.getContainerCode() + "_"
|
||||
+ materialInventoryDO.getLotNumber() + "_"
|
||||
+ materialInventoryDO.getInOrderNumber();
|
||||
|
||||
// 注意:如果唯一性约束包含批次号、容器ID、物料状态等字段,那么key也应该包含这些字段
|
||||
// 但是,根据唯一性约束名称IDX_MAT_INV_LOC_MAT_ID,它应该只包含storage_location_id和material_base_info_id
|
||||
@@ -499,4 +513,516 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
public MaterialInventoryPO selectOneByWhere(MaterialInventoryDO materialInventoryDO) {
|
||||
return materialInventoryMapper.selectOneByWhere(materialInventoryDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void xgkc(MaterialInventoryParamDO materialInventoryParamDO) {
|
||||
BigDecimal netWeight = materialInventoryParamDO.getNetWeight() != null ? materialInventoryParamDO.getNetWeight() : BigDecimal.ZERO;
|
||||
BigDecimal grossWeight = materialInventoryParamDO.getGrossWeight() != null ? materialInventoryParamDO.getGrossWeight() : BigDecimal.ZERO;
|
||||
BigDecimal volume = materialInventoryParamDO.getVolume() != null ? materialInventoryParamDO.getVolume() : BigDecimal.ZERO;
|
||||
BigDecimal area = materialInventoryParamDO.getArea() != null ? materialInventoryParamDO.getArea() : BigDecimal.ZERO;
|
||||
BigDecimal quantity = materialInventoryParamDO.getQuantity() != null ? materialInventoryParamDO.getQuantity() : BigDecimal.ZERO;
|
||||
String type = materialInventoryParamDO.getType();
|
||||
Long materialInventoryId = materialInventoryParamDO.getMaterialInventoryId();
|
||||
|
||||
//类型(1:上架2:分配3:取消分配4:出库交接5:移位6:库存调整7:库存冻结)
|
||||
switch (type) {
|
||||
case "1":
|
||||
// 上架
|
||||
sj(netWeight, grossWeight, volume, area, quantity, materialInventoryId, materialInventoryParamDO);
|
||||
break;
|
||||
case "2":
|
||||
// 分配
|
||||
ff(netWeight, grossWeight, volume, area, quantity, materialInventoryId);
|
||||
break;
|
||||
case "3":
|
||||
// 取消分配
|
||||
qxff(netWeight, grossWeight, volume, area, quantity, materialInventoryId);
|
||||
break;
|
||||
case "4":
|
||||
// 出库交接
|
||||
ckjj(netWeight, grossWeight, volume, area, quantity, materialInventoryId);
|
||||
break;
|
||||
case "5":
|
||||
// 移位
|
||||
yw(netWeight, grossWeight, volume, area, quantity, materialInventoryId);
|
||||
break;
|
||||
case "6":
|
||||
// 库存调整
|
||||
kctz(netWeight, grossWeight, volume, area, quantity, materialInventoryId);
|
||||
break;
|
||||
case "7":
|
||||
// 库存冻结
|
||||
kcdj(netWeight, grossWeight, volume, area, quantity, materialInventoryId);
|
||||
break;
|
||||
default:
|
||||
throw new ServiceException("错误的类型");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kctzjl(MaterialInventory materialInventory, String orderNumber, LoginUser loginUser,
|
||||
BigDecimal oldArea, BigDecimal oldGrossWeight, BigDecimal oldNetWeight, BigDecimal oldVolume
|
||||
,BigDecimal oldInventoryQuantity, BigDecimal oldAllocationQuantity, BigDecimal oldFreezeQuantity,
|
||||
String adjustAction) {
|
||||
//库存调整记录
|
||||
Long materialBaseInfoId = materialInventory.getMaterialBaseInfoId();
|
||||
MaterialBaseInfo materialBaseInfo = materialBaseInfoService.getOne(new QueryWrapper<MaterialBaseInfo>().lambda()
|
||||
.eq(MaterialBaseInfo::getMaterialBaseInfoId, materialBaseInfoId).eq(BaseVOEntity::getDelFlag,1));
|
||||
InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
|
||||
inventoryAdjustmentRecord.setAdjustAction(adjustAction);
|
||||
inventoryAdjustmentRecord.setRelateNo(orderNumber);
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustBeforeStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
|
||||
inventoryAdjustmentRecord.setAdjustBeforeStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId());
|
||||
if (ObjectUtil.isNotNull(materialBaseInfo)) {
|
||||
inventoryAdjustmentRecord.setMaterialCode(materialBaseInfo.getMaterialCode());
|
||||
inventoryAdjustmentRecord.setMaterialName(materialBaseInfo.getMaterialName());
|
||||
inventoryAdjustmentRecord.setBarCode(materialBaseInfo.getBarCode());
|
||||
inventoryAdjustmentRecord.setShipperId(materialBaseInfo.getShipperId());
|
||||
inventoryAdjustmentRecord.setShipperName(materialBaseInfo.getShipperName());
|
||||
}
|
||||
if (inventoryAdjustmentRecord.getBarCode() == null || inventoryAdjustmentRecord.getBarCode().isEmpty()){
|
||||
getBarCode(materialInventory, inventoryAdjustmentRecord);
|
||||
}
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setAdjustType(1L);
|
||||
inventoryAdjustmentRecord.setOrganizationId(materialInventory.getOrganizationId());
|
||||
inventoryAdjustmentRecord.setOrganizationName(materialInventory.getOrganizationName());
|
||||
inventoryAdjustmentRecord.setTopOrganizationId(materialInventory.getTopOrganizationId());
|
||||
inventoryAdjustmentRecord.setWarehouseCode(materialInventory.getWarehouseCode());
|
||||
inventoryAdjustmentRecord.setWarehouseName(materialInventory.getWarehouseName());
|
||||
inventoryAdjustmentRecord.setWarehouseId(materialInventory.getWarehouseId());
|
||||
inventoryAdjustmentRecord.setStorageCode(materialInventory.getStorageCode());
|
||||
inventoryAdjustmentRecord.setStorageName(materialInventory.getStorageName());
|
||||
inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId());
|
||||
inventoryAdjustmentRecord.setStorageLocationCode(materialInventory.getStorageLocationCode());
|
||||
inventoryAdjustmentRecord.setStorageLocationName(materialInventory.getStorageLocationName());
|
||||
inventoryAdjustmentRecord.setMaterialInventoryId(materialInventory.getMaterialInventoryId());
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setStorageSectionId(materialInventory.getStorageSectionId());
|
||||
inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId());
|
||||
inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName());
|
||||
inventoryAdjustmentRecord.setCreateTime(new Date());
|
||||
inventoryAdjustmentRecord.setAllocationBeforeQuantity(oldAllocationQuantity);
|
||||
inventoryAdjustmentRecord.setAllocationAfterQuantity(oldAllocationQuantity);
|
||||
inventoryAdjustmentRecord.setFreezeBeforeQuantity(oldFreezeQuantity);
|
||||
inventoryAdjustmentRecord.setFreezeAfterQuantity(materialInventory.getFreezeQuantity());//调整后 冻结-出库
|
||||
inventoryAdjustmentRecord.setInventoryBeforeQuantity(oldInventoryQuantity);
|
||||
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity());
|
||||
// 调整前:库存数量(净重、毛重、体积、面积)
|
||||
inventoryAdjustmentRecord.setNetWeight(oldNetWeight);
|
||||
inventoryAdjustmentRecord.setGrossWeight(oldGrossWeight);
|
||||
inventoryAdjustmentRecord.setVolume(oldVolume);
|
||||
inventoryAdjustmentRecord.setArea(oldArea);
|
||||
// 调整后:库存数量 - 复核时填写的数量
|
||||
inventoryAdjustmentRecord.setAdjustedNetWeight(materialInventory.getNetWeight());
|
||||
inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventory.getGrossWeight());
|
||||
inventoryAdjustmentRecord.setAdjustedVolume(materialInventory.getVolume());
|
||||
inventoryAdjustmentRecord.setAdjustedArea(materialInventory.getArea());
|
||||
|
||||
inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
|
||||
}
|
||||
|
||||
private void getBarCode(MaterialInventory materialInventoryPO, InventoryAdjustmentRecord inventoryAdjustmentRecord) {
|
||||
List<MaterialBarCodePO> materialBarCodePOList = materialBarCodeService.getInfoByMaterialBaseInfoIds(materialInventoryPO.getMaterialBaseInfoId());
|
||||
if (materialBarCodePOList != null && !materialBarCodePOList.isEmpty()) {
|
||||
Map<Long, MaterialBarCodePO> collect = materialBarCodePOList.stream()
|
||||
.collect(Collectors.toMap(
|
||||
MaterialBarCodePO::getMaterialBaseInfoId,
|
||||
po -> po,
|
||||
(existing, replacement) -> existing
|
||||
));
|
||||
MaterialBarCodePO materialBarCodePO = collect.get(materialInventoryPO.getMaterialBaseInfoId());
|
||||
if (materialBarCodePO != null && materialBarCodePO.getBarCode() != null) {
|
||||
inventoryAdjustmentRecord.setBarCode(materialBarCodePO.getBarCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sj(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId,MaterialInventoryParamDO materialInventoryParamDO) {
|
||||
if (materialInventoryId == null) {
|
||||
Long materialBaseInfoId = materialInventoryParamDO.getMaterialBaseInfoId();
|
||||
MaterialBaseInfo materialBaseInfo = materialBaseInfoService.getOne(new QueryWrapper<MaterialBaseInfo>().lambda()
|
||||
.eq(MaterialBaseInfo::getMaterialBaseInfoId, materialBaseInfoId).eq(BaseVOEntity::getDelFlag,1));
|
||||
MaterialInventory materialInventory = new MaterialInventory();
|
||||
materialInventory.setInventoryQuantity(quantity);
|
||||
materialInventory.setAllocationQuantity(quantity);
|
||||
materialInventory.setFreezeQuantity(BigDecimal.ZERO);
|
||||
materialInventory.setArea(area);
|
||||
materialInventory.setVolume(volume);
|
||||
materialInventory.setGrossWeight(grossWeight);
|
||||
materialInventory.setNetWeight(netWeight);
|
||||
materialInventory.setMaterialBaseInfoId(materialInventoryParamDO.getMaterialBaseInfoId());
|
||||
materialInventory.setInOrderNumber(materialInventoryParamDO.getInOrderNumber());
|
||||
if (materialBaseInfo != null) {
|
||||
materialInventory.setShipperId(materialBaseInfo.getShipperId());
|
||||
materialInventory.setShipperName(materialBaseInfo.getShipperName());
|
||||
}
|
||||
//仓库信息
|
||||
materialInventory.setOrganizationId(materialInventoryParamDO.getOrganizationId());
|
||||
materialInventory.setOrganizationName(materialInventoryParamDO.getOrganizationName());
|
||||
materialInventory.setTopOrganizationId(materialInventoryParamDO.getTopOrganizationId());
|
||||
materialInventory.setWarehouseCode(materialInventoryParamDO.getWarehouseCode());
|
||||
materialInventory.setWarehouseName(materialInventoryParamDO.getWarehouseName());
|
||||
materialInventory.setWarehouseId(materialInventoryParamDO.getWarehouseId());
|
||||
materialInventory.setStorageCode(materialInventoryParamDO.getStorageCode());
|
||||
materialInventory.setStorageName(materialInventoryParamDO.getStorageName());
|
||||
materialInventory.setStorageLocationId(materialInventoryParamDO.getStorageLocationId());
|
||||
materialInventory.setStorageLocationCode(materialInventoryParamDO.getStorageLocationCode());
|
||||
materialInventory.setStorageLocationName(materialInventoryParamDO.getStorageLocationName());
|
||||
materialInventory.setStorageSectionId(materialInventoryParamDO.getStorageSectionId());
|
||||
//更多属性
|
||||
materialInventory.setBatchRefNo(materialInventoryParamDO.getBatchRefNo());
|
||||
materialInventory.setSheetRefNo(materialInventoryParamDO.getSheetRefNo());
|
||||
materialInventory.setBoxPalletNo(materialInventoryParamDO.getBoxPalletNo());
|
||||
materialInventory.setProductionDate(materialInventoryParamDO.getProductionDate());
|
||||
materialInventory.setExtAttr1(materialInventoryParamDO.getExtAttr1());
|
||||
materialInventory.setExtAttr2(materialInventoryParamDO.getExtAttr2());
|
||||
materialInventory.setExtAttr3(materialInventoryParamDO.getExtAttr3());
|
||||
materialInventory.setExtAttr4(materialInventoryParamDO.getExtAttr4());
|
||||
materialInventory.setExpiryDate(materialInventoryParamDO.getExpiryDate());
|
||||
materialInventory.setInventoryDate(materialInventoryParamDO.getInventoryDate());
|
||||
|
||||
materialInventoryMapper.insert(materialInventory);
|
||||
} else {
|
||||
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||
if (materialInventoryPO != null) {
|
||||
//库存数量
|
||||
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
|
||||
//可用数量
|
||||
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||
oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
|
||||
//冻结数量(出库交接不变动冻结数量)
|
||||
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
|
||||
//扣减后库存数量
|
||||
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity);
|
||||
//扣减后可用数量
|
||||
BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity);
|
||||
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity);
|
||||
|
||||
|
||||
|
||||
BigDecimal oldArea = materialInventoryPO.getArea();
|
||||
BigDecimal oldVolume = materialInventoryPO.getVolume();
|
||||
BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight();
|
||||
BigDecimal oldNetWeight = materialInventoryPO.getNetWeight();
|
||||
|
||||
// 初始化旧数据,避免空指针
|
||||
oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;
|
||||
oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO;
|
||||
oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO;
|
||||
oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO;
|
||||
|
||||
BigDecimal newArea = oldArea.add(area);
|
||||
BigDecimal newVolume = oldVolume.add(volume);
|
||||
BigDecimal newGrossWeight = oldGrossWeight.add(grossWeight);
|
||||
BigDecimal newNetWeight = oldNetWeight.add(netWeight);
|
||||
|
||||
materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||
//materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity());
|
||||
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||
materialInventoryPO.setArea(newArea);
|
||||
materialInventoryPO.setVolume(newVolume);
|
||||
materialInventoryPO.setGrossWeight(newGrossWeight);
|
||||
materialInventoryPO.setNetWeight(newNetWeight);
|
||||
MaterialInventory materialInventory = new MaterialInventory();
|
||||
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||
materialInventoryMapper.updateById(materialInventory);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ff(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
|
||||
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||
if (materialInventoryPO != null) {
|
||||
//库存数量
|
||||
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
|
||||
//可用数量
|
||||
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||
oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
|
||||
//冻结数量(出库交接不变动冻结数量)
|
||||
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
|
||||
//扣减后库存数量
|
||||
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity);
|
||||
//扣减后可用数量
|
||||
BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity);
|
||||
BigDecimal newFreezeQuantity = oldFreezeQuantity.add(quantity);
|
||||
|
||||
|
||||
|
||||
BigDecimal oldArea = materialInventoryPO.getArea();
|
||||
BigDecimal oldVolume = materialInventoryPO.getVolume();
|
||||
BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight();
|
||||
BigDecimal oldNetWeight = materialInventoryPO.getNetWeight();
|
||||
|
||||
// 初始化旧数据,避免空指针
|
||||
oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;
|
||||
oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO;
|
||||
oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO;
|
||||
oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO;
|
||||
|
||||
BigDecimal newArea = oldArea.subtract(area);
|
||||
BigDecimal newVolume = oldVolume.subtract(volume);
|
||||
BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight);
|
||||
BigDecimal newNetWeight = oldNetWeight.subtract(netWeight);
|
||||
|
||||
//materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||
materialInventoryPO.setAllocationQuantity(newAllocationQuantity);
|
||||
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||
materialInventoryPO.setArea(newArea);
|
||||
materialInventoryPO.setVolume(newVolume);
|
||||
materialInventoryPO.setGrossWeight(newGrossWeight);
|
||||
materialInventoryPO.setNetWeight(newNetWeight);
|
||||
MaterialInventory materialInventory = new MaterialInventory();
|
||||
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||
materialInventoryMapper.updateById(materialInventory);
|
||||
}
|
||||
}
|
||||
private void qxff(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
|
||||
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||
if (materialInventoryPO != null) {
|
||||
//库存数量
|
||||
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
|
||||
//可用数量
|
||||
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||
oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
|
||||
//冻结数量(出库交接不变动冻结数量)
|
||||
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
|
||||
//扣减后库存数量
|
||||
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity);
|
||||
//扣减后可用数量
|
||||
BigDecimal newAllocationQuantity = oldAllocationQuantity.add(quantity);
|
||||
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity);
|
||||
|
||||
|
||||
|
||||
BigDecimal oldArea = materialInventoryPO.getArea();
|
||||
BigDecimal oldVolume = materialInventoryPO.getVolume();
|
||||
BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight();
|
||||
BigDecimal oldNetWeight = materialInventoryPO.getNetWeight();
|
||||
|
||||
// 初始化旧数据,避免空指针
|
||||
oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;
|
||||
oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO;
|
||||
oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO;
|
||||
oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO;
|
||||
|
||||
BigDecimal newArea = oldArea.subtract(area);
|
||||
BigDecimal newVolume = oldVolume.subtract(volume);
|
||||
BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight);
|
||||
BigDecimal newNetWeight = oldNetWeight.subtract(netWeight);
|
||||
|
||||
//materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||
materialInventoryPO.setAllocationQuantity(newAllocationQuantity);
|
||||
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||
materialInventoryPO.setArea(newArea);
|
||||
materialInventoryPO.setVolume(newVolume);
|
||||
materialInventoryPO.setGrossWeight(newGrossWeight);
|
||||
materialInventoryPO.setNetWeight(newNetWeight);
|
||||
MaterialInventory materialInventory = new MaterialInventory();
|
||||
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||
materialInventoryMapper.updateById(materialInventory);
|
||||
}
|
||||
}
|
||||
private void ckjj(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
|
||||
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||
if (materialInventoryPO != null) {
|
||||
//库存数量
|
||||
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
|
||||
//可用数量
|
||||
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||
oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
|
||||
//冻结数量(出库交接不变动冻结数量)
|
||||
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
|
||||
//扣减后库存数量
|
||||
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity);
|
||||
//扣减后可用数量
|
||||
BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity);
|
||||
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity);
|
||||
|
||||
|
||||
|
||||
BigDecimal oldArea = materialInventoryPO.getArea();
|
||||
BigDecimal oldVolume = materialInventoryPO.getVolume();
|
||||
BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight();
|
||||
BigDecimal oldNetWeight = materialInventoryPO.getNetWeight();
|
||||
|
||||
// 初始化旧数据,避免空指针
|
||||
oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;
|
||||
oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO;
|
||||
oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO;
|
||||
oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO;
|
||||
|
||||
BigDecimal newArea = oldArea.subtract(area);
|
||||
BigDecimal newVolume = oldVolume.subtract(volume);
|
||||
BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight);
|
||||
BigDecimal newNetWeight = oldNetWeight.subtract(netWeight);
|
||||
|
||||
materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||
//materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity());
|
||||
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||
materialInventoryPO.setArea(newArea);
|
||||
materialInventoryPO.setVolume(newVolume);
|
||||
materialInventoryPO.setGrossWeight(newGrossWeight);
|
||||
materialInventoryPO.setNetWeight(newNetWeight);
|
||||
MaterialInventory materialInventory = new MaterialInventory();
|
||||
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||
materialInventoryMapper.updateById(materialInventory);
|
||||
}
|
||||
}
|
||||
private void yw(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
|
||||
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||
if (materialInventoryPO != null) {
|
||||
//库存数量
|
||||
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
|
||||
//可用数量
|
||||
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||
oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
|
||||
//冻结数量(出库交接不变动冻结数量)
|
||||
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
|
||||
//扣减后库存数量
|
||||
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity);
|
||||
//扣减后可用数量
|
||||
BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity);
|
||||
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity);
|
||||
|
||||
|
||||
|
||||
BigDecimal oldArea = materialInventoryPO.getArea();
|
||||
BigDecimal oldVolume = materialInventoryPO.getVolume();
|
||||
BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight();
|
||||
BigDecimal oldNetWeight = materialInventoryPO.getNetWeight();
|
||||
|
||||
// 初始化旧数据,避免空指针
|
||||
oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;
|
||||
oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO;
|
||||
oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO;
|
||||
oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO;
|
||||
|
||||
BigDecimal newArea = oldArea.subtract(area);
|
||||
BigDecimal newVolume = oldVolume.subtract(volume);
|
||||
BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight);
|
||||
BigDecimal newNetWeight = oldNetWeight.subtract(netWeight);
|
||||
|
||||
materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||
//materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity());
|
||||
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||
materialInventoryPO.setArea(newArea);
|
||||
materialInventoryPO.setVolume(newVolume);
|
||||
materialInventoryPO.setGrossWeight(newGrossWeight);
|
||||
materialInventoryPO.setNetWeight(newNetWeight);
|
||||
MaterialInventory materialInventory = new MaterialInventory();
|
||||
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||
materialInventoryMapper.updateById(materialInventory);
|
||||
}
|
||||
}
|
||||
private void kctz(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
|
||||
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||
if (materialInventoryPO != null) {
|
||||
//库存数量
|
||||
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
|
||||
//可用数量
|
||||
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||
oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
|
||||
//冻结数量(出库交接不变动冻结数量)
|
||||
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
|
||||
//扣减后库存数量
|
||||
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity);
|
||||
//扣减后可用数量
|
||||
BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity);
|
||||
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity);
|
||||
|
||||
|
||||
|
||||
BigDecimal oldArea = materialInventoryPO.getArea();
|
||||
BigDecimal oldVolume = materialInventoryPO.getVolume();
|
||||
BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight();
|
||||
BigDecimal oldNetWeight = materialInventoryPO.getNetWeight();
|
||||
|
||||
// 初始化旧数据,避免空指针
|
||||
oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;
|
||||
oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO;
|
||||
oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO;
|
||||
oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO;
|
||||
|
||||
BigDecimal newArea = oldArea.subtract(area);
|
||||
BigDecimal newVolume = oldVolume.subtract(volume);
|
||||
BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight);
|
||||
BigDecimal newNetWeight = oldNetWeight.subtract(netWeight);
|
||||
|
||||
materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||
//materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity());
|
||||
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||
materialInventoryPO.setArea(newArea);
|
||||
materialInventoryPO.setVolume(newVolume);
|
||||
materialInventoryPO.setGrossWeight(newGrossWeight);
|
||||
materialInventoryPO.setNetWeight(newNetWeight);
|
||||
MaterialInventory materialInventory = new MaterialInventory();
|
||||
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||
materialInventoryMapper.updateById(materialInventory);
|
||||
}
|
||||
}
|
||||
private void kcdj(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
|
||||
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||
if (materialInventoryPO != null) {
|
||||
//库存数量
|
||||
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
|
||||
//可用数量
|
||||
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||
oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
|
||||
//冻结数量(出库交接不变动冻结数量)
|
||||
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
|
||||
//扣减后库存数量
|
||||
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity);
|
||||
//扣减后可用数量
|
||||
BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity);
|
||||
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity);
|
||||
|
||||
|
||||
|
||||
BigDecimal oldArea = materialInventoryPO.getArea();
|
||||
BigDecimal oldVolume = materialInventoryPO.getVolume();
|
||||
BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight();
|
||||
BigDecimal oldNetWeight = materialInventoryPO.getNetWeight();
|
||||
|
||||
// 初始化旧数据,避免空指针
|
||||
oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;
|
||||
oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO;
|
||||
oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO;
|
||||
oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO;
|
||||
|
||||
BigDecimal newArea = oldArea.subtract(area);
|
||||
BigDecimal newVolume = oldVolume.subtract(volume);
|
||||
BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight);
|
||||
BigDecimal newNetWeight = oldNetWeight.subtract(netWeight);
|
||||
|
||||
materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||
//materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity());
|
||||
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||
materialInventoryPO.setArea(newArea);
|
||||
materialInventoryPO.setVolume(newVolume);
|
||||
materialInventoryPO.setGrossWeight(newGrossWeight);
|
||||
materialInventoryPO.setNetWeight(newNetWeight);
|
||||
MaterialInventory materialInventory = new MaterialInventory();
|
||||
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||
materialInventoryMapper.updateById(materialInventory);
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -221,4 +221,12 @@ public class MaterialInventoryPO extends MaterialBasePO {
|
||||
@ApiModelProperty("条码")
|
||||
@Excel(name = "条码")
|
||||
private String barCode;
|
||||
|
||||
@ApiModelProperty("入库单号")
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("LOT编号")
|
||||
@Excel(name = "LOT编号")
|
||||
private String lotNumber;
|
||||
}
|
||||
+8
@@ -236,4 +236,12 @@ public class MaterialInventoryDO extends MaterialBaseDO {
|
||||
@ApiModelProperty("冻结数量大于0条件")
|
||||
@Excel(name = "冻结数量大于0条件")
|
||||
private String greaterThanFreezeQuantity;
|
||||
|
||||
@ApiModelProperty("入库单号")
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("LOT编号")
|
||||
@Excel(name = "LOT编号")
|
||||
private String lotNumber;
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package com.mhd.wms.domain.materialInventory.repository.todo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.wms.domain.materialBaseInfo.repository.todo.MaterialBaseDO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 物料库存对象 material_inventory
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-29
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class MaterialInventoryParamDO extends MaterialBaseDO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
//库存id
|
||||
private Long materialInventoryId;
|
||||
//物料基础信息id
|
||||
private Long materialBaseInfoId;
|
||||
//物料明细ID
|
||||
private Long materialDetailId;
|
||||
|
||||
//仓库信息参数
|
||||
private Long organizationId;
|
||||
private String organizationName;
|
||||
private Long topOrganizationId;
|
||||
//仓库ID
|
||||
private Long warehouseId;
|
||||
//仓库编码
|
||||
private String warehouseCode;
|
||||
//仓库名称
|
||||
private String warehouseName;
|
||||
//存储区ID
|
||||
private Long storageSectionId;
|
||||
//存储区编码
|
||||
private String storageCode;
|
||||
//存储区名称
|
||||
private String storageName;
|
||||
//存储位置ID
|
||||
private Long storageLocationId;
|
||||
//存储位置编码
|
||||
private String storageLocationCode;
|
||||
//存储位置名称
|
||||
private String storageLocationName;
|
||||
|
||||
|
||||
//调整参数
|
||||
|
||||
//调整数量
|
||||
private BigDecimal quantity;
|
||||
//净重
|
||||
private BigDecimal netWeight;
|
||||
//毛重
|
||||
private BigDecimal grossWeight;
|
||||
//体积
|
||||
private BigDecimal volume;
|
||||
//面积
|
||||
private BigDecimal area;
|
||||
//类型(1:上架2:分配3:取消分配4:出库交接5:移位6:库存调整7:库存冻结)
|
||||
private String type;
|
||||
|
||||
|
||||
|
||||
|
||||
//更多属性
|
||||
private String batchRefNo;
|
||||
private String sheetRefNo;
|
||||
//箱码
|
||||
private String boxPalletNo;
|
||||
//扩展字段2
|
||||
private String extAttr1;
|
||||
//扩展字段1
|
||||
private String extAttr2;
|
||||
//生产日期
|
||||
private Date productionDate;
|
||||
//过期日期
|
||||
private Date expiryDate;
|
||||
//库存日期
|
||||
private Date inventoryDate;
|
||||
//扩展字段3
|
||||
private Date extAttr3;
|
||||
//扩展字段4
|
||||
private Date extAttr4;
|
||||
|
||||
|
||||
private String inOrderNumber;
|
||||
|
||||
private String lotNumber;
|
||||
|
||||
}
|
||||
+15
@@ -68,6 +68,11 @@ public class PickingMaterialDetail extends BaseVOEntity {
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
@TableField("SIZE")
|
||||
private String size;
|
||||
|
||||
@ApiModelProperty("净重 单位:千克")
|
||||
@Excel(name = "净重 单位:千克")
|
||||
private BigDecimal weightLimit;
|
||||
@@ -264,4 +269,14 @@ public class PickingMaterialDetail extends BaseVOEntity {
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private BigDecimal totalArea;
|
||||
|
||||
@ApiModelProperty("装卸费")
|
||||
@Excel(name = "装卸费")
|
||||
@TableField(exist = false)
|
||||
private BigDecimal loadUnloadFee;
|
||||
|
||||
@ApiModelProperty("贴标费")
|
||||
@Excel(name = "贴标费")
|
||||
@TableField(exist = false)
|
||||
private BigDecimal stickerFee;
|
||||
}
|
||||
+6
@@ -165,6 +165,12 @@ public class PickingMaterialDetailImpl extends ServiceImpl<PickingMaterialDetail
|
||||
pickingMaterialDetail.setTotalGrossWeight(pickingMaterialDetailDO.getTotalGrossWeight());
|
||||
pickingMaterialDetail.setUnitCode(pickingMaterialDetailDO.getUnitCode());
|
||||
pickingMaterialDetail.setUnitName(pickingMaterialDetailDO.getUnitName());
|
||||
// 尺寸字段(SIZE):拣货确认时允许同步更新
|
||||
if (pickingMaterialDetailDO.getSize() != null) {
|
||||
pickingMaterialDetail.setSize(pickingMaterialDetailDO.getSize());
|
||||
}
|
||||
pickingMaterialDetail.setLoadUnloadFee(pickingMaterialDetailDO.getLoadUnloadFee());
|
||||
pickingMaterialDetail.setStickerFee(pickingMaterialDetailDO.getStickerFee());
|
||||
BigDecimal actualQuantity = pickingMaterialDetailDO.getActualQuantity();
|
||||
pickingMaterialDetail.setPickingQuantity(actualQuantity);
|
||||
pickingMaterialDetailList.add(pickingMaterialDetail);
|
||||
|
||||
+12
@@ -71,6 +71,10 @@ public class PickingMaterialDetailPO extends BaseVOEntity {
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String size;
|
||||
|
||||
@ApiModelProperty("净重 单位:千克")
|
||||
@Excel(name = "净重 单位:千克")
|
||||
private BigDecimal weightLimit;
|
||||
@@ -278,4 +282,12 @@ public class PickingMaterialDetailPO extends BaseVOEntity {
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private BigDecimal totalArea;
|
||||
|
||||
@ApiModelProperty("装卸费")
|
||||
@Excel(name = "装卸费")
|
||||
private BigDecimal loadUnloadFee;
|
||||
|
||||
@ApiModelProperty("贴标费")
|
||||
@Excel(name = "贴标费")
|
||||
private BigDecimal stickerFee;
|
||||
}
|
||||
+12
@@ -66,6 +66,10 @@ public class PickingMaterialDetailDO extends BaseVOEntity {
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String size;
|
||||
|
||||
@ApiModelProperty("净重 单位:千克")
|
||||
@Excel(name = "净重 单位:千克")
|
||||
private BigDecimal weightLimit;
|
||||
@@ -279,4 +283,12 @@ public class PickingMaterialDetailDO extends BaseVOEntity {
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private BigDecimal totalArea;
|
||||
|
||||
@ApiModelProperty("装卸费")
|
||||
@Excel(name = "装卸费")
|
||||
private BigDecimal loadUnloadFee;
|
||||
|
||||
@ApiModelProperty("贴标费")
|
||||
@Excel(name = "贴标费")
|
||||
private BigDecimal stickerFee;
|
||||
}
|
||||
+12
-9
@@ -526,15 +526,18 @@ public class PickingOrderDomainService {
|
||||
stockOutTaskOrderDO.setSerialNumber(OrderSequence.getOrderCode("JHZYLS"));
|
||||
stockOutTaskOrderDO.setTaskNumber(OrderSequence.getOrderCode("JHZY"));
|
||||
stockOutTaskOrderDO.setType(1);//按单
|
||||
stockOutTaskOrderDO.setWarehouseId(pickingOrderDO.getWarehouseId());
|
||||
stockOutTaskOrderDO.setWarehouseCode(pickingOrderDO.getWarehouseCode());
|
||||
stockOutTaskOrderDO.setWarehouseName(pickingOrderDO.getWarehouseName());
|
||||
stockOutTaskOrderDO.setStorageSectionId(pickingOrderDO.getStorageSectionId());
|
||||
stockOutTaskOrderDO.setStorageCode(pickingOrderDO.getStorageCode());
|
||||
stockOutTaskOrderDO.setStorageName(pickingOrderDO.getStorageName());
|
||||
stockOutTaskOrderDO.setStorageLocationId(pickingOrderDO.getStorageLocationId());
|
||||
stockOutTaskOrderDO.setStorageLocationCode(pickingOrderDO.getStorageLocationCode());
|
||||
stockOutTaskOrderDO.setStorageLocationName(pickingOrderDO.getStorageLocationName());
|
||||
// 集货位选填:仅在请求中传入集货位时,才覆盖任务单的库位信息
|
||||
if (pickingOrderDO.getStorageLocationId() != null) {
|
||||
stockOutTaskOrderDO.setWarehouseId(pickingOrderDO.getWarehouseId());
|
||||
stockOutTaskOrderDO.setWarehouseCode(pickingOrderDO.getWarehouseCode());
|
||||
stockOutTaskOrderDO.setWarehouseName(pickingOrderDO.getWarehouseName());
|
||||
stockOutTaskOrderDO.setStorageSectionId(pickingOrderDO.getStorageSectionId());
|
||||
stockOutTaskOrderDO.setStorageCode(pickingOrderDO.getStorageCode());
|
||||
stockOutTaskOrderDO.setStorageName(pickingOrderDO.getStorageName());
|
||||
stockOutTaskOrderDO.setStorageLocationId(pickingOrderDO.getStorageLocationId());
|
||||
stockOutTaskOrderDO.setStorageLocationCode(pickingOrderDO.getStorageLocationCode());
|
||||
stockOutTaskOrderDO.setStorageLocationName(pickingOrderDO.getStorageLocationName());
|
||||
}
|
||||
stockOutTaskOrderDO.setOperatorsBy(pickingOrderDO.getOperatorsBy());
|
||||
stockOutTaskOrderDO.setOperatorsName(pickingOrderDO.getOperatorsName());
|
||||
List<PickingMaterialDetail> pickingMaterialDetailDbList = pickingMaterialDetailMap.get(pickingOrderPO.getPickingOrderNumber());
|
||||
|
||||
+1
-1
@@ -332,7 +332,7 @@ public class ReceiptMaterialDetail extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
@TableField(exist = false)
|
||||
@TableField("dimensions")
|
||||
private String dimensions;
|
||||
|
||||
@ApiModelProperty("箱数")
|
||||
|
||||
+4
@@ -72,6 +72,10 @@ public class ReceiptMaterialDetailPO extends BaseVOEntity {
|
||||
@Excel(name = "规格型号")
|
||||
private String specificationModel;
|
||||
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String dimensions;
|
||||
|
||||
@ApiModelProperty("计划数量")
|
||||
@Excel(name = "计划数量")
|
||||
private BigDecimal quantity;
|
||||
|
||||
+4
@@ -70,6 +70,10 @@ public class ReceiptMaterialDetailDO extends BaseVOEntity {
|
||||
@Excel(name = "规格型号")
|
||||
private String specificationModel;
|
||||
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String dimensions;
|
||||
|
||||
@ApiModelProperty("计划数量")
|
||||
@Excel(name = "计划数量")
|
||||
private BigDecimal quantity;
|
||||
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
package com.mhd.wms.domain.receiptOrderAccount.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Data
|
||||
public class ReceiptOrderAccount extends BaseVOEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ID_WORKER_STR)
|
||||
private String id;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
@Excel(name = "创建人", width = 15)
|
||||
private Long createBy;
|
||||
/**创建日期*/
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
@Excel(name = "创建日期", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
@Excel(name = "更新人", width = 15)
|
||||
private Long updateBy;
|
||||
/**更新日期*/
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
@Excel(name = "更新日期", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
@Excel(name = "所属部门", width = 15)
|
||||
private String sysOrgCode;
|
||||
/**删除标识*/
|
||||
@ApiModelProperty(value = "删除标识")
|
||||
@Excel(name = "删除标识", width = 15)
|
||||
private Integer isDelete;
|
||||
/**所属组织*/
|
||||
@ApiModelProperty(value = "所属组织")
|
||||
@Excel(name = "所属组织", width = 15)
|
||||
private String orgName;
|
||||
/**组织ID*/
|
||||
@ApiModelProperty(value = "组织ID")
|
||||
@Excel(name = "组织ID", width = 15)
|
||||
private Long organizationId;
|
||||
/**一级组织ID*/
|
||||
@ApiModelProperty(value = "一级组织ID")
|
||||
@Excel(name = "一级组织ID", width = 15)
|
||||
private Long topOrganizationId;
|
||||
/**组织名称*/
|
||||
@ApiModelProperty(value = "组织名称")
|
||||
@Excel(name = "组织名称", width = 15)
|
||||
private String organizationName;
|
||||
/**订单id*/
|
||||
@ApiModelProperty(value = "订单id")
|
||||
@Excel(name = "订单id", width = 15)
|
||||
private Long orderId;
|
||||
/**科目id*/
|
||||
@ApiModelProperty(value = "科目id")
|
||||
@Excel(name = "科目id", width = 15)
|
||||
private Long accountId;
|
||||
/**科目收支类型(1-应收,2-应付*/
|
||||
@ApiModelProperty(value = "科目收支类型(1-应收,2-应付")
|
||||
@Excel(name = "科目收支类型(1-应收,2-应付", width = 15)
|
||||
private Long accountType;
|
||||
/**科目编码*/
|
||||
@ApiModelProperty(value = "科目编码")
|
||||
@Excel(name = "科目编码", width = 15)
|
||||
private String subjectCode;
|
||||
/**科目名称*/
|
||||
@ApiModelProperty(value = "科目名称")
|
||||
@Excel(name = "科目名称", width = 15)
|
||||
private String subjectName;
|
||||
/**费用类别*/
|
||||
@ApiModelProperty(value = "费用类别")
|
||||
@Excel(name = "费用类别", width = 15)
|
||||
private String serviceItemsCode;
|
||||
/**费用类别*/
|
||||
@ApiModelProperty(value = "费用类别")
|
||||
@Excel(name = "费用类别", width = 15)
|
||||
private String serviceItemsName;
|
||||
/**科目费率*/
|
||||
@ApiModelProperty(value = "科目费率")
|
||||
@Excel(name = "科目费率", width = 15)
|
||||
private BigDecimal rate;
|
||||
|
||||
/**金额*/
|
||||
@ApiModelProperty(value = "金额")
|
||||
@Excel(name = "金额", width = 15)
|
||||
private BigDecimal amount;
|
||||
@ApiModelProperty(value = "计算金额")
|
||||
@Excel(name = "计算金额", width = 15)
|
||||
private BigDecimal settlementAmount;
|
||||
|
||||
@ApiModelProperty(value = "数量")
|
||||
@Excel(name = "数量", width = 15)
|
||||
private BigDecimal num;
|
||||
|
||||
@ApiModelProperty(value = "单价")
|
||||
@Excel(name = "单价", width = 15)
|
||||
private BigDecimal price;
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.mhd.wms.domain.receiptOrderAccount.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.wms.domain.receiptOrderAccount.entity.ReceiptOrderAccount;
|
||||
|
||||
public interface IReceiptOrderAccountService extends IService<ReceiptOrderAccount>
|
||||
{
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.mhd.wms.domain.receiptOrderAccount.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.wms.domain.receiptOrderAccount.entity.ReceiptOrderAccount;
|
||||
|
||||
public interface ReceiptOrderAccountMapper extends BaseMapper<ReceiptOrderAccount>
|
||||
{
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.mhd.wms.domain.receiptOrderAccount.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.wms.domain.receiptOrderAccount.entity.ReceiptOrderAccount;
|
||||
import com.mhd.wms.domain.receiptOrderAccount.repository.facade.IReceiptOrderAccountService;
|
||||
import com.mhd.wms.domain.receiptOrderAccount.repository.mapper.ReceiptOrderAccountMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ReceiptOrderAccountServiceImpl extends ServiceImpl<ReceiptOrderAccountMapper, ReceiptOrderAccount> implements IReceiptOrderAccountService {
|
||||
}
|
||||
+29
@@ -68,6 +68,11 @@ public class ShelfMaterialDetail extends BaseVOEntity {
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
@TableField("dimensions")
|
||||
private String dimensions;
|
||||
|
||||
@ApiModelProperty("计划数量")
|
||||
@Excel(name = "计划数量")
|
||||
private BigDecimal quantity;
|
||||
@@ -314,15 +319,39 @@ public class ShelfMaterialDetail extends BaseVOEntity {
|
||||
@Excel(name = "总净重(KG)")
|
||||
private BigDecimal totalNetWeight;
|
||||
|
||||
@ApiModelProperty("累计已上架净重(KG),与 totalNetWeight 同口径累加本次净重")
|
||||
@TableField("total_net_weight")
|
||||
private BigDecimal alreadyShelvesNetWeight;
|
||||
|
||||
@ApiModelProperty("总毛重(KG)")
|
||||
@Excel(name = "总毛重(KG)")
|
||||
private BigDecimal totalGrossWeight;
|
||||
|
||||
@ApiModelProperty("累计已上架毛重(KG),与 totalGrossWeight 同口径累加本次毛重")
|
||||
@TableField("total_gross_weight")
|
||||
private BigDecimal alreadyShelvesGrossWeight;
|
||||
|
||||
@ApiModelProperty("总体积(CBM)")
|
||||
@Excel(name = "总体积(CBM)")
|
||||
private BigDecimal totalVolume;
|
||||
|
||||
@ApiModelProperty("累计已上架体积(CBM),与 totalVolume 同口径累加本次体积")
|
||||
@TableField("total_volume")
|
||||
private BigDecimal alreadyShelvesVolume;
|
||||
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private BigDecimal totalArea;
|
||||
|
||||
@ApiModelProperty("入库单号")
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("LOT编号")
|
||||
@Excel(name = "LOT编号")
|
||||
private String lotNumber;
|
||||
|
||||
@ApiModelProperty("累计已上架面积(SQM),与 totalArea 同口径累加本次面积")
|
||||
@TableField("total_area")
|
||||
private BigDecimal alreadyShelvesArea;
|
||||
}
|
||||
+12
-1
@@ -290,6 +290,7 @@ public class ShelfMaterialDetailImpl extends ServiceImpl<ShelfMaterialDetailMapp
|
||||
throw new ServiceException("物料明细不能为空");
|
||||
}
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
boolean fromApp = Boolean.TRUE.equals(stockShelfOrderDO.getFromApp());
|
||||
//批量新增或修改物料信息
|
||||
List<ShelfMaterialDetail> shelfMaterialDetailList = new ArrayList<>();
|
||||
// 批量新增序列号
|
||||
@@ -326,11 +327,21 @@ public class ShelfMaterialDetailImpl extends ServiceImpl<ShelfMaterialDetailMapp
|
||||
totalActualQuantity = totalActualQuantity.add(childActualQuantity);
|
||||
}
|
||||
}
|
||||
if (shelfMaterialDetailDO.getShelvesStatus() == 2){//部分上架 第二次上架 这次上架数量覆盖掉已上架数量
|
||||
// 不要覆盖累计已上架数量:alreadyShelvesQuantity 应由上层 assembleParamByShelf 累计计算
|
||||
// 仅当 alreadyShelvesQuantity 为空时,才回退到 shelvesQuantity(兼容旧/缺字段场景)
|
||||
if (shelfMaterialDetailDO.getAlreadyShelvesQuantity() == null) {
|
||||
shelfMaterialDetailDO.setAlreadyShelvesQuantity(shelfMaterialDetailDO.getShelvesQuantity());
|
||||
}
|
||||
ShelfMaterialDetail shelfMaterialDetail = new ShelfMaterialDetail();
|
||||
BeanUtils.copyProperties(shelfMaterialDetailDO, shelfMaterialDetail);
|
||||
// PDA:明细表 shelves_quantity 也要跟累计 already_shelves_quantity 同步
|
||||
// PC:保持旧语义(shelves_quantity=本次上架数量)
|
||||
if (fromApp) {
|
||||
BigDecimal already = shelfMaterialDetailDO.getAlreadyShelvesQuantity();
|
||||
if (already != null) {
|
||||
shelfMaterialDetail.setShelvesQuantity(already);
|
||||
}
|
||||
}
|
||||
shelfMaterialDetail.setUpdateBy(loginUser.getUserid());
|
||||
shelfMaterialDetail.setUpdateByName(loginUser.getUsername());
|
||||
shelfMaterialDetail.setUpdateTime(new Date());
|
||||
|
||||
+28
@@ -69,6 +69,10 @@ public class ShelfMaterialDetailPO extends BaseVOEntity {
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String dimensions;
|
||||
|
||||
@ApiModelProperty("计划数量")
|
||||
@Excel(name = "计划数量")
|
||||
private BigDecimal quantity;
|
||||
@@ -77,6 +81,10 @@ public class ShelfMaterialDetailPO extends BaseVOEntity {
|
||||
@Excel(name = "已上架数量")
|
||||
private BigDecimal alreadyShelvesQuantity;
|
||||
|
||||
@ApiModelProperty("待上架数量")
|
||||
@Excel(name = "待上架数量")
|
||||
private BigDecimal pendingShelvesQuantity;
|
||||
|
||||
@ApiModelProperty("上架数量")
|
||||
@Excel(name = "上架数量")
|
||||
private BigDecimal shelvesQuantity;
|
||||
@@ -317,15 +325,35 @@ public class ShelfMaterialDetailPO extends BaseVOEntity {
|
||||
@Excel(name = "总净重(KG)")
|
||||
private BigDecimal totalNetWeight;
|
||||
|
||||
@ApiModelProperty("累计已上架净重(KG),与 totalNetWeight 同口径累加本次净重")
|
||||
private BigDecimal alreadyShelvesNetWeight;
|
||||
|
||||
@ApiModelProperty("总毛重(KG)")
|
||||
@Excel(name = "总毛重(KG)")
|
||||
private BigDecimal totalGrossWeight;
|
||||
|
||||
@ApiModelProperty("累计已上架毛重(KG),与 totalGrossWeight 同口径累加本次毛重")
|
||||
private BigDecimal alreadyShelvesGrossWeight;
|
||||
|
||||
@ApiModelProperty("总体积(CBM)")
|
||||
@Excel(name = "总体积(CBM)")
|
||||
private BigDecimal totalVolume;
|
||||
|
||||
@ApiModelProperty("累计已上架体积(CBM),与 totalVolume 同口径累加本次体积")
|
||||
private BigDecimal alreadyShelvesVolume;
|
||||
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private BigDecimal totalArea;
|
||||
|
||||
@ApiModelProperty("累计已上架面积(SQM),与 totalArea 同口径累加本次面积")
|
||||
private BigDecimal alreadyShelvesArea;
|
||||
|
||||
@ApiModelProperty("入库单号")
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("LOT编号")
|
||||
@Excel(name = "LOT编号")
|
||||
private String lotNumber;
|
||||
}
|
||||
+4
@@ -66,6 +66,10 @@ public class ShelfMaterialDetailDO extends BaseVOEntity {
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String dimensions;
|
||||
|
||||
@ApiModelProperty("计划数量")
|
||||
@Excel(name = "计划数量")
|
||||
private BigDecimal quantity;
|
||||
|
||||
+2
@@ -870,6 +870,8 @@ public class ShiftManageDomainService {
|
||||
if (ObjectUtil.isNull(materialInventoryDb)){
|
||||
MaterialInventoryDO materialInventoryDONow = new MaterialInventoryDO();
|
||||
BatchAttributeAssignment(materialMoreDetailList, materialInventoryDONow);//批次属性赋值
|
||||
materialInventoryDONow.setLotNumber(shiftMaterialDetailPO.getLotNumber());
|
||||
materialInventoryDONow.setInOrderNumber(shiftMaterialDetailPO.getInOrderNumber());
|
||||
materialInventoryDONow.setMaterialBaseInfoId(shiftMaterialDetailPO.getMaterialBaseInfoId());
|
||||
materialInventoryDONow.setWarehouseId(shiftMaterialDetailPO.getNewWarehouseId());
|
||||
materialInventoryDONow.setWarehouseCode(shiftMaterialDetailPO.getNewWarehouseCode());
|
||||
|
||||
+8
@@ -260,6 +260,14 @@ public class ShiftMaterialDetail extends BaseVOEntity {
|
||||
@Excel(name = "面积")
|
||||
private BigDecimal area;
|
||||
|
||||
@ApiModelProperty("入库单号")
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("LOT编号")
|
||||
@Excel(name = "LOT编号")
|
||||
private String lotNumber;
|
||||
|
||||
@ApiModelProperty("移位详情")
|
||||
@TableField(exist = false)
|
||||
private List<ShiftMoveMaterialQuantityPO> shiftMoveMaterialQuantityList;
|
||||
|
||||
+2
@@ -729,6 +729,8 @@ public class ShiftMaterialDetailImpl extends ServiceImpl<ShiftMaterialDetailMapp
|
||||
|
||||
|
||||
inventoryAdjustmentRecord.setAdjustAction("移位管理");
|
||||
inventoryAdjustmentRecord.setInOrderNumber(shiftMaterialDetailDO.getInOrderNumber());
|
||||
inventoryAdjustmentRecord.setLotNumber(shiftMaterialDetailDO.getLotNumber());
|
||||
inventoryAdjustmentRecord.setRelateNo(shiftMaterialDetailDO.getShiftNumber());
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventory1.getMaterialStatusCode() == null ? "" : materialInventory1.getMaterialStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustBeforeStatusCode(materialInventory1.getMaterialStatusCode() == null ? "" : materialInventory1.getMaterialStatusCode());
|
||||
|
||||
+8
@@ -275,6 +275,14 @@ public class ShiftMaterialDetailPO extends BaseVOEntity {
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private BigDecimal totalArea;
|
||||
|
||||
@ApiModelProperty("入库单号")
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("LOT编号")
|
||||
@Excel(name = "LOT编号")
|
||||
private String lotNumber;
|
||||
|
||||
@ApiModelProperty("移位详情")
|
||||
@TableField(exist = false)
|
||||
private List<ShiftMaterialDetailPO> children;
|
||||
|
||||
+8
@@ -273,6 +273,14 @@ public class ShiftMaterialDetailDO extends BaseVOEntity {
|
||||
@ApiModelProperty("总面积(SQM),PDA 表单区修改后回传")
|
||||
private BigDecimal totalArea;
|
||||
|
||||
@ApiModelProperty("入库单号")
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("LOT编号")
|
||||
@Excel(name = "LOT编号")
|
||||
private String lotNumber;
|
||||
|
||||
@ApiModelProperty("移位详情")
|
||||
@TableField(exist = false)
|
||||
private List<ShiftMaterialDetailDO> children;
|
||||
|
||||
+7
@@ -127,4 +127,11 @@ public class ImmediateInventoryPO {
|
||||
@ApiModelProperty("批次号")
|
||||
private String batchNumber;
|
||||
|
||||
@ApiModelProperty("入库单号")
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("LOT编号")
|
||||
@Excel(name = "LOT编号")
|
||||
private String lotNumber;
|
||||
}
|
||||
+4
@@ -154,4 +154,8 @@ public class ImmediateInventoryDO extends BaseVOEntity {
|
||||
@ApiModelProperty("复核数量开始")
|
||||
private BigDecimal checkQuantityEnd;
|
||||
|
||||
@ApiModelProperty("批次号")
|
||||
@Excel(name = "批次号")
|
||||
private String batchNumber;
|
||||
|
||||
}
|
||||
@@ -326,4 +326,30 @@ public class StockInOrder extends BaseVOEntity {
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "下单日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date orderDate;
|
||||
}
|
||||
|
||||
@ApiModelProperty("业务单号")
|
||||
@Excel(name = "业务单号")
|
||||
private String businessOrderNo;
|
||||
|
||||
@ApiModelProperty("业务类型")
|
||||
@Excel(name = "业务类型")
|
||||
private String businessType;
|
||||
|
||||
@ApiModelProperty("制单人")
|
||||
@Excel(name = "制单人")
|
||||
private String documentCreator;
|
||||
|
||||
@ApiModelProperty("制单人名称")
|
||||
@Excel(name = "制单人名称")
|
||||
private String documentCreatorName;
|
||||
|
||||
@ApiModelProperty("制单日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "制单日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date documentDate;
|
||||
|
||||
@ApiModelProperty("订单状态")
|
||||
@Excel(name = "订单状态")
|
||||
private String orderStatus;
|
||||
}
|
||||
+28
-1
@@ -346,4 +346,31 @@ public class StockInOrderPO extends BaseVOEntity {
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "下单日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date orderDate;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty("业务单号")
|
||||
@Excel(name = "业务单号")
|
||||
private String businessOrderNo;
|
||||
|
||||
@ApiModelProperty("业务类型")
|
||||
@Excel(name = "业务类型")
|
||||
private String businessType;
|
||||
|
||||
@ApiModelProperty("制单人")
|
||||
@Excel(name = "制单人")
|
||||
private String documentCreator;
|
||||
|
||||
@ApiModelProperty("制单人名称")
|
||||
@Excel(name = "制单人名称")
|
||||
private String documentCreatorName;
|
||||
|
||||
@ApiModelProperty("制单日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "制单日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date documentDate;
|
||||
|
||||
@ApiModelProperty("订单状态")
|
||||
@Excel(name = "订单状态")
|
||||
private String orderStatus;
|
||||
}
|
||||
+34
-1
@@ -341,9 +341,42 @@ public class StockInOrderDO extends BaseVOEntity {
|
||||
@Excel(name = "下单日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date orderDate;
|
||||
|
||||
|
||||
@ApiModelProperty("业务单号")
|
||||
@Excel(name = "业务单号")
|
||||
private String businessOrderNo;
|
||||
|
||||
@ApiModelProperty("业务类型")
|
||||
@Excel(name = "业务类型")
|
||||
private String businessType;
|
||||
|
||||
@ApiModelProperty("制单人")
|
||||
@Excel(name = "制单人")
|
||||
private String documentCreator;
|
||||
|
||||
@ApiModelProperty("制单人名称")
|
||||
@Excel(name = "制单人名称")
|
||||
private String documentCreatorName;
|
||||
|
||||
@ApiModelProperty("制单日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "制单日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date documentDate;
|
||||
|
||||
@ApiModelProperty("订单状态")
|
||||
@Excel(name = "订单状态")
|
||||
private String orderStatus;
|
||||
|
||||
@ApiModelProperty(name = "创建时间查询条件开始日期")
|
||||
private String createTimeStart;
|
||||
|
||||
@ApiModelProperty(name = "创建时间查询条件结束日期")
|
||||
private String createTimeEnd;
|
||||
}
|
||||
|
||||
@ApiModelProperty("入库明细-物料名称(商品名称),模糊匹配")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("入库明细-物料编码,模糊匹配")
|
||||
private String materialCode;
|
||||
}
|
||||
+6
@@ -407,6 +407,12 @@ public class StockOutOrderDO extends BaseVOEntity {
|
||||
@ApiModelProperty(name = "审核时间查询条件结束日期")
|
||||
private String auditTimeEnd;
|
||||
|
||||
@ApiModelProperty("出库明细-物料名称(商品名称),模糊匹配")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("出库明细-物料编码,模糊匹配")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty(name = "已分配数量总数量")
|
||||
private BigDecimal alreadyAllocationQuantityAll;
|
||||
}
|
||||
+4
-1
@@ -3,6 +3,7 @@ package com.mhd.wms.domain.stockReceiptOrder.repository.po;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.wms.domain.receiptMaterialDetail.repository.po.ReceiptMaterialDetailPO;
|
||||
import com.mhd.wms.domain.receiptOrderAccount.entity.ReceiptOrderAccount;
|
||||
import com.mhd.wms.domain.stockInOrder.repository.po.StockInOrderBasePO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -156,4 +157,6 @@ public class StockReceiptOrderPO extends StockInOrderBasePO {
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private BigDecimal totalArea;
|
||||
}
|
||||
@ApiModelProperty("费用")
|
||||
List<ReceiptOrderAccount> receiptOrderAccountList;
|
||||
}
|
||||
+4
-1
@@ -3,6 +3,7 @@ package com.mhd.wms.domain.stockReceiptOrder.repository.todo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.wms.domain.receiptMaterialDetail.repository.todo.ReceiptMaterialDetailDO;
|
||||
import com.mhd.wms.domain.receiptOrderAccount.entity.ReceiptOrderAccount;
|
||||
import com.mhd.wms.domain.stockInOrder.repository.todo.StockInOrderBaseDO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -169,4 +170,6 @@ public class StockReceiptOrderDO extends StockInOrderBaseDO {
|
||||
|
||||
@ApiModelProperty("是否来自PDA收货:true-PDA收货完成,false-PC收货完成(用于上架单是否下发:PDA=是,PC=否)")
|
||||
private Boolean fromPda;
|
||||
}
|
||||
@ApiModelProperty("费用")
|
||||
List<ReceiptOrderAccount> receiptOrderAccountList;
|
||||
}
|
||||
+144
-12
@@ -8,6 +8,7 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.mhd.common.core.constant.SnowFlakeConstants;
|
||||
import com.mhd.common.core.domain.dto.BusinessDataPushDTO;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.OrderSequence;
|
||||
@@ -16,6 +17,7 @@ import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.utils.uuid.IdGenerator;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.BmsServiceFeign;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.domain.BatchDetailFeignPO;
|
||||
import com.mhd.system.api.domain.ContainerFeignPO;
|
||||
@@ -47,6 +49,8 @@ import com.mhd.wms.domain.receiptMaterialDetail.entity.ReceiptMaterialDetail;
|
||||
import com.mhd.wms.domain.receiptMaterialDetail.repository.facade.IReceiptMaterialDetailService;
|
||||
import com.mhd.wms.domain.receiptMaterialDetail.repository.po.ReceiptMaterialDetailPO;
|
||||
import com.mhd.wms.domain.receiptMaterialDetail.repository.todo.ReceiptMaterialDetailDO;
|
||||
import com.mhd.wms.domain.receiptOrderAccount.entity.ReceiptOrderAccount;
|
||||
import com.mhd.wms.domain.receiptOrderAccount.repository.facade.IReceiptOrderAccountService;
|
||||
import com.mhd.wms.domain.shelfMaterialDetail.repository.todo.ShelfMaterialDetailDO;
|
||||
import com.mhd.wms.domain.stockInOrder.entity.StockInOrder;
|
||||
import com.mhd.wms.domain.stockInOrder.repository.facade.IStockInOrderService;
|
||||
@@ -64,6 +68,7 @@ import com.mhd.wms.domain.stockShelfOrder.repository.po.StockShelfOrderPO;
|
||||
import com.mhd.wms.domain.stockShelfOrder.repository.todo.StockShelfOrderDO;
|
||||
import com.mhd.wms.domain.stockShelfOrder.service.StockShelfOrderDomainService;
|
||||
import com.mhd.wms.domain.taskReceiptMaterialDetail.repository.todo.TaskReceiptMaterialDetailDO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -121,6 +126,10 @@ public class StockReceiptOrderDomainService {
|
||||
private IContainerUsageRecordService containerUsageRecordService;
|
||||
@Resource
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
@Resource
|
||||
private BmsServiceFeign bmsServiceFeign;
|
||||
@Resource
|
||||
private IReceiptOrderAccountService receiptOrderAccountService;
|
||||
|
||||
/**
|
||||
* 分页查询收货单列表
|
||||
@@ -410,7 +419,7 @@ public class StockReceiptOrderDomainService {
|
||||
genStockReceiptTaskOrderByReceivingGoods(stockReceiptOrderPO,stockReceiptOrderDO);
|
||||
//收货后上架前 生成质检
|
||||
genQualityInspectionByReceivingGoods(stockReceiptOrderDO);
|
||||
|
||||
saveAmount(stockReceiptOrderDO);
|
||||
//更新入库单状态
|
||||
updateStockInOrder(stockReceiptOrderPO);
|
||||
//修改收货单 设置收货单收货需要更新的数据数据
|
||||
@@ -418,6 +427,71 @@ public class StockReceiptOrderDomainService {
|
||||
|
||||
}
|
||||
|
||||
private void saveAmount(StockReceiptOrderDO stockReceiptOrderDO) {
|
||||
Long receiptOrderId = stockReceiptOrderDO.getReceiptOrderId();
|
||||
List<ReceiptOrderAccount> receiptOrderAccountList = stockReceiptOrderDO.getReceiptOrderAccountList();
|
||||
for (ReceiptOrderAccount receiptOrderAccount : receiptOrderAccountList) {
|
||||
receiptOrderAccount.setOrderId(receiptOrderId);
|
||||
}
|
||||
receiptOrderAccountService.remove(new QueryWrapper<ReceiptOrderAccount>().lambda().eq(ReceiptOrderAccount::getOrderId, receiptOrderId));
|
||||
receiptOrderAccountService.saveBatch(receiptOrderAccountList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务整租推送到bms装卸费
|
||||
*/
|
||||
public void wholeRentSynchronizationZXF(Long busId) {
|
||||
StockReceiptOrder stockReceiptOrder = stockReceiptOrderService.getById(busId);
|
||||
String inOrderNumber = stockReceiptOrder.getInOrderNumber();
|
||||
StockInOrder stockInOrder = stockInOrderService.getOne(new QueryWrapper<StockInOrder>().lambda().eq(StockInOrder::getInOrderNumber, inOrderNumber),false);
|
||||
Long shipperId = stockInOrder.getShipperId();
|
||||
Long organizationId = stockInOrder.getOrganizationId();
|
||||
String organizationName = stockInOrder.getOrganizationName();
|
||||
Long topOrganizationId = stockInOrder.getTopOrganizationId();
|
||||
List<ReceiptOrderAccount> accounts = receiptOrderAccountService.list(new QueryWrapper<ReceiptOrderAccount>().lambda().eq(ReceiptOrderAccount::getOrderId, busId));
|
||||
for (ReceiptOrderAccount account : accounts) {
|
||||
String subjectCode = account.getSubjectCode();
|
||||
String subjectName = account.getSubjectName();
|
||||
String serviceItemsCode = account.getServiceItemsCode();
|
||||
if (shipperId == null) {
|
||||
continue;
|
||||
}
|
||||
log.info("开始执行{}", com.alibaba.fastjson.JSONObject.toJSONString(stockReceiptOrder));
|
||||
BusinessDataPushDTO businessDataPushDTO = new BusinessDataPushDTO();
|
||||
businessDataPushDTO.setOrganizationId(organizationId);
|
||||
businessDataPushDTO.setTopOrganizationId(topOrganizationId);
|
||||
businessDataPushDTO.setOrganizationName(organizationName);
|
||||
businessDataPushDTO.setBelongModuleCode("wms");
|
||||
businessDataPushDTO.setBillAmount(account.getAmount());//计费金额
|
||||
businessDataPushDTO.setEstimatedCost(account.getSettlementAmount());//计算金额
|
||||
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
|
||||
if ("装卸费".equals(subjectName)) {
|
||||
jsonObject.put("loading_unloading_unit_price", account.getPrice());//装卸货单价
|
||||
jsonObject.put("cargo_quantity",account.getNum());//货物数量
|
||||
} else if ("贴标费".equals(subjectName)) {
|
||||
jsonObject.put("wooden_case_labeling_unit_price", account.getPrice());//木箱单价
|
||||
jsonObject.put("carton_labeling_unit_price",account.getPrice());//纸箱单价
|
||||
jsonObject.put("wooden_case_quantity",account.getNum());//木箱数量
|
||||
jsonObject.put("carton_quantity",account.getNum());//纸箱数量
|
||||
} else if ("进出仓操作费".equals(subjectName)) {
|
||||
jsonObject.put("cargo_quantity", account.getNum());//货物数量
|
||||
jsonObject.put("warehouse_handling_unit_price",account.getPrice());//进出仓操作费单价
|
||||
}
|
||||
businessDataPushDTO.setDocumentFormJson(jsonObject.toJSONString());
|
||||
businessDataPushDTO.setDocumentTypeCode("WMS_ckjccd");
|
||||
businessDataPushDTO.setSettlementEntityId(shipperId);
|
||||
businessDataPushDTO.setSecondSubjectCode(subjectCode);
|
||||
businessDataPushDTO.setServiceItemsCode(serviceItemsCode);
|
||||
businessDataPushDTO.setDataSources(1);
|
||||
businessDataPushDTO.setTaxRate(account.getRate());
|
||||
|
||||
//businessDataPushDTO.setSettlementCurrency(leasePO.getSettlementCurrency());
|
||||
//businessDataPushDTO.setSalesmanId(leasePO.getSalesmanId());
|
||||
bmsServiceFeign.wholeRentSynchronizationZXF(businessDataPushDTO);
|
||||
}
|
||||
log.info("定时任务整租推送到bms触发--结束");
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步更新入库单明细的收货数量(总毛重/总净重/总面积/总体积不再写入入库单明细,逻辑已注释保留)
|
||||
* 根据收货单明细中填写的数据,按 materialDetailId 分组汇总后更新到入库单明细
|
||||
@@ -713,17 +787,22 @@ public class StockReceiptOrderDomainService {
|
||||
}
|
||||
// 完成收货:同步更新本单全部明细收货状态(与整单收货 entireReceipt 一致,否则 PDA/列表仍显示收货中)
|
||||
updateReceiptMaterialDetailReceiptStatusWhenOrderCompleted(stockReceiptOrderPO, loginUser, userRealName);
|
||||
return stockReceiptOrderService.update(null, new UpdateWrapper<StockReceiptOrder>().lambda()
|
||||
.set(StockReceiptOrder::getStatus, 3)
|
||||
.set(StockReceiptOrder::getAbnormal, abnormal)
|
||||
.set(StockReceiptOrder::getUpdateBy, loginUser.getUserid())
|
||||
.set(StockReceiptOrder::getUpdateByName, loginUser.getUsername())
|
||||
.set(StockReceiptOrder::getUpdateTime, new Date())
|
||||
.eq(StockReceiptOrder::getReceiptOrderId, receiptOrderId));
|
||||
boolean update = stockReceiptOrderService.update(null, new UpdateWrapper<StockReceiptOrder>().lambda()
|
||||
.set(StockReceiptOrder::getStatus, 3)
|
||||
.set(StockReceiptOrder::getAbnormal, abnormal)
|
||||
.set(StockReceiptOrder::getUpdateBy, loginUser.getUserid())
|
||||
.set(StockReceiptOrder::getUpdateByName, loginUser.getUsername())
|
||||
.set(StockReceiptOrder::getUpdateTime, new Date())
|
||||
.eq(StockReceiptOrder::getReceiptOrderId, receiptOrderId));
|
||||
//推送bms
|
||||
wholeRentSynchronizationZXF(receiptOrderId);
|
||||
return update;
|
||||
}
|
||||
|
||||
/**
|
||||
* 收货单完成时:按累计已收与计划数量比较,更新明细 receipt_status(3 正常收完 / 4 少收 / 5 超收)
|
||||
* <p>PC 主子行拆分收货时:计划数量只在主行(level=1),子行 quantity 常为 0;须按「主行已收 + 其下子行已收」与主行计划比较,
|
||||
* 主、子行使用同一状态,避免主行判少收、子行判超收。</p>
|
||||
*/
|
||||
private void updateReceiptMaterialDetailReceiptStatusWhenOrderCompleted(StockReceiptOrderPO stockReceiptOrderPO,
|
||||
LoginUser loginUser, String userRealName) {
|
||||
@@ -738,15 +817,68 @@ public class StockReceiptOrderDomainService {
|
||||
if (CollectionUtils.isEmpty(details)) {
|
||||
return;
|
||||
}
|
||||
Map<Long, List<ReceiptMaterialDetail>> childrenByParentUniqueId = new HashMap<>();
|
||||
for (ReceiptMaterialDetail d : details) {
|
||||
d.setReceiptStatus(resolveReceiptDetailStatusOnOrderComplete(d.getAlreadyReceiptQuantity(), d.getQuantity()));
|
||||
d.setUpdateBy(loginUser.getUserid());
|
||||
d.setUpdateByName(userRealName);
|
||||
d.setUpdateTime(updateTime);
|
||||
if (isReceiptDetailChildRow(d) && d.getParentUniqueId() != null) {
|
||||
childrenByParentUniqueId.computeIfAbsent(d.getParentUniqueId(), k -> new ArrayList<>()).add(d);
|
||||
}
|
||||
}
|
||||
Set<Long> parentUniqueIdsInOrder = details.stream()
|
||||
.filter(d -> !isReceiptDetailChildRow(d))
|
||||
.map(ReceiptMaterialDetail::getUniqueId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
for (ReceiptMaterialDetail parent : details) {
|
||||
if (isReceiptDetailChildRow(parent)) {
|
||||
continue;
|
||||
}
|
||||
Integer status;
|
||||
List<ReceiptMaterialDetail> children = parent.getUniqueId() == null ? null
|
||||
: childrenByParentUniqueId.get(parent.getUniqueId());
|
||||
if (!CollectionUtils.isEmpty(children)) {
|
||||
BigDecimal groupReceived = nz(parent.getAlreadyReceiptQuantity());
|
||||
for (ReceiptMaterialDetail ch : children) {
|
||||
groupReceived = groupReceived.add(nz(ch.getAlreadyReceiptQuantity()));
|
||||
}
|
||||
status = resolveReceiptDetailStatusOnOrderComplete(groupReceived, parent.getQuantity());
|
||||
} else {
|
||||
status = resolveReceiptDetailStatusOnOrderComplete(parent.getAlreadyReceiptQuantity(), parent.getQuantity());
|
||||
}
|
||||
parent.setReceiptStatus(status);
|
||||
parent.setUpdateBy(loginUser.getUserid());
|
||||
parent.setUpdateByName(userRealName);
|
||||
parent.setUpdateTime(updateTime);
|
||||
if (!CollectionUtils.isEmpty(children)) {
|
||||
for (ReceiptMaterialDetail ch : children) {
|
||||
ch.setReceiptStatus(status);
|
||||
ch.setUpdateBy(loginUser.getUserid());
|
||||
ch.setUpdateByName(userRealName);
|
||||
ch.setUpdateTime(updateTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 子行的 parent_unique_id 在本单明细中找不到对应主行时:无法按组合计,仍按单行口径更新
|
||||
for (ReceiptMaterialDetail d : details) {
|
||||
if (isReceiptDetailChildRow(d) && d.getParentUniqueId() != null
|
||||
&& !parentUniqueIdsInOrder.contains(d.getParentUniqueId())) {
|
||||
d.setReceiptStatus(resolveReceiptDetailStatusOnOrderComplete(d.getAlreadyReceiptQuantity(), d.getQuantity()));
|
||||
d.setUpdateBy(loginUser.getUserid());
|
||||
d.setUpdateByName(userRealName);
|
||||
d.setUpdateTime(updateTime);
|
||||
}
|
||||
}
|
||||
receiptMaterialDetailService.updateBatchById(details);
|
||||
}
|
||||
|
||||
private static boolean isReceiptDetailChildRow(ReceiptMaterialDetail d) {
|
||||
return d.getLevel() != null && d.getLevel() == 2
|
||||
&& d.getParentUniqueId() != null && d.getParentUniqueId() != 0L;
|
||||
}
|
||||
|
||||
private static BigDecimal nz(BigDecimal v) {
|
||||
return v != null ? v : BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
/** 3=已收足 4=少收 5=超收 */
|
||||
private static Integer resolveReceiptDetailStatusOnOrderComplete(BigDecimal alreadyReceiptQuantity, BigDecimal quantity) {
|
||||
BigDecimal already = alreadyReceiptQuantity != null ? alreadyReceiptQuantity : BigDecimal.ZERO;
|
||||
|
||||
+46
-6
@@ -542,11 +542,15 @@ public class StockShelfOrderDomainService {
|
||||
stockShelfOrder.setShelfOrderId(stockShelfOrderDO.getShelfOrderId());
|
||||
stockShelfOrder.setStatus(2);
|
||||
BigDecimal currentShelvesQuantity = stockShelfOrderPO.getShelvesQuantity() != null ? stockShelfOrderPO.getShelvesQuantity() : BigDecimal.ZERO;
|
||||
BigDecimal actualQuantity = stockShelfOrderDO.getActualQuantity() != null ? stockShelfOrderDO.getActualQuantity() : BigDecimal.ZERO;
|
||||
BigDecimal reduce = stockShelfOrderDO.getMaterialDetailList().stream().map(ShelfMaterialDetailDO::getShelvesQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// PDA(fromApp=true)累加已有上架数量;PC 直接覆盖
|
||||
BigDecimal orderIncrementQuantity = stockShelfOrderDO.getActualQuantity() != null ? stockShelfOrderDO.getActualQuantity() : BigDecimal.ZERO;
|
||||
// PDA(fromApp=true):本单本次作业量 = assembleParamByShelf 汇总的 actualQuantity(含主行+子行),累加到单头
|
||||
// PC:单头「上架数量」= 各明细累计已上架数量之和(递归含子行),不可仅顶层 shelvesQuantity 汇总,否则子行数量漏计、统计与完成判断错误
|
||||
boolean fromApp = Boolean.TRUE.equals(stockShelfOrderDO.getFromApp());
|
||||
stockShelfOrder.setShelvesQuantity(fromApp ? currentShelvesQuantity.add(reduce) : reduce);
|
||||
if (fromApp) {
|
||||
stockShelfOrder.setShelvesQuantity(currentShelvesQuantity.add(orderIncrementQuantity));
|
||||
} else {
|
||||
stockShelfOrder.setShelvesQuantity(sumShelfDetailAlreadyShelvesQuantityRecursive(stockShelfOrderDO.getMaterialDetailList()));
|
||||
}
|
||||
stockShelfOrder.setShelvesMaterialQuantity(stockShelfOrderPO.getShelvesMaterialQuantity() + stockShelfOrderDO.getActualReceiptMaterialQuantity());
|
||||
stockShelfOrder.setUpdateBy(loginUser.getUserid());
|
||||
stockShelfOrder.setUpdateByName(loginUser.getUsername());
|
||||
@@ -560,6 +564,26 @@ public class StockShelfOrderDomainService {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归汇总上架明细的累计已上架数量(主行 + 子行),用于 PC 端写入上架单头 shelves_quantity。
|
||||
*/
|
||||
private BigDecimal sumShelfDetailAlreadyShelvesQuantityRecursive(List<ShelfMaterialDetailDO> list) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal sum = BigDecimal.ZERO;
|
||||
for (ShelfMaterialDetailDO d : list) {
|
||||
if (d == null) {
|
||||
continue;
|
||||
}
|
||||
if (d.getAlreadyShelvesQuantity() != null) {
|
||||
sum = sum.add(d.getAlreadyShelvesQuantity());
|
||||
}
|
||||
sum = sum.add(sumShelfDetailAlreadyShelvesQuantityRecursive(d.getChildren()));
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param stockShelfOrderPO
|
||||
* @param status 入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入
|
||||
@@ -649,12 +673,14 @@ public class StockShelfOrderDomainService {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
Long shipperId = stockReceiptOrderDO.getShipperId();
|
||||
MaterialInventory param = getParam(shelfMaterialDetail, fieldNames, shipperId);
|
||||
MaterialInventory param = getParam(shelfMaterialDetail, fieldNames, shipperId,stockReceiptOrderDO.getInOrderNumber());
|
||||
List<MaterialInventoryPO> materialInventoryPOS = materialInventoryMapper.selectListByWhere(param);
|
||||
MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId);
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (materialInventoryPOS.size() == 0) {
|
||||
MaterialInventory materialInventory = new MaterialInventory();
|
||||
materialInventory.setInOrderNumber(stockReceiptOrderDO.getInOrderNumber());
|
||||
materialInventory.setLotNumber(shelfMaterialDetail.getLotNumber());
|
||||
//仓库信息
|
||||
materialInventory.setWarehouseId(stockReceiptOrderDO.getWarehouseId());
|
||||
materialInventory.setWarehouseCode(stockReceiptOrderDO.getWarehouseCode());
|
||||
@@ -702,6 +728,11 @@ public class StockShelfOrderDomainService {
|
||||
materialInventory.setCreateByName(loginUser.getUsername());
|
||||
materialInventory.setCreateTime(new Date());
|
||||
|
||||
// 新增库存时同步更新时间(update_time)
|
||||
materialInventory.setUpdateBy(loginUser.getUserid());
|
||||
materialInventory.setUpdateByName(loginUser.getUsername());
|
||||
materialInventory.setUpdateTime(new Date());
|
||||
|
||||
//体积 重量等
|
||||
materialInventory.setVolume(shelfMaterialDetail.getTotalVolume());
|
||||
materialInventory.setArea(shelfMaterialDetail.getTotalArea());
|
||||
@@ -733,6 +764,8 @@ public class StockShelfOrderDomainService {
|
||||
|
||||
//库存调整记录
|
||||
InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
|
||||
inventoryAdjustmentRecord.setInOrderNumber(stockReceiptOrderDO.getInOrderNumber());
|
||||
inventoryAdjustmentRecord.setLotNumber(shelfMaterialDetail.getLotNumber());
|
||||
inventoryAdjustmentRecord.setAdjustAction("入库");
|
||||
inventoryAdjustmentRecord.setRelateNo(stockReceiptOrderDO.getInOrderNumber());
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
@@ -802,6 +835,9 @@ public class StockShelfOrderDomainService {
|
||||
inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
|
||||
} else if (materialInventoryPOS.size() == 1) {
|
||||
MaterialInventory materialInventory = new MaterialInventory();
|
||||
materialInventory.setInOrderNumber(stockReceiptOrderDO.getInOrderNumber());
|
||||
materialInventory.setLotNumber(shelfMaterialDetail.getLotNumber());
|
||||
|
||||
BigDecimal shelvesQuantity = shelfMaterialDetail.getShelvesQuantity();
|
||||
shelvesQuantity = shelvesQuantity != null ? shelvesQuantity : BigDecimal.ZERO;
|
||||
MaterialInventoryPO materialInventoryPO = materialInventoryPOS.get(0);
|
||||
@@ -869,6 +905,8 @@ public class StockShelfOrderDomainService {
|
||||
|
||||
|
||||
InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
|
||||
inventoryAdjustmentRecord.setInOrderNumber(stockReceiptOrderDO.getInOrderNumber());
|
||||
inventoryAdjustmentRecord.setLotNumber(shelfMaterialDetail.getLotNumber());
|
||||
inventoryAdjustmentRecord.setAdjustAction("入库");
|
||||
inventoryAdjustmentRecord.setRelateNo(stockReceiptOrderDO.getInOrderNumber());
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
@@ -923,7 +961,7 @@ public class StockShelfOrderDomainService {
|
||||
}
|
||||
}
|
||||
|
||||
private MaterialInventory getParam(ShelfMaterialDetail shelfMaterialDetail, List<String> fieldNames,Long shipperId){
|
||||
private MaterialInventory getParam(ShelfMaterialDetail shelfMaterialDetail, List<String> fieldNames,Long shipperId,String inOrderNumber){
|
||||
MaterialInventory param = new MaterialInventory();
|
||||
param.setShipperId(shipperId);
|
||||
param.setWarehouseId(shelfMaterialDetail.getWarehouseId());
|
||||
@@ -932,6 +970,8 @@ public class StockShelfOrderDomainService {
|
||||
param.setStorageLocationId(shelfMaterialDetail.getStorageLocationId());
|
||||
param.setOrganizationId(shelfMaterialDetail.getOrganizationId());
|
||||
param.setBatchNumber(shelfMaterialDetail.getBatchNumber());
|
||||
param.setLotNumber(shelfMaterialDetail.getLotNumber());
|
||||
param.setInOrderNumber(inOrderNumber);
|
||||
if (fieldNames.size() > 0) {
|
||||
for (String fieldName : fieldNames) {
|
||||
switch (fieldName) {
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.mhd.wms.domain.sysTableConfig.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author: brb
|
||||
* @description:
|
||||
* @create: 2026-03-04 14:30
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_table_config")
|
||||
public class SysTableConfig extends BaseVOEntity {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/*
|
||||
* 仓库id
|
||||
* */
|
||||
@ApiModelProperty("仓库ID")
|
||||
@Excel(name = "仓库ID")
|
||||
private Long warehouseId;
|
||||
/**组织ID*/
|
||||
@ApiModelProperty(value = "组织ID")
|
||||
@Excel(name = "组织ID", width = 15)
|
||||
private Long organizationId;
|
||||
/**一级组织ID*/
|
||||
@ApiModelProperty(value = "一级组织ID")
|
||||
@Excel(name = "一级组织ID", width = 15)
|
||||
private Long topOrganizationId;
|
||||
/**组织名称*/
|
||||
@ApiModelProperty(value = "组织名称")
|
||||
@Excel(name = "组织名称", width = 15)
|
||||
private String organizationName;
|
||||
/**键*/
|
||||
@ApiModelProperty(value = "键")
|
||||
@Excel(name = "键", width = 15)
|
||||
private String key;
|
||||
/**值*/
|
||||
@ApiModelProperty(value = "值")
|
||||
@Excel(name = "值", width = 15)
|
||||
private String value;
|
||||
/**备注说明*/
|
||||
@ApiModelProperty(value = "备注说明")
|
||||
@Excel(name = "备注说明", width = 15)
|
||||
private String remark;
|
||||
/**明细值*/
|
||||
@ApiModelProperty(value = "明细值")
|
||||
@Excel(name = "明细值", width = 15)
|
||||
private String detailValue;
|
||||
/**物料添加方式*/
|
||||
@ApiModelProperty(value = "物料添加方式")
|
||||
@Excel(name = "物料添加方式", width = 15)
|
||||
private String materialAddType;
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.mhd.wms.domain.sysTableConfig.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.wms.domain.sysTableConfig.entity.SysTableConfig;
|
||||
import com.mhd.wms.domain.sysTableConfig.repository.todo.SysTableConfigDTO;
|
||||
import com.mhd.wms.domain.sysTableConfig.repository.vo.SysTableConfigVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ISysTableConfigService extends IService<SysTableConfig> {
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询配置列表
|
||||
* @param page 分页对象
|
||||
* @param sysTableConfigDTO 查询条件
|
||||
* @return 配置列表
|
||||
*/
|
||||
Page<SysTableConfigVO> queryList(Page<SysTableConfigVO> page, SysTableConfigDTO sysTableConfigDTO);
|
||||
|
||||
/**
|
||||
* 根据组织 ID 和键查询配置
|
||||
* @param organizationId 组织 ID
|
||||
* @param key 配置键
|
||||
* @return 配置信息
|
||||
*/
|
||||
SysTableConfig getByOrgIdAndKey(Long organizationId, String key,Long warehouseId);
|
||||
|
||||
/**
|
||||
* 根据组织 ID 查询所有配置
|
||||
* @param organizationId 组织 ID
|
||||
* @return 配置列表
|
||||
*/
|
||||
List<SysTableConfig> listByOrgId(Long organizationId,Long warehouseId);
|
||||
|
||||
/**
|
||||
* 保存或更新配置(根据组织 ID 和键判断是新增还是更新)
|
||||
* @param sysTableConfigDTO 配置信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean saveOrUpdateConfig(SysTableConfigDTO sysTableConfigDTO);
|
||||
|
||||
/**
|
||||
* 删除配置
|
||||
* @param ids 主键 ID 列表
|
||||
* @return 是否成功
|
||||
*/
|
||||
int delete(List<String> ids);
|
||||
|
||||
/**
|
||||
* 根据组织 ID 删除所有配置
|
||||
* @param organizationId 组织 ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
int deleteByOrgId(Long organizationId);
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package com.mhd.wms.domain.sysTableConfig.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mhd.wms.domain.sysTableConfig.entity.SysTableConfig;
|
||||
import com.mhd.wms.domain.sysTableConfig.repository.vo.SysTableConfigVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 系统表配置(全局表内容展示顺序)
|
||||
* @Author: Assistant
|
||||
* @Date: 2026-03-04
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysTableConfigMapper extends BaseMapper<SysTableConfig> {
|
||||
|
||||
/**
|
||||
* 根据组织 ID 和键查询配置
|
||||
* @param organizationId 组织 ID
|
||||
* @param key 配置键
|
||||
* @return 配置信息
|
||||
*/
|
||||
@Select("SELECT * FROM sys_table_config WHERE organization_id = #{organizationId} AND key = #{key} and warehouse_id = #{warehouseId}")
|
||||
SysTableConfig getByOrgIdAndKey(@Param("organizationId") Long organizationId, @Param("key") String key, @Param("warehouseId") Long warehouseId);
|
||||
|
||||
/**
|
||||
* 根据组织 ID 查询所有配置
|
||||
* @param organizationId 组织 ID
|
||||
* @return 配置列表
|
||||
*/
|
||||
@Select("SELECT * FROM sys_table_config WHERE organization_id = #{organizationId} and warehouse_id = #{warehouseId} ORDER BY create_time DESC")
|
||||
List<SysTableConfig> listByOrgId(@Param("organizationId") Long organizationId, @Param("warehouseId") Long warehouseId);
|
||||
|
||||
/**
|
||||
* 分页查询配置列表
|
||||
* @param page 分页对象
|
||||
* @param organizationId 组织 ID
|
||||
* @param key 配置键(可选)
|
||||
* @return 配置列表
|
||||
*/
|
||||
List<SysTableConfigVO> queryList(Page<SysTableConfigVO> page,
|
||||
@Param("organizationId") Long organizationId,
|
||||
@Param("key") String key, @Param("warehouseId") Long warehouseId);
|
||||
}
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
package com.mhd.wms.domain.sysTableConfig.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.domain.WlhyLoginUser;
|
||||
import com.mhd.wms.domain.sysTableConfig.entity.SysTableConfig;
|
||||
import com.mhd.wms.domain.sysTableConfig.repository.facade.ISysTableConfigService;
|
||||
import com.mhd.wms.domain.sysTableConfig.repository.mapper.SysTableConfigMapper;
|
||||
import com.mhd.wms.domain.sysTableConfig.repository.todo.SysTableConfigDTO;
|
||||
import com.mhd.wms.domain.sysTableConfig.repository.vo.SysTableConfigVO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@Service
|
||||
public class SysTableConfigServiceImpl extends ServiceImpl<SysTableConfigMapper, SysTableConfig> implements ISysTableConfigService {
|
||||
|
||||
|
||||
@Resource
|
||||
private SysTableConfigMapper sysTableConfigMapper;
|
||||
|
||||
@Override
|
||||
public Page<SysTableConfigVO> queryList(Page<SysTableConfigVO> page, SysTableConfigDTO sysTableConfigDTO) {
|
||||
// 获取登录人信息(可选,用于自动填充组织 ID)
|
||||
try {
|
||||
WlhyLoginUser loginUser = SecurityUtils.getLoginUser().getWlhyLoginUser();
|
||||
if (loginUser != null && sysTableConfigDTO.getOrganizationId() == null) {
|
||||
// 如果没有传入组织 ID,可以选择不设置或者设置默认值
|
||||
// 这里保持传入参数不变,由 Mapper 层处理 null 值
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
List<SysTableConfigVO> list = sysTableConfigMapper.queryList(page,
|
||||
sysTableConfigDTO.getOrganizationId() != null ? sysTableConfigDTO.getOrganizationId().longValue() : null,
|
||||
sysTableConfigDTO.getKey(), sysTableConfigDTO.getWarehouseId());
|
||||
return page.setRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysTableConfig getByOrgIdAndKey(Long organizationId, String key,Long warehouseId) {
|
||||
if (organizationId == null || StringUtils.isBlank(key)) {
|
||||
throw new ServiceException("组织 ID 和键不能为空");
|
||||
}
|
||||
if (warehouseId == null) {
|
||||
throw new ServiceException("仓库 ID 不能为空");
|
||||
}
|
||||
return sysTableConfigMapper.getByOrgIdAndKey(organizationId, key,warehouseId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysTableConfig> listByOrgId(Long organizationId, Long warehouseId) {
|
||||
if (organizationId == null) {
|
||||
throw new ServiceException("组织 ID 不能为空");
|
||||
}
|
||||
if (warehouseId == null) {
|
||||
throw new ServiceException("仓库 ID 不能为空");
|
||||
}
|
||||
return sysTableConfigMapper.listByOrgId(organizationId, warehouseId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean saveOrUpdateConfig(SysTableConfigDTO sysTableConfigDTO) {
|
||||
if (sysTableConfigDTO.getOrganizationId() == null) {
|
||||
throw new ServiceException("组织 ID 不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(sysTableConfigDTO.getKey())) {
|
||||
throw new ServiceException("配置键不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(sysTableConfigDTO.getValue())) {
|
||||
throw new ServiceException("配置值不能为空");
|
||||
}
|
||||
if (sysTableConfigDTO.getWarehouseId() == null) {
|
||||
throw new ServiceException("仓库 ID 不能为空");
|
||||
}
|
||||
|
||||
// 获取登录人信息
|
||||
WlhyLoginUser loginUser = SecurityUtils.getLoginUser().getWlhyLoginUser();
|
||||
String username = loginUser != null ? loginUser.getUsername() : "system";
|
||||
|
||||
// 判断是新增还是更新
|
||||
SysTableConfig existingConfig = sysTableConfigMapper.getByOrgIdAndKey(
|
||||
sysTableConfigDTO.getOrganizationId().longValue(),
|
||||
sysTableConfigDTO.getKey(), sysTableConfigDTO.getWarehouseId());
|
||||
|
||||
if (existingConfig != null) {
|
||||
// 更新
|
||||
existingConfig.setValue(sysTableConfigDTO.getValue());
|
||||
//existingConfig.setUpdateBy(username);
|
||||
existingConfig.setUpdateTime(new Date());
|
||||
existingConfig.setDetailValue(sysTableConfigDTO.getDetailValue());
|
||||
existingConfig.setMaterialAddType(sysTableConfigDTO.getMaterialAddType());
|
||||
if (StringUtils.isNotBlank(sysTableConfigDTO.getRemark())) {
|
||||
existingConfig.setRemark(sysTableConfigDTO.getRemark());
|
||||
}
|
||||
return this.updateById(existingConfig);
|
||||
} else {
|
||||
// 新增
|
||||
SysTableConfig newConfig = new SysTableConfig();
|
||||
BeanUtils.copyProperties(sysTableConfigDTO, newConfig);
|
||||
//newConfig.setCreateBy(username);
|
||||
newConfig.setCreateTime(new Date());
|
||||
//newConfig.setUpdateBy(username);
|
||||
newConfig.setUpdateTime(new Date());
|
||||
return this.save(newConfig);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int delete(List<String> ids) {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
throw new ServiceException("删除的 ID 不能为空");
|
||||
}
|
||||
|
||||
// 简单的日志记录,不做复杂的权限验证
|
||||
try {
|
||||
WlhyLoginUser loginUser = SecurityUtils.getLoginUser().getWlhyLoginUser();
|
||||
if (loginUser != null) {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return this.removeByIds(ids) ? ids.size() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteByOrgId(Long organizationId) {
|
||||
if (organizationId == null) {
|
||||
throw new ServiceException("组织 ID 不能为空");
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<SysTableConfig> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysTableConfig::getOrganizationId, organizationId);
|
||||
|
||||
return this.remove(queryWrapper) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.mhd.wms.domain.sysTableConfig.repository.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author: brb
|
||||
* @description:
|
||||
* @create: 2026-03-04 14:30
|
||||
*/
|
||||
@Data
|
||||
public class SysTableConfigPO extends BaseVOEntity {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/*
|
||||
* 仓库id
|
||||
* */
|
||||
@ApiModelProperty("仓库ID")
|
||||
@Excel(name = "仓库ID")
|
||||
private Long warehouseId;
|
||||
/**组织ID*/
|
||||
@ApiModelProperty(value = "组织ID")
|
||||
@Excel(name = "组织ID", width = 15)
|
||||
private Long organizationId;
|
||||
/**键*/
|
||||
@ApiModelProperty(value = "键")
|
||||
@Excel(name = "键", width = 15)
|
||||
private String key;
|
||||
/**值*/
|
||||
@ApiModelProperty(value = "值")
|
||||
@Excel(name = "值", width = 15)
|
||||
private String value;
|
||||
/**备注说明*/
|
||||
@ApiModelProperty(value = "备注说明")
|
||||
@Excel(name = "备注说明", width = 15)
|
||||
private String remark;
|
||||
/**明细值*/
|
||||
@ApiModelProperty(value = "明细值")
|
||||
@Excel(name = "明细值", width = 15)
|
||||
private String detailValue;
|
||||
/**物料添加方式*/
|
||||
@ApiModelProperty(value = "物料添加方式")
|
||||
@Excel(name = "物料添加方式", width = 15)
|
||||
private String materialAddType;
|
||||
/**一级组织ID*/
|
||||
@ApiModelProperty(value = "一级组织ID")
|
||||
@Excel(name = "一级组织ID", width = 15)
|
||||
private Long topOrganizationId;
|
||||
/**组织名称*/
|
||||
@ApiModelProperty(value = "组织名称")
|
||||
@Excel(name = "组织名称", width = 15)
|
||||
private String organizationName;
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package com.mhd.wms.domain.sysTableConfig.repository.todo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author: brb
|
||||
* @description:
|
||||
* @create: 2026-03-04 14:30
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_table_config")
|
||||
public class SysTableConfigDTO extends BaseVOEntity {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/*
|
||||
* 仓库id
|
||||
* */
|
||||
@ApiModelProperty("仓库ID")
|
||||
@Excel(name = "仓库ID")
|
||||
private Long warehouseId;
|
||||
/**组织ID*/
|
||||
@ApiModelProperty(value = "组织ID")
|
||||
@Excel(name = "组织ID", width = 15)
|
||||
private Long organizationId;
|
||||
/**键*/
|
||||
@ApiModelProperty(value = "键")
|
||||
@Excel(name = "键", width = 15)
|
||||
private String key;
|
||||
/**值*/
|
||||
@ApiModelProperty(value = "值")
|
||||
@Excel(name = "值", width = 15)
|
||||
private String value;
|
||||
/**备注说明*/
|
||||
@ApiModelProperty(value = "备注说明")
|
||||
@Excel(name = "备注说明", width = 15)
|
||||
private String remark;
|
||||
/**明细值*/
|
||||
@ApiModelProperty(value = "明细值")
|
||||
@Excel(name = "明细值", width = 15)
|
||||
private String detailValue;
|
||||
/**物料添加方式*/
|
||||
@ApiModelProperty(value = "物料添加方式")
|
||||
@Excel(name = "物料添加方式", width = 15)
|
||||
private String materialAddType;
|
||||
/**一级组织ID*/
|
||||
@ApiModelProperty(value = "一级组织ID")
|
||||
@Excel(name = "一级组织ID", width = 15)
|
||||
private Long topOrganizationId;
|
||||
/**组织名称*/
|
||||
@ApiModelProperty(value = "组织名称")
|
||||
@Excel(name = "组织名称", width = 15)
|
||||
private String organizationName;
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package com.mhd.wms.domain.sysTableConfig.repository.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author: brb
|
||||
* @description:
|
||||
* @create: 2026-03-04 14:30
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_table_config")
|
||||
public class SysTableConfigVO extends BaseVOEntity {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/*
|
||||
* 仓库id
|
||||
* */
|
||||
@ApiModelProperty("仓库ID")
|
||||
@Excel(name = "仓库ID")
|
||||
private Long warehouseId;
|
||||
/**组织ID*/
|
||||
@ApiModelProperty(value = "组织ID")
|
||||
@Excel(name = "组织ID", width = 15)
|
||||
private Long organizationId;
|
||||
/**键*/
|
||||
@ApiModelProperty(value = "键")
|
||||
@Excel(name = "键", width = 15)
|
||||
private String key;
|
||||
/**值*/
|
||||
@ApiModelProperty(value = "值")
|
||||
@Excel(name = "值", width = 15)
|
||||
private String value;
|
||||
/**备注说明*/
|
||||
@ApiModelProperty(value = "备注说明")
|
||||
@Excel(name = "备注说明", width = 15)
|
||||
private String remark;
|
||||
/**明细值*/
|
||||
@ApiModelProperty(value = "明细值")
|
||||
@Excel(name = "明细值", width = 15)
|
||||
private String detailValue;
|
||||
/**物料添加方式*/
|
||||
@ApiModelProperty(value = "物料添加方式")
|
||||
@Excel(name = "物料添加方式", width = 15)
|
||||
private String materialAddType;
|
||||
/**一级组织ID*/
|
||||
@ApiModelProperty(value = "一级组织ID")
|
||||
@Excel(name = "一级组织ID", width = 15)
|
||||
private Long topOrganizationId;
|
||||
/**组织名称*/
|
||||
@ApiModelProperty(value = "组织名称")
|
||||
@Excel(name = "组织名称", width = 15)
|
||||
private String organizationName;
|
||||
}
|
||||
+3
@@ -223,4 +223,7 @@ public class TaskPickingMaterialDetailPO extends BaseVOEntity {
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
private BigDecimal totalArea;
|
||||
|
||||
@ApiModelProperty("尺寸")
|
||||
private String size;
|
||||
|
||||
}
|
||||
|
||||
+27
@@ -35,6 +35,13 @@ public class StockInOrderAssembler {
|
||||
// 确保查询条件字段被正确传递(查询条件字段需要明确传递,避免被IgnoreNullUtil忽略)
|
||||
stockInOrderDO.setCreateTimeStart(stockInOrderDTO.getCreateTimeStart());
|
||||
stockInOrderDO.setCreateTimeEnd(stockInOrderDTO.getCreateTimeEnd());
|
||||
// 列表筛选:前端常传「名称 (编码)」展示串,库内多为纯名称,去掉末尾括号段再 LIKE
|
||||
if (stockInOrderDTO.getMaterialName() != null && !stockInOrderDTO.getMaterialName().isEmpty()) {
|
||||
String normalized = normalizeDetailMaterialNameForQuery(stockInOrderDTO.getMaterialName());
|
||||
stockInOrderDO.setMaterialName(normalized.isEmpty()
|
||||
? stockInOrderDTO.getMaterialName().trim()
|
||||
: normalized);
|
||||
}
|
||||
return stockInOrderDO;
|
||||
}
|
||||
|
||||
@@ -104,4 +111,24 @@ public class StockInOrderAssembler {
|
||||
return stockInOrderDO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 去掉物料展示名末尾的「 (xxx) / (xxx)」等,便于与库内 material_name 模糊匹配。
|
||||
*/
|
||||
private static String normalizeDetailMaterialNameForQuery(String raw) {
|
||||
if (raw == null) {
|
||||
return null;
|
||||
}
|
||||
String s = raw.trim();
|
||||
// 循环去掉末尾多组括号(兼容「名称 (编码)」或重复后缀)
|
||||
String next;
|
||||
do {
|
||||
next = s.replaceFirst("[\\s\\u3000]*[((][^))]*[))]\\s*$", "").trim();
|
||||
if (next.equals(s)) {
|
||||
break;
|
||||
}
|
||||
s = next;
|
||||
} while (!s.isEmpty());
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+27
@@ -36,6 +36,13 @@ public class StockOutOrderAssembler {
|
||||
stockOutOrderDO.setAuditTimeStart(stockOutOrderDTO.getAuditTimeStart());
|
||||
stockOutOrderDO.setAuditTimeEnd(stockOutOrderDTO.getAuditTimeEnd());
|
||||
stockOutOrderDO.setTabType(stockOutOrderDTO.getTabType());
|
||||
// 列表筛选:前端常传「名称 (编码)」展示串,库内多为纯名称,去掉末尾括号段再 LIKE
|
||||
if (stockOutOrderDTO.getMaterialName() != null && !stockOutOrderDTO.getMaterialName().isEmpty()) {
|
||||
String normalized = normalizeDetailMaterialNameForQuery(stockOutOrderDTO.getMaterialName());
|
||||
stockOutOrderDO.setMaterialName(normalized.isEmpty()
|
||||
? stockOutOrderDTO.getMaterialName().trim()
|
||||
: normalized);
|
||||
}
|
||||
return stockOutOrderDO;
|
||||
}
|
||||
|
||||
@@ -83,4 +90,24 @@ public class StockOutOrderAssembler {
|
||||
return stockOutOrderDO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 去掉物料展示名末尾的「 (xxx) / (xxx)」等,便于与库内 material_name 模糊匹配。
|
||||
*/
|
||||
private static String normalizeDetailMaterialNameForQuery(String raw) {
|
||||
if (raw == null) {
|
||||
return null;
|
||||
}
|
||||
String s = raw.trim();
|
||||
// 循环去掉末尾多组括号(兼容「名称 (编码)」或重复后缀)
|
||||
String next;
|
||||
do {
|
||||
next = s.replaceFirst("[\\s\\u3000]*[((][^))]*[))]\\s*$", "").trim();
|
||||
if (next.equals(s)) {
|
||||
break;
|
||||
}
|
||||
s = next;
|
||||
} while (!s.isEmpty());
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+69
-5
@@ -1,12 +1,19 @@
|
||||
package com.mhd.wms.interfaces.assember.stockReceiptOrder;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.wms.domain.materialMoreDetail.repository.todo.MaterialMoreDetailDO;
|
||||
import com.mhd.wms.domain.receiptMaterialDetail.repository.todo.ReceiptMaterialDetailDO;
|
||||
import com.mhd.wms.domain.stockReceiptOrder.repository.todo.StockReceiptOrderDO;
|
||||
import com.mhd.wms.interfaces.dto.materialMoreDetail.MaterialMoreDetailDTO;
|
||||
import com.mhd.wms.interfaces.dto.receiptMaterialDetail.ReceiptMaterialDetailDTO;
|
||||
import com.mhd.wms.interfaces.dto.stockReceiptOrder.StockReceiptOrderDTO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 收货单Assembler
|
||||
*
|
||||
@@ -30,11 +37,68 @@ public class StockReceiptOrderAssembler {
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
* 编辑/收货提交:DTO → DO。
|
||||
* Jackson/Hutool 对嵌套 {@code materialDetailList[].children} 与 {@code MaterialMoreDetailDTO}→DO 的中转易丢子行,
|
||||
* 导致子项 {@code receiptQuantity} 为 null、不生成收货明细。此处显式递归拷贝,保证子树完整。
|
||||
*/
|
||||
public StockReceiptOrderDO toDOByEdit(StockReceiptOrderDTO stockReceiptOrderDTO) {
|
||||
// 拷贝
|
||||
return JSONUtil.toBean(JSONUtil.toJsonStr(stockReceiptOrderDTO), StockReceiptOrderDO.class);
|
||||
StockReceiptOrderDO target = new StockReceiptOrderDO();
|
||||
String[] topIgnore = appendIgnores(IgnoreNullUtil.getNullPropertyNames(stockReceiptOrderDTO), "materialDetailList");
|
||||
BeanUtils.copyProperties(stockReceiptOrderDTO, target, topIgnore);
|
||||
target.setMaterialDetailList(convertMaterialDetailRows(stockReceiptOrderDTO.getMaterialDetailList()));
|
||||
return target;
|
||||
}
|
||||
|
||||
private static String[] appendIgnores(String[] base, String... extra) {
|
||||
if (extra == null || extra.length == 0) {
|
||||
return base;
|
||||
}
|
||||
String[] out = Arrays.copyOf(base, base.length + extra.length);
|
||||
System.arraycopy(extra, 0, out, base.length, extra.length);
|
||||
return out;
|
||||
}
|
||||
|
||||
private static List<ReceiptMaterialDetailDO> convertMaterialDetailRows(List<ReceiptMaterialDetailDTO> src) {
|
||||
if (src == null) {
|
||||
return null;
|
||||
}
|
||||
List<ReceiptMaterialDetailDO> list = new ArrayList<>(src.size());
|
||||
for (ReceiptMaterialDetailDTO row : src) {
|
||||
list.add(convertOneMaterialDetail(row));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static ReceiptMaterialDetailDO convertOneMaterialDetail(ReceiptMaterialDetailDTO src) {
|
||||
if (src == null) {
|
||||
return null;
|
||||
}
|
||||
ReceiptMaterialDetailDO t = new ReceiptMaterialDetailDO();
|
||||
String[] ignore = appendIgnores(IgnoreNullUtil.getNullPropertyNames(src),
|
||||
"children", "materialMoreDetailList");
|
||||
BeanUtils.copyProperties(src, t, ignore);
|
||||
t.setMaterialMoreDetailList(convertMoreDetailList(src.getMaterialMoreDetailList()));
|
||||
t.setChildren(convertMaterialDetailRows(src.getChildren()));
|
||||
if (src.getMaterialDetailSerialNumberList() != null) {
|
||||
t.setMaterialDetailSerialNumberList(new ArrayList<>(src.getMaterialDetailSerialNumberList()));
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
private static List<MaterialMoreDetailDO> convertMoreDetailList(List<MaterialMoreDetailDTO> src) {
|
||||
if (src == null) {
|
||||
return null;
|
||||
}
|
||||
List<MaterialMoreDetailDO> list = new ArrayList<>(src.size());
|
||||
for (MaterialMoreDetailDTO m : src) {
|
||||
if (m == null) {
|
||||
continue;
|
||||
}
|
||||
MaterialMoreDetailDO d = new MaterialMoreDetailDO();
|
||||
BeanUtils.copyProperties(m, d, IgnoreNullUtil.getNullPropertyNames(m));
|
||||
list.add(d);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+29
-1
@@ -352,4 +352,32 @@ public class InMaterialDetailDTO extends BaseVOEntity {
|
||||
@Excel(name = "总价")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
}
|
||||
@ApiModelProperty("合同收费")
|
||||
@Excel(name = "合同收费")
|
||||
private BigDecimal contractFee;
|
||||
|
||||
@ApiModelProperty("每月仓租")
|
||||
@Excel(name = "每月仓租")
|
||||
private BigDecimal monthlyWarehouseFee;
|
||||
|
||||
@ApiModelProperty("半月仓租")
|
||||
@Excel(name = "半月仓租")
|
||||
private BigDecimal halfMonthWhFee;
|
||||
|
||||
@ApiModelProperty("折扣(%)")
|
||||
@Excel(name = "折扣(%)")
|
||||
private BigDecimal discountRate;
|
||||
|
||||
@ApiModelProperty("单体积(CBM)")
|
||||
@Excel(name = "单体积(CBM)")
|
||||
private BigDecimal singleVolume;
|
||||
|
||||
@ApiModelProperty("单毛重(KG)")
|
||||
@Excel(name = "单毛重(KG)")
|
||||
private BigDecimal singleGrossWeight;
|
||||
|
||||
@ApiModelProperty("lot编号")
|
||||
@Excel(name = "lot编号")
|
||||
private String lotNo;
|
||||
|
||||
}
|
||||
+40
@@ -13,6 +13,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -74,6 +75,9 @@ public class MaterialBaseInfoDTO extends BaseVOEntity {
|
||||
@Excel(name = "物料分类名称")
|
||||
@TableField(typeHandler = ListTypeHandler.class)
|
||||
private List<String> materialClassifyName;
|
||||
@ApiModelProperty("物料分类(导入)")
|
||||
@Excel(name = "物料分类")
|
||||
private String materialClassifyImport;
|
||||
|
||||
@ApiModelProperty("物料种类编码 数据字典")
|
||||
@Excel(name = "物料种类编码 数据字典")
|
||||
@@ -82,6 +86,9 @@ public class MaterialBaseInfoDTO extends BaseVOEntity {
|
||||
@ApiModelProperty("物料种类名称 数据字典")
|
||||
@Excel(name = "物料种类名称 数据字典")
|
||||
private String materialTypeName;
|
||||
@ApiModelProperty("物料种类(导入)")
|
||||
@Excel(name = "物料种类")
|
||||
private String materialTypeImport;
|
||||
|
||||
@ApiModelProperty("包装规格id")
|
||||
@Excel(name = "包装规格id")
|
||||
@@ -94,6 +101,9 @@ public class MaterialBaseInfoDTO extends BaseVOEntity {
|
||||
@ApiModelProperty("包装规格名称")
|
||||
@Excel(name = "包装规格名称")
|
||||
private String packName;
|
||||
@ApiModelProperty("包装规格(导入)")
|
||||
@Excel(name = "包装规格")
|
||||
private String packImport;
|
||||
|
||||
@ApiModelProperty("包装单位编码")
|
||||
@Excel(name = "包装单位编码")
|
||||
@@ -102,6 +112,12 @@ public class MaterialBaseInfoDTO extends BaseVOEntity {
|
||||
@ApiModelProperty("包装单位名称")
|
||||
@Excel(name = "包装单位名称")
|
||||
private String unitName;
|
||||
@ApiModelProperty("物料单位(导入)")
|
||||
@Excel(name = "物料单位")
|
||||
private String unitImport;
|
||||
@ApiModelProperty("单位(导入)")
|
||||
@Excel(name = "单位")
|
||||
private String unitImport2;
|
||||
|
||||
@ApiModelProperty("品牌id")
|
||||
@Excel(name = "品牌id")
|
||||
@@ -192,32 +208,56 @@ public class MaterialBaseInfoDTO extends BaseVOEntity {
|
||||
private Integer common;
|
||||
|
||||
@ApiModelProperty("SKU码")
|
||||
@Excel(name = "SKU码")
|
||||
private String skuCode;
|
||||
|
||||
@ApiModelProperty("单价")
|
||||
@Excel(name = "单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ApiModelProperty("币制")
|
||||
@Excel(name = "币制")
|
||||
private String currency;
|
||||
|
||||
@ApiModelProperty("原产国")
|
||||
@Excel(name = "原产国")
|
||||
private String originCountry;
|
||||
|
||||
@ApiModelProperty("HS码")
|
||||
@Excel(name = "HS码")
|
||||
private String hsCode;
|
||||
@ApiModelProperty("HS编码(导入)")
|
||||
@Excel(name = "HS编码")
|
||||
private String hsCodeImport;
|
||||
|
||||
@ApiModelProperty("申报单位")
|
||||
@Excel(name = "申报单位")
|
||||
private String declarationUnit;
|
||||
|
||||
@ApiModelProperty("法定单位")
|
||||
@Excel(name = "法定单位")
|
||||
private String statutoryUnit;
|
||||
|
||||
@ApiModelProperty("法定第二单位")
|
||||
@Excel(name = "法定第二单位")
|
||||
private String statutorySecondUnit;
|
||||
|
||||
@ApiModelProperty("规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String specificationModel;
|
||||
|
||||
@ApiModelProperty("批次ID")
|
||||
private Long batchId;
|
||||
|
||||
@ApiModelProperty("批次规则(导入:批次名称)")
|
||||
@Excel(name = "批次规则")
|
||||
private String batchRuleNameImport;
|
||||
|
||||
@ApiModelProperty("批次名称(导入)")
|
||||
@Excel(name = "批次名称")
|
||||
private String batchName;
|
||||
|
||||
@ApiModelProperty("批次(导入)")
|
||||
@Excel(name = "批次")
|
||||
private String batchImport;
|
||||
}
|
||||
|
||||
+12
@@ -62,6 +62,10 @@ public class PickingMaterialDetailDTO extends BaseVOEntity {
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String size;
|
||||
|
||||
@ApiModelProperty("净重 单位:千克")
|
||||
@Excel(name = "净重 单位:千克")
|
||||
private BigDecimal weightLimit;
|
||||
@@ -220,4 +224,12 @@ public class PickingMaterialDetailDTO extends BaseVOEntity {
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private BigDecimal totalArea;
|
||||
|
||||
@ApiModelProperty("装卸费")
|
||||
@Excel(name = "装卸费")
|
||||
private BigDecimal loadUnloadFee;
|
||||
|
||||
@ApiModelProperty("贴标费")
|
||||
@Excel(name = "贴标费")
|
||||
private BigDecimal stickerFee;
|
||||
}
|
||||
+4
@@ -65,6 +65,10 @@ public class ReceiptMaterialDetailDTO extends BaseVOEntity {
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String dimensions;
|
||||
|
||||
@ApiModelProperty("计划数量")
|
||||
@Excel(name = "计划数量")
|
||||
private BigDecimal quantity;
|
||||
|
||||
+4
@@ -66,6 +66,10 @@ public class ShelfMaterialDetailDTO extends BaseVOEntity {
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String dimensions;
|
||||
|
||||
@ApiModelProperty("计划数量")
|
||||
@Excel(name = "计划数量")
|
||||
private BigDecimal quantity;
|
||||
|
||||
+5
@@ -156,4 +156,9 @@ public class ImmediateInventoryDTO {
|
||||
|
||||
@ApiModelProperty("复核数量开始")
|
||||
private BigDecimal checkQuantityEnd;
|
||||
|
||||
@ApiModelProperty("批次号")
|
||||
@Excel(name = "批次号")
|
||||
private String batchNumber;
|
||||
|
||||
}
|
||||
@@ -338,9 +338,42 @@ public class StockInOrderDTO extends StockInOrderBaseDTO {
|
||||
@Excel(name = "下单日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date orderDate;
|
||||
|
||||
|
||||
@ApiModelProperty("业务单号")
|
||||
@Excel(name = "业务单号")
|
||||
private String businessOrderNo;
|
||||
|
||||
@ApiModelProperty("业务类型")
|
||||
@Excel(name = "业务类型")
|
||||
private String businessType;
|
||||
|
||||
@ApiModelProperty("制单人")
|
||||
@Excel(name = "制单人")
|
||||
private String documentCreator;
|
||||
|
||||
@ApiModelProperty("制单人名称")
|
||||
@Excel(name = "制单人名称")
|
||||
private String documentCreatorName;
|
||||
|
||||
@ApiModelProperty("制单日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "制单日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date documentDate;
|
||||
|
||||
@ApiModelProperty("订单状态")
|
||||
@Excel(name = "订单状态")
|
||||
private String orderStatus;
|
||||
|
||||
@ApiModelProperty(name = "创建时间查询条件开始日期")
|
||||
private String createTimeStart;
|
||||
|
||||
@ApiModelProperty(name = "创建时间查询条件结束日期")
|
||||
private String createTimeEnd;
|
||||
}
|
||||
|
||||
@ApiModelProperty("入库明细-物料名称(商品名称),模糊匹配,与前端参数 materialName 一致")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("入库明细-物料编码,模糊匹配,与前端参数 materialCode 一致")
|
||||
private String materialCode;
|
||||
}
|
||||
@@ -397,6 +397,12 @@ public class StockOutOrderDTO extends StockOutOrderBaseDTO {
|
||||
@ApiModelProperty(name = "审核时间查询条件结束日期")
|
||||
private String auditTimeEnd;
|
||||
|
||||
@ApiModelProperty("出库明细-物料名称(商品名称),模糊匹配,与前端参数 materialName 一致")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("出库明细-物料编码,模糊匹配,与前端参数 materialCode 一致")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty("出库交接图片,PDA出库交接时上传的照片,多张图片以逗号隔开")
|
||||
private String pictureApp;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user