diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java index c71910a4d..b1fe8a953 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java @@ -484,20 +484,34 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { logger.warn("#################handleDataToPlatform: 保存订单信息失败 orderSelfNum={}", orderSelfNum); throw new CustomerException(405, "保存订单信息失败"); } - } else { - id = distributionStockArticleEntity.getId(); - String waybillNumber = distributionStockArticleEntity.getWaybillNumber(); - if(!waybillNumber.contains(waybillNoNum)){ - waybillNumber = waybillNumber+","+waybillNoNum; - } - distributionStockArticleEntity.setWaybillNumber(waybillNumber); - distributionStockArticleClient.saveOrUpdate(distributionStockArticleEntity); } - - //查询包件信息数据 + id = distributionStockArticleEntity.getId(); + //保存包件信息 saveOrderPackage(unitNo, distributionStockArticleEntity, id, basicdataWarehouseEntity, waybillNoNum); - //包件保存成功去修改订单的数量 - distributionStockArticleClient.addHandQuantity(id, 1); + + + + String waybillNumber = distributionStockArticleEntity.getWaybillNumber(); + if(!waybillNumber.contains(waybillNoNum)){ + waybillNumber = waybillNumber+","+waybillNoNum; + } + distributionStockArticleEntity.setWaybillNumber(waybillNumber); + + // 修改入库状态 + distributionStockArticleEntity.setHandQuantity(distributionStockArticleEntity.getHandQuantity().intValue()+1); + String orderStatus = checkDistributionStockArticleOrderStatus(distributionStockArticleEntity); + distributionStockArticleEntity.setOrderStatus(orderStatus); + + // 修改收货 + if(distributionStockArticleEntity.getOrderStatus().equals(OrderStatusConstant.ruku.getValue())){ + distributionStockArticleEntity.setOrderReceiveStatus(OrderReceiveStatusConstant.yishouhuo.getValue()); + } + // 修改最新的入库时间 + distributionStockArticleEntity.setWarehouseEntryTimeEnd(new Date()); + distributionStockArticleClient.saveOrUpdate(distributionStockArticleEntity); + +// //包件保存成功去修改订单的数量 +// distributionStockArticleClient.addHandQuantity(id, 1); // todo 这里需要根据包件状态修改状态 logger.info("#################handleDataToPlatform: 数据处理完成"); } else { @@ -506,6 +520,26 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { } } + /** + * 根据订单的在库数联返回订单的状态 + * @param distributionStockArticleEntity + * @return + */ + private String checkDistributionStockArticleOrderStatus(DistributionStockArticleEntity distributionStockArticleEntity) { + + if(ObjectUtils.isNull(distributionStockArticleEntity)){ + return null; + } + if (distributionStockArticleEntity.getTotalNumber().equals(distributionStockArticleEntity.getHandQuantity())){ + // 如果订单总数 和在库件数一致 表示入库完成 + return OrderStatusConstant.ruku.getValue(); + } + return OrderStatusConstant.bufenruku.getValue(); + + + } + + /** * 根据客户ID 查询客户的配送类型 *