|
|
@ -93,8 +93,8 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String waybillNo = wayBillEntity.getWaybillNo(); |
|
|
|
String waybillNo = wayBillEntity.getWaybillNo(); |
|
|
|
if(ObjectUtils.isEmpty(allNum)){ |
|
|
|
if (ObjectUtils.isEmpty(allNum)) { |
|
|
|
allNum=wayBillEntity.getNumber(); |
|
|
|
allNum = wayBillEntity.getNumber(); |
|
|
|
} |
|
|
|
} |
|
|
|
//通过运单号先去查询新系统是否存在这个运单号
|
|
|
|
//通过运单号先去查询新系统是否存在这个运单号
|
|
|
|
QueryWrapper<WarehouseWaybillEntity> waybillQueryWrapper = new QueryWrapper<>(); |
|
|
|
QueryWrapper<WarehouseWaybillEntity> waybillQueryWrapper = new QueryWrapper<>(); |
|
|
@ -128,7 +128,7 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
warehouseWayBillDetailService.addList(ls); |
|
|
|
warehouseWayBillDetailService.addList(ls); |
|
|
|
createStockArticle(warehouseWaybill); |
|
|
|
//createStockArticle(warehouseWaybill);
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Integer totalCount = warehouseWaybill.getTotalCount(); |
|
|
|
Integer totalCount = warehouseWaybill.getTotalCount(); |
|
|
@ -140,20 +140,18 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil |
|
|
|
warehouseWaybill.setStockCount(stockCount + allNum); |
|
|
|
warehouseWaybill.setStockCount(stockCount + allNum); |
|
|
|
warehouseWaybill.setUpdateTime(date); |
|
|
|
warehouseWaybill.setUpdateTime(date); |
|
|
|
warehouseWaybillMapper.updateById(warehouseWaybill); |
|
|
|
warehouseWaybillMapper.updateById(warehouseWaybill); |
|
|
|
//修改在库订单的在库数量
|
|
|
|
// //修改在库订单的在库数量
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findByOrderSelfNum(waybillNo); |
|
|
|
// DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findByOrderSelfNum(waybillNo);
|
|
|
|
distributionStockArticleClient.addHandQuantity(stockArticleEntity.getId(), allNum); |
|
|
|
// distributionStockArticleClient.addHandQuantity(stockArticleEntity.getId(), allNum);
|
|
|
|
waybillId = warehouseWaybill.getId(); |
|
|
|
// waybillId = warehouseWaybill.getId();
|
|
|
|
//判断是否需要创建在库订单
|
|
|
|
//判断是否需要创建在库订单
|
|
|
|
} |
|
|
|
} |
|
|
|
if (isOrder) { |
|
|
|
//创建在库订单
|
|
|
|
//创建在库订单
|
|
|
|
createStockArticle(warehouseWaybill); |
|
|
|
createStockArticle(warehouseWaybill); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
log.info("###############waybillDataHandler: 处理数据结束 waybillNo={}", waybillNo); |
|
|
|
log.info("###############waybillDataHandler: 处理数据结束 waybillNo={}", waybillNo); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private final void createStockArticle(WarehouseWaybillEntity warehouseWaybill) { |
|
|
|
private void createStockArticle(WarehouseWaybillEntity warehouseWaybill) { |
|
|
|
//判断新系统是否有这条订单数据
|
|
|
|
//判断新系统是否有这条订单数据
|
|
|
|
//自动生成的在库订单就用运单号作为订单号
|
|
|
|
//自动生成的在库订单就用运单号作为订单号
|
|
|
|
String waybillNo = warehouseWaybill.getWaybillNo(); |
|
|
|
String waybillNo = warehouseWaybill.getWaybillNo(); |
|
|
@ -180,7 +178,7 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil |
|
|
|
distributionStockArticleEntity.setWarehouse(basicdataWarehouseEntity.getName()); |
|
|
|
distributionStockArticleEntity.setWarehouse(basicdataWarehouseEntity.getName()); |
|
|
|
distributionStockArticleEntity.setWarehouseEntryTime(date); |
|
|
|
distributionStockArticleEntity.setWarehouseEntryTime(date); |
|
|
|
distributionStockArticleEntity.setTotalNumber(totalCount); |
|
|
|
distributionStockArticleEntity.setTotalNumber(totalCount); |
|
|
|
distributionStockArticleEntity.setHandQuantity(totalCount); |
|
|
|
distributionStockArticleEntity.setHandQuantity(stockCount); |
|
|
|
//零担订单默认齐套
|
|
|
|
//零担订单默认齐套
|
|
|
|
distributionStockArticleEntity.setCompleteSet(1); |
|
|
|
distributionStockArticleEntity.setCompleteSet(1); |
|
|
|
|
|
|
|
|
|
|
@ -216,48 +214,101 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil |
|
|
|
distributionStockArticleEntity.setGroundingStatus(OrderGroundingStatusConstant.daishangjia.getValue()); //上架状态
|
|
|
|
distributionStockArticleEntity.setGroundingStatus(OrderGroundingStatusConstant.daishangjia.getValue()); //上架状态
|
|
|
|
distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.bufenruku.getValue()); |
|
|
|
distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.bufenruku.getValue()); |
|
|
|
distributionStockArticleEntity.setOrderReceiveStatus(OrderReceiveStatusConstant.bufenshouhuo.getValue()); |
|
|
|
distributionStockArticleEntity.setOrderReceiveStatus(OrderReceiveStatusConstant.bufenshouhuo.getValue()); |
|
|
|
|
|
|
|
checkStatus(distributionStockArticleEntity); |
|
|
|
|
|
|
|
|
|
|
|
distributionStockArticleEntity.setConsigneeUnit(customerName);//收货单位(经销商)
|
|
|
|
distributionStockArticleEntity.setConsigneeUnit(customerName);//收货单位(经销商)
|
|
|
|
distributionStockArticleEntity.setConsigneePerson(warehouseWaybill.getConsigneeName());//收货人
|
|
|
|
distributionStockArticleEntity.setConsigneePerson(warehouseWaybill.getConsigneeName());//收货人
|
|
|
|
distributionStockArticleEntity.setIsZero("1"); |
|
|
|
distributionStockArticleEntity.setIsZero("1"); |
|
|
|
distributionStockArticleEntity.setTenantId(TenantNum.HUITONGCODE); |
|
|
|
distributionStockArticleEntity.setTenantId(TenantNum.HUITONGCODE); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<WarehouseWayBillDetail> details = warehouseWayBillDetailService.findByWaybillId(waybillId); |
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
|
|
|
|
for (WarehouseWayBillDetail warehouseWayBillDetail : details) { |
|
|
|
|
|
|
|
if (!sb.toString().isEmpty()) { |
|
|
|
|
|
|
|
sb.append(","); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
sb.append(warehouseWayBillDetail.getProductName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
distributionStockArticleEntity.setDescriptionGoods(sb.toString()); |
|
|
|
|
|
|
|
|
|
|
|
id = distributionStockArticleClient.addData(distributionStockArticleEntity); |
|
|
|
id = distributionStockArticleClient.addData(distributionStockArticleEntity); |
|
|
|
if (id == 0) { |
|
|
|
if (id == 0) { |
|
|
|
log.warn("#################createStockArticle: 保存订单信息失败 orderSelfNum={}", waybillNo); |
|
|
|
log.warn("#################createStockArticle: 保存订单信息失败 orderSelfNum={}", waybillNo); |
|
|
|
throw new CustomerException(405, "保存订单信息失败"); |
|
|
|
throw new CustomerException(405, "保存订单信息失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
id = distributionStockArticleEntity.getId(); |
|
|
|
id = distributionStockArticleEntity.getId(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//存入包件信息
|
|
|
|
distributionStockArticleEntity.setTotalNumber(totalCount); |
|
|
|
List<WarehouseWayBillDetail> details = warehouseWayBillDetailService.findByWaybillId(waybillId); |
|
|
|
distributionStockArticleEntity.setHandQuantity(stockCount); |
|
|
|
List<DistributionParcelListEntity> ls = new ArrayList<>(); |
|
|
|
log.info(">>>> 更新订单"); |
|
|
|
for (WarehouseWayBillDetail warehouseWayBillDetail : details) { |
|
|
|
checkStatus(distributionStockArticleEntity); |
|
|
|
DistributionParcelListEntity entity = new DistributionParcelListEntity(); |
|
|
|
distributionStockArticleClient.saveOrUpdate(distributionStockArticleEntity); |
|
|
|
entity.setMaterialName(warehouseWayBillDetail.getProductName()); |
|
|
|
|
|
|
|
entity.setQuantity(warehouseWayBillDetail.getNum()); |
|
|
|
|
|
|
|
entity.setConditions(3); |
|
|
|
|
|
|
|
entity.setStockArticleId(id); |
|
|
|
|
|
|
|
ls.add(entity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
boolean b = distributionParcelListClient.addBatch(ls); |
|
|
|
|
|
|
|
if (!b) { |
|
|
|
|
|
|
|
log.warn("#################createStockArticle: 保存包件信息失败 orderSelfNum={}", waybillNo); |
|
|
|
|
|
|
|
throw new CustomerException(405, "保存包件信息失败"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// 判断运单的货物是否齐套
|
|
|
|
|
|
|
|
// todo 目前这里无法判断零担货物是否齐套 默认已到期
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 存入包件信息
|
|
|
|
|
|
|
|
// List<WarehouseWayBillDetail> details = warehouseWayBillDetailService.findByWaybillId(waybillId);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // 查询运单的附件
|
|
|
|
|
|
|
|
// List<DistributionParcelListEntity> tesmn = distributionParcelListClient.findEntityListByOrderCode(distributionStockArticleEntity.getOrderCode());
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if(ObjectUtils.isEmpty(tesmn)||tesmn.isEmpty()){
|
|
|
|
|
|
|
|
// // 新增
|
|
|
|
|
|
|
|
// DistributionParcelListEntity entity = new DistributionParcelListEntity();
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// entity.setQuantity(stockCount);
|
|
|
|
|
|
|
|
// entity.setConditions(3);
|
|
|
|
|
|
|
|
// entity.setStockArticleId(id);
|
|
|
|
|
|
|
|
// entity.setWarehouse(distributionStockArticleEntity.getWarehouse());
|
|
|
|
|
|
|
|
// entity.setWarehouseId(distributionStockArticleEntity.getWarehouseId());
|
|
|
|
|
|
|
|
// entity.setOrderCode(distributionStockArticleEntity.getOrderCode());
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// for (WarehouseWayBillDetail warehouseWayBillDetail : details) {
|
|
|
|
|
|
|
|
// entity.setMaterialName((StringUtil.isBlank(entity.getMaterialName())?"":entity.getMaterialName())+warehouseWayBillDetail.getProductName());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// distributionParcelListClient.add(entity);
|
|
|
|
|
|
|
|
// }else{
|
|
|
|
|
|
|
|
// // 更新
|
|
|
|
|
|
|
|
// DistributionParcelListEntity distributionParcelListEntity = tesmn.get(0);
|
|
|
|
|
|
|
|
// distributionParcelListEntity.setQuantity(stockCount);
|
|
|
|
|
|
|
|
// distributionParcelListClient.update(distributionParcelListEntity);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// List<DistributionParcelListEntity> ls = new ArrayList<>();
|
|
|
|
|
|
|
|
// for (WarehouseWayBillDetail warehouseWayBillDetail : details) {
|
|
|
|
|
|
|
|
// DistributionParcelListEntity entity = new DistributionParcelListEntity();
|
|
|
|
|
|
|
|
// entity.setMaterialName(warehouseWayBillDetail.getProductName());
|
|
|
|
|
|
|
|
// entity.setQuantity(warehouseWayBillDetail.getNum());
|
|
|
|
|
|
|
|
// entity.setConditions(3);
|
|
|
|
|
|
|
|
// entity.setStockArticleId(id);
|
|
|
|
|
|
|
|
// ls.add(entity);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// boolean b = distributionParcelListClient.addBatch(ls);
|
|
|
|
|
|
|
|
// if (!b) {
|
|
|
|
|
|
|
|
// log.warn("#################createStockArticle: 保存包件信息失败 orderSelfNum={}", waybillNo);
|
|
|
|
|
|
|
|
// throw new CustomerException(405, "保存包件信息失败");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// 判断运单的货物是否齐套
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void checkStatus(DistributionStockArticleEntity distributionStockArticleEntity) { |
|
|
|
|
|
|
|
// 判断数联
|
|
|
|
|
|
|
|
if (distributionStockArticleEntity.getTotalNumber().equals(distributionStockArticleEntity.getHandQuantity())) { |
|
|
|
|
|
|
|
distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.ruku.getValue()); |
|
|
|
|
|
|
|
distributionStockArticleEntity.setOrderReceiveStatus(OrderReceiveStatusConstant.yishouhuo.getValue()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public WarehouseWaybillEntity findByWaybillNo(String waybillNo) { |
|
|
|
public WarehouseWaybillEntity findByWaybillNo(String waybillNo) { |
|
|
|
QueryWrapper<WarehouseWaybillEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
QueryWrapper<WarehouseWaybillEntity> queryWrapper = new QueryWrapper<>(); |
|
|
@ -464,6 +515,6 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil |
|
|
|
public IPage<WarehouseWaybillEntity> selectPage(IPage<WarehouseWaybillEntity> page, QueryWrapper<WarehouseWaybillEntity> queryWrapper) { |
|
|
|
public IPage<WarehouseWaybillEntity> selectPage(IPage<WarehouseWaybillEntity> page, QueryWrapper<WarehouseWaybillEntity> queryWrapper) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return this.page(page,queryWrapper); |
|
|
|
return this.page(page, queryWrapper); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|