diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/BatchDetailFeignPO.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/BatchDetailFeignPO.java index e0645a815..d2d867393 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/BatchDetailFeignPO.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/BatchDetailFeignPO.java @@ -44,6 +44,10 @@ public class BatchDetailFeignPO extends BaseVOEntity{ @Excel(name = "批次标签") private String batchLabels; + @ApiModelProperty("字段名称") + @Excel(name = "字段名称") + private String fieldName; + @ApiModelProperty("输入控制: 1-必填 2-可选") @Excel(name = "输入控制: 1-必填 2-可选") private String inputControl; @@ -56,6 +60,10 @@ public class BatchDetailFeignPO extends BaseVOEntity{ @Excel(name = "属性选项") private String attributeOption; + @ApiModelProperty("是否显示: 0-不显示 1-显示") + @Excel(name = "是否显示: 0-不显示 1-显示") + private Integer isDisplay; + @ApiModelProperty("备注") @Excel(name = "备注") private String remark; diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/batchDetail/BatchDetailApplicationService.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/batchDetail/BatchDetailApplicationService.java index a1a16a3e4..9ca5b92f5 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/batchDetail/BatchDetailApplicationService.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/batchDetail/BatchDetailApplicationService.java @@ -45,6 +45,10 @@ public class BatchDetailApplicationService { batchDetailDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); } } + // 如果未指定isDisplay,默认只查询显示的数据(isDisplay=1) + if (batchDetailDO.getIsDisplay() == null) { + batchDetailDO.setIsDisplay(1); + } return batchDetailDomainService.queryList(batchDetailDO); } diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/entity/BatchDetail.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/entity/BatchDetail.java index 536aa4de4..7e0a26afd 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/entity/BatchDetail.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/entity/BatchDetail.java @@ -46,6 +46,10 @@ public class BatchDetail extends BaseVOEntity{ @Excel(name = "批次标签") private String batchLabels; + @ApiModelProperty("字段名称") + @Excel(name = "字段名称") + private String fieldName; + @ApiModelProperty("输入控制: 1-必填 2-可选") @Excel(name = "输入控制: 1-必填 2-可选") private String inputControl; @@ -58,6 +62,10 @@ public class BatchDetail extends BaseVOEntity{ @Excel(name = "属性选项") private String attributeOption; + @ApiModelProperty("是否显示: 0-不显示 1-显示") + @Excel(name = "是否显示: 0-不显示 1-显示") + private Integer isDisplay; + @ApiModelProperty("备注") @Excel(name = "备注") private String remark; diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/repository/persistence/BatchDetailImpl.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/repository/persistence/BatchDetailImpl.java index 81cf88b75..675a2b10f 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/repository/persistence/BatchDetailImpl.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/repository/persistence/BatchDetailImpl.java @@ -62,13 +62,26 @@ public class BatchDetailImpl extends ServiceImpl LoginUser loginUser = SecurityUtils.getLoginUser(); UserPo userPo = loginUser.getUserPo(); List batchDetailDOList = batchDO.getBatchDetailList(); - //验证提交的数据是否存在重复 + // 验证本次提交的数据是否存在重复(同一批次内不允许重复标签) long count = batchDetailDOList.stream().map(BatchDetailDO::getBatchLabels).distinct().count(); if (batchDetailDOList.size() != count){ throw new ServiceException("批次标签不允许重复,请检查提交的数据"); } + + // 查询当前批次原有的标签明细 List batchDetailDbList = batchDetailMapper.selectList(new QueryWrapper().lambda() .eq(BatchDetail::getBatchId, batchDO.getBatchId())); + + // 如果数据库里已经有明细,并且这次前端传过来的所有明细都没有明细ID, + // 说明前端没有带回原来的主键,这种情况我们视为“完全替换”: + // 先物理删除当前批次下所有旧的明细,再按本次数据重新插入,避免命中数据库唯一索引冲突。 + boolean allNewWithoutId = CollectionUtil.isNotEmpty(batchDetailDOList) + && batchDetailDOList.stream().allMatch(detail -> detail.getBatchDetailId() == null); + if (CollectionUtil.isNotEmpty(batchDetailDbList) && allNewWithoutId) { + batchDetailMapper.delete(new QueryWrapper().lambda() + .eq(BatchDetail::getBatchId, batchDO.getBatchId())); + batchDetailDbList = new ArrayList<>(); + } List batchDetailListSave = new ArrayList<>(); List batchDetailListSave2 = new ArrayList<>(); List batchDetailListUpdates = new ArrayList<>(); @@ -78,9 +91,11 @@ public class BatchDetailImpl extends ServiceImpl BatchDetail batchDetailDb = batchDetailMap.get(batchDetailDO.getBatchDetailId()); if (batchDetailDb != null){ batchDetailDb.setBatchLabels(batchDetailDO.getBatchLabels()); + batchDetailDb.setFieldName(batchDetailDO.getFieldName()); batchDetailDb.setInputControl(batchDetailDO.getInputControl()); batchDetailDb.setAttributeFormat(batchDetailDO.getAttributeFormat()); batchDetailDb.setAttributeOption(batchDetailDO.getAttributeOption()); + batchDetailDb.setIsDisplay(batchDetailDO.getIsDisplay()); batchDetailDb.setRemark(batchDetailDO.getRemark()); batchDetailDb.setDelFlag(1); batchDetailListUpdates.add(batchDetailDb); diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/repository/po/BatchDetailPO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/repository/po/BatchDetailPO.java index 51ad85366..6d66a4cd6 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/repository/po/BatchDetailPO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/repository/po/BatchDetailPO.java @@ -45,6 +45,10 @@ public class BatchDetailPO extends BaseVOEntity{ @Excel(name = "批次标签") private String batchLabels; + @ApiModelProperty("字段名称") + @Excel(name = "字段名称") + private String fieldName; + @ApiModelProperty("输入控制: 1-必填 2-可选") @Excel(name = "输入控制: 1-必填 2-可选") private String inputControl; @@ -57,6 +61,10 @@ public class BatchDetailPO extends BaseVOEntity{ @Excel(name = "属性选项") private String attributeOption; + @ApiModelProperty("是否显示: 0-不显示 1-显示") + @Excel(name = "是否显示: 0-不显示 1-显示") + private Integer isDisplay; + @ApiModelProperty("备注") @Excel(name = "备注") private String remark; diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/repository/todo/BatchDetailDO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/repository/todo/BatchDetailDO.java index 6d4e9ab0c..2d0452a0f 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/repository/todo/BatchDetailDO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/batchDetail/repository/todo/BatchDetailDO.java @@ -22,8 +22,8 @@ import java.util.List; public class BatchDetailDO extends BaseVOEntity{ private static final long serialVersionUID = 1L; - @ApiModelProperty("批次管理详情id") - private Long batchDetailId; + + @ApiModelProperty("组织表ID") @Excel(name = "组织表ID") @@ -45,6 +45,14 @@ public class BatchDetailDO extends BaseVOEntity{ @Excel(name = "批次标签") private String batchLabels; + @ApiModelProperty("字段名称") + @Excel(name = "字段名称") + private String fieldName; + + @ApiModelProperty("是否显示: 0-不显示 1-显示") + @Excel(name = "是否显示: 0-不显示 1-显示") + private Integer isDisplay; + @ApiModelProperty("输入控制: 1-必填 2-可选") @Excel(name = "输入控制: 1-必填 2-可选") private String inputControl; @@ -57,6 +65,8 @@ public class BatchDetailDO extends BaseVOEntity{ @Excel(name = "属性选项") private String attributeOption; + + @ApiModelProperty("备注") @Excel(name = "备注") private String remark; diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/batchDetail/BatchDetailDTO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/batchDetail/BatchDetailDTO.java index 0e1af3b28..45eabb799 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/batchDetail/BatchDetailDTO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/batchDetail/BatchDetailDTO.java @@ -44,6 +44,10 @@ public class BatchDetailDTO extends BaseVOEntity{ @Excel(name = "批次标签") private String batchLabels; + @ApiModelProperty("字段名称") + @Excel(name = "字段名称") + private String fieldName; + @ApiModelProperty("输入控制: 1-必填 2-可选") @Excel(name = "输入控制: 1-必填 2-可选") private String inputControl; @@ -56,6 +60,10 @@ public class BatchDetailDTO extends BaseVOEntity{ @Excel(name = "属性选项") private String attributeOption; + @ApiModelProperty("是否显示: 0-不显示 1-显示") + @Excel(name = "是否显示: 0-不显示 1-显示") + private Integer isDisplay; + @ApiModelProperty("备注") @Excel(name = "备注") private String remark; diff --git a/mhd-modules/mhd-system/src/main/resources/mapper/basic/batchDetail/BatchDetailMapper.xml b/mhd-modules/mhd-system/src/main/resources/mapper/basic/batchDetail/BatchDetailMapper.xml index af405db1f..5b033420b 100644 --- a/mhd-modules/mhd-system/src/main/resources/mapper/basic/batchDetail/BatchDetailMapper.xml +++ b/mhd-modules/mhd-system/src/main/resources/mapper/basic/batchDetail/BatchDetailMapper.xml @@ -11,9 +11,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -26,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select batch_detail_id, organization_id, organization_name, top_organization_id, batch_id, batch_labels, input_control, attribute_format, attribute_option, remark, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag from batch_detail + select batch_detail_id, organization_id, organization_name, top_organization_id, batch_id, batch_labels, field_name, input_control, attribute_format, attribute_option, is_display, remark, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag from batch_detail @@ -46,6 +48,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and batch_labels = #{batchLabels} + + and field_name = #{fieldName} + and input_control = #{inputControl} @@ -55,6 +60,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and attribute_option = #{attributeOption} + + and is_display = #{isDisplay} + and create_by_name like concat('%', #{createByName}, '%') diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockInOrder/StockInOrderApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockInOrder/StockInOrderApplicationService.java index 6c775fa08..0bc9998ef 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockInOrder/StockInOrderApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockInOrder/StockInOrderApplicationService.java @@ -1485,9 +1485,49 @@ public class StockInOrderApplicationService { // 如果货主ID为空,尝试根据货主名称或编号查找 if (shipperId == null) { - if (StringUtils.isNotEmpty(shipperName) || StringUtils.isNotEmpty(shipperCode)) { - // 尝试从货主列表中查找 + // 优先尝试:如果名称是纯数字,可能是误传的ID,直接按ID查询 + if (StringUtils.isNotEmpty(shipperName) && shipperName.matches("\\d+")) { try { + Long possibleId = Long.valueOf(shipperName); + AjaxResult ajaxResult = userServiceFeign.getInfo(possibleId); + if ("200".equals(String.valueOf(ajaxResult.get("code"))) && ajaxResult.get("data") != null) { + UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class); + if (userPo != null) { + shipperId = userPo.getUserId(); + log.info("根据货主名称(实际为ID)找到货主ID:{}", shipperId); + } + } + } catch (Exception e) { + log.warn("尝试将货主名称作为ID查询失败,货主名称:{},错误:{}", shipperName, e.getMessage()); + } + } + + // 如果仍未找到,尝试根据名称查询(使用 getInfoByName 接口,更高效) + // 注意:如果接口返回404,说明接口可能未实现,继续尝试从列表中查找 + if (shipperId == null && StringUtils.isNotEmpty(shipperName) && !shipperName.matches("\\d+")) { + try { + AjaxResult ajaxResult = userServiceFeign.getInfoByName(shipperName); + String code = String.valueOf(ajaxResult.get("code")); + if ("200".equals(code) && ajaxResult.get("data") != null) { + UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class); + if (userPo != null) { + shipperId = userPo.getUserId(); + log.info("根据货主名称找到货主ID,货主名称:{},货主ID:{}", shipperName, shipperId); + } + } else { + // 接口返回非200(可能是404),记录日志但继续尝试其他方式 + log.debug("getInfoByName接口返回非200,货主名称:{},返回码:{},将继续尝试从列表中查找", shipperName, code); + } + } catch (Exception e) { + // 接口调用异常(包括404),记录日志但继续尝试其他方式 + log.debug("根据货主名称查询失败(可能是接口未实现),货主名称:{},错误:{},将继续尝试从列表中查找", shipperName, e.getMessage()); + } + } + + // 如果仍未找到,尝试从货主列表中根据编号或名称查找(兜底方案) + if (shipperId == null && (StringUtils.isNotEmpty(shipperName) || StringUtils.isNotEmpty(shipperCode))) { + try { + log.debug("开始从货主列表中查找,货主名称:{},货主编号:{}", shipperName, shipperCode); AjaxResult shipperListResult = userServiceFeign.userShipperListAll(); if ("200".equals(String.valueOf(shipperListResult.get("code"))) && shipperListResult.get("data") != null) { Object data = shipperListResult.get("data"); @@ -1514,38 +1554,121 @@ public class StockInOrderApplicationService { shipperList = JSON.parseObject(jsonStr, new com.alibaba.fastjson.TypeReference>>(){}); } if (shipperList != null && !shipperList.isEmpty()) { + log.debug("货主列表大小:{},开始匹配查找,查找货主名称:{},货主编号:{}", + shipperList.size(), shipperName, shipperCode); + + // 输出前3个货主的详细信息,用于调试 + if (log.isDebugEnabled() && shipperList.size() > 0) { + int debugCount = Math.min(3, shipperList.size()); + for (int i = 0; i < debugCount; i++) { + Map debugShipper = shipperList.get(i); + log.debug("货主列表示例[{}]:所有字段={}", i, debugShipper.keySet()); + log.debug("货主列表示例[{}]:userId={}, userName={}, userCode={}, userMemberCode={}, name={}, shipperName={}", + i, + debugShipper.get("userId"), + debugShipper.get("userName"), + debugShipper.get("userCode"), + debugShipper.get("userMemberCode"), + debugShipper.get("name"), + debugShipper.get("shipperName")); + } + } + + // 标准化输入的货主名称和编号(去除空格,用于匹配) + String normalizedShipperName = shipperName != null ? shipperName.trim() : ""; + String normalizedShipperCode = shipperCode != null ? shipperCode.trim() : ""; + for (Map shipper : shipperList) { Object userId = shipper.get("userId"); Object userName = shipper.get("userName"); Object userCode = shipper.get("userCode"); Object userMemberCode = shipper.get("userMemberCode"); + // 尝试多个可能的字段名(按优先级顺序) + if (userName == null) { + userName = shipper.get("name"); + } + if (userName == null) { + userName = shipper.get("shipperName"); + } + if (userName == null) { + userName = shipper.get("userName"); + } + // 尝试其他可能的字段名 + if (userName == null) { + userName = shipper.get("customerName"); + } + if (userName == null) { + userName = shipper.get("companyName"); + } + boolean matched = false; // 优先根据编号匹配(更准确) - if (StringUtils.isNotEmpty(shipperCode)) { - if ((userCode != null && shipperCode.equals(String.valueOf(userCode))) || - (userMemberCode != null && shipperCode.equals(String.valueOf(userMemberCode)))) { + if (StringUtils.isNotEmpty(normalizedShipperCode)) { + String normalizedUserCode = userCode != null ? String.valueOf(userCode).trim() : ""; + String normalizedUserMemberCode = userMemberCode != null ? String.valueOf(userMemberCode).trim() : ""; + if (normalizedShipperCode.equals(normalizedUserCode) || + normalizedShipperCode.equals(normalizedUserMemberCode)) { matched = true; + log.debug("通过编号匹配成功,货主编号:{},货主ID:{}", normalizedShipperCode, userId); } } - // 如果编号不匹配,再根据名称匹配 - if (!matched && StringUtils.isNotEmpty(shipperName) && - userName != null && - shipperName.equals(String.valueOf(userName))) { - matched = true; + // 如果编号不匹配,再根据名称匹配(支持去除空格后匹配) + if (!matched && StringUtils.isNotEmpty(normalizedShipperName) && userName != null) { + String normalizedUserName = String.valueOf(userName).trim(); + // 精确匹配 + if (normalizedShipperName.equals(normalizedUserName)) { + matched = true; + log.debug("通过名称精确匹配成功,货主名称:{},货主ID:{}", normalizedShipperName, userId); + } + // 如果精确匹配失败,尝试包含匹配(支持部分匹配) + if (!matched && normalizedUserName.contains(normalizedShipperName)) { + matched = true; + log.debug("通过名称包含匹配成功,货主名称:{},列表中的名称:{},货主ID:{}", + normalizedShipperName, normalizedUserName, userId); + } + // 如果包含匹配也失败,尝试反向包含匹配 + if (!matched && normalizedShipperName.contains(normalizedUserName)) { + matched = true; + log.debug("通过名称反向包含匹配成功,货主名称:{},列表中的名称:{},货主ID:{}", + normalizedShipperName, normalizedUserName, userId); + } } if (matched && userId != null) { shipperId = Long.valueOf(String.valueOf(userId)); - log.info("根据货主信息找到货主ID,货主名称:{},货主编号:{},货主ID:{}", + log.info("从货主列表中找到货主ID,货主名称:{},货主编号:{},货主ID:{}", shipperName, shipperCode, shipperId); break; } } + + if (shipperId == null) { + // 输出所有货主名称,帮助排查 + List allShipperNames = new ArrayList<>(); + for (Map shipper : shipperList) { + Object name = shipper.get("userName"); + if (name == null) { + name = shipper.get("name"); + } + if (name == null) { + name = shipper.get("shipperName"); + } + if (name != null) { + allShipperNames.add(String.valueOf(name)); + } + } + log.warn("从货主列表中未找到匹配的货主,货主名称:{},货主编号:{},列表大小:{},所有货主名称:{}", + shipperName, shipperCode, shipperList.size(), allShipperNames); + } + } else { + log.warn("货主列表为空或解析失败"); } + } else { + log.warn("获取货主列表失败,返回码:{}", shipperListResult.get("code")); } } catch (Exception e) { - log.warn("根据货主名称查找货主ID失败,货主名称:{},错误:{}", shipperName, e.getMessage()); + log.error("从货主列表中查找货主ID失败,货主名称:{},货主编号:{},错误:{}", shipperName, shipperCode, e.getMessage(), e); } } diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockReceiptOrder/StockReceiptOrderApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockReceiptOrder/StockReceiptOrderApplicationService.java index ece7cca3d..9965953ac 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockReceiptOrder/StockReceiptOrderApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockReceiptOrder/StockReceiptOrderApplicationService.java @@ -28,6 +28,7 @@ import com.mhd.wms.domain.materialGoodsRule.repository.facade.IMaterialGoodsRule import com.mhd.wms.domain.materialGoodsRule.repository.po.MaterialGoodsRulePO; import com.mhd.wms.domain.materialWarehouseControl.repository.facade.IMaterialWarehouseControlService; import com.mhd.wms.domain.materialWarehouseControl.repository.po.MaterialWarehouseControlPO; +import com.mhd.wms.domain.materialMoreDetail.repository.po.MaterialMoreDetailPO; 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; @@ -134,9 +135,59 @@ public class StockReceiptOrderApplicationService { ReceiptMaterialDetailDO receiptMaterialDetailDO = new ReceiptMaterialDetailDO(); receiptMaterialDetailDO.setReceiptOrderNumber(stockReceiptOrderPO.getReceiptOrderNumber()); List receiptMaterialDetailPOList = receiptMaterialDetailDomainService.queryListChildren(receiptMaterialDetailDO); + + // 为每个物料明细设置更多属性(根据物料绑定的批次属性,过滤isDisplay=1的属性) + receiptMaterialDetailPOList.forEach(receiptMaterialDetailPO -> { + List materialMoreDetailList = + getMaterialMoreDetailByBatch(receiptMaterialDetailPO.getMaterialBaseInfoId()); + receiptMaterialDetailPO.setMaterialMoreDetailList(materialMoreDetailList); + }); + stockReceiptOrderPO.setMaterialDetailList(receiptMaterialDetailPOList); return stockReceiptOrderPO; } + + /** + * 根据物料基础信息ID获取批次属性(更多属性),只返回isDisplay=1的属性 + * @param materialBaseInfoId 物料基础信息ID + * @return 更多属性列表 + */ + private List getMaterialMoreDetailByBatch(Long materialBaseInfoId) { + List materialMoreDetailPOList = new ArrayList<>(); + if (materialBaseInfoId == null) { + return materialMoreDetailPOList; + } + + try { + // 根据物料基础信息ID获取批次属性列表 + AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(materialBaseInfoId); + if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) { + List batchDetailFeignPOList = JSON.parseArray( + JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class); + + if (!CollectionUtils.isEmpty(batchDetailFeignPOList)) { + // 过滤isDisplay=1的属性 + batchDetailFeignPOList.stream() + .filter(batchDetail -> batchDetail.getIsDisplay() != null && batchDetail.getIsDisplay() == 1) + .forEach(batchDetailFeignPO -> { + MaterialMoreDetailPO materialMoreDetailPO = new MaterialMoreDetailPO(); + materialMoreDetailPO.setBatchId(batchDetailFeignPO.getBatchId()); + materialMoreDetailPO.setBatchDetailId(batchDetailFeignPO.getBatchDetailId()); + materialMoreDetailPO.setBatchLabels(batchDetailFeignPO.getBatchLabels()); + materialMoreDetailPO.setInputControl(batchDetailFeignPO.getInputControl()); + materialMoreDetailPO.setAttributeFormat(batchDetailFeignPO.getAttributeFormat()); + materialMoreDetailPO.setAttributeOption(batchDetailFeignPO.getAttributeOption()); + materialMoreDetailPO.setRemark(batchDetailFeignPO.getRemark()); + materialMoreDetailPOList.add(materialMoreDetailPO); + }); + } + } + } catch (Exception e) { + log.warn("获取物料批次属性失败,物料基础信息ID:{},错误:{}", materialBaseInfoId, e.getMessage()); + } + + return materialMoreDetailPOList; + } /** * 获取收货单详细信息 diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialMoreDetail/repository/todo/MaterialMoreDetailDO.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialMoreDetail/repository/todo/MaterialMoreDetailDO.java index 14c72011f..5d2fd39c7 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialMoreDetail/repository/todo/MaterialMoreDetailDO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialMoreDetail/repository/todo/MaterialMoreDetailDO.java @@ -54,6 +54,7 @@ public class MaterialMoreDetailDO extends BaseVOEntity { @Excel(name = "批次标签") private String batchLabels; + @ApiModelProperty("输入控制: 1-必填 2-可选") @Excel(name = "输入控制: 1-必填 2-可选") private String inputControl; diff --git a/mhd_wms/src/main/java/com/mhd/wms/interfaces/assember/stockInOrder/StockInOrderAssembler.java b/mhd_wms/src/main/java/com/mhd/wms/interfaces/assember/stockInOrder/StockInOrderAssembler.java index b0b23d62c..3b2804890 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/interfaces/assember/stockInOrder/StockInOrderAssembler.java +++ b/mhd_wms/src/main/java/com/mhd/wms/interfaces/assember/stockInOrder/StockInOrderAssembler.java @@ -37,6 +37,15 @@ public class StockInOrderAssembler { * 转换实体 */ public StockInOrderDO toDOByEdit(StockInOrderDTO stockInOrderDTO) { + // 兼容前端传 userName 作为货主名称字段的情况: + // 如果 shipperName 为空但 userName 有值,则优先回填到 shipperName, + // 以保证后续 shipperParam 能根据名称正确找到货主ID。 + if (ObjectUtil.isNull(stockInOrderDTO.getShipperId()) + && (stockInOrderDTO.getShipperName() == null || stockInOrderDTO.getShipperName().trim().length() == 0) + && stockInOrderDTO.getUserName() != null && stockInOrderDTO.getUserName().trim().length() > 0) { + stockInOrderDTO.setShipperName(stockInOrderDTO.getUserName().trim()); + } + StockInOrderDO stockInOrderDO = JSONUtil.toBean(JSONUtil.toJsonStr(stockInOrderDTO), StockInOrderDO.class); LoginUser loginUser = SecurityUtils.getLoginUser(); if (ObjectUtil.isNull(loginUser)) { diff --git a/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/stockInOrder/StockInOrderBaseDTO.java b/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/stockInOrder/StockInOrderBaseDTO.java index 189f2fe9d..848a1c5b8 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/stockInOrder/StockInOrderBaseDTO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/stockInOrder/StockInOrderBaseDTO.java @@ -51,6 +51,13 @@ public class StockInOrderBaseDTO extends BaseVOEntity { @Excel(name = "货主名称") private String shipperName; + /** + * 兼容前端使用 userName 作为货主名称字段: + * 如果请求体中只传了 userName,将在组装器中自动回填到 shipperName。 + */ + @ApiModelProperty("货主名称(兼容字段:userName)") + private String userName; + @ApiModelProperty("入库单类型编码") @Excel(name = "入库单类型编码") private String orderTypeCode; diff --git a/mhd_wms/src/main/resources/mapper/materialBaseInfo/MaterialBaseInfoMapper.xml b/mhd_wms/src/main/resources/mapper/materialBaseInfo/MaterialBaseInfoMapper.xml index b4b57664e..3c3d2f748 100644 --- a/mhd_wms/src/main/resources/mapper/materialBaseInfo/MaterialBaseInfoMapper.xml +++ b/mhd_wms/src/main/resources/mapper/materialBaseInfo/MaterialBaseInfoMapper.xml @@ -22,6 +22,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -45,11 +47,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + - select material_base_info_id, organization_id, organization_name, top_organization_id, shipper_id, shipper_code, shipper_name, material_code, material_name, bar_code, material_classify_code, material_classify_name, material_type, material_type_name, pack_id, pack_code, pack_name, unit_code, unit_name, brand_id, brand_code, brand_name, shelf_life, weight_limit, volume_limit, material_shape, material_shape_name, material_size, material_length, material_width, material_height, remark, nullify, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag,common,sku_code, unit_price, currency, origin_country, hs_code, declaration_unit, statutory_unit, statutory_second_unit,specification_Model from material_base_info + select material_base_info_id, organization_id, organization_name, top_organization_id, shipper_id, shipper_code, shipper_name, material_code, material_name, bar_code, material_classify_code, material_classify_name, material_type, material_type_name, pack_id, pack_code, pack_name, unit_code, unit_name, brand_id, brand_code, brand_name, shelf_life, weight_limit, volume_limit, material_shape, material_shape_name, material_size, material_length, material_width, material_height, remark, nullify, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag, common, sku_code, unit_price, currency, origin_country, hs_code, declaration_unit, statutory_unit, statutory_second_unit, specification_model as specification_model from material_base_info