Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
+4
@@ -223,4 +223,8 @@ public class MaterialInventory extends BaseVOEntity {
|
||||
@Excel(name = "ExtAttr4", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField("ext_attr_4")
|
||||
private Date extAttr4;
|
||||
|
||||
@ApiModelProperty("条码")
|
||||
@Excel(name = "条码")
|
||||
private String barCode;
|
||||
}
|
||||
+4
@@ -217,4 +217,8 @@ public class MaterialInventoryPO extends MaterialBasePO {
|
||||
@ApiModelProperty("单位名")
|
||||
@Excel(name = "单位名")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty("条码")
|
||||
@Excel(name = "条码")
|
||||
private String barCode;
|
||||
}
|
||||
+38
@@ -709,6 +709,24 @@ public class StockShelfOrderDomainService {
|
||||
materialInventory.setNetWeight(shelfMaterialDetail.getTotalNetWeight());
|
||||
materialInventory.setUnit(materialBaseInfo.getUnitCode());
|
||||
materialInventory.setUnitName(materialBaseInfo.getUnitName());
|
||||
// 条码:优先取上架明细的 barCode,为空则从 material_bar_code 表取(优先 EA 单位)
|
||||
String insertBarCode = shelfMaterialDetail.getBarCode();
|
||||
if (StringUtils.isBlank(insertBarCode) && shelfMaterialDetail.getMaterialBaseInfoId() != null) {
|
||||
try {
|
||||
List<MaterialBarCodePO> barCodeList = materialBarCodeService.getInfoByMaterialBaseInfoIds(shelfMaterialDetail.getMaterialBaseInfoId());
|
||||
if (barCodeList != null && !barCodeList.isEmpty()) {
|
||||
MaterialBarCodePO eaBarCode = barCodeList.stream()
|
||||
.filter(po -> "EA".equals(po.getUnitCode()))
|
||||
.findFirst().orElse(barCodeList.get(0));
|
||||
if (eaBarCode != null && StringUtils.isNotBlank(eaBarCode.getBarCode())) {
|
||||
insertBarCode = eaBarCode.getBarCode();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取条码失败,materialBaseInfoId={},错误:{}", shelfMaterialDetail.getMaterialBaseInfoId(), e.getMessage());
|
||||
}
|
||||
}
|
||||
materialInventory.setBarCode(insertBarCode);
|
||||
|
||||
materialInventoryMapper.insert(materialInventory);
|
||||
|
||||
@@ -827,6 +845,26 @@ public class StockShelfOrderDomainService {
|
||||
materialInventory.setUpdateBy(loginUser.getUserid());
|
||||
materialInventory.setUpdateByName(loginUser.getUsername());
|
||||
materialInventory.setUpdateTime(new Date());
|
||||
// 如果库存记录没有 barCode,则补充写入
|
||||
if (StringUtils.isBlank(materialInventoryPO.getBarCode())) {
|
||||
String updateBarCode = shelfMaterialDetail.getBarCode();
|
||||
if (StringUtils.isBlank(updateBarCode) && shelfMaterialDetail.getMaterialBaseInfoId() != null) {
|
||||
try {
|
||||
List<MaterialBarCodePO> barCodeList = materialBarCodeService.getInfoByMaterialBaseInfoIds(shelfMaterialDetail.getMaterialBaseInfoId());
|
||||
if (barCodeList != null && !barCodeList.isEmpty()) {
|
||||
MaterialBarCodePO eaBarCode = barCodeList.stream()
|
||||
.filter(po -> "EA".equals(po.getUnitCode()))
|
||||
.findFirst().orElse(barCodeList.get(0));
|
||||
if (eaBarCode != null && StringUtils.isNotBlank(eaBarCode.getBarCode())) {
|
||||
updateBarCode = eaBarCode.getBarCode();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取条码失败,materialBaseInfoId={},错误:{}", shelfMaterialDetail.getMaterialBaseInfoId(), e.getMessage());
|
||||
}
|
||||
}
|
||||
materialInventory.setBarCode(updateBarCode);
|
||||
}
|
||||
materialInventoryMapper.updateById(materialInventory);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user