任务BUG修改
This commit is contained in:
+6
@@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* 物料条码信息对象 material_bar_code
|
||||
@@ -66,6 +68,10 @@ public class MaterialBarCodePO extends BaseVOEntity {
|
||||
@Excel(name = "名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("数量")
|
||||
@Excel(name = "数量")
|
||||
private BigDecimal number;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
+5
@@ -5,6 +5,7 @@ import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -66,6 +67,10 @@ public class MaterialBarCodeDO extends BaseVOEntity {
|
||||
@Excel(name = "名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("数量")
|
||||
@Excel(name = "数量")
|
||||
private BigDecimal number;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
+72
-1
@@ -116,9 +116,80 @@ public class MaterialBaseInfoDomainService {
|
||||
//获取库存预警
|
||||
List<MaterialInventoryWarningPO> materialInventoryWarningPOList = materialInventoryWarningService.getInfoByMaterialBaseInfoIds(materialBaseInfoId);
|
||||
materialBaseInfoPO.setMaterialInventoryWarningList(materialInventoryWarningPOList);
|
||||
//获取条码信息
|
||||
|
||||
// 条码信息:
|
||||
// 1)优先读取已维护的物料条码表 material_bar_code;
|
||||
// 2)如果没有维护条码,则根据当前物料绑定的包装规格(packId),
|
||||
// 按包装明细的单位(EA/IP/CS/PL/OT 等)生成一份默认的条码信息列表,
|
||||
// 其中条码字段留空,前端可编辑。
|
||||
List<MaterialBarCodePO> materialBarCodePOList = materialBarCodeService.getInfoByMaterialBaseInfoIds(materialBaseInfoId);
|
||||
if ((materialBarCodePOList == null || materialBarCodePOList.isEmpty()) && materialBaseInfoPO.getPackId() != null) {
|
||||
try {
|
||||
materialBarCodePOList = new ArrayList<>();
|
||||
// 常见单位代码;只生成在包装规格中实际存在的单位
|
||||
String[] unitCodes = {"EA", "IP", "CS", "PL", "OT"};
|
||||
for (String unitCode : unitCodes) {
|
||||
AjaxResult packDetailResult = systemServiceFeign.getInfoByPackIdAndUnitCode(materialBaseInfoPO.getPackId(), unitCode);
|
||||
if (!"200".equals(String.valueOf(packDetailResult.get("code")))
|
||||
|| packDetailResult.get("data") == null) {
|
||||
continue;
|
||||
}
|
||||
PackDetailFeignPO packDetailFeignPO = JSON.parseObject(
|
||||
JSONObject.toJSONString(packDetailResult.get("data")),
|
||||
PackDetailFeignPO.class);
|
||||
// 如果包装明细没有维护名称或数量,则不生成对应的条码行
|
||||
if (packDetailFeignPO == null
|
||||
|| packDetailFeignPO.getName() == null
|
||||
|| packDetailFeignPO.getNumber() == null) {
|
||||
continue;
|
||||
}
|
||||
MaterialBarCodePO barCodePO = new MaterialBarCodePO();
|
||||
// 物料、组织信息
|
||||
barCodePO.setMaterialBaseInfoId(materialBaseInfoId);
|
||||
barCodePO.setPackId(materialBaseInfoPO.getPackId());
|
||||
barCodePO.setPackCode(materialBaseInfoPO.getPackCode());
|
||||
barCodePO.setPackName(materialBaseInfoPO.getPackName());
|
||||
// 绑定包装明细(单位代码、名称、数量来自包装规格明细)
|
||||
barCodePO.setPackDetailId(packDetailFeignPO.getPackDetailId());
|
||||
barCodePO.setUnitCode(packDetailFeignPO.getUnitCode());
|
||||
barCodePO.setName(packDetailFeignPO.getName());
|
||||
barCodePO.setNumber(packDetailFeignPO.getNumber());
|
||||
// 条码本身留空,前端允许编辑
|
||||
barCodePO.setBarCode(null);
|
||||
materialBarCodePOList.add(barCodePO);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("根据包装规格生成条码信息失败,物料ID:{},包装ID:{},错误:{}",
|
||||
materialBaseInfoId, materialBaseInfoPO.getPackId(), e.getMessage());
|
||||
}
|
||||
}
|
||||
materialBaseInfoPO.setMaterialBarCodeList(materialBarCodePOList);
|
||||
|
||||
// 从包装规格获取默认显示的包装单位(取第一条包装详情的单位名称),前端只读展示
|
||||
if (materialBaseInfoPO.getPackId() != null) {
|
||||
try {
|
||||
String[] unitCodes = {"EA", "IP", "CS", "PL", "OT"};
|
||||
for (String unitCode : unitCodes) {
|
||||
AjaxResult packDetailResult = systemServiceFeign.getInfoByPackIdAndUnitCode(materialBaseInfoPO.getPackId(), unitCode);
|
||||
if (!"200".equals(String.valueOf(packDetailResult.get("code")))
|
||||
|| packDetailResult.get("data") == null) {
|
||||
continue;
|
||||
}
|
||||
PackDetailFeignPO packDetailFeignPO = JSON.parseObject(
|
||||
JSONObject.toJSONString(packDetailResult.get("data")),
|
||||
PackDetailFeignPO.class);
|
||||
if (packDetailFeignPO != null && packDetailFeignPO.getName() != null) {
|
||||
materialBaseInfoPO.setUnitName(packDetailFeignPO.getName());
|
||||
materialBaseInfoPO.setUnitCode(packDetailFeignPO.getUnitCode());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取包装规格单位名称失败,物料ID:{},包装ID:{},错误:{}",
|
||||
materialBaseInfoId, materialBaseInfoPO.getPackId(), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return materialBaseInfoPO;
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -5,6 +5,7 @@ import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -65,6 +66,10 @@ public class MaterialBarCodeDTO extends BaseVOEntity {
|
||||
@Excel(name = "名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("数量")
|
||||
@Excel(name = "数量")
|
||||
private BigDecimal number;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
Reference in New Issue
Block a user