批次规则的修改
This commit is contained in:
@@ -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;
|
||||
|
||||
+4
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+8
@@ -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;
|
||||
|
||||
+16
-1
@@ -62,13 +62,26 @@ public class BatchDetailImpl extends ServiceImpl<BatchDetailMapper, BatchDetail>
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
List<BatchDetailDO> batchDetailDOList = batchDO.getBatchDetailList();
|
||||
//验证提交的数据是否存在重复
|
||||
// 验证本次提交的数据是否存在重复(同一批次内不允许重复标签)
|
||||
long count = batchDetailDOList.stream().map(BatchDetailDO::getBatchLabels).distinct().count();
|
||||
if (batchDetailDOList.size() != count){
|
||||
throw new ServiceException("批次标签不允许重复,请检查提交的数据");
|
||||
}
|
||||
|
||||
// 查询当前批次原有的标签明细
|
||||
List<BatchDetail> batchDetailDbList = batchDetailMapper.selectList(new QueryWrapper<BatchDetail>().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<BatchDetail>().lambda()
|
||||
.eq(BatchDetail::getBatchId, batchDO.getBatchId()));
|
||||
batchDetailDbList = new ArrayList<>();
|
||||
}
|
||||
List<BatchDetail> batchDetailListSave = new ArrayList<>();
|
||||
List<BatchDetail> batchDetailListSave2 = new ArrayList<>();
|
||||
List<BatchDetail> batchDetailListUpdates = new ArrayList<>();
|
||||
@@ -78,9 +91,11 @@ public class BatchDetailImpl extends ServiceImpl<BatchDetailMapper, BatchDetail>
|
||||
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);
|
||||
|
||||
+8
@@ -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;
|
||||
|
||||
+12
-2
@@ -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;
|
||||
|
||||
+8
@@ -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;
|
||||
|
||||
+9
-1
@@ -11,9 +11,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="topOrganizationId" column="top_organization_id" />
|
||||
<result property="batchId" column="batch_id" />
|
||||
<result property="batchLabels" column="batch_labels" />
|
||||
<result property="fieldName" column="field_name" />
|
||||
<result property="inputControl" column="input_control" />
|
||||
<result property="attributeFormat" column="attribute_format" />
|
||||
<result property="attributeOption" column="attribute_option" />
|
||||
<result property="isDisplay" column="is_display" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
@@ -26,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
|
||||
<sql id="selectBatchDetailPo">
|
||||
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
|
||||
</sql>
|
||||
|
||||
<sql id="selectBatchDetailPo1">
|
||||
@@ -46,6 +48,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="batchLabels != null and batchLabels != ''">
|
||||
and batch_labels = #{batchLabels}
|
||||
</if>
|
||||
<if test="fieldName != null and fieldName != ''">
|
||||
and field_name = #{fieldName}
|
||||
</if>
|
||||
<if test="inputControl != null ">
|
||||
and input_control = #{inputControl}
|
||||
</if>
|
||||
@@ -55,6 +60,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="attributeOption != null and attributeOption != ''">
|
||||
and attribute_option = #{attributeOption}
|
||||
</if>
|
||||
<if test="isDisplay != null ">
|
||||
and is_display = #{isDisplay}
|
||||
</if>
|
||||
<if test="createByName != null and createByName != ''">
|
||||
and create_by_name like concat('%', #{createByName}, '%')
|
||||
</if>
|
||||
|
||||
+135
-12
@@ -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<List<Map<String, Object>>>(){});
|
||||
}
|
||||
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<String, Object> 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<String, Object> 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<String> allShipperNames = new ArrayList<>();
|
||||
for (Map<String, Object> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+51
@@ -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<ReceiptMaterialDetailPO> receiptMaterialDetailPOList = receiptMaterialDetailDomainService.queryListChildren(receiptMaterialDetailDO);
|
||||
|
||||
// 为每个物料明细设置更多属性(根据物料绑定的批次属性,过滤isDisplay=1的属性)
|
||||
receiptMaterialDetailPOList.forEach(receiptMaterialDetailPO -> {
|
||||
List<MaterialMoreDetailPO> materialMoreDetailList =
|
||||
getMaterialMoreDetailByBatch(receiptMaterialDetailPO.getMaterialBaseInfoId());
|
||||
receiptMaterialDetailPO.setMaterialMoreDetailList(materialMoreDetailList);
|
||||
});
|
||||
|
||||
stockReceiptOrderPO.setMaterialDetailList(receiptMaterialDetailPOList);
|
||||
return stockReceiptOrderPO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据物料基础信息ID获取批次属性(更多属性),只返回isDisplay=1的属性
|
||||
* @param materialBaseInfoId 物料基础信息ID
|
||||
* @return 更多属性列表
|
||||
*/
|
||||
private List<MaterialMoreDetailPO> getMaterialMoreDetailByBatch(Long materialBaseInfoId) {
|
||||
List<MaterialMoreDetailPO> 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<BatchDetailFeignPO> 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取收货单详细信息
|
||||
|
||||
+1
@@ -54,6 +54,7 @@ public class MaterialMoreDetailDO extends BaseVOEntity {
|
||||
@Excel(name = "批次标签")
|
||||
private String batchLabels;
|
||||
|
||||
|
||||
@ApiModelProperty("输入控制: 1-必填 2-可选")
|
||||
@Excel(name = "输入控制: 1-必填 2-可选")
|
||||
private String inputControl;
|
||||
|
||||
+9
@@ -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)) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -22,6 +22,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="packId" column="pack_id" />
|
||||
<result property="packCode" column="pack_code" />
|
||||
<result property="packName" column="pack_name" />
|
||||
<result property="unitCode" column="unit_code" />
|
||||
<result property="unitName" column="unit_name" />
|
||||
<result property="brandId" column="brand_id" />
|
||||
<result property="brandCode" column="brand_code" />
|
||||
<result property="brandName" column="brand_name" />
|
||||
@@ -45,11 +47,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="unitNumber" column="unit_number" />
|
||||
<result property="common" column="common" />
|
||||
<result property="skuCode" column="SKU_CODE" />
|
||||
<result property="unitPrice" column="UNIT_PRICE" />
|
||||
<result property="currency" column="CURRENCY" />
|
||||
<result property="originCountry" column="ORIGIN_COUNTRY" />
|
||||
<result property="hsCode" column="HS_CODE" />
|
||||
<result property="declarationUnit" column="DECLARATION_UNIT" />
|
||||
<result property="statutoryUnit" column="STATUTORY_UNIT" />
|
||||
<result property="statutorySecondUnit" column="STATUTORY_SECOND_UNIT" />
|
||||
<result property="specificationModel" column="SPECIFICATION_MODEL" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectMaterialBaseInfoPo">
|
||||
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
|
||||
</sql>
|
||||
|
||||
<sql id="JoinMaterialBaseInfoPo">
|
||||
|
||||
Reference in New Issue
Block a user