feat(oms): 出库导入支持指定仓库,校验物料库存归属并按仓过滤批次库存
背景:物料档案全仓共享,此前导入不区分仓库,批次库存"查到哪条算哪条",单据可能取到其他仓库的库存且主表仓库为空。 1. /parseExcel 新增可选参数 warehouseId(前端随文件提交当前页面仓库;不传保持原有行为) 2. 新增 countInventoryByWarehouse 归属校验:物料在指定仓库无库存记录时统一报错"物料[xx]在当前仓库[名]没有库存记录,无法从该仓库出库" 3. getkcId 批次库存查询增加仓库过滤,明细批次/仓库/入库单号均取当前仓库 4. 导入单主表回填当前仓库 warehouseId/Code/Name(此前导入单仓库为空) 5. 出库导入两个入口(reservationStockInOrderApi/executionStockInOrderApi 的 parseExcel)同步支持 6. 库存不足报错补充物料编码,便于定位
This commit is contained in:
+2
-1
@@ -53,10 +53,11 @@ public interface IExecutionStockInOrderService extends IService<ExecutionStockIn
|
|||||||
* 解析Excel文件并获取出库数据
|
* 解析Excel文件并获取出库数据
|
||||||
* @param file Excel文件
|
* @param file Excel文件
|
||||||
* @param sheetName 工作表名称(出库导入/参考数据)
|
* @param sheetName 工作表名称(出库导入/参考数据)
|
||||||
|
* @param warehouseId 当前仓库id(非空时校验导入物料是否属于该仓库)
|
||||||
* @return 出库数据DTO
|
* @return 出库数据DTO
|
||||||
* @throws Exception 解析异常
|
* @throws Exception 解析异常
|
||||||
*/
|
*/
|
||||||
DeliveryDataDTO parseExcelFile(MultipartFile file, String sheetName) throws Exception;
|
DeliveryDataDTO parseExcelFile(MultipartFile file, String sheetName, Long warehouseId) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析入库单Excel文件
|
* 解析入库单Excel文件
|
||||||
|
|||||||
+30
-1
@@ -35,6 +35,7 @@ import com.mhd.oms.domain.executionStockOutOrder.repository.todo.ExecutionStockO
|
|||||||
import com.mhd.oms.domain.executionStockOutOrder.service.ExecutionStockOutOrderApplicationService;
|
import com.mhd.oms.domain.executionStockOutOrder.service.ExecutionStockOutOrderApplicationService;
|
||||||
import com.mhd.oms.domain.reservationDeliveryDetailsLink.entity.ReservationDeliveryDetailsLink;
|
import com.mhd.oms.domain.reservationDeliveryDetailsLink.entity.ReservationDeliveryDetailsLink;
|
||||||
import com.mhd.oms.domain.reservationDeliveryDetailsLink.repository.facade.IReservationDeliveryDetailsLinkService;
|
import com.mhd.oms.domain.reservationDeliveryDetailsLink.repository.facade.IReservationDeliveryDetailsLinkService;
|
||||||
|
import com.mhd.oms.domain.reservationStockInOrder.repository.mapper.ReservationStockInOrderMapper;
|
||||||
import com.mhd.system.api.SystemServiceFeign;
|
import com.mhd.system.api.SystemServiceFeign;
|
||||||
import com.mhd.system.api.UserServiceFeign;
|
import com.mhd.system.api.UserServiceFeign;
|
||||||
import com.mhd.system.api.WmsServiceFeign;
|
import com.mhd.system.api.WmsServiceFeign;
|
||||||
@@ -80,6 +81,8 @@ public class ExecutionStockInOrderImpl extends ServiceImpl<ExecutionStockInOrder
|
|||||||
private SystemServiceFeign systemServiceFeign;
|
private SystemServiceFeign systemServiceFeign;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IExecutionInMaterialDetailService materialDetailService;
|
private IExecutionInMaterialDetailService materialDetailService;
|
||||||
|
@Autowired
|
||||||
|
private ReservationStockInOrderMapper reservationStockInOrderMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询入库单列表
|
* 查询入库单列表
|
||||||
@@ -207,7 +210,7 @@ public class ExecutionStockInOrderImpl extends ServiceImpl<ExecutionStockInOrder
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DeliveryDataDTO parseExcelFile(MultipartFile file, String sheetName) throws Exception {
|
public DeliveryDataDTO parseExcelFile(MultipartFile file, String sheetName, Long warehouseId) throws Exception {
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
// 校验文件和工作表名称(逻辑不变)
|
// 校验文件和工作表名称(逻辑不变)
|
||||||
if (file.isEmpty()) {
|
if (file.isEmpty()) {
|
||||||
@@ -256,6 +259,26 @@ public class ExecutionStockInOrderImpl extends ServiceImpl<ExecutionStockInOrder
|
|||||||
throw new Exception("出库物料不是同一个货主!");
|
throw new Exception("出库物料不是同一个货主!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ====== 物料仓库校验(物料档案全仓共享;指定仓库时,物料必须在该仓库有库存记录才可出库) ======
|
||||||
|
if (warehouseId != null && warehouseId > 0) {
|
||||||
|
String warehouseName = reservationStockInOrderMapper.getWarehouseName(warehouseId);
|
||||||
|
List<String> wrongWarehouseMaterials = new ArrayList<>();
|
||||||
|
for (ProductDetail productDetail : productDetailList) {
|
||||||
|
MaterialBaseInfoPO materialBaseInfoPO = stockInOrderMapper.getByCode(productDetail.getProductCode());
|
||||||
|
if (materialBaseInfoPO == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int count = reservationStockInOrderMapper.countInventoryByWarehouse(materialBaseInfoPO.getMaterialBaseInfoId(), warehouseId);
|
||||||
|
if (count <= 0) {
|
||||||
|
wrongWarehouseMaterials.add(productDetail.getProductCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!wrongWarehouseMaterials.isEmpty()) {
|
||||||
|
throw new Exception("物料[" + String.join("、", wrongWarehouseMaterials) + "]在当前仓库["
|
||||||
|
+ (warehouseName == null ? warehouseId : warehouseName) + "]没有库存记录,无法从该仓库出库,请确认导入仓库是否正确");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ExecutionStockOutOrderDO reservationStockOutOrderDO = new ExecutionStockOutOrderDO();
|
ExecutionStockOutOrderDO reservationStockOutOrderDO = new ExecutionStockOutOrderDO();
|
||||||
reservationStockOutOrderDO.setOutOrderNumber(OrderSequence.getOrderCode("CK"));
|
reservationStockOutOrderDO.setOutOrderNumber(OrderSequence.getOrderCode("CK"));
|
||||||
reservationStockOutOrderDO.setShipperId((Long) shipperIds.get(0).get("shipperId"));
|
reservationStockOutOrderDO.setShipperId((Long) shipperIds.get(0).get("shipperId"));
|
||||||
@@ -263,6 +286,12 @@ public class ExecutionStockInOrderImpl extends ServiceImpl<ExecutionStockInOrder
|
|||||||
reservationStockOutOrderDO.setShipperCode((String) shipperIds.get(0).get("shipperCode"));
|
reservationStockOutOrderDO.setShipperCode((String) shipperIds.get(0).get("shipperCode"));
|
||||||
reservationStockOutOrderDO.setNeedTransportFlag("1");
|
reservationStockOutOrderDO.setNeedTransportFlag("1");
|
||||||
reservationStockOutOrderDO.setNeedDeclareFlag("1");
|
reservationStockOutOrderDO.setNeedDeclareFlag("1");
|
||||||
|
// 指定仓库时回填单据仓库信息
|
||||||
|
if (warehouseId != null && warehouseId > 0) {
|
||||||
|
reservationStockOutOrderDO.setWarehouseId(warehouseId);
|
||||||
|
reservationStockOutOrderDO.setWarehouseCode(reservationStockInOrderMapper.getWarehouseCode(warehouseId));
|
||||||
|
reservationStockOutOrderDO.setWarehouseName(reservationStockInOrderMapper.getWarehouseName(warehouseId));
|
||||||
|
}
|
||||||
reservationStockOutOrderDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
reservationStockOutOrderDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||||
reservationStockOutOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
reservationStockOutOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||||
reservationStockOutOrderDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
reservationStockOutOrderDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||||
|
|||||||
+13
-12
@@ -174,40 +174,41 @@ public class ReservationMaterialInventoryPO extends MaterialBasePO {
|
|||||||
@Excel(name = "扩展字段2")
|
@Excel(name = "扩展字段2")
|
||||||
private String extAttr2;
|
private String extAttr2;
|
||||||
|
|
||||||
|
// 以下业务日期字段只保留年月日:导出复用 /list 接口,前端取 JSON 值直接进 Excel,去掉时分秒(与 WMS 库存查询一致)
|
||||||
@ApiModelProperty("生产日期")
|
@ApiModelProperty("生产日期")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
@Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date productionDate;
|
private Date productionDate;
|
||||||
|
|
||||||
@ApiModelProperty("过期日期")
|
@ApiModelProperty("过期日期")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "过期日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
@Excel(name = "过期日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date expiryDate;
|
private Date expiryDate;
|
||||||
|
|
||||||
@ApiModelProperty("存货日期")
|
@ApiModelProperty("存货日期")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "存货日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
@Excel(name = "存货日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date inventoryDate;
|
private Date inventoryDate;
|
||||||
|
|
||||||
@ApiModelProperty("进货日期")
|
@ApiModelProperty("进货日期")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "进货日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
@Excel(name = "进货日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date purchaseDate;
|
private Date purchaseDate;
|
||||||
|
|
||||||
@ApiModelProperty("ExtAttr3")
|
@ApiModelProperty("ExtAttr3")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "ExtAttr3", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
@Excel(name = "ExtAttr3", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date extAttr3;
|
private Date extAttr3;
|
||||||
|
|
||||||
@ApiModelProperty("ExtAttr4")
|
@ApiModelProperty("ExtAttr4")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "ExtAttr4", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
@Excel(name = "ExtAttr4", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date extAttr4;
|
private Date extAttr4;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -53,10 +53,11 @@ public interface IReservationStockInOrderService extends IService<ReservationSto
|
|||||||
* 解析Excel文件并获取出库数据
|
* 解析Excel文件并获取出库数据
|
||||||
* @param file Excel文件
|
* @param file Excel文件
|
||||||
* @param sheetName 工作表名称(出库导入/参考数据)
|
* @param sheetName 工作表名称(出库导入/参考数据)
|
||||||
|
* @param warehouseId 当前仓库id(非空时校验导入物料是否属于该仓库,并按该仓库过滤批次库存)
|
||||||
* @return 出库数据DTO
|
* @return 出库数据DTO
|
||||||
* @throws Exception 解析异常
|
* @throws Exception 解析异常
|
||||||
*/
|
*/
|
||||||
DeliveryDataDTO parseExcelFile(MultipartFile file, String sheetName) throws Exception;
|
DeliveryDataDTO parseExcelFile(MultipartFile file, String sheetName, Long warehouseId) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析入库单Excel文件
|
* 解析入库单Excel文件
|
||||||
|
|||||||
+7
-1
@@ -35,7 +35,13 @@ public interface ReservationStockInOrderMapper extends BaseMapper<ReservationSto
|
|||||||
|
|
||||||
public List<MaterialBaseInfoPO> getMaterialBaseInfoList(@Param("id") String id);
|
public List<MaterialBaseInfoPO> getMaterialBaseInfoList(@Param("id") String id);
|
||||||
|
|
||||||
public List<ReservationMaterialInventoryPO> getkcId(@Param("id") Long id,@Param("q") BigDecimal q);
|
public List<ReservationMaterialInventoryPO> getkcId(@Param("id") Long id,@Param("q") BigDecimal q, @Param("warehouseId") Long warehouseId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出库导入校验:物料在指定仓库是否存在库存记录(存在即视为归属该仓库,不限数量)
|
||||||
|
* @return 库存记录数
|
||||||
|
*/
|
||||||
|
public int countInventoryByWarehouse(@Param("id") Long id, @Param("warehouseId") Long warehouseId);
|
||||||
|
|
||||||
public MaterialWarehouseControlPO getInfoByMaterialBaseInfoIds(@Param("id") Long id);
|
public MaterialWarehouseControlPO getInfoByMaterialBaseInfoIds(@Param("id") Long id);
|
||||||
|
|
||||||
|
|||||||
+30
-5
@@ -220,7 +220,7 @@ public class ReservationStockInOrderImpl extends ServiceImpl<ReservationStockInO
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DeliveryDataDTO parseExcelFile(MultipartFile file, String sheetName) throws Exception {
|
public DeliveryDataDTO parseExcelFile(MultipartFile file, String sheetName, Long warehouseId) throws Exception {
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
// 校验文件和工作表名称(逻辑不变)
|
// 校验文件和工作表名称(逻辑不变)
|
||||||
if (file.isEmpty()) {
|
if (file.isEmpty()) {
|
||||||
@@ -309,6 +309,23 @@ public class ReservationStockInOrderImpl extends ServiceImpl<ReservationStockInO
|
|||||||
throw new Exception(String.join(";", problems) + ",维护完成后重新导入");
|
throw new Exception(String.join(";", problems) + ",维护完成后重新导入");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ====== 第四步:物料仓库校验(物料档案全仓共享;指定仓库时,物料必须在该仓库有库存记录才可出库,
|
||||||
|
// 防止取到其他仓库的批次库存、单据显示成其他仓库) ======
|
||||||
|
if (warehouseId != null && warehouseId > 0) {
|
||||||
|
String warehouseName = stockInOrderMapper.getWarehouseName(warehouseId);
|
||||||
|
List<String> wrongWarehouseMaterials = new ArrayList<>();
|
||||||
|
for (MaterialBaseInfoPO materialBaseInfoPO : materialCache.values()) {
|
||||||
|
int count = stockInOrderMapper.countInventoryByWarehouse(materialBaseInfoPO.getMaterialBaseInfoId(), warehouseId);
|
||||||
|
if (count <= 0) {
|
||||||
|
wrongWarehouseMaterials.add(materialBaseInfoPO.getMaterialCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!wrongWarehouseMaterials.isEmpty()) {
|
||||||
|
throw new Exception("物料[" + String.join("、", wrongWarehouseMaterials) + "]在当前仓库["
|
||||||
|
+ (warehouseName == null ? warehouseId : warehouseName) + "]没有库存记录,无法从该仓库出库,请确认导入仓库是否正确");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ====== 后续处理(编号均已存在):货主归属校验、建单落库 ======
|
// ====== 后续处理(编号均已存在):货主归属校验、建单落库 ======
|
||||||
for (MaterialBaseInfoPO materialBaseInfoPO : materialCache.values()) {
|
for (MaterialBaseInfoPO materialBaseInfoPO : materialCache.values()) {
|
||||||
if (materialBaseInfoPO.getShipperId() != null && processedShipperIds.add(materialBaseInfoPO.getShipperId())) {
|
if (materialBaseInfoPO.getShipperId() != null && processedShipperIds.add(materialBaseInfoPO.getShipperId())) {
|
||||||
@@ -343,6 +360,12 @@ public class ReservationStockInOrderImpl extends ServiceImpl<ReservationStockInO
|
|||||||
}
|
}
|
||||||
reservationStockOutOrderDO.setNeedTransportFlag("1");
|
reservationStockOutOrderDO.setNeedTransportFlag("1");
|
||||||
reservationStockOutOrderDO.setNeedDeclareFlag("1");
|
reservationStockOutOrderDO.setNeedDeclareFlag("1");
|
||||||
|
// 指定仓库时回填单据仓库信息(此前导入单仓库为空)
|
||||||
|
if (warehouseId != null && warehouseId > 0) {
|
||||||
|
reservationStockOutOrderDO.setWarehouseId(warehouseId);
|
||||||
|
reservationStockOutOrderDO.setWarehouseCode(stockInOrderMapper.getWarehouseCode(warehouseId));
|
||||||
|
reservationStockOutOrderDO.setWarehouseName(stockInOrderMapper.getWarehouseName(warehouseId));
|
||||||
|
}
|
||||||
reservationStockOutOrderDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
reservationStockOutOrderDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||||
reservationStockOutOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
reservationStockOutOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||||
reservationStockOutOrderDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
reservationStockOutOrderDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||||
@@ -382,13 +405,14 @@ public class ReservationStockInOrderImpl extends ServiceImpl<ReservationStockInO
|
|||||||
reservationOutMaterialDetailDO.setQuantity(new BigDecimal(productDetail.getPieceCount()).setScale(2, BigDecimal.ROUND_HALF_UP));
|
reservationOutMaterialDetailDO.setQuantity(new BigDecimal(productDetail.getPieceCount()).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||||
if (materialBaseInfoPO != null) {
|
if (materialBaseInfoPO != null) {
|
||||||
Long materialBaseInfoId = materialBaseInfoPO.getMaterialBaseInfoId();
|
Long materialBaseInfoId = materialBaseInfoPO.getMaterialBaseInfoId();
|
||||||
List<ReservationMaterialInventoryPO> reservationMaterialInventoryPOS = stockInOrderMapper.getkcId(materialBaseInfoId, new BigDecimal(productDetail.getPieceCount()).setScale(2, BigDecimal.ROUND_HALF_UP));
|
List<ReservationMaterialInventoryPO> reservationMaterialInventoryPOS = stockInOrderMapper.getkcId(materialBaseInfoId, new BigDecimal(productDetail.getPieceCount()).setScale(2, BigDecimal.ROUND_HALF_UP), warehouseId);
|
||||||
if (reservationMaterialInventoryPOS != null&&reservationMaterialInventoryPOS.size() > 0) {
|
if (reservationMaterialInventoryPOS != null&&reservationMaterialInventoryPOS.size() > 0) {
|
||||||
ReservationMaterialInventoryPO reservationMaterialInventoryPO = reservationMaterialInventoryPOS.get(0);
|
ReservationMaterialInventoryPO reservationMaterialInventoryPO = reservationMaterialInventoryPOS.get(0);
|
||||||
Long materialInventoryId = reservationMaterialInventoryPO.getMaterialInventoryId();
|
Long materialInventoryId = reservationMaterialInventoryPO.getMaterialInventoryId();
|
||||||
String batchNumber = reservationMaterialInventoryPO.getBatchNumber();
|
String batchNumber = reservationMaterialInventoryPO.getBatchNumber();
|
||||||
String lotNumber = reservationMaterialInventoryPO.getLotNumber();
|
String lotNumber = reservationMaterialInventoryPO.getLotNumber();
|
||||||
Long warehouseId = reservationMaterialInventoryPO.getWarehouseId();
|
// 库存记录所在仓库(指定导入仓库时,getkcId 已按该仓库过滤,两者一致)
|
||||||
|
Long invWarehouseId = reservationMaterialInventoryPO.getWarehouseId();
|
||||||
String warehouseCode = reservationMaterialInventoryPO.getWarehouseCode();
|
String warehouseCode = reservationMaterialInventoryPO.getWarehouseCode();
|
||||||
String warehouseName = reservationMaterialInventoryPO.getWarehouseName();
|
String warehouseName = reservationMaterialInventoryPO.getWarehouseName();
|
||||||
String inOrderNumber = reservationMaterialInventoryPO.getInOrderNumber();
|
String inOrderNumber = reservationMaterialInventoryPO.getInOrderNumber();
|
||||||
@@ -398,7 +422,7 @@ public class ReservationStockInOrderImpl extends ServiceImpl<ReservationStockInO
|
|||||||
reservationOutMaterialDetailDO.setMaterialInventoryId(materialInventoryId);
|
reservationOutMaterialDetailDO.setMaterialInventoryId(materialInventoryId);
|
||||||
reservationOutMaterialDetailDO.setBatchNumber(batchNumber);
|
reservationOutMaterialDetailDO.setBatchNumber(batchNumber);
|
||||||
reservationOutMaterialDetailDO.setLotNo(lotNumber);
|
reservationOutMaterialDetailDO.setLotNo(lotNumber);
|
||||||
reservationOutMaterialDetailDO.setWarehouseId(warehouseId);
|
reservationOutMaterialDetailDO.setWarehouseId(invWarehouseId);
|
||||||
reservationOutMaterialDetailDO.setWarehouseCode(warehouseCode);
|
reservationOutMaterialDetailDO.setWarehouseCode(warehouseCode);
|
||||||
reservationOutMaterialDetailDO.setWarehouseName(warehouseName);
|
reservationOutMaterialDetailDO.setWarehouseName(warehouseName);
|
||||||
reservationOutMaterialDetailDO.setInOrderNumber(inOrderNumber);
|
reservationOutMaterialDetailDO.setInOrderNumber(inOrderNumber);
|
||||||
@@ -408,7 +432,8 @@ public class ReservationStockInOrderImpl extends ServiceImpl<ReservationStockInO
|
|||||||
reservationOutMaterialDetailDO.setInventoryQuantity(inventoryQuantity);
|
reservationOutMaterialDetailDO.setInventoryQuantity(inventoryQuantity);
|
||||||
reservationOutMaterialDetailDO.setUnitName(unitName);
|
reservationOutMaterialDetailDO.setUnitName(unitName);
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("物料批次库存数量少于出库数量!");
|
throw new RuntimeException("物料[" + productDetail.getProductCode() + "]"
|
||||||
|
+ (warehouseId != null && warehouseId > 0 ? "在当前仓库" : "") + "批次库存数量少于出库数量!");
|
||||||
}
|
}
|
||||||
reservationOutMaterialDetailDO.setMaterialBaseInfoId(materialBaseInfoPO.getMaterialBaseInfoId());
|
reservationOutMaterialDetailDO.setMaterialBaseInfoId(materialBaseInfoPO.getMaterialBaseInfoId());
|
||||||
reservationOutMaterialDetailDO.setMaterialCode(materialBaseInfoPO.getMaterialCode());
|
reservationOutMaterialDetailDO.setMaterialCode(materialBaseInfoPO.getMaterialCode());
|
||||||
|
|||||||
+4
-2
@@ -203,13 +203,15 @@ public class ExecutionStockInOrderApi extends BaseController {
|
|||||||
* 上传并解析Excel文件
|
* 上传并解析Excel文件
|
||||||
* @param file Excel文件
|
* @param file Excel文件
|
||||||
* @param sheetName 工作表名称(出库导入/参考数据)
|
* @param sheetName 工作表名称(出库导入/参考数据)
|
||||||
|
* @param warehouseId 当前仓库id(非空时校验导入物料是否属于该仓库,并按该仓库过滤批次库存)
|
||||||
* @return 解析后的出库数据
|
* @return 解析后的出库数据
|
||||||
*/
|
*/
|
||||||
@PostMapping("/parseExcel")
|
@PostMapping("/parseExcel")
|
||||||
public ResponseEntity<Map<String, Object>> parseExcel(
|
public ResponseEntity<Map<String, Object>> parseExcel(
|
||||||
@RequestParam("file") MultipartFile file) {
|
@RequestParam("file") MultipartFile file,
|
||||||
|
@RequestParam(value = "warehouseId", required = false) Long warehouseId) {
|
||||||
try {
|
try {
|
||||||
DeliveryDataDTO deliveryDataDTO = reservationStockInOrderService.parseExcelFile(file, "");
|
DeliveryDataDTO deliveryDataDTO = reservationStockInOrderService.parseExcelFile(file, "", warehouseId);
|
||||||
Map<String, Object> result = new HashMap<>();
|
Map<String, Object> result = new HashMap<>();
|
||||||
result.put("result", deliveryDataDTO);
|
result.put("result", deliveryDataDTO);
|
||||||
result.put("code",200);
|
result.put("code",200);
|
||||||
|
|||||||
+4
-2
@@ -211,14 +211,16 @@ public class ReservationStockInOrderApi extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 上传并解析Excel文件(默认读取"出库导入"工作表)
|
* 上传并解析Excel文件(默认读取"出库导入"工作表)
|
||||||
* @param file Excel文件
|
* @param file Excel文件
|
||||||
|
* @param warehouseId 当前仓库id(非空时校验导入物料是否属于该仓库,并按该仓库过滤批次库存)
|
||||||
* @return 解析后的出库数据
|
* @return 解析后的出库数据
|
||||||
*/
|
*/
|
||||||
@PostMapping("/parseExcel")
|
@PostMapping("/parseExcel")
|
||||||
public ResponseEntity<Map<String, Object>> parseExcel(
|
public ResponseEntity<Map<String, Object>> parseExcel(
|
||||||
@RequestParam("file") MultipartFile file) {
|
@RequestParam("file") MultipartFile file,
|
||||||
|
@RequestParam(value = "warehouseId", required = false) Long warehouseId) {
|
||||||
Map<String, Object> result = new HashMap<>();
|
Map<String, Object> result = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
DeliveryDataDTO deliveryDataDTO = reservationStockInOrderService.parseExcelFile(file, "");
|
DeliveryDataDTO deliveryDataDTO = reservationStockInOrderService.parseExcelFile(file, "", warehouseId);
|
||||||
result.put("result", deliveryDataDTO);
|
result.put("result", deliveryDataDTO);
|
||||||
result.put("code", 200);
|
result.put("code", 200);
|
||||||
result.put("msg", "解析成功");
|
result.put("msg", "解析成功");
|
||||||
|
|||||||
+8
@@ -556,6 +556,14 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="getkcId" resultType="com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryPO">
|
<select id="getkcId" resultType="com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryPO">
|
||||||
select * from "NGWL_TEST_WMS".MATERIAL_INVENTORY where 1 = 1 and DEL_FLAG = 1 and MATERIAL_BASE_INFO_ID = #{id} and ALLOCATION_QUANTITY >= #{q}
|
select * from "NGWL_TEST_WMS".MATERIAL_INVENTORY where 1 = 1 and DEL_FLAG = 1 and MATERIAL_BASE_INFO_ID = #{id} and ALLOCATION_QUANTITY >= #{q}
|
||||||
|
<if test="warehouseId != null">
|
||||||
|
and WAREHOUSE_ID = #{warehouseId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<!-- 出库导入校验:物料在指定仓库是否存在库存记录(存在即视为归属该仓库,不限数量) -->
|
||||||
|
<select id="countInventoryByWarehouse" resultType="int">
|
||||||
|
select count(1) from "NGWL_TEST_WMS".MATERIAL_INVENTORY
|
||||||
|
where 1 = 1 and DEL_FLAG = 1 and MATERIAL_BASE_INFO_ID = #{id} and WAREHOUSE_ID = #{warehouseId}
|
||||||
</select>
|
</select>
|
||||||
<select id="getUserNcCode" parameterType="java.lang.Long" resultType="java.lang.String">
|
<select id="getUserNcCode" parameterType="java.lang.Long" resultType="java.lang.String">
|
||||||
select CUSTOMER_NC_CODE from "NGWL_TEST_USER".USER_SHIPPER where 1 = 1 and DEL_FLAG = 1 and USER_ID = #{id} limit 1
|
select CUSTOMER_NC_CODE from "NGWL_TEST_USER".USER_SHIPPER where 1 = 1 and DEL_FLAG = 1 and USER_ID = #{id} limit 1
|
||||||
|
|||||||
+13
-12
@@ -176,40 +176,41 @@ public class MaterialInventoryPO extends MaterialBasePO {
|
|||||||
@Excel(name = "扩展字段2")
|
@Excel(name = "扩展字段2")
|
||||||
private String extAttr2;
|
private String extAttr2;
|
||||||
|
|
||||||
|
// 以下业务日期字段只保留年月日:导出复用 /list 接口,前端取 JSON 值直接进 Excel,去掉时分秒(与 OMS 库存查询一致)
|
||||||
@ApiModelProperty("生产日期")
|
@ApiModelProperty("生产日期")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
@Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date productionDate;
|
private Date productionDate;
|
||||||
|
|
||||||
@ApiModelProperty("过期日期")
|
@ApiModelProperty("过期日期")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "过期日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
@Excel(name = "过期日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date expiryDate;
|
private Date expiryDate;
|
||||||
|
|
||||||
@ApiModelProperty("存货日期")
|
@ApiModelProperty("存货日期")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "存货日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
@Excel(name = "存货日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date inventoryDate;
|
private Date inventoryDate;
|
||||||
|
|
||||||
@ApiModelProperty("进货日期")
|
@ApiModelProperty("进货日期")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "进货日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
@Excel(name = "进货日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date purchaseDate;
|
private Date purchaseDate;
|
||||||
|
|
||||||
@ApiModelProperty("ExtAttr3")
|
@ApiModelProperty("ExtAttr3")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "ExtAttr3", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
@Excel(name = "ExtAttr3", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date extAttr3;
|
private Date extAttr3;
|
||||||
|
|
||||||
@ApiModelProperty("ExtAttr4")
|
@ApiModelProperty("ExtAttr4")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "ExtAttr4", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
@Excel(name = "ExtAttr4", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date extAttr4;
|
private Date extAttr4;
|
||||||
|
|
||||||
@ApiModelProperty("物料更多属性列表(批次属性)")
|
@ApiModelProperty("物料更多属性列表(批次属性)")
|
||||||
|
|||||||
Reference in New Issue
Block a user