仓码820
This commit is contained in:
+5
@@ -68,4 +68,9 @@ public class ReservedInventory {
|
||||
* 验证结果(导入后自动填充,不映射Excel)
|
||||
*/
|
||||
private String validationResult;
|
||||
|
||||
/**
|
||||
* WMS物料id(解析预览接口根据货物名称匹配后自动填充,匹配不到为空,不映射Excel)
|
||||
*/
|
||||
private Long materialBaseInfoId;
|
||||
}
|
||||
+29
@@ -1972,6 +1972,35 @@ public class ReserveStockInOrderApplicationService {
|
||||
return stockInOrderDomainService.queryNoticePrintDetail(stockInOrderDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* Excel解析预览:根据货物名称匹配WMS对应物料并填充物料id,
|
||||
* 匹配不到物料id保持为空,不阻断解析
|
||||
*/
|
||||
public void fillMaterialBaseInfoId(List<ReservedInventory> dataList) {
|
||||
if (dataList == null || dataList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// 物料名称匹配结果缓存,避免同名重复查库
|
||||
Map<String, MaterialBaseInfoPO> materialCache = new HashMap<>();
|
||||
for (ReservedInventory reservedInventory : dataList) {
|
||||
String goodsName = reservedInventory.getGoodsName();
|
||||
if (StringUtils.isBlank(goodsName)) {
|
||||
continue;
|
||||
}
|
||||
MaterialBaseInfoPO materialBaseInfoPO = materialCache.get(goodsName);
|
||||
if (materialBaseInfoPO == null && !materialCache.containsKey(goodsName)) {
|
||||
List<MaterialBaseInfoPO> materialBaseInfoPOS = reserveStockInOrderMapper.getByName(goodsName);
|
||||
if (materialBaseInfoPOS != null && !materialBaseInfoPOS.isEmpty()) {
|
||||
materialBaseInfoPO = materialBaseInfoPOS.get(0);
|
||||
}
|
||||
materialCache.put(goodsName, materialBaseInfoPO);
|
||||
}
|
||||
if (materialBaseInfoPO != null) {
|
||||
reservedInventory.setMaterialBaseInfoId(materialBaseInfoPO.getMaterialBaseInfoId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void importInData(List<ReservedInventory> dataList) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
ReserveStockInOrderDO reserveStockInOrder = new ReserveStockInOrderDO();
|
||||
|
||||
+5
@@ -444,4 +444,9 @@ public class ReserveStockOutOrder extends BaseVOEntity {
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date outboundTime;
|
||||
|
||||
@ApiModelProperty("预约业务类型")
|
||||
private String reserveBusinessType;
|
||||
@ApiModelProperty("预约业务类型名称")
|
||||
private String reserveBusinessTypeName;
|
||||
|
||||
}
|
||||
+4
@@ -452,4 +452,8 @@ public class ReserveStockOutOrderPO extends BaseVOEntity {
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date outboundTime;
|
||||
@ApiModelProperty("预约业务类型")
|
||||
private String reserveBusinessType;
|
||||
@ApiModelProperty("预约业务类型名称")
|
||||
private String reserveBusinessTypeName;
|
||||
}
|
||||
+4
@@ -490,4 +490,8 @@ public class ReserveStockOutOrderDO extends BaseVOEntity {
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date outboundTime;
|
||||
@ApiModelProperty("预约业务类型")
|
||||
private String reserveBusinessType;
|
||||
@ApiModelProperty("预约业务类型名称")
|
||||
private String reserveBusinessTypeName;
|
||||
}
|
||||
+4
@@ -479,4 +479,8 @@ public class ReserveStockOutOrderDTO extends ReserveStockOutOrderBaseDTO {
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date outboundTime;
|
||||
@ApiModelProperty("预约业务类型")
|
||||
private String reserveBusinessType;
|
||||
@ApiModelProperty("预约业务类型名称")
|
||||
private String reserveBusinessTypeName;
|
||||
}
|
||||
+10
@@ -1,5 +1,6 @@
|
||||
package com.mhd.oms.domain.reserveStockOutOrder.repository.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.mhd.oms.domain.reserveStockInOrder.repository.util.StringToBigDecimalConverter;
|
||||
import com.mhd.oms.domain.reserveStockInOrder.repository.util.StringToDateConverter;
|
||||
@@ -35,6 +36,15 @@ public class ReservedInventoryOut {
|
||||
|
||||
/**
|
||||
* 验证结果(导入后自动填充,不映射Excel)
|
||||
* @ExcelIgnore:排除在Excel列映射之外,避免被自动分配列索引
|
||||
*/
|
||||
@ExcelIgnore
|
||||
private String validationResult;
|
||||
|
||||
/**
|
||||
* WMS库存id(解析预览接口根据货物名称查询可用库存后自动填充,不映射Excel)
|
||||
* @ExcelIgnore:Long类型字段若被自动映射到非数字列,会抛出ExcelDataConvertException
|
||||
*/
|
||||
@ExcelIgnore
|
||||
private Long materialInventoryId;
|
||||
}
|
||||
+39
-3
@@ -841,7 +841,7 @@ public class ReserveStockOutOrderApplicationService {
|
||||
* @description 审核入库单
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/21 13:53
|
||||
* @param stockInOrderDO
|
||||
* @param stockOutOrderDO
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean auditState(ReserveStockOutOrderDO stockOutOrderDO){
|
||||
@@ -852,7 +852,7 @@ public class ReserveStockOutOrderApplicationService {
|
||||
* @description 下发入库单
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/21 13:53
|
||||
* @param stockInOrderDO
|
||||
* @param stockOutOrderDO
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean issueOrder(ReserveStockOutOrderDO stockOutOrderDO){
|
||||
@@ -862,7 +862,7 @@ public class ReserveStockOutOrderApplicationService {
|
||||
* @description 审核入库单
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/21 13:53
|
||||
* @param stockInOrderDO
|
||||
* @param stockOutOrderDO
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean orderReject(ReserveStockOutOrderDO stockOutOrderDO){
|
||||
@@ -1355,6 +1355,42 @@ public class ReserveStockOutOrderApplicationService {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Excel解析预览:根据货物名称查询WMS对应物料的库存信息,
|
||||
* 可用数量大于导入数据件数的填充库存id;
|
||||
* 物料不存在、无库存或可用数量不足时库存id保持为空,不抛异常
|
||||
*/
|
||||
public void fillMaterialInventoryId(List<ReservedInventoryOut> dataList) {
|
||||
if (CollectionUtils.isEmpty(dataList)) {
|
||||
return;
|
||||
}
|
||||
for (ReservedInventoryOut reservedInventory : dataList) {
|
||||
String goodsName = reservedInventory.getGoodsName();
|
||||
BigDecimal importQuantity = reservedInventory.getQuantity() == null ? BigDecimal.ZERO : reservedInventory.getQuantity();
|
||||
// 根据货物名称查询对应物料,匹配不到则库存id为空
|
||||
List<MaterialBaseInfoPO> materialBaseInfoPOS = reserveStockInOrderMapper.getByName(goodsName);
|
||||
if (materialBaseInfoPOS == null || materialBaseInfoPOS.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
Long materialBaseInfoId = materialBaseInfoPOS.get(0).getMaterialBaseInfoId();
|
||||
// 根据物料id查询对应库存,无库存则库存id为空
|
||||
List<ReservationMaterialInventory> reservationMaterialInventories = reservationMaterialInventoryMapper.selectList(
|
||||
new LambdaQueryWrapper<ReservationMaterialInventory>()
|
||||
.eq(ReservationMaterialInventory::getMaterialBaseInfoId, materialBaseInfoId));
|
||||
if (reservationMaterialInventories == null || reservationMaterialInventories.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
// 取可用数量大于导入数据件数的库存,填充库存id;都不满足则库存id为空
|
||||
for (ReservationMaterialInventory inventory : reservationMaterialInventories) {
|
||||
BigDecimal allocationQuantity = inventory.getAllocationQuantity() == null ? BigDecimal.ZERO : inventory.getAllocationQuantity();
|
||||
if (allocationQuantity.compareTo(importQuantity) > 0) {
|
||||
reservedInventory.setMaterialInventoryId(inventory.getMaterialInventoryId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void importInData(List<ReservedInventoryOut> dataList) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
ReserveStockOutOrderDO reserveStockOutOrder = new ReserveStockOutOrderDO();
|
||||
|
||||
Reference in New Issue
Block a user