diff --git a/BBWY.Client/APIServices/LogisticsService.cs b/BBWY.Client/APIServices/LogisticsService.cs index fc6e67ff..86fc40a6 100644 --- a/BBWY.Client/APIServices/LogisticsService.cs +++ b/BBWY.Client/APIServices/LogisticsService.cs @@ -21,6 +21,10 @@ namespace BBWY.Client.APIServices }, null, HttpMethod.Post); } + /// + /// 获取仓库列表 + /// + /// public ApiResponse> GetStoreList() { return SendRequest>(globalContext.BBYWApiHost, "api/vender/GetStoreHouseList", new diff --git a/BBWY.Client/APIServices/SealBoxService.cs b/BBWY.Client/APIServices/SealBoxService.cs new file mode 100644 index 00000000..d5a263c6 --- /dev/null +++ b/BBWY.Client/APIServices/SealBoxService.cs @@ -0,0 +1,141 @@ +using BBWY.Client.Models.APIModel; +using BBWY.Client.Models.APIModel.Response.PackTask; +using BBWY.Client.Views.PackTask; +using BBWY.Common.Http; +using BBWY.Common.Models; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; + +namespace BBWY.Client.APIServices +{ + public class SealBoxService : BaseApiService, IDenpendency + { + public SealBoxService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) + { + } + + + public ApiResponse GetSealBoxWaitConfigureList(string SkuId, string TaskId, int? PageSize = 10, int? PageIndex = 1, string SpuId = null) + { + return SendRequest(globalContext.QKApiHost, $"api/SealBox/GetSealBoxWaitConfigureList", + new + { + ShopId = globalContext.User.Shop.ShopId.ToString(), + TaskId = TaskId, + SkuId = SkuId, + SpuId, + PageSize, + PageIndex, + } + , null, HttpMethod.Post); + } + + + public ApiResponse GetSealBoxPackStateCount() + { + return SendRequest(globalContext.QKApiHost, $"api/SealBox/GetSealBoxPackStateCount", + new + { + ShopId = globalContext.User.Shop.ShopId.ToString(), + } + , null, HttpMethod.Post); + } + + public ApiResponse SetSealBoxConfigured(SetSealBoxConfiguredRequest setSealBoxConfiguredRequest) + { + return SendRequest(globalContext.QKApiHost, $"api/SealBox/SetSealBoxConfigured", + setSealBoxConfiguredRequest + , null, HttpMethod.Post); + } + + public ApiResponse GetSealBoxConfiguredList(string SkuId, string TaskId, string shopId, int? PageSize = 10, int? PageIndex = 1, string SpuId = null) + { + return SendRequest(globalContext.QKApiHost, $"api/SealBox/GetSealBoxConfiguredList", + new + { + ShopId = shopId, + TaskId = TaskId, + SkuId = SkuId, + SpuId, + PageSize, + PageIndex, + } + , null, HttpMethod.Post); + } + + + public ApiResponse GetUpdateSealBoxConfigured(long SealBoxId, long[] TaskIds) + { + return SendRequest(globalContext.QKApiHost, $"api/SealBox/GetUpdateSealBoxConfigured", + new + { + SealBoxId, + TaskIds + } + , null, HttpMethod.Post); + } + + + public ApiResponse BatchUpdateSealBoxConfigured(BatchUpdateSealBoxConfiguredRequest batchUpdateSealBoxConfiguredRequest) + { + return SendRequest(globalContext.QKApiHost, $"api/SealBox/BatchUpdateSealBoxConfigured", + batchUpdateSealBoxConfiguredRequest + , null, HttpMethod.Post); + } + + public ApiResponse GetWareSealBoxList(string ShopName, long? TaskId, string SkuId, int? PageIndex, int? PageSize) + { + return SendRequest(globalContext.QKApiHost, $"api/SealBox/GetWareSealBoxList", + new + { + ShopName, + TaskId, + SkuId, + PageIndex, + PageSize + } + , null, HttpMethod.Post); + } + + + + public ApiResponse WareCompeteSealBox(long SealBoxId, int? BoxCount) + { + return SendRequest(globalContext.QKApiHost, $"api/SealBox/WareCompeteSealBox", + new + { + SealBoxId, + BoxCount + } + , null, HttpMethod.Post); + } + /// + /// 获取待落仓列表 + /// + /// + /// + /// + /// + /// + /// + public ApiResponse SearchWaitFallWareList(string ShopName = null, long? TaskId = null, string SkuId = null, int PageIndex = 1 + , int PageSize = 10) + { + return SendRequest(globalContext.QKApiHost, $"api/SealBox/SearchWaitFallWareList", + new + { + ShopName, + TaskId, + SkuId, + PageIndex, + PageSize + } + , null, HttpMethod.Post); + } + + + + } +} diff --git a/BBWY.Client/App.xaml.cs b/BBWY.Client/App.xaml.cs index 88b79fe5..e111aba8 100644 --- a/BBWY.Client/App.xaml.cs +++ b/BBWY.Client/App.xaml.cs @@ -1,6 +1,7 @@ using BBWY.Client.Models; using BBWY.Client.ViewModels; using BBWY.Client.ViewModels.PackTask; +using BBWY.Client.ViewModels.SealBox; using BBWY.Common.Extensions; using BBWY.Common.Http; using BBWY.Common.Models; @@ -122,7 +123,8 @@ namespace BBWY.Client serviceCollection.AddTransient(); serviceCollection.AddTransient(); serviceCollection.AddTransient(); - + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); //serviceCollection.AddScoped(); #region 注册拳探SDK相关类 diff --git a/BBWY.Client/Helpers/MyPrintHelper.cs b/BBWY.Client/Helpers/MyPrintHelper.cs index 4d2cb7a1..7058d3c0 100644 --- a/BBWY.Client/Helpers/MyPrintHelper.cs +++ b/BBWY.Client/Helpers/MyPrintHelper.cs @@ -696,10 +696,10 @@ namespace BBWY.Client.Helpers //{ // title = title.Substring(0,5); //} - totalCount += sealBoxModel.SealBoxSkus[i].SkuCount; + totalCount += sealBoxModel.SealBoxSkus[i].WareHourseSkuCount; sheet2.GetRow(i + 6).GetCell(1).SetCellValue($"名称:{title}"); sheet2.GetRow(i + 6).GetCell(2).SetCellValue($"SKU:{sealBoxModel.SealBoxSkus[i].SkuId}"); - sheet2.GetRow(i + 6).GetCell(3).SetCellValue($"数量:{sealBoxModel.SealBoxSkus[i].SkuCount}"); + sheet2.GetRow(i + 6).GetCell(3).SetCellValue($"数量:{sealBoxModel.SealBoxSkus[i].WareHourseSkuCount}"); } sheet2.GetRow(25).GetCell(1).SetCellValue(totalCount); diff --git a/BBWY.Client/Models/APIModel/Request/BatchUpdateSealBoxConfiguredRequest.cs b/BBWY.Client/Models/APIModel/Request/BatchUpdateSealBoxConfiguredRequest.cs new file mode 100644 index 00000000..642e94b4 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Request/BatchUpdateSealBoxConfiguredRequest.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + public class BatchUpdateSealBoxConfiguredRequest + { + /// + /// 判断当前的封箱任务是否 是带封箱状态 + /// + public long SealBoxId { get; set; } + + public string ShopId { get; set; } + + public IList UpdateSealBoxConfiguredDatas { get; set; } + + } + public class UpdateSealBoxConfiguredDataRequest + { + public long TaskId { get; set; } + + /// + /// sku总量任务量 + /// + public int SkuCount { get; set; } + + public IList SealBoxConfiguredWareHourseRequests { get; set; } + } + + public class SealBoxConfiguredWareHourseRequest : WareHourseData + { + /// + ///待封箱 = 0, 待落仓 = 1, 待完结 = 2 + /// + public PositionState? WareState { get; set; } + } + +} \ No newline at end of file diff --git a/BBWY.Client/Models/APIModel/Request/SetSealBoxConfiguredRequest.cs b/BBWY.Client/Models/APIModel/Request/SetSealBoxConfiguredRequest.cs new file mode 100644 index 00000000..5c9882e9 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Request/SetSealBoxConfiguredRequest.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + public class SetSealBoxConfiguredRequest + { + /// + /// 店铺id + /// + public string ShopId { get; set; } + + public IList SetSealBoxConfiguredDatas { get; set; } + + } + + + public class SetSealBoxConfiguredData + { + /// + /// 任务Id + /// + public long TaskId { get; set; } + + /// + /// sku + /// + public string SkuId { get; set; } + + /// + /// sku总量任务量(校对) + /// + public int TotalCount { get; set; } + /// + /// 仓库去向 + /// + public IList WareHourseDatas { get; set; } + + } + public class WareHourseData + { + /// + /// 仓库id + /// + public string WareId { get; set; } + /// + /// 仓库名称 + /// + public string WareName { get; set; } + /// + /// 数量 + /// + public int Count { get; set; } + /// + /// 入仓类型 (京仓=0 云仓=1,商家仓=2,聚水潭=3) + /// + public WareType WareType { get; set; } + + } +} diff --git a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxResponse.cs b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxResponse.cs new file mode 100644 index 00000000..df433a54 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxResponse.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + public class GetWareSealBoxResponse + { + /// + /// 数量 + /// + public int TotalCount { get; set; } + + /// + /// 分箱列表 + /// + public List WaitSealBoxModels { get; set; } + } + + public class WareSealBoxData + { + public long SealBoxId { get; set; } + /// + /// 店铺Id + /// + public string ShopId { get; set; } + /// + /// 仓库Id(同一个店铺 唯一) + /// + public string WareId { get; set; } + /// + /// 店铺名称 + /// + public string ShopName { get; set; } + /// + /// 仓库名 + /// + public string WareName { get; set; } + + /// + /// 团队名称 + /// + public string DepartmentName { get; set; } + + /// + /// 对接人(同团队下) + /// + public List AcceptUserNames { get; set; } + + /// + /// 封箱sku列表 + /// + public List SealBoxSkus { get; set; } + + } + + public class WareSealBoxSku + { + /// + /// 任务Id + /// + public long TaskId { get; set; } + /// + /// 图片链接 + /// + public string Logo { get; set; } + /// + /// skuid + /// + public string SkuId { get; set; } + /// + /// sku标题 + /// + public string SkuTitle { get; set; } + /// + /// 品名 + /// + public string BrandName { get; set; } + /// + /// 货号 + /// + public string ProductNo { get; set; } + /// + /// (分箱的仓库的sku产品数量) + /// + public int WareHourseSkuCount { get; set; } + } +} diff --git a/BBWY.Client/Models/APIModel/Response/SealBox/SealBoxConfiguredResponse.cs b/BBWY.Client/Models/APIModel/Response/SealBox/SealBoxConfiguredResponse.cs new file mode 100644 index 00000000..34801c7d --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/SealBox/SealBoxConfiguredResponse.cs @@ -0,0 +1,17 @@ +using BBWY.Client.Models.SealBox; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + public class SealBoxConfiguredResponse + { + public int TotalCount { get; set; } + + public IList SealBoxConfiguredModels { get; set; } + } + + + +} diff --git a/BBWY.Client/Models/APIModel/Response/SealBox/SealBoxPackStateCountResponse.cs b/BBWY.Client/Models/APIModel/Response/SealBox/SealBoxPackStateCountResponse.cs new file mode 100644 index 00000000..6ff5c867 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/SealBox/SealBoxPackStateCountResponse.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + public class SealBoxPackStateCountResponse + { + /// + /// 封箱 待配置数 + /// + public int SealBoxWaitConfigureCount { get; set; } + /// + ///封箱 已配置数 + /// + public int SealBoxConfiguredCount { get; set; } + } +} diff --git a/BBWY.Client/Models/APIModel/Response/SealBox/SealBoxWaitConfigureResponse.cs b/BBWY.Client/Models/APIModel/Response/SealBox/SealBoxWaitConfigureResponse.cs new file mode 100644 index 00000000..f89ee0b2 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/SealBox/SealBoxWaitConfigureResponse.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + public class SealBoxWaitConfigureResponse + { + public int TotalCount { get; set; } + + public IList SealBoxWaitConfigureModels { get; set; } + + } + + +} diff --git a/BBWY.Client/Models/APIModel/Response/SealBox/UpdateSealBoxConfiguredResponse.cs b/BBWY.Client/Models/APIModel/Response/SealBox/UpdateSealBoxConfiguredResponse.cs new file mode 100644 index 00000000..7c3c1e05 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/SealBox/UpdateSealBoxConfiguredResponse.cs @@ -0,0 +1,12 @@ +using BBWY.Client.Models.SealBox; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + public class UpdateSealBoxConfiguredResponse + { + public IList UpdateSealBoxConfiguredTaskDatas { get; set; } + } +} diff --git a/BBWY.Client/Models/Enums.cs b/BBWY.Client/Models/Enums.cs index 10791c88..c42da767 100644 --- a/BBWY.Client/Models/Enums.cs +++ b/BBWY.Client/Models/Enums.cs @@ -484,4 +484,13 @@ { 待封箱, 待落仓, 待完结 } + + /// + /// 封箱配置状态 + /// + public enum SealBoxConfigureType + { + 已配置=0, + 待配置=1 + } } diff --git a/BBWY.Client/Models/PackTask/PackTaskModel.cs b/BBWY.Client/Models/PackTask/PackTaskModel.cs index 96ed9782..f42edc2a 100644 --- a/BBWY.Client/Models/PackTask/PackTaskModel.cs +++ b/BBWY.Client/Models/PackTask/PackTaskModel.cs @@ -54,20 +54,15 @@ namespace BBWY.Client.Models private void UpdateTask() { - ViewModelLocator viewModel = new ViewModelLocator(); - var publicTaskViewModel = viewModel.PublishTask; - - if (publicTaskViewModel.ReflashWindow == null) - publicTaskViewModel.ReflashWindow = ReflashTask; - + if (!this.OrderId.IsNullOrEmpty()) { System.Windows.MessageBox.Show("暂不支持修改采购组的任务"); return; } - publicTaskViewModel.InitData(this); - PublishTaskWindow publish = new PublishTaskWindow(); + + PublishTaskWindow publish = new PublishTaskWindow(ReflashTask, this); publish.Show(); //CreatePackTask create = new CreatePackTask(); diff --git a/BBWY.Client/Models/PackTask/SealBoxModel.cs b/BBWY.Client/Models/PackTask/SealBoxModel.cs index 248d85e5..d9afe1e1 100644 --- a/BBWY.Client/Models/PackTask/SealBoxModel.cs +++ b/BBWY.Client/Models/PackTask/SealBoxModel.cs @@ -7,7 +7,10 @@ namespace BBWY.Client.Models.PackTask { public class SealBoxModel { - + /// + /// /封箱id + /// + public long SealBoxId { get; set; } /// /// 店铺Id /// @@ -38,7 +41,7 @@ namespace BBWY.Client.Models.PackTask /// /// 封箱sku列表 /// - public List SealBoxSkus { get; set; } + public List SealBoxSkus { get; set; } /// diff --git a/BBWY.Client/Models/SealBox/SealBoxConfigureModel.cs b/BBWY.Client/Models/SealBox/SealBoxConfigureModel.cs new file mode 100644 index 00000000..eb384976 --- /dev/null +++ b/BBWY.Client/Models/SealBox/SealBoxConfigureModel.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; + +namespace BBWY.Client.Models.SealBox +{ + public class SealBoxConfigureModel : NotifyObject + { + + + /// + /// skuid + /// + public string SkuId { get; set; } + /// + /// 任务id + /// + public long TaskId { get; set; } + /// + /// sku任务数 + /// + public int SkuCount { get; set; } + + /// + /// sku图片 + /// + public string Logo { get; set; } + + private int splitCount; + /// + /// 份数 + /// + public int SplitCount { get=>splitCount; set {Set(ref splitCount,value); } } + + private ObservableCollection wareHourseDatas = new ObservableCollection(); + /// + /// 装箱配置列表 + /// + public ObservableCollection WareHourseDatas { get => wareHourseDatas; set { Set(ref wareHourseDatas, value); } } + + } + /// + /// 封箱配置 装箱配置 + /// + public class SealBoxConfigureWareHourseModel : NotifyObject + { + private int index; + + public int Index { get => index; set { Set(ref index, value); } } + + private int count; + + public int Count { get=>count; set {Set(ref count,value); } } + + private string wareId; + + public string WareId { get => wareId; set { Set(ref wareId, value); } } + + + private string wareName; + + public string WareName { get => wareName; set { Set(ref wareName, value); } } + + + private WareType? wareType; + + public WareType? WareType { get => wareType; set { Set(ref wareType, value); } } + + /// + ///待封箱 = 0, 待落仓 = 1, 待完结 = 2 + /// + public PositionState? WareState { get; set; } + + + + } +} diff --git a/BBWY.Client/Models/SealBox/SealBoxConfiguredModel.cs b/BBWY.Client/Models/SealBox/SealBoxConfiguredModel.cs new file mode 100644 index 00000000..64acda27 --- /dev/null +++ b/BBWY.Client/Models/SealBox/SealBoxConfiguredModel.cs @@ -0,0 +1,62 @@ +using BBWY.Client.Models.APIModel; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; + +namespace BBWY.Client.Models.SealBox +{ + public class SealBoxConfiguredModel:NotifyObject + { + /// + /// 封箱id + /// + public long SealBoxId { get; set; } + + /// + /// 箱子总数量 + /// + public int SealBoxTotalCount { get; set; } + + /// + /// 仓库名称 + /// + public string WareName { get; set; } + + /// + /// 仓库任务列表 + /// + public ObservableCollection SealBoxConfigureTasks { get; set; } + } + public class SealBoxConfigureTask:NotifyObject + { + /// + /// skuid + /// + public string SkuId { get; set; } + /// + /// 任务id + /// + public long TaskId { get; set; } + /// + /// 仓库sku任务数 + /// + public int WareHourseCount { get; set; } + /// + /// sku名称 + /// + public string SkuName { get; set; } + /// + /// sku图片 + /// + public string Logo { get; set; } + ///// + ///// 预计完成时间 + ///// + //public DateTime? PreCompletedTime { get; set; } + ///// + ///// 任务状态 + ///// + //public TaskState? TaskState { get; set; } + } +} diff --git a/BBWY.Client/Models/SealBox/SealBoxWaitConfigureModel.cs b/BBWY.Client/Models/SealBox/SealBoxWaitConfigureModel.cs new file mode 100644 index 00000000..22bd2083 --- /dev/null +++ b/BBWY.Client/Models/SealBox/SealBoxWaitConfigureModel.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models +{ + public class SealBoxWaitConfigureModel : NotifyObject + { + /// + /// skuid + /// + public string SkuId { get; set; } + /// + /// 任务id + /// + public long TaskId { get; set; } + /// + /// sku任务数 + /// + public int SkuCount { get; set; } + /// + /// sku名称 + /// + public string SkuName { get; set; } + /// + /// sku图片 + /// + public string Logo { get; set; } + /// + /// 预计完成时间 + /// + public DateTime? PreCompletedTime { get; set; } + /// + /// 任务状态 + /// + public TaskState? TaskState { get; set; } + + } +} diff --git a/BBWY.Client/Models/SealBox/UpdateSealBoxConfiguredTaskModel.cs b/BBWY.Client/Models/SealBox/UpdateSealBoxConfiguredTaskModel.cs new file mode 100644 index 00000000..bc56a9ab --- /dev/null +++ b/BBWY.Client/Models/SealBox/UpdateSealBoxConfiguredTaskModel.cs @@ -0,0 +1,43 @@ +using BBWY.Client.Models.APIModel; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; + +namespace BBWY.Client.Models.SealBox +{ + public class UpdateSealBoxConfiguredTaskModel:NotifyObject + { + public string Logo { get; set; } + + public string SkuId { get; set; } + + public long TaskId { get; set; } + /// + /// 采购数量 + /// + public int SkuCount { get; set; } + public string SkuName { get; set; } + + private int taskWareCount; + /// + /// 份数 + /// + public int TaskWareCount { get => taskWareCount; set { Set(ref taskWareCount, value); } } + + + + private ObservableCollection wareHourseDatas; + + public ObservableCollection WareHourseDatas { get => wareHourseDatas; set { Set(ref wareHourseDatas, value); } } + } + public class UpdateSealBoxWareHourseModel:WareHourseData + { + + + /// + ///待封箱 = 0, 待落仓 = 1, 待完结 = 2 + /// + public PositionState? WareState { get; set; } + } +} diff --git a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs index eae1740d..8f26bbbb 100644 --- a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs @@ -19,7 +19,7 @@ using System.Windows.Input; namespace BBWY.Client.ViewModels.PackTask { - public class PublishTaskViewModel : BaseVM, IDenpendency + public class PublishTaskViewModel : BaseVM { #region 属性 diff --git a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs index 98c12fa2..aec0236a 100644 --- a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs @@ -23,6 +23,10 @@ using Newtonsoft.Json; using BBWY.Client.Models.APIModel.Response.PackTask; using BBWY.Client.Models.PackTask; using WebSocketSharp; +using BBWY.Client.Models.APIModel; +using BBWY.Client.Views.SealBox; +using BBWY.Client.Models.SealBox; +using BBWY.Client.ViewModels.SealBox; namespace BBWY.Client.ViewModels.PackTask { @@ -36,25 +40,36 @@ namespace BBWY.Client.ViewModels.PackTask #region 属性绑定 + private string sealBoxWaitConfigureCount; + /// + /// 封箱 待配置数 + /// + public string SealBoxWaitConfigureCount { get => sealBoxWaitConfigureCount; set { Set(ref sealBoxWaitConfigureCount, value); } } - //private SealBoxConfigureType sealBoxConfigureType; - ///// - ///// 封箱配置状态 - ///// - //public SealBoxConfigureType SealBoxConfigureType { get; set; } + private string sealBoxConfiguredCount; + /// + ///封箱 已配置数 + /// + public string SealBoxConfiguredCount { get => sealBoxConfiguredCount; set { Set(ref sealBoxConfiguredCount, value); } } + + private SealBoxConfigureType sealBoxConfigureType; + /// + /// 封箱配置状态 + /// + public SealBoxConfigureType SealBoxConfigureType { get => sealBoxConfigureType; set { Set(ref sealBoxConfigureType, value); } } - //private ObservableCollection sealBoxWaitConfigureList; - ///// - ///// 封箱待配置列表 - ///// - //public ObservableCollection SealBoxWaitConfigureList { get => sealBoxWaitConfigureList; set { Set(ref sealBoxWaitConfigureList, value); } } + private ObservableCollection sealBoxWaitConfigureList; + /// + /// 封箱待配置列表 + /// + public ObservableCollection SealBoxWaitConfigureList { get => sealBoxWaitConfigureList; set { Set(ref sealBoxWaitConfigureList, value); } } - //private ObservableCollection sealBoxConfiguredList; - ///// - ///// 封箱已配置列表 - ///// - //public ObservableCollection SealBoxConfiguredList { get => sealBoxConfiguredList; set { Set(ref sealBoxConfiguredList, value); } } + private ObservableCollection sealBoxConfiguredList; + /// + /// 封箱已配置列表 + /// + public ObservableCollection SealBoxConfiguredList { get => sealBoxConfiguredList; set { Set(ref sealBoxConfiguredList, value); } } /// /// 查询时间段 @@ -160,7 +175,7 @@ namespace BBWY.Client.ViewModels.PackTask - + private readonly SealBoxService sealBoxService; private readonly PackTaskService packTaskService; WorkProcessService workProcessService; public int? taskStatus { get; set; } @@ -175,7 +190,7 @@ namespace BBWY.Client.ViewModels.PackTask - public TaskListViewModel(PackTaskService packTaskService, GlobalContext globalContext, ProductService productService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateServiceService) + public TaskListViewModel(PackTaskService packTaskService, GlobalContext globalContext, ProductService productService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateServiceService, SealBoxService sealBoxService) { this.globalContext = globalContext; this.productService = productService; @@ -186,6 +201,14 @@ namespace BBWY.Client.ViewModels.PackTask PackTaskList = new ObservableCollection();//初始化数据 SetTaskStateCommand = new RelayCommand(SetTaskState); + + SetSealBoxConfigureTypeCommand = new RelayCommand(s => + { + PageIndex = 1; + SealBoxConfigureType = s; + Task.Factory.StartNew(() => SearchTaskList()); + }); + CreateTaskCommand = new RelayCommand(CreateTask); SearchTaskCommand = new RelayCommand(() => { @@ -200,35 +223,91 @@ namespace BBWY.Client.ViewModels.PackTask OpenSkuDetailCommand = new RelayCommand(OpenSkuDetail); DeletedTaskCommand = new RelayCommand(DeletedTask); + ConfiguredSealBoxCommand = new RelayCommand(ConfiguredSealBox); + UpdateSealBoxConfiguredCommand = new RelayCommand(UpdateSealBoxConfigured); + StartTime = DateTime.Now.Date; EndTime = DateTime.Now.Date; IsLoading = false; //加载数据 SetTaskState(null); + this.sealBoxService = sealBoxService; + SealBoxConfigureType = SealBoxConfigureType.已配置; } - - private void DeletedTask(object obj) + private void UpdateSealBoxConfigured(SealBoxConfiguredModel model) { - var packTaskmodel = (PackTaskModel)obj; - if (!packTaskmodel.OrderId.IsNullOrEmpty()) + var sealBoxId = model.SealBoxId; + var taskIds = model.SealBoxConfigureTasks.Select(s => s.TaskId).ToArray(); + + var updateSealBoxConfig = sealBoxService.GetUpdateSealBoxConfigured(sealBoxId, taskIds); + if (updateSealBoxConfig == null) { - System.Windows.MessageBox.Show("暂不支持删除采购组的任务"); + MessageBox.Show("网络异常,获取不到带封箱数据"); + return; + } + if (!updateSealBoxConfig.Success || updateSealBoxConfig.Data == null) + { + MessageBox.Show(updateSealBoxConfig.Msg); return; } - MessageBoxResult result = MessageBox.Show("确定取消任务?", "提示", - MessageBoxButton.YesNo, - MessageBoxImage.Warning); - - + SealBoxConfigureWindow sealBoxConfigureWindow = new SealBoxConfigureWindow(updateSealBoxConfig.Data.UpdateSealBoxConfiguredTaskDatas, ReflashTask, sealBoxId); + sealBoxConfigureWindow.Show(); + } + private void ConfiguredSealBox() + { + var waitSealBoxRes = sealBoxService.GetSealBoxWaitConfigureList(null, null, null, null, null);//获取所有待封装列表 + if (waitSealBoxRes == null) + { + MessageBox.Show("网络异常,获取不到带封箱数据"); + return; + } + if (!waitSealBoxRes.Success || waitSealBoxRes.Data == null) + { + MessageBox.Show(waitSealBoxRes.Msg); + return; + } + if (waitSealBoxRes.Data.TotalCount <= 0) + { + MessageBox.Show("已全部封箱!"); + return; + } + var taskIds = waitSealBoxRes.Data.SealBoxWaitConfigureModels.Select(w => w.TaskId).ToArray(); + var updateSealBoxConfig = sealBoxService.GetUpdateSealBoxConfigured(0, taskIds); + if (updateSealBoxConfig == null) + { + MessageBox.Show("网络异常,获取不到带封箱数据"); + return; + } + if (!updateSealBoxConfig.Success || updateSealBoxConfig.Data == null) + { + MessageBox.Show(updateSealBoxConfig.Msg); + return; + } + SealBoxConfigureWindow sealBoxConfigureWindow = new SealBoxConfigureWindow(updateSealBoxConfig.Data.UpdateSealBoxConfiguredTaskDatas, ReflashTask, 0); + sealBoxConfigureWindow.Show(); + + } + + private void DeletedTask(object obj) + { + var packTaskmodel = (PackTaskModel)obj; + if (!packTaskmodel.OrderId.IsNullOrEmpty()) + { + System.Windows.MessageBox.Show($"暂不支持删除采购组的任务,如要删除,请到采购列表取消订单:{packTaskmodel.OrderId}"); + return; + } + MessageBoxResult result = MessageBox.Show("确定取消任务?", "提示", + MessageBoxButton.YesNo, + MessageBoxImage.Warning); if (result != MessageBoxResult.Yes) return; packTaskService.DeletedTask(packTaskmodel.TaskId); Task.Factory.StartNew(() => SearchTaskList()); @@ -265,6 +344,20 @@ namespace BBWY.Client.ViewModels.PackTask #region 事件绑定 + + /// + /// 修改封箱数据 + /// + public ICommand UpdateSealBoxConfiguredCommand { get; set; } + /// + /// 配置封箱策略 + /// + public ICommand ConfiguredSealBoxCommand { get; set; } + /// + /// 待配置 /已配置 + /// + public ICommand SetSealBoxConfigureTypeCommand { get; set; } + /// /// 筛选数据 /// @@ -312,7 +405,9 @@ namespace BBWY.Client.ViewModels.PackTask SearchTaskList(); } - + private List waitSealBoxTaskStates = new List { + Models.TaskState.待落仓, Models.TaskState.待封箱 + };//配置封箱的任务状态范围 /// /// 搜索任务列表 /// @@ -331,108 +426,187 @@ namespace BBWY.Client.ViewModels.PackTask } IsLoading = true; - Task.Factory.StartNew(() => - { - try + if (TaskState == null || !waitSealBoxTaskStates.Contains(TaskState.Value)) + Task.Factory.StartNew(() => { - PackTaskList = new ObservableCollection();//初始化数据 - var datas = packTaskService.GetTaskList(SearchSkuId, SearchTaskId, StartTime, EndTime, (this.TaskState), - PageIndex, PageSize); - if (datas != null && datas.Data != null && datas.Success) + + try { - var dataModel = datas.Data; - OrderCount = dataModel.TotalCount; - foreach (var item in dataModel.Items) + PackTaskList = new ObservableCollection();//初始化数据 + var datas = packTaskService.GetTaskList(SearchSkuId, SearchTaskId, StartTime, EndTime, (this.TaskState), + PageIndex, PageSize); + if (datas != null && datas.Data != null && datas.Success) { - - var data = new PackTaskModel() + var dataModel = datas.Data; + OrderCount = dataModel.TotalCount; + foreach (var item in dataModel.Items) { - Brand = item.Brand, - SkuId = item.SkuId, - AcceptName = item.UserName, - Availability = (Availability)item.Availability, - BasicPack = (BasicPack)item.BasicPack, - DepartmentName = item.DepartmentName, - CertificatePosition = (CertificatePosition)item.CertificatePosition, - GoodsNumber = item.GoodsNumber, - Increment1 = item.Increment1, - ItemList = new List() { new SkuMessage + + var data = new PackTaskModel() + { + Brand = item.Brand, + SkuId = item.SkuId, + AcceptName = item.UserName, + Availability = (Availability)item.Availability, + BasicPack = (BasicPack)item.BasicPack, + DepartmentName = item.DepartmentName, + CertificatePosition = (CertificatePosition)item.CertificatePosition, + GoodsNumber = item.GoodsNumber, + Increment1 = item.Increment1, + ItemList = new List() { new SkuMessage { BrandName = item.BrandName, GoodsNo = item.ProductItemNum, Logo= item.Logo, ShopName = item.ShopName, SkuName = item.SkuName, Id = item.SkuId } }, - MarkMessage = item.MarkMessage, - PackType = (PackType)item.PackType, - - PositionType = item.PositionType, - SkuCount = item.SkuCount, - SkuTitle = item.SkuGoodsTitle, - TaskId = item.TaskId, - - EndTime = item.CreateTime, - BrandName = item.BrandName, - OrderId = item.OrderId, - TaskState = item.TaskState, - - // IsWorry = (Worry)item.IsWorry, - }; - if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) - { - data.BarCodeModel = item.BarCodeDTO; - } - if (item.Cers != null) - { - data.CertificateModel = item.Cers; - } - if (item.FeesItemResponse != null) - { - data.FeesItemResponse = item.FeesItemResponse; - data.FeesMoney = item.FeesItemResponse.SingleFees; - data.IsShowFees = data.FeesMoney > 0 ? true : false; - data.FeesItemResponse.DiscountSingleFees = item.FeesItemResponse.SingleFees * item.FeesItemResponse.disCount; - data.FeesItemResponse.DiscountAllFees = item.FeesItemResponse.AllFees * item.FeesItemResponse.disCount; + MarkMessage = item.MarkMessage, + PackType = (PackType)item.PackType, + + PositionType = item.PositionType, + SkuCount = item.SkuCount, + SkuTitle = item.SkuGoodsTitle, + TaskId = item.TaskId, + + EndTime = item.CreateTime, + BrandName = item.BrandName, + OrderId = item.OrderId, + TaskState = item.TaskState, + + // IsWorry = (Worry)item.IsWorry, + }; + if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) + { + data.BarCodeModel = item.BarCodeDTO; + } + if (item.Cers != null) + { + data.CertificateModel = item.Cers; + } + if (item.FeesItemResponse != null) + { + data.FeesItemResponse = item.FeesItemResponse; + data.FeesMoney = item.FeesItemResponse.SingleFees; + data.IsShowFees = data.FeesMoney > 0 ? true : false; + data.FeesItemResponse.DiscountSingleFees = item.FeesItemResponse.SingleFees * item.FeesItemResponse.disCount; + data.FeesItemResponse.DiscountAllFees = item.FeesItemResponse.AllFees * item.FeesItemResponse.disCount; + + } + else + { + data.IsShowFees = false; + } + if (item.PackUserName != null && item.PackUserName.Count() > 0) + { + data.PackUser = string.Join("\r\n", item.PackUserName); + } + + data.ReflashTask = ReflashTask; + + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + PackTaskList.Add(data); + })); } - else - { - data.IsShowFees = false; - } - if (item.PackUserName != null && item.PackUserName.Count() > 0) - { - data.PackUser = string.Join("\r\n", item.PackUserName); - } - data.ReflashTask = ReflashTask; - App.Current.Dispatcher.BeginInvoke(new Action(() => - { - PackTaskList.Add(data); - })); } - - + else + { + MessageBox.Show("查不到数据"); + } + IsLoadCount(); } - else + catch (Exception ex) { - MessageBox.Show("查不到数据"); - + System.Windows.MessageBox.Show(ex.Message); } - IsLoadCount(); + IsLoading = false; + }); - } - catch (Exception ex) - { + if (TaskState != null && waitSealBoxTaskStates.Contains(TaskState.Value))//封箱操作 + { + if (TaskState == Models.TaskState.待封箱) + Task.Factory.StartNew(() => + { + try + { + if (SealBoxConfigureType == SealBoxConfigureType.待配置) + { + SealBoxWaitConfigureList = new ObservableCollection(); + ApiResponse sealBoxWaitRes = sealBoxService.GetSealBoxWaitConfigureList(SearchSkuId, SearchTaskId, PageSize, PageIndex); + + if (sealBoxWaitRes == null) + { + System.Windows.MessageBox.Show("网络异常"); IsLoading = false; return; + } + + if (!sealBoxWaitRes.Success || sealBoxWaitRes.Data == null) + { + System.Windows.MessageBox.Show(sealBoxWaitRes.Msg); IsLoading = false; return; + } + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + OrderCount = sealBoxWaitRes.Data.TotalCount; + })); + + foreach (var item in sealBoxWaitRes.Data.SealBoxWaitConfigureModels) + { + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + SealBoxWaitConfigureList.Add(item); + })); + } + } - } - IsLoading = false; - }); + if (SealBoxConfigureType == SealBoxConfigureType.已配置) + { + SealBoxConfiguredList = new ObservableCollection(); + + + + var sealBoxRes = sealBoxService.GetSealBoxConfiguredList(SearchSkuId, SearchTaskId, globalContext.User.Shop.ShopId.ToString(), PageSize, PageIndex); + if (sealBoxRes == null) + { + System.Windows.MessageBox.Show("网络异常"); IsLoading = false; return; + } + + if (!sealBoxRes.Success || sealBoxRes.Data == null) + { + System.Windows.MessageBox.Show(sealBoxRes.Msg); IsLoading = false; return; + } + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + OrderCount = sealBoxRes.Data.TotalCount; + })); + + foreach (var item in sealBoxRes.Data.SealBoxConfiguredModels) + { + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + SealBoxConfiguredList.Add(item); + })); + } + } + IsLoadSealBoxCount(); + } + catch (Exception ex) + { + + System.Windows.MessageBox.Show(ex.Message); + } + + IsLoading = false; + }); + if (TaskState == Models.TaskState.待落仓) + IsLoading = false; + } @@ -442,22 +616,26 @@ namespace BBWY.Client.ViewModels.PackTask ProductService productService; + private void IsLoadSealBoxCount() + { + var res = sealBoxService.GetSealBoxPackStateCount(); + if (res != null && res.Success && res.Data != null) + { + SealBoxWaitConfigureCount = res.Data.SealBoxWaitConfigureCount.ToString(); + SealBoxConfiguredCount = res.Data.SealBoxConfiguredCount.ToString(); + } + } /// /// 展示发布任务页面 /// public void CreateTask() { - ViewModelLocator viewModel = new ViewModelLocator(); - var publicTaskViewModel = viewModel.PublishTask; - if (publicTaskViewModel.ReflashWindow == null) - publicTaskViewModel.ReflashWindow = ReflashTask; - publicTaskViewModel.InitData(); - PublishTaskWindow publish = new PublishTaskWindow(); + PublishTaskWindow publish = new PublishTaskWindow(ReflashTask); publish.Show(); } @@ -490,7 +668,9 @@ namespace BBWY.Client.ViewModels.PackTask { var paramList = (object[])param; // var orderId = paramList[0].ToString(); - var skuId = paramList[1].ToString(); + + + var skuId = paramList.Last().ToString(); var url = $"https://item.jd.com/{skuId}.html"; diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index 488d17d3..42eebbcd 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -217,19 +217,16 @@ namespace BBWY.Client.ViewModels.PackTask #endregion - private readonly ProductService productService; - private readonly ConsumableService consumableService; - private readonly WorkProcessService workProcessService; + private readonly PackTaskService packTaskService; - private readonly IncreateServiceService increateServiceService; + private readonly SealBoxService sealBoxService; public GlobalContext globalContext; - public WareHouseListViewModel(PackTaskService packTaskService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateServiceService, ProductService productService, BatchPurchaseService batchPurchaseService, GlobalContext globalContext) + public WareHouseListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService) { this.globalContext = globalContext; - - + this.sealBoxService = sealBoxService; this.packTaskService = packTaskService; - this.consumableService = consumableService; + //Messenger.Default.Send(globalContext, "AcceptGlobalContext"); PackTaskList = new ObservableCollection();//初始化数据 @@ -247,7 +244,7 @@ namespace BBWY.Client.ViewModels.PackTask }); OpenSkuDetailCommand = new RelayCommand(OpenSkuDetail); - + StartTime = DateTime.Now.Date; EndTime = DateTime.Now.Date; IsLoading = false; @@ -255,10 +252,9 @@ namespace BBWY.Client.ViewModels.PackTask //加载数据 SetTaskState(null); - this.workProcessService = workProcessService; - this.increateServiceService = increateServiceService; - this.productService = productService; - this.batchPurchaseService = batchPurchaseService; + + + UpdateTaskStateCommand = new RelayCommand(UpdateTaskState); @@ -266,6 +262,7 @@ namespace BBWY.Client.ViewModels.PackTask SetSealBoxCommand = new RelayCommand(SetSealBox); CompeteFallWareCommand = new RelayCommand(CompeteFallWare); + } /// @@ -333,10 +330,13 @@ namespace BBWY.Client.ViewModels.PackTask public ICommand SetSealBoxCommand { get; set; } - BatchPurchaseService batchPurchaseService; + /// + /// 完成封箱 + /// + /// private void CompeteSealBox(object obj) { var model = (SealBoxModel)obj; @@ -346,19 +346,21 @@ namespace BBWY.Client.ViewModels.PackTask System.Windows.MessageBox.Show("请先设置封箱数量"); return; } + var res = sealBoxService.WareCompeteSealBox(model.SealBoxId,model.SealBoxCount); + if(res==null) + { + System.Windows. MessageBox.Show("网络异常",""); + return; + } - var objList = obj as SealBoxModel; - CompeteSealBox competeSealBox = new CompeteSealBox(); - competeSealBox.WareId = objList.WareId; - competeSealBox.BoxCount = model.SealBoxCount.Value; - competeSealBox.TaskId = objList.SealBoxSkus.Select(s => s.TaskId).ToArray(); - var res = packTaskService.CompeteSealBox(competeSealBox); - if (res != null && res.Success) + + if (!res.Success||!res.Data) { - SearchTaskList(); + System.Windows.MessageBox.Show(res.Msg); + return; } - + SearchTaskList(); } @@ -427,6 +429,7 @@ namespace BBWY.Client.ViewModels.PackTask } public void SetTaskState(TaskState? taskState) { + PageIndex = 1; TaskState = taskState; SearchTaskList(); @@ -457,7 +460,7 @@ namespace BBWY.Client.ViewModels.PackTask WaitFallWareList = new ObservableCollection(); - var datas = packTaskService.SearchWaitFallWareList(SearchShopName, taskId, SearchSkuId, PageIndex, PageSize); + var datas = sealBoxService.SearchWaitFallWareList(SearchShopName, taskId, SearchSkuId, PageIndex, PageSize); if (datas != null && datas.Data != null && datas.Success) { var dataModel = datas.Data; @@ -497,10 +500,12 @@ namespace BBWY.Client.ViewModels.PackTask else if (TaskState == Models.TaskState.待封箱) Task.Factory.StartNew(() => { - + + WaitSealBoxModels = new ObservableCollection(); - var datas = packTaskService.SearchWaitSealBoxList(SearchShopName, taskId, SearchSkuId, PageIndex, PageSize); + + var datas = sealBoxService.GetWareSealBoxList(SearchShopName, taskId, SearchSkuId, PageIndex, PageSize); if (datas != null && datas.Data != null && datas.Success) { var dataModel = datas.Data; @@ -511,14 +516,14 @@ namespace BBWY.Client.ViewModels.PackTask { WaitSealBoxModels.Add(new SealBoxModel { - AcceptUserName = string.Join("|", item.AcceptUserNames.Select(a => a.UserName)), + AcceptUserName = string.Join("|", item.AcceptUserNames), DepartmentName = item.DepartmentName, SealBoxSkus = item.SealBoxSkus, ShopId = item.ShopId, ShopName = item.ShopName, WareId = item.WareId, WareName = item.WareName, - + SealBoxId = item.SealBoxId, }); })); diff --git a/BBWY.Client/ViewModels/QiKu/PackSkuSplitConfigViewModel.cs b/BBWY.Client/ViewModels/QiKu/PackSkuSplitConfigViewModel.cs index f96467a2..cf13eb1f 100644 --- a/BBWY.Client/ViewModels/QiKu/PackSkuSplitConfigViewModel.cs +++ b/BBWY.Client/ViewModels/QiKu/PackSkuSplitConfigViewModel.cs @@ -74,7 +74,7 @@ namespace BBWY.Client.ViewModels MessageBox.Show(response.Msg, "获取仓库"); return; } - storeList = response.Data; + storeList = response.Data.Where(s=>s.Status== StockStatus.使用).ToArray(); } var w = new PackSkuSplitCountAndStoreWindow(packSkuSplitConfig.PackCount, packSkuSplitConfig.Store, storeList, packSkuSplitConfig.IsJST); if (w.ShowDialog() == true) diff --git a/BBWY.Client/ViewModels/SealBox/SealBoxConfigureViewModel.cs b/BBWY.Client/ViewModels/SealBox/SealBoxConfigureViewModel.cs new file mode 100644 index 00000000..7a37c917 --- /dev/null +++ b/BBWY.Client/ViewModels/SealBox/SealBoxConfigureViewModel.cs @@ -0,0 +1,304 @@ +using AutoMapper.Internal; +using BBWY.Client.APIServices; +using BBWY.Client.Models; +using BBWY.Client.Models.APIModel; +using BBWY.Client.Models.QiKu; +using BBWY.Client.Models.SealBox; +using BBWY.Client.Views.BatchPurchase; +using BBWY.Controls; +using GalaSoft.MvvmLight.Command; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Input; + +namespace BBWY.Client.ViewModels.SealBox +{ + public class SealBoxConfigureViewModel : BaseVM + { + private IList storeList;//仓库列表 + private LogisticsService logisticsService; + private SealBoxService sealBoxService; + private GlobalContext globalContext; + private ObservableCollection sealBoxConfigureModelList; + + + /// + /// 分箱配置列表 + /// + public ObservableCollection SealBoxConfigureModelList { get => sealBoxConfigureModelList; set { Set(ref sealBoxConfigureModelList, value); } } + public SealBoxConfigureViewModel(LogisticsService logisticsService, SealBoxService sealBoxService, GlobalContext globalContext) + { + this.logisticsService = logisticsService; + this.sealBoxService = sealBoxService; + SetSplitCountCommand = new RelayCommand(SetSplitCount); + SetPackCountAndStoreCommand = new RelayCommand(SetPackCountAndStore); + SaveCommand = new RelayCommand(Save); + SealBoxConfigureModelList = new ObservableCollection(); + this.globalContext = globalContext; + } + + private long sealBoxId; + public long SealBoxId { get => sealBoxId; set { Set(ref sealBoxId, value); } } + + public ICommand SetSplitCountCommand { get; set; } + + public ICommand SetPackCountAndStoreCommand { get; set; } + + public ICommand SaveCommand { get; set; } + + private void SetSplitCount(SealBoxConfigureModel sealBoxConfigureModel) + { + sealBoxConfigureModel.WareHourseDatas.Where(w => w.WareState == null || w.WareState == PositionState.待封箱).ToList().ForEach( + s => sealBoxConfigureModel.WareHourseDatas.Remove(s) + + ); + var otherCount = sealBoxConfigureModel.WareHourseDatas.Count(); + if (sealBoxConfigureModel.SplitCount <= 0 || sealBoxConfigureModel.SplitCount < otherCount) + { + MessageBox.Show("份数不正确"); + return; + } + + int resetIndex = 1; + foreach (var item in sealBoxConfigureModel.WareHourseDatas) + { + item.Index = resetIndex; + resetIndex++; + } + + + + + for (var i = 1 + otherCount; i <= sealBoxConfigureModel.SplitCount; i++) + { + sealBoxConfigureModel.WareHourseDatas.Add(new SealBoxConfigureWareHourseModel() + { + Index = i, + Count = 0 + }); + } + + + + } + + + + private StoreResponse store; + private void SetPackCountAndStore(object obj) + { + + var sealBoxConfigureWareHourseModel = obj as SealBoxConfigureWareHourseModel; + if (storeList == null) + { + var response = logisticsService.GetStoreList(); + if (!response.Success) + { + MessageBox.Show(response.Msg, "获取仓库"); + return; + } + storeList = response.Data.Where(s => s.Status == StockStatus.使用).ToArray(); + } + if (store == null) + { + if (sealBoxConfigureWareHourseModel != null) + store = new StoreResponse + { + Id = sealBoxConfigureWareHourseModel.WareId, + Name = sealBoxConfigureWareHourseModel.WareName, + Type = ToStockType(sealBoxConfigureWareHourseModel.WareType), + Status = StockStatus.使用 + }; + } + + + + var w = new PackSkuSplitCountAndStoreWindow(sealBoxConfigureWareHourseModel.Count, store, storeList, sealBoxConfigureWareHourseModel.WareType == WareType.聚水潭齐越仓); + if (w.ShowDialog() == true) + { + store = w.Store; + sealBoxConfigureWareHourseModel.Count = w.Quantity; + IsJST = w.IsJST; + sealBoxConfigureWareHourseModel.WareType = w.IsJST ? WareType.聚水潭齐越仓 : ToWareType(w.Store.Type); + sealBoxConfigureWareHourseModel.WareId = w.IsJST ? "qiyuejushuitan" : w.Store.Id; + sealBoxConfigureWareHourseModel.WareName = w.IsJST ? "齐越聚水潭" : w.Store.Name; + + + + + } + } + + /// + /// 是否聚水潭 + /// + public bool IsJST { get; set; } + + private WareType ToWareType(StockType stockType) + { + switch (stockType) + { + case StockType.商家仓: + return WareType.商家仓; + break; + case StockType.京仓: + return WareType.京仓; + break; + case StockType.云仓: + return WareType.云仓; + break; + default: + break; + } + return WareType.聚水潭齐越仓; + } + + private StockType ToStockType(WareType? wareType) + { + switch (wareType) + { + case WareType.京仓: + return StockType.京仓; + break; + case WareType.云仓: + return StockType.云仓; + break; + case WareType.商家仓: + return StockType.商家仓; + break; + case WareType.聚水潭齐越仓: + break; + default: + break; + } + + return StockType.京仓; + } + + private void Save(object obj) + { + + if (SealBoxId <= 0)//设置分箱 + { + SetSealBoxConfiguredRequest setSealBoxConfiguredRequest = new SetSealBoxConfiguredRequest(); + setSealBoxConfiguredRequest.ShopId = globalContext.User.Shop.ShopId.ToString(); + IList SetSealBoxConfiguredDatas = new List(); + foreach (var sealBoxConfigureModel in SealBoxConfigureModelList) + { + ////todo: 到分箱界面判断 + //if (sealBoxConfigureModel.WareHourseDatas.Select(s => s.WareId).Distinct().Count() != sealBoxConfigureModel.WareHourseDatas.Count()) + //{ + // MessageBox.Show($"任务id:{sealBoxConfigureModel.TaskId} ,分箱出现重复仓库,请重新设置!"); + // return; + //} + //判断任务数量与分箱数量总和是否相等 + if (sealBoxConfigureModel.SkuCount != sealBoxConfigureModel.WareHourseDatas.Select(s => s.Count).Sum()) + { + MessageBox.Show($"任务id:{sealBoxConfigureModel.TaskId}中,采购数量:{sealBoxConfigureModel.SkuCount} 不等于 分箱总数量:{sealBoxConfigureModel.WareHourseDatas.Select(s => s.Count).Sum()}"); + return; + } + SetSealBoxConfiguredDatas.Add(new SetSealBoxConfiguredData + { + SkuId = sealBoxConfigureModel.SkuId, + TaskId = sealBoxConfigureModel.TaskId, + TotalCount = sealBoxConfigureModel.SkuCount, + WareHourseDatas = sealBoxConfigureModel.WareHourseDatas.Select(x => new WareHourseData + { + Count = x.Count, + WareId = x.WareId, + WareName = x.WareName, + WareType = x.WareType.Value, + }).ToList(), + }); + } + setSealBoxConfiguredRequest.SetSealBoxConfiguredDatas = SetSealBoxConfiguredDatas; + var setSealBoxRes = sealBoxService.SetSealBoxConfigured(setSealBoxConfiguredRequest); + if (setSealBoxRes == null) + { + MessageBox.Show("网络异常"); + return; + } + if (!setSealBoxRes.Success || setSealBoxRes.Data == null || !setSealBoxRes.Data) + { + MessageBox.Show(setSealBoxRes.Msg); + return; + } + if (ReflashWindow != null) ReflashWindow(); + + var window = obj as BWindow; + window.Close(); + } + + + if (SealBoxId > 0)//修改分箱 + { + BatchUpdateSealBoxConfiguredRequest res = new BatchUpdateSealBoxConfiguredRequest() + { + + SealBoxId = SealBoxId, + ShopId = globalContext.User.Shop.ShopId.ToString() + }; + + IList UpdateSealBoxConfiguredDatas = new List(); + foreach (var sealBoxConfigureModel in SealBoxConfigureModelList) + { + + ////todo: 到分箱界面判断 + //if (sealBoxConfigureModel.WareHourseDatas.Select(s => s.WareId).Distinct().Count() != sealBoxConfigureModel.WareHourseDatas.Count()) + //{ + // MessageBox.Show($"任务id:{sealBoxConfigureModel.TaskId} ,分箱出现重复仓库,请重新设置!"); + // return; + //} + //判断任务数量与分箱数量总和是否相等 + if (sealBoxConfigureModel.SkuCount != sealBoxConfigureModel.WareHourseDatas.Select(s => s.Count).Sum()) + { + MessageBox.Show($"任务id:{sealBoxConfigureModel.TaskId} 中,采购数量:{sealBoxConfigureModel.SkuCount} 不等于 分箱总数量:{sealBoxConfigureModel.WareHourseDatas.Select(s => s.Count).Sum()}"); + return; + } + UpdateSealBoxConfiguredDatas.Add(new UpdateSealBoxConfiguredDataRequest + { + + TaskId = sealBoxConfigureModel.TaskId, + SkuCount = sealBoxConfigureModel.SkuCount, + SealBoxConfiguredWareHourseRequests = sealBoxConfigureModel.WareHourseDatas.Select(x => new SealBoxConfiguredWareHourseRequest + { + Count = x.Count, + WareId = x.WareId, + WareName = x.WareName, + WareType = x.WareType.Value, + WareState = x.WareState, + + }).ToList(), + }); + } + res.UpdateSealBoxConfiguredDatas = UpdateSealBoxConfiguredDatas; + + + var setSealBoxRes = sealBoxService.BatchUpdateSealBoxConfigured(res); + if (setSealBoxRes == null) + { + MessageBox.Show("网络异常"); + return; + } + if (!setSealBoxRes.Success || setSealBoxRes.Data == null || !setSealBoxRes.Data) + { + MessageBox.Show(setSealBoxRes.Msg); + return; + } + if (ReflashWindow != null) ReflashWindow(); + var window = obj as BWindow; + window.Close(); + } + + } + + + + public Action ReflashWindow { get; set; } + + } +} diff --git a/BBWY.Client/ViewModels/ViewModelLocator.cs b/BBWY.Client/ViewModels/ViewModelLocator.cs index a5ebf30e..9d503d99 100644 --- a/BBWY.Client/ViewModels/ViewModelLocator.cs +++ b/BBWY.Client/ViewModels/ViewModelLocator.cs @@ -1,4 +1,6 @@ -using BBWY.Client.ViewModels.PackTask; +using BBWY.Client.Models; +using BBWY.Client.ViewModels.PackTask; +using BBWY.Client.ViewModels.SealBox; using BBWY.Client.ViewModels.TotalPackTask; using GalaSoft.MvvmLight.Ioc; using Microsoft.Extensions.DependencyInjection; @@ -326,10 +328,26 @@ namespace BBWY.Client.ViewModels } - void test() + public SealBoxConfigureViewModel SealBoxConfigureVModel { - - var packuser = (App.Current as App).ServiceProvider.GetRequiredService(); + get + { + using var s = sp.CreateScope(); + return s.ServiceProvider.GetRequiredService(); + } } + + //public ShopSealBoxListViewModel ShopSealBoxListVM + //{ + // get + // { + + // using (var s = sp.CreateScope()) + // { + // return s.ServiceProvider.GetRequiredService(); + // } + // } + //} + } } diff --git a/BBWY.Client/Views/BatchPurchase/PackSkuSplitCountAndStoreWindow.xaml.cs b/BBWY.Client/Views/BatchPurchase/PackSkuSplitCountAndStoreWindow.xaml.cs index 596f9765..2beb37e3 100644 --- a/BBWY.Client/Views/BatchPurchase/PackSkuSplitCountAndStoreWindow.xaml.cs +++ b/BBWY.Client/Views/BatchPurchase/PackSkuSplitCountAndStoreWindow.xaml.cs @@ -95,7 +95,18 @@ namespace BBWY.Client.Views.BatchPurchase { this.txtQuantity.Text = Quantity.ToString(); - this.cbx_stroeList.SelectedItem = this.Store; + + if (isJST) + { + //this.cbx_stroeList.Text = Store.Name; + + } + else + { + this.cbx_stroeList.SelectedItem = storeList.FirstOrDefault(s => s.Id == Store.Id); + } + + //this.cbx_stroeList.ItemsSource = storeList; //if (Store != null) // this.cbx_stroeList.SelectedItem = storeList.FirstOrDefault(s => s.Id == Store.Id); diff --git a/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml.cs b/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml.cs index 845ba5dc..d662157c 100644 --- a/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml.cs @@ -1,4 +1,6 @@ -using BBWY.Controls; +using BBWY.Client.Models; +using BBWY.Client.ViewModels.PackTask; +using BBWY.Controls; using System; using System.Collections.Generic; using System.Text; @@ -18,9 +20,15 @@ namespace BBWY.Client.Views.PackTask /// public partial class PublishTaskWindow : BWindow { - public PublishTaskWindow() + public PublishTaskWindow(Action ReflashTask, PackTaskModel model = null) { InitializeComponent(); + + var publicTaskViewModel = (PublishTaskViewModel)this.DataContext; + if (publicTaskViewModel.ReflashWindow == null) + publicTaskViewModel.ReflashWindow = ReflashTask; + + publicTaskViewModel.InitData(model); } } } diff --git a/BBWY.Client/Views/PackTask/TaskList.xaml b/BBWY.Client/Views/PackTask/TaskList.xaml index d20a9abe..236a13cc 100644 --- a/BBWY.Client/Views/PackTask/TaskList.xaml +++ b/BBWY.Client/Views/PackTask/TaskList.xaml @@ -7,6 +7,7 @@ xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" xmlns:ctr="clr-namespace:BBWY.Client.Converters" xmlns:cmodel="clr-namespace:BBWY.Client.Models" + xmlns:sealbox="clr-namespace:BBWY.Client.Views.SealBox" xmlns:b="http://schemas.microsoft.com/xaml/behaviors" xmlns:sys="clr-namespace:System;assembly=mscorlib" DataContext="{Binding TaskList,Source={StaticResource Locator}}" @@ -72,12 +73,12 @@ - + - + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BBWY.Client/Views/SealBox/ShopSealBoxListControl.xaml.cs b/BBWY.Client/Views/SealBox/ShopSealBoxListControl.xaml.cs new file mode 100644 index 00000000..d4a318f5 --- /dev/null +++ b/BBWY.Client/Views/SealBox/ShopSealBoxListControl.xaml.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BBWY.Client.Views.SealBox +{ + /// + /// ShopSealBoxListControl.xaml 的交互逻辑 + /// + public partial class ShopSealBoxListControl : UserControl + { + public ShopSealBoxListControl() + { + InitializeComponent(); + } + } +} diff --git a/BBWY.Client/Views/SealBox/UpdateSealBoxConfiguredWindow.xaml b/BBWY.Client/Views/SealBox/UpdateSealBoxConfiguredWindow.xaml new file mode 100644 index 00000000..3ed105d8 --- /dev/null +++ b/BBWY.Client/Views/SealBox/UpdateSealBoxConfiguredWindow.xaml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BBWY.Client/Views/SealBox/UpdateSealBoxConfiguredWindow.xaml.cs b/BBWY.Client/Views/SealBox/UpdateSealBoxConfiguredWindow.xaml.cs new file mode 100644 index 00000000..234f76dd --- /dev/null +++ b/BBWY.Client/Views/SealBox/UpdateSealBoxConfiguredWindow.xaml.cs @@ -0,0 +1,26 @@ +using BBWY.Controls; +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace BBWY.Client.Views.SealBox +{ + /// + /// UpdateSealBoxConfiguredWindow.xaml 的交互逻辑 + /// + public partial class UpdateSealBoxConfiguredWindow : BWindow + { + public UpdateSealBoxConfiguredWindow() + { + InitializeComponent(); + } + } +} diff --git a/BBWY.Client/Views/SealBox/WaitSealBoxControl.xaml b/BBWY.Client/Views/SealBox/WaitSealBoxControl.xaml index 08d8d329..4954fd56 100644 --- a/BBWY.Client/Views/SealBox/WaitSealBoxControl.xaml +++ b/BBWY.Client/Views/SealBox/WaitSealBoxControl.xaml @@ -221,7 +221,7 @@