From 29cc9e87acdfd435d4d0ad5b948d7e3b16f3560c Mon Sep 17 00:00:00 2001 From: wangpengfei <1928057482@qq.com> Date: Fri, 27 Sep 2024 08:42:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InventoryAdjustmentDetail.java | 12 +++-- .../InventoryAdjustmentDetailDto.java | 12 +++-- .../InventoryAdjustmentDetailMapper.xml | 2 - .../InventoryAdjustmentDetailService.java | 53 ++++++++++--------- .../InventoryAdjustmentDetailVo.java | 1 + .../biz/warehouseinfo/WarehouseInfoMapper.xml | 2 +- .../WarehouseInventoryMapper.xml | 3 +- .../WarehouseInvoiceService.java | 4 +- .../WarehouseOutLocationMapper.java | 2 +- .../WarehouseOutLocationMapper.xml | 4 +- .../WarehouseOutLocationService.java | 53 +++++++++++-------- 11 files changed, 84 insertions(+), 64 deletions(-) diff --git a/src/main/java/com/yxt/warehouse/biz/inventoryadjustmentdetail/InventoryAdjustmentDetail.java b/src/main/java/com/yxt/warehouse/biz/inventoryadjustmentdetail/InventoryAdjustmentDetail.java index 4a7a02a..91a3988 100644 --- a/src/main/java/com/yxt/warehouse/biz/inventoryadjustmentdetail/InventoryAdjustmentDetail.java +++ b/src/main/java/com/yxt/warehouse/biz/inventoryadjustmentdetail/InventoryAdjustmentDetail.java @@ -17,9 +17,13 @@ public class InventoryAdjustmentDetail extends BaseEntity { private String rackSid; private String rackName; private String rackCode; - private String goodsSpuSid;//仓库sid - private String goodsSpuName;//库位容量 - private String goodsSkuSid;//计量单位 - private String goodsSkuTitle;//货区类型 + private String goodsSpuSid;//商品 + private String goodsSpuName;// + private String goodsSkuSid;// + private String goodsSkuTitle;//商品名 + private String barCode;//条码 + private String goodsSkuCode;//商品编码 + private String goodsSkuOwnSpec;//商品规格 private String count; + private String unit; } diff --git a/src/main/java/com/yxt/warehouse/biz/inventoryadjustmentdetail/InventoryAdjustmentDetailDto.java b/src/main/java/com/yxt/warehouse/biz/inventoryadjustmentdetail/InventoryAdjustmentDetailDto.java index 91389ed..37a0869 100644 --- a/src/main/java/com/yxt/warehouse/biz/inventoryadjustmentdetail/InventoryAdjustmentDetailDto.java +++ b/src/main/java/com/yxt/warehouse/biz/inventoryadjustmentdetail/InventoryAdjustmentDetailDto.java @@ -25,10 +25,14 @@ public class InventoryAdjustmentDetailDto implements Dto { private String rackSid; private String rackName; private String rackCode; - private String goodsSpuSid;//仓库sid - private String goodsSpuName;//库位容量 - private String goodsSkuSid;//计量单位 - private String goodsSkuTitle;//货区类型 + private String goodsSpuSid;//商品 + private String goodsSpuName;// + private String goodsSkuSid;// + private String goodsSkuTitle;//商品名 + private String barCode;//条码 + private String goodsSkuCode;//商品编码 + private String goodsSkuOwnSpec;//商品规格 private String count; + private String unit; private String userSid; } diff --git a/src/main/java/com/yxt/warehouse/biz/inventoryadjustmentdetail/InventoryAdjustmentDetailMapper.xml b/src/main/java/com/yxt/warehouse/biz/inventoryadjustmentdetail/InventoryAdjustmentDetailMapper.xml index 9be7c23..e360f1f 100644 --- a/src/main/java/com/yxt/warehouse/biz/inventoryadjustmentdetail/InventoryAdjustmentDetailMapper.xml +++ b/src/main/java/com/yxt/warehouse/biz/inventoryadjustmentdetail/InventoryAdjustmentDetailMapper.xml @@ -14,8 +14,6 @@ ${ew.sqlSegment} - GROUP BY - rackSid,goodsSkuSid - + select a.* as totalCount from warehouse_out_location a a.sourceBillSid=#{sid} and a.goodsSkuSid=#{skuSid} diff --git a/src/main/java/com/yxt/warehouse/biz/warehouseoutlocation/WarehouseOutLocationService.java b/src/main/java/com/yxt/warehouse/biz/warehouseoutlocation/WarehouseOutLocationService.java index 26698c6..5aed33d 100644 --- a/src/main/java/com/yxt/warehouse/biz/warehouseoutlocation/WarehouseOutLocationService.java +++ b/src/main/java/com/yxt/warehouse/biz/warehouseoutlocation/WarehouseOutLocationService.java @@ -22,6 +22,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.UUID; @@ -48,7 +49,6 @@ public class WarehouseOutLocationService extends MybatisBaseService() .eq("sourceBillSid", dtos.get(0).getSourceBillSid()) @@ -64,24 +64,35 @@ public class WarehouseOutLocationService extends MybatisBaseService().eq("sid", dto.getInventorySid())); - warehouseInventory.setAllocateCount(warehouseInventory.getAllocateCount().add(dto.getCount().subtract(dto.getInitialCount()))); - warehouseInventoryService.saveOrUpdate(warehouseInventory); - int i = dto.getInitialCount().compareTo(new BigDecimal(0)); - if (i == 0) { - WarehouseOutLocation warehouseOutLocation = new WarehouseOutLocation(); - BeanUtil.copyProperties(dto, warehouseOutLocation, "sid"); - warehouseOutLocation.setGoodsSkuCode(warehouseOutBillDetail.getGoodsSkuCode()); - warehouseOutLocation.setSpec(dto.getSpec()); - warehouseOutLocation.setSid(UUID.randomUUID().toString()); - baseMapper.insert(warehouseOutLocation); - } else { - WarehouseOutLocation warehouseOutLocation = new WarehouseOutLocation(); - BeanUtil.copyProperties(dto, warehouseOutLocation); - warehouseOutLocation.setSid(dto.getLocationSid()); - warehouseOutLocation.setGoodsSkuCode(warehouseOutBillDetail.getGoodsSkuCode()); - warehouseOutLocation.setSpec(dto.getSpec()); - baseMapper.update(warehouseOutLocation,new QueryWrapper().eq("sid",dto.getLocationSid())); + int b=dto.getCount().compareTo(new BigDecimal(0)); + if(b==0){ + WarehouseOutLocation w=baseMapper.selectOne(new QueryWrapper().eq("sid",dto.getSid())); + if(null!=w){ + warehouseInventory.setAllocateCount(warehouseInventory.getAllocateCount().subtract(w.getCount())); + warehouseInventoryService.saveOrUpdate(warehouseInventory); + baseMapper.delete(new QueryWrapper().eq("sid",dto.getSid())); + } + }else{ + warehouseInventory.setAllocateCount(warehouseInventory.getAllocateCount().add(dto.getCount().subtract(dto.getInitialCount()))); + warehouseInventoryService.saveOrUpdate(warehouseInventory); + int i = dto.getInitialCount().compareTo(new BigDecimal(0)); + if (i == 0) { + WarehouseOutLocation warehouseOutLocation = new WarehouseOutLocation(); + BeanUtil.copyProperties(dto, warehouseOutLocation, "sid"); + warehouseOutLocation.setGoodsSkuCode(warehouseOutBillDetail.getGoodsSkuCode()); + warehouseOutLocation.setSpec(dto.getSpec()); + warehouseOutLocation.setSid(UUID.randomUUID().toString()); + baseMapper.insert(warehouseOutLocation); + } else { + WarehouseOutLocation warehouseOutLocation = new WarehouseOutLocation(); + BeanUtil.copyProperties(dto, warehouseOutLocation); + warehouseOutLocation.setSid(dto.getLocationSid()); + warehouseOutLocation.setGoodsSkuCode(warehouseOutBillDetail.getGoodsSkuCode()); + warehouseOutLocation.setSpec(dto.getSpec()); + baseMapper.update(warehouseOutLocation,new QueryWrapper().eq("sid",dto.getLocationSid())); + } } + } if (warehouseOutBillDetail.getOrderCount().compareTo(t)==0 ) { warehouseOutBillDetail.setRackState("2"); @@ -102,9 +113,9 @@ public class WarehouseOutLocationService extends MybatisBaseService totalCountBySkuSid(String sid, String skuSid) { - ResultBean rb = ResultBean.fireFail(); - WarehouseOutLocationVo warehouseOutLocationVo = baseMapper.totalCountBySkuSid(sid, skuSid); + public ResultBean> totalCountBySkuSid(String sid, String skuSid) { + ResultBean> rb = ResultBean.fireFail(); + List warehouseOutLocationVo = baseMapper.sleLocationBySkuSid(sid, skuSid); return rb.success().setData(warehouseOutLocationVo); }