diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/OldSystemDataPushConfig.java b/blade-biz-common/src/main/java/org/springblade/common/constant/OldSystemDataPushConfig.java index 83752c780..f79a9aebc 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/OldSystemDataPushConfig.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/OldSystemDataPushConfig.java @@ -24,6 +24,7 @@ public class OldSystemDataPushConfig { warehourseIds.add("33"); warehourseIds.add("131"); warehourseIds.add("74"); + warehourseIds.add("77"); } diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineBillladingWaybillVO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineBillladingWaybillVO.java index eaf83f091..05f0b421e 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineBillladingWaybillVO.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineBillladingWaybillVO.java @@ -28,4 +28,9 @@ public class TrunklineBillladingWaybillVO extends TrunklineBillladingWaybillEnti private String remark;//备注 private BigDecimal collectPay;//运费 + private Integer totalCount; + private Integer stockCount; + + private Long billladingWaybillId; + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingWaybillMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingWaybillMapper.xml index 5e86ecf33..0441a8ee0 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingWaybillMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingWaybillMapper.xml @@ -14,7 +14,7 @@ - select sum(ltbw.real_num) + select IFNULL(sum(ltbw.real_num),0) from logpm_trunkline_billlading_waybill ltbw where ltbw.is_deleted = 0 and ltbw.waybill_id = #{waybillId} 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 c3a1f2650..aa8bffdb6 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 @@ -698,13 +698,14 @@ public class OpenOrderServiceImpl implements IOpenOrderService { return R.fail(405,"运单保存失败"); } - List advanceEntityList = advanceService.findListByIds(advanceIds); - for (TrunklineAdvanceEntity advanceEntity : advanceEntityList) { - advanceEntity.setWaybillNo(waybillNo); - advanceEntity.setWaybillStatus("1"); + if(advanceIds != null && advanceIds.size() > 0){ + List advanceEntityList = advanceService.findListByIds(advanceIds); + for (TrunklineAdvanceEntity advanceEntity : advanceEntityList) { + advanceEntity.setWaybillNo(waybillNo); + advanceEntity.setWaybillStatus("1"); + } + advanceService.updateBatchById(advanceEntityList); } - advanceService.updateBatchById(advanceEntityList); - //异步存入日志 String nickName = AuthUtil.getNickName(); @@ -2746,8 +2747,9 @@ public class OpenOrderServiceImpl implements IOpenOrderService { distributionStockArticleEntity.setWarehouseEntryTime(date); distributionStockArticleEntity.setTotalNumber(warehouseWaybill.getTotalCount()); distributionStockArticleEntity.setHandQuantity(warehouseWaybill.getStockCount()); + distributionStockArticleEntity.setIncomingNum(warehouseWaybill.getStockCount()); //零担订单默认齐套 - distributionStockArticleEntity.setCompleteSet(1); + distributionStockArticleEntity.setCompleteSet(2); distributionStockArticleEntity.setBrand(warehouseWaybill.getBrand()); distributionStockArticleEntity.setResource("零担"); @@ -2833,7 +2835,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { parcelNumberEntity.setStockArticleId(orderId); parcelNumberEntity.setWarehouseId(entity.getWarehouseId()); parcelNumberEntity.setParcelListId(aLong); - parcelNumberEntity.setHandQuantity(entity.getQuantity()); + parcelNumberEntity.setHandQuantity(0); parcelNumberEntity.setQuantity(entity.getQuantity()); parcelNumberEntity.setDeliveryQuantity(0); parcelNumberEntity.setSigninQuantity(0); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java index 084686569..f97260d90 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java @@ -11,8 +11,10 @@ import com.logpm.basicdata.feign.IBasicdataDriverArteryClient; import com.logpm.basicdata.feign.IBasicdataTrayClient; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.distribution.entity.DistributionParcelListEntity; +import com.logpm.distribution.entity.DistributionParcelNumberEntity; import com.logpm.distribution.entity.DistributionStockArticleEntity; import com.logpm.distribution.feign.IDistributionParcelListClient; +import com.logpm.distribution.feign.IDistributionParcelNumberClient; import com.logpm.distribution.feign.IDistributionStockArticleClient; import com.logpm.trunkline.bean.Resp; import com.logpm.trunkline.dto.*; @@ -82,6 +84,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl loadCarsPageList(LoadCarsDTO loadCarsDTO) { @@ -4397,12 +4400,14 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl parcelListEntityList = distributionParcelListClient.findEntityListByOrderCode(orderCode, fromWarehouseId); + List ls = new ArrayList<>(); for (DistributionParcelListEntity parcelListEntity : parcelListEntityList) { DistributionParcelListEntity newParcelListEntity = new DistributionParcelListEntity(); BeanUtil.copy(parcelListEntity,newParcelListEntity); @@ -4410,8 +4415,20 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl 30) { - log.warn("################splitOrder: 当前在库订单已进入配送流程,不能拆单 waybillNo={}", waybillNo); - return R.fail(405, "当前在库订单已进入配送流程"); - } +// Integer state = Integer.parseInt(distributionStockArticleEntity.getOrderStatus());//订单状态 +// Long orderId = distributionStockArticleEntity.getId();//订单id +// if (state > 30) { +// log.warn("################splitOrder: 当前在库订单已进入配送流程,不能拆单 waybillNo={}", waybillNo); +// return R.fail(405, "当前在库订单已进入配送流程"); +// } //判断拆单后的数值是否等于总数量 - Integer total = new Integer("0"); - for (SplitOrderDTO splitOrderDTO : splitOrderDTOList) { - List products = splitOrderDTO.getProducts(); - for (ProductDTO productDTO : products) { - Integer splitNum = productDTO.getSplitNum(); - if (!Objects.isNull(splitNum)) { - total = total + splitNum; - } - } - } - if (stockCount < total) { - log.warn("################splitOrder: 拆单数量不能小于在库数量 waybillNo={}", waybillNo); - return R.fail(405, "拆单数量不能小于在库数量"); - } +// Integer total = new Integer("0"); +// for (SplitOrderDTO splitOrderDTO : splitOrderDTOList) { +// List products = splitOrderDTO.getProducts(); +// for (ProductDTO productDTO : products) { +// Integer splitNum = productDTO.getSplitNum(); +// if (!Objects.isNull(splitNum)) { +// total = total + splitNum; +// } +// } +// } +// if (stockCount < total) { +// log.warn("################splitOrder: 拆单数量不能小于在库数量 waybillNo={}", waybillNo); +// return R.fail(405, "拆单数量不能小于在库数量"); +// } try { //拆单操作 warehouseWaybillService.splitOrder(splitOrderDTOList, distributionStockArticleEntity); //拆单完成去把以前的订单逻辑删除 - distributionStockArticleClient.deleteById(orderId); +// distributionStockArticleClient.deleteById(orderId); return R.success("拆单成功"); } catch (CustomerException e) { @@ -313,4 +312,32 @@ public class WarehouseWaybillController extends BladeController { } } + @ResponseBody + @PostMapping("/findWaybillBillladingList") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "查询运单信息", notes = "传入waybillDTO") + public R findWaybillBillladingList(@RequestBody WarehouseWaybillDTO waybillDTO) { + String method = "############findWaybillBillladingList: "; + log.info(method + "请求参数{}", waybillDTO); + String waybillNo = waybillDTO.getWaybillNo(); + try{ + + //当前登录人选择的仓库 + BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); + if(Objects.isNull(myCurrentWarehouse)){ + log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); + return R.fail(403,"仓库信息为空"); + } + + return warehouseWaybillService.findWaybillBillladingList(waybillNo,myCurrentWarehouse.getId()); + }catch (CustomerException e){ + log.error(e.message,e); + return R.fail(e.code,e.message); + }catch (Exception e){ + log.error(method+"系统异常",e); + return R.fail(500,"系统异常"); + } + } + + } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.java index e2ea97d0c..cddf742b1 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.java @@ -54,4 +54,6 @@ public interface WarehouseWaybillMapper extends BaseMapper findMoreWaybillNo(); Long findLastData(@Param("waybillNo") String waybillNo); + + List findWaybillBillladingList(@Param("waybillNo") String waybillNo,@Param("warehouseId") Long warehouseId); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml index 661c79b82..36e48b53b 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml @@ -171,4 +171,15 @@ + + diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWaybillService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWaybillService.java index 35e629fd0..5061222c0 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWaybillService.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWaybillService.java @@ -56,4 +56,7 @@ public interface IWarehouseWaybillService extends BaseService findMoreWaybillNo(); Long findLastData(String waybillNo); + + R findWaybillBillladingList(String waybillNo,Long warehouseId); + } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java index 7e0cbfbdb..70e0ffe26 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java @@ -154,21 +154,6 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl>>> 更新订单"); checkStatus(distributionStockArticleEntity); @@ -425,14 +406,12 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl submitList = new ArrayList<>(); - List articleList = distributionStockArticleClient.findListByOrderCodeLike(orderCode); List parcelListEntityList = distributionParcelListClient.findEntityListByOrderCode(orderCode, warehouseId); - int size = articleList.size(); Integer subNum = 0; for (int i = 0; i < splitOrderDTOList.size(); i++) { + List articleList = distributionStockArticleClient.findListByOrderCodeLike(orderCode); + int size = articleList.size(); SplitOrderDTO splitOrderDTO = splitOrderDTOList.get(i); DistributionStockArticleEntity entity = new DistributionStockArticleEntity(); BeanUtil.copyProperties(distributionStockArticleEntity, entity); @@ -444,36 +423,31 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl products = splitOrderDTO.getProducts(); StringBuffer stringBuffer = new StringBuffer(); Integer allNum = 0; - List list = new ArrayList<>(); for (ProductDTO productDTO : products) { - Integer splitNum = productDTO.getSplitNum(); - if (Objects.isNull(splitNum) || splitNum <= 0) { - log.info("#########splitOrder: 该条物料数量值不正确"); - continue; - } if (StringUtil.isBlank(stringBuffer.toString())) { stringBuffer.append(productDTO.getProductName()); } else { stringBuffer.append(",").append(productDTO.getProductName()); } - allNum = allNum + productDTO.getSplitNum(); - DistributionParcelListEntity distributionParcelListEntity = new DistributionParcelListEntity(); - DistributionParcelListEntity distributionParcelListEntity1 = parcelListEntityList.get(0); - BeanUtil.copyProperties(distributionParcelListEntity1, distributionParcelListEntity); - distributionParcelListEntity.setId(null); - distributionParcelListEntity.setFirsts(productDTO.getProductName()); - distributionParcelListEntity.setQuantity(productDTO.getSplitNum()); - list.add(distributionParcelListEntity); - submitList.add(productDTO); + Integer splitNum = productDTO.getSplitNum(); + if(Objects.isNull(splitNum)){ + splitNum = 0; + } + allNum = allNum + splitNum; } + subNum = subNum + allNum; entity.setDescriptionGoods(stringBuffer.toString()); entity.setTotalNumber(allNum); entity.setHandQuantity(allNum); + entity.setIncomingNum(allNum); //处理-1的值 entity.setNotification(2); entity.setFee(BigDecimal.ZERO); entity.setRate(BigDecimal.ZERO); entity.setAdvanceId(null); + entity.setGroundingStatus("10"); + entity.setFreezeStatus("10"); + entity.setOrderStatus("20"); entity.setReservationNum(0); entity.setCollectFee(BigDecimal.ZERO); entity.setStorageFee(BigDecimal.ZERO); @@ -494,55 +468,37 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl parcelNumberList = new ArrayList<>(); - for (DistributionParcelListEntity distributionParcelListEntity : list) { - DistributionParcelNumberEntity parcelNumberEntity = new DistributionParcelNumberEntity(); - parcelNumberEntity.setStockArticleId(distributionParcelListEntity.getStockArticleId()); - parcelNumberEntity.setParcelListId(distributionParcelListEntity.getId()); - parcelNumberEntity.setHandQuantity(distributionParcelListEntity.getQuantity()); - parcelNumberEntity.setQuantity(distributionParcelListEntity.getQuantity()); - parcelNumberEntity.setDeliveryQuantity(0); - parcelNumberEntity.setSigninQuantity(0); - parcelNumberEntity.setOutboundQuantity(0); - parcelNumberList.add(parcelNumberEntity); - } - //存入零担订单包件数量 - distributionParcelNumberClient.addBatch(parcelNumberList); - - //减少主订单上在库数量 - if (handQuantity - allNum < 0) { - log.warn("###########splitOrder: 拆单数量大于在库数量"); - throw new CustomerException(405, "拆单数量大于在库数量"); - } - distributionStockArticleEntity.setHandQuantity(handQuantity - allNum); - distributionStockArticleClient.submitHandQuantity(allNum, articleId); -// String orderSelfNumbering = distributionStockArticleEntity.getOrderCode(); -// warehouseWaybillMapper.submitStockCount(orderSelfNumbering, allNum); - //删除主订单包件对应数据 - for (ProductDTO productDTO : submitList) { - String productName = productDTO.getProductName(); - Integer num = productDTO.getSplitNum(); - boolean submitFlag = distributionParcelListClient.submitNumByOrderIdAndName(articleId, productName, num); - if (!submitFlag) { - log.warn("###########splitOrder: 减掉包件数量失败 articleId={},productName={},num={}", articleId, productName, num); - throw new CustomerException(405, "减掉包件数量失败"); + }else{ + List parcelNumberList = new ArrayList<>(); + for (ProductDTO productDTO : products) { + Integer splitNum = productDTO.getSplitNum(); + if(Objects.isNull(splitNum)){ + splitNum = 0; + } + DistributionParcelListEntity distributionParcelListEntity = new DistributionParcelListEntity(); + DistributionParcelListEntity distributionParcelListEntity1 = parcelListEntityList.get(0); + BeanUtil.copyProperties(distributionParcelListEntity1, distributionParcelListEntity); + distributionParcelListEntity.setId(null); + distributionParcelListEntity.setStockArticleId(aLong); + distributionParcelListEntity.setFirsts(productDTO.getProductName()); + distributionParcelListEntity.setQuantity(splitNum); + Long orderPackageId = distributionParcelListClient.addReturnId(distributionParcelListEntity); + + DistributionParcelNumberEntity parcelNumberEntity = new DistributionParcelNumberEntity(); + parcelNumberEntity.setStockArticleId(aLong); + parcelNumberEntity.setParcelListId(orderPackageId); + parcelNumberEntity.setHandQuantity(0); + parcelNumberEntity.setQuantity(distributionParcelListEntity.getQuantity()); + parcelNumberEntity.setDeliveryQuantity(0); + parcelNumberEntity.setSigninQuantity(0); + parcelNumberEntity.setOutboundQuantity(0); + parcelNumberList.add(parcelNumberEntity); } - subNum = subNum + num; + //存入零担订单包件数量 + distributionParcelNumberClient.addBatch(parcelNumberList); } - size++; } - //减去零担零担上的在库件数 -// distributionStockArticleClient.submitHandleNumByOrderId(subNum,articleId); - + distributionStockArticleClient.submitHandleNumByOrderId(subNum,articleId); } @@ -602,7 +558,7 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl list = baseMapper.findWaybillBillladingList(waybillNo,warehouseId); + + return R.data(list); + } }