diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockEntity.java index 69a8fffe2..de240adbb 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockEntity.java @@ -117,6 +117,11 @@ public class DistributionStockEntity extends TenantEntity { @ApiModelProperty(value = "包件id") @TableField(exist = false) private String parcelsId; + /** + * 扫描操作人 + */ + @ApiModelProperty(value = "扫描操作人") + private String scanUser; /** * 单位 */ @@ -164,6 +169,9 @@ public class DistributionStockEntity extends TenantEntity { @ApiModelProperty(value = "备货区") private String stockupArea; + + @ApiModelProperty(value = "备货区") + private Long stockupAreaId; /** * 货位Id */ diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockClient.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockClient.java index 2a3a2819b..ce6e84d12 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockClient.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockClient.java @@ -47,4 +47,6 @@ public interface IDistributionStockClient { @GetMapping(TOP) BladePage top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); + @GetMapping(TOP+"/getCargoStockUpAllocationId") + String getCargoStockUpAllocationId(@RequestParam("code")String code,@RequestParam("warehouseId") Long warehouseId,@RequestParam("taskId") Long taskId); } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionBillOrderVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionBillOrderVO.java index 90e1ab273..99a8f68dd 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionBillOrderVO.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionBillOrderVO.java @@ -15,6 +15,10 @@ public class DistributionBillOrderVO { private String descriptionGoods; private String stockupStatus; private String stockupStatusName; + /** + * 扫描操作人 + */ + private String scanUser; /** * 应提货件数 */ diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseUpdownStockupAreaEntity.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseUpdownStockupAreaEntity.java index 30f1b9d98..520d7a4bb 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseUpdownStockupAreaEntity.java +++ b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseUpdownStockupAreaEntity.java @@ -67,6 +67,8 @@ public class WarehouseUpdownStockupAreaEntity extends TenantEntity { /** 货物名称 */ @ApiModelProperty(name = "货物名称",notes = "") private String goodsName ; + @ApiModelProperty(name = "货物名称",notes = "") + private String trayName ; /** 数量 */ @ApiModelProperty(name = "数量",notes = "") private Integer num ; diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseTrayGoodsClient.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseTrayGoodsClient.java index 262ae39c8..cc486e603 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseTrayGoodsClient.java +++ b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseTrayGoodsClient.java @@ -17,6 +17,7 @@ package com.logpm.warehouse.feign; +import com.alibaba.fastjson.JSONObject; import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity; import org.springblade.common.constant.ModuleNameConstant; import org.springframework.cloud.openfeign.FeignClient; @@ -103,6 +104,9 @@ public interface IWarehouseTrayGoodsClient { @GetMapping(API_PREFIX+"/delTrayGoodsById") void delTrayGoodsById(@RequestParam Long trayGoodsId, @RequestParam Long warehouseId); + @PostMapping(API_PREFIX+"/downZeroTrayById") + void downZeroTrayById( @RequestBody List list); + /** * 查询一批包件所在托盘 * @param map diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseUpdownStockUpAreaClient.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseUpdownStockUpAreaClient.java index 227be1536..3e37ffcaf 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseUpdownStockUpAreaClient.java +++ b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseUpdownStockUpAreaClient.java @@ -17,6 +17,7 @@ package com.logpm.warehouse.feign; +import com.alibaba.fastjson.JSONObject; import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity; import com.logpm.warehouse.entity.WarehouseUpdownGoodsLogEntity; import org.springblade.common.constant.ModuleNameConstant; @@ -44,18 +45,11 @@ public interface IWarehouseUpdownStockUpAreaClient { String TOP = API_PREFIX + "/top"; - @GetMapping(TOP+"/upStockUpShelf") - Boolean upStockUpShelf(@RequestParam String code,@RequestParam Long stockUpAllocationId,@RequestParam Long warehouseId,@RequestParam Integer type,@RequestParam Integer num); + @PostMapping(TOP+"/upStockUpShelf") + Boolean upStockUpShelf(@RequestBody JSONObject jsonObject); - /** - * 备货库位下架接口 - * @param code - * @param warehouseId - * @param type - * @param num - * @return - */ - @GetMapping(TOP+"/downStockUpShelf") - Boolean downStockUpShelf(@RequestParam String code,@RequestParam Long warehouseId,@RequestParam Integer type,@RequestParam Integer num); + + @PostMapping(TOP+"/downStockUpShelf") + void downStockUpShelf(@RequestBody List jsonObjects); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java index 4595e72b0..ffdea0c7d 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java @@ -48,6 +48,7 @@ import org.springblade.common.constant.DictBizConstant; import org.springblade.common.constant.RabbitConstant; import org.springblade.common.constant.common.IsOrNoConstant; import org.springblade.common.constant.orderpackage.OrderPackageFreezeStatusConstant; +import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant; import org.springblade.common.constant.pda.PdaAudioLingoStatus; import org.springblade.common.constant.reservation.ReservationLoadingStatusConstant; import org.springblade.common.constant.reservation.ReservationOrderStatusConstant; @@ -1378,6 +1379,7 @@ public class DistributionStockupAppController extends BladeController { entity.setStockupArea(byId1.getStockupArea()); entity.setStockupId(stockupId); entity.setStockQuantity(1); + entity.setScanUser(AuthUtil.getUser().getNickName()); if ("3".equals(stockupEntity.getTypeService())) { entity.setBillLadingId(reservationId); } else { @@ -1434,6 +1436,8 @@ public class DistributionStockupAppController extends BladeController { entity.setType(2); entity.setAllocationId(stockupDTO.getAllocationId()); entity.setOutboundType(stockupEntity.getTypeService()); + entity.setStockupAreaId(stockupDTO.getStockupAllocationId()); + entity.setStockupArea(stockupDTO.getStockupAllocationName()); distributionStockService.save(entity); // //修改备货时间 distributionAsyncService.updateStockupStockListDate(stockupDTO); @@ -1457,10 +1461,13 @@ public class DistributionStockupAppController extends BladeController { String audioValue = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.saomiaochenggong.getValue()); //进行备货库位上架 - if (Func.isNotEmpty(stockupDTO.getStockUpAllocationId())){ - - warehouseUpdownStockUpAreaClient.upStockUpShelf(packetBarCode,stockupDTO.getStockUpAllocationId(),myCurrentWarehouse.getId(),2,1); - } + JSONObject jsonObject = new JSONObject(); + jsonObject.put("warehouseId", myCurrentWarehouse.getId()); + jsonObject.put("code",packetBarCode); + jsonObject.put("stockUpAllocationId", stockupDTO.getStockupAllocationId()); + jsonObject.put("type", 2); + jsonObject.put("num", 1); + warehouseUpdownStockUpAreaClient.upStockUpShelf(jsonObject); //扫码成功 return Resp.scanSuccess(PdaAudioLingoStatus.saomiaochenggong.getName(), audioValue); case 2: @@ -1526,6 +1533,7 @@ public class DistributionStockupAppController extends BladeController { String packetBarCode = stockupDTO.getPacketBarCode();//包件码 Long stockupId = stockupDTO.getStockupId();//备货任务ID Long reservationId = stockupDTO.getReservationId();//预约单id + Long stockUpAllocationId = stockupDTO.getStockupAllocationId();//备货库位ID if (Objects.isNull(myCurrentWarehouse)) { log.warn("##################stockupScan: 未选择仓库,订单自编号为空"); return R.fail(403,"未授权!!"); @@ -1546,6 +1554,10 @@ public class DistributionStockupAppController extends BladeController { log.warn("##################stockupScan: 包件扫码,预约单id为空"); return R.fail("包件扫码:预约单id不能为空"); } + if (Objects.isNull(stockUpAllocationId)) { + log.warn("##################stockupScan: 备货库位不存在,stockUpAllocationId:{}",stockUpAllocationId); + return Resp.scanFail("请扫描备货库位","请扫描备货库位"); + } Integer integer = distributionStockupService.selectPackage(stockupDTO); switch (integer) { @@ -1561,7 +1573,9 @@ public class DistributionStockupAppController extends BladeController { entity.setOrderSelfNumbering(one.getOrderCode()); entity.setStockArticle(one.getStockArticleId()); entity.setCoding(packetBarCode); + entity.setScanUser(AuthUtil.getUser().getNickName()); // entity.setStockupArea(stockupArea); + entity.setStockupId(stockupId); entity.setStockupId(stockupId); entity.setParcelListId(one.getId()); entity.setStockQuantity(1); @@ -1598,6 +1612,8 @@ public class DistributionStockupAppController extends BladeController { entity.setConditions("0"); entity.setType(2); entity.setOutboundType(distributionStockupEntity.getTypeService()); + entity.setStockupArea(stockupDTO.getStockupAllocationName()); + entity.setStockupAreaId(stockupDTO.getStockupAllocationId()); distributionStockService.save(entity); //修改订单备货状态 distributionAsyncService.updateStockArticleStock(one.getStockArticleId()); @@ -1612,16 +1628,9 @@ public class DistributionStockupAppController extends BladeController { map.put("logId", entity.getId()); map.put("messageData", entity); map.put("createTime", System.currentTimeMillis()); - -// BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); -// log.info(">>>> find bug myCurrentWarehouse {}",myCurrentWarehouse); -// if (Objects.isNull(myCurrentWarehouse)) { -// throw new CustomerException(403, "仓库信息不能为空"); -// } //将消息携带绑定键值 rabbitTemplate.convertAndSend(RabbitConstant.STOCKUP_SCAN_EXCHANGE, RabbitConstant.STOCKUP_SCAN_ROUTING, map); - //查询是否货位数据是否该下架 Map mapState = new HashMap<>(); mapState.put("messageId", CommonUtil.getUUID()); @@ -1633,9 +1642,6 @@ public class DistributionStockupAppController extends BladeController { mapState.put("messageData", entity); mapState.put("warehouseId",myCurrentWarehouse.getId()); mapState.put("createTime", System.currentTimeMillis()); - - - String audioValue = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.saomiaochenggong.getValue()); log.info(">>>>>>>>>>>>>>>>>>>> 对扫码的包件进行下架"); @@ -1647,10 +1653,19 @@ public class DistributionStockupAppController extends BladeController { }); //查询是否货位数据是否该下架 - if (Func.isNotEmpty(stockupDTO.getStockUpAllocationId())){ + JSONObject jsonObject = new JSONObject(); + jsonObject.put("warehouseId", myCurrentWarehouse.getId()); + jsonObject.put("code",packetBarCode); + jsonObject.put("stockUpAllocationId", stockupDTO.getStockupAllocationId()); + jsonObject.put("type", 1); + jsonObject.put("num", 1); //进行了备货库位的选择才进行备货库位的上架 - warehouseUpdownStockUpAreaClient.upStockUpShelf(packetBarCode, stockupDTO.getStockUpAllocationId(),myCurrentWarehouse.getId(),1,1); - } + warehouseUpdownStockUpAreaClient.upStockUpShelf(jsonObject); + //修改包件备货状态 + DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); + parcelListEntity.setId(entity.getParcelListId()); + parcelListEntity.setOrderPackageStockupStatus(OrderPackageStockupStatusConstant.yibeihu.getValue()); + distributionParcelListService.updateById(parcelListEntity); return Resp.scanSuccess(PdaAudioLingoStatus.saomiaochenggong.getName(), audioValue); case 2: //重复扫描 diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/StockupDTO.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/StockupDTO.java index 9fd4edfb1..4c9d87751 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/StockupDTO.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/StockupDTO.java @@ -13,7 +13,8 @@ public class StockupDTO implements Serializable { private String stockupDateEnd;//备货日期 private Integer status;//0未完成 1已完成 - private Long stockUpAllocationId;//0未完成 1已完成 + private Long stockupAllocationId;//0未完成 1已完成 + private String stockupAllocationName;//0未完成 1已完成 /** * 客户名城 diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/StockupZeroDTO.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/StockupZeroDTO.java index 5c9888a36..cc4dbfc37 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/StockupZeroDTO.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/StockupZeroDTO.java @@ -21,5 +21,8 @@ public class StockupZeroDTO implements Serializable { private String[] stockArticleIdList;//订单id private String typeService;//备货类型 3 自提 private Long reservationId;//预约单id + private Integer num;//预约单id + private Long stockupAllocationId;//备货库位Id + private String stockupAllocationName;//备货库位Id } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockClient.java index 97a280727..79dca4fc5 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockClient.java @@ -17,6 +17,7 @@ package com.logpm.distribution.feign; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.distribution.entity.DistributionStockEntity; import com.logpm.distribution.service.IDistributionStockService; import lombok.AllArgsConstructor; @@ -27,6 +28,9 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; +import java.util.List; +import java.util.stream.Collectors; + /** * 库存品详情信息 Feign实现类 * @@ -50,4 +54,24 @@ public class DistributionStockClient implements IDistributionStockClient { return BladePage.of(page); } + /** + * @param code + * @param warehouseId + * @param taskId + * @return + */ + @Override + public String getCargoStockUpAllocationId(String code, Long warehouseId, Long taskId) { + List stockEntityList = distributionStockService.list(Wrappers.query().lambda() + .eq(DistributionStockEntity::getReservationId, taskId) + .eq(DistributionStockEntity::getCoding, code) + ); + + if (!stockEntityList.isEmpty()){ + return stockEntityList.stream().map(DistributionStockEntity::getStockupAreaId).map(String::valueOf).collect(Collectors.joining(",")); + } + + return null; + } + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml index de38fcea5..d7c99fac7 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml @@ -213,7 +213,9 @@ LEFT JOIN logpm_distribution_reservation ldr on ldr.id = lds.reservation_id LEFT JOIN (SELECT lddl.id,ldsa.order_code FROM logpm_distribution_delivery_list lddl LEFT JOIN logpm_distribution_signfor lds ON lddl.id = lds.delivery_id LEFT JOIN logpm_distribution_reservation_stockarticle AS ldrs ON lds.reservation_id = ldrs.reservation_id AND ldrs.stock_article_status != 2 LEFT JOIN logpm_distribution_stock_article AS ldsa ON ldrs.stock_article_id = ldsa.id ) AS y ON y.id = lddl.id - lddl.is_deleted = 0 AND (IF(lddl.delivery_number is null ,0,lddl.delivery_number) + IF(lddl.inventory_nub is null ,0,lddl.inventory_nub)) > 0 AND (lddl.customers_number > 0 AND ldr.reservation_num + ldr.reservation_stock_list_num) >0 + lddl.is_deleted = 0 + AND (IF(lddl.delivery_number is null ,0,lddl.delivery_number) + IF(lddl.inventory_nub is null ,0,lddl.inventory_nub)) > 0 + AND (lddl.customers_number > 0 AND ldr.reservation_num + ldr.reservation_stock_list_num) >0 and lddl.train_number like concat('%',#{param.trainNumber},'%') diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.xml index 5f07aebb5..30360e66b 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.xml @@ -141,11 +141,15 @@ LEFT JOIN logpm_warehouse_updown_goods lwug on lwug.association_id = ldpl.id and lwug.association_type = '3' LEFT JOIN logpm_warehouse_goods_allocation AS lwga ON lwug.allocation_id = lwga.id where ldpl.stock_article_id = ldbs.stock_article_id) goodsAllocation, - ldsa.service_number serviceNumber,ldsa.waybill_number waybillNumber,ldsa.train_number trainNumber,ldsa.send_warehouse_name sendWarehouseName + ldsa.service_number serviceNumber,ldsa.waybill_number waybillNumber,ldsa.train_number trainNumber,ldsa.send_warehouse_name sendWarehouseName, + t.scan_user AS scanUser from logpm_distrilbution_bill_stock ldbs LEFT JOIN logpm_distribution_stock_article ldsa on ldbs.stock_article_id = ldsa.id LEFT JOIN logpm_distribution_stock lds on lds.stock_article = ldbs.stock_article_id LEFT JOIN logpm_distrilbution_bill_lading ldbl ON lds.stock_article = ldbl.stock_article_id + LEFT JOIN (SELECT ldbs.stock_article_id,GROUP_CONCAT(ldbls.scan_user) AS scan_user FROM logpm_distrilbution_bill_stock AS ldbs LEFT JOIN logpm_distribution_bill_lading_scan AS ldbls ON ldbs.stock_article_id = ldbls.stock_article_id WHERE ldbs.order_status IN ( + 1, + 3) AND ldbs.is_deleted = 0 AND ldbls.is_deleted = 0 GROUP BY ldbs.stock_article_id) AS t ON ldbs.stock_article_id = t.stock_article_id ldbs.is_deleted = 0 and ldbs.bill_lading_id = #{param.billLadingId} and ldbs.order_status in (1,3) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java index 98a043254..9341d1001 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java @@ -49,10 +49,7 @@ import com.logpm.distribution.vo.print.PrintPreviewVO; import com.logpm.distribution.wrapper.*; import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity; import com.logpm.warehouse.entity.WarehouseWaybillEntity; -import com.logpm.warehouse.feign.IWarehouseTrayGoodsClient; -import com.logpm.warehouse.feign.IWarehouseTrayTypeClient; -import com.logpm.warehouse.feign.IWarehouseUpdownTypeClient; -import com.logpm.warehouse.feign.IWarehouseWaybillClient; +import com.logpm.warehouse.feign.*; import com.logpm.warehouse.vo.TrayTypeDataVO; import lombok.extern.log4j.Log4j2; import org.apache.commons.lang.StringUtils; @@ -230,6 +227,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl packageLockIds = new ArrayList<>(); + List jsonObjects = new ArrayList<>(); + DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfEntity(); if ("1".equals(distributionDeliveryListEntity.getKind())) { if (!Objects.isNull(distrilbutionloadingscanDTO.getLoadingId())) { @@ -701,8 +703,14 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl>>>>>>>>>>>> 进入延迟队列处理包件相关信息状态"); rabbitTemplate.convertAndSend(RabbitConstant.ORDER_PACKAGE_STATUS_INFO_EXCHANGE, RabbitConstant.ORDER_PACKAGE_STATUS_INFO_ROUTING, map, message -> { message.getMessageProperties() @@ -791,6 +799,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl>>>>>>>>>>>>>>>>>>>>>jsonObjects:{}",jsonObjects); + warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects); //查询已装车件数 // String str = getLoadingMsg(distrilbutionloadingscanDTO); @@ -2051,18 +2071,18 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImplquery().lambda().eq(DistributionStockListEntity::getId, distributionLoadscaninvnEntity.getInventoryId())); -// BigDecimal quantityStock = new BigDecimal(distributionStockListEntity.getQuantityStock()); -// BigDecimal loadedNub = new BigDecimal(distributionLoadscaninvnEntity.getLoadedNub()); -// int stockListQuantityStock = quantityStock.subtract(loadedNub).intValue(); -// int stockListOutboundQuantity = quantityStock.add(loadedNub).intValue(); -// distributionStockListEntity.setQuantityStock(stockListQuantityStock); -// distributionStockListEntity.setQuantityOccupied(stockListOutboundQuantity); -// distributionStockListEntity.setOutboundQuantity(stockListOutboundQuantity); -// distributionStockListMapper.updateById(distributionStockListEntity); + + //备货库位下架 + List jsonObjects = new ArrayList<>(); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("code",distributionLoadscaninvnEntity.getOrderPackageCode()); + jsonObject.put("warehouseId",myCurrentWarehouse.getId()); + jsonObject.put("taskId",distributionLoadscaninvnEntity.getReservationId()); + jsonObject.put("type",2); + jsonObject.put("num",1); + jsonObject.put("remark","装车下架"); + jsonObjects.add(jsonObject); + warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects); } else { return Resp.scanFail("窜货", "窜货"); } @@ -5522,6 +5542,16 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl jsonObjects = new ArrayList<>(); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("code",loadscanEntity.getOrderPackageCode()); + jsonObject.put("warehouseId",myCurrentWarehouse.getId()); + jsonObject.put("taskId",loadscanEntity.getReservationId()); + jsonObject.put("type",1); + jsonObject.put("num",1); + jsonObject.put("remark","异常装车下架"); + jsonObjects.add(jsonObject); + warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects); //修改包件装车状态 //修改包件状态 维护订单状态 parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue()); @@ -5668,6 +5698,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl packageLockIds = new ArrayList<>(); + List jsonObjects = new ArrayList<>(); if (Func.isNotEmpty(distrilbutionloadingscanDTO.getReservationId())) { //查询该订单是否属于当前配送任务 List reservationStockarticleEntityList = distributionReservationMapper.selectStockArticleByReservationId(distrilbutionloadingscanDTO.getReservationId()); @@ -5698,6 +5729,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl 0) { diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java index 958a5bddf..d6281b97f 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java @@ -17,6 +17,7 @@ package com.logpm.distribution.service.impl; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; @@ -46,6 +47,7 @@ import com.logpm.distribution.wrapper.DistributionDisStockListWrapper; import com.logpm.distribution.wrapper.DistributionParcelListAppWrapper; import com.logpm.distribution.wrapper.DistributionParcelListWrapper; import com.logpm.distribution.wrapper.DistributionStockArticleWrapper; +import com.logpm.warehouse.feign.IWarehouseUpdownStockUpAreaClient; import com.logpm.warehouse.feign.IWarehouseUpdownTypeClient; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; @@ -214,6 +216,10 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl selectDistributionSignforPage(IPage page, DistributionSignforVO distributionSignfor) { //转换创建时间 @@ -669,6 +675,11 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl detailEntities = distributionReservationMapper.selectInventoryListByReservation(distrilbutionloadingscanDTO.getReservationId()); - + List jsonObjects = new ArrayList<>(); if (Func.isNotEmpty(split)) { for (String s : split) { List inventoryPackage = detailEntities.stream().filter(f -> Func.isNotEmpty(f.getStockPackageCode()) && f.getStockPackageCode().equals(s)).collect(Collectors.toList()); @@ -774,6 +785,14 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl jsonObjects = new ArrayList<>(); BladeUser user = AuthUtil.getUser(); //查询零担计划 DistributionReservationZeroPackageEntity reservationZeroPackageEntities = distributionReservationZeroPackageService.getOne(Wrappers.query().lambda() @@ -1242,6 +1270,14 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl jsonObjects = new ArrayList<>(); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("code",updatePackage.getOrderPackageCode()); + jsonObject.put("warehouseId",myCurrentWarehouse.getId()); + jsonObject.put("taskId",distributionReservationEntity.getId()); + jsonObject.put("type",1); + jsonObject.put("num",1); + jsonObject.put("remark","签收下架"); + jsonObjects.add(jsonObject); + warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects); } else if (Func.isEmpty(collect)) { //这里就需要对该包件信息是否属于该配送计划进行判定。如果属于该配送计划则是串货。不是那么则需要提示是否异常签收或者返回的操作 @@ -2459,6 +2514,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl orderpackages = new ArrayList<>(); List packageLockIds = new ArrayList<>(); + List jsonObjects = new ArrayList<>(); for (String orderPackageCode : orderPackageCodes) { List collect = parcelListEntityList.stream().filter(p -> p.getOrderPackageCode().equals(orderPackageCode)).collect(Collectors.toList()); if (Func.isNotEmpty(collect) && collect.size() == 1) { @@ -2552,7 +2608,14 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl jsonObjects = new ArrayList<>(); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("code",loadscanEntity.getOrderPackageCode()); + jsonObject.put("warehouseId",myCurrentWarehouse.getId()); + jsonObject.put("taskId",loadscanEntity.getReservationId()); + jsonObject.put("type",1); + jsonObject.put("num",1); + jsonObject.put("remark","异常签收下架"); + jsonObjects.add(jsonObject); + warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects); // Integer j = distributionSignforMapper.updateSignforNum(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub()); if (Func.isEmpty(loadscanEntity)) { //更新装车包件数和签收包件数 @@ -3385,12 +3457,16 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl jsonObjects = new ArrayList<>(); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("code",distributionLoadscaninvnEntity.getOrderPackageCode()); + jsonObject.put("warehouseId",myCurrentWarehouse.getId()); + jsonObject.put("taskId",distributionLoadscaninvnEntity.getReservationId()); + jsonObject.put("type",2); + jsonObject.put("num",1); + jsonObject.put("remark","签收下架"); + jsonObjects.add(jsonObject); + warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects); } //进行库存品包件状态维护 DisStockListDetailEntity disStockListDetailEntity = new DisStockListDetailEntity(); @@ -4420,6 +4496,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl jsonObjects = new ArrayList<>(); // ------------------------------------2023-09-08 一键签收调整------------------------------------------ //1、查询本次一键签收操作是否有效 ---- > 这里一件签收针对的就是制定的任务下的包件和库存品 @@ -4571,11 +4648,20 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl jsonObjects = new ArrayList<>(); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("code",parcelListEntity.getOrderCode()); + jsonObject.put("warehouseId",myCurrentWarehouse.getId()); + jsonObject.put("taskId",loadscanEntity.getReservationId()); + jsonObject.put("type",3); + jsonObject.put("num",1); + jsonObject.put("remark","签收下架"); + jsonObjects.add(jsonObject); + warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects); } //维护订单 if (outboundQuantity.equals(distributionParcelNumberEntity.getQuantity())) { diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockServiceImpl.java index 026f92a9c..b6643d762 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockServiceImpl.java @@ -33,6 +33,7 @@ import com.logpm.distribution.vo.DistributionStockAllocationVO; import com.logpm.distribution.vo.DistributionStockVO; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; +import org.apache.logging.log4j.util.Strings; import org.springblade.common.constant.order.OrderStockupStatusConstant; import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant; import org.springblade.common.constant.stockup.StockupStatusConstant; @@ -67,7 +68,7 @@ public class DistributionStockServiceImpl extends BaseServiceImplquery().lambda() .eq(DistributionStockupEntity::getId, distributionStockEntity.getStockupId()) ); - if("3".equals(distributionStockupEntity.getTypeService())){ + if ("3".equals(distributionStockupEntity.getTypeService())) { //自提 // DistrilbutionBillLadingEntity byId = distrilbutionBillLadingService.getById(reservationId); // distributionStockEntity. - }else{ + } else { DistributionReservationEntity reservationEntity = distributionReservationService.getById(reservationId); distributionStockEntity.setReservationCode(reservationEntity.getReservationCode()); } - log.info("#############repairPackageScanInfo: 补全包件扫码信息开始 coding={}",coding); + log.info("#############repairPackageScanInfo: 补全包件扫码信息开始 coding={}", coding); //查询包件信息 QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("order_package_code",coding); + queryWrapper.eq("order_package_code", coding); DistributionParcelListEntity parcelListEntity = distributionParcelListService.getOne(queryWrapper);//包件信息 - if(!Objects.isNull(parcelListEntity)){ + if (!Objects.isNull(parcelListEntity)) { DistributionStockArticleEntity byId = distributionStockArticleService.getById(parcelListEntity.getStockArticleId()); String cargoTitle = parcelListEntity.getCargoTitle();//货区 String shelfTitle = parcelListEntity.getShelfTitle();//货位 String goodsAllocation = parcelListEntity.getGoodsAllocation();//货架 - distributionStockEntity.setGoodsAllocation(cargoTitle+"-"+shelfTitle+"-"+goodsAllocation); + if (!Strings.isBlank(cargoTitle) && !Strings.isBlank(shelfTitle) && !Strings.isBlank(goodsAllocation)) { + distributionStockEntity.setGoodsAllocation(cargoTitle + "-" + shelfTitle + "-" + goodsAllocation); + } distributionStockEntity.setStockArticle(parcelListEntity.getStockArticleId()); distributionStockEntity.setGoodsName(parcelListEntity.getFirsts()); distributionStockEntity.setParcelListId(parcelListEntity.getId()); distributionStockEntity.setStockupArea(distributionStockupEntity.getStockupArea()); distributionStockEntity.setMaterialId(parcelListEntity.getMaterialId()); - if(ObjectUtils.isNotNull(byId.getMallId())){ + if (ObjectUtils.isNotNull(byId.getMallId())) { Long mallId = byId.getMallId(); distributionStockEntity.setMarketId(Optional.ofNullable(mallId).orElse(null)); } } distributionStockEntity.setConditions("1"); baseMapper.updateById(distributionStockEntity); - log.info("#############repairPackageScanInfo: 补全包件扫码信息完成 coding={}",coding); + log.info("#############repairPackageScanInfo: 补全包件扫码信息完成 coding={}", coding); } /** * MQ备货库存品扫描 + * * @param distributionStockEntity */ @Override @@ -154,21 +159,21 @@ public class DistributionStockServiceImpl extends BaseServiceImplquery().lambda() .eq(DistributionStockupEntity::getId, distributionStockEntity.getStockupId()) ); - if("3".equals(distributionStockupEntity.getTypeService())){ + if ("3".equals(distributionStockupEntity.getTypeService())) { //自提 // DistrilbutionBillLadingEntity byId = distrilbutionBillLadingService.getById(reservationId); // distributionStockEntity. - }else{ + } else { DistributionReservationEntity reservationEntity = distributionReservationService.getById(reservationId); distributionStockEntity.setReservationCode(reservationEntity.getReservationCode()); } - log.info("#############repairPackageScanInfo: 补全库存品扫码信息完成 stockListId={}",stockListId); + log.info("#############repairPackageScanInfo: 补全库存品扫码信息完成 stockListId={}", stockListId); //查询包件信息 QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("id",stockListId); + queryWrapper.eq("id", stockListId); DistributionStockListEntity stockListEntity = distributionStockListService.getOne(queryWrapper);//包件信息 DistributionReservationEntity reservationEntity = distributionReservationService.getById(reservationId); - if(!Objects.isNull(stockListEntity)){ + if (!Objects.isNull(stockListEntity)) { distributionStockEntity.setGoodsAllocation(stockListEntity.getStorageLocation()); distributionStockEntity.setGoodsName(stockListEntity.getDescriptionGoods()); distributionStockEntity.setUnpackingQuantity(stockListEntity.getUnpackingQuantity()); @@ -184,13 +189,10 @@ public class DistributionStockServiceImpl extends BaseServiceImpl stockVOList = baseMapper.selectReservationDelivery(String.valueOf(distributionStocks.getStockupId())); if (stockVOList.isEmpty()) { continue; } - if(ObjectUtils.isNotNull(distributionStocks.getStockupType()) && "ZT".equals(distributionStocks.getStockupType())){ + if (ObjectUtils.isNotNull(distributionStocks.getStockupType()) && "ZT".equals(distributionStocks.getStockupType())) { List list1 = distrilbutionBillPackageService.list(Wrappers.query().lambda() .eq(DistrilbutionBillPackageEntity::getParceListId, i) .apply("packet_bar_status in (1,3)") .orderByDesc(DistrilbutionBillPackageEntity::getCreateTime) ); stockEntity.setBillLadingId(list1.get(0).getBillLadingId()); - }else{ + } else { List list1 = distributionReservationPackageService.list(Wrappers.query().lambda() .eq(DistributionReservationPackageEntity::getParceListId, i) .apply("packet_bar_status in (1,3)") @@ -257,31 +259,31 @@ public class DistributionStockServiceImpl extends BaseServiceImplquery().lambda().eq()); //添加备货数据 - if(ObjectUtils.isNotNull(distributionStocks.getStockupType()) && "ZT".equals(distributionStocks.getStockupType())){ + if (ObjectUtils.isNotNull(distributionStocks.getStockupType()) && "ZT".equals(distributionStocks.getStockupType())) { //自提 - DistrilbutionBillLadingEntity billLadingEntity = distrilbutionBillLadingMapper.selectById(stockEntity.getBillLadingId()); - if(ObjectUtils.isNotNull(billLadingEntity)){ - DistrilbutionBillLadingEntity billLading = new DistrilbutionBillLadingEntity(); - billLading.setId(billLadingEntity.getId()); - billLading.setStockOrderQuantity(billLadingEntity.getStockOrderQuantity()+1); - distrilbutionBillLadingMapper.updateById(billLading); - } - }else{ + DistrilbutionBillLadingEntity billLadingEntity = distrilbutionBillLadingMapper.selectById(stockEntity.getBillLadingId()); + if (ObjectUtils.isNotNull(billLadingEntity)) { + DistrilbutionBillLadingEntity billLading = new DistrilbutionBillLadingEntity(); + billLading.setId(billLadingEntity.getId()); + billLading.setStockOrderQuantity(billLadingEntity.getStockOrderQuantity() + 1); + distrilbutionBillLadingMapper.updateById(billLading); + } + } else { //商 市 DistributionReservationEntity byId2 = distributionReservationService.getById(stockEntity.getReservationId()); - if(ObjectUtils.isNotNull(byId2)){ + if (ObjectUtils.isNotNull(byId2)) { DistributionReservationEntity reservationEntity = new DistributionReservationEntity(); reservationEntity.setId(byId2.getId()); - int yu =byId2.getReservationNum() + byId2.getReservationStockListNum(); - int bei = byId2.getStockOrderQuantity()+1 + byId2.getReserveQuantity(); - if(bei >= yu){ - reservationEntity.setStockOrderQuantity(byId2.getStockOrderQuantity()+1); + int yu = byId2.getReservationNum() + byId2.getReservationStockListNum(); + int bei = byId2.getStockOrderQuantity() + 1 + byId2.getReserveQuantity(); + if (bei >= yu) { + reservationEntity.setStockOrderQuantity(byId2.getStockOrderQuantity() + 1); reservationEntity.setStockStatus("3"); reservationEntity.setEndTimeStocking(new Date()); - }else{ - reservationEntity.setStockOrderQuantity(byId2.getStockOrderQuantity()+1); + } else { + reservationEntity.setStockOrderQuantity(byId2.getStockOrderQuantity() + 1); reservationEntity.setStockStatus("2"); - if(ObjectUtils.isNull(reservationEntity.getStartTimeStocking())){ + if (ObjectUtils.isNull(reservationEntity.getStartTimeStocking())) { reservationEntity.setStartTimeStocking(new Date()); } } @@ -289,35 +291,35 @@ public class DistributionStockServiceImpl extends BaseServiceImpl stockVOptional = Optional.ofNullable(distributionStockVO); - if(stockVOptional.isPresent()){ + if (stockVOptional.isPresent()) { //已经备货完成 - if(distributionStockVO.getScanned() == 0){ + if (distributionStockVO.getScanned() == 0) { //修改 DistributionStockArticleEntity distributionStockArticle = new DistributionStockArticleEntity(); distributionStockArticle.setId(distributionStockVO.getStockArticleId()); @@ -325,74 +327,74 @@ public class DistributionStockServiceImpl extends BaseServiceImpl= ii){ + if (i >= ii) { //查询备货状态 - getUpdateStockup(pageId,2); + getUpdateStockup(pageId, 2); } - }else{ + } else { //查询备货状态 - getUpdateStockup(pageId,2); + getUpdateStockup(pageId, 2); } } } - break; + break; case 3://自提 DistributionStockupInfoEntity one = distributionStockupInfoService.getOne(Wrappers.query().lambda() - .eq(DistributionStockupInfoEntity::getStockupId, pageId) + .eq(DistributionStockupInfoEntity::getStockupId, pageId) ); DistributionStockVO distributionStockSelf = baseMapper.selectStockupInfoSelf(pageId); //查询库存品 DistributionDeliveryDetailsVO distributionSelf = distributionDeliveryDetailsService.selectCount(pageId); - int ys = 0; //已扫 - int qb = 0; //全部 - if(ObjectUtils.isNotNull(distributionSelf)){ - Integer wholeNum = 0 ; - if(ObjectUtils.isNull(distributionSelf.getWholeNum())){ + int ys = 0; //已扫 + int qb = 0; //全部 + if (ObjectUtils.isNotNull(distributionSelf)) { + Integer wholeNum = 0; + if (ObjectUtils.isNull(distributionSelf.getWholeNum())) { qb += 0; - }else{ + } else { qb += distributionSelf.getWholeNum(); } //有库存品 ys += distributionSelf.getEsauNum(); } - if(ObjectUtils.isNotNull(distributionStockSelf)){ + if (ObjectUtils.isNotNull(distributionStockSelf)) { //有订单 ys += distributionStockSelf.getScanned(); qb += distributionStockSelf.getWhole(); } - if(ys + num >= qb){ + if (ys + num >= qb) { //修改备货任务 - getUpdateStockup(pageId,2); + getUpdateStockup(pageId, 2); DistrilbutionBillLadingEntity billLadingEntity = distrilbutionBillLadingMapper.selectById(one.getReservationId()); DistrilbutionBillLadingEntity billLading = new DistrilbutionBillLadingEntity(); billLading.setId(billLadingEntity.getId()); billLading.setStockStatus("3"); billLading.setEndTimeStocking(new Date()); distrilbutionBillLadingMapper.updateById(billLading); - }else{ + } else { //没有完成 - getUpdateStockup(pageId,1); + getUpdateStockup(pageId, 1); } - break; + break; } @@ -400,13 +402,14 @@ public class DistributionStockServiceImpl extends BaseServiceImpl stockEntityList = baseMapper.selectList(Wrappers.query().lambda() .eq(ObjectUtils.isNotNull(id), DistributionStockEntity::getStockArticle, id) .eq(DistributionStockEntity::getStockupId, parseLong) @@ -434,12 +438,12 @@ public class DistributionStockServiceImpl extends BaseServiceImpl selectDistributionStockupPage(IPage page, DistributionStockupVO distributionStockup) { @@ -1833,6 +1836,10 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl stock = new AtomicReference<>(false); + BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); + if (Func.isEmpty(myCurrentWarehouse.getId())){ + return Resp.scanFail("未授权!!!","未授权"); + } DistributionStockupInfoEntity one = distributionStockupInfoService.getOne(Wrappers.query().lambda() .eq(DistributionStockupInfoEntity::getReservationId, stockupDTO.getReservationId()) @@ -1933,6 +1940,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl entityList = distributionStockupInfoService.list(Wrappers.query().lambda() + .eq(DistributionStockupInfoEntity::getReservationId, stockupDTO.getReservationId()) + .eq(DistributionStockupInfoEntity::getStockupId, stockupDTO.getStockupId()) + ); + if (!entityList.isEmpty()) { + boolean flag = entityList.stream().allMatch(a -> "4".equals(a.getStockStatus())); + if (flag) { + log.error(method + "备货任务已取消:{}", stockupDTO.getReservationId()); + return Resp.scanFail("备货任务已取消", "备货任务已取消"); + } + } else { + return Resp.scanFail("备货任务已取消", "备货任务已取消"); + + } + //查询订单在库数量是否满足备货 + DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(stockupDTO.getStockArticleId()); + if (ObjectUtils.isNull(stockArticleEntity)) { + log.error(method + "查询订单信息错误OrderId:{}", stockupDTO.getStockArticleId()); + return R.fail(3002, "订单信息错误 !"); + } + //查询库内数量是否满足此次操作数量 + if (stockArticleEntity.getHandQuantity() < stockupDTO.getNum()) { + log.error(method + stockArticleEntity.getOrderCode() + "在库数量不足:{}", stockupDTO.getStockArticleId()); + return R.fail(3002, stockArticleEntity.getOrderCode() + "在库数量不足"); } + //查询计划数量 + List reservationZeroPackageEntities = reservationZeroPackageService.list(Wrappers.query().lambda() + .eq(DistributionReservationZeroPackageEntity::getReservationId, stockupDTO.getReservationId()) + .ne(DistributionReservationZeroPackageEntity::getZeroPackageStatus, ReservationPackageStatusConstant.quxiao.getValue()) + .apply("quantity > 0") + ); + Integer planNum = 0; + Integer stockupNum = 0; + if (!reservationZeroPackageEntities.isEmpty()) { + //查询此次备货是否在计划之中 + List plan = reservationZeroPackageEntities.stream().filter(f -> stockArticleEntity.getId().equals(f.getStockArticleId())).collect(Collectors.toList()); + if (!plan.isEmpty()) { + planNum = plan.stream().mapToInt(DistributionReservationZeroPackageEntity::getQuantity).sum(); + } + //查询以备数量 + List stockEntityList = distributionStockService.list(Wrappers.query().lambda() + .eq(DistributionStockEntity::getReservationId, stockupDTO.getReservationId()) + .eq(DistributionStockEntity::getStockupId, stockupDTO.getStockupId()) + .eq(DistributionStockEntity::getStockArticle, stockupDTO.getStockArticleId()) + ); + if (!stockEntityList.isEmpty()){ + stockupNum = stockEntityList.stream().mapToInt(DistributionStockEntity::getStockQuantity).sum(); + } + } - return null; + //比计划是否超出计划备货数量 + int i = planNum - stockupNum - stockupDTO.getNum(); + if (i < 0) { + log.error(method + "超出计划备货,当前备货数量:{},计划数量:{},以备数量:{}", stockupDTO.getNum(), planNum, stockupNum); + return Resp.scanFail("超出备货数量", "超出备货数量"); + } + + DistributionStockEntity stockEntity = new DistributionStockEntity(); + stockEntity.setStockArticle(stockArticleEntity.getId()); + stockEntity.setStockupId(stockupDTO.getStockupId()); + stockEntity.setScanUser(AuthUtil.getUser().getNickName()); + if ("3".equals(stockupDTO.getTypeService())) { + stockEntity.setConditions("2"); + stockEntity.setBillLadingId(stockupDTO.getReservationId()); + stockEntity.setOutboundType("3"); + } else { + stockEntity.setOutboundType(reservationEntity.getDeliveryType()); + } + stockEntity.setType(3); + stockEntity.setStockQuantity(stockupDTO.getNum()); + stockEntity.setStockupId(stockupDTO.getStockupId()); + stockEntity.setReservationId(stockupDTO.getReservationId()); + stockEntity.setStockArticle(stockArticleEntity.getId()); + stockEntity.setOrderSelfNumbering(stockArticleEntity.getOrderCode()); + stockEntity.setCoding(stockArticleEntity.getOrderCode()); + stockEntity.setGoodsName(stockArticleEntity.getDescriptionGoods()); + stockEntity.setMarketId(stockArticleEntity.getMallId()); + stockEntity.setReservationCode(reservationEntity.getReservationCode()); + stockEntity.setStockupArea(stockupDTO.getStockupAllocationName()); + stockEntity.setStockupAreaId(stockupDTO.getStockupAllocationId()); + if (Func.isNotEmpty(stockupDTO.getAllocationId())) { + log.info(method + "库位备货"); + //查询库位零担 + WarehouseUpdownGoodsEntity warehouseUpdownGoodsEntity = new WarehouseUpdownGoodsEntity(); + warehouseUpdownGoodsEntity.setAssociationValue(stockArticleEntity.getOrderCode()); + warehouseUpdownGoodsEntity.setAssociationId(stockArticleEntity.getId()); + warehouseUpdownGoodsEntity.setAssociationType("1"); + warehouseUpdownGoodsEntity.setAllocationId(stockupDTO.getAllocationId()); + List locationStockListInformation = warehouseUpdownGoodsClient.getLocationStockListInformation(warehouseUpdownGoodsEntity); + if (locationStockListInformation.isEmpty()) { + log.error(method + "查询库位信息失败orderCode:{},id:{},type:{}", stockArticleEntity.getOrderCode(), stockArticleEntity.getId(), "1"); + return Resp.scanFail("库位信息查询失败", "库位信息查询失败"); + } + //记录货位 + if (locationStockListInformation.size() == 1) { + WarehouseUpdownGoodsEntity updownGoodsEntity = locationStockListInformation.get(0); + stockEntity.setAllocationId(updownGoodsEntity.getAllocationId()); + stockEntity.setAllocationTitle(updownGoodsEntity.getAllocationTitle()); + } + List list = new ArrayList<>(); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("warehouseId", myCurrentWarehouse.getId()); + jsonObject.put("orderCode", stockArticleEntity.getOrderCode()); + jsonObject.put("waybillCode", stockArticleEntity.getWaybillNumber()); + jsonObject.put("enterNum", stockupDTO.getNum()); + jsonObject.put("allocationId", stockupDTO.getAllocationId()); + jsonObject.put("remark", "备货下架零担" + stockupDTO.getNum() + "件"); + list.add(jsonObject); + //进行下架 + warehouseUpdownTypeClient.downZeroOrder(list); + stockEntity.setAllocationId(stockupDTO.getAllocationId()); + } else if (Func.isNotEmpty(stockupDTO.getTrayId())) { + log.info(method + "托盘备货"); + //查询托盘 + WarehouseTrayGoodsEntity warehouseTrayGoodsEntity = new WarehouseTrayGoodsEntity(); + warehouseTrayGoodsEntity.setAssociationValue(stockArticleEntity.getOrderCode()); + warehouseTrayGoodsEntity.setAssociationId(stockArticleEntity.getId()); + warehouseTrayGoodsEntity.setAssociationType("1"); + warehouseTrayGoodsEntity.setTrayId(Long.parseLong(stockupDTO.getTrayId())); + List trayList = warehouseTrayGoodsClient.getTrayList(warehouseTrayGoodsEntity); + if (!trayList.isEmpty()) { + if (trayList.size() == 1) { + //托盘解托 + WarehouseTrayGoodsEntity trayGoodsEntity = trayList.get(0); + log.info(method+"downZeroTrayById>>>>>>>>>>>>>>>trayId:{},orderId:{},warehouseId:{},num:{}",trayGoodsEntity.getTrayId(),stockArticleEntity.getId(), myCurrentWarehouse.getId(), stockupDTO.getNum()); + List list = new ArrayList<>(); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("warehouseId", myCurrentWarehouse.getId()); + jsonObject.put("trayId", stockupDTO.getTrayId()); + jsonObject.put("orderId", stockArticleEntity.getId()); + jsonObject.put("num", stockupDTO.getNum()); + jsonObject.put("remark", "备货解托零担" + stockupDTO.getNum() + "件"); + list.add(jsonObject); + warehouseTrayGoodsClient.downZeroTrayById(list); + } else { + //查询托盘存在多条记录 + log.error(method + "查询库托盘信息失败orderCode:{},id:{},type:{}", stockArticleEntity.getOrderCode(), stockArticleEntity.getId(), "1"); + throw new RuntimeException("查询托盘信息失败"); + } + } else { + log.error(method + "查询库托盘信息失败orderCode:{},id:{},type:{}", stockArticleEntity.getOrderCode(), stockArticleEntity.getId(), "1"); + //查询托盘信息错误 + throw new RuntimeException("查询托盘信息失败"); + } + } else { + log.info(method + "无库位无托盘备货"); + } + distributionStockService.save(stockEntity); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("warehouseId", myCurrentWarehouse.getId()); + jsonObject.put("code", stockArticleEntity.getOrderCode()); + jsonObject.put("stockUpAllocationId", stockupDTO.getStockupAllocationId()); + jsonObject.put("type", 3); + jsonObject.put("num", stockupDTO.getNum()); + //备货库位上架 + warehouseUpdownStockUpAreaClient.upStockUpShelf(jsonObject); + return Resp.scanSuccess("备货成功", "本次成功备货" + stockupDTO.getNum() + "件"); } @@ -2719,7 +2921,6 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl stockEntityList = distributionStockService.list(Wrappers.query().lambda() .eq(DistributionStockEntity::getReservationId, stockupDTO.getReservationId()) .eq(DistributionStockEntity::getStockArticle, stockupDTO.getStockArticleId()) - .in(DistributionStockEntity::getParcelListId, collect) ); if (!stockEntityList.isEmpty()) { int scanNum = stockEntityList.stream().mapToInt(DistributionStockEntity::getStockQuantity).sum(); @@ -2732,6 +2933,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl> wrapStockUp(WarehouseVisualizationDTO warehouseGoodsAllocation, Query query) { + IPage pages = warehouseGoodsAllocationService.wrapStockUp(warehouseGoodsAllocation, Condition.getPage(query)); + return R.data(WarehouseVisualizaVOWrapper.build().pageVO(pages)); + } + /** * 货位上架 查询订单 */ @@ -202,6 +210,8 @@ public class WarehouseGoodsAllocationController extends BladeController { } + + /** * 货位上架 订单上架 */ @@ -523,6 +533,14 @@ public class WarehouseGoodsAllocationController extends BladeController { return R.data(pages); } + @GetMapping("/selectStockUpZeroOrder") + @ApiOperationSupport(order = 22) + @ApiOperation(value = "货位 查询零担", notes = "传入warehouseGoodsAllocation") + public R> selectStockUpZeroOrder(WarehouseStockArticleZationDTO warehouseStockArticleZationDTO, Query query) { + IPage pages = warehouseGoodsAllocationService.selectStockUpZeroOrder(warehouseStockArticleZationDTO, Condition.getPage(query)); + return R.data(pages); + } + /** * 货位 查询托盘 */ diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseTrayGoodsClient.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseTrayGoodsClient.java index 0d15091ea..fbe2d1f21 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseTrayGoodsClient.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseTrayGoodsClient.java @@ -1,8 +1,10 @@ package com.logpm.warehouse.feign; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.logpm.warehouse.dto.UpShelfZeroOrderDTO; import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity; import com.logpm.warehouse.service.IWarehouseTrayGoodsService; import com.logpm.warehouse.service.IWarehouseTrayTypeService; @@ -73,10 +75,12 @@ public class WarehouseTrayGoodsClient implements IWarehouseTrayGoodsClient { public List getTrayList(WarehouseTrayGoodsEntity warehouseTrayGoodsEntity) { return warehouseTrayGoodsService.list(Wrappers.query().lambda() .eq(ObjectUtils.isNotNull(warehouseTrayGoodsEntity.getAssociationId()),WarehouseTrayGoodsEntity:: getAssociationId,warehouseTrayGoodsEntity.getAssociationId()) + .eq(ObjectUtils.isNotNull(warehouseTrayGoodsEntity.getAssociationValue()),WarehouseTrayGoodsEntity:: getAssociationValue,warehouseTrayGoodsEntity.getAssociationValue()) .eq(ObjectUtils.isNotNull(warehouseTrayGoodsEntity.getWarehouseId()),WarehouseTrayGoodsEntity:: getWarehouseId,warehouseTrayGoodsEntity.getWarehouseId()) .eq(ObjectUtils.isNotNull(warehouseTrayGoodsEntity.getIncomingBatch()),WarehouseTrayGoodsEntity:: getIncomingBatch,warehouseTrayGoodsEntity.getIncomingBatch()) .eq(ObjectUtils.isNotNull(warehouseTrayGoodsEntity.getMarketId()),WarehouseTrayGoodsEntity::getMarketId ,warehouseTrayGoodsEntity.getMarketId()) .eq(ObjectUtils.isNotNull(warehouseTrayGoodsEntity.getAssociationType()),WarehouseTrayGoodsEntity::getAssociationType ,warehouseTrayGoodsEntity.getAssociationType()) + .eq(ObjectUtils.isNotNull(warehouseTrayGoodsEntity.getTrayId()),WarehouseTrayGoodsEntity::getTrayId ,warehouseTrayGoodsEntity.getTrayId()) ); } @@ -105,6 +109,26 @@ public class WarehouseTrayGoodsClient implements IWarehouseTrayGoodsClient { warehouseTrayGoodsService.deleteByTrayGoodsId(trayGoodsId,warehouseId); } + @Override + public void downZeroTrayById(List list) { + Long warehouseId = null; + Long trayId = null; + Long orderId = null; + Integer num = null; + String remark = null; + for (JSONObject jsonObject:list){ + warehouseId = jsonObject.getLong("warehouseId"); + trayId = jsonObject.getLong("trayId"); + orderId = jsonObject.getLong("orderId"); + num = jsonObject.getInteger("num"); + remark = jsonObject.getString("remark"); + } + + + + warehouseTrayGoodsService.downZeroByTrayId(trayId, orderId, warehouseId, num, remark); + } + /** * @param map * @return diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseUpdownStockupAreaClient.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseUpdownStockupAreaClient.java index 3fbfc83cb..94c6c3257 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseUpdownStockupAreaClient.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseUpdownStockupAreaClient.java @@ -1,5 +1,6 @@ package com.logpm.warehouse.feign; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -29,28 +30,34 @@ public class WarehouseUpdownStockupAreaClient implements IWarehouseUpdownStockUp /** * 备货库位上架 - * @param code 包条码、库存品码、托盘、订单 - * @param stockUpAllocationId 备货库位ID - * @param warehouseId 仓库ID - * @param type 类型 1 - 包件、完成备货库存品、 2 - 零担 3 - 托盘 * @return */ @Override - public Boolean upStockUpShelf(String code, Long stockUpAllocationId, Long warehouseId, Integer type,Integer num) { - return warehouseUpdownStockupAreaService.upStockUpShelf(code,stockUpAllocationId,warehouseId,type,num); + public Boolean upStockUpShelf(JSONObject jsonObject) { + Long warehouseId =jsonObject.getLong("warehouseId"); + String code =jsonObject.getString("code"); + Long stockUpAllocationId =jsonObject.getLong("stockUpAllocationId"); + Integer type =jsonObject.getInteger("type"); + Integer num =jsonObject.getInteger("num"); +// * @param code 包条码、库存品码、托盘、订单 +// * @param stockUpAllocationId 备货库位ID +// * @param warehouseId 仓库ID +// * @param type + return warehouseUpdownStockupAreaService.upStockUpShelf(code, stockUpAllocationId, warehouseId, type, num); } - /** - * @param code - * @param warehouseId - * @param type - * @param num - * @return - */ - @Override - public Boolean downStockUpShelf(String code, Long warehouseId, Integer type, Integer num) { - return warehouseUpdownStockupAreaService.downStockUpShelf(code,warehouseId,type,num); + @Override + public void downStockUpShelf(List jsonObjects) { + for (JSONObject jsonObject : jsonObjects) { + Long warehouseId =jsonObject.getLong("warehouseId"); + Long reservationId =jsonObject.getLong("taskId"); + String code =jsonObject.getString("code"); + String remark =jsonObject.getString("remark"); + Integer type =jsonObject.getInteger("type"); + Integer num =jsonObject.getInteger("num"); + warehouseUpdownStockupAreaService.downStockUpShelf(code,warehouseId,reservationId,type,num,remark); + } } } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseGoodsAllocationMapper.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseGoodsAllocationMapper.java index 5f809abab..3e5458050 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseGoodsAllocationMapper.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseGoodsAllocationMapper.java @@ -188,4 +188,21 @@ public interface WarehouseGoodsAllocationMapper extends BaseMapper selectStockUpAllocationWrap(IPage page, @Param("param") WarehouseGoodsAllocationDTO warehouseGoodsAllocation); + + /** + * 查询备货库位零担信息 + * @param page + * @param warehouseStockArticleZationDTO + * @return + */ + List selectStockUpZeroOrder(IPage page,@Param("param") WarehouseStockArticleZationDTO warehouseStockArticleZationDTO); + + /** + * 查询订制品备货库位上架信息 + * @param page + * @param warehouseGoodsAllocation + * @return + */ + List wrapStockUp(IPage page,@Param("param") WarehouseVisualizationDTO warehouseGoodsAllocation); + } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseGoodsAllocationMapper.xml b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseGoodsAllocationMapper.xml index 8fd98d961..f4aa6dfbc 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseGoodsAllocationMapper.xml +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseGoodsAllocationMapper.xml @@ -501,6 +501,32 @@ WHERE lwusu.goods_type = 1 + + diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseGoodsAllocationService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseGoodsAllocationService.java index 3cc38b4cf..549125ba5 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseGoodsAllocationService.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseGoodsAllocationService.java @@ -134,4 +134,20 @@ public interface IWarehouseGoodsAllocationService extends BaseService selectStockUpAllocationWrap(WarehouseGoodsAllocationDTO warehouseGoodsAllocation, IPage page); + + /** + * 查询备货库位零担上架情况 + * @param warehouseStockArticleZationDTO + * @param page + * @return + */ + IPage selectStockUpZeroOrder(WarehouseStockArticleZationDTO warehouseStockArticleZationDTO, IPage page); + + /** + * 备货货位包件上架信息 + * @param warehouseGoodsAllocation + * @param page + * @return + */ + IPage wrapStockUp(WarehouseVisualizationDTO warehouseGoodsAllocation, IPage page); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayGoodsService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayGoodsService.java index 16eaf848c..3a8a05d9f 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayGoodsService.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayGoodsService.java @@ -29,6 +29,8 @@ public interface IWarehouseTrayGoodsService extends BaseService getZeroListByTrayTypeId(Long trayTypeId,Long warehouseId); List getZeroUpListByTrayTypeId(Long trayTypeId); /** diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownStockupAreaService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownStockupAreaService.java index 2a732882b..a95a834d8 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownStockupAreaService.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownStockupAreaService.java @@ -65,5 +65,5 @@ public interface IWarehouseUpdownStockupAreaService extends BaseService selectAllZeroOrder(WarehouseStockArticleZationDTO warehouseStockArticleZationDTO, IPage page) { //查询库位的零担 @@ -422,6 +424,29 @@ public class WarehouseGoodsAllocationServiceImpl extends BaseServiceImpl selectStockUpZeroOrder(WarehouseStockArticleZationDTO warehouseStockArticleZationDTO, IPage page) { + List list = baseMapper.selectStockUpZeroOrder(page, warehouseStockArticleZationDTO); + + return page.setRecords(list); + } + + /** + * @param warehouseGoodsAllocation + * @param page + * @return + */ + @Override + public IPage wrapStockUp(WarehouseVisualizationDTO warehouseGoodsAllocation, IPage page) { + List list =baseMapper.wrapStockUp(page,warehouseGoodsAllocation); + return page.setRecords(list); + } + public List getMyWatchWarehouseIds(){ //获取当前登录人仓库 List myWatchWarehouse = basicdataWarehouseClient.getMyWatchWarehouse(); 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 9cf616cde..b6f76ee91 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 @@ -1,10 +1,12 @@ package com.logpm.warehouse.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.basicdata.feign.IBasicdataTrayClient; import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.entity.DistributionStockArticleEntity; import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity; +import com.logpm.warehouse.entity.WarehouseTrayGoodsLogEntity; import com.logpm.warehouse.entity.WarehouseTrayTypeEntity; import com.logpm.warehouse.mapper.WarehouseTrayGoodsMapper; import com.logpm.warehouse.mapper.WarehouseTrayTypeMapper; @@ -93,6 +95,35 @@ public class WarehouseTrayGoodsServiceImpl extends BaseServiceImplquery().lambda() + .eq(WarehouseTrayGoodsEntity::getTrayId,trayId) + .eq(WarehouseTrayGoodsEntity::getAssociationId,orderId) + .eq(WarehouseTrayGoodsEntity::getAssociationType,"1") + .eq(WarehouseTrayGoodsEntity::getWarehouseId,warehouseId) + ); + Long trayTypeId = trayGoodsEntity.getTrayTypeId(); + int i = trayGoodsEntity.getNum() - num; + log.info("零担解托>>>>>>>>>>>当前托上数量:{},计划解托数量:{}",trayGoodsEntity.getNum(),num); + if (i == 0){ + baseMapper.deleteEntityByTrayGoodsId(trayGoodsEntity.getId()); + }else { + trayGoodsEntity.setNum(i); + baseMapper.updateById(trayGoodsEntity); + WarehouseTrayGoodsLogEntity copy = Func.copy(trayGoodsEntity, WarehouseTrayGoodsLogEntity.class); + copy.setNum(num); + copy.setId(null); + copy.setRemark(remark); + warehouseTrayGoodsLogService.save(copy); + } +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.eq("tray_type_id",trayTypeId); +// List list = baseMapper.selectList(queryWrapper); +// return list.size(); + return true; + } + @Override public List getZeroListByTrayTypeId(Long trayTypeId,Long warehouseId) { return baseMapper.getZeroListByTrayTypeId(trayTypeId,warehouseId); diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownStockupAreaServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownStockupAreaServiceImpl.java index a2e1cfbb4..64e6e6837 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownStockupAreaServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownStockupAreaServiceImpl.java @@ -20,17 +20,11 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.basicdata.entity.*; -import com.logpm.basicdata.feign.IBasicdataGoodsAllocationClient; -import com.logpm.basicdata.feign.IBasicdataGoodsAreaClient; -import com.logpm.basicdata.feign.IBasicdataGoodsShelfClient; -import com.logpm.basicdata.feign.IBasicdataWarehouseClient; +import com.logpm.basicdata.feign.*; import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.entity.DistributionStockArticleEntity; import com.logpm.distribution.entity.DistributionStockListEntity; -import com.logpm.distribution.feign.IDisStockListDetailClient; -import com.logpm.distribution.feign.IDistributionParcelListClient; -import com.logpm.distribution.feign.IDistributionStockArticleClient; -import com.logpm.distribution.feign.IDistributionStockListClient; +import com.logpm.distribution.feign.*; import com.logpm.distribution.vo.UpDownStockupAreaVO; import com.logpm.warehouse.bean.Resp; import com.logpm.warehouse.dto.*; @@ -58,6 +52,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; /** @@ -102,6 +97,10 @@ public class WarehouseUpdownStockupAreaServiceImpl extends BaseServiceImpl trayTypeEntityQueryWrapper = new QueryWrapper<>(); - trayTypeEntityQueryWrapper.eq("tray_code",code) - .eq("is_deleted",0); + trayTypeEntityQueryWrapper.eq("tray_code", code) + .eq("is_deleted", 0); WarehouseTrayTypeEntity trayTypeEntity = warehouseTrayTypeService.getOne(trayTypeEntityQueryWrapper); - if (Func.isEmpty(trayTypeEntity)){ + if (Func.isEmpty(trayTypeEntity)) { + BasicdataTrayEntity trayByTrayCode = trayClient.getTrayByTrayCode(trayTypeEntity.getTrayCode()); warehouseUpdownStockupArea.setAssociationValue(trayTypeEntity.getTrayCode()); warehouseUpdownStockupArea.setAssociationId(trayTypeEntity.getTrayId()); - warehouseUpdownStockupArea.setAssociationType("4"); + warehouseUpdownStockupArea.setAssociationType("3"); warehouseUpdownStockupArea.setNum(trayTypeEntity.getOrderTotalNum()); + warehouseUpdownStockupArea.setTrayName(trayByTrayCode.getPalletName()); } this.save(warehouseUpdownStockupArea); - break; default: - log.error(method+ "未知type:{}",type); + log.error(method + "未知type:{}", type); return false; } WarehouseUpdownStockupAreaLogEntity warehouseUpdownStockupAreaLogEntity = Func.copy(warehouseUpdownStockupArea, WarehouseUpdownStockupAreaLogEntity.class); @@ -240,49 +240,91 @@ public class WarehouseUpdownStockupAreaServiceImpl extends BaseServiceImpl>>>>>>>>>>>>,code:{},warehouseId:{},type:{},num:{}", code, warehouseId, type, num); + + //查询备货库位 + String stockUpAllocationId = distributionStockClient.getCargoStockUpAllocationId(code, warehouseId, taskId); + if (Func.isEmpty(stockUpAllocationId)) { + log.error(method + "无上架库位ID,stockUpAllocationId:{}", stockUpAllocationId); + throw new RuntimeException("无上架记录"); + } //查询上架货物 List warehouseUpdownStockupAreaEntityList = this.list(Wrappers.query().lambda() .eq(WarehouseUpdownStockupAreaEntity::getAssociationValue, code) .eq(WarehouseUpdownStockupAreaEntity::getWarehouseId, warehouseId) + .eq(WarehouseUpdownStockupAreaEntity::getAllocationId, stockUpAllocationId) ); - if (warehouseUpdownStockupAreaEntityList.isEmpty()){ - log.error(method+"无上架记录AssociationValue:{},warehouseId:{}",code,warehouseId); - return false; + if (warehouseUpdownStockupAreaEntityList.isEmpty()) { + log.error(method + "无上架记录AssociationValue:{},warehouseId:{}", code, warehouseId); + throw new RuntimeException("无上架记录"); } - if (warehouseUpdownStockupAreaEntityList.size() > 1){ - log.error(method+"多条上架记录AssociationValue:{},warehouseId:{}",code,warehouseId); - return false; + if (warehouseUpdownStockupAreaEntityList.size() > 1) { + boolean flag = warehouseUpdownStockupAreaEntityList.stream().anyMatch(item -> !item.getAssociationType().equals("3")); + if (flag) { + log.error(method + "多条上架记录AssociationValue:{},warehouseId:{}", code, warehouseId); + throw new RuntimeException("多条上架记录"); + } else { + log.info(method + "零担备货库位存在多条上架记录AssociationValue:{},warehouseId:{}", code, warehouseId); + } } WarehouseUpdownStockupAreaEntity warehouseUpdownStockupArea = warehouseUpdownStockupAreaEntityList.get(0); - switch (warehouseUpdownStockupArea.getAssociationType()){ - case "1" : - case "2" : - case "4" : - //库存品包件 - //订制品 + List warehouseUpdownStockupAreaLogEntities = new ArrayList<>(); + switch (warehouseUpdownStockupArea.getAssociationType()) { + case "1": + case "2": + case "4": + //库存品包件 + //订制品 + WarehouseUpdownStockupAreaLogEntity warehouseUpdownStockupAreaLogEntity = Func.copy(warehouseUpdownStockupArea, WarehouseUpdownStockupAreaLogEntity.class); + warehouseUpdownStockupAreaLogEntity.setId(null); + warehouseUpdownStockupAreaLogEntity.setNum(num); + warehouseUpdownStockupAreaLogEntity.setBindingType(2); + warehouseUpdownStockupAreaLogEntity.setRemark(remark); + warehouseUpdownStockupAreaLogEntities.add(warehouseUpdownStockupAreaLogEntity); this.removeById(warehouseUpdownStockupArea.getId()); break; - case "3": + case "3": //零担 - int i = warehouseUpdownStockupArea.getNum() - num; - warehouseUpdownStockupArea.setNum(i); - if (i == 0){ - this.removeById(warehouseUpdownStockupArea.getId()); - }else { - this.updateById(warehouseUpdownStockupArea); + int sum = warehouseUpdownStockupAreaEntityList.stream().mapToInt(item -> item.getNum()).sum(); + int i = warehouseUpdownStockupArea.getNum() - sum; + AtomicInteger a = new AtomicInteger(num); + if (i < 0) { + log.info(method + "零担备货库位下架备货库位数量不足下架,库位总数sum:{},下架数量num:{}", sum, num); + throw new RuntimeException("备货库位在库数不足"); + } + Iterator iterator = warehouseUpdownStockupAreaEntityList.iterator(); + while (iterator.hasNext()){ + WarehouseUpdownStockupAreaEntity next = iterator.next(); + if (a.get() > 0 ){ + WarehouseUpdownStockupAreaLogEntity updownStockupAreaLogEntity = Func.copy(next, WarehouseUpdownStockupAreaLogEntity.class); + updownStockupAreaLogEntity.setId(null); + updownStockupAreaLogEntity.setBindingType(2); + updownStockupAreaLogEntity.setRemark(remark); + warehouseUpdownStockupAreaLogEntities.add(updownStockupAreaLogEntity); + if ((next.getNum() - a.get()) >= 0){ + //此时具备库位内的零担进行下架 + next.setNum(0); + updownStockupAreaLogEntity.setNum(next.getNum()); + warehouseUpdownStockupAreaLogEntities.add(updownStockupAreaLogEntity); + + this.removeById(next); + }else { + next.setNum(next.getNum() - a.get()); + updownStockupAreaLogEntity.setNum(next.getNum() - a.get()); + warehouseUpdownStockupAreaLogEntities.add(updownStockupAreaLogEntity); + this.updateById(next); + } + a.set(a.get() - next.getNum()); + } } break; default: - log.error(method+"type错误type:{}",type); - return false; + log.error(method + "type错误type:{}", type); } - WarehouseUpdownStockupAreaLogEntity warehouseUpdownStockupAreaLogEntity = Func.copy(warehouseUpdownStockupArea, WarehouseUpdownStockupAreaLogEntity.class); - warehouseUpdownStockupAreaLogEntity.setNum(num); - warehouseUpdownStockupAreaLogEntity.setBindingType(2); - warehouseUpdownStockupAreaLogService.save(warehouseUpdownStockupAreaLogEntity); - return true; + + warehouseUpdownStockupAreaLogService.saveBatch(warehouseUpdownStockupAreaLogEntities); } }