diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataCarrierEntity.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataCarrierEntity.java index 953ea714d..1c68ceebd 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataCarrierEntity.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataCarrierEntity.java @@ -208,4 +208,5 @@ public class BasicdataCarrierEntity extends TenantEntity { @ApiModelProperty(value = "预留5") private String reserve5; + } diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataVehicleEntity.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataVehicleEntity.java index 91d120e0c..4637ec2ec 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataVehicleEntity.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataVehicleEntity.java @@ -319,4 +319,5 @@ public class BasicdataVehicleEntity extends TenantEntity { @ApiModelProperty(value = "预留5") private String reserve5; + } diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataClientClient.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataClientClient.java index b38dbc80d..5789c6a83 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataClientClient.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataClientClient.java @@ -80,4 +80,12 @@ public interface IBasicdataClientClient { @GetMapping(API_PREFIX+"/findListByClientName") List findListByClientName(@RequestParam String clientName); + + /** + * 根据Id查询客户 + * @param mallId + * @return + */ + @GetMapping(API_PREFIX+"/getMallById") + BasicdataClientEntity getMallById(Long mallId); } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppDeliveryListVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppDeliveryListVO.java index 0bd951461..0a5538edd 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppDeliveryListVO.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppDeliveryListVO.java @@ -60,6 +60,11 @@ public class DistributionAppDeliveryListVO extends DistributionDeliveryListEntit */ @ApiModelProperty(value = "完成装车客户数") private Integer loadCusNub; + /** + * 装车客户数 + */ + @ApiModelProperty(value = "装车件数") + private Integer scannedNumber; /** * 配车状态 diff --git a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java index 75421268a..b18f8d93a 100644 --- a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java +++ b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java @@ -274,7 +274,7 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl numberRules = DictBizCache.getList("work_order_number_rules"); SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss"); - if (numberRules.isEmpty()) { + if (ObjectUtils.isNull(numberRules) || numberRules.isEmpty()) { log.info("注意,注意!工单号字典未配置!请配置!"); } else { Optional first2 = pcWorkOrder.stream().filter(i -> i.getDictKey().equals(workOrderType)).findFirst(); diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataClientClient.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataClientClient.java index 6fa79eca0..85f58c524 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataClientClient.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataClientClient.java @@ -114,4 +114,10 @@ public class BasicdataClientClient implements IBasicdataClientClient { return basicdataClientService.findListByClientName(clientName); } + @Override + @GetMapping(API_PREFIX+"/getMallById") + public BasicdataClientEntity getMallById(Long mallId) { + return basicdataClientService.getById(mallId); + } + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataCodeClient.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataCodeClient.java index 40abf0ddb..11156019c 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataCodeClient.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataCodeClient.java @@ -1,5 +1,6 @@ package com.logpm.basicdata.feign; +import com.logpm.basicdata.entity.BasicdataClientEntity; import com.logpm.basicdata.service.IBasicdataCodeService; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.RestController; @@ -16,4 +17,5 @@ public class BasicdataCodeClient implements IBasicdataCodeClient { public String getCodeByType(Integer type,String warehouseCode,String orderCode) { return basicdataCodeService.getCodeByType(type,warehouseCode,orderCode); } + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionDeliveryListController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionDeliveryListController.java index c22afa381..a73182c53 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionDeliveryListController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionDeliveryListController.java @@ -482,4 +482,26 @@ public class DistributionDeliveryListController extends BladeController { R r = distributionSignforService.signforInPC(distrilbutionloadingscanDTO); return r; } + + + + @PostMapping("/cancelDelivery") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "PC签收包件") + public R cancelDelivery(@Valid @RequestBody DistrilbutionAppsignforDTO distrilbutionloadingscanDTO) { + R r = distributionDeliveryListService.cancelDelivery(distrilbutionloadingscanDTO.getDeliveryId()); + if (r.isSuccess()){ + //取消成功,维护配送单状态和数量 + distributionDeliveryListService.maintenanceDeliveryNum(distrilbutionloadingscanDTO.getDeliveryId()); + distributionDeliveryListService.maintenanceDeliveryInfo(distrilbutionloadingscanDTO.getDeliveryId()); + } + return r; + } + + + + + + + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java index 83ba58abb..a26695d2c 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java @@ -31,6 +31,7 @@ import com.logpm.distribution.entity.DistributionSignforEntity; import com.logpm.distribution.excel.DistributionSignforExcel; import com.logpm.distribution.excel.DistributionSignforOwnExcel; import com.logpm.distribution.service.IDistributionAsyncService; +import com.logpm.distribution.service.IDistributionDeliveryListService; import com.logpm.distribution.service.IDistributionReservationService; import com.logpm.distribution.service.IDistributionSignforService; import com.logpm.distribution.service.impl.DistributionAddvalueServiceImpl; @@ -85,6 +86,8 @@ public class DistributionSignforController extends BladeController { private final IDistributionAsyncService distributionAsyncService; + private final IDistributionDeliveryListService distributionDeliveryListService; + /** * 签收管理 详情 */ @@ -306,8 +309,11 @@ public class DistributionSignforController extends BladeController { @ApiOperation(value = "修改", notes = "传入distributionSignfor") public R update(@Valid @RequestBody DistributionSignforDTO distributionSignfor) { - R r= distributionSignforService.recheck(distributionSignfor.getId()); - + R r= distributionSignforService.recheck(distributionSignfor); + if (r.isSuccess()){ + //维护配送状态 + distributionDeliveryListService.maintenanceDeliveryInfo(distributionSignfor.getDeliveryId()); + } // return R.status(distributionSignforService.updateById(distributionSignfor)); return r; } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistrilbutionBillLadingController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistrilbutionBillLadingController.java index 08f35f04c..ea322394a 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistrilbutionBillLadingController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistrilbutionBillLadingController.java @@ -275,6 +275,13 @@ public class DistrilbutionBillLadingController extends BladeController { return R.status(distrilbutionBillLadingService.ownSaveOrUpdate(distrilbutionBillLading)); } + @PostMapping("/cancelBillLoding") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "批量取消自提单", notes = "传入distrilbutionBillLading") + public R cancelBillLoding(@Valid @RequestBody DistrilbutionBillLadingDTO distrilbutionBillLadingDTO) { + return distrilbutionBillLadingService.cancelBillLoding(distrilbutionBillLadingDTO.getBillLodingIds()); + } + /** diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistrilbutionBillLadingDTO.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistrilbutionBillLadingDTO.java index 12ba89c9b..8e0e45643 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistrilbutionBillLadingDTO.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistrilbutionBillLadingDTO.java @@ -42,6 +42,11 @@ public class DistrilbutionBillLadingDTO extends DistrilbutionBillLadingEntity { * */ private String name; + + /** + * + */ + private String billLodingIds; /** * 提货批次 */ 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 8eb691651..99e77bbd2 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 @@ -210,7 +210,7 @@ left JOIN logpm_distribution_signfor lds on lddl.id = lds.delivery_id LEFT JOIN logpm_distribution_reservation ldr on ldr.id = lds.reservation_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 + 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 lddl.train_number like concat('%',#{param.trainNumber},'%') @@ -757,7 +757,7 @@ logpm_distribution_delivery_list lddl left join logpm_distribution_delivery_self ldds on lddl.id =ldds.delivery_id - lddl.is_deleted =0 and lddl.warehouse_id =#{warehouseId} + lddl.is_deleted =0 and lddl.customers_number > 0 and lddl.warehouse_id =#{warehouseId} and lddl.type = #{param.type} and lddl.id in @@ -1171,6 +1171,7 @@ logpm_distribution_signfor lds JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id + ldr.reservation_status != 40 and lds.delivery_id = #{deliveryListId} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanMapper.xml index 5aabf4b43..107fdee5a 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanMapper.xml @@ -256,9 +256,6 @@ SELECT reservation_id,COUNT(1) as num from ( diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java index f3c54c30a..a2f2b3649 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java @@ -70,8 +70,7 @@ public interface DistributionReservationMapper extends BaseMapper selectStockupOrderList(@Param("reservationId")Long reservationId,@Param("isZero") String isZero); List selectStockupStockList(@Param("reservationId")Long reservationId); - List selectStockupStockListNew(@Param("reservationId")Long reservationId,@Param("warehouseId") Long warehouseId); - + List selectStockupStockListNew(@Param("reservationId")Long reservationId,@Param("warehouseId")Long warehouseId,@Param("mallName")String mallName); Integer selectOrderNumByReservationId(@Param("reservationId")Long reservationId); Integer selectPlanNum(@Param("reservationId")Long reservationId); @@ -119,8 +118,8 @@ public interface DistributionReservationMapper extends BaseMapper getReservationPackage(IPage page,@Param("orderIds") List orderIds,@Param("param")Map param); @@ -133,8 +132,8 @@ public interface DistributionReservationMapper extends BaseMapper selectPackageByReservationAndStockArticle(@Param("reservationId") Long reservationId,@Param("stockArticleId") Long stockArticleId,@Param("warehourseId") Long warehourseId); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml index 09d6ec569..254ecd992 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml @@ -335,10 +335,12 @@ LEFT JOIN logpm_distribution_stock_list ldsl ON ldrs.stocklist_id = ldsl.id WHERE ldrs.reservation_id = #{reservationId} + AND ldsl.market_name = #{mallName} group by ldsl.cargo_number ) t LEFT JOIN logpm_distribution_stock_list ldslNew ON t.cargo_number = ldslNew.cargo_number - LEFT JOIN logpm_distribution_stock ldss ON ldss.stock_list_id = t.id where ldslNew.is_deleted = 0 + LEFT JOIN logpm_distribution_stock ldss ON ldss.stock_list_id = t.id + where ldslNew.is_deleted = 0 @@ -1156,6 +1158,7 @@ ldsa.order_code, ldrs.is_have_data, ldsa.id AS id, + ldsa.waybill_number AS waybillNumber, ldrs.is_zero FROM logpm_distribution_reservation AS lds diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.java index 23c2ea57d..37e274f25 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.java @@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.distribution.dto.DistributionSignforDTO; import com.logpm.distribution.dto.app.DistributionAppDeliveryListDTO; import com.logpm.distribution.entity.DistributionParcelListEntity; +import com.logpm.distribution.entity.DistributionReservationEntity; import com.logpm.distribution.entity.DistributionSignforEntity; import com.logpm.distribution.excel.DistributionSignforExcel; import com.logpm.distribution.vo.*; @@ -313,4 +314,10 @@ public interface DistributionSignforMapper extends BaseMapper signingPackageDetail(@Param("reservationId") Long reservationId); + + /** + * 查询配送单关联预约 + * @param deliveryId + */ + List selectReservationByDeliveryId(Long deliveryId); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml index 2a9f52810..c511c3a8b 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml @@ -349,7 +349,7 @@ JOIN logpm_distribution_delivery_list lddl ON lddl.id = lds.delivery_id JOIN logpm_distribution_reservation ldr ON ldr.id = lds.reservation_id - lds.is_deleted = 0 and ldr.is_deleted = 0 and lddl.is_deleted = 0 + lds.is_deleted = 0 and ldr.is_deleted = 0 and lddl.is_deleted = 0 AND (ldr.reservation_num + ldr.reservation_stock_list_num) > 0 and ldr.mall_name like concat('%',#{param.mallName},'%') @@ -1279,4 +1279,11 @@ ldr.id = #{reservationId} + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.java index 1f5b965bd..8f7cef4df 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.java @@ -152,4 +152,6 @@ public interface DistributionStockListMapper extends BaseMapper selectMerchantHaveDataStockListInfo(@Param("stockListId") Long stockListId); List selectMerchantNotHaveDataStockListInfo(@Param("stockListId")Long id); + + IPage listAllocationOrder(IPage page, @Param("param") DistributionStockListEntity distributionStockListEntity); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.xml index 53fd57982..04dfc1663 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.xml @@ -387,6 +387,30 @@ + + + + select dbl.id,GROUP_CONCAT(DISTINCT dsa.service_number) serviceNumber,GROUP_CONCAT(DISTINCT dsa.waybill_number) waybillNumber,GROUP_CONCAT(DISTINCT dsa.consignee_unit) @@ -121,40 +127,35 @@ + + + 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 8a499d4af..831493ea0 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 @@ -123,6 +123,7 @@ CASE WHEN (SELECT COUNT(id) FROM logpm_distribution_bill_lading_scan WHERE stock_article_id = ldsa.id) - (SELECT COUNT(id) FROM logpm_distrilbution_bill_package WHERE stock_article_id = ldsa.id AND packet_bar_status IN (1,3)) = 0 THEN 20 WHEN (SELECT COUNT(id) FROM logpm_distribution_bill_lading_scan WHERE stock_article_id = ldsa.id) - (SELECT COUNT(id) FROM logpm_distrilbution_bill_package WHERE stock_article_id = ldsa.id AND packet_bar_status IN (1,3)) > 0 THEN 10 + WHEN (SELECT COUNT(id) FROM logpm_distribution_bill_lading_scan WHERE stock_article_id = ldsa.id) - (SELECT COUNT(id) FROM logpm_distrilbution_bill_package WHERE stock_article_id = ldsa.id AND packet_bar_status IN (1,3)) < 0 THEN 30 END AS conditions, (select GROUP_CONCAT(DISTINCT ldpl.material_name ) from logpm_distribution_parcel_list ldpl diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDisStockListDetailService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDisStockListDetailService.java index 2bdc628bf..2fcbee1c4 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDisStockListDetailService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDisStockListDetailService.java @@ -68,4 +68,10 @@ public interface IDisStockListDetailService extends BaseService disStockListDetail) throws Exception; + /** + * 取消库存品包件信息 + * @param stockListId + * @param billLadingId + */ + void cancelInventoryPackageByReservationIdAnStockListId(Long stockListId, Long billLadingId); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryListService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryListService.java index bd8587232..0a7ae5613 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryListService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryListService.java @@ -25,6 +25,7 @@ import com.logpm.distribution.dto.DistributionDeliveryListDTO; import com.logpm.distribution.dto.app.DistributionAppDeliveryListDTO; import com.logpm.distribution.dto.app.DistrilbutionloadingscanDTO; import com.logpm.distribution.entity.DistributionDeliveryListEntity; +import com.logpm.distribution.entity.DistributionLoadscanEntity; import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.excel.DistributionDeliveryListExcel; import com.logpm.distribution.vo.*; @@ -405,6 +406,19 @@ public interface IDistributionDeliveryListService extends BaseService selectAbnormalLoadingBydeliveryId(Long deliveryId); + /** * 查询签收预约客户包件信息 diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java index 2a38c4b8f..20ecd7fe8 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java @@ -180,4 +180,10 @@ public interface IDistributionParcelListService extends BaseService findByWaybillNumber(String waybillId); + /** + * 批量还原包件状态 + * @param packageIds + * @return + */ + Integer restorePakcageByIds(List packageIds); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java index 5a71f68d5..680034c36 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java @@ -173,7 +173,7 @@ public interface IDistributionReservationService extends BaseService selectStockupOrderList(Long reservationId,String isZero); - List selectStockupStockList(Long reservationId,Long warehouseId); + List selectStockupStockList(Long reservationId,Long warehouseId,String mallName); Integer selectOrderNumByReservationId(Long reservationId); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSignforService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSignforService.java index cd1d25e66..75ee5e378 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSignforService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSignforService.java @@ -22,6 +22,7 @@ import com.logpm.distribution.dto.DistributionAddvalueDTO; import com.logpm.distribution.dto.DistributionSignforDTO; import com.logpm.distribution.dto.DistrilbutionAppsignforDTO; import com.logpm.distribution.dto.app.DistributionAppDeliveryListDTO; +import com.logpm.distribution.entity.DistributionReservationEntity; import com.logpm.distribution.entity.DistributionSignPrintEntity; import com.logpm.distribution.entity.DistributionSignforEntity; import com.logpm.distribution.excel.DistributionSignforExcel; @@ -244,7 +245,7 @@ public interface IDistributionSignforService extends BaseService selectReservationByDeliveryId(Long deliveryId); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java index 8352d6588..2367447a3 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java @@ -182,6 +182,12 @@ public interface IDistributionStockListService extends BaseService getMerchantStockList(String materielCode); + /** + * 维护库存品的占用数量 + * @param stockListId + * @param quantity + */ + void updateInventoryQuantityOccupied(Long stockListId, Integer quantity); // /** diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistrilbutionBillLadingService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistrilbutionBillLadingService.java index 80fe95b60..a402c65fd 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistrilbutionBillLadingService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistrilbutionBillLadingService.java @@ -214,4 +214,11 @@ public interface IDistrilbutionBillLadingService extends BaseService updateWrapper = new UpdateWrapper<>(); + updateWrapper.lambda().eq(DisStockListDetailEntity::getStockListId,stockListId) + .eq(DisStockListDetailEntity::getReservationId,billLadingId) + .set(DisStockListDetailEntity::getStockPackageStatus,2); + this.update(updateWrapper); + } + /** * 赋值模板转换 * @param id 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 cdf90f44c..e750d1fd8 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 @@ -25,6 +25,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.logpm.aftersales.vo.AftersalesAbnormalPackageVO; import com.logpm.basic.entity.BasicPrintTemplateEntity; import com.logpm.basic.feign.IBasicPrintTemplateClient; @@ -577,8 +578,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl map = new HashMap(); + Map map = new HashMap(); String distrilbutionloadingscanDTOJson = JSONObject.toJSONString(distrilbutionloadingscanDTO); - map.put("distrilbutionloadingscanDTO",distrilbutionloadingscanDTOJson); + map.put("distrilbutionloadingscanDTO", distrilbutionloadingscanDTOJson); String parcelListEntityJson = JSONObject.toJSONString(parcelListEntity); - map.put("parcelListEntity",parcelListEntityJson); - map.put("myCurrentWarehouseId",myCurrentWarehouse.getId()); + map.put("parcelListEntity", parcelListEntityJson); + map.put("myCurrentWarehouseId", myCurrentWarehouse.getId()); String reservationEntityJson = JSONObject.toJSONString(reservationEntity); - map.put("reservationEntity",reservationEntityJson); + map.put("reservationEntity", reservationEntityJson); log.info(">>>>>>>>>>>>> 进入延迟队列处理包件相关信息状态"); @@ -871,7 +872,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl selectDistributionAppDeliveryListPage(IPage page, DistributionAppDeliveryListDTO distributionAppDeliveryListDTO) { - - //获取当前登录人 - BladeUser user = AuthUtil.getUser(); - String roleId = user.getRoleId(); - //判断当前登录人是否为司机 List distributionAppDeliveryListVOS = new ArrayList<>(); - boolean delivery = false; - String value1 = DictBizCache.getValue("role_class", "delivery_driver_new"); - if (roleId.contains(value1)) delivery = true; - - BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); - + try { +//获取当前登录人 + BladeUser user = AuthUtil.getUser(); + String roleId = user.getRoleId(); + //判断当前登录人是否为司机 + boolean delivery = false; + String value1 = DictBizCache.getValue("role_class", "delivery_driver_new"); + if (roleId.contains(value1)) delivery = true; + BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); // R value = dictBizClient.getValue("role_class", roleId); - if (delivery) { - //查询当前登录人的配送任务 - BasicdataDriverArteryEntity driverArtery = iBasicdataDriverArteryClient.getDriverArtery(user.getUserId()); - if (null == driverArtery) { - log.error("没有司机的信息!!"); - return page.setRecords(distributionAppDeliveryListVOS); - } - //查询司机的任务 - List deliveryIds = distributionDeliverySelfMapper.selectdeliveryList(driverArtery.getId()); - if (!deliveryIds.isEmpty()) { - distributionAppDeliveryListVOS = baseMapper.selectDistributionAppDeliveryListPage(page, distributionAppDeliveryListDTO, deliveryIds, myCurrentWarehouse.getId()); + if (delivery) { + //查询当前登录人的配送任务 + BasicdataDriverArteryEntity driverArtery = iBasicdataDriverArteryClient.getDriverArtery(user.getUserId()); + if (null == driverArtery) { + log.error("没有司机的信息!!"); + return page.setRecords(distributionAppDeliveryListVOS); + } + //查询司机的任务 + List deliveryIds = distributionDeliverySelfMapper.selectdeliveryList(driverArtery.getId()); + if (!deliveryIds.isEmpty()) { + distributionAppDeliveryListVOS = baseMapper.selectDistributionAppDeliveryListPage(page, distributionAppDeliveryListDTO, deliveryIds, myCurrentWarehouse.getId()); + } else { + return page.setRecords(distributionAppDeliveryListVOS); + } } else { - return page.setRecords(distributionAppDeliveryListVOS); + distributionAppDeliveryListVOS = baseMapper.selectDistributionAppDeliveryListPage(page, distributionAppDeliveryListDTO, null, myCurrentWarehouse.getId()); } - } else { - distributionAppDeliveryListVOS = baseMapper.selectDistributionAppDeliveryListPage(page, distributionAppDeliveryListDTO, null, myCurrentWarehouse.getId()); - } - //转换字典字段 - for (DistributionAppDeliveryListVO distributionAppDeliveryListVO : distributionAppDeliveryListVOS) { - distributionAppDeliveryListVO.setScannedNumber(getCarLaodNum(distributionAppDeliveryListVO.getId())); - // 调用下 查询装车件数的方法 - //查询备货区 - if (StringUtils.isNotBlank(distributionAppDeliveryListVO.getReservationId())) { - List list = CommonUtil.stringNum(distributionAppDeliveryListVO.getReservationId()); - QueryWrapper queryWrapper = new QueryWrapper(); + log.info(">>>>>>>>>>>>>>>>> distributionAppDeliveryListVOS 司机配送任务列表 {}", distributionAppDeliveryListVOS); + //转换字典字段 + for (DistributionAppDeliveryListVO distributionAppDeliveryListVO : distributionAppDeliveryListVOS) { - if (list.size() > 1) { - queryWrapper.in("reservation_id", list); - } else { - queryWrapper.eq("reservation_id", distributionAppDeliveryListVO.getReservationId()); - } - List list1 = distributionStockupInfoService.list(queryWrapper); - if (!list1.isEmpty()) { - DistributionStockupInfoEntity distributionStockupInfoEntity = list1.get(0); - DistributionStockupEntity distributionStockupEntity = distributionStockupMapper.selectById(distributionStockupInfoEntity.getStockupId()); - if (ObjectUtils.isNotNull(distributionStockupEntity)) { - distributionAppDeliveryListVO.setStockupArea(distributionStockupEntity.getStockupArea()); + distributionAppDeliveryListVO.setScannedNumber(getCarLaodNum(distributionAppDeliveryListVO.getId())); + // 调用下 查询装车件数的方法 + //查询备货区 + if (StringUtils.isNotBlank(distributionAppDeliveryListVO.getReservationId())) { + List list = CommonUtil.stringNum(distributionAppDeliveryListVO.getReservationId()); + QueryWrapper queryWrapper = new QueryWrapper(); + + if (list.size() > 1) { + queryWrapper.in("reservation_id", list); + } else { + queryWrapper.eq("reservation_id", distributionAppDeliveryListVO.getReservationId()); + } + List list1 = distributionStockupInfoService.list(queryWrapper); + if (!list1.isEmpty()) { + DistributionStockupInfoEntity distributionStockupInfoEntity = list1.get(0); + DistributionStockupEntity distributionStockupEntity = distributionStockupMapper.selectById(distributionStockupInfoEntity.getStockupId()); + if (ObjectUtils.isNotNull(distributionStockupEntity)) { + distributionAppDeliveryListVO.setStockupArea(distributionStockupEntity.getStockupArea()); + } else { + distributionAppDeliveryListVO.setStockupArea("无数据"); + } } else { distributionAppDeliveryListVO.setStockupArea("无数据"); } + } + //查询包件签收件数 + Integer lad = distributionLoadscanMapper.selectCount(new QueryWrapper().lambda().eq(DistributionLoadscanEntity::getDeliveryId, distributionAppDeliveryListVO.getId()).eq(DistributionLoadscanEntity::getSignforState, 2)).intValue(); + //查询库存品签收件数 + Integer nad = distributionLoadscaninvnMapper.selectCount(new QueryWrapper().lambda().eq(DistributionLoadscaninvnEntity::getDeliveryId, distributionAppDeliveryListVO.getId()).eq(DistributionLoadscaninvnEntity::getSignforState, 2)).intValue(); + //维护计划数 + List reservationEntityList = baseMapper.selectReservationByDeliveryListId(distributionAppDeliveryListVO.getId()); + if (Func.isNotEmpty(reservationEntityList)) { + int packageNum = reservationEntityList.stream().mapToInt(DistributionReservationEntity::getReservationNum).sum(); + int invertoryNum = reservationEntityList.stream().mapToInt(DistributionReservationEntity::getReservationStockListNum).sum(); + distributionAppDeliveryListVO.setDeliveryNumber(packageNum + invertoryNum); } else { - distributionAppDeliveryListVO.setStockupArea("无数据"); + continue; } - } - //查询包件签收件数 - Integer lad = distributionLoadscanMapper.selectCount(new QueryWrapper().lambda().eq(DistributionLoadscanEntity::getDeliveryId, distributionAppDeliveryListVO.getId()).eq(DistributionLoadscanEntity::getSignforState, 2)).intValue(); - - //查询库存品签收件数 - Integer nad = distributionLoadscaninvnMapper.selectCount(new QueryWrapper().lambda().eq(DistributionLoadscaninvnEntity::getDeliveryId, distributionAppDeliveryListVO.getId()).eq(DistributionLoadscaninvnEntity::getSignforState, 2)).intValue(); - //维护计划数 - List reservationEntityList = baseMapper.selectReservationByDeliveryListId(distributionAppDeliveryListVO.getId()); - if (Func.isNotEmpty(reservationEntityList)) { - int packageNum = reservationEntityList.stream().mapToInt(DistributionReservationEntity::getReservationNum).sum(); - int invertoryNum = reservationEntityList.stream().mapToInt(DistributionReservationEntity::getReservationStockListNum).sum(); - distributionAppDeliveryListVO.setDeliveryNumber(packageNum + invertoryNum); - } else { - return null; - } - distributionAppDeliveryListVO.setSignNub(lad + nad); - //查询完成客户数 - Integer cusCount = baseMapper.selectCompletecusCount(distributionAppDeliveryListVO.getId()); - //查询完成订单数 - AtomicInteger ordCount = new AtomicInteger(); + distributionAppDeliveryListVO.setSignNub(lad + nad); + //查询完成客户数 + Integer cusCount = baseMapper.selectCompletecusCount(distributionAppDeliveryListVO.getId()); + //查询完成订单数 + AtomicInteger ordCount = new AtomicInteger(); // List distributionAppStockArticleVOS = baseMapper.selectDistributionAppDeliveryOrderO(distributionAppDeliveryListVO); - List deliveryStockArticleInfo = baseMapper.getDeliveryStockArticleInfo(distributionAppDeliveryListVO.getId()); + List deliveryStockArticleInfo = baseMapper.getDeliveryStockArticleInfo(distributionAppDeliveryListVO.getId()); // deliveryStockArticleInfo.forEach(); - List distributionReservationEntities = baseMapper.selectReservationByDeliveryListId(distributionAppDeliveryListVO.getId()); - distributionReservationEntities.forEach(r -> { - List reservationStockarticleEntityList = distributionReservationMapper.selectStockArticleByReservationId(r.getId()); - reservationStockarticleEntityList.forEach(rs -> { - List loadscanEntityList = distributionLoadscanService.list(Wrappers.query().lambda().eq(DistributionLoadscanEntity::getDeliveryId, distributionAppDeliveryListVO.getId()).eq(DistributionLoadscanEntity::getOrderId, rs.getStockArticleId()).eq(DistributionLoadscanEntity::getReservationId, rs.getReservationId()).ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())); - if (Func.isNotEmpty(loadscanEntityList)) { - int loadSum = loadscanEntityList.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum(); - if (rs.getReservationNum() == loadSum) { - ordCount.getAndIncrement(); + List distributionReservationEntities = baseMapper.selectReservationByDeliveryListId(distributionAppDeliveryListVO.getId()); + distributionReservationEntities.forEach(r -> { + List reservationStockarticleEntityList = distributionReservationMapper.selectStockArticleByReservationId(r.getId()); + reservationStockarticleEntityList.forEach(rs -> { + List loadscanEntityList = distributionLoadscanService.list(Wrappers.query().lambda().eq(DistributionLoadscanEntity::getDeliveryId, distributionAppDeliveryListVO.getId()).eq(DistributionLoadscanEntity::getOrderId, rs.getStockArticleId()).eq(DistributionLoadscanEntity::getReservationId, rs.getReservationId()).ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())); + if (Func.isNotEmpty(loadscanEntityList)) { + int loadSum = loadscanEntityList.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum(); + if (rs.getReservationNum() == loadSum) { + ordCount.getAndIncrement(); + } } - } + }); }); - }); // distributionReservationMapper.selectPackageByReservationAndStockArticle() // for (DistributionAppStockArticleVO distributionAppStockArticleVO : distributionAppStockArticleVOS) { // if (distributionAppStockArticleVO.getLoadingNub() >= distributionAppStockArticleVO.getReservationNum()) { // ordCount += 1; // } // } - distributionAppDeliveryListVO.setLoadCusNub(cusCount); - distributionAppDeliveryListVO.setLoadOrdNub(ordCount.get()); - //查询下面的预约单 - List distributionSignforEntityList = distributionSignforMapper.selectList(new QueryWrapper().lambda().eq(DistributionSignforEntity::getDeliveryId, distributionAppDeliveryListVO.getId())); - //提取id - List reList = distributionSignforEntityList.stream().map(DistributionSignforEntity::getId).collect(Collectors.toList()); - distributionAppDeliveryListVO.setType_name(dictBizClient.getValue("distribution_type", distributionAppDeliveryListVO.getType()).getData()); - //查询是否配车 - Integer aLong = 0; - Integer aLong2 = 0; - distributionAppDeliveryListVO.setVehicleStatus_name("已配车"); - distributionAppDeliveryListVO.setDeliStatus_name("配送中"); - if (distributionAppDeliveryListVO.getDeliveryStatus().equals("4")) { - distributionAppDeliveryListVO.setDeliStatus_name("完成"); - } - if (distributionAppDeliveryListVO.getKind().equals("1")) { - aLong = distributionDeliverySelfMapper.selectCount(new QueryWrapper().lambda().eq(DistributionDeliverySelfEntity::getDeliveryId, distributionAppDeliveryListVO.getId())).intValue(); - } else { - aLong2 = distributionDeliveryTripartiteMapper.selectCount(new QueryWrapper().lambda().eq(DistributionDeliveryTripartiteEntity::getDeliveryId, distributionAppDeliveryListVO.getId())).intValue(); - } - if (aLong == 0 && aLong2 == 0) { - distributionAppDeliveryListVO.setVehicleStatus_name("未配车"); - } - //查询是否备货 - distributionAppDeliveryListVO.setIsstock("备货未完成"); - List stockEntityList = distributionStockMapper.selectList(new QueryWrapper().lambda().eq(DistributionStockEntity::getReservationId, distributionAppDeliveryListVO.getReservationId())); - if (Func.isNotEmpty(stockEntityList)) { - Integer deliveryNumber = distributionAppDeliveryListVO.getDeliveryNumber(); //配送件数 - int sum = stockEntityList.stream().mapToInt(DistributionStockEntity::getStockQuantity).sum(); - if (sum == deliveryNumber) { - distributionAppDeliveryListVO.setIsstock("备货完成"); + distributionAppDeliveryListVO.setLoadCusNub(cusCount); + distributionAppDeliveryListVO.setLoadOrdNub(ordCount.get()); + //查询下面的预约单 + List distributionSignforEntityList = distributionSignforMapper.selectList(new QueryWrapper().lambda().eq(DistributionSignforEntity::getDeliveryId, distributionAppDeliveryListVO.getId())); + //提取id + List reList = distributionSignforEntityList.stream().map(DistributionSignforEntity::getId).collect(Collectors.toList()); + distributionAppDeliveryListVO.setType_name(dictBizClient.getValue("distribution_type", distributionAppDeliveryListVO.getType()).getData()); + //查询是否配车 + Integer aLong = 0; + Integer aLong2 = 0; + distributionAppDeliveryListVO.setVehicleStatus_name("已配车"); + distributionAppDeliveryListVO.setDeliStatus_name("配送中"); + if (distributionAppDeliveryListVO.getDeliveryStatus().equals("4")) { + distributionAppDeliveryListVO.setDeliStatus_name("完成"); } - } - //查询司机 - List distributionAppDeliverySelfVOS = distributionDeliverySelfMapper.selectListcustom(distributionAppDeliveryListVO.getId()); - if (!distributionAppDeliverySelfVOS.isEmpty()) { - StringBuilder stringBuilder = new StringBuilder(); - distributionAppDeliverySelfVOS.forEach(e -> { - if (e.getIsMaster() == 2) { - stringBuilder.append(e.getDriverName()).append("(主)"); - } else { - stringBuilder.append(e.getDriverName()).append("(副)"); + if (distributionAppDeliveryListVO.getKind().equals("1")) { + aLong = distributionDeliverySelfMapper.selectCount(new QueryWrapper().lambda().eq(DistributionDeliverySelfEntity::getDeliveryId, distributionAppDeliveryListVO.getId())).intValue(); + } else { + aLong2 = distributionDeliveryTripartiteMapper.selectCount(new QueryWrapper().lambda().eq(DistributionDeliveryTripartiteEntity::getDeliveryId, distributionAppDeliveryListVO.getId())).intValue(); + } + if (aLong == 0 && aLong2 == 0) { + distributionAppDeliveryListVO.setVehicleStatus_name("未配车"); + } + //查询是否备货 + distributionAppDeliveryListVO.setIsstock("备货未完成"); + List stockEntityList = distributionStockMapper.selectList(new QueryWrapper().lambda().eq(DistributionStockEntity::getReservationId, distributionAppDeliveryListVO.getReservationId())); + if (Func.isNotEmpty(stockEntityList)) { + Integer deliveryNumber = distributionAppDeliveryListVO.getDeliveryNumber(); //配送件数 + int sum = stockEntityList.stream().mapToInt(DistributionStockEntity::getStockQuantity).sum(); + if (sum == deliveryNumber) { + distributionAppDeliveryListVO.setIsstock("备货完成"); } - }); - distributionAppDeliveryListVO.setDriverName(stringBuilder.toString()); + } + //查询司机 + List distributionAppDeliverySelfVOS = distributionDeliverySelfMapper.selectListcustom(distributionAppDeliveryListVO.getId()); + if (!distributionAppDeliverySelfVOS.isEmpty()) { + StringBuilder stringBuilder = new StringBuilder(); + distributionAppDeliverySelfVOS.forEach(e -> { + if (e.getIsMaster() == 2) { + stringBuilder.append(e.getDriverName()).append("(主)"); + } else { + stringBuilder.append(e.getDriverName()).append("(副)"); + } + }); + distributionAppDeliveryListVO.setDriverName(stringBuilder.toString()); + } } + } catch (Exception e) { + log.error(">>>>>>>> 司机配送装车查询 报错", e); } return page.setRecords(distributionAppDeliveryListVOS); + } @Override @@ -3020,9 +3024,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl distributionParcelListEntities = distributionParcelListService.list(Wrappers.query().lambda().eq(DistributionParcelListEntity::getStockArticleId, s.getId()).ne(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.yizhuangche.getValue()).ne(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.yiyueyue.getValue()).notIn(DistributionParcelListEntity::getOrderPackageStatus, new String[]{OrderPackageStatusConstant.yichuku.getValue(), OrderPackageStatusConstant.yiqianshou.getValue()})); if (Func.isEmpty(distributionParcelListEntities)) { log.error("##############添加空订单"); - throw new RuntimeException(s.getOrderCode()+"无可用包件!!!"); + throw new RuntimeException(s.getOrderCode() + "无可用包件!!!"); } distributionParcelListEntities.forEach(dp -> { if (!dp.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) { @@ -3164,9 +3168,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl { if (Func.isEmpty(oldPackageList.get(p.getId()))) { - if (Func.isNotEmpty(signforEntity) && signforEntity.getSigningStatus().equals(SignforStatusConstant.yiqianshou.getValue())){ - log.error("#############商配文员对已复核预约进行订单追加reservationId:{}",reservationEntity.getId()); - throw new RuntimeException("收货单位:"+reservationEntity.getMallName()+"客户:"+reservationEntity.getConsignee()+"完成复核签收,无法追加订单"); + if (Func.isNotEmpty(signforEntity) && signforEntity.getSigningStatus().equals(SignforStatusConstant.yiqianshou.getValue())) { + log.error("#############商配文员对已复核预约进行订单追加reservationId:{}", reservationEntity.getId()); + throw new RuntimeException("收货单位:" + reservationEntity.getMallName() + "客户:" + reservationEntity.getConsignee() + "完成复核签收,无法追加订单"); } //为该订单新增了包件 DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity(); @@ -3186,9 +3190,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl { - if (Func.isNotEmpty(signforEntity) && signforEntity.getSigningStatus().equals(SignforStatusConstant.yiqianshou.getValue())){ - log.error("#############商配文员对已复核预约进行订单追加reservationId:{}",reservationEntity.getId()); - throw new RuntimeException("收货单位:"+reservationEntity.getMallName()+"客户:"+reservationEntity.getConsignee()+"完成复核签收,无法追加订单"); + if (Func.isNotEmpty(signforEntity) && signforEntity.getSigningStatus().equals(SignforStatusConstant.yiqianshou.getValue())) { + log.error("#############商配文员对已复核预约进行订单追加reservationId:{}", reservationEntity.getId()); + throw new RuntimeException("收货单位:" + reservationEntity.getMallName() + "客户:" + reservationEntity.getConsignee() + "完成复核签收,无法追加订单"); } DistributionReservationPackageEntity reservationPackageEntity = b.get(0); reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.quxiao.getValue()); @@ -3285,9 +3289,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl { - if (Func.isNotEmpty(signforEntity) && signforEntity.getSigningStatus().equals(SignforStatusConstant.yiqianshou.getValue())){ - log.error("#############商配文员对已复核预约进行订单追加reservationId:{}",reservationEntity.getId()); - throw new RuntimeException("收货单位:"+reservationEntity.getMallName()+"客户:"+reservationEntity.getConsignee()+"完成复核签收,无法追加订单"); + if (Func.isNotEmpty(signforEntity) && signforEntity.getSigningStatus().equals(SignforStatusConstant.yiqianshou.getValue())) { + log.error("#############商配文员对已复核预约进行订单追加reservationId:{}", reservationEntity.getId()); + throw new RuntimeException("收货单位:" + reservationEntity.getMallName() + "客户:" + reservationEntity.getConsignee() + "完成复核签收,无法追加订单"); } DistributionReservationStockarticleEntity reservationStockarticleEntity = n.get(0); if (reservationStockarticleEntity.getIsZero().equals(IsOrNoConstant.no.getValue())) { @@ -4169,16 +4173,16 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl orderIds = reservationStockarticleEntityList.stream().filter(order -> order.getIsZero().equals(IsOrNoConstant.no.getValue())).map(DistributionReservationStockarticleEntity::getStockArticleId).collect(Collectors.toList()); if (Func.isNotEmpty(orderIds)) { //查询该客户的非零但订单包间 - IPage parcelListEntityList = distributionReservationMapper.getReservationPackage(page,orderIds, distributionDeliveryInfoDTO); + IPage parcelListEntityList = distributionReservationMapper.getReservationPackage(page, orderIds, distributionDeliveryInfoDTO); parcelListVOIPage.setTotal(parcelListEntityList.getTotal()); // List parcelListEntityList = distributionReservationMapper.getReservationPackageNew(distributionDeliveryInfoDTO); - log.info(">>>>>> parcelListEntityList {}",parcelListEntityList); + log.info(">>>>>> parcelListEntityList {}", parcelListEntityList); List parcelListVOList = DistributionParcelListWrapper.build().listVO(parcelListEntityList.getRecords()); for (DistributionParcelListVO distributionParcelListVO : parcelListVOList) { - log.info(">>>>>> distributionParcelListVO {}",distributionParcelListVO); + log.info(">>>>>> distributionParcelListVO {}", distributionParcelListVO); if (Func.isNotEmpty(loadingDataMap)) { DistributionLoadscanEntity loadscanEntity = loadingDataMap.get(distributionParcelListVO.getId()); - log.info(">>>>>> loadscanEntity {}",loadscanEntity); + log.info(">>>>>> loadscanEntity {}", loadscanEntity); if (Func.isNotEmpty(loadscanEntity)) { if (loadscanEntity.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())) { @@ -4224,7 +4228,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl>>>>> distributionParcelListVO2 {}",distributionParcelListVO); + log.info(">>>>>> distributionParcelListVO2 {}", distributionParcelListVO); distributionParcelListVOS.add(distributionParcelListVO); } @@ -5134,7 +5138,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl parcelListEntities = distributionParcelListService.list(Wrappers.query().lambda().eq(DistributionParcelListEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode())); if (Func.isNotEmpty(parcelListEntities) && parcelListEntities.size() == 1) { DistributionParcelListEntity parcelListEntity = parcelListEntities.get(0); - if (OrderPackageLoadingStatusConstant.yizhuangche.getValue().equals(parcelListEntity.getOrderPackageLoadingStatus())){ + if (OrderPackageLoadingStatusConstant.yizhuangche.getValue().equals(parcelListEntity.getOrderPackageLoadingStatus())) { //包件已装车 log.error("重复异常装车,:{}", parcelListEntity.getOrderPackageCode()); return Resp.scanFail("操作失败", "包件已装车"); @@ -5289,13 +5293,13 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl parcelListEntityLambdaQueryWrapper = Wrappers.query().lambda() - .notIn(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue(),OrderPackageStatusConstant.yichuku.getValue()) + .notIn(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue(), OrderPackageStatusConstant.yichuku.getValue()) .ne(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.yizhuangche.getValue()) .eq(DistributionParcelListEntity::getStockArticleId, orderId); - if (Func.isNotEmpty(reservationPackageList)){ + if (Func.isNotEmpty(reservationPackageList)) { List packageIds = reservationPackageList.stream().map(DistributionParcelListEntity::getId).collect(Collectors.toList()); - if (Func.isNotEmpty(packageIds)){ - parcelListEntityLambdaQueryWrapper.notIn(DistributionParcelListEntity::getId,packageIds); + if (Func.isNotEmpty(packageIds)) { + parcelListEntityLambdaQueryWrapper.notIn(DistributionParcelListEntity::getId, packageIds); } } List parcelListEntities = distributionParcelListService.list(parcelListEntityLambdaQueryWrapper); @@ -6474,7 +6478,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl reservationEntities = distributionSignforService.selectReservationByDeliveryId(deliveryId); + if (Func.isEmpty(reservationEntities)) { + log.info(method + "预约查询失败:{}", deliveryId); + return R.fail("服务器正忙!!!"); + } + String reservationCodes = reservationEntities.stream().filter(f -> !f.getLoadingStatus().equals(ReservationLoadingStatusConstant.daizhuangche.getValue())).map(DistributionReservationEntity::getReservationCode).collect(Collectors.joining(",")); + if (Func.isNotEmpty(reservationCodes)) { + log.info(method + "存在装车数据:{}", reservationCodes); + return R.fail(deliveryListEntity.getTrainNumber() + "存在装车包件!!!"); + } + //该配送是否存在异常装车或者异常签收数据 + List loadscanEntityList = distributionDeliveryListService.selectAbnormalLoadingBydeliveryId(deliveryId); + if (Func.isNotEmpty(loadscanEntityList)) { + log.info(method + "存在异常装车数据:{}", deliveryId); + return R.fail(reservationCodes + "存在异常装车、签收包条!!!"); + } + boolean flag = false; + for (DistributionReservationEntity reservationEntity : reservationEntities) { + DistributionReservationDTO reservationDTO = Func.copy(reservationEntity, DistributionReservationDTO.class); + flag = distributionReservationService.cancelReservation(reservationDTO); + if (!flag) { + log.info(method + "取消预约失败:{}", deliveryId); + throw new RuntimeException("取消配送计划失败,请联系管理员"); + } + } + return R.status(flag); + } + + @Override + public List selectAbnormalLoadingBydeliveryId(Long deliveryId) { + return distributionLoadscanService.list(Wrappers.query().lambda() + .eq(DistributionLoadscanEntity::getDeliveryId, deliveryId) + .eq(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) + .eq(DistributionLoadscanEntity::getIsAbnormalLoading, 2) + ); + } + @Override @Transactional public void maintenanceDeliveryInfo(Long deliveryId) { @@ -6798,10 +6850,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl list = distributionSignforService.list(Wrappers.query().lambda() .eq(DistributionSignforEntity::getDeliveryId, deliveryId) ); - if (!list.isEmpty()){ + if (!list.isEmpty()) { //查看所有的签收信息是否均已完成 boolean anyMatch = list.stream().allMatch(s -> s.getSigningStatus().equals(SignforStatusConstant.yiqianshou.getValue())); - if (anyMatch){ + if (anyMatch) { deliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.yiwancheng.getValue()); } } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java index 355646611..561615268 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java @@ -926,4 +926,9 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl packageIds) { + return baseMapper.restorePakcageByIds(packageIds); + } + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java index 36367e490..9e696e6ee 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java @@ -2863,8 +2863,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl selectStockupStockList(Long reservationId,Long warehouseId) { - return baseMapper.selectStockupStockListNew(reservationId,warehouseId); + public List selectStockupStockList(Long reservationId,Long warehouseId,String mallName) { + return baseMapper.selectStockupStockListNew(reservationId,warehouseId,mallName); } @Override 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 43f09fb90..34be9e4fd 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 @@ -218,10 +218,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl disStockListDetailEntities = distributionReservationMapper.selectInventoryListByReservation(d.getReservationId()); if (Func.isNotEmpty(disStockListDetailEntities)){ @@ -392,7 +389,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl selectReservationByDeliveryId(Long deliveryId) { + + return baseMapper.selectReservationByDeliveryId(deliveryId); + } + private boolean judgmentSignIsHavePackage(Long reservationId) { boolean flag = false; List distributionParcelListEntities = distributionReservationMapper.selectPackageListByReservationId(reservationId); @@ -4120,6 +4126,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl listAllocation(IPage page, Map distributionStockList) { DistributionStockListEntity distributionStockListEntity = JSONObject.parseObject(JSONObject.toJSONString(distributionStockList), DistributionStockListEntity.class); - return baseMapper.listAllocation(page,distributionStockListEntity); + IPage pageList = null; + Long marketId = distributionStockListEntity.getMarketId(); + Long materialId = distributionStockListEntity.getMaterialId(); + String incomingBatch = distributionStockListEntity.getIncomingBatch(); + Long warehouseId = distributionStockListEntity.getWarehouseId(); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("market_id",marketId) + .eq("material_id",materialId) + .eq("incoming_batch",incomingBatch) + .eq("warehouse_id",warehouseId); + distributionStockListEntity = getOne(queryWrapper); + + if(Objects.isNull(distributionStockListEntity)){ + log.warn("##################listAllocation: 库存品信息不存在"); + return null; + } + String sourceType = distributionStockListEntity.getSourceType(); + if("1".equals(sourceType)){ + pageList = baseMapper.listAllocationOrder(page,distributionStockListEntity); + }else{ + pageList = baseMapper.listAllocation(page,distributionStockListEntity); + } + + return pageList; } @Override @@ -681,6 +704,16 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl selectDistributionStockupPage(IPage page, DistributionStockupVO distributionStockup) { @@ -1135,10 +1140,27 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl selectStockupStockList(StockupDTO stockupDTO) { - - + BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); + if (Func.isEmpty(myCurrentWarehouse)){ + log.error("###########myCurrentWarehouse:{}",myCurrentWarehouse); + return null; + } Long reservationId = stockupDTO.getReservationId();//预约单id DistributionReservationEntity reservationEntity = distributionReservationService.getById(reservationId); + if (Func.isEmpty(reservationEntity)){ + log.error("###########查询预约失败reservationId:{}",reservationId); + return null; + } + String mallName = reservationEntity.getMallName(); + if (Func.isBlank(mallName)){ + //预约商场名称为空 查看是否存在商场ID + if (Func.isNotEmpty(reservationEntity.getMallId())){ + BasicdataClientEntity basicdataClientEntity = basicdataClientClient.getMallById(reservationEntity.getMallId()); + mallName = basicdataClientEntity.getClientName(); + }else { + log.error("###########预约单无商场信息:{}",reservationId); + } + } if (stockupDTO.getTypeService().equals("3")) { //自 @@ -1167,30 +1189,29 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl list = distributionReservationService.selectStockupStockList(reservationId,reservationEntity.getWarehouseId()); - for (int i = 0; i < list.size(); i++) { - DistributionStockupStockListVO distributionStockupStockListVO = list.get(i); - if (distributionStockupStockListVO.getPlanNum().equals(distributionStockupStockListVO.getRealNum())) { - distributionStockupStockListVO.setCompleteStact(true); - } - if (Func.isNotEmpty(distributionStockupStockListVO.getAllocations())){ - - String[] ids = distributionStockupStockListVO.getAllocations().split(","); - List allocationInforByIds = warehouseGoodsAllocationClient.getAllocationInforByIds(ids); - - for (WarehouseGoodsAllocationEntity allocationInforById : allocationInforByIds) { - if (distributionStockupStockListVO.getAllocationList() == null) { - distributionStockupStockListVO.setAllocationList(new ArrayList<>()); - } - Map map = new HashMap<>(); - map.put("id", allocationInforById.getId()); - map.put("name", allocationInforById.getQrCode()); - distributionStockupStockListVO.getAllocationList().add(map); - } - } - - - } + List list = distributionReservationService.selectStockupStockList(reservationId,myCurrentWarehouse.getId(),mallName); + for (DistributionStockupStockListVO distributionStockupStockListVO : list) { + if (distributionStockupStockListVO.getPlanNum().equals(distributionStockupStockListVO.getRealNum())) { + distributionStockupStockListVO.setCompleteStact(true); + } + if (Func.isNotEmpty(distributionStockupStockListVO.getAllocations())) { + + String[] ids = distributionStockupStockListVO.getAllocations().split(","); + List allocationInforByIds = warehouseGoodsAllocationClient.getAllocationInforByIds(ids); + + for (WarehouseGoodsAllocationEntity allocationInforById : allocationInforByIds) { + if (distributionStockupStockListVO.getAllocationList() == null) { + distributionStockupStockListVO.setAllocationList(new ArrayList<>()); + } + Map map = new HashMap<>(); + map.put("id", allocationInforById.getId()); + map.put("name", allocationInforById.getQrCode()); + distributionStockupStockListVO.getAllocationList().add(map); + } + } + + + } return list; } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java index 8a37cf6a6..393b59ef0 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java @@ -21,6 +21,7 @@ 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.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils; @@ -101,6 +102,8 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl orderList = new ArrayList<>(); - List packageList = new ArrayList<>(); - if(!list.isEmpty()){ - list.forEach(i ->{ - if("2".equals(i.getConditions())){ + List packageList = new ArrayList<>(); + if (!list.isEmpty()) { + list.forEach(i -> { + if ("2".equals(i.getConditions())) { throw new ServiceException("包含已提货的订单,不能取消全部订单"); } //取消订单预约信息 @@ -167,88 +170,89 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl collect = listPackage.stream().filter(a -> a.getStockArticleId().equals(i.getStockArticleId())).map(DistrilbutionBillPackageEntity::getParceListId).collect(Collectors.toList()); packageList.addAll(collect); }); - try{ + try { //修改订单状态 - if(!orderList.isEmpty()){ + if (!orderList.isEmpty()) { LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.in(DistributionStockArticleEntity::getId,orderList); - updateWrapper.set(DistributionStockArticleEntity::getReservationStatus,OrderReservationStatusConstant.bufenyuyue.getValue()); + updateWrapper.in(DistributionStockArticleEntity::getId, orderList); + updateWrapper.set(DistributionStockArticleEntity::getReservationStatus, OrderReservationStatusConstant.bufenyuyue.getValue()); distributionStockArticleService.update(updateWrapper); LambdaUpdateWrapper updateWrapper1 = new LambdaUpdateWrapper<>(); - updateWrapper1.in(DistrilbutionBillStockEntity::getStockArticleId,orderList); - updateWrapper1.set(DistrilbutionBillStockEntity::getOrderStatus,"3"); + updateWrapper1.in(DistrilbutionBillStockEntity::getStockArticleId, orderList); + updateWrapper1.set(DistrilbutionBillStockEntity::getOrderStatus, "3"); distrilbutionBillStockService.update(updateWrapper1); } //修改包件预约状态 - if(!packageList.isEmpty()){ + if (!packageList.isEmpty()) { LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.in(DistributionParcelListEntity::getId,packageList); - updateWrapper.set(DistributionParcelListEntity::getOrderPackageReservationStatus,OrderPackageReservationStatusConstant.daiyuyue.getValue()); + updateWrapper.in(DistributionParcelListEntity::getId, packageList); + updateWrapper.set(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue()); distributionParcelListService.update(updateWrapper); LambdaUpdateWrapper updateWrapper1 = new LambdaUpdateWrapper<>(); - updateWrapper1.in(DistrilbutionBillPackageEntity::getParceListId,packageList); - updateWrapper1.set(DistrilbutionBillPackageEntity::getPacketBarStatus,"2"); + updateWrapper1.in(DistrilbutionBillPackageEntity::getParceListId, packageList); + updateWrapper1.set(DistrilbutionBillPackageEntity::getPacketBarStatus, "2"); distrilbutionBillPackageService.update(updateWrapper1); } - }catch (Exception e){ - log.error("自提取消订单报错!{}",e.getMessage()); + } catch (Exception e) { + log.error("自提取消订单报错!{}", e.getMessage()); throw new ServiceException("系统异常!!"); } } } + //判断有没有库存品数据 - private void updateStockBill(DistrilbutionBillLadingDTO distrilbutionBillLading){ + private void updateStockBill(DistrilbutionBillLadingDTO distrilbutionBillLading) { List list = distributionDeliveryDetailsService.list(Wrappers.query().lambda() .eq(DistributionDeliveryDetailsEntity::getBillLadingId, distrilbutionBillLading.getId()) .apply("inventory_status in ( 1 , 2)") ); List stockEntityList = new ArrayList<>(); List dd = new ArrayList<>(); - if(!list.isEmpty()){ - list.forEach(i ->{ - if("2".equals(i.getConditions())){ + if (!list.isEmpty()) { + list.forEach(i -> { + if ("2".equals(i.getConditions())) { throw new ServiceException("包含已提货的库存品,无法取消!!!"); } - if("1".equals(i.getStockStatus())){ + if ("1".equals(i.getStockStatus())) { DistributionStockListEntity stockEntity = new DistributionStockListEntity(); stockEntity.setId(i.getStockListId()); stockEntity.setQuantityStock(i.getQuantity()); stockEntityList.add(stockEntity); dd.add(i.getId()); - }else{ + } else { throw new ServiceException("包含已备货的库存品,无法取消!!!"); } }); try { - if(!dd.isEmpty()){ + if (!dd.isEmpty()) { //取消预约记录 LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.in(DistributionDeliveryDetailsEntity::getId,dd); - updateWrapper.set(DistributionDeliveryDetailsEntity::getInventoryStatus,"3"); + updateWrapper.in(DistributionDeliveryDetailsEntity::getId, dd); + updateWrapper.set(DistributionDeliveryDetailsEntity::getInventoryStatus, "3"); distributionDeliveryDetailsService.update(updateWrapper); } //修改库存品数据 - if(!stockEntityList.isEmpty()){ - stockEntityList.forEach( i ->{ + if (!stockEntityList.isEmpty()) { + stockEntityList.forEach(i -> { DistributionStockListEntity byId = distributionStockListService.getById(i.getId()); DistributionStockListEntity updateWrapper = new DistributionStockListEntity(); updateWrapper.setId(i.getId()); - updateWrapper.setQuantityStock(i.getQuantityStock()+byId.getQuantityStock()); + updateWrapper.setQuantityStock(i.getQuantityStock() + byId.getQuantityStock()); distributionStockListService.updateById(updateWrapper); }); } - }catch (Exception e){ - log.error("取消库存品报错!!{}",e.getMessage()); + } catch (Exception e) { + log.error("取消库存品报错!!{}", e.getMessage()); throw new ServiceException("系统异常!!"); } } } - /** * 提货单 新增或修改 + * * @param distrilbutionBillLading * @return */ @@ -259,13 +263,13 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl list = distrilbutionBillStockService.list(Wrappers.query().lambda() - .eq(!distrilbutionBillLading.getStockArticleId().contains(","),DistrilbutionBillStockEntity::getStockArticleId, distrilbutionBillLading.getStockArticleId()) - .in(distrilbutionBillLading.getStockArticleId().contains(","),DistrilbutionBillStockEntity::getStockArticleId, distrilbutionBillLading.getStockArticleId().split(",")) + .eq(!distrilbutionBillLading.getStockArticleId().contains(","), DistrilbutionBillStockEntity::getStockArticleId, distrilbutionBillLading.getStockArticleId()) + .in(distrilbutionBillLading.getStockArticleId().contains(","), DistrilbutionBillStockEntity::getStockArticleId, distrilbutionBillLading.getStockArticleId().split(",")) ); - if(!list.isEmpty()){ + if (!list.isEmpty()) { for (DistrilbutionBillStockEntity i : list) { DistributionStockArticleEntity byId = distributionStockArticleService.getById(i.getStockArticleId()); - if(byId.getStockupStatus().equals(OrderReservationStatusConstant.daiyuyue.getValue())){ + if (byId.getStockupStatus().equals(OrderReservationStatusConstant.daiyuyue.getValue())) { break; } List list1 = distributionParcelListService.list(Wrappers.query().lambda() .eq(DistributionParcelListEntity::getStockArticleId, i.getStockArticleId())); int sum = list1.stream().filter(ii -> ii.getOrderPackageReservationStatus().equals(OrderPackageReservationStatusConstant.daiyuyue.getValue())).collect(Collectors.toList()).stream().mapToInt(DistributionParcelListEntity::getQuantity).sum(); - if(sum == 0){ - log.debug("####{}当前订单备货包件为空,无法创建任务!",byId.getOrderCode()); - throw new ServiceException(byId.getOrderCode()+"当前订单备货包件为空,无法创建任务!"); + if (sum == 0) { + log.debug("####{}当前订单备货包件为空,无法创建任务!", byId.getOrderCode()); + throw new ServiceException(byId.getOrderCode() + "当前订单备货包件为空,无法创建任务!"); } } @@ -466,9 +470,9 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl packageEntityList = new ArrayList<>(); - if(ObjectUtils.isNotNull(distrilbutionBillLading.getBillPackageEntityList())){ + if (ObjectUtils.isNotNull(distrilbutionBillLading.getBillPackageEntityList())) { //添加自提包件信息 // List collect = new ArrayList<>(); List collect = distrilbutionBillLading.getBillPackageEntityList().stream().filter(qqq -> qqq.getStockArticleId().toString().equals(s)).collect(Collectors.toList()); - if(!collect.isEmpty()){ + if (!collect.isEmpty()) { //有包件 - collect.stream().forEach(ss ->{ + collect.stream().forEach(ss -> { DistrilbutionBillPackageEntity billPackageEntity = new DistrilbutionBillPackageEntity(); billPackageEntity.setBillLadingId(distrilbutionBillLading.getId()); billPackageEntity.setPacketBarCode(ss.getPacketBarCode()); @@ -514,25 +518,25 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl 0){ + if (i > 0) { //部分 distributionStockArticle.setReservationStatus(OrderReservationStatusConstant.bufenyuyue.getValue()); } - }else{ + } else { //没有包件 查询包件信息 List packageEntityList1 = billPackInfo(s, distrilbutionBillLading.getId(), parcelLisList, byId); - if(packageEntityList1.isEmpty()){ - throw new ServiceException(byId.getOrderCode()+"没有可用包件信息!"); + if (packageEntityList1.isEmpty()) { + throw new ServiceException(byId.getOrderCode() + "没有可用包件信息!"); } packageEntityList.addAll(packageEntityList1); // distributionStockArticle.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue()); } - }else{ + } else { //没有包件 查询包件信息 - List packageEntityList1 = billPackInfo(s,distrilbutionBillLading.getId(),parcelLisList,byId); - if(packageEntityList1.isEmpty()){ - throw new ServiceException(byId.getOrderCode()+"没有可用包件信息!"); + List packageEntityList1 = billPackInfo(s, distrilbutionBillLading.getId(), parcelLisList, byId); + if (packageEntityList1.isEmpty()) { + throw new ServiceException(byId.getOrderCode() + "没有可用包件信息!"); } packageEntityList.addAll(packageEntityList1); @@ -540,11 +544,11 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl parcelNumberList = distributionParcelNumberService.list(Wrappers.query().lambda() .eq(DistributionParcelNumberEntity::getStockArticleId, s) ); - if(!parcelNumberList.isEmpty()){ + if (!parcelNumberList.isEmpty()) { //零担 int handQuantity = parcelNumberList.stream().mapToInt(DistributionParcelNumberEntity::getHandQuantity).sum(); //在库总数量 int sum = parcelNumberList.stream().mapToInt(DistributionParcelNumberEntity::getDeliveryQuantity).sum(); //配送数量 int i = handQuantity - sum; - if(i > 0){ + if (i > 0) { //部分 distributionStockArticle.setReservationStatus(OrderReservationStatusConstant.bufenyuyue.getValue()); - }else if(i == 0){ + } else if (i == 0) { //全部 distributionStockArticle.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue()); } @@ -622,8 +626,6 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl printEntityList = distributionPrintService.list(Wrappers.query().lambda().eq(DistributionPrintEntity::getBillLadingId, distrilbutionBillLading.getId())); if (!printEntityList.isEmpty()) { @@ -636,7 +638,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl ids = Func.toLongList(",", billLodingIds); + List distrilbutionBillLadingEntities = this.listByIds(ids); + if (Func.isEmpty(distrilbutionBillLadingEntities)) { + log.error(method + "查询自提单信息失败:{}", billLodingIds); + return R.fail("服务器正忙,请联系管理员!!!"); + } + String errorBillLading = distrilbutionBillLadingEntities.stream().filter(f -> !f.getConditions().equals(BillLadingStatusConstant.daitihuo.getValue())).map(DistrilbutionBillLadingEntity::getPickupBatch).collect(Collectors.joining(",")); + if (Func.isNotEmpty(errorBillLading)) { + log.error(method + "存在已提货或签收自提单:{}", errorBillLading); + return R.fail(errorBillLading + "已提货或已签收!!!"); + } + //查询是否存在自提扫描的有效包件 + List ladingScanEntities = distributionBillLadingScanService.list(Wrappers.query().lambda() + .in(DistributionBillLadingScanEntity::getBillLadingId, ids) + ); + if (Func.isNotEmpty(ladingScanEntities)) { + log.error(method + "取消自提单存在自提扫描数据:{}", errorBillLading); + return R.fail(errorBillLading + "已提货或已签收!!!"); + } + //满足进行取消自提,进行自提单的资源释放 + //直接对配送的包件和库存品进行取消 + Integer a = this.cancelBillLodingPackage(ids); + switch (a) { + case 0: + //进行自提单的取消 + this.removeBatchByIds(ids); + return R.status(true); + case 1: + return R.fail("未授权!!!"); + case 2: + return R.fail("存在签收包件"); + } + return R.status(false); + } + + @Transactional + private Integer cancelBillLodingPackage(List ids) { + String method = "##########类DistrilbutionBillLadingServiceImpl执行方法cancelBillLoding,"; + BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); + if (Func.isEmpty(myCurrentWarehouse)) { + //未授权 + return 1; + } + //查询关联包件进行状态恢复 + List distributionParcelListEntities = baseMapper.selectBillLadingPackage(ids); + if (Func.isNotEmpty(distributionParcelListEntities)) { + List signingPakcage = distributionParcelListEntities.stream().filter(f -> f.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())).collect(Collectors.toList()); + if (Func.isNotEmpty(signingPakcage)) { + //存在签收包件 + return 2; + } + //取消包件 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.lambda() + .in(DistrilbutionBillPackageEntity::getBillLadingId,ids) + .set(DistrilbutionBillPackageEntity::getPacketBarStatus,"3") + ; + distrilbutionBillPackageService.update(updateWrapper); + + //取消订单 + UpdateWrapper orderUpdateWrapper = new UpdateWrapper<>(); + orderUpdateWrapper.lambda() + .in(DistrilbutionBillStockEntity::getBillLadingId,ids) + .set(DistrilbutionBillStockEntity::getOrderStatus,"3") + ; + distrilbutionBillStockService.update(orderUpdateWrapper); + + List packageIds = distributionParcelListEntities.stream().map(DistributionParcelListEntity::getId).collect(Collectors.toList()); + //将这些包件还原成可操作状态 + Integer num = distributionParcelListService.restorePakcageByIds(packageIds); + //维护订单状态 + String orderCodes = distributionParcelListEntities.stream().map(DistributionParcelListEntity::getOrderCode).distinct().collect(Collectors.joining(",")); + distributionStockArticleService.maintenanceOrderInfo(orderCodes, myCurrentWarehouse.getId()); + } + //取消库存品 + //查询自提库存品信息 + List distributionStockListEntities = baseMapper.selectBillLadingInventory(ids); + if (Func.isNotEmpty(distributionStockListEntities)) { + //已经备货的库存品 存在库存品包件 + distributionStockListEntities.forEach(ddd -> { + //恢复库存品数量 + distributionStockListService.updateInventoryQuantityOccupied(ddd.getStockListId(),ddd.getQuantity()); + //进行库存品包件取消 + if (ddd.getStockStatus().equals("3")) { + disStockListDetailService.cancelInventoryPackageByReservationIdAnStockListId(ddd.getStockListId(), ddd.getBillLadingId()); + } + + } + ); + + + //对所有的库存品相关进行取消标识 + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.lambda() + .set(DistributionDeliveryDetailsEntity::getInventoryStatus, 3) + .set(DistributionDeliveryDetailsEntity::getQuantity, 0) + .in(DistributionDeliveryDetailsEntity::getBillLadingId, ids); + distributionDeliveryDetailsService.update(updateWrapper); + } + return 0; + } + /** * 自提没有包件信息添加包件 + * * @param stockArticleId * @param billId * @param parcelLisList * @param byId * @return */ - public List billPackInfo(String stockArticleId,Long billId,List parcelLisList,DistributionStockArticleEntity byId){ + public List billPackInfo(String stockArticleId, Long billId, List parcelLisList, DistributionStockArticleEntity byId) { List packageEntityList = new ArrayList<>(); //没有包件 查询待预约包件信息 List list1 = distributionParcelListService.list(Wrappers.query().lambda() .eq(DistributionParcelListEntity::getStockArticleId, stockArticleId) .eq(DistributionParcelListEntity::getConditions, 1) - .eq(DistributionParcelListEntity::getOrderPackageReservationStatus,OrderPackageReservationStatusConstant.daiyuyue.getValue()) + .eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue()) ); List list = distrilbutionBillPackageService.list(Wrappers.query().lambda() .eq(DistrilbutionBillPackageEntity::getBillLadingId, billId) .apply("packet_bar_status in ( 1 , 3 )") ); - if(!list1.isEmpty()){ - list1.forEach(ss ->{ + if (!list1.isEmpty()) { + list1.forEach(ss -> { Optional first1 = list.stream().filter(q -> q.getParceListId().equals(ss.getId())).findFirst(); - if(!first1.isPresent()){ + if (!first1.isPresent()) { DistrilbutionBillPackageEntity billPackageEntity = new DistrilbutionBillPackageEntity(); billPackageEntity.setBillLadingId(billId); billPackageEntity.setPacketBarCode(ss.getOrderPackageCode()); billPackageEntity.setPacketBarStatus(1); billPackageEntity.setParceListId(ss.getId()); billPackageEntity.setStockArticleId(ss.getStockArticleId()); - if(byId.getIsZero().equals("1")){ + if (byId.getIsZero().equals("1")) { //零担 Optional first = parcelLisList.stream().filter(i -> i.getStockArticleId().equals(ss.getStockArticleId()) && i.getId().equals(ss.getId())).findFirst(); billPackageEntity.setBillType("2"); billPackageEntity.setPacketNumber(first.get().getQuantity()); - }else{ + } else { billPackageEntity.setBillType("1"); billPackageEntity.setPacketNumber(ss.getQuantity()); } @@ -696,29 +804,29 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl{ + public Boolean updateBillPackeg(DistrilbutionBillLadingDTO distrilbutionBillLading) { + distrilbutionBillLading.getBillPackageEntityList().stream().collect(Collectors.groupingBy(DistrilbutionBillPackageEntity::getStockArticleId)) + .forEach((k, v) -> { List list = distrilbutionBillPackageService.list(Wrappers.query().lambda() .eq(DistrilbutionBillPackageEntity::getBillLadingId, distrilbutionBillLading.getId()) .eq(DistrilbutionBillPackageEntity::getStockArticleId, k) ); //没有数据 - if(list.isEmpty()){ + if (list.isEmpty()) { throw new ServiceException("没有包件数据!"); } List sc = new ArrayList<>(); Iterator iterator = v.iterator(); - list.stream().forEach( i ->{ + list.stream().forEach(i -> { Boolean cz = false; - while (iterator.hasNext()){ + while (iterator.hasNext()) { DistrilbutionBillPackageEntity next = iterator.next(); - if(i.getParceListId().equals(next.getParceListId())){ + if (i.getParceListId().equals(next.getParceListId())) { //存在 iterator.remove(); } @@ -727,11 +835,11 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl packageEntityList = new ArrayList<>(); - v.stream().forEach(i ->{ + v.stream().forEach(i -> { DistrilbutionBillPackageEntity billPackageEntity = new DistrilbutionBillPackageEntity(); - BeanUtils.copyProperties(i,billPackageEntity); + BeanUtils.copyProperties(i, billPackageEntity); billPackageEntity.setBillLadingId(distrilbutionBillLading.getId()); billPackageEntity.setPacketNumber(1); billPackageEntity.setPacketBarStatus(1); @@ -742,24 +850,24 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl collect = packageEntityList.stream().map(i -> i.getParceListId()).collect(Collectors.toList()); //修改包件状态 distributionParcelListService.update(Wrappers.update() - .in("id",collect) + .in("id", collect) .set("order_package_reservation_status", OrderPackageReservationStatusConstant.yiyueyue.getValue()) ); } }); //删除包件 - if(!distrilbutionBillLading.getUnBillPackageEntityList().isEmpty()){ + if (!distrilbutionBillLading.getUnBillPackageEntityList().isEmpty()) { List collect = distrilbutionBillLading.getUnBillPackageEntityList().stream().map(e -> e.getParceListId()).collect(Collectors.toList()); boolean update = distrilbutionBillPackageService.update(Wrappers.update() .in("parce_list_id", collect) .set("packet_bar_status", 2)); //修改包件状态 distributionParcelListService.update(Wrappers.update() - .in("id",collect) + .in("id", collect) .set("order_package_reservation_status", OrderPackageReservationStatusConstant.daiyuyue.getValue()) ); - if(!update){ + if (!update) { throw new ServiceException("修改失败!!!"); } } @@ -767,42 +875,42 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl list = distributionZeroPackageService.list(Wrappers.query().lambda() .eq(DistributionReservationZeroPackageEntity::getReservationId, distrilbutionBillLadingDTO.getId()) ); //数据库的品分类数据 List parcelLisList = distrilbutionBillLadingDTO.getParcelLisList();//品类信息 - if(!list.isEmpty()){ + if (!list.isEmpty()) { List longs = new ArrayList<>(); //存在的 - list.forEach(i ->{ + list.forEach(i -> { boolean b = parcelLisList.stream().anyMatch(ii -> ii.getId().equals(i.getParcelListId())); - if(b){ + if (b) { //有数据 Iterator iterator = parcelLisList.iterator(); - while (iterator.hasNext()){ + while (iterator.hasNext()) { DistributionParcelListDTO next = iterator.next(); - if(next.getId().equals(i.getParcelListId())){ - if(i.getRealityQuantity() > 0){ + if (next.getId().equals(i.getParcelListId())) { + if (i.getRealityQuantity() > 0) { throw new ServiceException("已备货无法修改备货数量!"); } //获取修改的数量 Integer quantity = i.getQuantity();//原预约数量 Integer quantity1 = next.getQuantity();//改变的数量 int i1 = quantity - quantity1; - if(i1 > 0 ){ + if (i1 > 0) { //减少了 - distributionParcelNumberService.updateBillNum(i.getParcelListId(),i1,1); - }else if(i1 < 0){ + distributionParcelNumberService.updateBillNum(i.getParcelListId(), i1, 1); + } else if (i1 < 0) { //增加了 - distributionParcelNumberService.updateBillNum(i.getParcelListId(),i1,2); - }else { + distributionParcelNumberService.updateBillNum(i.getParcelListId(), i1, 2); + } else { //不做操作! continue; } @@ -814,18 +922,18 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl packageEntityList = new ArrayList<>(); - parcelLisList.forEach( w ->{ + parcelLisList.forEach(w -> { DistributionReservationZeroPackageEntity zeroPackageEntity = new DistributionReservationZeroPackageEntity(); zeroPackageEntity.setParcelListId(w.getId()); zeroPackageEntity.setStockArticleId(w.getStockArticleId()); @@ -837,19 +945,19 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl { //查询数据是否已备货 - if ("10".equals(i.getConditions()) ) { + if ("10".equals(i.getConditions())) { //未 List list1 = distributionStockService.list(Wrappers.query().lambda().eq(DistributionStockEntity::getStockArticle, i.getStockArticleId())); if (list1.isEmpty()) { @@ -906,14 +1014,14 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImplupdate() - .eq("bill_lading_id",id) - .eq("stock_article_id",i.getStockArticleId()) + .eq("bill_lading_id", id) + .eq("stock_article_id", i.getStockArticleId()) .apply("packet_bar_status in ( 1 , 3 )") - .set("packet_bar_status",2) + .set("packet_bar_status", 2) ); //还原预约包件信息 distributionParcelListService.update(Wrappers.update() - .eq("stock_article_id",i.getStockArticleId()) + .eq("stock_article_id", i.getStockArticleId()) .set("order_package_reservation_status", OrderPackageReservationStatusConstant.daiyuyue.getValue()) ); //修改订单数据 @@ -941,33 +1049,33 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl packageEntityList1 = billPackInfo(String.valueOf(i.getId()),id,null,i); - if(packageEntityList1.isEmpty()){ - throw new ServiceException(i.getOrderCode()+"没有可用包件信息!"); + List packageEntityList1 = billPackInfo(String.valueOf(i.getId()), id, null, i); + if (packageEntityList1.isEmpty()) { + throw new ServiceException(i.getOrderCode() + "没有可用包件信息!"); } packageEntityList.addAll(packageEntityList1); stringBuff.add(String.valueOf(i.getId())); }); //添加包件信息 - if(!packageEntityList.isEmpty()){ + if (!packageEntityList.isEmpty()) { distrilbutionBillPackageService.saveBatch(packageEntityList); } distrilbutionBillStockService.saveBatch(list1); - if(ObjectUtils.isNotNull(stringBuff) || ObjectUtils.isNotNull(sStock)){ + if (ObjectUtils.isNotNull(stringBuff) || ObjectUtils.isNotNull(sStock)) { //修改订单状态 DistrilbutionBillLadingEntity billLadingEntity = baseMapper.selectById(id); DistrilbutionBillLadingEntity distrilbutionBillLading = new DistrilbutionBillLadingEntity(); distrilbutionBillLading.setId(billLadingEntity.getId()); - List list2 =new ArrayList<>( Arrays.asList(billLadingEntity.getStockArticleId().split(","))); + List list2 = new ArrayList<>(Arrays.asList(billLadingEntity.getStockArticleId().split(","))); StringBuffer s = new StringBuffer(); - if(ObjectUtils.isNotNull(sStock)){ + if (ObjectUtils.isNotNull(sStock)) { list2.removeAll(sStock); } String join = String.join(",", list2); s.append(join); - if(ObjectUtils.isNotNull(stringBuff)){ + if (ObjectUtils.isNotNull(stringBuff)) { String join1 = String.join(",", stringBuff); - s.append(","+join1); + s.append("," + join1); } distrilbutionBillLading.setStockArticleId(s.toString()); baseMapper.updateById(distrilbutionBillLading); @@ -1007,9 +1115,9 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl "1".equals(ii.getGenre().toString())).count(); int count1 = (int) list1.stream().filter(ii -> "2".equals(ii.getGenre().toString())).count(); int count2 = (int) list1.stream().filter(ii -> "3".equals(ii.getGenre().toString())).count(); - if(count1 >= 1 && count >= 1 && count2 >= 1){ + if (count1 >= 1 && count >= 1 && count2 >= 1) { i.setPrintState(true); - }else{ + } else { i.setPrintState(false); } }); @@ -1022,13 +1130,13 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl idArr = null; - if (null != ids && !ids.toString().equals("")){ + if (null != ids && !ids.toString().equals("")) { idArr = Arrays.asList(param.get("ids").toString().split(",")); } @@ -1038,7 +1146,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl { DistrilbutionBillLadingExcel excel = new DistrilbutionBillLadingExcel(); s.setCertificateTypeName(DictBizCache.getValue(DictBizConstant.CERTIFICATE_TYPE, s.getCertificateTypeName())); - BeanUtil.copyProperties(s,excel); + BeanUtil.copyProperties(s, excel); listExcel.add(excel); }); @@ -1079,11 +1187,11 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl pageListApp(IPage page, BillLadingAppDTO billLadingAppDTO) { //查询仓库信息 BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); - if(ObjectUtils.isNotNull(myCurrentWarehouse)){ + if (ObjectUtils.isNotNull(myCurrentWarehouse)) { billLadingAppDTO.setWarehouseId(myCurrentWarehouse.getId()); //仓库ID - if(ObjectUtils.isNotNull(billLadingAppDTO.getPickUpTimeStart()) && ObjectUtils.isNotNull(billLadingAppDTO.getPickUpTimeEnd())){ - billLadingAppDTO.setPickUpTimeStart(billLadingAppDTO.getPickUpTimeStart()+" 00:00:00"); - billLadingAppDTO.setPickUpTimeEnd(billLadingAppDTO.getPickUpTimeEnd()+" 23:59:59"); + if (ObjectUtils.isNotNull(billLadingAppDTO.getPickUpTimeStart()) && ObjectUtils.isNotNull(billLadingAppDTO.getPickUpTimeEnd())) { + billLadingAppDTO.setPickUpTimeStart(billLadingAppDTO.getPickUpTimeStart() + " 00:00:00"); + billLadingAppDTO.setPickUpTimeEnd(billLadingAppDTO.getPickUpTimeEnd() + " 23:59:59"); } //查询自提数据 IPage pageList = baseMapper.pageListApp(page, billLadingAppDTO); @@ -1103,7 +1211,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl list = distributionParcelListService.list(queryWrapper); List list = distrilbutionBillPackageService.list(Wrappers.query().lambda() - .eq(DistrilbutionBillPackageEntity::getBillLadingId,vo.getBillLadingId()) - .eq(DistrilbutionBillPackageEntity::getStockArticleId,s) + .eq(DistrilbutionBillPackageEntity::getBillLadingId, vo.getBillLadingId()) + .eq(DistrilbutionBillPackageEntity::getStockArticleId, s) .apply("packet_bar_status in (1,3)") ); int pn = list.size(); //包件数量 @@ -1132,7 +1240,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl ls = distributionBillLadingScanService.list(qw); - if(!ls.isEmpty()){ + if (!ls.isEmpty()) { int sum = ls.stream().mapToInt(DistributionBillLadingScanEntity::getQuantity).sum(); signedNum = signedNum + sum; } @@ -1156,7 +1264,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl list = distributionParcelListService.list(queryWrapper); int pn = 0; - if( !list.isEmpty() && ObjectUtils.isNotNull(list.get(0))){ + if (!list.isEmpty() && ObjectUtils.isNotNull(list.get(0))) { vo.setOrderSelfNumbering(list.get(0).getOrderCode()); pn = list.size(); vo.setPlanNum(pn); @@ -1220,7 +1328,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl qw = new QueryWrapper<>(); qw.eq("stock_article_id", Long.parseLong(s)) .eq("is_deleted", 0); - qw.eq("bill_lading_id",main.getBillLadingId()); + qw.eq("bill_lading_id", main.getBillLadingId()); List ls = distributionBillLadingScanService.list(qw); int sn = ls.stream().mapToInt(DistributionBillLadingScanEntity::getQuantity).sum(); vo.setSignedNum(sn); @@ -1237,7 +1345,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl details = baseMapper.selectDetailList(Long.parseLong(s), scanStatus, orderSelfNumbering,billLadingId); + List details = baseMapper.selectDetailList(Long.parseLong(s), scanStatus, orderSelfNumbering, billLadingId); for (DistrilbutionAppBillLadingDetailVO detailVO : details) { Integer ss = detailVO.getScanStatus(); Integer errorStatus = detailVO.getErrorStatus(); @@ -1352,8 +1460,8 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl list = distributionParcelListService.list(queryWrapper); List list = distrilbutionBillPackageService.list(Wrappers.query().lambda() - .eq(DistrilbutionBillPackageEntity::getBillLadingId,billLadingId) - .eq(DistrilbutionBillPackageEntity::getStockArticleId,s) + .eq(DistrilbutionBillPackageEntity::getBillLadingId, billLadingId) + .eq(DistrilbutionBillPackageEntity::getStockArticleId, s) .apply("packet_bar_status in (1,3)") ); int pn = list.size(); @@ -1363,7 +1471,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl ls = distributionBillLadingScanService.list(qw); - if(!ls.isEmpty()){ + if (!ls.isEmpty()) { int sum = ls.stream().mapToInt(DistributionBillLadingScanEntity::getQuantity).sum(); signedNum = signedNum + sum; if (pn == sum) { @@ -1592,12 +1700,12 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl list3 = distributionBillLadingScanService.list(Wrappers.query().lambda() @@ -1606,7 +1714,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl inventoryAppVO.getQuantity()){ - return Resp.scanFail("已完成!", "已完成!!"); + if (list.size() > inventoryAppVO.getQuantity()) { + return Resp.scanFail("已完成!", "已完成!!"); } //修改库存品签收 distributionAsyncService.getInventorySelfPickup(inventoryAppVO.getStockArticleId()); @@ -1638,7 +1746,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImplquery().lambda() .eq(DistrilbutionBillStockEntity::getBillLadingId, billLadingId) - .apply("order_status in (1 , 2)") + .apply("order_status in (1 , 2)") .eq(DistrilbutionBillStockEntity::getStockArticleId, list4.get(0).getStockArticleId()) ); - if(ObjectUtils.isNull(one2)){ - return Resp.scanFail("不在本次自提计划!","不在本次自提计划!"); + if (ObjectUtils.isNull(one2)) { + return Resp.scanFail("不在本次自提计划!", "不在本次自提计划!"); } - if("20".equals(one2.getConditions())){ - return Resp.scanFail("当前提货任务,"+list4.get(0).getOrderCode()+"已齐套!","当前提货任务,"+list4.get(0).getOrderCode()+"已齐套!"); + if ("20".equals(one2.getConditions())) { + return Resp.scanFail("当前提货任务," + list4.get(0).getOrderCode() + "已齐套!", "当前提货任务," + list4.get(0).getOrderCode() + "已齐套!"); } //查询订单存在吗 @@ -1668,7 +1776,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl { @@ -1694,7 +1802,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImplquery().lambda() .eq(DistrilbutionBillStockEntity::getBillLadingId, billLadingId) .eq(DistrilbutionBillStockEntity::getStockArticleId, one.getId()) - .eq(DistrilbutionBillStockEntity::getConditions,BillLadingStatusConstant.daitihuo.getValue() ) + .eq(DistrilbutionBillStockEntity::getConditions, BillLadingStatusConstant.daitihuo.getValue()) ); //修改订单状态 distributionAsyncService.getOrderSelfPickup(list1.get(0).getId()); @@ -1702,12 +1810,12 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl 0){ + if (ObjectUtils.isNotNull(one.getHandQuantity()) && one.getHandQuantity() > 0) { int i = one.getHandQuantity() - 1; int i2 = ObjectUtils.isNull(one.getSigninQuantity()) ? 1 : one.getSigninQuantity() + 1; distributionStockArticleService.update(Wrappers.update() - .eq("id",one.getId()) - .set("hand_quantity",i) + .eq("id", one.getId()) + .set("hand_quantity", i) .set("signin_quantity", i2) ); } @@ -1720,10 +1828,10 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl > 签收成功!!"); - return Resp.scanSuccess( "签收成功",""); + log.info(coding + " > > 签收成功!!"); + return Resp.scanSuccess("签收成功", ""); } } @@ -1820,13 +1928,13 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl list1 = distributionPrintService.list(Wrappers.query().lambda() .eq(DistributionPrintEntity::getBillLadingId, s) ); - if(list1.isEmpty()){ + if (list1.isEmpty()) { throw new ServiceException("请上传签收图片!!"); } int count = (int) list1.stream().filter(ii -> "1".equals(ii.getGenre().toString())).count(); int count1 = (int) list1.stream().filter(ii -> "2".equals(ii.getGenre().toString())).count(); int count2 = (int) list1.stream().filter(ii -> "3".equals(ii.getGenre().toString())).count(); - if(count1 < 1 || count < 1 || count2 < 1){ + if (count1 < 1 || count < 1 || count2 < 1) { throw new ServiceException("请上传完整签收图片!!"); } //修改提货状态 @@ -1836,8 +1944,8 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl list = distrilbutionBillStockService.list(Wrappers.query().lambda() - .eq(DistrilbutionBillStockEntity::getBillLadingId, s) - .apply("order_status in ( 1 , 2)") + .eq(DistrilbutionBillStockEntity::getBillLadingId, s) + .apply("order_status in ( 1 , 2)") // .or(ew -> ew.eq(DistrilbutionBillStockEntity::getBillLadingId, s).apply(DistrilbutionBillStockEntity::getOrderStatus, "2")) ); if (!list.isEmpty()) { @@ -1849,14 +1957,14 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl 0){ + if (i1 > 0) { stockArticleEntity.setOrderStatus(OrderStatusConstant.bufenqianshou.getValue()); } distributionStockArticleService.updateById(stockArticleEntity); @@ -1868,45 +1976,43 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl list = disStockListDetailService.list(Wrappers.query().lambda() - .eq(DisStockListDetailEntity::getReservationId, billId)); - if(ObjectUtils.isNotNull(list)){ - //处理库存 - List scanEntityList = new ArrayList<>(); - list.stream().filter(i -> i.getStockSignfoStatus().equals("10")).forEach( i ->{ - //添加自提库存品记录 - DistributionBillLadingScanEntity billLadingScan = new DistributionBillLadingScanEntity(); - billLadingScan.setMaterialType("1"); - billLadingScan.setScanType(2); - billLadingScan.setBillLadingId(Long.valueOf(billId)); - billLadingScan.setQuantity(1); - billLadingScan.setStockListId(i.getStockListId()); - billLadingScan.setPacketBarCode(i.getStockPackageCode()); - scanEntityList.add(billLadingScan); - }); - if(!scanEntityList.isEmpty()){ - distributionBillLadingScanService.saveBatch(scanEntityList); - } - - + /** + * 处理提货库存品签收 + */ + public void updateStock(String billId) { + List list = disStockListDetailService.list(Wrappers.query().lambda() + .eq(DisStockListDetailEntity::getReservationId, billId)); + if (ObjectUtils.isNotNull(list)) { + //处理库存 + List scanEntityList = new ArrayList<>(); + list.stream().filter(i -> i.getStockSignfoStatus().equals("10")).forEach(i -> { + //添加自提库存品记录 + DistributionBillLadingScanEntity billLadingScan = new DistributionBillLadingScanEntity(); + billLadingScan.setMaterialType("1"); + billLadingScan.setScanType(2); + billLadingScan.setBillLadingId(Long.valueOf(billId)); + billLadingScan.setQuantity(1); + billLadingScan.setStockListId(i.getStockListId()); + billLadingScan.setPacketBarCode(i.getStockPackageCode()); + scanEntityList.add(billLadingScan); + }); + if (!scanEntityList.isEmpty()) { + distributionBillLadingScanService.saveBatch(scanEntityList); + } - } + } - } + } /** * 修改包件签收状态 */ @Transactional(rollbackFor = Exception.class) - public Integer updatePack(Long ids,Long billId){ + public Integer updatePack(Long ids, Long billId) { List list = distrilbutionBillPackageService.list(Wrappers.query().lambda() .eq(DistrilbutionBillPackageEntity::getBillLadingId, billId) @@ -1914,17 +2020,17 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl scanEntityList = new ArrayList<>(); AtomicReference num = new AtomicReference<>(0); - if(ObjectUtils.isNotNull(list) && !list.isEmpty()){ + if (ObjectUtils.isNotNull(list) && !list.isEmpty()) { //签收记录 List list1 = distributionBillLadingScanService.list(Wrappers.query().lambda() .eq(DistributionBillLadingScanEntity::getBillLadingId, billId) ); //去除签收的包件 Iterator iterator = list.iterator(); - while (iterator.hasNext()){ + while (iterator.hasNext()) { DistrilbutionBillPackageEntity next = iterator.next(); boolean b = list1.stream().anyMatch(q -> q.getParcelListId().equals(next.getParceListId())); - if(b){ + if (b) { //删除包件 iterator.remove(); } @@ -1946,7 +2052,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl{ + list.stream().forEach(i -> { DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); parcelListEntity.setId(i.getParceListId()); parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue()); @@ -1955,7 +2061,6 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl distrilbutionBillLading) { BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); - if(ObjectUtils.isNotNull(myCurrentWarehouse)){ - distrilbutionBillLading.put("warehouse_id",myCurrentWarehouse.getId()); + if (ObjectUtils.isNotNull(myCurrentWarehouse)) { + distrilbutionBillLading.put("warehouse_id", myCurrentWarehouse.getId()); } DistrilbutionBillLadingDTO billLadingEntity = JSONObject.parseObject(JSONObject.toJSONString(distrilbutionBillLading), DistrilbutionBillLadingDTO.class); @@ -1988,11 +2091,11 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl getViewDetailOwn(String id) { List viewDetailOwn = baseMapper.getViewDetailOwn(id); - viewDetailOwn.forEach(i ->{ + viewDetailOwn.forEach(i -> { List list = distributionPrintService.list(Wrappers.query().lambda() .eq(DistributionPrintEntity::getBillLadingId, id) ); - if(!viewDetailOwn.isEmpty()){ + if (!viewDetailOwn.isEmpty()) { i.setPrintList(list); } }); @@ -2005,14 +2108,14 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl list = new ArrayList<>(); boolean isZeroType = false; // distrilbutionBillLading.setZeroType("1"); - if(distrilbutionBillLading.getZeroType().equals("2")){ + if (distrilbutionBillLading.getZeroType().equals("2")) { list = distrilbutionBillLading.getParcelLisList(); distrilbutionBillLading.setParcelLisList(null); isZeroType = true; } this.save(distrilbutionBillLading); - if(isZeroType){ - if(list.isEmpty()){ + if (isZeroType) { + if (list.isEmpty()) { throw new ServiceException("类型数据未填写!!!"); } List zeroPackageEntityList = new ArrayList<>(); @@ -2020,7 +2123,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl { - if(i.getQuantity() != 0){ + if (i.getQuantity() != 0) { DistributionReservationZeroPackageEntity zeroPackageEntity = new DistributionReservationZeroPackageEntity(); zeroPackageEntity.setQuantity(i.getQuantity()); zeroPackageEntity.setReservationId(distrilbutionBillLading.getId()); @@ -2036,31 +2139,31 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl{ - if(nu.get() <= p.getHandQuantity()){ + if (!parcelNumberEntityList.isEmpty()) { + parcelNumberEntityList.forEach(p -> { + if (nu.get() <= p.getHandQuantity()) { p.setHandQuantity(null); distributionParcelNumberService.updateById(p); - }else{ + } else { throw new ServiceException("预约数量大于在库数量!!"); } }); - }else{ + } else { throw new ServiceException("数据异常,请联系管理员!!"); } distributionZeroPackageService.saveBatch(zeroPackageEntityList); @@ -2102,10 +2205,10 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl billStockList(IPage page, Map distrilbutionBillLading) { - List result =baseMapper.selectBillStockList(page,distrilbutionBillLading); + List result = baseMapper.selectBillStockList(page, distrilbutionBillLading); for (DistrilbutionBillLadingVO distrilbutionBillLadingVO : result) { List list = distributionDeliveryChargeService.list(Wrappers.query().lambda() .eq(DistributionDeliveryChargeEntity::getBillLading, distrilbutionBillLadingVO.getId()) ); distrilbutionBillLadingVO.setList(list); - distrilbutionBillLadingVO.setConditionName(DictBizCache.getValue(DictBizConstant.BILL_CONDITIONS_STATUS,distrilbutionBillLadingVO.getConditions())); - distrilbutionBillLadingVO.setNotificationStatusName(DictBizCache.getValue(DictBizConstant.BILL_NOTIFICATION_STATUS,distrilbutionBillLadingVO.getNotificationStatus())); - distrilbutionBillLadingVO.setCertificateTypeName(DictBizCache.getValue(DictBizConstant.CERTIFICATE_TYPE,distrilbutionBillLadingVO.getCertificateType())); + distrilbutionBillLadingVO.setConditionName(DictBizCache.getValue(DictBizConstant.BILL_CONDITIONS_STATUS, distrilbutionBillLadingVO.getConditions())); + distrilbutionBillLadingVO.setNotificationStatusName(DictBizCache.getValue(DictBizConstant.BILL_NOTIFICATION_STATUS, distrilbutionBillLadingVO.getNotificationStatus())); + distrilbutionBillLadingVO.setCertificateTypeName(DictBizCache.getValue(DictBizConstant.CERTIFICATE_TYPE, distrilbutionBillLadingVO.getCertificateType())); } page.setRecords(result); return page; @@ -2133,6 +2236,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl parcelListEntityList = new ArrayList<>(); - if(!list.isEmpty()){ - list.forEach( i -> { + if (!list.isEmpty()) { + list.forEach(i -> { //查询品类信息 DistributionParcelListEntity byId = distributionParcelListService.getById(i.getParcelListId()); DistrilbutionAppBillLadingZeroVO billLadingZeroVO = new DistrilbutionAppBillLadingZeroVO(); - BeanUtils.copyProperties(byId,billLadingZeroVO); + BeanUtils.copyProperties(byId, billLadingZeroVO); billLadingZeroVO.setReservationQuantity(i.getQuantity()); billLadingZeroVO.setRealityQuantity(i.getRealityQuantity()); //查询是否已经签收过 @@ -2158,7 +2262,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl list = distributionZeroPackageService.list(Wrappers.query().lambda() .eq(DistributionReservationZeroPackageEntity::getReservationId, billLadingAppDTO.getBillLadingId()) .eq(DistributionReservationZeroPackageEntity::getIsDeleted, 0) @@ -2213,18 +2318,18 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl{ - v.forEach(i ->{ + .forEach((k, v) -> { + v.forEach(i -> { //修改包件签收状态 DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); //判断是否大于总件数的数量 DistributionParcelListEntity byId = distributionParcelListService.getById(i.getId()); - if(i.getQuantity() > byId.getQuantity()){ + if (i.getQuantity() > byId.getQuantity()) { throw new ServiceException("签收数量大于订单数量!!"); - }else if(i.getQuantity().equals(byId.getQuantity())){ + } else if (i.getQuantity().equals(byId.getQuantity())) { parcelListEntity.setId(byId.getId()); parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue()); - }else{ + } else { parcelListEntity.setId(byId.getId()); parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.bufenqianshou.getValue()); } @@ -2241,21 +2346,22 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl billLadingZeroOrderVOS = new ArrayList<>(); - if(!list.isEmpty()){ + if (!list.isEmpty()) { list.stream().collect(Collectors.groupingBy(DistributionReservationZeroPackageEntity::getStockArticleId)). - forEach((k,v) ->{ + forEach((k, v) -> { int sum = v.stream().mapToInt(DistributionReservationZeroPackageEntity::getQuantity).sum(); int sum1 = v.stream().mapToInt(DistributionReservationZeroPackageEntity::getRealityQuantity).sum(); DistributionStockArticleEntity byId = distributionStockArticleService.getById(k); DistrilbutionAppBillLadingZeroOrderVO zeroOrderVO = new DistrilbutionAppBillLadingZeroOrderVO(); - BeanUtils.copyProperties(byId,zeroOrderVO); + BeanUtils.copyProperties(byId, zeroOrderVO); zeroOrderVO.setReservationQuantity(sum); zeroOrderVO.setRealityQuantity(sum1); //查询签收订单数量 @@ -2285,7 +2391,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl list = distributionZeroPackageService.list(Wrappers.query().lambda() .eq(DistributionReservationZeroPackageEntity::getReservationId, billLadingAppDTO.getBillLadingId()) .eq(DistributionReservationZeroPackageEntity::getIsDeleted, 0) @@ -2328,28 +2435,28 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImplquery().lambda() .eq(DistributionBillLadingScanEntity::getBillLadingId, billLadingAppDTO.getBillLadingId()) .eq(DistributionBillLadingScanEntity::getParcelListId, i.getId()) ); - if(ObjectUtils.isNotNull(one1)){ - return Resp.scanFail("当前物料已签收!","当前物料已签收!"); + if (ObjectUtils.isNotNull(one1)) { + return Resp.scanFail("当前物料已签收!", "当前物料已签收!"); } //修改包件签收状态 DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); //判断是否大于总件数的数量 DistributionParcelListEntity byId = distributionParcelListService.getById(i.getId()); - if(i.getQuantity() > byId.getQuantity()){ + if (i.getQuantity() > byId.getQuantity()) { throw new ServiceException("签收数量大于订单数量!!"); - }else if(i.getQuantity().equals(byId.getQuantity())){ + } else if (i.getQuantity().equals(byId.getQuantity())) { parcelListEntity.setId(byId.getId()); parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue()); - }else{ + } else { parcelListEntity.setId(byId.getId()); parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.bufenqianshou.getValue()); } @@ -2362,7 +2469,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl z.getStockArticleId().equals(i.getStockArticleId())).collect(Collectors.toList()).stream().mapToInt(DistributionReservationZeroPackageEntity::getQuantity).sum(); //获取已签收数量 List list1 = distributionBillLadingScanService.list(Wrappers.query().lambda() @@ -2370,21 +2477,22 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl aid = billLadingAppDTO.getPrintList().stream().filter(i -> ObjectUtils.isNull(i.getId())).collect(Collectors.toList());//添加的图片 List uid = billLadingAppDTO.getPrintList().stream().filter(i -> ObjectUtils.isNotNull(i.getId())).collect(Collectors.toList()); //保存的图片 //添加图片 - //处理不需要的图片 - while (distributionPrintEntityListIterator.hasNext()){ + //处理不需要的图片 + while (distributionPrintEntityListIterator.hasNext()) { for (BillLadingAppDTO.Print q : uid) { DistributionPrintEntity next = distributionPrintEntityListIterator.next(); - if(q.getId().toString().equals(next.getId().toString())){ + if (q.getId().toString().equals(next.getId().toString())) { distributionPrintEntityListIterator.remove(); } } } //清除需要删除的图片 - if(!printEntityList.isEmpty()){ + if (!printEntityList.isEmpty()) { List collect = printEntityList.stream().map(DistributionPrintEntity::getId).collect(Collectors.toList()); distributionPrintService.deleteLogic(collect); } - if(!aid.isEmpty()){ + if (!aid.isEmpty()) { //新增 List list2 = new ArrayList<>(); aid.forEach(print -> { @@ -2425,7 +2533,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl list = distributionPrintService.list(Wrappers.query().lambda() .eq(DistributionPrintEntity::getBillLadingId, billLadingAppDTO.getBillLadingId()) ); - Map map = new HashMap<>(); - if(!list.isEmpty()){ + Map map = new HashMap<>(); + if (!list.isEmpty()) { List list1 = new ArrayList<>(); - list.forEach(i ->{ + list.forEach(i -> { BillLadingAppDTO.Print print = new BillLadingAppDTO.Print(); print.setId(i.getId()); print.setUrl(i.getSite()); @@ -2458,30 +2567,31 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl list,Long stockArticleId,Long billLadingId){ + public Boolean updateBillStock(Integer sum, List list, Long stockArticleId, Long billLadingId) { int sum1 = list.stream().collect(Collectors.groupingBy(DistributionReservationZeroPackageEntity::getStockArticleId)).get(stockArticleId).stream().mapToInt(DistributionReservationZeroPackageEntity::getQuantity).sum(); - if(sum >= sum1){ + if (sum >= sum1) { //修改提货提货状态 - return distrilbutionBillStockService.update(Wrappers.update() - .eq("bill_lading_id",billLadingId) - .eq("stock_article_id",stockArticleId) - .set("conditions",2) + return distrilbutionBillStockService.update(Wrappers.update() + .eq("bill_lading_id", billLadingId) + .eq("stock_article_id", stockArticleId) + .set("conditions", 2) ); } return false; diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java index 1268cd494..3e49f1898 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java @@ -690,7 +690,6 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { logger.info("##############sendMtFactoryData 发送数据: {}", data); - //先获取token String token = getMtToken(); //处理逻辑 @@ -700,7 +699,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { .header("USERID", mtFactoryProperties.getUserid()) .header("USERPWD", MD5Utils.md5Hex(mtFactoryProperties.getUserpwd().getBytes(StandardCharsets.UTF_8))) .header("Content-Type", "application/json") - .body(data).timeout(5 * 1000) + .body(data).timeout(30 * 1000) .execute().body(); logger.info("##############sendMtFactoryData 接受数据: {}", result); @@ -718,7 +717,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { if (!Objects.isNull(jsonObject)) { Integer code = jsonObject.getInteger("Result"); String message = jsonObject.getString("Message"); - if (code.equals(0)) { + if (0==code) { logger.info("##########sendMtFactoryData: 物流状态传递成功"); return Resp.success("物流状态传递成功"); } else { diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java index d32390bea..9d16328b7 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java @@ -71,4 +71,6 @@ public interface TrunklineCarsLoadScanMapper extends BaseMapper + + update logpm_trunkline_cars_load_scan + set final_node_id = #{finalNodeId}, + final_node_name = #{finalNodeName} + where id = #{loadScanId} + diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java index c2ef22565..c0b7ac0b7 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java @@ -67,4 +67,7 @@ public interface ITrunklineCarsLoadScanService extends BaseService findListByIds(List loadScanIds); Integer findRealSignNumBySignOrderId(Long signOrderId); + + void updateFinalNodeIdAndFinalNodeNameById(Long loadScanId, Long finalNodeId, String finalNodeName); + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java index f342efee9..4dd3c0eea 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java @@ -871,9 +871,9 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List pacakgeDetailExcelDTOS = EasyExcel.read(inputStream).head(PacakgeDetailExcelDTO.class).sheet(0).headRowNumber(2).doReadSync(); - Map> listMap = pacakgeDetailExcelDTOS.parallelStream().collect(Collectors.groupingBy(a -> a.getOrderCode() + "-" + a.getTrainNumber())); + Map> listMap = pacakgeDetailExcelDTOS.parallelStream().collect(Collectors.groupingBy(a -> a.getOrderCode() + "&" + a.getTrainNumber())); - listMap.remove("null-null"); + listMap.remove("null&null"); Set set = listMap.keySet(); List advanceDetailEntities = new ArrayList<>(); @@ -882,7 +882,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { for (String str : set) { List detailExcelDTOS = listMap.get(str); PacakgeDetailExcelDTO pacakgeDetailExcelDTO = detailExcelDTOS.get(0); - String[] split = str.split("-"); + String[] split = str.split("&"); String orderCode = split[0]; String trainNumber = split[1]; List orderPackageCodes = new ArrayList<>(); @@ -981,10 +981,10 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceDetailEntities.add(advanceDetailModel); } - int all = orderPackageCodes.size() + advanceDetailEntities.size(); - if(all != advanceEntity.getTotalNum()){ - advanceService.updateTotalNumById(advanceEntity.getId(),all); - } +// int all = orderPackageCodes.size() + advanceDetailEntities.size(); +// if(all != advanceEntity.getTotalNum()){ +// advanceService.updateTotalNumById(advanceEntity.getId(),all); +// } } advanceDetailService.saveBatch(advanceDetailEntities); @@ -1004,9 +1004,9 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List importCustomizedOuPaiDTOS = EasyExcel.read(inputStream).head(ImportCustomizedOuPaiDTO.class).sheet(0).headRowNumber(1).doReadSync(); - Map> listMap = importCustomizedOuPaiDTOS.parallelStream().collect(Collectors.groupingBy(a -> a.getOrderCode() + "-" + a.getTrainNumber())); + Map> listMap = importCustomizedOuPaiDTOS.parallelStream().collect(Collectors.groupingBy(a -> a.getOrderCode() + "&" + a.getTrainNumber())); - listMap.remove("null-null"); + listMap.remove("null&null"); Set set = listMap.keySet(); @@ -1015,7 +1015,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { for (String str : set) { List paiDTOList = listMap.get(str); ImportCustomizedOuPaiDTO importCustomizedOuPaiDTO = paiDTOList.get(0); - String[] split = str.split("-"); + String[] split = str.split("&"); String orderCode = split[0]; String trainNumber = split[1]; List orderPackageCodes = new ArrayList<>(); @@ -1091,10 +1091,10 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceDetailEntities.add(advanceDetailModel); } - int all = orderPackageCodes.size() + advanceDetailEntities.size(); - if(all != trunklineAdvanceEntity.getTotalNum()){ - advanceService.updateTotalNumById(trunklineAdvanceEntity.getId(),all); - } +// int all = orderPackageCodes.size() + advanceDetailEntities.size(); +// if(all != trunklineAdvanceEntity.getTotalNum()){ +// advanceService.updateTotalNumById(trunklineAdvanceEntity.getId(),all); +// } } advanceDetailService.saveBatch(advanceDetailEntities); @@ -1116,9 +1116,9 @@ public class OpenOrderServiceImpl implements IOpenOrderService { InputStream inputStream = file.getInputStream(); List importStandardOuPaiDTOS = EasyExcel.read(inputStream).head(ImportStandardOuPaiDTO.class).sheet(0).headRowNumber(1).doReadSync(); - Map> listMap = importStandardOuPaiDTOS.parallelStream().collect(Collectors.groupingBy(a -> a.getOrderCode() + "-" + a.getTrainNumber())); + Map> listMap = importStandardOuPaiDTOS.parallelStream().collect(Collectors.groupingBy(a -> a.getOrderCode() + "&" + a.getTrainNumber())); - listMap.remove("null-null"); + listMap.remove("null&null"); Set set = listMap.keySet(); @@ -1126,7 +1126,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { for (String str : set) { List paiDTOList = listMap.get(str); ImportStandardOuPaiDTO importStandardOuPaiDTO = paiDTOList.get(0); - String[] split = str.split("-"); + String[] split = str.split("&"); String orderCode = split[0]; String trainNumber = split[1]; List orderPackageCodes = new ArrayList<>(); @@ -1168,6 +1168,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceDetailModel.setWarehouseId(warehouseId); advanceDetailModel.setWarehouseName(warehouseName); advanceDetailModel.setAdvanceId(trunklineAdvanceEntity.getId()); + advanceDetailModel.setOrderPackageCode(orderPackageCode); advanceDetailModel.setOrderCode(orderCode); advanceDetailModel.setBrand("欧派"); advanceDetailModel.setSystemType("线上"); @@ -1218,10 +1219,10 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceDetailEntities.add(advanceDetailModel); } - int all = orderPackageCodes.size() + advanceDetailEntities.size(); - if(all != trunklineAdvanceEntity.getTotalNum()){ - advanceService.updateTotalNumById(trunklineAdvanceEntity.getId(),all); - } +// int all = orderPackageCodes.size() + advanceDetailEntities.size(); +// if(all != trunklineAdvanceEntity.getTotalNum()){ +// advanceService.updateTotalNumById(trunklineAdvanceEntity.getId(),all); +// } } advanceDetailService.saveBatch(advanceDetailEntities); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadScanServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadScanServiceImpl.java index 8c5929df0..ce4eaa24e 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadScanServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadScanServiceImpl.java @@ -162,4 +162,9 @@ public class TrunklineCarsLoadScanServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); @@ -1864,6 +1873,11 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl trayGoodsQueryWrapper = new QueryWrapper<>(); - DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCode(orderPackageCode); + DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode,warehouseId); trayGoodsQueryWrapper.eq("association_type","3") .eq("association_value",orderPackageCode); WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsService.getOne(trayGoodsQueryWrapper); StringBuffer stringBuffer = new StringBuffer(); - if (Func.isNotEmpty(trayGoodsEntity)){ + if (!Objects.isNull(trayGoodsEntity)){ Long trayGoodsId = trayGoodsEntity.getId(); Long trayTypeId = trayGoodsEntity.getTrayTypeId(); Long trayId = trayGoodsEntity.getTrayId(); 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 166845aa7..52d668835 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 @@ -1370,7 +1370,7 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl