From 7f9ced25ff047d3818e1bb2330077aac181e9237 Mon Sep 17 00:00:00 2001
From: shanji <18996038927@163.com>
Date: Thu, 15 Jun 2023 14:52:52 +0800
Subject: [PATCH] 1
---
.../Controllers/BatchPurchaseController.cs | 2 +
.../BatchPurchase/BatchPurchaseBusiness.cs | 264 ++++++++++++++++++
2 files changed, 266 insertions(+)
diff --git a/BBWY.Server.API/Controllers/BatchPurchaseController.cs b/BBWY.Server.API/Controllers/BatchPurchaseController.cs
index 276dbfe2..9de11af3 100644
--- a/BBWY.Server.API/Controllers/BatchPurchaseController.cs
+++ b/BBWY.Server.API/Controllers/BatchPurchaseController.cs
@@ -1,5 +1,6 @@
using BBWY.Server.Business;
using BBWY.Server.Model.Dto;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
@@ -87,6 +88,7 @@ namespace BBWY.Server.API.Controllers
///
///
[HttpPost]
+ [AllowAnonymous]
public UpdatePackStateResponse UpdatePurchaseOrderState([FromBody] UpdatePurchaseOrderStateRequest request)
{
return batchPurchaseBusiness.UpdatePurchaseOrderState(request);
diff --git a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
index 00aca985..451257c7 100644
--- a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
+++ b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
@@ -431,6 +431,270 @@ namespace BBWY.Server.Business
};
}
+ ///
+ /// 创建订单
+ ///
+ ///
+ public BatchCreareOrderResponse BatchCreateOrderV2(BatchPurchaseCreateOrderRequestV2 request)
+ {
+ /*
+ 下单日志
+ */
+ var loggerName = $"批量采购-{request.ShopName}";
+ nLogManager.GetLogger(loggerName).Info(JsonConvert.SerializeObject(request));
+
+ if (request.CargoParamGroupList == null || request.CargoParamGroupList.Count() == 0 ||
+ request.CargoParamGroupList.Any(g => g.CargoParamList == null || g.CargoParamList.Count() == 0 || string.IsNullOrEmpty(g.PurchaserId)))
+ throw new BusinessException("缺少商品参数");
+ if (request.Consignee == null ||
+ string.IsNullOrEmpty(request.Consignee.Address) ||
+ string.IsNullOrEmpty(request.Consignee.Mobile) ||
+ string.IsNullOrEmpty(request.Consignee.ContactName))
+ throw new BusinessException("缺少收货人信息");
+ if (request.PurchaseAccountList == null || request.PurchaseAccountList.Count() == 0)
+ throw new BusinessException("缺少采购账号");
+
+ var shop = freeSqlMultiDBManager.MDSfsql.Select().Where(s => s.ShopId == request.ShopId.ToString()).ToOne();
+ if (shop == null)
+ throw new BusinessException("无效的店铺Id");
+ var successSkuIdList = new List();
+ var failSkuList = new List();
+ var qikuPackSkuConfigRequestList = new List