|
|
|
@ -256,23 +256,28 @@ public class OutstorageServiceImpl implements OutstorageService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void dsPurchaseAutoOutStorage(ShopBO shopBO, OpOrder opOrder, PurchaseOrder purchaseOrder) {
|
|
|
|
|
log.info("dsPurchaseAutoOutStorage_begin_" + opOrder.getOrderId());
|
|
|
|
|
DsPurchaseSetting dsPurchaseSetting = dsPurchaseSettingService.getShopSetting(opOrder.getShopId());
|
|
|
|
|
if (purchaseOrder.getItems() == null) {
|
|
|
|
|
List<PurchaseOrderItem> items = purchaseOrderItemService.getRelatePurchaseOrderItemsByPurchaseOrderId(purchaseOrder.getPurchaseOrderId());
|
|
|
|
|
purchaseOrder.setItems(items);
|
|
|
|
|
}
|
|
|
|
|
log.info("getOrderStatus: " + opOrder.getOrderStatus());
|
|
|
|
|
// try {
|
|
|
|
|
try {
|
|
|
|
|
if (opOrder.getOrderStatus().equals(OrderConst.ORDER_STATUS_WAIT_SELLER_SEND_GOODS)) {
|
|
|
|
|
log.info("dsPurchaseAutoOutStorage: dsOrderOutStorage" + opOrder.getOrderId());
|
|
|
|
|
dsOrderOutStorage(shopBO, opOrder, purchaseOrder, dsPurchaseSetting);
|
|
|
|
|
} else if (opOrder.getOrderStatus().equals(OrderConst.ORDER_STATUS_WAIT_BUYER_CONFIRM_GOODS) || opOrder.getOrderStatus().equals(OrderConst.ORDER_STATUS_PART_DELIVERY)) {
|
|
|
|
|
log.info("dsPurchaseAutoOutStorage: dsOrderOutStorageOrUpdateOutStorageLogistics" + opOrder.getOrderId());
|
|
|
|
|
dsOrderOutStorageOrUpdateOutStorageLogistics(shopBO, opOrder, purchaseOrder, dsPurchaseSetting);
|
|
|
|
|
} else {
|
|
|
|
|
log.error("dsPurchaseAutoOutStorageNotNeed_" + opOrder.getOrderId());
|
|
|
|
|
throw new RuntimeException("订单状态未达到发货条件");
|
|
|
|
|
}
|
|
|
|
|
// } catch (RuntimeException e) {
|
|
|
|
|
// opOrderOutstorageHistoryService.addOrderOutstorageHistory(shopBO.getShopId(), opOrder.getOrderId(), );;
|
|
|
|
|
// }
|
|
|
|
|
} catch (RuntimeException e) {
|
|
|
|
|
log.error("dsPurchaseAutoOutStorageError_" + opOrder.getOrderId(), e);
|
|
|
|
|
opOrderOutstorageHistoryService.addOrderOutstorageHistory(shopBO.getShopId(), Collections.singletonList(opOrder.getOrderId()), 0, purchaseOrder.getPurchaseOrderWaybillCode(), LogisticsConst.outstorageSourceDsAuto, 0, ResultDTO.fail(e.getMessage()));;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void dsOrderOutStorage(ShopBO shopBO, OpOrder opOrder, PurchaseOrder purchaseOrder, DsPurchaseSetting dsPurchaseSetting) {
|
|
|
|
|