From 7d3027b14dbf30ba5cfde1a4176e5fb139bf7a1a Mon Sep 17 00:00:00 2001
From: shanji <18996038927@163.com>
Date: Wed, 14 Jun 2023 13:28:52 +0800
Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E9=87=87=E8=B4=ADv2=E6=8E=A5?=
=?UTF-8?q?=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/BatchPurchaseController.cs | 22 ++
.../BatchPurchase/BatchPurchaseBusiness.cs | 351 +++++++++++++++++-
.../BatchPurchasePreviewOrderRequest.cs | 1 -
.../BatchPurchaseCargoParamRequestV2.cs | 90 +++++
.../BatchPurchaseCreateOrderRequestV2.cs | 25 ++
.../BatchPurchasePreviewOrderRequestV2.cs | 22 ++
6 files changed, 507 insertions(+), 4 deletions(-)
create mode 100644 BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase2/BatchPurchaseCargoParamRequestV2.cs
create mode 100644 BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase2/BatchPurchaseCreateOrderRequestV2.cs
create mode 100644 BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase2/BatchPurchasePreviewOrderRequestV2.cs
diff --git a/BBWY.Server.API/Controllers/BatchPurchaseController.cs b/BBWY.Server.API/Controllers/BatchPurchaseController.cs
index 276dbfe2..81eb963d 100644
--- a/BBWY.Server.API/Controllers/BatchPurchaseController.cs
+++ b/BBWY.Server.API/Controllers/BatchPurchaseController.cs
@@ -48,6 +48,28 @@ namespace BBWY.Server.API.Controllers
return batchPurchaseBusiness.BatchCreateOrder(request);
}
+ ///
+ /// 预览订单价格V2
+ ///
+ ///
+ ///
+ [HttpPost]
+ public PreviewOrderResponse PreviewOrderV2([FromBody] BatchPurchasePreviewOrderRequestV2 request)
+ {
+ return batchPurchaseBusiness.PreviewOrderV2(request);
+ }
+
+ ///
+ /// 批量创建采购单V2
+ ///
+ ///
+ ///
+ [HttpPost]
+ public BatchCreareOrderResponse BatchCreateOrderV2(BatchPurchaseCreateOrderRequestV2 request)
+ {
+ return batchPurchaseBusiness.BatchCreateOrderV2(request);
+ }
+
///
/// 获取采购单列表
///
diff --git a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
index 9f5b44e1..3ab3a661 100644
--- a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
+++ b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
@@ -2,7 +2,7 @@
using BBWY.Common.Models;
using BBWY.Server.Model;
using BBWY.Server.Model.Db;
-using BBWY.Server.Model.Db.QK;
+using BBWY.Server.Model.Db.Mds;
using BBWY.Server.Model.Dto;
using FreeSql;
using Newtonsoft.Json;
@@ -11,7 +11,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
-using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
using Yitter.IdGenerator;
@@ -24,17 +23,20 @@ namespace BBWY.Server.Business
private IEnumerable platformSDKBusinessList;
//private TaskSchedulerManager taskSchedulerManager;
private RestApiService restApiService;
+ private FreeSqlMultiDBManager freeSqlMultiDBManager;
public BatchPurchaseBusiness(IFreeSql fsql,
NLogManager nLogManager,
IIdGenerator idGenerator,
ProductBusiness productBusiness,
IEnumerable platformSDKBusinessList,
- RestApiService restApiService) : base(fsql, nLogManager, idGenerator)
+ RestApiService restApiService,
+ FreeSqlMultiDBManager freeSqlMultiDBManager) : base(fsql, nLogManager, idGenerator)
{
this.productBusiness = productBusiness;
this.platformSDKBusinessList = platformSDKBusinessList;
this.restApiService = restApiService;
+ this.freeSqlMultiDBManager = freeSqlMultiDBManager;
}
///
@@ -200,6 +202,85 @@ namespace BBWY.Server.Business
};
}
+ ///
+ /// 预览订单V2
+ ///
+ ///
+ ///
+ ///
+ public PreviewOrderResponse PreviewOrderV2(BatchPurchasePreviewOrderRequestV2 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 extJArray = new List