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 --- .../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; + } } }