|
|
|
@ -154,21 +154,6 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
|
|
|
|
|
warehouseWayBillDetailService.addList(ls); |
|
|
|
|
//createStockArticle(warehouseWaybill);
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
Integer totalCount = warehouseWaybill.getTotalCount(); |
|
|
|
|
Integer stockCount = warehouseWaybill.getStockCount(); |
|
|
|
|
if (totalCount.compareTo(stockCount + allNum) < 0) { |
|
|
|
|
log.warn("##############waybillDataHandler: 运单的总数量异常 totalCount={} stockCount={} allNum={}", totalCount, stockCount, allNum); |
|
|
|
|
throw new CustomerException("运单的总数量异常"); |
|
|
|
|
} |
|
|
|
|
warehouseWaybill.setStockCount(stockCount + allNum); |
|
|
|
|
warehouseWaybill.setUpdateTime(date); |
|
|
|
|
warehouseWaybillMapper.updateById(warehouseWaybill); |
|
|
|
|
// //修改在库订单的在库数量
|
|
|
|
|
// DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findByOrderSelfNum(waybillNo);
|
|
|
|
|
// distributionStockArticleClient.addHandQuantity(stockArticleEntity.getId(), allNum);
|
|
|
|
|
// waybillId = warehouseWaybill.getId();
|
|
|
|
|
//判断是否需要创建在库订单
|
|
|
|
|
} |
|
|
|
|
//创建在库订单
|
|
|
|
|
createStockArticle(warehouseWaybill,allNum); |
|
|
|
@ -207,7 +192,7 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
|
|
|
|
|
distributionStockArticleEntity.setWarehouse(basicdataWarehouseEntity.getName()); |
|
|
|
|
distributionStockArticleEntity.setWarehouseEntryTime(date); |
|
|
|
|
distributionStockArticleEntity.setTotalNumber(totalCount); |
|
|
|
|
distributionStockArticleEntity.setHandQuantity(stockCount); |
|
|
|
|
distributionStockArticleEntity.setHandQuantity(allNum); |
|
|
|
|
//零担订单默认齐套
|
|
|
|
|
distributionStockArticleEntity.setCompleteSet(1); |
|
|
|
|
|
|
|
|
@ -310,11 +295,7 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
|
|
|
|
|
parcelNumberEntity.setCreateUser(distributionStockArticleEntity.getCreateUser()); |
|
|
|
|
parcelNumberEntity.setUpdateUser(distributionStockArticleEntity.getCreateUser()); |
|
|
|
|
parcelNumberEntity.setCreateDept(distributionStockArticleEntity.getCreateDept()); |
|
|
|
|
if(totalCount.equals(stockCount)){ |
|
|
|
|
parcelNumberEntity.setHandQuantity(entity.getQuantity()); |
|
|
|
|
}else{ |
|
|
|
|
parcelNumberEntity.setHandQuantity(0); |
|
|
|
|
} |
|
|
|
|
parcelNumberEntity.setHandQuantity(0); |
|
|
|
|
parcelNumberEntity.setQuantity(entity.getQuantity()); |
|
|
|
|
parcelNumberEntity.setDeliveryQuantity(0); |
|
|
|
|
parcelNumberEntity.setSigninQuantity(0); |
|
|
|
@ -328,9 +309,9 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
id = distributionStockArticleEntity.getId(); |
|
|
|
|
|
|
|
|
|
Integer handQuantity = distributionStockArticleEntity.getHandQuantity(); |
|
|
|
|
distributionStockArticleEntity.setTotalNumber(totalCount); |
|
|
|
|
distributionStockArticleEntity.setHandQuantity(stockCount); |
|
|
|
|
distributionStockArticleEntity.setHandQuantity(handQuantity+allNum); |
|
|
|
|
distributionStockArticleEntity.setWarehouseEntryTimeEnd(date); |
|
|
|
|
log.info(">>>> 更新订单"); |
|
|
|
|
checkStatus(distributionStockArticleEntity); |
|
|
|
@ -425,14 +406,12 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String orderCode = distributionStockArticleEntity.getOrderCode(); |
|
|
|
|
Long orderId = distributionStockArticleEntity.getId(); |
|
|
|
|
Long warehouseId = distributionStockArticleEntity.getWarehouseId(); |
|
|
|
|
List<ProductDTO> submitList = new ArrayList<>(); |
|
|
|
|
List<DistributionStockArticleEntity> articleList = distributionStockArticleClient.findListByOrderCodeLike(orderCode); |
|
|
|
|
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findEntityListByOrderCode(orderCode, warehouseId); |
|
|
|
|
int size = articleList.size(); |
|
|
|
|
Integer subNum = 0; |
|
|
|
|
for (int i = 0; i < splitOrderDTOList.size(); i++) { |
|
|
|
|
List<DistributionStockArticleEntity> 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<WarehouseWaybil
|
|
|
|
|
List<ProductDTO> products = splitOrderDTO.getProducts(); |
|
|
|
|
StringBuffer stringBuffer = new StringBuffer(); |
|
|
|
|
Integer allNum = 0; |
|
|
|
|
List<DistributionParcelListEntity> 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<WarehouseWaybil
|
|
|
|
|
if (aLong == 0) { |
|
|
|
|
log.warn("###########splitOrder: 保存新订单数据失败"); |
|
|
|
|
throw new CustomerException(405, "保存新订单数据失败"); |
|
|
|
|
} |
|
|
|
|
for (DistributionParcelListEntity distributionParcelListEntity : list) { |
|
|
|
|
distributionParcelListEntity.setStockArticleId(aLong); |
|
|
|
|
} |
|
|
|
|
boolean b = distributionParcelListClient.addBatch(list); |
|
|
|
|
if (!b) { |
|
|
|
|
log.warn("###########splitOrder: 保存包件数据失败"); |
|
|
|
|
throw new CustomerException(405, "保存包件数据失败"); |
|
|
|
|
} |
|
|
|
|
List<DistributionParcelNumberEntity> 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<DistributionParcelNumberEntity> 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<WarehouseWaybil
|
|
|
|
|
warehouseWaybill.setDestination(wayBillEntity.getArriveSite()); |
|
|
|
|
warehouseWaybill.setGoodsName(packname); |
|
|
|
|
warehouseWaybill.setTotalCount(number); |
|
|
|
|
warehouseWaybill.setStockCount(allNum); |
|
|
|
|
warehouseWaybill.setStockCount(number); |
|
|
|
|
warehouseWaybill.setTotalWeight(wayBillEntity.getWeight()); |
|
|
|
|
warehouseWaybill.setTotalVolume(wayBillEntity.getVolume()); |
|
|
|
|
warehouseWaybill.setDeliveryMethod(wayBillEntity.getSendType()); |
|
|
|
@ -786,4 +742,12 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
|
|
|
|
|
public Long findLastData(String waybillNo) { |
|
|
|
|
return baseMapper.findLastData(waybillNo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R findWaybillBillladingList(String waybillNo,Long warehouseId) { |
|
|
|
|
|
|
|
|
|
List<WarehouseWaybillEntity> list = baseMapper.findWaybillBillladingList(waybillNo,warehouseId); |
|
|
|
|
|
|
|
|
|
return R.data(list); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|