From d61087419b336d134babe63325a204a8557298c1 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Tue, 29 Aug 2023 18:08:12 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=BA=93=E5=86=85=E4=BD=9C=E4=B8=9A=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/logpm/warehouse/vo/UpShelfDataVO.java | 1 + .../warehouse/vo/WarehouseUpdownGoodsVO.java | 1 + .../DistributionStockArticleServiceImpl.java | 13 +- .../api/WarehouseTrayTypeApiController.java | 28 +++ .../mapper/WarehouseTrayGoodsMapper.xml | 12 +- .../mapper/WarehouseUpdownGoodsMapper.java | 6 + .../mapper/WarehouseUpdownGoodsMapper.xml | 26 ++- .../service/IWarehouseUpdownGoodsService.java | 6 + .../impl/WarehouseTrayGoodsServiceImpl.java | 2 +- .../impl/WarehouseUpdownGoodsServiceImpl.java | 15 ++ .../impl/WarehouseUpdownTypeServiceImpl.java | 201 +++++++++++------- 11 files changed, 224 insertions(+), 87 deletions(-) diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/UpShelfDataVO.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/UpShelfDataVO.java index c17a6a0cf..fcc0880b7 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/UpShelfDataVO.java +++ b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/UpShelfDataVO.java @@ -17,6 +17,7 @@ public class UpShelfDataVO implements Serializable { private String marketName;//商场名称 private String materialCode;//物料编码 private String materialName;//物料名称 + private String incomingBatch;//批次号 private Integer goodsType;//货物类型 } diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseUpdownGoodsVO.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseUpdownGoodsVO.java index 62d65ea8d..e3b75c029 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseUpdownGoodsVO.java +++ b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseUpdownGoodsVO.java @@ -9,5 +9,6 @@ import lombok.EqualsAndHashCode; public class WarehouseUpdownGoodsVO extends WarehouseUpdownGoodsEntity { private String orderCode; + private String waybillNumber; } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java index 2208e6056..0476ddca7 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java @@ -20,7 +20,6 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.BeanUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -30,15 +29,16 @@ import com.logpm.basic.entity.BasicPrintTemplateEntity; import com.logpm.basic.feign.IBasicMaterialClient; import com.logpm.basic.feign.IBasicPrintTemplateClient; import com.logpm.distribution.dto.DistributionStockArticleDTO; -import com.logpm.distribution.dto.DistributionStockListInfoDTO; import com.logpm.distribution.entity.*; import com.logpm.distribution.excel.DistributionStockArticleExcel; -import com.logpm.distribution.excel.DistributionStockListInfoExcel; import com.logpm.distribution.mapper.DistributionAddvalueMapper; import com.logpm.distribution.mapper.DistributionDeliveryListMapper; import com.logpm.distribution.mapper.DistributionStockArticleMapper; import com.logpm.distribution.service.*; -import com.logpm.distribution.vo.*; +import com.logpm.distribution.vo.DistributionParcelListVO; +import com.logpm.distribution.vo.DistributionStockArticleQRCodeVO; +import com.logpm.distribution.vo.DistributionStockArticleVO; +import com.logpm.distribution.vo.OrderPackgeCodeDataVO; import com.logpm.distribution.wrapper.DistributionParcelListWrapper; import com.logpm.distribution.wrapper.DistributionStockArticleWrapper; import lombok.AllArgsConstructor; @@ -57,19 +57,15 @@ import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.system.cache.DictBizCache; -import org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import sun.misc.BASE64Encoder; import javax.imageio.ImageIO; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.awt.image.BufferedImage; import java.io.File; -import java.io.FileInputStream; import java.io.IOException; -import java.io.InputStream; import java.math.BigDecimal; import java.util.*; import java.util.concurrent.ScheduledThreadPoolExecutor; @@ -565,6 +561,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl findListByWaybillNumber(String waybillNumber) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("waybill_number",waybillNumber) + .eq("is_zero","1") .eq("is_deleted",0); return baseMapper.selectList(queryWrapper); diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTrayTypeApiController.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTrayTypeApiController.java index 3b8413976..6d055ee70 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTrayTypeApiController.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTrayTypeApiController.java @@ -759,6 +759,34 @@ public class WarehouseTrayTypeApiController { //-------------------------------托盘空置--------------- + @ResponseBody + @PostMapping("/trayToNullScanTrayCode") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "托盘空置扫描托盘", notes = "传入trayTypeDTO") + public R trayToNullScanTrayCode(@RequestBody TrayTypeDTO trayTypeDTO) { + String method = "###########trayToNullScanTrayCode: "; + log.info(method+"托盘空置扫描托盘 trayTypeDTO={}",trayTypeDTO); + String trayCode = trayTypeDTO.getTrayCode();//托盘码 + //通过托盘码查询,当前托盘是否有货物,如果有就按照原来的托盘打包方式展示,如果没有就展示订单的打托方式 + try{ + if(!StringUtil.hasLength(trayCode)){ + log.warn(method+"托盘码不能为空 trayCode={}",trayCode); + return R.fail(403,"托盘码不能为空"); + } + + //查询托盘是否被打托 + TrayTypeDataVO trayTypeDataVO = warehouseTrayTypeService.getEntityByTrayCode(trayCode); + return R.data(trayTypeDataVO); + }catch (CustomerException e){ + log.warn(e.message); + return R.fail(e.code,e.message); + }catch (Exception e){ + log.error(method+"系统异常,联系管理员",e); + return R.fail(500,"系统异常,联系管理员"); + } + + } + @ResponseBody @PostMapping("/trayToNull") @ApiOperationSupport(order = 1) diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml index 38343c776..2792b6bfa 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml @@ -21,9 +21,11 @@ select ldpl.order_code orderCode, lwtg.tray_code trayCode, 1 goodsType, - sum(lwtg.num) shelfNum + sum(lwtg.num) shelfNum, + max(ldsa.total_number) totalNum from logpm_warehouse_tray_goods lwtg left join logpm_distribution_parcel_list ldpl on ldpl.id = lwtg.association_id and ldpl.is_deleted = 0 + left join logpm_distribution_stock_article ldsa on ldpl.order_code = ldsa.order_code and ldsa.is_deleted = 0 where 1=1 and lwtg.is_deleted = 0 and lwtg.tray_type_id = #{trayTypeId} @@ -58,7 +60,8 @@ select ldsa.order_code orderCode, lwtg.tray_code trayCode, 2 goodsType, - lwtg.num num + lwtg.num shelfNum, + ldsa.total_number totalNum from logpm_warehouse_tray_goods lwtg left join logpm_distribution_stock_article ldsa on ldsa.id = lwtg.association_id and ldsa.is_zero = 1 and ldsa.is_deleted = 0 where lwtg.is_deleted = 0 @@ -109,7 +112,10 @@ lwtg.num shelfNum, 3 goodsType, ldsl.market_id marketId, - ldsl.market_name marketName + ldsl.market_name marketName, + lwtg.association_value materialCode, + ldsl.description_goods materialName, + lwtg.incoming_batch incomingBatch from logpm_warehouse_tray_goods lwtg left join logpm_distribution_stock_list ldsl on ldsl.material_id = lwtg.association_id and lwtg.market_id = ldsl.market_id and lwtg.incoming_batch = ldsl.incoming_batch and ldsl.is_deleted = 0 where lwtg.is_deleted = 0 diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.java index ff99c0cb5..f54da3a43 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.java @@ -80,6 +80,12 @@ public interface WarehouseUpdownGoodsMapper extends BaseMapper getUpdownGoodsByStock(@Param("marketId") Long marketId, @Param("materialCode") String materialCode, @Param("incomingBatch") String incomingBatch); + List findUpdownStockByMaterialName(@Param("materialName") String materialName, @Param("marketId") Long marketId); + + List getZeroOrderList(@Param("orderCode") String orderCode); + + List getZeroOrderListByWaybillNumber(@Param("waybillNumber") String waybillNumber); + // /** // * 根据货位查询货物 diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.xml b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.xml index 24c824c5b..3bf3518a3 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.xml +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.xml @@ -187,7 +187,7 @@ update logpm_warehouse_updown_goods set num = #{num} - where updown_type_id = #{updownTypeId} + where id = #{updownGoodsId} @@ -226,4 +226,28 @@ and lwug.incoming_batch = #{incomingBatch} + + + + + + diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownGoodsService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownGoodsService.java index 02c272336..e792c49e9 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownGoodsService.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownGoodsService.java @@ -115,4 +115,10 @@ public interface IWarehouseUpdownGoodsService extends BaseService getUpdownGoodsByZeroOrderId(Long orderId); List getUpdownGoodsByStock(Long marketId, String materialCode, String incomingBatch); + + List findUpdownStockByMaterialName(String materialName, Long marketId); + + List getZeroOrderList(String orderCode); + + List getZeroOrderListByWaybillNumber(String waybillNumber); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayGoodsServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayGoodsServiceImpl.java index fad84270d..86b97dcab 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayGoodsServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayGoodsServiceImpl.java @@ -172,7 +172,7 @@ public class WarehouseTrayGoodsServiceImpl extends BaseServiceImpl findUpdownStockByMaterialName(String materialName, Long marketId) { + return baseMapper.findUpdownStockByMaterialName(materialName,marketId); + } + + @Override + public List getZeroOrderList(String orderCode) { + return baseMapper.getZeroOrderList(orderCode); + } + + @Override + public List getZeroOrderListByWaybillNumber(String waybillNumber) { + return baseMapper.getZeroOrderListByWaybillNumber(waybillNumber); + } + } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java index 5ee88c809..c90f9c7d4 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java @@ -148,6 +148,10 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl listByTrayTypeId = null; if(PalletProductTypeConstant.CUSTOMIZED.equals(type)){ - upShelfAllocationVO.setTotalNum(trayTypeEntity.getTotalNum()); listByTrayTypeId = warehouseTrayGoodsService.getUpListByTrayTypeId(trayTypeId); }else if(PalletProductTypeConstant.ARTIFICIAL.equals(type)){ - upShelfAllocationVO.setTotalNum(trayTypeEntity.getTotalNum()); listByTrayTypeId = warehouseTrayGoodsService.getZeroUpListByTrayTypeId(trayTypeId); }else if(PalletProductTypeConstant.STOCKDATA.equals(type)){ - upShelfAllocationVO.setStockTotalNum(trayTypeEntity.getTotalNum()); listByTrayTypeId = warehouseTrayGoodsService.getStockUpListByTrayTypeId(trayTypeId); }else if(PalletProductTypeConstant.STOCKNODATA.equals(type)){ - upShelfAllocationVO.setStockTotalNum(trayTypeEntity.getTotalNum()); listByTrayTypeId = warehouseTrayGoodsService.getStockUpListByTrayTypeId(trayTypeId); } upShelfAllocationVO.setList(listByTrayTypeId); @@ -413,9 +422,12 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("tray_code",trayCode) + .eq("is_deleted",0); + WarehouseTrayTypeEntity trayTypeEntity = warehouseTrayTypeService.getOne(queryWrapper); + trayType = trayTypeEntity.getTrayType(); + String type = trayTypeEntity.getType();//数据类型 1订制品 2零担 3 4 库存品 if(!"1".equals(type)){ log.warn("##############upShelfOrder: 库位上的托盘是定制品类型 allocationId={}",allocationId); return R.fail(403,"库位上的托盘是定制品类型"); @@ -454,14 +466,31 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("association_value",orderPackageCode); + WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsService.getOne(queryWrapper); + if(!Objects.isNull(updownGoodsEntity)){ + log.warn("##############upShelfPackage: 包件已上架 orderPackageCode={}",orderPackageCode); + continue; + } + //判断包件是否有绑托盘, + QueryWrapper trayGoodsQueryWrapper = new QueryWrapper<>(); + trayGoodsQueryWrapper.eq("association_value",orderPackageCode); + WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsService.getOne(trayGoodsQueryWrapper); + if(!Objects.isNull(trayGoodsEntity)){ + //已打托的数据需要取消托盘绑定 + warehouseTrayTypeService.downPackageByOrderPackageCode(orderPackageCode,"扫描上架:包件下托"); + } + DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCode(orderPackageCode); - //包件级别的上架 - upShelfPackageNoTray(parcelListEntity,goodsAllocationEntity,goodsShelfEntity,goodsAreaEntity); if(StringUtil.hasLength(trayCode)){ //存入托盘信息 warehouseTrayTypeService.orderScanOrderPackageCode(trayType,trayCode,orderPackageCode); } + //包件级别的上架 + upShelfPackageNoTray(parcelListEntity,goodsAllocationEntity,goodsShelfEntity,goodsAreaEntity); num++; }catch (CustomerException e){ log.warn(e.message); @@ -760,21 +789,12 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("association_value",orderCode); - List list = warehouseUpdownGoodsService.list(queryWrapper); + List list = warehouseUpdownGoodsService.getZeroOrderList(orderCode); return R.data(list); }else if (2==zeroType){ //零担运单号 String waybillNumber = code; - List list = new ArrayList<>(); - List listByWaybillNumber = distributionStockArticleClient.findListByWaybillNumber(waybillNumber); - for (DistributionStockArticleEntity stockArticleEntity:listByWaybillNumber){ - String orderCode = stockArticleEntity.getOrderCode(); - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("association_value",orderCode); - list.addAll(warehouseUpdownGoodsService.list(queryWrapper)); - } + List list = warehouseUpdownGoodsService.getZeroOrderListByWaybillNumber(waybillNumber); return R.data(list); }else{ log.warn("#################getZeroOrderByCode: 未知的订单查询类型"); @@ -892,23 +912,14 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl list = warehouseUpdownGoodsService.list(queryWrapper); return R.data(list); }else if (2==stockType){ -// //2物料名称 -// String materialName = code; -// List list = new ArrayList<>(); -// List listByWaybillNumber = distributionStockArticleClient.findListByWaybillNumber(waybillNumber); -// for (DistributionStockArticleEntity stockArticleEntity:listByWaybillNumber){ -// String orderCode = stockArticleEntity.getOrderCode(); -// QueryWrapper queryWrapper = new QueryWrapper<>(); -// queryWrapper.eq("association_value",orderCode); -// list.addAll(warehouseUpdownGoodsService.list(queryWrapper)); -// } -// return R.data(list); + //2物料名称 + String materialName = code; + List list = warehouseUpdownGoodsService.findUpdownStockByMaterialName(materialName,marketId); + return R.data(list); }else{ log.warn("#################getZeroOrderByCode: 未知的订单查询类型"); return R.fail(403,"未知的订单查询类型"); } - - return null; } @Override @@ -919,10 +930,12 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.eq("association_value",materialCode) + .eq("incoming_batch",incomingBatch) .eq("allocation_id",allocationId); WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsService.getOne(queryWrapper); Integer num = updownGoodsEntity.getNum(); @@ -1245,34 +1258,56 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl upShelfStockList, WarehouseUpdownTypeEntity updownTypeEntity) { List updownGoodsList = new ArrayList<>(); + List updownGoodsLogList = new ArrayList<>(); for (UpShelfStockDTO upShelfStockDTO:upShelfStockList){ Long marketId = upShelfStockDTO.getMarketId(); + Long allocationId = updownTypeEntity.getAllocationId(); String materialCode = upShelfStockDTO.getMaterialCode(); Integer enterNum = upShelfStockDTO.getEnterNum(); String incomingBatch = upShelfStockDTO.getIncomingBatch(); - DistributionStockListEntity stockListEntity = distributionStockListClient.getEntityByMarketIdAndMaterialCodeAndIncomingBatch(marketId, materialCode,incomingBatch); - WarehouseUpdownGoodsEntity updownGoodsEntity = new WarehouseUpdownGoodsEntity(); - updownGoodsEntity.setUpdownTypeId(updownTypeEntity.getId()); - updownGoodsEntity.setAreaId(updownTypeEntity.getAreaId()); - updownGoodsEntity.setAreaTitle(updownTypeEntity.getAreaTitle()); - updownGoodsEntity.setShelfId(updownTypeEntity.getShelfId()); - updownGoodsEntity.setShelfTitle(updownTypeEntity.getShelfTitle()); - updownGoodsEntity.setAllocationId(updownTypeEntity.getAllocationId()); - updownGoodsEntity.setAllocationTitle(updownTypeEntity.getAllocationTitle()); - updownGoodsEntity.setPositionCode(updownTypeEntity.getPositionCode()); - updownGoodsEntity.setAssociationId(stockListEntity.getMaterialId()); - updownGoodsEntity.setAssociationValue(stockListEntity.getCargoNumber()); - updownGoodsEntity.setAssociationType("4"); - updownGoodsEntity.setGoodsName(stockListEntity.getDescriptionGoods()); - updownGoodsEntity.setNum(enterNum); - updownGoodsEntity.setMarketId(stockListEntity.getMarketId()); - updownGoodsEntity.setMarketName(stockListEntity.getMarketName()); - updownGoodsEntity.setIncomingBatch(stockListEntity.getIncomingBatch()); - updownGoodsList.add(updownGoodsEntity); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("allocation_id",allocationId) + .eq("market_id",marketId) + .eq("association_value",materialCode) + .eq("incoming_batch",incomingBatch); + WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsService.getOne(queryWrapper); + if(!Objects.isNull(updownGoodsEntity)){ + Integer num = updownGoodsEntity.getNum(); + updownGoodsEntity.setNum(num+enterNum); + updownGoodsList.add(updownGoodsEntity); + //存入日志对象 + WarehouseUpdownGoodsEntity oldUpdownGoodsEntity = new WarehouseUpdownGoodsEntity(); + BeanUtil.copy(updownGoodsEntity,oldUpdownGoodsEntity); + oldUpdownGoodsEntity.setNum(enterNum); + oldUpdownGoodsEntity.setId(null); + updownGoodsLogList.add(oldUpdownGoodsEntity); + }else{ + DistributionStockListEntity stockListEntity = distributionStockListClient.getEntityByMarketIdAndMaterialCodeAndIncomingBatch(marketId, materialCode,incomingBatch); + updownGoodsEntity = new WarehouseUpdownGoodsEntity(); + updownGoodsEntity.setUpdownTypeId(updownTypeEntity.getId()); + updownGoodsEntity.setAreaId(updownTypeEntity.getAreaId()); + updownGoodsEntity.setAreaTitle(updownTypeEntity.getAreaTitle()); + updownGoodsEntity.setShelfId(updownTypeEntity.getShelfId()); + updownGoodsEntity.setShelfTitle(updownTypeEntity.getShelfTitle()); + updownGoodsEntity.setAllocationId(updownTypeEntity.getAllocationId()); + updownGoodsEntity.setAllocationTitle(updownTypeEntity.getAllocationTitle()); + updownGoodsEntity.setPositionCode(updownTypeEntity.getPositionCode()); + updownGoodsEntity.setAssociationId(stockListEntity.getMaterialId()); + updownGoodsEntity.setAssociationValue(stockListEntity.getCargoNumber()); + updownGoodsEntity.setAssociationType("4"); + updownGoodsEntity.setGoodsName(stockListEntity.getDescriptionGoods()); + updownGoodsEntity.setNum(enterNum); + updownGoodsEntity.setMarketId(stockListEntity.getMarketId()); + updownGoodsEntity.setMarketName(stockListEntity.getMarketName()); + updownGoodsEntity.setIncomingBatch(stockListEntity.getIncomingBatch()); + updownGoodsList.add(updownGoodsEntity); + updownGoodsLogList.add(updownGoodsEntity); + } + } warehouseUpdownGoodsService.saveBatch(updownGoodsList); - saveUpdownGoodsLog(updownGoodsList,"1",0,"扫描上架:库存品上架"); + saveUpdownGoodsLog(updownGoodsLogList,"1",0,"扫描上架:库存品上架"); } private UpdownStockVO stockToUpdownStockVO(DistributionStockListEntity stockListEntity) { @@ -1324,30 +1359,47 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl upShelfZeroOrderList, WarehouseUpdownTypeEntity updownTypeEntity) { List updownGoodsList = new ArrayList<>(); + List updownGoodsLogList = new ArrayList<>(); for (UpShelfZeroOrderDTO upShelfZeroOrderDTO:upShelfZeroOrderList){ String orderCode = upShelfZeroOrderDTO.getOrderCode(); Integer enterNum = upShelfZeroOrderDTO.getEnterNum(); - DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCode(orderCode); - WarehouseUpdownGoodsEntity updownGoodsEntity = new WarehouseUpdownGoodsEntity(); - updownGoodsEntity.setUpdownTypeId(updownTypeEntity.getId()); - updownGoodsEntity.setAreaId(updownTypeEntity.getAreaId()); - updownGoodsEntity.setAreaTitle(updownTypeEntity.getAreaTitle()); - updownGoodsEntity.setShelfId(updownTypeEntity.getShelfId()); - updownGoodsEntity.setShelfTitle(updownTypeEntity.getShelfTitle()); - updownGoodsEntity.setAllocationId(updownTypeEntity.getAllocationId()); - updownGoodsEntity.setAllocationTitle(updownTypeEntity.getAllocationTitle()); - updownGoodsEntity.setPositionCode(updownTypeEntity.getPositionCode()); - updownGoodsEntity.setAssociationId(stockArticleEntity.getId()); - updownGoodsEntity.setAssociationValue(stockArticleEntity.getOrderCode()); - updownGoodsEntity.setAssociationType("1"); - updownGoodsEntity.setGoodsName(stockArticleEntity.getDescriptionGoods()); - updownGoodsEntity.setNum(enterNum); - updownGoodsList.add(updownGoodsEntity); + Long allocationId = updownTypeEntity.getAllocationId(); + //判断是否有这个订单在库位上 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("association_value",orderCode) + .eq("allocation_id",allocationId); + WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsService.getOne(queryWrapper); + if(!Objects.isNull(updownGoodsEntity)){ + Integer num = updownGoodsEntity.getNum(); + updownGoodsEntity.setNum(num+enterNum); + updownGoodsList.add(updownGoodsEntity);//存入绑定更新 + WarehouseUpdownGoodsEntity oldUpdownGoodsEntity = new WarehouseUpdownGoodsEntity(); + BeanUtil.copy(updownGoodsEntity,oldUpdownGoodsEntity); + oldUpdownGoodsEntity.setNum(enterNum); + oldUpdownGoodsEntity.setId(null); + updownGoodsLogList.add(oldUpdownGoodsEntity); + }else{ + DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCode(orderCode); + updownGoodsEntity = new WarehouseUpdownGoodsEntity(); + updownGoodsEntity.setUpdownTypeId(updownTypeEntity.getId()); + updownGoodsEntity.setAreaId(updownTypeEntity.getAreaId()); + updownGoodsEntity.setAreaTitle(updownTypeEntity.getAreaTitle()); + updownGoodsEntity.setShelfId(updownTypeEntity.getShelfId()); + updownGoodsEntity.setShelfTitle(updownTypeEntity.getShelfTitle()); + updownGoodsEntity.setAllocationId(allocationId); + updownGoodsEntity.setAllocationTitle(updownTypeEntity.getAllocationTitle()); + updownGoodsEntity.setPositionCode(updownTypeEntity.getPositionCode()); + updownGoodsEntity.setAssociationId(stockArticleEntity.getId()); + updownGoodsEntity.setAssociationValue(stockArticleEntity.getOrderCode()); + updownGoodsEntity.setAssociationType("1"); + updownGoodsEntity.setGoodsName(stockArticleEntity.getDescriptionGoods()); + updownGoodsEntity.setNum(enterNum); + updownGoodsList.add(updownGoodsEntity); + updownGoodsLogList.add(updownGoodsEntity); + } } - warehouseUpdownGoodsService.saveBatch(updownGoodsList); - - saveUpdownGoodsLog(updownGoodsList,"1",0,"扫描上架:零担上架"); - + warehouseUpdownGoodsService.saveOrUpdateBatch(updownGoodsList); + saveUpdownGoodsLog(updownGoodsLogList,"1",0,"扫描上架:零担上架"); } private R saveTrayGoodsToAllocation(WarehouseTrayTypeEntity trayTypeEntity, BasicdataGoodsAllocationEntity goodsAllocationEntity, BasicdataGoodsShelfEntity goodsShelfEntity, BasicdataGoodsAreaEntity goodsAreaEntity) { @@ -1417,6 +1469,7 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl