Merge branch 'dev_20260429' into dev_WMS20260401
# Conflicts: # mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java # mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/UserServiceFeign.java # mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteOmsFeignFallbackFactory.java # mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteUserFeignFallbackFactory.java # mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/batchDetail/BatchDetailApplicationService.java # mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/service/BatchDetailDomainService.java # mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/sysTableConfig/SysTableConfigApi.java
This commit is contained in:
+2
-2
@@ -106,10 +106,10 @@ public class BatchDetailApplicationService {
|
||||
throw new ServiceException("获取物料规则信息失败");
|
||||
}
|
||||
MaterialGoodsRuleFeign materialGoodsRuleFeign = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), MaterialGoodsRuleFeign.class);
|
||||
// 无商品规则或未绑定批次模板时,不返回任何批次属性(避免 batchId 空导致查全表)
|
||||
if (ObjectUtil.isNull(materialGoodsRuleFeign) || materialGoodsRuleFeign.getBatchId() == null) {
|
||||
// 未绑定批次时只返回空列表,不可按空 batchId 全表查 batch_detail
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return getBatchDetailListByBatchId(materialGoodsRuleFeign.getBatchId());
|
||||
}
|
||||
}
|
||||
}
|
||||
+253
@@ -337,6 +337,165 @@ public class ContractManageApplicationService {
|
||||
return result;
|
||||
}
|
||||
|
||||
/** 单据类型「仓库进出仓单」编码(与 BMS / WMS 推送一致) */
|
||||
public static final String DOCUMENT_TYPE_CODE_WAREHOUSE_IN_OUT_ORDER = "WMS_ckjccd";
|
||||
|
||||
/**
|
||||
* 按结算主体取仓储合同结算设置中,单据类型包含指定类型的费用科目编码(按明细行顺序,可重复,调用方去重)。
|
||||
* 科目编码优先取二级 {@code second_subject_code},为空则取一级 {@code first_subject_code}。
|
||||
* settlementCustomersCode 为空时与同模块合同逻辑一致:使用通用仓储合同(commonContractFlag=1)。
|
||||
*/
|
||||
public List<String> listSecondSubjectCodesBySettlementAndDocumentType(String settlementCustomersCode,
|
||||
Long organizationId,
|
||||
Long topOrganizationId,
|
||||
String documentTypeCode) {
|
||||
if (StringUtils.isEmpty(documentTypeCode)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
ContractManagePO contractManagePO = getInfoByCustomerAndOrganizationId(settlementCustomersCode, 1, topOrganizationId, organizationId);
|
||||
if (contractManagePO == null || contractManagePO.getContractManageId() == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<ContractManageDetailPO> detailPOS = contractManageDetailDomainService.queryListByManageId(contractManagePO.getContractManageId());
|
||||
if (detailPOS == null || detailPOS.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<String> codes = new ArrayList<>();
|
||||
for (ContractManageDetailPO detail : detailPOS) {
|
||||
if (detail == null) {
|
||||
continue;
|
||||
}
|
||||
String subjectCode = resolveContractDetailExpenseSubjectCode(detail);
|
||||
if (StringUtils.isEmpty(subjectCode)) {
|
||||
continue;
|
||||
}
|
||||
if (!matchesContractDetailWarehouseInOut(detail, documentTypeCode)) {
|
||||
continue;
|
||||
}
|
||||
codes.add(subjectCode);
|
||||
}
|
||||
return codes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 合同结算行的费用科目编码:有二级科目用二级,否则用一级。
|
||||
*/
|
||||
private static String resolveContractDetailExpenseSubjectCode(ContractManageDetailPO detail) {
|
||||
if (detail == null) {
|
||||
return null;
|
||||
}
|
||||
if (!StringUtils.isEmpty(detail.getSecondSubjectCode())) {
|
||||
return detail.getSecondSubjectCode().trim();
|
||||
}
|
||||
if (!StringUtils.isEmpty(detail.getFirstSubjectCode())) {
|
||||
return detail.getFirstSubjectCode().trim();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否属于「仓库进出仓单」类结算行:优先按单据类型编码精确匹配(含逗号分隔多编码),
|
||||
* 避免因 BMS 主数据编码与 WMS 计费推送编码(如 WMS_ckjccd)不一致导致筛掉全部行;
|
||||
* 兼容按单据类型名称包含「仓库进出仓」判定(合同保存时会拼接中文名称)。
|
||||
*/
|
||||
private static boolean matchesContractDetailWarehouseInOut(ContractManageDetailPO detail, String documentTypeCode) {
|
||||
if (detail == null || StringUtils.isEmpty(documentTypeCode)) {
|
||||
return false;
|
||||
}
|
||||
if (contractDetailContainsDocumentType(detail.getDocumentTypeCode(), documentTypeCode)) {
|
||||
return true;
|
||||
}
|
||||
String typeNames = detail.getDocumentType();
|
||||
if (StringUtils.isEmpty(typeNames)) {
|
||||
return false;
|
||||
}
|
||||
return Stream.of(typeNames.split(","))
|
||||
.map(String::trim)
|
||||
.filter(s -> !StringUtils.isEmpty(s))
|
||||
.anyMatch(n -> n.contains("仓库进出仓"));
|
||||
}
|
||||
|
||||
private static boolean contractDetailContainsDocumentType(String detailDocumentTypeCodes, String documentTypeCode) {
|
||||
if (StringUtils.isEmpty(detailDocumentTypeCodes)) {
|
||||
return false;
|
||||
}
|
||||
return Stream.of(detailDocumentTypeCodes.split(","))
|
||||
.map(String::trim)
|
||||
.filter(s -> !StringUtils.isEmpty(s))
|
||||
.anyMatch(code -> code.equalsIgnoreCase(documentTypeCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 按单据类型取合同结算行上的计费单价(计费策略展开的 isFee 项)。
|
||||
* <p>多条结算明细共用同一计费策略(accounting_strategy_id 相同)时,只展开一次策略参数,
|
||||
* 避免前端出现重复的单价列。</p>
|
||||
*/
|
||||
public List<SubjectAndPriceReturn> getPrice(String documentTypeCode, String settlementCustomersCode,Long organizationId,Long topOrganizationId) {
|
||||
List<SubjectAndPriceReturn> result = new ArrayList<>();
|
||||
ContractManagePO contractManagePO = getInfoByCustomerAndOrganizationId(settlementCustomersCode, 1, topOrganizationId, organizationId);
|
||||
List<ContractManageDetailPO> detailPOS = contractManageDetailDomainService.queryListByManageId(contractManagePO.getContractManageId());
|
||||
contractManagePO.setContractManageDetailPOList(detailPOS);
|
||||
if (contractManagePO != null) {
|
||||
List<ContractManageDetailPO> contractManageDetailPOList = contractManagePO.getContractManageDetailPOList();
|
||||
if (contractManageDetailPOList != null && contractManageDetailPOList.size() > 0) {
|
||||
List<ContractManageDetailPO> contractManageDetailPOs = contractManageDetailPOList.stream()
|
||||
.filter(item -> contractDetailContainsDocumentType(item.getDocumentTypeCode(), documentTypeCode))
|
||||
.collect(Collectors.toList());
|
||||
if (contractManageDetailPOs != null && contractManageDetailPOs.size() > 0) {
|
||||
Set<Long> expandedAccountingStrategyIds = new HashSet<>();
|
||||
for (ContractManageDetailPO contractManageDetailPO : contractManageDetailPOs) {
|
||||
Long accountingStrategyId = contractManageDetailPO.getAccountingStrategyId();
|
||||
if (accountingStrategyId == null || !expandedAccountingStrategyIds.add(accountingStrategyId)) {
|
||||
continue;
|
||||
}
|
||||
List<BillingParamsPO> billingParams = contractManageDetailMapper.getBillingParams(accountingStrategyId);
|
||||
if (billingParams != null && billingParams.size() > 0) {
|
||||
//if (billingParams != null && billingParams.size() > 0) {
|
||||
BillingParamsPO billingParam = billingParams.get(0);
|
||||
String billingParamsJson = billingParam.getBillingParamsJson();
|
||||
String preSetRules = billingParam.getPreSetRules();
|
||||
Long billingParamsId = billingParam.getBillingParamsId();
|
||||
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 (preSetRulesList != null && preSetRulesList.size() > 0) {
|
||||
Map<String, Object> stringObjectMap1 = preSetRulesList.get(0);
|
||||
for (Map<String, Object> stringObjectMap : billingParamsList) {
|
||||
String fieldsName = (String) stringObjectMap.get("fieldsName");
|
||||
String isShow = (String) stringObjectMap.get("isShow");
|
||||
String isFee = (String) stringObjectMap.get("isFee");
|
||||
String isPush = (String) stringObjectMap.get("isPush");
|
||||
if ("1".equals(isFee)) {
|
||||
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(accountingStrategyId);
|
||||
subjectAndPriceReturn.setIsShow(isShow);
|
||||
subjectAndPriceReturn.setIsFee(isFee);
|
||||
subjectAndPriceReturn.setIsPush(isPush);
|
||||
subjectAndPriceReturn.setRulesId(billingParamsId);
|
||||
result.add(subjectAndPriceReturn);
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
} else {
|
||||
throw new ServiceException("计费参数不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new ServiceException("合同信息不存在");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<SubjectAndPriceReturn> getSubject(SubjectAndPriceDTO contractManageDTO) {
|
||||
List<SubjectAndPriceReturn> result = new ArrayList<>();
|
||||
Long settlementCustomersId = contractManageDTO.getSettlementCustomersId();
|
||||
@@ -757,6 +916,100 @@ public class ContractManageApplicationService {
|
||||
return resultContract;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据结算主体获取合同信息
|
||||
* @param settlementCustomersCode 结算主体code
|
||||
* @param contractType 合同类型
|
||||
*/
|
||||
public ContractManagePO getInfoByCustomerAndOrganizationId(String settlementCustomersCode,Integer contractType, Long topOrganizationId, Long organizationId) {
|
||||
/*
|
||||
首先根据合同类型(仓储、运输),以及结算客户,查询合同信息
|
||||
如果传了结算主体,则根据结算主体以及当前时间查询有效的特殊合同,如果特殊合同没有,则查询通用合同
|
||||
*/
|
||||
//获取当前登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser) && topOrganizationId == null) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
if(contractType==null){
|
||||
throw new ServiceException("合同类型不能为空");
|
||||
}
|
||||
ContractManagePO resultContract = new ContractManagePO();
|
||||
//查询当前日期在有效期内的合同
|
||||
ContractManageDO queryParam = new ContractManageDO();
|
||||
queryParam.setNowDateString(DateUtil.format(new Date(),"yyyy-MM-dd"));
|
||||
if (!ObjectUtil.isNull(loginUser)) {
|
||||
queryParam.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}else {
|
||||
queryParam.setTopOrganizationId(topOrganizationId);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(organizationId)) {
|
||||
queryParam.setOrganizationId(organizationId);
|
||||
}
|
||||
List<ContractManagePO> contractManagePOList = contractManageDomainService.queryList(queryParam);
|
||||
if(contractManagePOList != null && contractManagePOList.size()>0){
|
||||
if(StringUtils.isNotEmpty(settlementCustomersCode)){
|
||||
//根据结算对象,及合同的类型 查询对应合同信息
|
||||
ContractManagePO contractManagePO = contractManagePOList.stream()
|
||||
.filter(item -> item.getSettlementCustomersCode().equals(settlementCustomersCode) && Objects.equals(item.getContractType(), contractType)).findFirst().orElse(null);
|
||||
if(null == contractManagePO){
|
||||
if(contractType==1){
|
||||
//仓储合同
|
||||
resultContract = contractManagePOList.stream()
|
||||
.filter(item ->
|
||||
item.getContractType()==1 &&
|
||||
item.getCommonContractFlag() == 1 && item.getContractState() ==2)
|
||||
.findFirst().orElse(null);
|
||||
}else{
|
||||
//运输合同
|
||||
resultContract = contractManagePOList.stream().filter(item -> item.getContractType()==2
|
||||
&& item.getCommonContractFlag() == 1 && item.getContractState() ==2).findFirst().orElse(null);
|
||||
}
|
||||
}else {
|
||||
resultContract = contractManagePO;
|
||||
}
|
||||
}else {
|
||||
if(contractType==1){
|
||||
//仓储合同
|
||||
resultContract = contractManagePOList.stream().filter(contractManagePO -> contractManagePO.getContractType()==1
|
||||
&& contractManagePO.getCommonContractFlag() == 1 && contractManagePO.getContractState() ==2).findFirst().orElse(null);
|
||||
}else{
|
||||
//运输合同
|
||||
resultContract = contractManagePOList.stream().filter(contractManagePO -> contractManagePO.getContractType()==2
|
||||
&& contractManagePO.getCommonContractFlag() == 1 && contractManagePO.getContractState() ==2).findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
if(null == resultContract){
|
||||
throw new ServiceException("找不到匹配的合同,请重试");
|
||||
}
|
||||
//得到合同后,查询合同明细
|
||||
List<ContractManageDetailPO> contractManageDetailPOList = contractManageDetailDomainService.queryListByManageId(resultContract.getContractManageId());
|
||||
List<ContractManageDetailPO> contractManageDetailSaveList = new ArrayList<>();
|
||||
if(contractManageDetailPOList != null && contractManageDetailPOList.size()>0){
|
||||
//将临时合同中没有,但是通用合同中有的数据过滤出(使用 ObjectUtil.equal 避免 firstSubjectCode/secondSubjectCode 为 null 时 NPE)
|
||||
contractManageDetailSaveList = contractManageDetailPOList.stream().filter(item -> contractManageDetailPOList.stream().noneMatch(item1 -> ObjectUtil.equal(item1.getFirstSubjectCode(), item.getFirstSubjectCode()) && ObjectUtil.equal(item1.getSecondSubjectCode(), item.getSecondSubjectCode()) && item1.getSubjectType()==1)).collect(Collectors.toList());
|
||||
//首先根据结算科目类型将临时合同过滤出
|
||||
List<ContractManageDetailPO> tempContractManageDetailPOList = contractManageDetailPOList.stream().filter(item -> item.getSubjectType()==2).collect(Collectors.toList());
|
||||
//遍历两个集合,将相同费用科目code的数据,进行比较,如果结算科目类型是临时且合同有效期有效,则使用该条数据,将另一条移除
|
||||
for (ContractManageDetailPO manageDetailPO : tempContractManageDetailPOList) {
|
||||
for (ContractManageDetailPO contractManageDetailPO : contractManageDetailPOList) {
|
||||
if(ObjectUtil.equal(contractManageDetailPO.getFirstSubjectCode(), manageDetailPO.getFirstSubjectCode()) && ObjectUtil.equal(contractManageDetailPO.getSecondSubjectCode(), manageDetailPO.getSecondSubjectCode())){
|
||||
//判断如果是临时合同在有效期内,则将该条数据保存到集合contractManageDetailSaveList
|
||||
DateTime start = DateUtil.parseDate(DateUtil.format(manageDetailPO.getSubjectEffectiveDate(),"yyyy-MM-dd"));
|
||||
DateTime end = DateUtil.parseDateTime(DateUtil.format(manageDetailPO.getSubjectEffectiveDate(),"yyyy-MM-dd"));
|
||||
DateTime now = DateUtil.beginOfDay(DateUtil.date());
|
||||
if (now.isAfterOrEquals(start) && now.isBefore(end)) {
|
||||
contractManageDetailSaveList.add(manageDetailPO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
resultContract.setContractManageDetailPOList(contractManageDetailSaveList);
|
||||
}
|
||||
return resultContract;
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废合同
|
||||
* @param contractManageDTO
|
||||
|
||||
+59
@@ -9,6 +9,7 @@ import com.mhd.basic.domain.expenseAccount.repository.po.QueryExpenseAccountPO;
|
||||
import com.mhd.basic.domain.expenseAccount.repository.todo.ExpenseAccountDO;
|
||||
import com.mhd.basic.domain.expenseAccount.repository.todo.ExpenseAccountDoMap;
|
||||
import com.mhd.basic.domain.expenseAccount.repository.todo.SearchExpenseAccountDO;
|
||||
import com.mhd.basic.application.service.contractManage.ContractManageApplicationService;
|
||||
import com.mhd.basic.domain.expenseAccount.service.ExpenseAccountDomainService;
|
||||
import com.mhd.basic.infrastructure.feign.vo.SysDictDataVo;
|
||||
import com.mhd.basic.interfaces.dto.expenseAccount.ExpenseAccountDTO;
|
||||
@@ -27,8 +28,10 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -45,8 +48,64 @@ public class ExpenseAccountApplicationService {
|
||||
@Autowired
|
||||
private ExpenseAccountDomainService expenseAccountDomainService;
|
||||
@Autowired
|
||||
private ContractManageApplicationService contractManageApplicationService;
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
|
||||
/**
|
||||
* 入库/出库费用登记等场景:按仓储合同「仓库进出仓单」结算行取科目(二级编码优先,否则一级),再关联费用科目主数据。
|
||||
* <p>科目范围以合同结算设置为准;若 {@code expenseAccountDO.inOrderDisplay} 或 {@code expenseAccountDO.outOrderDisplay} 非空,
|
||||
* 再按主数据「入库单是否固定显示 / 出库单是否固定显示」(0-否 1-是)与入参相等过滤,二者同时传则同时满足(AND)。</p>
|
||||
* settlementCustomersCode 不传或为空时使用通用仓储合同。
|
||||
*/
|
||||
public List<ExpenseAccountPO> queryListFromContractWarehouseInOutSettlement(ExpenseAccountDO expenseAccountDO, String settlementCustomersCode) {
|
||||
Long topOrgIdForExpense = expenseAccountDO.getTopOrganizationId();
|
||||
if (topOrgIdForExpense == null) {
|
||||
LoginUser lu = SecurityUtils.getLoginUser();
|
||||
if (lu != null && lu.getUserPo() != null && lu.getUserPo().getTopOrganizationId() != null) {
|
||||
topOrgIdForExpense = lu.getUserPo().getTopOrganizationId();
|
||||
}
|
||||
}
|
||||
List<String> orderedCodes = contractManageApplicationService.listSecondSubjectCodesBySettlementAndDocumentType(
|
||||
settlementCustomersCode,
|
||||
expenseAccountDO.getOrganizationId(),
|
||||
topOrgIdForExpense,
|
||||
ContractManageApplicationService.DOCUMENT_TYPE_CODE_WAREHOUSE_IN_OUT_ORDER);
|
||||
log.info("按合同取费用科目编码:topOrgIdForExpense={}, 命中结算行科目数={}", topOrgIdForExpense,
|
||||
orderedCodes != null ? orderedCodes.size() : 0);
|
||||
boolean filterIn = expenseAccountDO.getInOrderDisplay() != null;
|
||||
boolean filterOut = expenseAccountDO.getOutOrderDisplay() != null;
|
||||
if (filterIn || filterOut) {
|
||||
log.info("合同科目叠加主数据出入库显示过滤:inOrderDisplay={}, outOrderDisplay={}",
|
||||
expenseAccountDO.getInOrderDisplay(), expenseAccountDO.getOutOrderDisplay());
|
||||
}
|
||||
List<ExpenseAccountPO> result = new ArrayList<>();
|
||||
for (String code : orderedCodes) {
|
||||
if (StringUtils.isEmpty(code)) {
|
||||
continue;
|
||||
}
|
||||
ExpenseAccountPO po = expenseAccountDomainService.getInfoByCode2(code.trim(), topOrgIdForExpense);
|
||||
if (po != null && po.getExpenseAccountId() != null && passWarehouseInOutDisplayFilter(po, expenseAccountDO)) {
|
||||
result.add(po);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 合同路径下可选:与主数据 in_order_display / out_order_display 一致才保留(入参为 null 的维度不参与过滤)。
|
||||
*/
|
||||
private static boolean passWarehouseInOutDisplayFilter(ExpenseAccountPO po, ExpenseAccountDO filter) {
|
||||
if (filter.getInOrderDisplay() != null
|
||||
&& !Objects.equals(po.getInOrderDisplay(), filter.getInOrderDisplay())) {
|
||||
return false;
|
||||
}
|
||||
if (filter.getOutOrderDisplay() != null
|
||||
&& !Objects.equals(po.getOutOrderDisplay(), filter.getOutOrderDisplay())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询费用科目列表
|
||||
|
||||
+25
-8
@@ -107,7 +107,31 @@ public class AssociationWarehouseImpl extends ServiceImpl<AssociationWarehouseMa
|
||||
associationWarehouseDO.setWarehouseId(associationWarehouseDO.getWarehouseIdIdList().get(0));
|
||||
//设置仓库信息
|
||||
warehouseParam(associationWarehouseDO);
|
||||
for (Long correlationId : associationWarehouseDO.getCorrelationIdList()){
|
||||
// 先删该仓下「非默认仓」绑定,再批量插入本次提交的用户;保留 is_default=2(如新建仓自动写入的创建人默认仓),避免前端列表不展示该条却全量保存时被误删
|
||||
remove(new QueryWrapper<AssociationWarehouse>().lambda()
|
||||
.eq(AssociationWarehouse::getWarehouseId, associationWarehouseDO.getWarehouseId())
|
||||
.eq(AssociationWarehouse::getDelFlag, 1)
|
||||
.and(w -> w.isNull(AssociationWarehouse::getIsDefault)
|
||||
.or()
|
||||
.ne(AssociationWarehouse::getIsDefault, 2)));
|
||||
List<AssociationWarehouse> stillBoundRows = associationWarehouseMapper.selectList(new QueryWrapper<AssociationWarehouse>().lambda()
|
||||
.eq(AssociationWarehouse::getWarehouseId, associationWarehouseDO.getWarehouseId())
|
||||
.eq(AssociationWarehouse::getDelFlag, 1));
|
||||
Set<Long> alreadyBoundCorrelationIds = stillBoundRows.stream()
|
||||
.map(AssociationWarehouse::getCorrelationId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
LinkedHashSet<Long> distinctCorrelationIds = CollectionUtils.isEmpty(associationWarehouseDO.getCorrelationIdList())
|
||||
? new LinkedHashSet<>()
|
||||
: new LinkedHashSet<>(associationWarehouseDO.getCorrelationIdList());
|
||||
for (Long correlationId : distinctCorrelationIds) {
|
||||
if (correlationId == null) {
|
||||
continue;
|
||||
}
|
||||
// 仍在库内的绑定(多为创建人默认仓 is_default=2)不再插入,否则撞唯一 IDX_ASS_COR_WAR_ID
|
||||
if (alreadyBoundCorrelationIds.contains(correlationId)) {
|
||||
continue;
|
||||
}
|
||||
AssociationWarehouse associationWarehouse = new AssociationWarehouse();
|
||||
associationWarehouse.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
associationWarehouse.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
@@ -121,13 +145,6 @@ public class AssociationWarehouseImpl extends ServiceImpl<AssociationWarehouseMa
|
||||
associationWarehouse.setCreateTime(new Date());
|
||||
associationWarehouseList.add(associationWarehouse);
|
||||
}
|
||||
// 先删该仓下「非默认仓」绑定,再批量插入本次提交的用户;保留 is_default=2(如新建仓自动写入的创建人默认仓),避免前端列表不展示该条却全量保存时被误删
|
||||
remove(new QueryWrapper<AssociationWarehouse>().lambda()
|
||||
.eq(AssociationWarehouse::getWarehouseId, associationWarehouseDO.getWarehouseId())
|
||||
.eq(AssociationWarehouse::getDelFlag, 1)
|
||||
.and(w -> w.isNull(AssociationWarehouse::getIsDefault)
|
||||
.or()
|
||||
.ne(AssociationWarehouse::getIsDefault, 2)));
|
||||
}
|
||||
return saveBatch(associationWarehouseList);
|
||||
}
|
||||
|
||||
+1
-1
@@ -75,4 +75,4 @@ public class BatchDetailDomainService {
|
||||
batchDetailDO.setBatchId(batchId);
|
||||
return batchDetailService.queryList(batchDetailDO);
|
||||
}
|
||||
}
|
||||
}
|
||||
+22
@@ -1,6 +1,7 @@
|
||||
package com.mhd.basic.domain.expenseAccount.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -113,4 +114,25 @@ public class ExpenseAccount extends BaseVOEntity{
|
||||
@ApiModelProperty("费率")
|
||||
private BigDecimal rate;
|
||||
|
||||
@ApiModelProperty("计费单位")
|
||||
private String billingUnit;
|
||||
|
||||
@ApiModelProperty("计费单位英文")
|
||||
private String billingUnitEn;
|
||||
|
||||
@ApiModelProperty("计费单位2")
|
||||
private String billingUnit2;
|
||||
|
||||
@ApiModelProperty("计费单位2英文")
|
||||
private String billingUnitEn2;
|
||||
|
||||
@ApiModelProperty("计费单位中文默认")
|
||||
private String billingUnitDefaultCn;
|
||||
|
||||
@ApiModelProperty("计费单位英文默认")
|
||||
private String billingUnitDefaultEn;
|
||||
|
||||
@ApiModelProperty("nc科目编码")
|
||||
private String ncSubjectCode;
|
||||
|
||||
}
|
||||
+23
@@ -1,5 +1,6 @@
|
||||
package com.mhd.basic.domain.expenseAccount.repository.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
@@ -136,4 +137,26 @@ public class ExpenseAccountPO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty(name = "出库单是否固定显示 0-否 1-是")
|
||||
private Integer outOrderDisplay;
|
||||
|
||||
|
||||
@ApiModelProperty("计费单位")
|
||||
private String billingUnit;
|
||||
|
||||
@ApiModelProperty("计费单位英文")
|
||||
private String billingUnitEn;
|
||||
|
||||
@ApiModelProperty("计费单位2")
|
||||
private String billingUnit2;
|
||||
|
||||
@ApiModelProperty("计费单位2英文")
|
||||
private String billingUnitEn2;
|
||||
|
||||
@ApiModelProperty("计费单位中文默认")
|
||||
private String billingUnitDefaultCn;
|
||||
|
||||
@ApiModelProperty("计费单位英文默认")
|
||||
private String billingUnitDefaultEn;
|
||||
|
||||
@ApiModelProperty("nc科目编码")
|
||||
private String ncSubjectCode;
|
||||
}
|
||||
+28
@@ -153,4 +153,32 @@ public class ExpenseAccountDO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty(name = "创建者姓名")
|
||||
private String updateByName;
|
||||
|
||||
|
||||
@ApiModelProperty("计费单位")
|
||||
private String billingUnit;
|
||||
|
||||
@ApiModelProperty("计费单位英文")
|
||||
private String billingUnitEn;
|
||||
|
||||
@ApiModelProperty("计费单位2")
|
||||
private String billingUnit2;
|
||||
|
||||
@ApiModelProperty("计费单位2英文")
|
||||
private String billingUnitEn2;
|
||||
|
||||
@ApiModelProperty("计费单位中文默认")
|
||||
private String billingUnitDefaultCn;
|
||||
|
||||
@ApiModelProperty("计费单位英文默认")
|
||||
private String billingUnitDefaultEn;
|
||||
|
||||
@ApiModelProperty("nc科目编码")
|
||||
private String ncSubjectCode;
|
||||
|
||||
/** 查询参数:是否按仓储合同结算设置拉取科目 */
|
||||
private Boolean contractSettlementQuery;
|
||||
|
||||
/** 查询参数:结算主体编码(货主编码等) */
|
||||
private String settlementCustomersCode;
|
||||
}
|
||||
+9
@@ -389,4 +389,13 @@ public class MaterialBaseInfo extends BaseVOEntity{
|
||||
@ApiModelProperty("是否抄码: 1-是 2-否")
|
||||
@Excel(name = "是否抄码: 1-是 2-否")
|
||||
private Integer copyCode;
|
||||
|
||||
@ApiModelProperty("货物类型:0-物料 1-半成品 2-成品")
|
||||
@Excel(name = "货物类型:0-物料 1-半成品 2-成品")
|
||||
private Integer goodsType;
|
||||
|
||||
@ApiModelProperty("毛重(kg)")
|
||||
@Excel(name = "毛重(kg)")
|
||||
private BigDecimal grossWeight;
|
||||
|
||||
}
|
||||
+8
@@ -365,6 +365,14 @@ public class MaterialBaseInfoPO extends BaseVOEntity{
|
||||
@Excel(name = "是否抄码: 1-是 2-否")
|
||||
private Integer copyCode;
|
||||
|
||||
@ApiModelProperty("货物类型:0-物料 1-半成品 2-成品")
|
||||
@Excel(name = "货物类型:0-物料 1-半成品 2-成品")
|
||||
private Integer goodsType;
|
||||
|
||||
@ApiModelProperty("毛重(kg)")
|
||||
@Excel(name = "毛重(kg)")
|
||||
private BigDecimal grossWeight;
|
||||
|
||||
@ApiModelProperty("商品规则")
|
||||
private MaterialGoodsRuleFeign materialGoodsRule;
|
||||
|
||||
|
||||
+8
@@ -385,4 +385,12 @@ public class MaterialBaseInfoDO extends BaseVOEntity{
|
||||
@ApiModelProperty("是否抄码: 1-是 2-否")
|
||||
@Excel(name = "是否抄码: 1-是 2-否")
|
||||
private Integer copyCode;
|
||||
|
||||
@ApiModelProperty("货物类型:0-物料 1-半成品 2-成品")
|
||||
@Excel(name = "货物类型:0-物料 1-半成品 2-成品")
|
||||
private Integer goodsType;
|
||||
|
||||
@ApiModelProperty("毛重(kg)")
|
||||
@Excel(name = "毛重(kg)")
|
||||
private BigDecimal grossWeight;
|
||||
}
|
||||
+31
@@ -138,4 +138,35 @@ public class ExpenseAccountDTO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty(name = "出库单是否固定显示 0-否 1-是")
|
||||
private Integer outOrderDisplay;
|
||||
|
||||
|
||||
@ApiModelProperty("计费单位")
|
||||
private String billingUnit;
|
||||
|
||||
@ApiModelProperty("计费单位英文")
|
||||
private String billingUnitEn;
|
||||
|
||||
@ApiModelProperty("计费单位2")
|
||||
private String billingUnit2;
|
||||
|
||||
@ApiModelProperty("计费单位2英文")
|
||||
private String billingUnitEn2;
|
||||
|
||||
@ApiModelProperty("计费单位中文默认")
|
||||
private String billingUnitDefaultCn;
|
||||
|
||||
@ApiModelProperty("计费单位英文默认")
|
||||
private String billingUnitDefaultEn;
|
||||
|
||||
@ApiModelProperty("nc科目编码")
|
||||
private String ncSubjectCode;
|
||||
|
||||
/**
|
||||
* 为 true 时从仓储合同「结算设置」取费用科目(入库/出库费用登记等)
|
||||
*/
|
||||
@ApiModelProperty("是否按合同结算设置查询费用科目(入库/出库费用登记;为 true 时可传 inOrderDisplay=1 或 outOrderDisplay=1 再按主数据入库/出库显示过滤)")
|
||||
private Boolean contractSettlementQuery;
|
||||
|
||||
@ApiModelProperty("结算主体编码(通常为货主编码);不传则按通用仓储合同的结算设置取科目")
|
||||
private String settlementCustomersCode;
|
||||
}
|
||||
+9
@@ -364,4 +364,13 @@ public class MaterialBaseInfoDTO extends BaseVOEntity{
|
||||
@ApiModelProperty("是否抄码: 1-是 2-否")
|
||||
@Excel(name = "是否抄码: 1-是 2-否")
|
||||
private Integer copyCode;
|
||||
|
||||
@ApiModelProperty("货物类型:0-物料 1-半成品 2-成品")
|
||||
@Excel(name = "货物类型:0-物料 1-半成品 2-成品")
|
||||
private Integer goodsType;
|
||||
|
||||
@ApiModelProperty("毛重(kg)")
|
||||
@Excel(name = "毛重(kg)")
|
||||
private BigDecimal grossWeight;
|
||||
|
||||
}
|
||||
+20
@@ -70,6 +70,19 @@ public class ContractManageApi extends BaseController{
|
||||
return AjaxResult.success(contractManageApplicationService.getSubject(subjectAndPriceDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单价
|
||||
*/
|
||||
@ApiOperation("获取单价")
|
||||
@GetMapping(value = "/getPrice")
|
||||
public AjaxResult getPrice(@RequestParam("documentTypeCode") String documentTypeCode,
|
||||
@RequestParam("settlementCustomersCode") String settlementCustomersCode,
|
||||
@RequestParam("organizationId") Long organizationId,
|
||||
@RequestParam("topOrganizationId") Long topOrganizationId)
|
||||
{
|
||||
return AjaxResult.success(contractManageApplicationService.getPrice(documentTypeCode,settlementCustomersCode,organizationId,topOrganizationId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取科目和单价
|
||||
*/
|
||||
@@ -154,6 +167,13 @@ public class ContractManageApi extends BaseController{
|
||||
return AjaxResult.success(contractManageApplicationService.getInfoByCustomer(settlementCustomersCode,contractType,topOrganizationId));
|
||||
}
|
||||
|
||||
@ApiOperation("根据结算主体获取合同信息")
|
||||
@GetMapping(value = "/getInfoByCustomerAndOrganizationId")
|
||||
public AjaxResult getInfoByCustomerAndOrganizationId(@RequestParam("settlementCustomersCode") String settlementCustomersCode,@RequestParam("contractType") Integer contractType,@RequestParam("topOrganizationId") Long topOrganizationId,@RequestParam("organizationId") Long organizationId)
|
||||
{
|
||||
return AjaxResult.success(contractManageApplicationService.getInfoByCustomerAndOrganizationId(settlementCustomersCode,contractType,topOrganizationId,organizationId));
|
||||
}
|
||||
|
||||
@ApiOperation("根据合同编码获取合同管理")
|
||||
@GetMapping(value = "/getInfoByCode")
|
||||
public AjaxResult getInfoByCode(@RequestParam(value = "contractNumber",required = true) String contractNumber)
|
||||
|
||||
+17
@@ -50,6 +50,11 @@ public class ExpenseAccountApi extends BaseController{
|
||||
|
||||
/**
|
||||
* 分页查询费用科目列表
|
||||
*
|
||||
* <p>入库/出库费用登记等场景传 {@code contractSettlementQuery=true}(与单据类型「仓库进出仓单」合同结算行一致),
|
||||
* 科目来源、结算主体为空走通用合同等逻辑<strong>入库与出库相同</strong>。
|
||||
* 先按合同结算行取科目,再关联主数据;若请求中传入 {@code inOrderDisplay} 或 {@code outOrderDisplay}(0-否 1-是),
|
||||
* 则再按主数据「入库单 / 出库单是否固定显示」与入参相等过滤(二者都传则同时满足)。不传则不在此维度过滤。</p>
|
||||
*/
|
||||
@ApiOperation("查询费用科目列表")
|
||||
@GetMapping("/list")
|
||||
@@ -62,6 +67,18 @@ public class ExpenseAccountApi extends BaseController{
|
||||
expenseAccountDTO = new ExpenseAccountDTO();
|
||||
logger.info("expenseAccountDTO 为 null,创建新对象");
|
||||
}
|
||||
if (Boolean.TRUE.equals(expenseAccountDTO.getContractSettlementQuery())) {
|
||||
ExpenseAccountDO contractQueryDO = new ExpenseAccountDO();
|
||||
BeanUtils.copyProperties(expenseAccountDTO, contractQueryDO);
|
||||
logger.info("按合同结算设置查询费用科目,settlementCustomersCode={},inOrderDisplay={},outOrderDisplay={}",
|
||||
expenseAccountDTO.getSettlementCustomersCode(),
|
||||
expenseAccountDTO.getInOrderDisplay(), expenseAccountDTO.getOutOrderDisplay());
|
||||
List<ExpenseAccountPO> contractList =
|
||||
expenseAccountApplicationService.queryListFromContractWarehouseInOutSettlement(
|
||||
contractQueryDO, expenseAccountDTO.getSettlementCustomersCode());
|
||||
logger.info("按合同结算设置查询完成,条数:{}", contractList != null ? contractList.size() : 0);
|
||||
return getDataTable(contractList != null ? contractList : new ArrayList<>());
|
||||
}
|
||||
ExpenseAccountDO expenseAccountDO = new ExpenseAccountDO();
|
||||
BeanUtils.copyProperties(expenseAccountDTO, expenseAccountDO);
|
||||
logger.info("转换后的 ExpenseAccountDO:{}", expenseAccountDO);
|
||||
|
||||
+18
@@ -5,6 +5,9 @@ import com.mhd.basic.interfaces.vo.MaterialStockInfoVo;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.mhd.system.api.OmsServiceFeign;
|
||||
import com.mhd.system.api.domain.ErpCountryDTO;
|
||||
import com.mhd.system.api.domain.ErpEnterpriseUnitDTO;
|
||||
import com.mhd.system.api.domain.MaterialBarCodeFeign;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -41,6 +44,9 @@ public class MaterialBaseInfoApi extends BaseController{
|
||||
@Resource
|
||||
private MaterialBaseInfoAssembler materialBaseInfoAssembler;
|
||||
|
||||
@Resource
|
||||
private OmsServiceFeign omsServiceFeign;
|
||||
|
||||
/**
|
||||
* 分页查询物料基础信息列表
|
||||
*/
|
||||
@@ -108,4 +114,16 @@ public class MaterialBaseInfoApi extends BaseController{
|
||||
return R.ok(materialBaseInfoApplicationService.getMaterialStockList(shipperName,materialName,machineCode,pageNum,pageSize));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("获取企业单位列表-申报单位下拉框用")
|
||||
@GetMapping("/getDeclarationUnitList")
|
||||
public AjaxResult getDeclarationUnitList(ErpEnterpriseUnitDTO erpEnterpriseUnitDTO) {
|
||||
return omsServiceFeign.getUnitList(erpEnterpriseUnitDTO);
|
||||
}
|
||||
|
||||
@ApiOperation("获取企业国别列表-原产国下拉框用")
|
||||
@GetMapping("/getCountryList")
|
||||
public AjaxResult getCountryList(ErpCountryDTO erpCountryDTO) {
|
||||
return omsServiceFeign.getCountryList(erpCountryDTO);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user