From c32e4ad6b58004347af7f0c685153876a9231414 Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Thu, 14 Dec 2023 17:44:00 +0800 Subject: [PATCH 1/5] 10222 --- BBWY.Client/GlobalContext.cs | 2 +- BBWY.Client/Views/PackTask/PrintWindow.xaml | 4 +- .../Views/PackTask/PrintWindow.xaml.cs | 92 +++++++++++++------ .../PrintPackDetailWindow.xaml.cs | 7 -- 4 files changed, 65 insertions(+), 40 deletions(-) diff --git a/BBWY.Client/GlobalContext.cs b/BBWY.Client/GlobalContext.cs index aa9ede9e..5831bf75 100644 --- a/BBWY.Client/GlobalContext.cs +++ b/BBWY.Client/GlobalContext.cs @@ -13,7 +13,7 @@ namespace BBWY.Client { ShopServiceGroupList = new List(); ShopServiceGroupLowerList = new List(); - ClientVersion = "10221"; + ClientVersion = "10222"; } diff --git a/BBWY.Client/Views/PackTask/PrintWindow.xaml b/BBWY.Client/Views/PackTask/PrintWindow.xaml index cd2c9821..860acbbe 100644 --- a/BBWY.Client/Views/PackTask/PrintWindow.xaml +++ b/BBWY.Client/Views/PackTask/PrintWindow.xaml @@ -45,13 +45,13 @@ - + - + diff --git a/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs b/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs index 0eb7a853..ce4d0ab1 100644 --- a/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs @@ -9,6 +9,8 @@ using System.Threading.Tasks; using System.Windows; using System.Collections.ObjectModel; using BBWY.Client.Extensions; +using System.Reflection; +using System.IO; namespace BBWY.Client.Views.PackTask { @@ -20,21 +22,17 @@ namespace BBWY.Client.Views.PackTask public PrintWindow() { InitializeComponent(); - this.Loaded += PrintWindow_Loaded; - - - } + InitPrintList(); + this.DataContext = this; - private void PrintWindow_Loaded(object sender, RoutedEventArgs e) - { - LoadPrints(); } - /// /// 获取打印机名称 /// - private void LoadPrints() + public void InitPrintList() { + + PrintList = new ObservableCollection(); var printingNames = PrinterSettings.InstalledPrinters;//获取本机的打印机数据 int index = -1; int selectIndex = 0; @@ -49,12 +47,30 @@ namespace BBWY.Client.Views.PackTask { selectIndex = index; } - cbPrints.Items.Add(name); + PrintList.Add(name); + } + try + { + var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + string printNames = System.IO.Path.Combine(applicationPath, "handPrintBarCerName.init"); + if (File.Exists(printNames)) + { + PrintName = File.ReadAllText(printNames); + } + else + { + if (PrintList.Count > 0) + { + PrintName = PrintList[0].ToString(); + } + } } - if (cbPrints.Items.Count > selectIndex) + catch (Exception) { - cbPrints.SelectedIndex = selectIndex; + + } + } @@ -81,43 +97,59 @@ namespace BBWY.Client.Views.PackTask cer.Visibility = Visibility.Collapsed; bar.Visibility = Visibility.Visible; } - this.DataContext = this; + } - public CertificateModel[] CertificateModel { get; set; } + private CertificateModel[] certificateModel; + public CertificateModel[] CertificateModel { get => certificateModel; set { Set(ref certificateModel, value); } } - public BarCodeModel BarCodeModel { get; set; } + private BarCodeModel barCodeModel; + public BarCodeModel BarCodeModel { get=> barCodeModel; set {Set(ref barCodeModel,value); } } - private void BButton_Click(object sender, RoutedEventArgs e) - { - int printCount = 0; - try - { - printCount = Convert.ToInt32(tbCount.Text); - } - catch - { - new TipsWindow("请输入打印份数", 1).ShowDialog(); - return; - } - string printName = cbPrints.Text;//选择的要打印的打印机名称 + /// + /// 打印机列表 + /// + public ObservableCollection PrintList { get; set; } + public string PrintName { get; set; } + public int PrintCount { get => printCount; set { Set(ref printCount, value); } } + private int printCount = 1; + + private void BButton_Click(object sender, RoutedEventArgs e) + { Task.Factory.StartNew(() => { if (BarCodeModel != null) { - PrintData(printCount, printName,BarCodeModel); + PrintData(PrintCount, PrintName,BarCodeModel); //MyPrintHelper.PrintBarcode(ref args, BarCodeModel, font); } if (CertificateModel != null&& CertificateModel.Count()>0) { foreach (var cer in CertificateModel) { - PrintData(printCount, printName,null,cer); + PrintData(PrintCount, PrintName,null,cer); System.Threading.Thread.Sleep(100); } } + + var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + string printNames = System.IO.Path.Combine(applicationPath, "handPrintBarCerName.init"); + try + { + if (File.Exists(printNames)) + { + File.Delete(printNames); + } + } + catch + { + + + } + + File.WriteAllText(printNames, PrintName); }); } diff --git a/BBWY.Client/Views/PackagingTask/PrintPackDetailWindow.xaml.cs b/BBWY.Client/Views/PackagingTask/PrintPackDetailWindow.xaml.cs index 54b0767c..c543d504 100644 --- a/BBWY.Client/Views/PackagingTask/PrintPackDetailWindow.xaml.cs +++ b/BBWY.Client/Views/PackagingTask/PrintPackDetailWindow.xaml.cs @@ -93,13 +93,6 @@ namespace BBWY.Client.Views.PackagingTask } private void BButton_Click(object sender, System.Windows.RoutedEventArgs e) { - - - - - - - if (PrintName.IsNullOrEmpty()) { MessageBox.Show("请选择打印设备"); From 8d4c72a2bc32831d10520d20ed70b64eef462a77 Mon Sep 17 00:00:00 2001 From: sanji Date: Fri, 15 Dec 2023 14:20:23 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBWY.Client/GlobalContext.cs | 2 +- .../Purchase/1688PreviewPurchaseViewModel.cs | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/BBWY.Client/GlobalContext.cs b/BBWY.Client/GlobalContext.cs index aa9ede9e..5831bf75 100644 --- a/BBWY.Client/GlobalContext.cs +++ b/BBWY.Client/GlobalContext.cs @@ -13,7 +13,7 @@ namespace BBWY.Client { ShopServiceGroupList = new List(); ShopServiceGroupLowerList = new List(); - ClientVersion = "10221"; + ClientVersion = "10222"; } diff --git a/BBWY.Client/ViewModels/Purchase/1688PreviewPurchaseViewModel.cs b/BBWY.Client/ViewModels/Purchase/1688PreviewPurchaseViewModel.cs index f9022b7d..878d5aea 100644 --- a/BBWY.Client/ViewModels/Purchase/1688PreviewPurchaseViewModel.cs +++ b/BBWY.Client/ViewModels/Purchase/1688PreviewPurchaseViewModel.cs @@ -76,6 +76,7 @@ namespace BBWY.Client.ViewModels /// 扩展数据,暂用于拳探 /// private string extensions; + private bool isSkuMatchError; public _1688PreviewPurchaseViewModel(OneBoundAPIService oneBoundAPIService, PurchaseService purchaseService, @@ -117,7 +118,7 @@ namespace BBWY.Client.ViewModels protected override void Load() { IsLoading = true; - + isSkuMatchError = false; Task.Factory.StartNew(() => purchaseService.GetPurchaseSchemeList(order.ItemList.Select(osku => osku.Id).ToList(), purchaser.Id, globalContext.User.Shop.ShopId)) .ContinueWith(r => { @@ -150,7 +151,10 @@ namespace BBWY.Client.ViewModels else { IsLoading = false; - App.Current.Dispatcher.Invoke(() => MessageBox.Show("采购方案商品加载失败,请重新打开预览窗口", "提示")); + if (isSkuMatchError) + App.Current.Dispatcher.Invoke(() => MessageBox.Show("采购方案与当前商品页的数据匹配失败,请删除旧采购方案后重新绑定采购方案", "提示")); + else + App.Current.Dispatcher.Invoke(() => MessageBox.Show("采购方案商品加载失败,请重新打开预览窗口", "提示")); } }); } @@ -195,6 +199,11 @@ namespace BBWY.Client.ViewModels } } }); + + if (purchaseSchemeProduct.SelectedSkuIdList.Any(s => !data.Value.purchaseSchemeProductSkus.Any(s1 => s1.PurchaseSkuId == s))) + { + isSkuMatchError = true; + } } ewh.Set(); From 8a49543deb7725241d173b345ee3d45c3b0be25b Mon Sep 17 00:00:00 2001 From: sanji Date: Fri, 15 Dec 2023 14:33:33 +0800 Subject: [PATCH 3/5] 10223 --- BBWY.Client/GlobalContext.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BBWY.Client/GlobalContext.cs b/BBWY.Client/GlobalContext.cs index 5831bf75..11a4832b 100644 --- a/BBWY.Client/GlobalContext.cs +++ b/BBWY.Client/GlobalContext.cs @@ -13,7 +13,7 @@ namespace BBWY.Client { ShopServiceGroupList = new List(); ShopServiceGroupLowerList = new List(); - ClientVersion = "10222"; + ClientVersion = "10223"; } From 941af2559250a5af1f6e7751c167062642daf2a5 Mon Sep 17 00:00:00 2001 From: sanji Date: Fri, 15 Dec 2023 17:26:17 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=A3=E5=8F=91?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBWY.Server.API/Controllers/TestController.cs | 6 +++++ BBWY.Server.Business/TestBusiness.cs | 25 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/BBWY.Server.API/Controllers/TestController.cs b/BBWY.Server.API/Controllers/TestController.cs index edbdf8b6..4f830b5d 100644 --- a/BBWY.Server.API/Controllers/TestController.cs +++ b/BBWY.Server.API/Controllers/TestController.cs @@ -42,5 +42,11 @@ namespace BBWY.Server.API.Controllers { testBusiness.RepairOrderProfit(); } + + [HttpPost] + public void RepairDFOrder() + { + testBusiness.RepairDFOrder(); + } } } diff --git a/BBWY.Server.Business/TestBusiness.cs b/BBWY.Server.Business/TestBusiness.cs index 257ecb48..744f188d 100644 --- a/BBWY.Server.Business/TestBusiness.cs +++ b/BBWY.Server.Business/TestBusiness.cs @@ -15,6 +15,7 @@ using BBWY.Server.Business.Extensions; using Newtonsoft.Json; using System.Net.Http; using System.Threading.Tasks; +using Org.BouncyCastle.Crypto.Signers; namespace BBWY.Server.Business { @@ -25,6 +26,7 @@ namespace BBWY.Server.Business private IFreeSql fsql; private OrderSyncBusiness orderSyncBusiness; private TaskSchedulerManager taskSchedulerManager; + private PurchaseOrderBusiness purchaseOrderBusiness; public TestBusiness(RestApiService restApiService, IOptions options, FreeSqlMultiDBManager freeSqlMultiDBManager, @@ -32,13 +34,15 @@ namespace BBWY.Server.Business YunDingBusiness yunDingBusiness, IFreeSql fsql, OrderSyncBusiness orderSyncBusiness, - TaskSchedulerManager taskSchedulerManager) : base(restApiService, options, yunDingBusiness) + TaskSchedulerManager taskSchedulerManager, + PurchaseOrderBusiness purchaseOrderBusiness) : base(restApiService, options, yunDingBusiness) { this.freeSqlMultiDBManager = freeSqlMultiDBManager; this.venderBusiness = venderBusiness; this.fsql = fsql; this.orderSyncBusiness = orderSyncBusiness; this.taskSchedulerManager = taskSchedulerManager; + this.purchaseOrderBusiness = purchaseOrderBusiness; } public void SyncVenderId() @@ -385,6 +389,25 @@ namespace BBWY.Server.Business if (!response.Success) throw new BusinessException(response.Msg); } + + public void RepairDFOrder() + { + var st = DateTime.Parse("2023-11-01"); + var et = DateTime.Parse("2023-11-30 23:59:59"); + var list = fsql.Select() + .InnerJoin((o, ods, ocd) => o.Id == ods.OrderId) + .InnerJoin((o, ods, ocd) => o.Id == ocd.OrderId) + .Where((o, ods, ocd) => o.ShopId == 11817258 && o.OrderState != Enums.OrderState.已取消 && o.StartTime >= st && o.StartTime <= et && o.StorageType == Enums.StorageType.代发 && ocd.IsEnabled == true && ocd.SkuAmount == 0) + .ToList((o, ods, ocd) => ods.PurchaseOrderId).Distinct().ToList(); + + for (var i = 0; i < list.Count; i++) + { + Console.WriteLine($"{i + 1}/{list.Count()},{list[i]}"); + var param = new { type = "ORDER_BUYER_VIEW_ORDER_PRICE_MODIFY", data = new { orderId = list[i] } }; + purchaseOrderBusiness.CallbackFrom1688(JsonConvert.SerializeObject(param)); + Thread.Sleep(1000); + } + } } public class JPCount From ffe849a59b91e0787a5c6f62d8f0b7d6cb438c37 Mon Sep 17 00:00:00 2001 From: sanji Date: Sat, 16 Dec 2023 15:02:31 +0800 Subject: [PATCH 5/5] 1 --- BBWY.Server.Business/TestBusiness.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BBWY.Server.Business/TestBusiness.cs b/BBWY.Server.Business/TestBusiness.cs index 744f188d..b63ba0fb 100644 --- a/BBWY.Server.Business/TestBusiness.cs +++ b/BBWY.Server.Business/TestBusiness.cs @@ -397,7 +397,7 @@ namespace BBWY.Server.Business var list = fsql.Select() .InnerJoin((o, ods, ocd) => o.Id == ods.OrderId) .InnerJoin((o, ods, ocd) => o.Id == ocd.OrderId) - .Where((o, ods, ocd) => o.ShopId == 11817258 && o.OrderState != Enums.OrderState.已取消 && o.StartTime >= st && o.StartTime <= et && o.StorageType == Enums.StorageType.代发 && ocd.IsEnabled == true && ocd.SkuAmount == 0) + .Where((o, ods, ocd) => o.ShopId == 12897067 && o.OrderState != Enums.OrderState.已取消 && o.StartTime >= st && o.StartTime <= et && o.StorageType == Enums.StorageType.代发 && ocd.IsEnabled == true && ocd.SkuAmount == 0) .ToList((o, ods, ocd) => ods.PurchaseOrderId).Distinct().ToList(); for (var i = 0; i < list.Count; i++)