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 1/2] 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 e8599b2426ebbeaab1af45e5ac41edc86065bf8f Mon Sep 17 00:00:00 2001
From: shanj <18996038927@163.com>
Date: Wed, 17 May 2023 16:58:23 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=8B=B3=E6=8E=A2?=
=?UTF-8?q?=E4=B8=8B=E5=8D=95=E6=8E=A5=E5=8F=A3=E6=89=A9=E5=B1=95=E5=8F=82?=
=?UTF-8?q?=E6=95=B0=E7=BB=93=E6=9E=84=EF=BC=8C=E5=8E=BB=E6=8E=89SourceSku?=
=?UTF-8?q?,=20=E6=94=B9=E6=88=90BelongSkus=20(object)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../PlatformSDK/QuanTanBusiness.cs | 6 +++---
.../BatchPurchase/BatchPurchaseBusiness.cs | 15 ++++++++++++++-
.../CreateOnlinePurchaseOrderRequest.cs | 2 +-
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/BBWY.Server.Business/PlatformSDK/QuanTanBusiness.cs b/BBWY.Server.Business/PlatformSDK/QuanTanBusiness.cs
index a3b14c1c..c52a4bba 100644
--- a/BBWY.Server.Business/PlatformSDK/QuanTanBusiness.cs
+++ b/BBWY.Server.Business/PlatformSDK/QuanTanBusiness.cs
@@ -23,13 +23,13 @@ namespace BBWY.Server.Business
public override PayPurchaseOrderResponse PayPurchaseOrder(PayPurchaseOrderRequest payPurchaseOrderRequest)
{
-
+
var qtResponse = quanTanOrderClient.PayOrder(new QuanTanPayOrderRequest
{
orderId = payPurchaseOrderRequest.OrderId,
userAccount = payPurchaseOrderRequest.AppToken
}, payPurchaseOrderRequest.AppKey, payPurchaseOrderRequest.AppSecret);
- if (qtResponse.Status == 200) return new PayPurchaseOrderResponse { Success = true, PurchaseOrderState= PurchaseOrderState.待发货 };
+ if (qtResponse.Status == 200) return new PayPurchaseOrderResponse { Success = true, PurchaseOrderState = PurchaseOrderState.待发货 };
if (qtResponse.Message != null && qtResponse.Message.Contains("已支付"))
{
@@ -163,7 +163,7 @@ namespace BBWY.Server.Business
extended = JsonConvert.SerializeObject(new
{
BuyerAccount = createOnlinePurchaseOrderRequest.AppToken,
- createOnlinePurchaseOrderRequest.SourceSku,
+ BelongSkus = createOnlinePurchaseOrderRequest.SourceSku,
createOnlinePurchaseOrderRequest.SourceShopName
})
};
diff --git a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
index 628c6e6b..d1a87b2c 100644
--- a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
+++ b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
@@ -242,6 +242,19 @@ namespace BBWY.Server.Business
else if (purchasePlatform == Enums.Platform.阿里巴巴)
tradeMode = extJson.Value("OrderTradeTypeCode");
+
+ #region 处理JD SKU和拳探SKU的对应关系
+ var belongSkus_mappingList = new List();
+ foreach (var belongSkuGroup in belongSkuGroups)
+ {
+ var firstProductParam = belongSkuGroup.FirstOrDefault();
+ if (!belongSkus_mappingList.Any(j => j.Value("BelongSkuId") == firstProductParam.BelongSkuId))
+ {
+ belongSkus_mappingList.Add(JObject.FromObject(new { firstProductParam.BelongSkuId, SkuId = firstProductParam.PurchaseSkuId }));
+ }
+ }
+ #endregion
+
var createOrderResponse = platformSDKBusinessList.FirstOrDefault(p => p.Platform == purchasePlatform)
.FastCreateOrder(new CreateOnlinePurchaseOrderRequest()
{
@@ -253,7 +266,7 @@ namespace BBWY.Server.Business
PurchaseOrderMode = request.PurchaseOrderMode,
Remark = request.Remark,
SourceShopName = request.ShopName,
- SourceSku = string.Join(",", belongSkuGroups.Select(g => g.Key)),
+ SourceSku = belongSkus_mappingList,
CargoParamList = productParamList.Select(p => new CargoParamRequest()
{
ProductId = p.PurchaseProductId,
diff --git a/BBWY.Server.Model/Dto/Request/PurchaseOrder/OnlinePurchase/CreateOnlinePurchaseOrderRequest.cs b/BBWY.Server.Model/Dto/Request/PurchaseOrder/OnlinePurchase/CreateOnlinePurchaseOrderRequest.cs
index 62f3d1db..a26ba6e7 100644
--- a/BBWY.Server.Model/Dto/Request/PurchaseOrder/OnlinePurchase/CreateOnlinePurchaseOrderRequest.cs
+++ b/BBWY.Server.Model/Dto/Request/PurchaseOrder/OnlinePurchase/CreateOnlinePurchaseOrderRequest.cs
@@ -48,7 +48,7 @@
public string Extensions { get; set; }
- public string SourceSku { get; set; }
+ public object SourceSku { get; set; }
public string SourceShopName { get; set; }