diff --git a/BBWY.Client/GlobalContext.cs b/BBWY.Client/GlobalContext.cs index 841e1f52..8d013252 100644 --- a/BBWY.Client/GlobalContext.cs +++ b/BBWY.Client/GlobalContext.cs @@ -9,7 +9,7 @@ namespace BBWY.Client { ShopServiceGroupList = new List(); ShopServiceGroupLowerList = new List(); - ClientVersion = "10118"; + ClientVersion = "10125"; } private User user; diff --git a/BBWY.Client/Helpers/MyPrintHelper.cs b/BBWY.Client/Helpers/MyPrintHelper.cs index 7058d3c0..cafd3e48 100644 --- a/BBWY.Client/Helpers/MyPrintHelper.cs +++ b/BBWY.Client/Helpers/MyPrintHelper.cs @@ -729,5 +729,19 @@ namespace BBWY.Client.Helpers print.Print(); } + + public static void SetDefaultPrint(string printName) + { + SetDefaultPrinter(printName); + } + + /// + /// 调用win api将指定名称的打印机设置为默认打印机 + /// + /// + /// + [DllImport("winspool.drv")] + public static extern bool SetDefaultPrinter(string Name); + } } diff --git a/BBWY.Client/Models/APIModel/Request/CerRequest.cs b/BBWY.Client/Models/APIModel/Request/CerRequest.cs index fe8a11c8..ebd0f15c 100644 --- a/BBWY.Client/Models/APIModel/Request/CerRequest.cs +++ b/BBWY.Client/Models/APIModel/Request/CerRequest.cs @@ -78,6 +78,7 @@ namespace BBWY.Client.Models.APIModel.Request public string PurchaseSkuId { get; set; } - + public SaveType? SaveType { get; set; } + } } diff --git a/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs b/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs index fb10e901..8bc501e2 100644 --- a/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs +++ b/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs @@ -93,5 +93,10 @@ namespace BBWY.Client.Models.APIModel.Request /// public DateTime? PreCompeteTime { get; set; } + /// + /// 地拖摆放编号 + /// + public int? FloorDragNumber { get; set; } + } } diff --git a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs index f8f767c6..1a7c7571 100644 --- a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs @@ -93,6 +93,12 @@ namespace BBWY.Client.Models.APIModel.Response.PackPurchaseTask /// 配件列表 /// public PurchaseSku[] PurchaseSkus { get; set; } + + + /// + /// + /// + public SaveType? SaveType { get; set; } } public class WareHourseDTO { diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/PackServiceResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/PackServiceResponse.cs index 64f726e6..a2e87af8 100644 --- a/BBWY.Client/Models/APIModel/Response/PackTask/PackServiceResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackTask/PackServiceResponse.cs @@ -57,6 +57,11 @@ namespace BBWY.Client.Models.APIModel.Response.PackTask /// 增量配件数量 /// public int? IncrementPartCount { get; set; } + + /// + /// 推荐打包人(skuid) + /// + public string SuggestPackUserName { get; set; } } public class PackServiceDTO diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs index a5d37c0d..f76bb8b0 100644 --- a/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs @@ -165,5 +165,9 @@ namespace BBWY.Client.Models.APIModel ///分箱情况 /// public WareHourseDTO[] WareHourses { get; set; } + /// + /// 地托编号 + /// + public int? FloorDragNumber { get; set; } } } diff --git a/BBWY.Client/Models/PackTask/CertificateModel.cs b/BBWY.Client/Models/PackTask/CertificateModel.cs index d37faf3c..90fe2664 100644 --- a/BBWY.Client/Models/PackTask/CertificateModel.cs +++ b/BBWY.Client/Models/PackTask/CertificateModel.cs @@ -12,9 +12,6 @@ namespace BBWY.Client.Models /// 合格证id /// public long Id { get; set; } - - - /// /// skuid /// @@ -143,6 +140,15 @@ namespace BBWY.Client.Models /// public long GoodsNumber { get => goodsNumber; set { Set(ref goodsNumber, value); } } + + + private int goodsNumberIndex = 1; + /// + /// 配件序号 + /// + public int GoodsNumberIndex { get => goodsNumberIndex; set { Set(ref goodsNumberIndex, value); } } + + private string produceDate; /// /// 生产日期 diff --git a/BBWY.Client/Models/PackTask/PackTaskModel.cs b/BBWY.Client/Models/PackTask/PackTaskModel.cs index f42edc2a..6daadbbe 100644 --- a/BBWY.Client/Models/PackTask/PackTaskModel.cs +++ b/BBWY.Client/Models/PackTask/PackTaskModel.cs @@ -113,7 +113,7 @@ namespace BBWY.Client.Models serviceViewModel.PackTaskModel = this; serviceViewModel.PackTaskList = new System.Collections.ObjectModel.ObservableCollection { this}; - + serviceViewModel.FloorDragNumber = this.FloorDragNumber; serviceViewModel.TaskCount = SkuCount; serviceViewModel.TaskId = TaskId; serviceViewModel.OrderId= OrderId; @@ -429,6 +429,8 @@ namespace BBWY.Client.Models public IList ItemList { get; set; } public string OrderId { get; set; } + private int? floorDragNumber; + public int? FloorDragNumber { get => floorDragNumber; set { Set(ref floorDragNumber, value); } } } public class SkuMessage : NotifyObject @@ -482,5 +484,7 @@ namespace BBWY.Client.Models /// 货号 /// public string GoodsNo { get => goodsNo; set { Set(ref goodsNo, value); } } + + } } diff --git a/BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs b/BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs index 0248f8d8..a821ab98 100644 --- a/BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs @@ -35,6 +35,17 @@ namespace BBWY.Client.ViewModels.PackTask public class PackServiceViewModel : BaseVM, IDenpendency { + + + private string suggestPackUserName; + /// + /// 打包人 + /// + public string SuggestPackUserName { get => suggestPackUserName; set { Set(ref suggestPackUserName, value); } } + + private int? floorDragNumber; + public int? FloorDragNumber { get => floorDragNumber; set { Set(ref floorDragNumber, value); } } + private string packUserName; /// /// 打包人 @@ -179,9 +190,6 @@ namespace BBWY.Client.ViewModels.PackTask public void InitPrintList() { - - - TaskImage = MyPrintHelper.GetBarcodeImage(TaskId.ToString(), 300, 60); BarcodeImage = MyPrintHelper.GetBarcodeImage(SkuId, 300, 60); @@ -287,6 +295,7 @@ namespace BBWY.Client.ViewModels.PackTask if (res.Success) { + SuggestPackUserName = res.Data.SuggestPackUserName; IncrementPartCount = res.Data.IncrementPartCount == null ? 0 : res.Data.IncrementPartCount.Value; if (res.Data != null && res.Data.IncrementItemList.Count() > 0) @@ -316,7 +325,7 @@ namespace BBWY.Client.ViewModels.PackTask BasicPackServiceList.Add(packService); if (packService.Name != "贴条码") PackServiceList.Add(packService);//加载工序服务列表 - + }); } } @@ -586,8 +595,8 @@ namespace BBWY.Client.ViewModels.PackTask if (disIncrementProcessList == null) return; - if (disBasicPackProcessList.Select(d=>d.ItemName).Distinct().Count()==1&& disBasicPackProcessList.Select(d => d.ItemName).Contains("贴条码") - && disIncrementProcessList.Count>0) + if (disBasicPackProcessList.Select(d => d.ItemName).Distinct().Count() == 1 && disBasicPackProcessList.Select(d => d.ItemName).Contains("贴条码") + && disIncrementProcessList.Count > 0) { System.Windows.MessageBox.Show("只有一道贴码工序,无法添加增值包装工序"); return; @@ -606,14 +615,25 @@ namespace BBWY.Client.ViewModels.PackTask packTaskDetail.ConsumableList = disConsumableServiceList; var res = packDetailService.SetPackTaskDetail(packTaskDetail); - if (res != null && res.Success) + + if (res==null) + { + System.Windows.MessageBox.Show("网络异常!"); + return; + } + if (!res.Success) { + System.Windows.MessageBox.Show(res.Msg); + return; + } + + // new TipsWindow("上传成功!").Show(); var win = obj as System.Windows.Window; if (SetAllFees != null) SetAllFees(); win.Close(); - } + } /// /// 更新 打包员 和费用数据 diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index 42eebbcd..e3820bb0 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -393,8 +393,11 @@ namespace BBWY.Client.ViewModels.PackTask System.Windows.MessageBox.Show("请先设置打包费用!"); return; } - - res = packTaskService.SetPackTaskState(taskId, Models.TaskState.待封箱); + if (System.Windows.MessageBox.Show("是否完成打包?", "提示", + MessageBoxButton.YesNo, + MessageBoxImage.Warning) != MessageBoxResult.Yes) + return; + res = packTaskService.SetPackTaskState(taskId, PackTaskState.待封箱); break; case Models.TaskState.待封箱: break; @@ -581,6 +584,8 @@ namespace BBWY.Client.ViewModels.PackTask OrderId = item.OrderId, SkuId = item.SkuId, SkuName = item.SkuName, + FloorDragNumber=item.FloorDragNumber, + }; if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index f4534dc2..16855eca 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -20,6 +20,7 @@ using Org.BouncyCastle.Asn1.Crmf; using System.Runtime.InteropServices.WindowsRuntime; using NPOI.Util; using BBWY.Controls; +using WebSocketSharp; namespace BBWY.Client.ViewModels { @@ -95,6 +96,18 @@ namespace BBWY.Client.ViewModels public ObservableCollection AvailabilityList { get => availabilityList; set { Set(ref availabilityList, value); } } + private int floorDragNumber; + public int FloorDragNumber { get => floorDragNumber; set { Set(ref floorDragNumber, value); } } + + private ObservableCollection floorDragNumberList = new ObservableCollection + { + + }; + public ObservableCollection FloorDragNumberList { get => floorDragNumberList; set { Set(ref floorDragNumberList, value); } } + + + + private ObservableCollection preCompeteTimeDayList = new ObservableCollection { @@ -103,7 +116,7 @@ namespace BBWY.Client.ViewModels private ObservableCollection preCompeteTimeHourList = new ObservableCollection { - "12点前","18点前","21点前" + "12点前","18点前","22点前" }; public ObservableCollection PreCompeteTimeHourList { get => preCompeteTimeHourList; set { Set(ref preCompeteTimeHourList, value); } } @@ -394,6 +407,11 @@ namespace BBWY.Client.ViewModels private void CompeteQualityTask(object obj) { + if (FloorDragNumber <= 0) + { + MessageBox.Show($"请选择摆放地拖编号"); + return; + } if (GoodProductQuantity > ArrivalQuantity) { @@ -423,29 +441,36 @@ namespace BBWY.Client.ViewModels SkuId = SkuId, IsNeedBar = IsNeedBarCode == Need.需要, IsNeedCer = IsNeedCertificateModel == Need.需要, - TaskId = TaskId + TaskId = TaskId, + FloorDragNumber = FloorDragNumber }; if (IsNeedBarCode == Need.需要) { - if (BarCodeModel.Id <= 0) + if (BarCodeModel == null || BarCodeModel.Id <= 0) { MessageBox.Show("条形码不能为空"); return; } request.BarcodeId = BarCodeModel.Id; } - if (IsNeedCertificateModel == Need.需要) + if(PurchaseSkuList != null && PurchaseSkuList.Count > 0&&purchaseSkuList.Any(p=> p.IsNeedCer)) //(IsNeedCertificateModel == Need.需要) { - if (PurchaseSkuList == null && PurchaseSkuList.Count <= 0) - { - MessageBox.Show("无可用的合格证打印!"); - return; - } - //if (PurchaseSkuList.Where(p => p.IsSetCertificate).Count() > 0) + //if () //{ - // MessageBox.Show("存在未确认的合格证,请先完成确认!"); + // MessageBox.Show("无可用的合格证打印!"); // return; //} + if (PurchaseSkuList.Where(p => p.IsSetCertificate).Count() > 0) + { + MessageBox.Show("存在未确认的合格证,请先完成确认!"); + return; + } + + if (purchaseSkuList.Any(p => p.IsNeedCer && p.CerDTO == null)) + { + MessageBox.Show("有未设置的合格证,请设置完所有的合格证再保存"); + return; + } if (PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Count() <= 0) { MessageBox.Show("无可选的合格证打印!"); @@ -457,45 +482,111 @@ namespace BBWY.Client.ViewModels int hour = Convert.ToInt32(PreCompeteTimeHour.Replace("点前", "")); - var date = Convert.ToDateTime(PreCompeteTimeDay); - - request.PreCompeteTime = date.AddHours(hour); + DateTime date = DateTime.Now; - var competeRes = packPurchaseTaskService.CompeteQualityTask(request); - if (competeRes == null) + switch (preCompeteTimeDay) { - MessageBox.Show("网络异常"); - return; + case "今天": + date = DateTime.Now; + break; + case "明天": + date = DateTime.Now.AddDays(1); + break; + case "后天": + date = DateTime.Now.AddDays(2); + break; + default: + break; } - if (!competeRes.Success) + + //date = Convert.ToDateTime(PreCompeteTimeDay); + + + var competeTime = date.Date.AddHours(hour); + + + + if (competeTime < DateTime.Now) { - MessageBox.Show(competeRes.Msg); + MessageBox.Show($"预计完成时间不能小于当前时间,请重新选择预计完成时间"); return; } - BatchPrintWindow batchPrint = new BatchPrintWindow(); - batchPrint.SetData(GoodProductQuantity, - PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Select(p => p.CerDTO).ToArray() - , BarCodeModel); - batchPrint.ShowDialog(); - try + var now = DateTime.Now; + if (now.Hour < 12) { + if (competeTime > now.AddDays(1).Date.AddHours(12)) + { + MessageBox.Show($"预计完成时间不能超过明天12点,请重新选择预计完成时间"); + return; + } + } - catch + else if (now.Hour < 18) { - - + if (competeTime > now.AddDays(1).Date.AddHours(18)) + { + MessageBox.Show($"预计完成时间不能超过明天18点,请重新选择预计完成时间"); + return; + } + } + else if (now.Hour < 22) + { + if (competeTime > now.AddDays(1).Date.AddHours(22)) + { + MessageBox.Show($"预计完成时间不能超过明天22点,请重新选择预计完成时间"); + return; + } } + else + { + if (competeTime > now.AddDays(2).Date.AddHours(12)) + { + MessageBox.Show($"预计完成时间不能超过后天12点,请重新选择预计完成时间"); + return; + } + } + + request.PreCompeteTime = competeTime; + + + try + { + var competeRes = packPurchaseTaskService.CompeteQualityTask(request); + if (competeRes == null) + { + MessageBox.Show("网络异常"); + return; + } + if (!competeRes.Success) + { + MessageBox.Show(competeRes.Msg); + return; + } + BatchPrintWindow batchPrint = new BatchPrintWindow(); + batchPrint.SetData(GoodProductQuantity, + PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Select(p => p.CerDTO).ToArray() + , BarCodeModel); + batchPrint.ShowDialog(); + if (ReflashWindow != null) ReflashWindow(); + var window = obj as BWindow; + App.Current.Dispatcher.Invoke(new Action(() => + { + + window.Close(); + })); - if (ReflashWindow != null) ReflashWindow(); - var window = obj as BWindow; + } + catch (Exception ex) + { - window.Close(); + System.Windows.MessageBox.Show(ex.Message); + } } @@ -560,7 +651,7 @@ namespace BBWY.Client.ViewModels model.CerDTO.BrandName = BrandName; QualitySetCerWindow setCerWindow = new QualitySetCerWindow(); - setCerWindow.LoadData(model.IsNeedCer, model.CerDTO, packPurchaseTaskService, spuCertificateModel, IsSetSpuCertificate); + setCerWindow.LoadData(model.IsNeedCer, model.CerDTO, packPurchaseTaskService, spuCertificateModel, IsSetSpuCertificate, saveType); setCerWindow.SaveResult = (s, PackCerState) => { if (string.IsNullOrEmpty(s.PurchaseSkuId)) @@ -601,11 +692,15 @@ namespace BBWY.Client.ViewModels look.Show(); } + + + SaveType? saveType; /// /// 搜索 skuId(todo:) /// public void SearchSku(PackTaskModel model) { + InitData(); TaskId = model.TaskId; OrderId = model.OrderId; @@ -623,6 +718,7 @@ namespace BBWY.Client.ViewModels BasicPack = model.BasicPack; CertificatePosition = model.CertificatePosition; + ArrivalQuantity = 0; GoodProductQuantity = 0; @@ -649,10 +745,30 @@ namespace BBWY.Client.ViewModels var packTaskRes = packPurchaseTaskService.GetQualityTask(model.TaskId); + + if (packTaskRes==null) + { + MessageBox.Show("网络异常!"); + return; + } + if (!packTaskRes.Success || packTaskRes.Data==null) + { + MessageBox.Show(packTaskRes.Msg); + return; + } + + + + SkuPurchaseSchemeId = packTaskRes.Data.SkuPurchaseSchemeId; + saveType = packTaskRes.Data.SaveType; + if (saveType == null) + { + saveType = OrderId.IsNullOrEmpty() ? SaveType.C端 : SaveType.B端; + } if (packTaskRes == null || !packTaskRes.Success) return; BarCodeModel = packTaskRes.Data.BarCodeDTO; IsNeedBarCode = packTaskRes.Data.IsNeedBar ? Need.需要 : Need.不需要; - IsSetBarCode = packTaskRes.Data.IsNeedBar ? false : true; + IsSetBarCode = packTaskRes.Data.BarCodeDTO == null ? true : false; IsNeedCertificateModel = packTaskRes.Data.IsNeedCer ? Need.需要 : Need.不需要; if (packTaskRes.Data.WareHourses != null) packTaskRes.Data.WareHourses.ToList().ForEach(w => @@ -663,9 +779,11 @@ namespace BBWY.Client.ViewModels if (packTaskRes.Data.PurchaseSkus != null) { - + int goodsIndex = 0; foreach (var item in packTaskRes.Data.PurchaseSkus) { + goodsIndex++; + if (item.CerDTO != null) item.CerDTO.GoodsNumberIndex = goodsIndex; item.IsSetCertificate = true; if (string.IsNullOrEmpty(item.PurchaseProductId)) { @@ -677,18 +795,20 @@ namespace BBWY.Client.ViewModels { PurchaseSkuList.Add(item); continue; } + PurchaseSkuItemBasicInfoResponse skuItem = null; + if (list.Data != null) skuItem = list.Data.ItemList.FirstOrDefault(f => f.PurchaseSkuId == item.PurchaseSkuId); + - var skuItem = list.Data.ItemList.FirstOrDefault(f => f.PurchaseSkuId == item.PurchaseSkuId); App.Current.Dispatcher.Invoke(new Action(() => { PurchaseSkuList.Add(new PurchaseSku { - Logo = skuItem.Logo, - Title = skuItem.Title, + Logo = skuItem?.Logo, + Title = skuItem?.Title, IsNeedCer = item.IsNeedCer, PurchaseSkuId = item.PurchaseSkuId, CerDTO = item.CerDTO, - IsSetCertificate = item.IsSetCertificate, + IsSetCertificate = item.IsNeedCer, }); })); //PurchaseSkuList.Add(item); @@ -706,17 +826,62 @@ namespace BBWY.Client.ViewModels public Action ReflashWindow { get; set; } public void InitData() { + FloorDragNumber = 0; PurchaseSkuList = new ObservableCollection(); WareHourseList = new ObservableCollection(); PreCompeteTimeDayList = new ObservableCollection(); + FloorDragNumberList = new ObservableCollection(); + + for (int i = 0; i < 30; i++) + { + App.Current.Dispatcher.Invoke((Action)(() => + { + + FloorDragNumberList.Add(i + 1); + })); + + } + + var nowTime = DateTime.Now; + var hour = nowTime.Hour; + - var date = DateTime.Now.Date; - for (int i = 0; i < 7; i++) + + if (hour < 12) + { + PreCompeteTimeDayList.Add("今天"); + PreCompeteTimeDayList.Add("明天"); + + PreCompeteTimeDay = "今天"; + PreCompeteTimeHour = "12点前"; + + } + else if (hour < 18) + { + PreCompeteTimeDayList.Add("今天"); + PreCompeteTimeDayList.Add("明天"); + PreCompeteTimeDay = "今天"; + PreCompeteTimeHour = "18点前"; + } + else if (hour < 22) { - PreCompeteTimeDayList.Add(date.AddDays(i).ToString("yyyy-MM-dd")); + PreCompeteTimeDayList.Add("今天"); + PreCompeteTimeDayList.Add("明天"); + PreCompeteTimeDay = "今天"; + PreCompeteTimeHour = "22点前"; } + else + { + PreCompeteTimeDayList.Add("今天"); + PreCompeteTimeDayList.Add("明天"); + PreCompeteTimeDayList.Add("后天"); + PreCompeteTimeDay = "明天"; + PreCompeteTimeHour = "12点前"; + } + + + - PreCompeteTimeDay = date.ToString("yyyy-MM-dd"); IsSetBarCode = true; SkuTitle = ""; @@ -724,11 +889,7 @@ namespace BBWY.Client.ViewModels GoodsNumber = 0; PackType = PackType.单件; BasicPack = BasicPack.快递袋; - // Availability = (TaskState.)config.Availability; - //MarkMessage = config.MarkMessage; CertificatePosition = CertificatePosition.无; - // Increment1 = config.Increment1; - IsNeedBarCode = Need.需要; IsNeedCertificateModel = Need.不需要; } diff --git a/BBWY.Client/Views/PackTask/LookCerWindow.xaml b/BBWY.Client/Views/PackTask/LookCerWindow.xaml index d7893ee0..d6d90724 100644 --- a/BBWY.Client/Views/PackTask/LookCerWindow.xaml +++ b/BBWY.Client/Views/PackTask/LookCerWindow.xaml @@ -44,7 +44,7 @@ - + diff --git a/BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs b/BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs index f5ff0e73..4ff41ffe 100644 --- a/BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs @@ -29,11 +29,23 @@ namespace BBWY.Client.Views.PackTask InitializeComponent(); GoodsNumberCerList = new ObservableCollection(); + int goodsNumberIndex = 0; foreach (CertificateModel certificateModel in certificate) + { + if (certificateModel==null) + { + continue; + } + goodsNumberIndex++; + certificateModel.GoodsNumberIndex = goodsNumberIndex; GoodsNumberCerList.Add(new GoodsNumberCer { CertificateModel = certificateModel.Copy(), + + }); + } + this.DataContext = this; } diff --git a/BBWY.Client/Views/PackTask/ServiceWindow.xaml b/BBWY.Client/Views/PackTask/ServiceWindow.xaml index d036a2c1..d288ce9d 100644 --- a/BBWY.Client/Views/PackTask/ServiceWindow.xaml +++ b/BBWY.Client/Views/PackTask/ServiceWindow.xaml @@ -70,19 +70,26 @@ - + - - - + + + + + + + + + + - + - + @@ -415,9 +422,6 @@ - - - @@ -429,6 +433,8 @@ + + diff --git a/BBWY.Client/Views/PackTask/ServiceWindow.xaml.cs b/BBWY.Client/Views/PackTask/ServiceWindow.xaml.cs index b5cfe39c..d2d77cf4 100644 --- a/BBWY.Client/Views/PackTask/ServiceWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/ServiceWindow.xaml.cs @@ -51,8 +51,8 @@ namespace BBWY.Client.Views.PackTask System.Windows.MessageBox.Show("打印机处于错误状态"); return; } - MyPrintHelper.SetDefaultPrint(printName);//设置默认的打印机 - + + MyPrintHelper.SetDefaultPrint(printName);//设置默认打印机 this.printArea.Arrange(new Rect(new Point(0, 0), new Size(printArea.ActualWidth, printArea.ActualHeight))); System.Windows.Controls.PrintDialog printDialog = new PrintDialog(); diff --git a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml index c457c441..4b35a051 100644 --- a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml +++ b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml @@ -60,19 +60,20 @@ + - - - - - - - - - - - - + + + + + + + + + + + + @@ -150,7 +151,7 @@ @@ -356,10 +357,11 @@ + - + @@ -385,7 +387,7 @@ - + - - - - - - - - - - - - + + + + + + + + + + + + + - diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs index 477e0dbd..9ce656c1 100644 --- a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs +++ b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs @@ -35,14 +35,16 @@ namespace BBWY.Client.Views.QualityTask PackCerState = obj; } - public void LoadData(bool isNeedCer, CertificateModel CertificateModel, PackPurchaseTaskService packTaskService, CertificateModel SpuCertificateModel, bool IsSetSpuCertificate) + public void LoadData(bool isNeedCer, CertificateModel CertificateModel, PackPurchaseTaskService packTaskService, CertificateModel SpuCertificateModel, bool IsSetSpuCertificate,SaveType? saveType) { this.CertificateModel = CertificateModel.Copy(); this.packTaskService = packTaskService; PackCerState = isNeedCer ? PackCerState.合格证信息 : PackCerState.无需合格证; + SaveType = saveType; this.DataContext = this; } + public SaveType? SaveType { get; set; } public ICommand SetPackCerStateCommand { get; set; } @@ -123,6 +125,7 @@ namespace BBWY.Client.Views.QualityTask GoodsNumber = CertificateModel.GoodsNumber, ProduceDate = CertificateModel.ProduceDate, PurchaseSkuId = CertificateModel.PurchaseSkuId, + SaveType = SaveType }); if (resData == null || !resData.Success) { diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml b/BBWY.Client/Views/QualityTask/QualityWindow.xaml index eff08d59..13ea3ad1 100644 --- a/BBWY.Client/Views/QualityTask/QualityWindow.xaml +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml @@ -112,7 +112,7 @@ - + @@ -136,7 +136,7 @@ - + @@ -149,7 +149,14 @@ + + + + + + + @@ -257,7 +264,7 @@ - + @@ -377,7 +384,7 @@ - + diff --git a/BBWY.Server.API/Controllers/BatchPurchaseController.cs b/BBWY.Server.API/Controllers/BatchPurchaseController.cs index 276dbfe2..81eb963d 100644 --- a/BBWY.Server.API/Controllers/BatchPurchaseController.cs +++ b/BBWY.Server.API/Controllers/BatchPurchaseController.cs @@ -48,6 +48,28 @@ namespace BBWY.Server.API.Controllers return batchPurchaseBusiness.BatchCreateOrder(request); } + /// + /// 预览订单价格V2 + /// + /// + /// + [HttpPost] + public PreviewOrderResponse PreviewOrderV2([FromBody] BatchPurchasePreviewOrderRequestV2 request) + { + return batchPurchaseBusiness.PreviewOrderV2(request); + } + + /// + /// 批量创建采购单V2 + /// + /// + /// + [HttpPost] + public BatchCreareOrderResponse BatchCreateOrderV2(BatchPurchaseCreateOrderRequestV2 request) + { + return batchPurchaseBusiness.BatchCreateOrderV2(request); + } + /// /// 获取采购单列表 /// diff --git a/BBWY.Server.API/Controllers/PurchaseSchemeController.cs b/BBWY.Server.API/Controllers/PurchaseSchemeController.cs index 404845b1..b154512a 100644 --- a/BBWY.Server.API/Controllers/PurchaseSchemeController.cs +++ b/BBWY.Server.API/Controllers/PurchaseSchemeController.cs @@ -30,7 +30,7 @@ namespace BBWY.Server.API.Controllers } /// - /// 根据产品Id批量查询采购商列表 + /// 批量查询采购方案列表 /// /// /// diff --git a/BBWY.Server.API/Middlewares/ClientVersionValidationMiddleWare.cs b/BBWY.Server.API/Middlewares/ClientVersionValidationMiddleWare.cs index 1d8d4fcd..0ebfc7cd 100644 --- a/BBWY.Server.API/Middlewares/ClientVersionValidationMiddleWare.cs +++ b/BBWY.Server.API/Middlewares/ClientVersionValidationMiddleWare.cs @@ -36,11 +36,11 @@ namespace BBWY.Server.API.Middlewares if (apiRequirement != null) { if (!context.Request.Headers.TryGetValue("ClientVersion", out StringValues clientVersionStr)) - throw new BusinessException("未读取到ClientVersion"); + throw new BusinessException("缺少版本信息,请更新步步为盈"); if (!int.TryParse(clientVersionStr, out int clientVersion)) - throw new BusinessException("非法ClientVersion"); + throw new BusinessException("版本信息不正确,请更新步步为盈"); if (clientVersion < apiRequirement.MinimumVersion) - throw new BusinessException("当前ClientVersion低于接口最低要求,请升级到最新版"); + throw new BusinessException("当前请求需更新步步为盈~!"); } await _next(context); //调用管道执行下一个中间件 } diff --git a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs index 9f5b44e1..3ab3a661 100644 --- a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs +++ b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs @@ -2,7 +2,7 @@ using BBWY.Common.Models; using BBWY.Server.Model; using BBWY.Server.Model.Db; -using BBWY.Server.Model.Db.QK; +using BBWY.Server.Model.Db.Mds; using BBWY.Server.Model.Dto; using FreeSql; using Newtonsoft.Json; @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; -using System.Net.Mail; using System.Text; using System.Threading.Tasks; using Yitter.IdGenerator; @@ -24,17 +23,20 @@ namespace BBWY.Server.Business private IEnumerable platformSDKBusinessList; //private TaskSchedulerManager taskSchedulerManager; private RestApiService restApiService; + private FreeSqlMultiDBManager freeSqlMultiDBManager; public BatchPurchaseBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator, ProductBusiness productBusiness, IEnumerable platformSDKBusinessList, - RestApiService restApiService) : base(fsql, nLogManager, idGenerator) + RestApiService restApiService, + FreeSqlMultiDBManager freeSqlMultiDBManager) : base(fsql, nLogManager, idGenerator) { this.productBusiness = productBusiness; this.platformSDKBusinessList = platformSDKBusinessList; this.restApiService = restApiService; + this.freeSqlMultiDBManager = freeSqlMultiDBManager; } /// @@ -200,6 +202,85 @@ namespace BBWY.Server.Business }; } + /// + /// 预览订单V2 + /// + /// + /// + /// + public PreviewOrderResponse PreviewOrderV2(BatchPurchasePreviewOrderRequestV2 request) + { + + if (request.CargoParamGroupList == null || request.CargoParamGroupList.Count() == 0 || + request.CargoParamGroupList.Any(g => g.CargoParamList == null || g.CargoParamList.Count() == 0 || string.IsNullOrEmpty(g.PurchaserId))) + throw new BusinessException("缺少商品参数"); + if (request.Consignee == null || + string.IsNullOrEmpty(request.Consignee.Address) || + string.IsNullOrEmpty(request.Consignee.Mobile) || + string.IsNullOrEmpty(request.Consignee.ContactName)) + throw new BusinessException("缺少收货人信息"); + if (request.PurchaseAccountList == null || request.PurchaseAccountList.Count() == 0) + throw new BusinessException("缺少采购账号"); + + var extJArray = new List(); + var errorBuilder = new StringBuilder(); + var freightAmount = 0M; + var productAmount = 0M; + var totalAmount = 0M; + + foreach (var purchaseGroup in request.CargoParamGroupList) + { + try + { + var purchaseAccount = request.PurchaseAccountList.FirstOrDefault(pa => pa.PurchasePlatformId == purchaseGroup.PurchasePlatform); + + if (purchaseAccount == null) + throw new BusinessException($"缺少{purchaseGroup.PurchasePlatform}采购平台账号,请在店铺配置中设置"); + + var platformSDKBusiness = platformSDKBusinessList.FirstOrDefault(p => p.Platform == purchaseGroup.PurchasePlatform); + var previewOrderResponse = platformSDKBusiness.PreviewOrder(new PreviewOrderReuqest() + { + AppKey = purchaseAccount.AppKey, + AppSecret = purchaseAccount.AppSecret, + AppToken = purchaseAccount.AppToken, + Consignee = request.Consignee, + Platform = purchaseGroup.PurchasePlatform, + PurchaseOrderMode = request.PurchaseOrderMode, + CargoParamList = purchaseGroup.CargoParamList.Select(p => new CargoParamRequest() + { + ProductId = p.ProductId, + SkuId = p.SkuId, + Quantity = p.Quantity, + SpecId = p.SpecId + }).ToList() + }); + + if (purchaseGroup.PurchasePlatform == Enums.Platform.拳探) + extJArray.Add(new { purchaseGroup.PurchaserId, CardId = previewOrderResponse.Extensions }); + else if (purchaseGroup.PurchasePlatform == Enums.Platform.阿里巴巴) + extJArray.Add(new { purchaseGroup.PurchaserId, OrderTradeTypeCode = previewOrderResponse.OrderTradeType?.Code }); + + freightAmount += previewOrderResponse.FreightAmount; + productAmount += previewOrderResponse.ProductAmount; + totalAmount += previewOrderResponse.TotalAmount; + } + catch (Exception ex) + { + errorBuilder.AppendLine($"采购商:{purchaseGroup.PurchaserName}"); + errorBuilder.AppendLine(ex.Message); + throw new BusinessException(errorBuilder.ToString()); + } + } + + return new PreviewOrderResponse() + { + Extensions = JsonConvert.SerializeObject(extJArray), + FreightAmount = freightAmount, + ProductAmount = productAmount, + TotalAmount = totalAmount + }; + } + /// /// 创建订单 /// @@ -455,6 +536,270 @@ namespace BBWY.Server.Business }; } + /// + /// 创建订单 + /// + /// + public BatchCreareOrderResponse BatchCreateOrderV2(BatchPurchaseCreateOrderRequestV2 request) + { + /* + 下单日志 + */ + var loggerName = $"批量采购-{request.ShopName}"; + nLogManager.GetLogger(loggerName).Info(JsonConvert.SerializeObject(request)); + + if (request.CargoParamGroupList == null || request.CargoParamGroupList.Count() == 0 || + request.CargoParamGroupList.Any(g => g.CargoParamList == null || g.CargoParamList.Count() == 0 || string.IsNullOrEmpty(g.PurchaserId))) + throw new BusinessException("缺少商品参数"); + if (request.Consignee == null || + string.IsNullOrEmpty(request.Consignee.Address) || + string.IsNullOrEmpty(request.Consignee.Mobile) || + string.IsNullOrEmpty(request.Consignee.ContactName)) + throw new BusinessException("缺少收货人信息"); + if (request.PurchaseAccountList == null || request.PurchaseAccountList.Count() == 0) + throw new BusinessException("缺少采购账号"); + + var shop = freeSqlMultiDBManager.MDSfsql.Select().Where(s => s.ShopId == request.ShopId.ToString()).ToOne(); + if (shop == null) + throw new BusinessException("无效的店铺Id"); + var successSkuIdList = new List(); + var failSkuList = new List(); + var qikuPackSkuConfigRequestList = new List(); + + var extJArray = JsonConvert.DeserializeObject(request.Extensions); + + foreach (var purchaseGroup in request.CargoParamGroupList) + { + var belongSkuGroups = purchaseGroup.CargoParamList.GroupBy(p => p.BelongSkuId); + + var belongSkuBasicInfoList = productBusiness.GetProductSkuList(new SearchProductSkuRequest() + { + AppKey = shop.AppKey, + AppSecret = shop.AppSecret, + AppToken = shop.AppToken, + Platform = (Enums.Platform)shop.PlatformId, + Sku = string.Join(",", belongSkuGroups.Select(x => x.Key)), + }); + + try + { + var purchaseAccount = request.PurchaseAccountList.FirstOrDefault(pa => pa.PurchasePlatformId == purchaseGroup.PurchasePlatform); + var platformSDKBusiness = platformSDKBusinessList.FirstOrDefault(p => p.Platform == purchaseGroup.PurchasePlatform); + string tradeMode = "", cardId = ""; + + var extJson = extJArray.FirstOrDefault(j => j.Value("PurchaserId") == purchaseGroup.PurchaserId); + if (purchaseGroup.PurchasePlatform == Enums.Platform.拳探) + cardId = extJson.Value("CardId"); + else if (purchaseGroup.PurchasePlatform == Enums.Platform.阿里巴巴) + tradeMode = extJson.Value("OrderTradeTypeCode"); + + + #region 处理JD SKU和拳探SKU的对应关系 + var belongSkus_mappingList = new List(); + if (purchaseGroup.PurchasePlatform == Enums.Platform.拳探) + { + 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, firstProductParam.SkuId })); + } + } + if (belongSkus_mappingList.Count() == 0) + throw new BusinessException("缺少来源SKU信息"); + } + #endregion + + var createOrderResponse = platformSDKBusinessList.FirstOrDefault(p => p.Platform == purchaseGroup.PurchasePlatform) + .FastCreateOrder(new CreateOnlinePurchaseOrderRequest() + { + AppKey = purchaseAccount.AppKey, + AppSecret = purchaseAccount.AppSecret, + AppToken = purchaseAccount.AppToken, + Platform = purchaseGroup.PurchasePlatform, + Consignee = request.Consignee, + PurchaseOrderMode = request.PurchaseOrderMode, + Remark = purchaseGroup.Remark, + SourceShopName = request.ShopName, + SourceSku = belongSkus_mappingList, + CargoParamList = purchaseGroup.CargoParamList.Select(p => new CargoParamRequest() + { + ProductId = p.ProductId, + SkuId = p.SkuId, + Quantity = p.Quantity, + SpecId = p.SpecId + }).ToList(), + TradeMode = tradeMode, + Extensions = cardId, + AutoPay = request.AutoPay, + + }); + + var purchaseOrderSimpleInfo = platformSDKBusinessList.FirstOrDefault(p => p.Platform == purchaseGroup.PurchasePlatform).GetOrderSimpleInfo(new GetOrderInfoRequest() + { + AppKey = purchaseAccount.AppKey, + AppSecret = purchaseAccount.AppSecret, + AppToken = purchaseAccount.AppToken, + OrderId = createOrderResponse.PurchaseOrderId, + Platform = purchaseGroup.PurchasePlatform + }); + + List updatePurchaseTimeSchemeIdList = purchaseGroup.CargoParamList.Select(p => p.BelongSchemeId).Distinct().ToList(); + List insertPurchaseOrderSkuList = new List(); + + List skuPackConfigList = null; + if (purchaseGroup.PurchasePlatform == Enums.Platform.拳探) + skuPackConfigList = new List(); + + foreach (var belongSkuGroup in belongSkuGroups) + { + var firstProductParam = belongSkuGroup.FirstOrDefault(); + var currentOrderSkuProductAmount = 0M; //采购成本 + currentOrderSkuProductAmount = purchaseOrderSimpleInfo.ItemList.Where(p => belongSkuGroup.Any(p1 => p1.SkuId == p.SkuId)) + ?.Sum(p => p.ProductAmount) ?? 0M; + + var currentOrderSkuFreightAmount = purchaseOrderSimpleInfo.FreightAmount / belongSkuGroups.Count(); //采购运费(按sku数均分) + + var belongSkuBasicInfo = belongSkuBasicInfoList.FirstOrDefault(x=>x.Id == belongSkuGroup.Key); + + var purchaseOrderSku = new PurchaseOrderSku() + { + Id = idGenerator.NewLong(), + ShopId = request.ShopId, + PurchaseOrderId = createOrderResponse.PurchaseOrderId, + ProductId = belongSkuBasicInfo.ProductId, + SkuId = firstProductParam.BelongSkuId, + Price = belongSkuBasicInfo.Price, + SkuTitle = belongSkuBasicInfo.Title, + Logo = belongSkuBasicInfo.Logo, + Quantity = firstProductParam.BelongQuantity, + PurchaseSchemeId = firstProductParam.BelongSchemeId, + PurchaseSkuIds = string.Join(",", belongSkuGroup.Select(p => p.SkuId).ToList()), + PurchaseAmount = currentOrderSkuProductAmount + currentOrderSkuFreightAmount, + ProductAmount = currentOrderSkuProductAmount, + PurchaseFreight = currentOrderSkuFreightAmount, + CreateTime = DateTime.Now + }; + insertPurchaseOrderSkuList.Add(purchaseOrderSku); + + + if (purchaseGroup.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 = skuPackConfig.RemarkMessage, + wareHourses = skuPackConfig.PackSkuSplitConfigList.Select(x => new + { + wareId = x.IsJST ? "qiyuejushuitan" : x.Store.Id, + wareName = x.IsJST ? "齐越聚水潭" : x.Store.Name, + count = x.PackCount, + wareType = x.IsJST ? 3 : GetQiKuWareType(x.Store.Type) + }) + }); + } + } + } + + var purchaseOrderV2 = new PurchaseOrderV2() + { + Id = createOrderResponse.PurchaseOrderId, + ShopId = request.ShopId, + OrderState = createOrderResponse.IsPay ? Enums.PurchaseOrderState.待发货 : Enums.PurchaseOrderState.待付款, + PurchasePlatform = purchaseGroup.PurchasePlatform, + ConsigneeContactName = request.Consignee.ContactName, + ConsigneeMobile = request.Consignee.Mobile, + ConsigneeProvince = request.Consignee.Province, + ConsigneeCity = request.Consignee.City, + ConsigneeCounty = request.Consignee.County, + ConsigneeTown = request.Consignee.Town, + ConsigneeAddress = request.Consignee.Address, + PurchaserId = purchaseGroup.PurchaserId, + PurchaserName = purchaseGroup.PurchaserName, + PurchaseAccountId = purchaseAccount.Id, + PurchaseAmount = purchaseOrderSimpleInfo.TotalAmount, + ProductAmount = purchaseOrderSimpleInfo.ProductAmount, + PurchaseFreight = purchaseOrderSimpleInfo.FreightAmount, + Remark = purchaseGroup.Remark, + CreateTime = DateTime.Now, + PurchaseMethod = Enums.PurchaseMethod.线上采购, + PurchaseOrderMode = request.PurchaseOrderMode + }; + if (createOrderResponse.IsPay) + purchaseOrderV2.PayTime = DateTime.Now; + + fsql.Transaction(() => + { + fsql.Insert(purchaseOrderV2).ExecuteAffrows(); + //fsql.Insert(purchaseOrderSku).ExecuteAffrows(); + fsql.Insert(insertPurchaseOrderSkuList).ExecuteAffrows(); + fsql.Update(updatePurchaseTimeSchemeIdList).Set(p => p.LastPurchaseTime, DateTime.Now).ExecuteAffrows(); + }); + successSkuIdList.AddRange(belongSkuGroups.Select(g => g.Key)); + + if (purchaseGroup.PurchasePlatform == Enums.Platform.拳探) + { + qikuPackSkuConfigRequestList.Add(new + { + orderId = purchaseOrderV2.Id, + //shopId = request.ShopId.ToString(), + shopId = purchaseGroup.PurchaserId, //拳探店铺Id(商家Id) + originShopName = request.ShopName, + userName = purchaseAccount.AccountName, + platform = Enums.Platform.拳探, + purchaseTaskModels = skuPackConfigList + }); + } + } + catch (Exception ex) + { + failSkuList.AddRange(belongSkuGroups.Select(g => new BatchCreareOrderFailDetail() + { + SkuId = g.Key, + ErrorMsg = ex.Message + })); + //throw new BusinessException(errorBuilder.ToString()); + } + } + + if (qikuPackSkuConfigRequestList.Count() > 0) + { + Task.Factory.StartNew(() => + { + foreach (var qikuPackSkuConfigRequest in qikuPackSkuConfigRequestList) + { + try + { + var qikuResponse = restApiService.SendRequest("http://qiku.qiyue666.com/", + "api/PackPurchaseTask/BatchPublicPurchaseTask", + qikuPackSkuConfigRequest, + null, + HttpMethod.Post); + if (qikuResponse.StatusCode != System.Net.HttpStatusCode.OK) + throw new Exception(qikuResponse.Content); + } + catch (Exception ex) + { + nLogManager.GetLogger($"发布打包任务-{request.ShopName}").Error(ex, JsonConvert.SerializeObject(qikuPackSkuConfigRequest)); + } + } + }); + } + + return new BatchCreareOrderResponse() + { + FailSkuList = failSkuList, + SuccessSkuIdList = successSkuIdList + }; + } + private int GetQiKuWareType(Enums.StockType stockType) { if (stockType == Enums.StockType.京仓) diff --git a/BBWY.Server.Business/PurchaseScheme/PurchaseSchemeBusiness.cs b/BBWY.Server.Business/PurchaseScheme/PurchaseSchemeBusiness.cs index 5e30e3d8..c32d3a4e 100644 --- a/BBWY.Server.Business/PurchaseScheme/PurchaseSchemeBusiness.cs +++ b/BBWY.Server.Business/PurchaseScheme/PurchaseSchemeBusiness.cs @@ -147,6 +147,8 @@ namespace BBWY.Server.Business var select = fsql.Select().InnerJoin((ps, p) => ps.PurchaserId == p.Id); if (querySchemeRequest.SchemeId != null && querySchemeRequest.SchemeId != 0) select = select.Where((ps, p) => ps.Id == querySchemeRequest.SchemeId); + else if (querySchemeRequest.SchemeIdList != null && querySchemeRequest.SchemeIdList.Count() > 0) + select = select.Where((ps, p) => querySchemeRequest.SchemeIdList.Contains(ps.Id)); else { select = select.WhereIf(querySchemeRequest.ShopId != null && querySchemeRequest.ShopId != 0, (ps, p) => ps.ShopId == querySchemeRequest.ShopId) diff --git a/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase/BatchPurchasePreviewOrderRequest.cs b/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase/BatchPurchasePreviewOrderRequest.cs index f1b1191e..9898eef3 100644 --- a/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase/BatchPurchasePreviewOrderRequest.cs +++ b/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase/BatchPurchasePreviewOrderRequest.cs @@ -25,7 +25,6 @@ namespace BBWY.Server.Model.Dto public Enums.Platform PurchasePlatform { get; set; } - public string BelongSkuId { get; set; } public string BelongProductId { get; set; } diff --git a/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase2/BatchPurchaseCargoParamRequestV2.cs b/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase2/BatchPurchaseCargoParamRequestV2.cs new file mode 100644 index 00000000..2b1319ad --- /dev/null +++ b/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase2/BatchPurchaseCargoParamRequestV2.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Server.Model.Dto +{ + public class BatchPurchaseCargoParamRequestV2 + { + /// + /// 采购商品Id + /// + public string ProductId { get; set; } + /// + /// 采购SkuId + /// + public string SkuId { get; set; } + + /// + /// 采购SpecId 1688独有 + /// + public string SpecId { get; set; } + + /// + /// 采购SKU数量 + /// + public int Quantity { get; set; } + + + #region BelongInfo + /// + /// 归属SKUId(JD) + /// + public string BelongSkuId { get; set; } + + ///// + ///// 归属商品Id(JD) + ///// + //public string BelongProductId { get; set; } + + ///// + ///// 归属商品价格(JD) + ///// + //public decimal BelongPrice { get; set; } + + ///// + ///// 归属商品标题(JD) + ///// + //public string BelongSkuTitle { get; set; } + + ///// + ///// 归属商品Logo(JD) + ///// + //public string BelongLogo { get; set; } + + /// + /// 归属SKU数量(JD) + /// + public int BelongQuantity { get; set; } + + /// + /// 采购方案Id + /// + public long BelongSchemeId { get; set; } + #endregion + } + + public class BatchPurchaseCargoParamGroupRequestV2 + { + /// + /// 采购商Id + /// + public string PurchaserId { get; set; } + /// + /// 采购商名称 + /// + public string PurchaserName { get; set; } + + public Enums.Platform PurchasePlatform { get; set; } + + /// + /// 下单备注 + /// + public string Remark { get; set; } + + /// + /// 采购商品列表 + /// + public IList CargoParamList { get; set; } + } +} diff --git a/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase2/BatchPurchaseCreateOrderRequestV2.cs b/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase2/BatchPurchaseCreateOrderRequestV2.cs new file mode 100644 index 00000000..e3730fc8 --- /dev/null +++ b/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase2/BatchPurchaseCreateOrderRequestV2.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Server.Model.Dto +{ + public class BatchPurchaseCreateOrderRequestV2 : BatchPurchasePreviewOrderRequestV2 + { + /// + /// 扩展字段 ,格式参考报价接口返回值 + /// + public string Extensions { get; set; } + + public long ShopId { get; set; } + + public string ShopName { get; set; } + + public string AutoPay { get; set; } + + /// + /// 打包设置 + /// + public IList PackSkuConfigList { get; set; } + } +} diff --git a/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase2/BatchPurchasePreviewOrderRequestV2.cs b/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase2/BatchPurchasePreviewOrderRequestV2.cs new file mode 100644 index 00000000..97847a08 --- /dev/null +++ b/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase2/BatchPurchasePreviewOrderRequestV2.cs @@ -0,0 +1,22 @@ +using BBWY.Server.Model.Db; +using System.Collections.Generic; + +namespace BBWY.Server.Model.Dto +{ + public class BatchPurchasePreviewOrderRequestV2 + { + /// + /// 采购账号列表 + /// + public IList PurchaseAccountList { get; set; } + + public Enums.PurchaseOrderMode PurchaseOrderMode { get; set; } + + /// + /// 收货人信息 + /// + public ConsigneeRequest Consignee { get; set; } + + public IList CargoParamGroupList { get; set; } + } +} diff --git a/BBWY.Server.Model/Dto/Request/PurchaseScheme/QuerySchemeRequest.cs b/BBWY.Server.Model/Dto/Request/PurchaseScheme/QuerySchemeRequest.cs index 9b9062a6..0215e0bc 100644 --- a/BBWY.Server.Model/Dto/Request/PurchaseScheme/QuerySchemeRequest.cs +++ b/BBWY.Server.Model/Dto/Request/PurchaseScheme/QuerySchemeRequest.cs @@ -9,6 +9,11 @@ namespace BBWY.Server.Model.Dto /// public long? SchemeId { get; set; } + /// + /// 采购方案Id集合 + /// + public IList SchemeIdList { get; set; } + public long? ShopId { get; set; } public IList SkuIdList { get; set; } diff --git a/BBWY.Server.Model/Enums.cs b/BBWY.Server.Model/Enums.cs index 917b567c..c5ecae56 100644 --- a/BBWY.Server.Model/Enums.cs +++ b/BBWY.Server.Model/Enums.cs @@ -3,7 +3,7 @@ public class Enums { /// - /// 电商平台 + /// 电商平台 淘宝 = 0,京东 = 1,阿里巴巴 = 2, 拼多多 = 3,微信 = 4,拳探 = 10 /// public enum Platform { diff --git a/PJZS/App.xaml.cs b/PJZS/App.xaml.cs index bd92d274..473a4c82 100644 --- a/PJZS/App.xaml.cs +++ b/PJZS/App.xaml.cs @@ -1,17 +1,16 @@ -using BBWY.Common.Http; +using BBWY.Common.Extensions; +using BBWY.Common.Http; using BBWY.Common.Models; -using BBWY.Common.Extensions; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using PJZS.Models; using System; +using System.Diagnostics; using System.IO; +using System.Linq; using System.Reflection; using System.Threading.Tasks; using System.Windows; -using PJZS.Models; -using System.Linq; -using System.IO.MemoryMappedFiles; -using System.Diagnostics; using Utils; namespace PJZS