From 8e42ebde1ffc244800d176b283c6bfb52ed39df3 Mon Sep 17 00:00:00 2001 From: wanghao Date: Fri, 5 Sep 2025 17:34:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E8=B0=83=E6=8B=A8?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E6=8F=92=E5=85=A5=E8=AE=B0=E5=BD=95=E3=80=81?= =?UTF-8?q?=E6=8F=92=E5=85=A5=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/api/WmsPdaApiController.java | 40 +++++++++---- .../wms/domain/WmsAllocateOrderDetail.java | 1 + .../dromara/wms/domain/WmsAllocateTask.java | 3 +- .../org/dromara/wms/domain/WmsInventory.java | 6 +- .../domain/bo/WmsAllocateOrderDetailBo.java | 10 ++-- .../domain/vo/WmsAllocateOrderDetailVo.java | 1 + .../dromara/wms/mapper/WmsPdaApiMapper.java | 3 + .../wms/service/IWmsPdaApiService.java | 2 + .../service/impl/WmsPdaApiServiceImpl.java | 60 +++++++++++++++++-- .../resources/mapper/wms/WmsPdaApiMapper.xml | 4 ++ 10 files changed, 106 insertions(+), 24 deletions(-) diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/api/WmsPdaApiController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/api/WmsPdaApiController.java index 54f9c8eb..39f86ce0 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/api/WmsPdaApiController.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/api/WmsPdaApiController.java @@ -151,10 +151,10 @@ public class WmsPdaApiController extends BaseController { */ @PostMapping("/raw/outSelectByOrderCode") public R> outSelectByOrderCode(String orderCode, String orderType) { - List wmsOutstockDetailVo = null; + List wmsOutstockDetailVoList; if (orderType.equals("5")) { - wmsOutstockDetailVo = apiService.outSelectByOrderCode(orderCode); - wmsOutstockDetailVo.forEach(item -> { + wmsOutstockDetailVoList = apiService.outSelectByOrderCode(orderCode); + wmsOutstockDetailVoList.forEach(item -> { WmsInventoryVo inventory = wmsInventoryService.selectOrderBeachCode(item.getMaterialId()); if (inventory != null) { item.setLocationCode(inventory.getLocationCode()); @@ -165,8 +165,9 @@ public class WmsPdaApiController extends BaseController { }); } else if (orderType.equals("7")) { List list = wmsAllocateOrderDetailService.selectdetailListByOrderCode(orderCode); - if (list != null && list.size() > 0) { - wmsOutstockDetailVo = new ArrayList<>(list.size()); + if (list != null && !list.isEmpty()) { + wmsOutstockDetailVoList = new ArrayList<>(list.size()); + list.forEach(item -> { WmsInventoryVo inventory = wmsInventoryService.selectOrderBeachCode(item.getMaterialId()); WmsOutstockDetailVo vo = new WmsOutstockDetailVo(); @@ -175,16 +176,22 @@ public class WmsPdaApiController extends BaseController { vo.setBatchCode(inventory.getBatchCode()); vo.setInventoryQty(inventory.getInventoryQty()); vo.setMaterialCode(inventory.getMaterialCode()); - vo.setMaterialName(inventory.getMaterialName()); -vo.setOutstockQty(item.getAllocateOrderQty()); + vo.setOutSum(item.getOutSum()); + vo.setMaterialName(item.getMaterialName()); + vo.setOutstockQty(item.getAllocateOrderQty()); + wmsOutstockDetailVoList.add(vo); }); + } else { + wmsOutstockDetailVoList = null; } + } else { + wmsOutstockDetailVoList = null; } - if (wmsOutstockDetailVo == null) return R.fail("出库单号不正确"); - return R.ok(wmsOutstockDetailVo); + if (wmsOutstockDetailVoList == null) return R.fail("出库单号不正确"); + return R.ok(wmsOutstockDetailVoList); } /** @@ -192,8 +199,18 @@ vo.setOutstockQty(item.getAllocateOrderQty()); */ @PostMapping("/raw/selectInVentoryByBatchCode") public R rawSelectInVentoryByBatchCode(@RequestBody WmsOutstockRecord outstockRecord) { - // 验证库存 - WmsInventory wmsInventory = apiService.outSelectInVentoryByBatch(outstockRecord); + + String type = outstockRecord.getSpecialType(); + WmsInventory wmsInventory = null; + if (type.equals("5")) { + // 验证库存 + + wmsInventory = apiService.outSelectInVentoryByBatch(outstockRecord); + + } else if (type.equals("7")) { + wmsInventory = apiService.outAllocateSelectInVentory(outstockRecord); + } + if (wmsInventory == null) { return R.fail("物料扫描错误"); } @@ -201,6 +218,7 @@ vo.setOutstockQty(item.getAllocateOrderQty()); if (wmsInventory.getInventoryQty().compareTo(outstockRecord.getOutstockQty()) < 0) { R.fail("当前库位库存为:" + wmsInventory.getInventoryQty()); } + Boolean result = apiService.rawOutSubmit(outstockRecord, wmsInventory); return result ? R.ok() : R.fail(); } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsAllocateOrderDetail.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsAllocateOrderDetail.java index 76f3364b..17ddb46a 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsAllocateOrderDetail.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsAllocateOrderDetail.java @@ -94,5 +94,6 @@ public class WmsAllocateOrderDetail { @TableField(exist = false) private String materialCode; + private double outSum;//实际出库数量 } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsAllocateTask.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsAllocateTask.java index 864b8cc8..8dcfa332 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsAllocateTask.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsAllocateTask.java @@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode; import org.dromara.common.tenant.core.TenantEntity; import java.io.Serial; +import java.math.BigDecimal; import java.util.Date; /** @@ -43,7 +44,7 @@ public class WmsAllocateTask extends TenantEntity { /** * 每包数量 */ - private Long materialQty; + private BigDecimal materialQty; /** * 条码数量 diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInventory.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInventory.java index 1f5651c8..7b3f4375 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInventory.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInventory.java @@ -118,5 +118,9 @@ public class WmsInventory { @TableField(exist = false) private String materialUnit;//字段映射 - + /** + * 调拨子表主键 + */ + @TableField(exist = false) + private Long aoDId;//字段映射 } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsAllocateOrderDetailBo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsAllocateOrderDetailBo.java index 2996fdcc..101ba3cc 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsAllocateOrderDetailBo.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsAllocateOrderDetailBo.java @@ -1,12 +1,9 @@ package org.dromara.wms.domain.bo; -import org.dromara.common.mybatis.core.domain.BaseEntity; -import org.dromara.common.core.validate.AddGroup; -import org.dromara.common.core.validate.EditGroup; import io.github.linpeilie.annotations.AutoMapper; import lombok.Data; import lombok.EqualsAndHashCode; -import jakarta.validation.constraints.*; +import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.wms.domain.WmsAllocateOrderDetail; import java.math.BigDecimal; @@ -57,12 +54,12 @@ public class WmsAllocateOrderDetailBo extends BaseEntity { */ // @NotNull(message = "erp同步数量不能为空", groups = { AddGroup.class, EditGroup.class }) private Long erpSynchronousQty; - + /** * 已分包数量 */ private BigDecimal printedQty; - + private String tenantId; /** @@ -95,5 +92,6 @@ public class WmsAllocateOrderDetailBo extends BaseEntity { */ private BigDecimal inventoryQty; + private double outSum; } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsAllocateOrderDetailVo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsAllocateOrderDetailVo.java index 459ed67e..a071614e 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsAllocateOrderDetailVo.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsAllocateOrderDetailVo.java @@ -121,6 +121,7 @@ public class WmsAllocateOrderDetailVo implements Serializable { * 库存数量(仅用于前端显示,用于调拨数量验证,来源于库存选择组件) */ private BigDecimal inventoryQty; + private double outSum; } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsPdaApiMapper.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsPdaApiMapper.java index 0c127f8a..26dd3e04 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsPdaApiMapper.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsPdaApiMapper.java @@ -7,6 +7,7 @@ import org.dromara.wms.domain.*; import org.dromara.wms.domain.vo.*; import org.springframework.stereotype.Repository; +import java.math.BigDecimal; import java.util.List; @Repository @@ -58,4 +59,6 @@ public interface WmsPdaApiMapper { int semiDeleteErrorCode(String code); String selectInstoreRecordLocaltionCode(@Param("materialId") Long materialId); + + void updateAllocate(@Param("id") Long aoDId,@Param("qty") BigDecimal outstockQty); } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsPdaApiService.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsPdaApiService.java index a3a08926..71688552 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsPdaApiService.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsPdaApiService.java @@ -81,4 +81,6 @@ public interface IWmsPdaApiService { boolean moveSubmit(WmsInventoryVo vo); String selectInstoreRecordLocaltionCode(Long materialId); + + WmsInventory outAllocateSelectInVentory(WmsOutstockRecord outstockRecord); } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsPdaApiServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsPdaApiServiceImpl.java index b0435819..b321d063 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsPdaApiServiceImpl.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsPdaApiServiceImpl.java @@ -46,6 +46,7 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService { private final BaseMaterialInfoMapper baseMaterialInfoMapper;//物料基础信息 private final WmsHppTransferMapper wmsHppTransferMapper; private final WmsBaseLocationMapper wmsBaseLocationMapper; + private final WmsAllocateTaskMapper wmsAllocateTaskMapper; @Override public WmsOutstockRecordVo returnSelectCode(String code) { @@ -264,14 +265,48 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService { */ @Override public Boolean rawOutSubmit(WmsOutstockRecord outstockRecord, WmsInventory wmsInventory) { - outStoreOperation(outstockRecord, wmsInventory,"5"); - // 修改子表出库数量 - wmsOutstockDetailMapper.updateOutNumberByObjId(wmsInventory.getOutstockDetailId(), outstockRecord.getOutstockQty()); + String type = outstockRecord.getSpecialType(); + outStoreOperation(outstockRecord, wmsInventory, type); + + if (type.equals("7")) { + // outstockCode = "AL250905152403002" + String outstockCode = outstockRecord.getOutstockCode(); + // batchCode = "IN20250903001WMS-003001" + String batchCode = outstockRecord.getBatchCode(); + // locationCode = "DJ-01" + BigDecimal outstockQty = outstockRecord.getOutstockQty(); + + //修改调拨子表出库数量 + apiMapper.updateAllocate(wmsInventory.getAoDId(), outstockRecord.getOutstockQty()); + //查询调拨入库任务 + MPJLambdaWrapper lqw = JoinWrappers.lambda(WmsAllocateTask.class) + .selectAll(WmsAllocateTask.class); + // lqw.eq(WmsAllocateTask::getAoDId, wmsInventory.getAoDId()); + lqw.eq(WmsAllocateTask::getAllocateCode,outstockCode);//单号 + lqw.eq(WmsAllocateTask::getBatchCode,batchCode);//批次码 + WmsAllocateTask WmsAllocateTask =wmsAllocateTaskMapper.selectOne(lqw); + if (WmsAllocateTask == null) { + WmsAllocateTask=new WmsAllocateTask(); + BeanUtils.copyProperties(wmsInventory, WmsAllocateTask); + WmsAllocateTask.setAoDId(wmsInventory.getAoDId()); + WmsAllocateTask.setAllocateCode(outstockCode); + // WmsAllocateTask.setBatchCode(batchCode); + WmsAllocateTask.setMaterialQty(outstockQty); + + wmsAllocateTaskMapper.insert(WmsAllocateTask); + } + + } else if (type.equals("5")) { + // 修改子表出库数量 + wmsOutstockDetailMapper.updateOutNumberByObjId(wmsInventory.getOutstockDetailId(), outstockRecord.getOutstockQty()); + } + + return true; } // 出库操作 - private void outStoreOperation(WmsOutstockRecord outstockRecord, WmsInventory wmsInventory,String type) { + private void outStoreOperation(WmsOutstockRecord outstockRecord, WmsInventory wmsInventory, String type) { // 出库数量 BigDecimal outstockQty = outstockRecord.getOutstockQty(); // 库存 @@ -291,6 +326,7 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService { outstockRecord.setCreateTime(DateUtils.getNowDate()); outstockRecord.setSpecialType(type); wmsOutstockRecordMapper.insert(outstockRecord); + } /** @@ -303,7 +339,7 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService { @Override public Boolean specialOutSubmit(WmsOutstockRecord outstockRecord, WmsInventory wmsInventory) { // 出库数量 - outStoreOperation(outstockRecord, wmsInventory,"6"); + outStoreOperation(outstockRecord, wmsInventory, "6"); return true; } @@ -321,6 +357,20 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService { return wmsInventoryMapper.selectOne(lqw); } + /** + * 出库连子表查物料库存 + */ + @Override + public WmsInventory outAllocateSelectInVentory(WmsOutstockRecord outstockRecord) { + MPJLambdaWrapper lqw = JoinWrappers.lambda(WmsInventory.class) + .selectAll(WmsInventory.class) + .rightJoin(WmsAllocateOrderDetail.class, WmsAllocateOrderDetail::getMaterialId, WmsInventory::getMaterialId) + .select(WmsAllocateOrderDetail::getAoDId) + .eq(WmsAllocateOrderDetail::getAllocateCode, outstockRecord.getOutstockCode()) + .eq(WmsInventory::getBatchCode, outstockRecord.getBatchCode()).eq(WmsInventory::getLocationCode, outstockRecord.getLocationCode()); + return wmsInventoryMapper.selectOne(lqw); + } + @Override public List selectStoreInfo(String type) { if (type.equals("盘点")) { diff --git a/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsPdaApiMapper.xml b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsPdaApiMapper.xml index bfb5104f..13be13f3 100644 --- a/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsPdaApiMapper.xml +++ b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsPdaApiMapper.xml @@ -180,5 +180,9 @@ select top 1 location_code from wms_instock_record where material_id = #{materialId} order by create_time desc + + UPDATE wms_allocate_order_detail SET out_sum = out_sum + #{qty} WHERE ao_d_id = #{id} + +