From 2f7d0392d1c52eeb9ae74a20175519bc1eec2fa9 Mon Sep 17 00:00:00 2001
From: "506583276@qq.com" <506583276@qq.com>
Date: Fri, 12 May 2023 22:08:07 +0800
Subject: [PATCH 01/19] =?UTF-8?q?=E5=90=88=E5=B9=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
BBWY.Client/Views/MainWindow.xaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/BBWY.Client/Views/MainWindow.xaml b/BBWY.Client/Views/MainWindow.xaml
index 9cdc135b..1c7172c2 100644
--- a/BBWY.Client/Views/MainWindow.xaml
+++ b/BBWY.Client/Views/MainWindow.xaml
@@ -26,7 +26,7 @@
-
+
From 731198b78a35c8a323d781d76c1148ba19e913c7 Mon Sep 17 00:00:00 2001
From: shanj <18996038927@163.com>
Date: Sun, 14 May 2023 17:03:11 +0800
Subject: [PATCH 02/19] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=87=87=E8=B4=AD?=
=?UTF-8?q?=E5=8D=95=E7=AD=BE=E6=94=B6=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/PurchaseOrderController.cs | 13 ++-
.../PurchaseOrder/PurchaseOrderBusiness.cs | 37 ++++++--
.../Callback/BBWYBDelivertCallBackRequest.cs | 16 ++++
BBWY.Test/Program.cs | 91 +++++++++++++++----
4 files changed, 129 insertions(+), 28 deletions(-)
create mode 100644 BBWY.Server.Model/Dto/Request/PurchaseOrder/Callback/BBWYBDelivertCallBackRequest.cs
diff --git a/BBWY.Server.API/Controllers/PurchaseOrderController.cs b/BBWY.Server.API/Controllers/PurchaseOrderController.cs
index 1684f932..caf9b7c4 100644
--- a/BBWY.Server.API/Controllers/PurchaseOrderController.cs
+++ b/BBWY.Server.API/Controllers/PurchaseOrderController.cs
@@ -105,9 +105,20 @@ namespace BBWY.Server.API.Controllers
///
[HttpPost]
[AllowAnonymous]
- public void QuanTanEditPriceCallback(QuanTanEditPriceNotifyRequest request)
+ public void QuanTanEditPriceCallback([FromBody] QuanTanEditPriceNotifyRequest request)
{
purchaseOrderBusiness.QuanTanEditPriceCallback(request);
}
+
+ ///
+ /// 签收采购单
+ ///
+ ///
+ [HttpPost]
+ [AllowAnonymous]
+ public void SignPurchaseOrder([FromBody] BBWYBSignCallBackRequest request)
+ {
+ purchaseOrderBusiness.SignPurchaseOrder(request);
+ }
}
}
diff --git a/BBWY.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs b/BBWY.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs
index 31092f97..c86f3325 100644
--- a/BBWY.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs
+++ b/BBWY.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs
@@ -369,7 +369,7 @@ namespace BBWY.Server.Business
#region CallBack
- #region 1688CallBack
+ #region 1688 CallBack
public void CallbackFrom1688(string jsonStr)
{
nLogManager.Default().Info(jsonStr);
@@ -415,7 +415,7 @@ namespace BBWY.Server.Business
}
#endregion
- #region 拳探回调
+ #region QuanTan Callback
public void QuanTanSendGoodsCallback(QuanTanSendGoodsNotifyRequest request)
{
Task.Factory.StartNew(() => DeliveryCallback(request.OrderId, new WayBillNoResponse()
@@ -425,12 +425,12 @@ namespace BBWY.Server.Business
WayBillNo = request.WayBillNo,
}, Enums.Platform.拳探), CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.PurchaseOrderCallbackTaskScheduler);
- //Task.Factory.StartNew(() => DeliveryCallbackForPurchaseOrder(request.OrderId, new WayBillNoResponse()
- //{
- // LogisticsCompanyId = request.ExpressId,
- // LogisticsCompanyName = request.ExpressName,
- // WayBillNo = request.WayBillNo,
- //}, Enums.Platform.拳探), CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.PurchaseOrderCallbackTaskScheduler);
+ Task.Factory.StartNew(() => DeliveryCallbackForPurchaseOrder(request.OrderId, new WayBillNoResponse()
+ {
+ LogisticsCompanyId = request.ExpressId,
+ LogisticsCompanyName = request.ExpressName,
+ WayBillNo = request.WayBillNo,
+ }, Enums.Platform.拳探), CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.PurchaseOrderCallbackTaskScheduler);
}
public void QuanTanEditPriceCallback(QuanTanEditPriceNotifyRequest request)
@@ -442,6 +442,19 @@ namespace BBWY.Server.Business
}
#endregion
+ #region bbwyb Callback
+ public void SignPurchaseOrder(BBWYBSignCallBackRequest request)
+ {
+ var pv2 = fsql.Select(request.OrderId).ToOne();
+ if (pv2.OrderState == Enums.PurchaseOrderState.待收货)
+ {
+ fsql.Update(request.OrderId).Set(p => p.OrderState, Enums.PurchaseOrderState.待质检)
+ .Set(p => p.SignTime, DateTime.Now)
+ .ExecuteAffrows();
+ }
+ }
+ #endregion
+
///
/// 采购平台发货回调(一件代发)
///
@@ -572,6 +585,14 @@ namespace BBWY.Server.Business
if (purchaseOrderV2 == null)
throw new Exception("未查询到采购单信息");
+ fsql.Update(purchaseOrderId).SetIf(purchaseOrderV2.OrderState == Enums.PurchaseOrderState.待发货 ||
+ purchaseOrderV2.OrderState == Enums.PurchaseOrderState.待付款,
+ p => p.OrderState, Enums.PurchaseOrderState.待收货)
+ .Set(p => p.ExpressName, wayBillNoResponse.LogisticsCompanyName)
+ .Set(p => p.WaybillNo, wayBillNoResponse.WayBillNo)
+ .ExecuteAffrows();
+
+
}
catch (Exception ex)
{
diff --git a/BBWY.Server.Model/Dto/Request/PurchaseOrder/Callback/BBWYBDelivertCallBackRequest.cs b/BBWY.Server.Model/Dto/Request/PurchaseOrder/Callback/BBWYBDelivertCallBackRequest.cs
new file mode 100644
index 00000000..41008cd8
--- /dev/null
+++ b/BBWY.Server.Model/Dto/Request/PurchaseOrder/Callback/BBWYBDelivertCallBackRequest.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace BBWY.Server.Model.Dto
+{
+ public class BBWYBDeliveryCallBackRequest
+ {
+ public string OrderId { get; set; }
+ }
+
+ public class BBWYBSignCallBackRequest : BBWYBDeliveryCallBackRequest
+ {
+
+ }
+}
diff --git a/BBWY.Test/Program.cs b/BBWY.Test/Program.cs
index f111c6f1..ec05aa1d 100644
--- a/BBWY.Test/Program.cs
+++ b/BBWY.Test/Program.cs
@@ -1,7 +1,11 @@
-using Jd.Api;
+using com.alibaba.openapi.client;
+using com.alibaba.openapi.client.policy;
+using Jd.Api;
using Jd.Api.Request;
+using Microsoft.Extensions.DependencyInjection;
using System;
using System.Linq;
+using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
@@ -22,6 +26,14 @@ namespace BBWY.Test
}
}
+ private static SyncAPIClient GetSyncAPIClient(string appKey, string appSecret)
+ {
+ var sercvice = new ServiceCollection();
+ sercvice.AddHttpClient();
+ var servicePriovder = sercvice.BuildServiceProvider();
+ return new SyncAPIClient(appKey, appSecret, new Common.Http.RestApiService(servicePriovder.GetRequiredService()));
+ }
+
static void Main(string[] args)
{
@@ -41,29 +53,70 @@ namespace BBWY.Test
//var token = "4a0ddc095e054c7aa90adcaccb14f83cwzgr"; //可比车品
var token = "50a4c0f5c55848b5a8a715709e8d6fe0jntb"; //卿卿玩具专营店
- //var dt1 = DateTime.Now;
- //List list = new List();
- //for (var i = 1; i <= 5000000; i++)
- //{
- // var str = tomMd5($"Mozilla/5.0 (Linux; Android 12; 21121210C Build/SKQ1.211006.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 Mobile Safari/537.36 T7/13.8 SP-engine/2.46.0 baiduboxapp/13.8.1.10 (Baidu; P1 12) NABar/1.0 Edg/102.0.5005.63_{i}_192.158.241.{i}_28726526517321");
- // Console.WriteLine($"生成第{i}位指纹,长度{str.Length},{str}");
- // list.Add(str);
- //}
- //var dt2 = DateTime.Now;
- //Console.WriteLine($"总数量{list.Count},总耗时{(dt2 - dt1).TotalSeconds}秒");
+ var request = new
+ {
+ AppKey = "3944754",
+ AppSecret = "NahdPJS5uzM",
+ AppToken = "a9a67b4a-1117-4ae6-8422-8188eedd3480",
+ OrderId = "1885695962273561469"
+ };
+ {
+ var client = GetSyncAPIClient(request.AppKey, request.AppSecret);
+ RequestPolicy reqPolicy = new RequestPolicy();
+ reqPolicy.HttpMethod = "POST";
+ reqPolicy.NeedAuthorization = false;
+ reqPolicy.RequestSendTimestamp = false;
+ reqPolicy.UseHttps = false;
+ reqPolicy.UseSignture = true;
+ reqPolicy.AccessPrivateApi = false;
+ Request _request = new Request();
+ APIId apiId = new APIId();
+ apiId.Name = "alibaba.trade.getLogisticsInfos.buyerView";
+ apiId.NamespaceValue = "com.alibaba.logistics";
+ apiId.Version = 1;
+ _request.ApiId = apiId;
- var jdClient = GetJdClient(appkey, appSecret);
- var req = new AscFreightViewRequest();
+ var param = new { orderId = request.OrderId, webSite = "1688", fields = "logisticsCompanyId,logisticsCompanyName,logisticsBillNo" };
+ _request.RequestEntity = param;
+ if (!string.IsNullOrEmpty(request.AppToken))
+ _request.AccessToken = request.AppToken;
+ var result = client.NewRequest(_request, reqPolicy);
+ }
+
+ {
+ var client = GetSyncAPIClient(request.AppKey, request.AppSecret);
+ RequestPolicy reqPolicy = new RequestPolicy();
+ reqPolicy.HttpMethod = "POST";
+ reqPolicy.NeedAuthorization = false;
+ reqPolicy.RequestSendTimestamp = false;
+ reqPolicy.UseHttps = false;
+ reqPolicy.UseSignture = true;
+ reqPolicy.AccessPrivateApi = false;
+
+ Request _request = new Request();
+ APIId apiId = new APIId
+ {
+ Name = "alibaba.trade.get.buyerView",
+ NamespaceValue = "com.alibaba.trade",
+ Version = 1
+ };
+ _request.ApiId = apiId;
+
+ var param = new
+ {
+ webSite = "1688",
+ orderId = request.OrderId,
+ includeFields = "baseInfo,productItems"
+ };
+ _request.RequestEntity = param;
+ if (!string.IsNullOrEmpty(request.AppToken))
+ _request.AccessToken = request.AppToken;
+ var result = client.NewRequest(_request, reqPolicy);
+ }
- req.buId = "11926867";
- req.operatePin = "开发测试";
- req.operateNick = "开发测试";
- req.serviceId = 1701316861;
- req.orderId = 264691201058;
- var res = jdClient.Execute(req,token, DateTime.Now.ToLocalTime());
Console.ReadKey();
}
From 6f6a78510af7fae8a2a4a2bbfed2311380ac5f58 Mon Sep 17 00:00:00 2001
From: shanj <18996038927@163.com>
Date: Wed, 17 May 2023 00:05:44 +0800
Subject: [PATCH 03/19] 1
---
.../Response/Logistics/StoreResponse.cs | 9 +++++
BBWY.Client/Models/QiKu/PackSkuConfig.cs | 35 +++++++++++++++++++
.../BatchPurchaseCreateNewOrderViewModel.cs | 27 ++++++++++++++
.../BatchCreateNewPurchaseOrder.xaml | 2 ++
.../Controllers/VenderController.cs | 14 +++++++-
.../Sync/StoreHouseSyncBusiness.cs | 20 +++++++----
BBWY.Server.Business/Vender/VenderBusiness.cs | 33 +++++++++++++++++
7 files changed, 132 insertions(+), 8 deletions(-)
create mode 100644 BBWY.Client/Models/APIModel/Response/Logistics/StoreResponse.cs
create mode 100644 BBWY.Client/Models/QiKu/PackSkuConfig.cs
diff --git a/BBWY.Client/Models/APIModel/Response/Logistics/StoreResponse.cs b/BBWY.Client/Models/APIModel/Response/Logistics/StoreResponse.cs
new file mode 100644
index 00000000..5f821c65
--- /dev/null
+++ b/BBWY.Client/Models/APIModel/Response/Logistics/StoreResponse.cs
@@ -0,0 +1,9 @@
+namespace BBWY.Client.Models
+{
+ public class StoreResponse
+ {
+ public string StoreId { get; set; }
+
+ public string StoreName { get; set; }
+ }
+}
diff --git a/BBWY.Client/Models/QiKu/PackSkuConfig.cs b/BBWY.Client/Models/QiKu/PackSkuConfig.cs
new file mode 100644
index 00000000..968fed0c
--- /dev/null
+++ b/BBWY.Client/Models/QiKu/PackSkuConfig.cs
@@ -0,0 +1,35 @@
+namespace BBWY.Client.Models.QiKu
+{
+ public class PackSkuConfig : NotifyObject
+ {
+ private int splitCount;
+
+ public string SkuId { get; set; }
+
+ public string Logo { get; set; }
+
+ public string Title { get; set; }
+
+ ///
+ /// 采购数量
+ ///
+ public int PurchaseCount { get; set; }
+
+ ///
+ /// 分箱数量
+ ///
+ public int SplitCount { get => splitCount; set { Set(ref splitCount, value); } }
+ }
+
+ public class PackSkuSplitConfig : NotifyObject
+ {
+ private int packCount;
+ private StoreResponse store;
+
+ public int Index { get; set; }
+
+ public int PackCount { get => packCount; set { Set(ref packCount, value); } }
+
+ public StoreResponse Store { get => store; set { Set(ref store, value); } }
+ }
+}
diff --git a/BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseCreateNewOrderViewModel.cs b/BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseCreateNewOrderViewModel.cs
index 200c9cb5..ac3dc3d2 100644
--- a/BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseCreateNewOrderViewModel.cs
+++ b/BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseCreateNewOrderViewModel.cs
@@ -76,6 +76,8 @@ namespace BBWY.Client.ViewModels
public ICommand SubtractQuantityCommand { get; set; }
+ public ICommand NextCommand { get; set; }
+
public BatchPurchaseCreateNewOrderViewModel(PurchaseProductAPIService purchaseProductAPIService,
PurchaseService purchaseService,
GlobalContext globalContext,
@@ -88,6 +90,7 @@ namespace BBWY.Client.ViewModels
ProductSkuWithSchemeList = new ObservableCollection();
FastCreateOrderCommand = new RelayCommand(FastCreateOrder);
+ NextCommand = new RelayCommand(Next);
PreviewOrderCommand = new RelayCommand(PreviewOrder);
AddProductSkuCommand = new RelayCommand(AddProductSku);
DeleteProductSkuWithSchemeCommand = new RelayCommand(DeleteProductSkuWithScheme);
@@ -375,5 +378,29 @@ namespace BBWY.Client.ViewModels
if (purchaseSchemeProductSku.ItemTotal > 1)
purchaseSchemeProductSku.ItemTotal--;
}
+
+ private void Next()
+ {
+ if (IsLoading)
+ return;
+ if (TotalAmount == 0)
+ {
+ MessageBox.Show("总金额为0不能提交订单", "提示");
+ return;
+ }
+ if (string.IsNullOrEmpty(Mobile) ||
+ string.IsNullOrEmpty(Address) ||
+ string.IsNullOrEmpty(City) ||
+ string.IsNullOrEmpty(Province) ||
+ string.IsNullOrEmpty(County) ||
+ string.IsNullOrEmpty(Town) ||
+ string.IsNullOrEmpty(ContactName))
+ {
+ MessageBox.Show("收货人信息不全", "下单");
+ return;
+ }
+
+
+ }
}
}
diff --git a/BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml b/BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml
index 742f85bb..b208bd6e 100644
--- a/BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml
+++ b/BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml
@@ -347,6 +347,8 @@
Command="{Binding PreviewOrderCommand}" Background="#1CC2A2"/>
+
diff --git a/BBWY.Server.API/Controllers/VenderController.cs b/BBWY.Server.API/Controllers/VenderController.cs
index 00b93147..336e77a9 100644
--- a/BBWY.Server.API/Controllers/VenderController.cs
+++ b/BBWY.Server.API/Controllers/VenderController.cs
@@ -1,5 +1,6 @@
using BBWY.Common.Models;
using BBWY.Server.Business;
+using BBWY.Server.Model.Db;
using BBWY.Server.Model.Dto;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
@@ -109,9 +110,20 @@ namespace BBWY.Server.API.Controllers
///
///
[HttpPost]
- public IList GetServiceGroupList([FromBody]PlatformRequest request)
+ public IList GetServiceGroupList([FromBody] PlatformRequest request)
{
return venderBusiness.GetServiceGroupList(request);
}
+
+ ///
+ /// 获取店铺关联的仓库列表
+ ///
+ ///
+ ///
+ [HttpPost]
+ public IList GetStoreHouseList([FromBody] PlatformRequest request)
+ {
+ return venderBusiness.GetStoreHouseList(request);
+ }
}
}
diff --git a/BBWY.Server.Business/Sync/StoreHouseSyncBusiness.cs b/BBWY.Server.Business/Sync/StoreHouseSyncBusiness.cs
index 9420f31f..f8db1684 100644
--- a/BBWY.Server.Business/Sync/StoreHouseSyncBusiness.cs
+++ b/BBWY.Server.Business/Sync/StoreHouseSyncBusiness.cs
@@ -78,14 +78,20 @@ namespace BBWY.Server.Business.Sync
}
}
- var storeHouseIds = storeHouseList.Select(s => s.Id).ToArray();
- var dbStoreIds = fsql.Select(storeHouseIds).ToList(s => s.Id);
- var exceptIds = storeHouseIds.Except(dbStoreIds);
- if (exceptIds.Count() > 0)
+ //var storeHouseIds = storeHouseList.Select(s => s.Id).ToArray();
+ //var dbStoreIds = fsql.Select(storeHouseIds).ToList(s => s.Id);
+ //var exceptIds = storeHouseIds.Except(dbStoreIds);
+ //if (exceptIds.Count() > 0)
+ //{
+ // var insertList = storeHouseList.Where(s => exceptIds.Contains(s.Id)).ToList();
+ // fsql.Insert(insertList).ExecuteAffrows();
+ //}
+ fsql.Transaction(() =>
{
- var insertList = storeHouseList.Where(s => exceptIds.Contains(s.Id)).ToList();
- fsql.Insert(insertList).ExecuteAffrows();
- }
+ fsql.Delete().Where(s => 1 == 1).ExecuteAffrows();
+ fsql.Insert(storeHouseList).ExecuteAffrows();
+ });
+
}
private void ResolveJDStoreHouse(JArray jarray, ShopResponse shop, IList storeHouseList)
diff --git a/BBWY.Server.Business/Vender/VenderBusiness.cs b/BBWY.Server.Business/Vender/VenderBusiness.cs
index 7c5eb43f..0da2601e 100644
--- a/BBWY.Server.Business/Vender/VenderBusiness.cs
+++ b/BBWY.Server.Business/Vender/VenderBusiness.cs
@@ -7,6 +7,7 @@ using BBWY.Server.Model.Db.Mds;
using BBWY.Server.Model.Dto;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -323,5 +324,37 @@ namespace BBWY.Server.Business
throw new BusinessException(response.Msg) { Code = response.Code };
return response.Data;
}
+
+ public IList GetStoreHouseList(PlatformRequest request)
+ {
+ var restApiResult = restApiService.SendRequest(GetPlatformRelayAPIHost(request.Platform), "api/PlatformSDK/GetStoreHouseList", new PlatformRequest()
+ {
+ AppKey = request.AppKey,
+ AppSecret = request.AppSecret,
+ AppToken = request.AppToken,
+ Platform = request.Platform,
+ SaveResponseLog = false
+ }, GetYunDingRequestHeader(), HttpMethod.Post);
+ if (restApiResult.StatusCode != System.Net.HttpStatusCode.OK)
+ throw new Exception(restApiResult.Content);
+ var response = JsonConvert.DeserializeObject>(restApiResult.Content);
+ if (response.Data == null || response.Data.Count() == 0)
+ return null;
+ var storeHouseList = new List();
+ foreach (var storeHouseJToken in response.Data)
+ {
+ var seq_num = storeHouseJToken.Value("seq_num");
+ storeHouseList.Add(new Storehouse()
+ {
+ Id = seq_num,
+ Name = storeHouseJToken.Value("name"),
+ Platform = request.Platform,
+ CreateTime = DateTime.Now,
+ Status = (Enums.StockStatus)storeHouseJToken.Value("use_flag"),
+ Type = (Enums.StockType)storeHouseJToken.Value("type")
+ });
+ }
+ return storeHouseList;
+ }
}
}
From 7f13af9c0e08f74e40a19465e23b7d61c940877d Mon Sep 17 00:00:00 2001
From: shanj <18996038927@163.com>
Date: Wed, 17 May 2023 02:47:31 +0800
Subject: [PATCH 04/19] =?UTF-8?q?=E5=88=86=E7=AE=B1=E9=85=8D=E7=BD=AE=20?=
=?UTF-8?q?=E6=9C=AA=E5=AE=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
BBWY.Client/APIServices/LogisticsService.cs | 11 ++
BBWY.Client/App.xaml.cs | 1 +
.../Response/Logistics/StoreResponse.cs | 15 +-
BBWY.Client/Models/Enums.cs | 16 +++
BBWY.Client/Models/QiKu/PackSkuConfig.cs | 11 +-
.../BatchPurchaseCreateNewOrderViewModel.cs | 12 ++
.../QiKu/PackSkuSplitConfigViewModel.cs | 105 ++++++++++++++
BBWY.Client/ViewModels/ViewModelLocator.cs | 9 ++
.../BatchCreateNewPurchaseOrder.xaml | 8 +-
.../BatchPurchase/BatchPurchaseOrderList.xaml | 2 +-
.../BatchPurchase/PackSkuConfigWindow.xaml | 132 ++++++++++++++++++
.../BatchPurchase/PackSkuConfigWindow.xaml.cs | 44 ++++++
.../PackSkuSplitCountAndStoreWindow.xaml | 50 +++++++
.../PackSkuSplitCountAndStoreWindow.xaml.cs | 64 +++++++++
14 files changed, 471 insertions(+), 9 deletions(-)
create mode 100644 BBWY.Client/ViewModels/QiKu/PackSkuSplitConfigViewModel.cs
create mode 100644 BBWY.Client/Views/BatchPurchase/PackSkuConfigWindow.xaml
create mode 100644 BBWY.Client/Views/BatchPurchase/PackSkuConfigWindow.xaml.cs
create mode 100644 BBWY.Client/Views/BatchPurchase/PackSkuSplitCountAndStoreWindow.xaml
create mode 100644 BBWY.Client/Views/BatchPurchase/PackSkuSplitCountAndStoreWindow.xaml.cs
diff --git a/BBWY.Client/APIServices/LogisticsService.cs b/BBWY.Client/APIServices/LogisticsService.cs
index 347484ad..fc6e67ff 100644
--- a/BBWY.Client/APIServices/LogisticsService.cs
+++ b/BBWY.Client/APIServices/LogisticsService.cs
@@ -20,5 +20,16 @@ namespace BBWY.Client.APIServices
globalContext.User.Shop.AppToken
}, null, HttpMethod.Post);
}
+
+ public ApiResponse> GetStoreList()
+ {
+ return SendRequest>(globalContext.BBYWApiHost, "api/vender/GetStoreHouseList", new
+ {
+ globalContext.User.Shop.Platform,
+ globalContext.User.Shop.AppKey,
+ globalContext.User.Shop.AppSecret,
+ globalContext.User.Shop.AppToken
+ }, null, HttpMethod.Post);
+ }
}
}
diff --git a/BBWY.Client/App.xaml.cs b/BBWY.Client/App.xaml.cs
index ed5c0cd0..e749423e 100644
--- a/BBWY.Client/App.xaml.cs
+++ b/BBWY.Client/App.xaml.cs
@@ -122,6 +122,7 @@ namespace BBWY.Client
serviceCollection.AddTransient();
serviceCollection.AddTransient();
serviceCollection.AddTransient();
+ serviceCollection.AddTransient();
#region 注册拳探SDK相关类
serviceCollection.AddSingleton();
diff --git a/BBWY.Client/Models/APIModel/Response/Logistics/StoreResponse.cs b/BBWY.Client/Models/APIModel/Response/Logistics/StoreResponse.cs
index 5f821c65..8ed924cf 100644
--- a/BBWY.Client/Models/APIModel/Response/Logistics/StoreResponse.cs
+++ b/BBWY.Client/Models/APIModel/Response/Logistics/StoreResponse.cs
@@ -1,9 +1,18 @@
-namespace BBWY.Client.Models
+using System;
+
+namespace BBWY.Client.Models
{
public class StoreResponse
{
- public string StoreId { get; set; }
+ public DateTime? CreateTime { get; set; }
+ public string Id { get; set; }
+
+ public string Name { get; set; }
+
+ public Platform Platform { get; set; }
+
+ public StockStatus Status { get; set; }
- public string StoreName { get; set; }
+ public StockType Type { get; set; }
}
}
diff --git a/BBWY.Client/Models/Enums.cs b/BBWY.Client/Models/Enums.cs
index 3c353aee..433dc415 100644
--- a/BBWY.Client/Models/Enums.cs
+++ b/BBWY.Client/Models/Enums.cs
@@ -402,4 +402,20 @@
胶带 = 2,
其他 = 3
}
+
+ ///
+ /// 京东仓库类型 1商家仓 2京东仓
+ ///
+ public enum StockType
+ {
+ 商家仓 = 1, 京仓 = 2
+ }
+
+ ///
+ /// 仓库状态 0暂停,1使用
+ ///
+ public enum StockStatus
+ {
+ 暂停 = 0, 使用 = 1
+ }
}
diff --git a/BBWY.Client/Models/QiKu/PackSkuConfig.cs b/BBWY.Client/Models/QiKu/PackSkuConfig.cs
index 968fed0c..619a3757 100644
--- a/BBWY.Client/Models/QiKu/PackSkuConfig.cs
+++ b/BBWY.Client/Models/QiKu/PackSkuConfig.cs
@@ -1,7 +1,14 @@
-namespace BBWY.Client.Models.QiKu
+using System.Collections.ObjectModel;
+
+namespace BBWY.Client.Models.QiKu
{
public class PackSkuConfig : NotifyObject
{
+ public PackSkuConfig()
+ {
+ PackSkuSplitConfigList = new ObservableCollection();
+ }
+
private int splitCount;
public string SkuId { get; set; }
@@ -19,6 +26,8 @@
/// 分箱数量
///
public int SplitCount { get => splitCount; set { Set(ref splitCount, value); } }
+
+ public ObservableCollection PackSkuSplitConfigList { get; set; }
}
public class PackSkuSplitConfig : NotifyObject
diff --git a/BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseCreateNewOrderViewModel.cs b/BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseCreateNewOrderViewModel.cs
index ac3dc3d2..b50bd3f5 100644
--- a/BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseCreateNewOrderViewModel.cs
+++ b/BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseCreateNewOrderViewModel.cs
@@ -400,7 +400,19 @@ namespace BBWY.Client.ViewModels
return;
}
+ var packWindow = new PackSkuConfigWindow(ProductSkuWithSchemeList.Select(ps => new Models.QiKu.PackSkuConfig()
+ {
+ Logo = ps.Logo,
+ SkuId = ps.SkuId,
+ Title = ps.Title,
+ PurchaseCount = ps.Quantity
+ }).ToList());
+
+ if (packWindow.ShowDialog() != true)
+ return;
+ var packSkuConfigList = packWindow.GetPackSkuConfigList();
+ Console.WriteLine(packSkuConfigList);
}
}
}
diff --git a/BBWY.Client/ViewModels/QiKu/PackSkuSplitConfigViewModel.cs b/BBWY.Client/ViewModels/QiKu/PackSkuSplitConfigViewModel.cs
new file mode 100644
index 00000000..324ef251
--- /dev/null
+++ b/BBWY.Client/ViewModels/QiKu/PackSkuSplitConfigViewModel.cs
@@ -0,0 +1,105 @@
+using BBWY.Client.APIServices;
+using BBWY.Client.Models;
+using BBWY.Client.Models.QiKu;
+using BBWY.Client.Views.BatchPurchase;
+using GalaSoft.MvvmLight.Command;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Windows;
+using System.Windows.Input;
+
+namespace BBWY.Client.ViewModels
+{
+ public class PackSkuSplitConfigViewModel : BaseVM
+ {
+ public IList PackSkuConfigList { get; set; }
+
+ private IList storeList;
+
+ public ICommand SetSplitCountCommand { get; set; }
+
+ public ICommand SetPackCountAndStoreCommand { get; set; }
+
+ public ICommand SaveCommand { get; set; }
+
+ private LogisticsService logisticsService;
+
+ public PackSkuSplitConfigViewModel(LogisticsService logisticsService)
+ {
+ this.logisticsService = logisticsService;
+ SetSplitCountCommand = new RelayCommand(SetSplitCount);
+ SetPackCountAndStoreCommand = new RelayCommand(SetPackCountAndStore);
+ SaveCommand = new RelayCommand(Save);
+ PackSkuConfigList = new ObservableCollection();
+ }
+
+ public void SetData(IList packSkuConfigList)
+ {
+ foreach (var item in packSkuConfigList)
+ PackSkuConfigList.Add(item);
+ }
+
+ public IList GetPackSkuConfigList()
+ {
+ return PackSkuConfigList;
+ }
+
+ private void SetSplitCount(PackSkuConfig packSkuConfig)
+ {
+ if (packSkuConfig.SplitCount <= 0)
+ {
+ MessageBox.Show("份数不正确");
+ return;
+ }
+
+ packSkuConfig.PackSkuSplitConfigList.Clear();
+ for (var i = 1; i <= packSkuConfig.SplitCount; i++)
+ {
+ packSkuConfig.PackSkuSplitConfigList.Add(new PackSkuSplitConfig()
+ {
+ Index = i,
+ PackCount = 0
+ });
+ }
+ }
+
+ private void SetPackCountAndStore(PackSkuSplitConfig packSkuSplitConfig)
+ {
+ if (storeList == null)
+ {
+ var response = logisticsService.GetStoreList();
+ if (!response.Success)
+ {
+ MessageBox.Show(response.Msg, "获取仓库");
+ return;
+ }
+ storeList = response.Data;
+ }
+ var w = new PackSkuSplitCountAndStoreWindow(packSkuSplitConfig.PackCount, packSkuSplitConfig.Store, storeList);
+ if (w.ShowDialog() == true)
+ {
+ packSkuSplitConfig.PackCount = w.Quantity;
+ packSkuSplitConfig.Store = w.Store;
+ }
+ }
+
+ private void Save()
+ {
+ if (PackSkuConfigList.Any(s => s.PackSkuSplitConfigList.Count() == 0 ||
+ s.PackSkuSplitConfigList.Any(sp => sp.PackCount <= 0)))
+ {
+ MessageBox.Show("装箱设置不正确", "提示");
+ return;
+ }
+
+ if (PackSkuConfigList.Any(s => s.PurchaseCount != s.PackSkuSplitConfigList.Sum(sp => sp.PackCount)))
+ {
+ MessageBox.Show("打包份数总数与采购数量不相等", "提示");
+ return;
+ }
+
+ GalaSoft.MvvmLight.Messaging.Messenger.Default.Send(true, "PackSkuConfigWindowClose");
+ }
+ }
+}
diff --git a/BBWY.Client/ViewModels/ViewModelLocator.cs b/BBWY.Client/ViewModels/ViewModelLocator.cs
index 7ccd0dad..cfd7e27c 100644
--- a/BBWY.Client/ViewModels/ViewModelLocator.cs
+++ b/BBWY.Client/ViewModels/ViewModelLocator.cs
@@ -294,5 +294,14 @@ namespace BBWY.Client.ViewModels
return s.ServiceProvider.GetRequiredService();
}
}
+
+ public PackSkuSplitConfigViewModel PackSkuConfig
+ {
+ get
+ {
+ using var s = sp.CreateScope();
+ return s.ServiceProvider.GetRequiredService();
+ }
+ }
}
}
diff --git a/BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml b/BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml
index b208bd6e..6c1dc8a0 100644
--- a/BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml
+++ b/BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml
@@ -345,10 +345,10 @@
-
-
+
+
diff --git a/BBWY.Client/Views/BatchPurchase/BatchPurchaseOrderList.xaml b/BBWY.Client/Views/BatchPurchase/BatchPurchaseOrderList.xaml
index 108f6f48..2ea7916f 100644
--- a/BBWY.Client/Views/BatchPurchase/BatchPurchaseOrderList.xaml
+++ b/BBWY.Client/Views/BatchPurchase/BatchPurchaseOrderList.xaml
@@ -202,7 +202,7 @@
-
+
diff --git a/BBWY.Client/Views/BatchPurchase/PackSkuConfigWindow.xaml b/BBWY.Client/Views/BatchPurchase/PackSkuConfigWindow.xaml
new file mode 100644
index 00000000..99738e9f
--- /dev/null
+++ b/BBWY.Client/Views/BatchPurchase/PackSkuConfigWindow.xaml
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BBWY.Client/Views/BatchPurchase/PackSkuConfigWindow.xaml.cs b/BBWY.Client/Views/BatchPurchase/PackSkuConfigWindow.xaml.cs
new file mode 100644
index 00000000..5a093730
--- /dev/null
+++ b/BBWY.Client/Views/BatchPurchase/PackSkuConfigWindow.xaml.cs
@@ -0,0 +1,44 @@
+using BBWY.Client.Models.QiKu;
+using BBWY.Client.ViewModels;
+using BBWY.Controls;
+using System.Collections.Generic;
+
+namespace BBWY.Client.Views.BatchPurchase
+{
+ ///
+ /// PackSkuConfigWindow.xaml 的交互逻辑
+ ///
+ public partial class PackSkuConfigWindow : BWindow
+ {
+ private PackSkuSplitConfigViewModel vm;
+
+ public PackSkuConfigWindow(IList list)
+ {
+ InitializeComponent();
+ vm = this.DataContext as PackSkuSplitConfigViewModel;
+ vm.SetData(list);
+
+ this.Loaded += PackSkuConfigWindow_Loaded;
+ this.Unloaded += PackSkuConfigWindow_Unloaded;
+ }
+
+ private void PackSkuConfigWindow_Unloaded(object sender, System.Windows.RoutedEventArgs e)
+ {
+ GalaSoft.MvvmLight.Messaging.Messenger.Default.Unregister(this);
+ }
+
+ private void PackSkuConfigWindow_Loaded(object sender, System.Windows.RoutedEventArgs e)
+ {
+ GalaSoft.MvvmLight.Messaging.Messenger.Default.Register(this, "PackSkuConfigWindowClose", (r) =>
+ {
+ this.DialogResult = r;
+ this.Close();
+ });
+ }
+
+ public IList GetPackSkuConfigList()
+ {
+ return vm.GetPackSkuConfigList();
+ }
+ }
+}
diff --git a/BBWY.Client/Views/BatchPurchase/PackSkuSplitCountAndStoreWindow.xaml b/BBWY.Client/Views/BatchPurchase/PackSkuSplitCountAndStoreWindow.xaml
new file mode 100644
index 00000000..8ada0b01
--- /dev/null
+++ b/BBWY.Client/Views/BatchPurchase/PackSkuSplitCountAndStoreWindow.xaml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BBWY.Client/Views/BatchPurchase/PackSkuSplitCountAndStoreWindow.xaml.cs b/BBWY.Client/Views/BatchPurchase/PackSkuSplitCountAndStoreWindow.xaml.cs
new file mode 100644
index 00000000..b00651f8
--- /dev/null
+++ b/BBWY.Client/Views/BatchPurchase/PackSkuSplitCountAndStoreWindow.xaml.cs
@@ -0,0 +1,64 @@
+using BBWY.Client.Models;
+using BBWY.Controls;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows;
+
+namespace BBWY.Client.Views.BatchPurchase
+{
+ ///
+ /// PackSkuSplitCountAndStoreWindow.xaml 的交互逻辑
+ ///
+ public partial class PackSkuSplitCountAndStoreWindow : BWindow
+ {
+ public int Quantity { get; set; }
+
+ public StoreResponse Store { get; set; }
+
+ private IList storeList;
+
+ public PackSkuSplitCountAndStoreWindow(int quantity, StoreResponse store, IList storeList)
+ {
+ InitializeComponent();
+ this.Quantity = quantity;
+ this.Store = store;
+ this.storeList = storeList;
+ this.Loaded += PackSkuSplitCountAndStoreWindow_Loaded;
+ }
+
+ private void PackSkuSplitCountAndStoreWindow_Loaded(object sender, System.Windows.RoutedEventArgs e)
+ {
+ this.txtQuantity.Text = Quantity.ToString();
+ this.cbx_stroeList.ItemsSource = storeList;
+ if (Store != null)
+ this.cbx_stroeList.SelectedItem = storeList.FirstOrDefault(s => s.Id == Store.Id);
+ else
+ this.cbx_stroeList.SelectedItem = storeList.FirstOrDefault();
+ }
+
+ private void btn_save_Click(object sender, System.Windows.RoutedEventArgs e)
+ {
+ if (!int.TryParse(txtQuantity.Text, out int q))
+ {
+ MessageBox.Show("件数不正确", "提示");
+ return;
+ }
+ if (q <= 0)
+ {
+ MessageBox.Show("件数不正确", "提示");
+ return;
+ }
+ if (cbx_stroeList.SelectedItem == null)
+ {
+ MessageBox.Show("请选择一个仓库", "提示");
+ return;
+ }
+
+ this.Quantity = q;
+ this.Store = cbx_stroeList.SelectedItem as StoreResponse;
+
+ this.DialogResult = true;
+ this.Close();
+ }
+ }
+}
From 72d495d56bd51df8d5b86681795bc186ca803763 Mon Sep 17 00:00:00 2001
From: shanj <18996038927@163.com>
Date: Wed, 17 May 2023 03:40:18 +0800
Subject: [PATCH 05/19] =?UTF-8?q?=20=E6=89=B9=E9=87=8F=E9=87=87=E8=B4=AD?=
=?UTF-8?q?=E5=AF=B9=E6=8E=A5=E9=BD=90=E5=BA=93=E6=89=93=E5=8C=85=E4=BB=BB?=
=?UTF-8?q?=E5=8A=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../APIServices/BatchPurchaseService.cs | 10 +--
.../BatchPurchaseCreateNewOrderViewModel.cs | 59 ++++++---------
.../BatchCreateNewPurchaseOrder.xaml | 8 +--
BBWY.Client/Views/MainWindow.xaml | 2 +-
.../BatchPurchase/BatchPurchaseBusiness.cs | 72 +++++++++++++++++--
.../BatchPurchaseCreateOrderRequest.cs | 9 ++-
.../Dto/Request/QiKu/PackSkuConfigRequest.cs | 34 +++++++++
.../Dto/Request/Stock/StoreRequest.cs | 9 +++
8 files changed, 148 insertions(+), 55 deletions(-)
create mode 100644 BBWY.Server.Model/Dto/Request/QiKu/PackSkuConfigRequest.cs
create mode 100644 BBWY.Server.Model/Dto/Request/Stock/StoreRequest.cs
diff --git a/BBWY.Client/APIServices/BatchPurchaseService.cs b/BBWY.Client/APIServices/BatchPurchaseService.cs
index 237f9eb5..3575cd39 100644
--- a/BBWY.Client/APIServices/BatchPurchaseService.cs
+++ b/BBWY.Client/APIServices/BatchPurchaseService.cs
@@ -1,4 +1,5 @@
using BBWY.Client.Models;
+using BBWY.Client.Models.QiKu;
using BBWY.Common.Http;
using BBWY.Common.Models;
using System;
@@ -71,7 +72,8 @@ namespace BBWY.Client.APIServices
PurchaseOrderMode purchaseOrderMode,
IList purchaseAccountList,
string extensions,
- string remark)
+ string remark,
+ IList packSkuConfigList)
{
var productParamList = new List
diff --git a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
index 628c6e6b..5b4517d1 100644
--- a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
+++ b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
@@ -1,4 +1,5 @@
-using BBWY.Common.Models;
+using BBWY.Common.Http;
+using BBWY.Common.Models;
using BBWY.Server.Model;
using BBWY.Server.Model.Db;
using BBWY.Server.Model.Db.QK;
@@ -9,6 +10,7 @@ using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Yitter.IdGenerator;
@@ -19,18 +21,19 @@ namespace BBWY.Server.Business
{
private ProductBusiness productBusiness;
private IEnumerable platformSDKBusinessList;
-
-
+ //private TaskSchedulerManager taskSchedulerManager;
+ private RestApiService restApiService;
public BatchPurchaseBusiness(IFreeSql fsql,
NLogManager nLogManager,
IIdGenerator idGenerator,
ProductBusiness productBusiness,
- IEnumerable platformSDKBusinessList) : base(fsql, nLogManager, idGenerator)
+ IEnumerable platformSDKBusinessList,
+ RestApiService restApiService) : base(fsql, nLogManager, idGenerator)
{
this.productBusiness = productBusiness;
this.platformSDKBusinessList = platformSDKBusinessList;
-
+ this.restApiService = restApiService;
}
///
@@ -218,6 +221,7 @@ namespace BBWY.Server.Business
var successSkuIdList = new List();
var failSkuList = new List();
+ var qikuPackSkuConfigRequestList = new List
From 6d2edadeb069bce6595400f1aed7fcee7c16ee9d Mon Sep 17 00:00:00 2001
From: "506583276@qq.com" <506583276@qq.com>
Date: Thu, 18 May 2023 16:19:41 +0800
Subject: [PATCH 09/19] 1
---
BBWY.Client/APIServices/PackTaskService.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/BBWY.Client/APIServices/PackTaskService.cs b/BBWY.Client/APIServices/PackTaskService.cs
index 7ee64b7f..9c0d5bd7 100644
--- a/BBWY.Client/APIServices/PackTaskService.cs
+++ b/BBWY.Client/APIServices/PackTaskService.cs
@@ -35,7 +35,7 @@ namespace BBWY.Client.APIServices
)
{
- return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchNew1PackTaskList", new
+ return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchNewPackTaskList", new
{
SkuId = skuId,
@@ -59,7 +59,7 @@ namespace BBWY.Client.APIServices
)
{
- return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchNew1PackTaskList", new
+ return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchNewPackTaskList", new
{
IsWorry = isWorry,
DepartmentName = departmentName,
From 1c1280a6fd7a6f2c7bb5e4ed9c43eeaa4f9f4b9e Mon Sep 17 00:00:00 2001
From: shanj <18996038927@163.com>
Date: Thu, 18 May 2023 16:51:51 +0800
Subject: [PATCH 10/19] 1
---
.../BatchPurchase/BatchPurchaseBusiness.cs | 25 +++++++++++--------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
index 5b4517d1..14dafed5 100644
--- a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
+++ b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
@@ -319,19 +319,22 @@ namespace BBWY.Server.Business
if (purchasePlatform == Enums.Platform.拳探)
{
- var skuPackConfig = request.PackSkuConfigList.FirstOrDefault(s => s.SkuId == firstProductParam.BelongSkuId);
- skuPackConfigList.Add(new
+ var skuPackConfig = request.PackSkuConfigList?.FirstOrDefault(s => s.SkuId == firstProductParam.BelongSkuId);
+ if (skuPackConfig != null)
{
- skuId = firstProductParam.BelongSkuId,
- skuCount = skuPackConfig.PurchaseCount,
- markMessage = string.Empty,
- wareHourses = skuPackConfig.PackSkuSplitConfigList.Select(x => new
+ skuPackConfigList.Add(new
{
- wareId = x.Store.Id,
- wareName = x.Store.Name,
- count = x.PackCount
- })
- });
+ skuId = firstProductParam.BelongSkuId,
+ skuCount = skuPackConfig.PurchaseCount,
+ markMessage = string.Empty,
+ wareHourses = skuPackConfig.PackSkuSplitConfigList.Select(x => new
+ {
+ wareId = x.Store.Id,
+ wareName = x.Store.Name,
+ count = x.PackCount
+ })
+ });
+ }
}
}
From 6b98199784717ceb6578beaa610756bc3cc84e5f Mon Sep 17 00:00:00 2001
From: shanj <18996038927@163.com>
Date: Thu, 18 May 2023 18:22:02 +0800
Subject: [PATCH 11/19] =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=89=93=E5=8C=85?=
=?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=8E=A5=E5=8F=A3=E5=9C=B0=E5=9D=80=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
index 14dafed5..52e021e0 100644
--- a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
+++ b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
@@ -407,7 +407,7 @@ namespace BBWY.Server.Business
try
{
var qikuResponse = restApiService.SendRequest("http://qiku.qiyue666.com/",
- "api/PackPurchaseTask/PublicPurchaseTask",
+ "api/PackPurchaseTask/BatchPublicPurchaseTask",
qikuPackSkuConfigRequest,
null,
HttpMethod.Post);
From e726c861e1c457c4ede7c33d71580d5065bdd5d9 Mon Sep 17 00:00:00 2001
From: shanji <18996038927@163.com>
Date: Fri, 19 May 2023 13:47:43 +0800
Subject: [PATCH 12/19] =?UTF-8?q?=E6=89=B9=E9=87=8F=E9=87=87=E8=B4=AD?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8CshopId=E8=B0=83=E6=95=B4=E4=B8=BA?=
=?UTF-8?q?=E6=8B=B3=E6=8E=A2=E5=95=86=E5=AE=B6Id?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
index 52e021e0..47385482 100644
--- a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
+++ b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
@@ -379,7 +379,8 @@ namespace BBWY.Server.Business
qikuPackSkuConfigRequestList.Add(new
{
orderId = purchaseOrderV2.Id,
- shopId = request.ShopId.ToString(),
+ //shopId = request.ShopId.ToString(),
+ shopId = purchaseGroup.Key, //拳探店铺Id(商家Id)
originShopName = request.ShopName,
userName = purchaseAccount.AccountName,
platform = Enums.Platform.拳探,
From c3bdc88f161261a9ee071f794f1f6f4d9a12b98d Mon Sep 17 00:00:00 2001
From: "506583276@qq.com" <506583276@qq.com>
Date: Fri, 19 May 2023 13:58:23 +0800
Subject: [PATCH 13/19] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=96=E6=B6=88?=
=?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../PackTask/PublishTaskViewModel.cs | 41 ++++++++++---------
.../BatchPurchase/BatchPurchaseBusiness.cs | 19 ++++++++-
2 files changed, 39 insertions(+), 21 deletions(-)
diff --git a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs
index 4a6a58fa..9d71b00b 100644
--- a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs
+++ b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs
@@ -185,7 +185,7 @@ namespace BBWY.Client.ViewModels.PackTask
{
Set(ref isSetBarCode, value);
- // IsNeedBarCode = IsSetBarCode ? Need.不需要 : Need.需要;
+ // IsNeedBarCode = IsSetBarCode ? Need.不需要 : Need.需要;
}
}
@@ -199,7 +199,7 @@ namespace BBWY.Client.ViewModels.PackTask
{
Set(ref isSetCertificate, value);
- //IsNeedCertificateModel = IsSetCertificate ? Need.不需要 : Need.需要;
+ //IsNeedCertificateModel = IsSetCertificate ? Need.不需要 : Need.需要;
}
}
private string setSpuCerStatus;
@@ -330,7 +330,7 @@ namespace BBWY.Client.ViewModels.PackTask
{
return;
}
- if (TaskId>0&&string.IsNullOrEmpty(SpuId))//修改界面刷新配置数据
+ if (TaskId > 0 && string.IsNullOrEmpty(SpuId))//修改界面刷新配置数据
{
SearchSku(SkuId);
}
@@ -375,7 +375,7 @@ namespace BBWY.Client.ViewModels.PackTask
ProductNo = ProductNo,
Brand = Brand,
SkuId = SkuId,
-
+
}
};
@@ -452,7 +452,7 @@ namespace BBWY.Client.ViewModels.PackTask
}
var productSku = packTaskService.GetProductSku(skuid);
- if (productSku == null || !productSku.Success||productSku.Data==null)
+ if (productSku == null || !productSku.Success || productSku.Data == null)
return;
BrandName = productSku.Data.BrandName;
CertificateModel = productSku.Data.Cers;
@@ -461,7 +461,7 @@ namespace BBWY.Client.ViewModels.PackTask
CertificateModel = new CertificateModel[] {
new CertificateModel{ }
};
-
+
}
foreach (var item in CertificateModel)
@@ -504,7 +504,7 @@ namespace BBWY.Client.ViewModels.PackTask
IsNeedCertificateModel = config.NeedCer ? Need.需要 : Need.不需要;
IsSetBarCode = !config.NeedBar;
- IsSetCertificate =!config.NeedCer;
+ IsSetCertificate = !config.NeedCer;
bool isSelected = false;
foreach (var item in increates)
@@ -533,7 +533,7 @@ namespace BBWY.Client.ViewModels.PackTask
return;
}
- //加载配置文件
+ //加载配置文件
}
public void SearSpuCer()
@@ -591,7 +591,7 @@ namespace BBWY.Client.ViewModels.PackTask
IsSetBarCode = true;
IsSetCertificate = true;
BarCodeModel = null;
-
+
CertificateModel = null;
SkuTitle = string.Empty;
GoodsNumber = 0;
@@ -631,13 +631,16 @@ namespace BBWY.Client.ViewModels.PackTask
IsNeedCertificateModel = model.CertificateModel == null ? Need.不需要 : Need.需要;
CertificatePosition = model.CertificatePosition;
TaskId = model.TaskId;
- string[] increateDatas = model.Increment1.Split(',');
+
+ List increateDatas = new List();
+ if (model.Increment1 != null)
+ increateDatas = model.Increment1.Split(',').ToList();
bool isTrue = false;
foreach (var item in increates)
{
isTrue = false;
- if (increateDatas.Contains(item))
+ if (increateDatas.Count()>0&& increateDatas.Contains(item))
{
isTrue = true;
}
@@ -650,7 +653,7 @@ namespace BBWY.Client.ViewModels.PackTask
});
});
}
- // SearchSku(SkuId);
+ // SearchSku(SkuId);
}
private void OpenSkuDetail(object param)
@@ -712,14 +715,14 @@ namespace BBWY.Client.ViewModels.PackTask
SkuCount = SkuCount,
UserId = globalContext.User.Id.ToString(),
ShopId = globalContext.User.Shop.ShopId.ToString(),
- NeedBar =IsNeedBarCode==Need.需要,
- NeedCer =IsNeedCertificateModel==Need.需要
-
+ NeedBar = IsNeedBarCode == Need.需要,
+ NeedCer = IsNeedCertificateModel == Need.需要
+
//IsWorry = IsWorry
};
if (IsNeedBarCode == Need.需要)
{
- if (BarCodeModel == null ||IsSetBarCode|| BarCodeModel.Id <= 0)
+ if (BarCodeModel == null || IsSetBarCode || BarCodeModel.Id <= 0)
{
new TipsWindow("请设置条形码模板").Show();
return;
@@ -737,12 +740,12 @@ namespace BBWY.Client.ViewModels.PackTask
{
createTaskModel.CertificateId = CertificateModel.Where(c => c.Id > 0).FirstOrDefault()?.Id;
}
- catch
+ catch
{
-
+
}
-
+
createTaskModel.CerId = string.Join(",", CertificateModel.Where(c => c.Id > 0).Select(c => c.Id));//
}
ApiResponse res = null;
diff --git a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
index 5b4517d1..18c62c89 100644
--- a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
+++ b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
@@ -404,7 +404,7 @@ namespace BBWY.Server.Business
try
{
var qikuResponse = restApiService.SendRequest("http://qiku.qiyue666.com/",
- "api/PackPurchaseTask/PublicPurchaseTask",
+ "/api/PackPurchaseTask/BatchPublicPurchaseTask",
qikuPackSkuConfigRequest,
null,
HttpMethod.Post);
@@ -528,12 +528,27 @@ namespace BBWY.Server.Business
var platformSDKBusiness = platformSDKBusinessList.FirstOrDefault(p => p.Platform == request.Platform);
var payOrderResponse = platformSDKBusiness.CancelPurchaseOrder(request);
- if (payOrderResponse.Success)
+ if (payOrderResponse.Success)//取消成功
{
//var order = fsql.Select().Where(p => p.Id == request.OrderId).ToOne();
fsql.Update(request.OrderId)
.Set(po => po.OrderState, Enums.PurchaseOrderState.已取消)
.ExecuteAffrows();
+ try
+ {
+ var qikuResponse = restApiService.SendRequest("http://qiku.qiyue666.com/",
+ $"/api/PackPurchaseTask/CancelOrderPackTask?orderId={request.OrderId}",
+ null,
+ null,
+ HttpMethod.Post);
+ if (qikuResponse.StatusCode != System.Net.HttpStatusCode.OK)
+ throw new Exception(qikuResponse.Content);
+ }
+ catch (Exception ex)
+ {
+ nLogManager.GetLogger($"取消打包任务-{request.OrderId}").Error(ex, JsonConvert.SerializeObject(request));
+ }
+
}
From 329a103465f66b0f3221c21a2ace4fc03c0a0bff Mon Sep 17 00:00:00 2001
From: "506583276@qq.com" <506583276@qq.com>
Date: Fri, 19 May 2023 14:41:51 +0800
Subject: [PATCH 14/19] 1
---
.../Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml b/BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml
index 6c1dc8a0..b208bd6e 100644
--- a/BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml
+++ b/BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml
@@ -345,10 +345,10 @@
-
-
+
+
From 63ab22f016af25c56e55e38a9ec58fb31e19c54c Mon Sep 17 00:00:00 2001
From: shanj <18996038927@163.com>
Date: Sat, 20 May 2023 01:26:37 +0800
Subject: [PATCH 15/19] =?UTF-8?q?=20=E6=89=B9=E9=87=8F=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E6=8B=B3=E6=8E=A2=E9=87=87=E8=B4=AD=E6=96=B9=E6=A1=88=E5=BD=92?=
=?UTF-8?q?=E5=B1=9E=E9=87=87=E8=B4=AD=E5=95=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
BBWY.Common/Extensions/CopyExtensions.cs | 12 +
.../Controllers/PurchaseSchemeController.cs | 11 +
.../PurchaseProductAPIService.cs | 295 ++++++++++++++++++
.../PurchaseScheme/PurchaseSchemeBusiness.cs | 111 ++++++-
...eQTPurchaseSchemeBelongPurchaserRequest.cs | 10 +
.../PurcasheSkuBasicInfoRequest.cs | 42 +++
.../PurchaseProductBasicInfoResponse.cs | 58 ++++
BBWY.Server.Model/Enums.cs | 9 +
8 files changed, 545 insertions(+), 3 deletions(-)
create mode 100644 BBWY.Common/Extensions/CopyExtensions.cs
create mode 100644 BBWY.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs
create mode 100644 BBWY.Server.Model/Dto/Request/PurchaseScheme/BatchUpdateQTPurchaseSchemeBelongPurchaserRequest.cs
create mode 100644 BBWY.Server.Model/Dto/Request/PurchaseScheme/PurcasheSkuBasicInfoRequest.cs
create mode 100644 BBWY.Server.Model/Dto/Response/PurchaseScheme/PurchaseProductBasicInfoResponse.cs
diff --git a/BBWY.Common/Extensions/CopyExtensions.cs b/BBWY.Common/Extensions/CopyExtensions.cs
new file mode 100644
index 00000000..d87833f3
--- /dev/null
+++ b/BBWY.Common/Extensions/CopyExtensions.cs
@@ -0,0 +1,12 @@
+using Newtonsoft.Json;
+
+namespace BBWY.Common.Extensions
+{
+ public static class CopyExtensions
+ {
+ public static T Copy(this T p)
+ {
+ return JsonConvert.DeserializeObject(JsonConvert.SerializeObject(p));
+ }
+ }
+}
diff --git a/BBWY.Server.API/Controllers/PurchaseSchemeController.cs b/BBWY.Server.API/Controllers/PurchaseSchemeController.cs
index 64e35246..a6bb132a 100644
--- a/BBWY.Server.API/Controllers/PurchaseSchemeController.cs
+++ b/BBWY.Server.API/Controllers/PurchaseSchemeController.cs
@@ -70,5 +70,16 @@ namespace BBWY.Server.API.Controllers
{
return purchaseSchemeBusiness.GetSharePurchaser(querySchemeRequest);
}
+
+ ///
+ /// 批量修改拳探采购方案归属采购商
+ ///
+ ///
+ ///
+ [HttpPost]
+ public IList BatchUpdateQTPurchaseSchemeBelongPurchaser([FromBody]BatchUpdateQTPurchaseSchemeBelongPurchaserRequest request)
+ {
+ return purchaseSchemeBusiness.BatchUpdateQTPurchaseSchemeBelongPurchaser(request);
+ }
}
}
diff --git a/BBWY.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs b/BBWY.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs
new file mode 100644
index 00000000..e7d7f956
--- /dev/null
+++ b/BBWY.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs
@@ -0,0 +1,295 @@
+using BBWY.Common.Extensions;
+using BBWY.Common.Http;
+using BBWY.Common.Models;
+using BBWY.Server.Model;
+using BBWY.Server.Model.Db;
+using BBWY.Server.Model.Dto;
+using Microsoft.Extensions.Caching.Memory;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Text.RegularExpressions;
+
+namespace BBWY.Server.Business
+{
+ public class PurchaseProductAPIService : IDenpendency
+ {
+ private RestApiService restApiService;
+ private IMemoryCache memoryCache;
+ private string oneBoundKey = "t5060712539";
+ private string oneBoundSecret = "20211103";
+
+ //private string qtAppId = "BBWY2023022001";
+ //private string qtAppSecret = "908e131365d5448ca651ba20ed7ddefe";
+
+ private TimeSpan purchaseProductCacheTimeSpan;
+ //private TimeSpan _1688SessionIdTimeSpan;
+
+ //private ConcurrentDictionary purchaseSchemeProductSkus)> productChaches;
+
+ private IDictionary _1688ProductDetailRequestHeader;
+ private char[] skuPropertiesSplitChar = new char[] { ';' };
+
+ public PurchaseProductAPIService(RestApiService restApiService, IMemoryCache memoryCache)
+ {
+ this.memoryCache = memoryCache;
+ this.restApiService = restApiService;
+ _1688ProductDetailRequestHeader = new Dictionary()
+ {
+ { "Host","detail.1688.com"},
+ { "User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36 Edg/104.0.1293.70"},
+ { "Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"},
+ { "Accept-Encoding","gzip, deflate, br"},
+ { "Accept-Language","zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"}
+ };
+ purchaseProductCacheTimeSpan = TimeSpan.FromDays(1);
+ }
+
+ public PurchaseSkuBasicInfoResponse GetProductInfo(PurchaseSkuBasicInfoRequest request)
+ {
+ var cacheKey = $"{request.PurchaseProductId}_{request.PriceMode}";
+ if (memoryCache.TryGetValue(cacheKey, out var tuple))
+ return tuple.Copy();
+
+ PurchaseSkuBasicInfoResponse response = null;
+
+ if (request.FirstApiMode == Enums.PurchaseProductAPIMode.Spider)
+ {
+ response = LoadFromSpider(request);
+ if (response == null)
+ response = LoadFromOneBound(request);
+ }
+ else if (request.FirstApiMode == Enums.PurchaseProductAPIMode.OneBound)
+ {
+ response = LoadFromOneBound(request);
+ if (response == null)
+ response = LoadFromSpider(request);
+ }
+
+ if (response != null)
+ {
+ try
+ {
+ memoryCache.Set(cacheKey, response, purchaseProductCacheTimeSpan);
+ }
+ catch { }
+ }
+
+ return response?.Copy();
+ }
+
+ private PurchaseSkuBasicInfoResponse LoadFromOneBound(PurchaseSkuBasicInfoRequest request)
+ {
+ try
+ {
+ string platformStr = string.Empty;
+ if (request.Platform == Enums.Platform.阿里巴巴)
+ platformStr = "1688";
+
+ if (string.IsNullOrEmpty(platformStr))
+ return null;
+
+ var result = restApiService.SendRequest("https://api-gw.onebound.cn/", $"{platformStr}/item_get", $"key={oneBoundKey}&secret={oneBoundSecret}&num_iid={request.PurchaseProductId}&lang=zh-CN&cache=no&agent={(request.PriceMode == Enums.PurchaseOrderMode.批发 ? 0 : 1)}", null, HttpMethod.Get, paramPosition: ParamPosition.Query, enableRandomTimeStamp: true);
+ if (result.StatusCode != System.Net.HttpStatusCode.OK)
+ throw new Exception($"{result.StatusCode} {result.Content}");
+
+ var jobject = JObject.Parse(result.Content);
+ var isOK = jobject.Value("error_code") == "0000";
+ if (isOK)
+ {
+ var skuJArray = (JArray)jobject["item"]["skus"]["sku"];
+ if (skuJArray.Count == 0)
+ {
+ //errorMsg = $"商品{purchaseSchemeProduct.PurchaseProductId}缺少sku信息";
+ return null;
+ }
+
+ var list = skuJArray.Select(j => new PurchaseSkuItemBasicInfoResponse()
+ {
+ PurchaseProductId = request.PurchaseProductId,
+ Price = j.Value("price"),
+ PurchaseSkuId = j.Value("sku_id"),
+ PurchaseSkuSpecId = j.Value("spec_id"),
+ Title = j.Value("properties_name"),
+ Logo = GetOneBoundSkuLogo(j, (JArray)jobject["item"]["prop_imgs"]["prop_img"])
+ }).ToList();
+
+ var purchaserId = jobject["item"]["seller_info"].Value("user_num_id");
+ var purchaserName = jobject["item"]["seller_info"].Value("title");
+ if (string.IsNullOrEmpty(purchaserName))
+ purchaserName = jobject["item"]["seller_info"].Value("shop_name");
+ var purchaserLocation = jobject["item"].Value("location");
+
+ return new PurchaseSkuBasicInfoResponse()
+ {
+ Purchaser = new Model.Db.Purchaser()
+ {
+ Id = purchaserId,
+ Location = purchaserLocation,
+ Name = purchaserName,
+ Platform = request.Platform
+ },
+ ItemList = list,
+ PurchasePlatform = request.Platform,
+ PurchaseProductId = request.PurchaseProductId
+ };
+ }
+ }
+ catch { }
+ {
+ return null;
+ }
+ }
+
+ private string GetOneBoundSkuLogo(JToken skuJToken, JArray prop_img)
+ {
+ if (!prop_img.HasValues)
+ return "pack://application:,,,/Resources/Images/defaultItem.png";
+ var properties = skuJToken.Value("properties").Split(skuPropertiesSplitChar, StringSplitOptions.RemoveEmptyEntries);
+ foreach (var p in properties)
+ {
+ var imgJToken = prop_img.FirstOrDefault(g => g.Value("properties") == p);
+ if (imgJToken != null)
+ return imgJToken.Value("url");
+ }
+ return "pack://application:,,,/Resources/Images/defaultItem.png";
+ }
+
+ private PurchaseSkuBasicInfoResponse LoadFromSpider(PurchaseSkuBasicInfoRequest request)
+ {
+ switch (request.Platform)
+ {
+ case Enums.Platform.阿里巴巴:
+ return LoadFrom1688Spider(request);
+ //case Platform.拳探:
+ // return LoadFromQTSpider(platform, productId, skuId, purchaseProductId, priceMode);
+ }
+ return null;
+ }
+
+ private PurchaseSkuBasicInfoResponse LoadFrom1688Spider(PurchaseSkuBasicInfoRequest request)
+ {
+ //https://detail.1688.com/offer/672221374773.html?clickid=65f3772cd5d16f190ce4991414607&sessionid=3de47a0c26dcbfde4692064bd55861&sk=order
+
+ //globalData/tempModel/sellerUserId
+ //globalData/tempModel/companyName
+ //data/1081181309101/data/location
+
+
+ //data/1081181309582/data/pirceModel/[currentPrices]/[0]price
+
+ try
+ {
+ var _1688pageResult = restApiService.SendRequest("https://detail.1688.com",
+ $"offer/{request.PurchaseProductId}.html",
+ $"clickid={Guid.NewGuid().ToString().Md5Encrypt()}&sessionid={Guid.NewGuid().ToString().Md5Encrypt()}&sk={(request.PriceMode == Enums.PurchaseOrderMode.批发 ? "order" : "consign")}",
+ _1688ProductDetailRequestHeader,
+ HttpMethod.Get,
+ httpClientName: "gzip");
+
+ if (_1688pageResult.StatusCode != System.Net.HttpStatusCode.OK)
+ return null;
+
+ var match = Regex.Match(_1688pageResult.Content, @"(window\.__INIT_DATA=)(.*)(\r*\n*\s*)");
+ if (!match.Success)
+ return null;
+
+ var jsonStr = match.Groups[2].Value;
+ var jobject = JObject.Parse(jsonStr);
+
+ //16347413030323
+ var purchaser = new Purchaser()
+ {
+ Id = jobject["globalData"]["tempModel"]["sellerUserId"].ToString(),
+ Name = jobject["globalData"]["tempModel"]["companyName"].ToString(),
+ Location = jobject["data"]["1081181309101"] != null ?
+ jobject["data"]["1081181309101"]["data"]["location"].ToString() :
+ jobject["data"]["16347413030323"]["data"]["location"].ToString(),
+ Platform = Enums.Platform.阿里巴巴
+ };
+
+ var colorsProperty = jobject["globalData"]["skuModel"]["skuProps"].FirstOrDefault(j => j.Value("fid") == 3216 ||
+ j.Value("fid") == 1627207 ||
+ j.Value("fid") == 1234 ||
+ j.Value("fid") == 3151)["value"]
+ .Children()
+ .Select(j => new
+ {
+ name = j.Value("name"),
+ imageUrl = j.Value("imageUrl")
+ }).ToList();
+
+ var firstPrice = jobject["data"]["1081181309582"] != null ?
+ jobject["data"]["1081181309582"]["data"]["priceModel"]["currentPrices"][0].Value("price") :
+ jobject["data"]["16347413030316"]["data"]["priceModel"]["currentPrices"][0].Value("price");
+
+ var list = new List();
+
+ foreach (var jsku in jobject["globalData"]["skuModel"]["skuInfoMap"].Children())
+ {
+ var jskuProperty = jsku as JProperty;
+ var name = jskuProperty.Name;
+ var matchName = name.Contains(">") ? name.Substring(0, name.IndexOf(">")) : name;
+ var value = jskuProperty.Value;
+
+ var skuPrice = value.Value("price");
+
+ list.Add(new PurchaseSkuItemBasicInfoResponse()
+ {
+ PurchaseProductId = request.PurchaseProductId,
+ Price = skuPrice == 0M ? firstPrice : skuPrice,
+ Title = name,
+ PurchaseSkuId = value.Value("skuId"),
+ PurchaseSkuSpecId = value.Value("specId"),
+ Logo = colorsProperty.FirstOrDefault(c => c.name == matchName)?.imageUrl ?? "pack://application:,,,/Resources/Images/defaultItem.png"
+ });
+ }
+
+ return new PurchaseSkuBasicInfoResponse()
+ {
+ ItemList = list,
+ Purchaser = purchaser,
+ PurchaseProductId = request.PurchaseProductId,
+ PurchasePlatform = Enums.Platform.阿里巴巴
+ };
+ }
+ catch
+ {
+
+ return null;
+ }
+ }
+
+ //private (Purchaser purchaser, IList purchaseSchemeProductSkus)? LoadFromQTSpider(Platform platform, string productId, string skuId, string purchaseProductId, PurchaseOrderMode priceMode)
+ //{
+ // try
+ // {
+ // var response = quanTanProductClient.GetProductInfo(purchaseProductId, qtAppId, qtAppSecret);
+ // if (response.Status != 200)
+ // return null;
+ // return (new Purchaser()
+ // {
+ // Id = response.Data.Supplier.VenderId,
+ // Name = response.Data.Supplier.VerdenName,
+ // Location = response.Data.Supplier.Location
+ // }, response.Data.ProductSku.Select(qtsku => new PurchaseSchemeProductSku()
+ // {
+ // ProductId = productId,
+ // SkuId = skuId,
+ // PurchaseProductId = purchaseProductId,
+ // Price = qtsku.Price,
+ // Title = qtsku.Title,
+ // PurchaseSkuId = qtsku.SkuId,
+ // PurchaseSkuSpecId = string.Empty,
+ // Logo = qtsku.Logo
+ // }).ToList());
+ // }
+ // catch
+ // {
+ // return null;
+ // }
+ //}
+ }
+}
diff --git a/BBWY.Server.Business/PurchaseScheme/PurchaseSchemeBusiness.cs b/BBWY.Server.Business/PurchaseScheme/PurchaseSchemeBusiness.cs
index 5633fc6b..8c89b5d9 100644
--- a/BBWY.Server.Business/PurchaseScheme/PurchaseSchemeBusiness.cs
+++ b/BBWY.Server.Business/PurchaseScheme/PurchaseSchemeBusiness.cs
@@ -1,7 +1,9 @@
using BBWY.Common.Extensions;
using BBWY.Common.Models;
+using BBWY.Server.Model;
using BBWY.Server.Model.Db;
using BBWY.Server.Model.Dto;
+using FreeSql;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,7 +13,11 @@ namespace BBWY.Server.Business
{
public class PurchaseSchemeBusiness : BaseBusiness, IDenpendency
{
- public PurchaseSchemeBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator) : base(fsql, nLogManager, idGenerator) { }
+ private PurchaseProductAPIService purchaseProductAPIService;
+ public PurchaseSchemeBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator, PurchaseProductAPIService purchaseProductAPIService) : base(fsql, nLogManager, idGenerator)
+ {
+ this.purchaseProductAPIService = purchaseProductAPIService;
+ }
private void ExtractNewPurchaser(IList purchaserSchemeList, IList addPurchaserList) where T : InputPurchaseSchemeRequest
{
@@ -223,13 +229,13 @@ namespace BBWY.Server.Business
var purchaserList = fsql.Select().Where(p => sharePurchaserIdList.Contains(p.Id)).ToList();
foreach (var p in purchaserList)
{
- var scheme = purchaseSchemeList.FirstOrDefault(ps=>ps.PurchaserId == p.Id);
+ var scheme = purchaseSchemeList.FirstOrDefault(ps => ps.PurchaserId == p.Id);
if (scheme != null)
{
p.DefaultCost = scheme.DefaultCost;
p.LastPurchaseTime = scheme.LastPurchaseTime;
}
- }
+ }
return purchaserList;
}
@@ -255,5 +261,104 @@ namespace BBWY.Server.Business
fsql.Delete().Where(p => p.SkuPurchaseSchemeId == schemeId).ExecuteAffrows();
});
}
+
+
+ ///
+ /// 获取采购Sku的基本信息
+ ///
+ ///
+ ///
+ public PurchaseSkuBasicInfoResponse GetPurchaseSkuBasicInfo(PurchaseSkuBasicInfoRequest request)
+ {
+ return purchaseProductAPIService.GetProductInfo(request);
+ }
+
+ public IList BatchGetPurchaseSkuBasicInfo(BatchPurchaseSkuBasicInfoRequest request)
+ {
+ var list = new List();
+ foreach (var param in request.Params)
+ {
+ foreach (var purchaseId in param.PurchaseProductIds)
+ {
+ var response = GetPurchaseSkuBasicInfo(new PurchaseSkuBasicInfoRequest()
+ {
+ FirstApiMode = request.FirstApiMode,
+ PriceMode = request.PriceMode,
+ Platform = param.Platform,
+ PurchaseProductId = purchaseId
+ });
+ if (response != null)
+ {
+ if (param.PurchaseSkuIds != null && param.PurchaseSkuIds.Count() > 0)
+ {
+ for (var i = 0; i < response.ItemList.Count(); i++)
+ {
+ var skuInfo = response.ItemList[i];
+ if (!param.PurchaseSkuIds.Any(s => s == skuInfo.PurchaseSkuId))
+ {
+ response.ItemList.RemoveAt(i);
+ i--;
+ }
+ }
+ }
+ list.Add(response);
+ }
+ }
+ }
+ return list;
+ }
+
+ ///
+ /// 批量修改拳探采购方案归属采购商
+ ///
+ /// 修改成功的拳探skuId
+ ///
+ public IList BatchUpdateQTPurchaseSchemeBelongPurchaser(BatchUpdateQTPurchaseSchemeBelongPurchaserRequest request)
+ {
+ var purchaseSchemeList = GetPurchaseSchemeList(new QuerySchemeRequest()
+ {
+ PurchasePlatform = Enums.Platform.拳探,
+ PurchaserId = request.PurchaserId
+ });
+ IList updateSkuIdList = new List();
+ IList> updatePurchaseSchemeList = new List>();
+ foreach (var purchaseScheme in purchaseSchemeList)
+ {
+ var firstProduct = purchaseScheme.PurchaseSchemeProductList.FirstOrDefault();
+ var purchaseBasicInfoList = BatchGetPurchaseSkuBasicInfo(new BatchPurchaseSkuBasicInfoRequest()
+ {
+ FirstApiMode = Enums.PurchaseProductAPIMode.Spider,
+ PriceMode = Enums.PurchaseOrderMode.批发,
+ Params = new List()
+ {
+ new BatchPurchaseSkuBasicInfoParamRequest()
+ {
+ Platform = Enums.Platform.拳探,
+ PurchaseProductIds = new string[]{firstProduct.PurchaseProductId}
+ }
+ }
+ });
+
+ if (purchaseBasicInfoList.Count() == 0)
+ continue;
+ var p = purchaseBasicInfoList.FirstOrDefault().Purchaser;
+ if (p != null && p.Id != purchaseScheme.PurchaserId)
+ {
+ var update = fsql.Update(purchaseScheme.Id).Set(ps => ps.PurchaserId, p.Id);
+ updatePurchaseSchemeList.Add(update);
+ updateSkuIdList.Add(purchaseScheme.SkuId);
+ }
+ }
+
+ if (updatePurchaseSchemeList.Count() > 0)
+ {
+ fsql.Transaction(() =>
+ {
+ foreach (var update in updatePurchaseSchemeList)
+ update.ExecuteAffrows();
+ });
+ }
+ return updateSkuIdList;
+ }
}
}
diff --git a/BBWY.Server.Model/Dto/Request/PurchaseScheme/BatchUpdateQTPurchaseSchemeBelongPurchaserRequest.cs b/BBWY.Server.Model/Dto/Request/PurchaseScheme/BatchUpdateQTPurchaseSchemeBelongPurchaserRequest.cs
new file mode 100644
index 00000000..2dbf1b5a
--- /dev/null
+++ b/BBWY.Server.Model/Dto/Request/PurchaseScheme/BatchUpdateQTPurchaseSchemeBelongPurchaserRequest.cs
@@ -0,0 +1,10 @@
+namespace BBWY.Server.Model.Dto
+{
+ public class BatchUpdateQTPurchaseSchemeBelongPurchaserRequest
+ {
+ ///
+ /// 采购商Id 可空
+ ///
+ public string PurchaserId { get; set; }
+ }
+}
diff --git a/BBWY.Server.Model/Dto/Request/PurchaseScheme/PurcasheSkuBasicInfoRequest.cs b/BBWY.Server.Model/Dto/Request/PurchaseScheme/PurcasheSkuBasicInfoRequest.cs
new file mode 100644
index 00000000..91cb83be
--- /dev/null
+++ b/BBWY.Server.Model/Dto/Request/PurchaseScheme/PurcasheSkuBasicInfoRequest.cs
@@ -0,0 +1,42 @@
+using System.Collections.Generic;
+
+namespace BBWY.Server.Model.Dto
+{
+ public class PurchaseSkuBasicInfoRequest
+ {
+ public Enums.Platform Platform { get; set; }
+
+ ///
+ /// 采购商品Id
+ ///
+ public string PurchaseProductId { get; set; }
+
+ public Enums.PurchaseOrderMode PriceMode { get; set; }
+
+ public Enums.PurchaseProductAPIMode FirstApiMode { get; set; }
+ }
+
+ public class BatchPurchaseSkuBasicInfoRequest
+ {
+ public IList Params { get; set; }
+
+ public Enums.PurchaseOrderMode PriceMode { get; set; }
+
+ public Enums.PurchaseProductAPIMode FirstApiMode { get; set; }
+ }
+
+ public class BatchPurchaseSkuBasicInfoParamRequest
+ {
+ public Enums.Platform Platform { get; set; }
+
+ ///
+ /// 采购商品Id(采购spu)
+ ///
+ public string[] PurchaseProductIds { get; set; }
+
+ ///
+ /// 需要保留的采购SkuId,如果传递了该数组,将过滤不在该数组的采购sku
+ ///
+ public string[] PurchaseSkuIds { get; set; }
+ }
+}
diff --git a/BBWY.Server.Model/Dto/Response/PurchaseScheme/PurchaseProductBasicInfoResponse.cs b/BBWY.Server.Model/Dto/Response/PurchaseScheme/PurchaseProductBasicInfoResponse.cs
new file mode 100644
index 00000000..6c3704c8
--- /dev/null
+++ b/BBWY.Server.Model/Dto/Response/PurchaseScheme/PurchaseProductBasicInfoResponse.cs
@@ -0,0 +1,58 @@
+using BBWY.Server.Model.Db;
+using System.Collections.Generic;
+
+namespace BBWY.Server.Model.Dto
+{
+ ///
+ /// 采购Sku基础信息对象
+ ///
+ public class PurchaseSkuBasicInfoResponse
+ {
+ public Enums.Platform PurchasePlatform { get; set; }
+
+ public string PurchaseProductId { get; set; }
+
+ ///
+ /// 采购SKU基础信息列表
+ ///
+ public IList ItemList { get; set; }
+
+ ///
+ /// 采购商
+ ///
+ public Purchaser Purchaser { get; set; }
+ }
+
+ ///
+ /// 采购Sku基础信息对象
+ ///
+ public class PurchaseSkuItemBasicInfoResponse
+ {
+ ///
+ /// 采购SPU
+ ///
+ public string PurchaseProductId { get; set; }
+
+ ///
+ /// 采购SKU
+ ///
+ public string PurchaseSkuId { get; set; }
+
+ ///
+ /// 采购SPEC 1688独有属性 下单需要
+ ///
+ public string PurchaseSkuSpecId { get; set; }
+
+ ///
+ /// SKU标题
+ ///
+ public string Title { get; set; }
+
+ public string Logo { get; set; }
+
+ ///
+ /// 单价
+ ///
+ public decimal Price { get; set; }
+ }
+}
diff --git a/BBWY.Server.Model/Enums.cs b/BBWY.Server.Model/Enums.cs
index cc90dd3a..41e71598 100644
--- a/BBWY.Server.Model/Enums.cs
+++ b/BBWY.Server.Model/Enums.cs
@@ -33,6 +33,15 @@
代发 = 1
}
+ ///
+ /// 采购商品API模式 Spider = 0,OneBound = 1
+ ///
+ public enum PurchaseProductAPIMode
+ {
+ Spider = 0,
+ OneBound = 1
+ }
+
///
/// 仓储类型
///
From 90a84fb12a5a354f8f5d946e943290ae650ea983 Mon Sep 17 00:00:00 2001
From: shanj <18996038927@163.com>
Date: Sat, 20 May 2023 15:43:42 +0800
Subject: [PATCH 16/19] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8B=B3=E6=8E=A2?=
=?UTF-8?q?=E9=87=87=E8=B4=AD=E6=96=B9=E6=A1=88=E9=94=99=E8=AF=AF=E7=9A=84?=
=?UTF-8?q?=E9=87=87=E8=B4=AD=E5=95=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/PurchaseSchemeController.cs | 2 +-
BBWY.Server.API/Startup.cs | 5 ++
.../PurchaseProductAPIService.cs | 74 ++++++++++---------
.../PurchaseScheme/PurchaseSchemeBusiness.cs | 9 ++-
4 files changed, 52 insertions(+), 38 deletions(-)
diff --git a/BBWY.Server.API/Controllers/PurchaseSchemeController.cs b/BBWY.Server.API/Controllers/PurchaseSchemeController.cs
index a6bb132a..80ea4cd7 100644
--- a/BBWY.Server.API/Controllers/PurchaseSchemeController.cs
+++ b/BBWY.Server.API/Controllers/PurchaseSchemeController.cs
@@ -9,7 +9,7 @@ using System.Collections.Generic;
namespace BBWY.Server.API.Controllers
{
- [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
+ //[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
public class PurchaseSchemeController : BaseApiController
{
private PurchaseSchemeBusiness purchaseSchemeBusiness;
diff --git a/BBWY.Server.API/Startup.cs b/BBWY.Server.API/Startup.cs
index d136e508..97d916ca 100644
--- a/BBWY.Server.API/Startup.cs
+++ b/BBWY.Server.API/Startup.cs
@@ -13,6 +13,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
using Newtonsoft.Json.Serialization;
+using QuanTan.SDK.Client;
using System;
using System.IO;
using System.Linq;
@@ -83,6 +84,10 @@ namespace BBWY.Server.API
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
+
+ #region עȭ̽SDK
+ services.AddSingleton();
+ #endregion
//var stores = Configuration.GetSection("Stores").Get>();
services.Configure(Configuration.GetSection("GlobalSetting"));
diff --git a/BBWY.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs b/BBWY.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs
index e7d7f956..c7cbf65b 100644
--- a/BBWY.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs
+++ b/BBWY.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs
@@ -6,6 +6,7 @@ using BBWY.Server.Model.Db;
using BBWY.Server.Model.Dto;
using Microsoft.Extensions.Caching.Memory;
using Newtonsoft.Json.Linq;
+using QuanTan.SDK.Client;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -21,8 +22,8 @@ namespace BBWY.Server.Business
private string oneBoundKey = "t5060712539";
private string oneBoundSecret = "20211103";
- //private string qtAppId = "BBWY2023022001";
- //private string qtAppSecret = "908e131365d5448ca651ba20ed7ddefe";
+ private string qtAppId = "BBWY2023022001";
+ private string qtAppSecret = "908e131365d5448ca651ba20ed7ddefe";
private TimeSpan purchaseProductCacheTimeSpan;
//private TimeSpan _1688SessionIdTimeSpan;
@@ -31,8 +32,9 @@ namespace BBWY.Server.Business
private IDictionary _1688ProductDetailRequestHeader;
private char[] skuPropertiesSplitChar = new char[] { ';' };
+ private QuanTanProductClient quanTanProductClient;
- public PurchaseProductAPIService(RestApiService restApiService, IMemoryCache memoryCache)
+ public PurchaseProductAPIService(RestApiService restApiService, IMemoryCache memoryCache, QuanTanProductClient quanTanProductClient)
{
this.memoryCache = memoryCache;
this.restApiService = restApiService;
@@ -45,6 +47,7 @@ namespace BBWY.Server.Business
{ "Accept-Language","zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"}
};
purchaseProductCacheTimeSpan = TimeSpan.FromDays(1);
+ this.quanTanProductClient = quanTanProductClient;
}
public PurchaseSkuBasicInfoResponse GetProductInfo(PurchaseSkuBasicInfoRequest request)
@@ -163,8 +166,8 @@ namespace BBWY.Server.Business
{
case Enums.Platform.阿里巴巴:
return LoadFrom1688Spider(request);
- //case Platform.拳探:
- // return LoadFromQTSpider(platform, productId, skuId, purchaseProductId, priceMode);
+ case Enums.Platform.拳探:
+ return LoadFromQTSpider(request);
}
return null;
}
@@ -262,34 +265,37 @@ namespace BBWY.Server.Business
}
}
- //private (Purchaser purchaser, IList purchaseSchemeProductSkus)? LoadFromQTSpider(Platform platform, string productId, string skuId, string purchaseProductId, PurchaseOrderMode priceMode)
- //{
- // try
- // {
- // var response = quanTanProductClient.GetProductInfo(purchaseProductId, qtAppId, qtAppSecret);
- // if (response.Status != 200)
- // return null;
- // return (new Purchaser()
- // {
- // Id = response.Data.Supplier.VenderId,
- // Name = response.Data.Supplier.VerdenName,
- // Location = response.Data.Supplier.Location
- // }, response.Data.ProductSku.Select(qtsku => new PurchaseSchemeProductSku()
- // {
- // ProductId = productId,
- // SkuId = skuId,
- // PurchaseProductId = purchaseProductId,
- // Price = qtsku.Price,
- // Title = qtsku.Title,
- // PurchaseSkuId = qtsku.SkuId,
- // PurchaseSkuSpecId = string.Empty,
- // Logo = qtsku.Logo
- // }).ToList());
- // }
- // catch
- // {
- // return null;
- // }
- //}
+ private PurchaseSkuBasicInfoResponse LoadFromQTSpider(PurchaseSkuBasicInfoRequest request)
+ {
+ try
+ {
+ var response = quanTanProductClient.GetProductInfo(request.PurchaseProductId, qtAppId, qtAppSecret);
+ if (response.Status != 200)
+ return null;
+ return new PurchaseSkuBasicInfoResponse()
+ {
+ Purchaser = new Purchaser()
+ {
+ Id = response.Data.Supplier.VenderId,
+ Name = response.Data.Supplier.VerdenName,
+ Location = response.Data.Supplier.Location
+ },
+ PurchaseProductId = request.PurchaseProductId,
+ PurchasePlatform = Enums.Platform.拳探,
+ ItemList = response.Data.ProductSku.Select(s => new PurchaseSkuItemBasicInfoResponse()
+ {
+ Logo = s.Logo,
+ Price = s.Price,
+ PurchaseProductId = s.ProductId,
+ PurchaseSkuId = s.SkuId,
+ Title = s.Title
+ }).ToList()
+ };
+ }
+ catch
+ {
+ return null;
+ }
+ }
}
}
diff --git a/BBWY.Server.Business/PurchaseScheme/PurchaseSchemeBusiness.cs b/BBWY.Server.Business/PurchaseScheme/PurchaseSchemeBusiness.cs
index 8c89b5d9..5e30e3d8 100644
--- a/BBWY.Server.Business/PurchaseScheme/PurchaseSchemeBusiness.cs
+++ b/BBWY.Server.Business/PurchaseScheme/PurchaseSchemeBusiness.cs
@@ -320,7 +320,8 @@ namespace BBWY.Server.Business
PurchasePlatform = Enums.Platform.拳探,
PurchaserId = request.PurchaserId
});
- IList updateSkuIdList = new List();
+ var qtPurchaserList = fsql.Select().Where(p => p.Platform == Enums.Platform.拳探).ToList();
+ IList updateSkuChangeInfoList = new List();
IList> updatePurchaseSchemeList = new List>();
foreach (var purchaseScheme in purchaseSchemeList)
{
@@ -346,7 +347,9 @@ namespace BBWY.Server.Business
{
var update = fsql.Update(purchaseScheme.Id).Set(ps => ps.PurchaserId, p.Id);
updatePurchaseSchemeList.Add(update);
- updateSkuIdList.Add(purchaseScheme.SkuId);
+
+ var oldPurchasr = qtPurchaserList.FirstOrDefault(op => op.Id == purchaseScheme.PurchaserId);
+ updateSkuChangeInfoList.Add($"{purchaseScheme.SkuId} -> {oldPurchasr?.Name} -> {p.Name}");
}
}
@@ -358,7 +361,7 @@ namespace BBWY.Server.Business
update.ExecuteAffrows();
});
}
- return updateSkuIdList;
+ return updateSkuChangeInfoList;
}
}
}
From 64169ad64aa241cddc7168d731a0324300b02312 Mon Sep 17 00:00:00 2001
From: "506583276@qq.com" <506583276@qq.com>
Date: Sun, 21 May 2023 13:03:51 +0800
Subject: [PATCH 17/19] 1
---
BBWY.Client/BBWYAppSettings.json | 8 ++++----
BBWY.Client/Models/QiKu/PackSkuConfig.cs | 5 +++++
.../Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml | 4 ++--
BBWY.Client/Views/BatchPurchase/PackSkuConfigWindow.xaml | 7 ++++++-
.../BatchPurchase/BatchPurchaseBusiness.cs | 6 +++++-
.../Dto/Request/QiKu/PackSkuConfigRequest.cs | 5 ++++-
6 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/BBWY.Client/BBWYAppSettings.json b/BBWY.Client/BBWYAppSettings.json
index e1b3dcff..3c6663c7 100644
--- a/BBWY.Client/BBWYAppSettings.json
+++ b/BBWY.Client/BBWYAppSettings.json
@@ -1,9 +1,9 @@
{
- //"BBWYApiHost": "http://localhost:5000",
- "BBWYApiHost": "http://bbwytest.qiyue666.com",
+ "BBWYApiHost": "http://localhost:5000",
+ //"BBWYApiHost": "http://bbwytest.qiyue666.com",
"MDSApiHost": "http://mdsapi.qiyue666.com",
"JOSApiHost": "",
"1688ApiHost": "",
- "QKApiHost": "http://localhost:8080"
- //"QKApiHost": "http://qiku.qiyue666.com"
+ //"QKApiHost": "http://localhost:8080"
+ "QKApiHost": "http://qiku.qiyue666.com"
}
\ No newline at end of file
diff --git a/BBWY.Client/Models/QiKu/PackSkuConfig.cs b/BBWY.Client/Models/QiKu/PackSkuConfig.cs
index 619a3757..d02c3370 100644
--- a/BBWY.Client/Models/QiKu/PackSkuConfig.cs
+++ b/BBWY.Client/Models/QiKu/PackSkuConfig.cs
@@ -10,6 +10,7 @@ namespace BBWY.Client.Models.QiKu
}
private int splitCount;
+ private string remarkMessage;
public string SkuId { get; set; }
@@ -17,6 +18,8 @@ namespace BBWY.Client.Models.QiKu
public string Title { get; set; }
+
+
///
/// 采购数量
///
@@ -27,6 +30,8 @@ namespace BBWY.Client.Models.QiKu
///
public int SplitCount { get => splitCount; set { Set(ref splitCount, value); } }
+ public string RemarkMessage { get => remarkMessage; set { Set(ref remarkMessage, value); } }
+
public ObservableCollection PackSkuSplitConfigList { get; set; }
}
diff --git a/BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml b/BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml
index b208bd6e..c98e7518 100644
--- a/BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml
+++ b/BBWY.Client/Views/BatchPurchase/BatchCreateNewPurchaseOrder.xaml
@@ -137,7 +137,7 @@
-
+
@@ -237,7 +237,7 @@
Height="18"
Command="{Binding DataContext.SubtractQuantityCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Window}}}"
CommandParameter="{Binding }"/>
-
+
@@ -49,6 +50,7 @@
+
@@ -116,10 +118,13 @@
+
+
-
+
+
diff --git a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
index 1c598771..b5cbc30b 100644
--- a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
+++ b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
@@ -11,6 +11,7 @@ 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;
@@ -330,16 +331,19 @@ namespace BBWY.Server.Business
};
insertPurchaseOrderSkuList.Add(purchaseOrderSku);
+
if (purchasePlatform == Enums.Platform.拳探)
{
var skuPackConfig = request.PackSkuConfigList?.FirstOrDefault(s => s.SkuId == firstProductParam.BelongSkuId);
+
if (skuPackConfig != null)
{
+
skuPackConfigList.Add(new
{
skuId = firstProductParam.BelongSkuId,
skuCount = skuPackConfig.PurchaseCount,
- markMessage = string.Empty,
+ markMessage = skuPackConfig.RemarkMessage,
wareHourses = skuPackConfig.PackSkuSplitConfigList.Select(x => new
{
wareId = x.Store.Id,
diff --git a/BBWY.Server.Model/Dto/Request/QiKu/PackSkuConfigRequest.cs b/BBWY.Server.Model/Dto/Request/QiKu/PackSkuConfigRequest.cs
index 6c3e9256..44d7f1d2 100644
--- a/BBWY.Server.Model/Dto/Request/QiKu/PackSkuConfigRequest.cs
+++ b/BBWY.Server.Model/Dto/Request/QiKu/PackSkuConfigRequest.cs
@@ -8,7 +8,10 @@ namespace BBWY.Server.Model.Dto
{
}
-
+ ///
+ /// 采购备注信息
+ ///
+ public string RemarkMessage { get; set; }
///
/// 店铺Sku
///
From 8267147d85f0bc22ef6d4f76c875489ce4fce899 Mon Sep 17 00:00:00 2001
From: "506583276@qq.com" <506583276@qq.com>
Date: Sun, 21 May 2023 14:11:52 +0800
Subject: [PATCH 18/19] 1
---
BBWY.Client/BBWYAppSettings.json | 4 ++--
BBWY.Client/Views/BatchPurchase/PackSkuConfigWindow.xaml | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/BBWY.Client/BBWYAppSettings.json b/BBWY.Client/BBWYAppSettings.json
index 3c6663c7..9622efaf 100644
--- a/BBWY.Client/BBWYAppSettings.json
+++ b/BBWY.Client/BBWYAppSettings.json
@@ -1,6 +1,6 @@
{
- "BBWYApiHost": "http://localhost:5000",
- //"BBWYApiHost": "http://bbwytest.qiyue666.com",
+ //"BBWYApiHost": "http://localhost:5000",
+ "BBWYApiHost": "http://bbwytest.qiyue666.com",
"MDSApiHost": "http://mdsapi.qiyue666.com",
"JOSApiHost": "",
"1688ApiHost": "",
diff --git a/BBWY.Client/Views/BatchPurchase/PackSkuConfigWindow.xaml b/BBWY.Client/Views/BatchPurchase/PackSkuConfigWindow.xaml
index 91676e79..02dc735c 100644
--- a/BBWY.Client/Views/BatchPurchase/PackSkuConfigWindow.xaml
+++ b/BBWY.Client/Views/BatchPurchase/PackSkuConfigWindow.xaml
@@ -120,7 +120,7 @@
-
+
From ea3e7692d106ce815dd6bcef23f7638baf9c9fc5 Mon Sep 17 00:00:00 2001
From: "506583276@qq.com" <506583276@qq.com>
Date: Sun, 21 May 2023 17:00:26 +0800
Subject: [PATCH 19/19] 1
---
BBWY.Client/Views/MainWindow.xaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/BBWY.Client/Views/MainWindow.xaml b/BBWY.Client/Views/MainWindow.xaml
index ad6b9b1e..7122ab5f 100644
--- a/BBWY.Client/Views/MainWindow.xaml
+++ b/BBWY.Client/Views/MainWindow.xaml
@@ -26,7 +26,7 @@
-
+