diff --git a/BBWY.Client/APIServices/OrderService.cs b/BBWY.Client/APIServices/OrderService.cs index 78fe11a0..fadd1f85 100644 --- a/BBWY.Client/APIServices/OrderService.cs +++ b/BBWY.Client/APIServices/OrderService.cs @@ -278,5 +278,37 @@ namespace BBWY.Client.APIServices shop.AppToken }, null, HttpMethod.Post); } + + public ApiResponse QueryOrderSkuList(DateTime startDate, + DateTime endDate, + int? purchasePlatform, + IList shopIds, + int pageIndex, + int pageSize) + { + return SendRequest(globalContext.BBYWApiHost, "api/order/queryorderskulist", new + { + shopIds, + purchasePlatform, + startTime = startDate, + endTime = endDate, + pageIndex, + pageSize + }, null, HttpMethod.Post); + } + + public ApiResponse> ExportOrderSkuList(DateTime startDate, + DateTime endDate, + int? purchasePlatform, + IList shopIds) + { + return SendRequest>(globalContext.BBYWApiHost, "api/order/exportorderskulist", new + { + shopIds, + purchasePlatform, + startTime = startDate, + endTime = endDate + }, null, HttpMethod.Post); + } } } diff --git a/BBWY.Client/APIServices/ProductService.cs b/BBWY.Client/APIServices/ProductService.cs index 1e4fbda8..7862bd24 100644 --- a/BBWY.Client/APIServices/ProductService.cs +++ b/BBWY.Client/APIServices/ProductService.cs @@ -28,22 +28,7 @@ namespace BBWY.Client.APIServices null, HttpMethod.Post); } - public ApiResponse> GetProductSkuList(string spu, string sku,Platform platform,string appKey,string appSecret,string appToken) - { - return SendRequest>(globalContext.BBYWApiHost, - "api/product/GetProductSkuList", - new - { - Spu = spu, - Sku = sku, - Platform = platform, - AppKey = appKey, - AppSecret = appSecret, - AppToken = appToken - }, - null, - HttpMethod.Post); - } + public ApiResponse> GetProductSkuList(string spu, string sku) { return SendRequest>(globalContext.BBYWApiHost, @@ -61,6 +46,25 @@ namespace BBWY.Client.APIServices HttpMethod.Post); } + + + + public ApiResponse> GetProductSkuList(string spu, string sku, Platform platform, string appKey, string appSecret, string appToken) + { + return SendRequest>(globalContext.BBYWApiHost, + "api/product/GetProductSkuList", + new + { + Spu = spu, + Sku = sku, + Platform = platform, + AppKey = appKey, + AppSecret = appSecret, + AppToken = appToken + }, + null, + HttpMethod.Post); + } public ApiResponse GetProductList(string spu, string productName, string productItem, int pageIndex, Platform platform, string appKey, string appSecret, string appToken) { return SendRequest(globalContext.BBYWApiHost, diff --git a/BBWY.Client/APIServices/QiKu/PackTaskService.cs b/BBWY.Client/APIServices/QiKu/PackTaskService.cs index 8cf6aba5..1ba284d0 100644 --- a/BBWY.Client/APIServices/QiKu/PackTaskService.cs +++ b/BBWY.Client/APIServices/QiKu/PackTaskService.cs @@ -19,8 +19,6 @@ namespace BBWY.Client.APIServices public class PackTaskService : BaseApiService, IDenpendency { - - public PackTaskService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) { } @@ -32,13 +30,14 @@ namespace BBWY.Client.APIServices TaskState? TaskState = null, int pageIndex = 1, int pageSize = 10 - + ) { - + return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchTaskList", new { + orderSn, spuId, skuId, @@ -55,12 +54,16 @@ namespace BBWY.Client.APIServices TaskState? TaskState = null, string ShopName = null, int pageIndex = 1, - int pageSize = 10 + int pageSize = 10, + string SkuTitle = null, + string SpuTitle = null ) { return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchTaskList", new { + SkuTitle, + SpuTitle, DepartmentName = departmentName, SkuId = skuId, TaskId = taskId, @@ -182,29 +185,59 @@ namespace BBWY.Client.APIServices } - public ApiResponse ShopTotal(string skuId = null, string taskId = null, - DateTime? startTime = null, - DateTime? endTime = null, - string ShopName = null, - string DepartmentName = null, + //public ApiResponse ShopTotal(string skuId = null, string taskId = null, + // DateTime? startTime = null, + // DateTime? endTime = null, + // string ShopName = null, + // string DepartmentName = null, + // int pageIndex = 1, + // int pageSize = 10 + // ) + //{ + // return SendRequest(globalContext.QKApiHost, "api/PackTask/ShopTotal", new + // { + + // SkuId = skuId, + // TaskId = taskId, + // StartTime = startTime, + // EndTime = endTime, + // DepartmentName, + // ShopName, + // PageIndex = pageIndex, + // PageSize = pageSize + + // }, null, HttpMethod.Post); + //} + + + public ApiResponse ShopTotalV2(string skuId, + string taskId, + string shopId, + DateTime? startTime, + DateTime? endTime, + string ShopName, + string DepartmentName, int pageIndex = 1, int pageSize = 10 ) { - return SendRequest(globalContext.QKApiHost, "api/PackTask/ShopTotal", new + return SendRequest(globalContext.QKApiHost, "api/PackTask/ShopTotalV2", new { - - SkuId = skuId, - TaskId = taskId, - StartTime = startTime, - EndTime = endTime, + shopId, + skuId, + taskId, + startTime, + endTime, DepartmentName, ShopName, - PageIndex = pageIndex, - PageSize = pageSize + pageIndex, + pageSize }, null, HttpMethod.Post); } + + + /// /// 批量结算 /// @@ -251,11 +284,6 @@ namespace BBWY.Client.APIServices }, null, HttpMethod.Post); } - public ApiResponse StoreGetBySelf(long taskId) - { - - return SendRequest(globalContext.QKApiHost, $"api/PackTask/StoreGetBySelf?TaskId={taskId}", null, null, HttpMethod.Post); - } public ApiResponse CompletedPackTask(long taskId) { @@ -286,7 +314,7 @@ namespace BBWY.Client.APIServices /// public ApiResponse ManualSign(string wayBillNo) { - return SendRequest< object>("http://bbwyb.qiyue666.com", $"Api​/PurchaseOrder​/ManualSign", new + return SendRequest("http://bbwyb.qiyue666.com", $"Api​/PurchaseOrder​/ManualSign", new { wayBillNo }, null, HttpMethod.Post); @@ -299,7 +327,7 @@ namespace BBWY.Client.APIServices /// public ApiResponse BatchManualSign(string[] wayBillNoList) { - return SendRequest("http://bbwyb.qiyue666.com", $"api/purchaseorder/batchmanualsign",new { wayBillNoList }, null, HttpMethod.Post); + return SendRequest("http://bbwyb.qiyue666.com", $"api/purchaseorder/batchmanualsign", new { wayBillNoList }, null, HttpMethod.Post); } /// @@ -331,21 +359,54 @@ namespace BBWY.Client.APIServices }, null, HttpMethod.Post); } - //public ApiResponse QikuPublishOrderSkuPackConfigState(string orderId, string skuId, PackConfigState packConfigState) - //{ - // return SendRequest("http://bbwyb.qiyue666.com", $"Api/Order/QikuPublishOrderSkuPackConfigState", new - // { - // orderId, - // skuId, - // packConfigState, - // }, null, HttpMethod.Post); - //} - public ApiResponse SendToSetSkuConfigure(long taskId) { - return SendRequest(globalContext.QKApiHost, $"api/PackTask/SendToSetSkuConfigure?taskid={taskId}",null, null, HttpMethod.Post); + return SendRequest(globalContext.QKApiHost, $"api/PackTask/SendToSetSkuConfigure?taskid={taskId}", null, null, HttpMethod.Post); } + + public ApiResponse GetStoreGetSelfData(long taskId) + { + return SendRequest(globalContext.QKApiHost, $"api/PackTask/GetStoreGetSelfData?taskid={taskId}", null, null, HttpMethod.Get); + } + + + public ApiResponse StoreGetBySelfV2(long taskId, int storeGetCount, string PickerUserName) + { + + return SendRequest(globalContext.QKApiHost, $"api/PackTask/StoreGetBySelfV2", new { + taskId, + storeGetCount, + PickerUserName, + OperatorUserName= globalContext.User.Name + }, null, HttpMethod.Post); + } + + public ApiResponse SearchStoreGetSelfList(string taskId, string OrderSn, string SpuId, string SkuId,string DepartmentName, string ShopName, int? pageIndex, int pageSize, string ShopId) + { + + return SendRequest(globalContext.QKApiHost, $"api/PackTask/SearchStoreGetSelfList", new + { + taskId, + OrderSn, + SpuId, + SkuId, + DepartmentName, ShopName, + ShopId , pageIndex, pageSize, + }, null, HttpMethod.Post); + } + + public ApiResponse AddSealBoxProduct(string skuId, PositionType positionType, int count) + { + return SendRequest(globalContext.QKApiHost, $"api/PackTask/AddSealBoxProduct", new + { + skuId, + positionType, + SkuCount = count, + ShopId = globalContext.User.Shop.ShopId.ToString(), + UserId = globalContext.User.Id.ToString() + }, null, HttpMethod.Post); + } } public class CompeteSealBox @@ -363,15 +424,12 @@ namespace BBWY.Client.APIServices } - public class AddConsumableRequest { public long TaskId { get; set; } public long[] ConsumableIds { get; set; } } - - public class PackTaskDetailRequest { /// /// 任务id @@ -512,22 +570,7 @@ namespace BBWY.Client.APIServices /// 服务数量 /// public int? ServiceCount { get; set; } - ///// - ///// 增值服务ids - ///// - //public string IncreateServiceIds { get; set; } - ///// - ///// 增值服务数量 - ///// - //public string IncreateServiceNos { get; set; } - ///// - ///// 工序ids - ///// - //public string WorkProcessIds { get; set; } - ///// - ///// 工序数量 - ///// - //public string WorkProcessNos { get; set; } + /// /// @@ -549,8 +592,6 @@ namespace BBWY.Client.APIServices public ServiceType ServiceType { get; set; } } - - public class ConsumableTaskModel { public decimal Price { get; set; } @@ -564,7 +605,6 @@ namespace BBWY.Client.APIServices public int? ConsumableCount { get; set; } } - public class PackServiceMemberModel { public decimal Price { get; set; } @@ -583,7 +623,4 @@ namespace BBWY.Client.APIServices } - - - } diff --git a/BBWY.Client/APIServices/QiKu/SealBoxService.cs b/BBWY.Client/APIServices/QiKu/SealBoxService.cs index c288ba6a..ded38c51 100644 --- a/BBWY.Client/APIServices/QiKu/SealBoxService.cs +++ b/BBWY.Client/APIServices/QiKu/SealBoxService.cs @@ -28,8 +28,8 @@ namespace BBWY.Client.APIServices { ShopId = globalContext.User.Shop.ShopId.ToString(), - TaskId = TaskId, - SkuId = SkuId, + TaskId, + SkuId, SpuId, PageSize, PageIndex, @@ -72,9 +72,9 @@ namespace BBWY.Client.APIServices } - public ApiResponse GetUpdateSealBoxConfigured(long SealBoxId, long[] TaskIds) + public ApiResponse GetUpdateSealBoxConfiguredV2(long SealBoxId, long[] TaskIds) { - return SendRequest(globalContext.QKApiHost, $"api/SealBox/GetUpdateSealBoxConfigured", + return SendRequest(globalContext.QKApiHost, $"api/SealBox/GetUpdateSealBoxConfiguredV2", new { SealBoxId, diff --git a/BBWY.Client/App.xaml.cs b/BBWY.Client/App.xaml.cs index a719e121..8b58aef9 100644 --- a/BBWY.Client/App.xaml.cs +++ b/BBWY.Client/App.xaml.cs @@ -50,10 +50,13 @@ namespace BBWY.Client #if DEBUG //仓库组测试 - // userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNjM1OTMyMDAyMjcwMDU2NDQ4IiwidGVhbUlkIjoiMTU0MDg4NTU3MDYyNzA0NzQyNCIsInNvblRlYW1JZHMiOiIxNTQwODg1NTcwNjI3MDQ3NDI0IiwiZXhwIjoxNzEwNDk2NTQ1fQ.Sx2vGJcYGf98x99slQLU3vt7yWdjspptSpbUCcZgWek"; + userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNjM1OTMyMDAyMjcwMDU2NDQ4IiwidGVhbUlkIjoiMTU0MDg4NTU3MDYyNzA0NzQyNCIsInNvblRlYW1JZHMiOiIxNTQwODg1NTcwNjI3MDQ3NDI0IiwiZXhwIjoxNzEwNDk2NTQ1fQ.Sx2vGJcYGf98x99slQLU3vt7yWdjspptSpbUCcZgWek"; + + //齐越梧桐 + userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNjY1ODk1OTgzMzc4MDc1NjQ4IiwidGVhbUlkIjoiMTUxNjcxNTM3MjQ0NTcwMDA5NiIsInNvblRlYW1JZHMiOiIxNTQwODg1NTcwNjI3MDQ3NDI0LDE1MTY3MTUzNzI0NDU3MDAwOTYiLCJleHAiOjE3MjQyOTE2MDZ9.NG6wDqHJ5ozmEDcAt2duJ50IcGarygrQ2bmiP4TGNRE"; //齐越山鸡 - userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTM1MzMwMzI4ODkyMTQ5NzYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM2Mjg4NTAwMjM1MjQzNTIwIiwiZXhwIjoxNjk0NjY5NjkxfQ.cSwro-7bGwOu92YejH9JhMenTai7Mvf99i2paQCmxIw"; + //userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTM1MzMwMzI4ODkyMTQ5NzYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM2Mjg4NTAwMjM1MjQzNTIwIiwiZXhwIjoxNjk0NjY5NjkxfQ.cSwro-7bGwOu92YejH9JhMenTai7Mvf99i2paQCmxIw"; //刷单组测试 //userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTcxODUyODE0OTAzMTUyNjQwIiwidGVhbUlkIjoiMTU3MTg1MjQ1MDI5NjUwMDIyNCIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE2OTUxNDc2ODh9.hVupdHnhgHHGo3QrMSDqhINqtq6Q5_RovWyXjiMkkEs"; diff --git a/BBWY.Client/BBWYAppSettings.json b/BBWY.Client/BBWYAppSettings.json index 9622efaf..e1b3dcff 100644 --- a/BBWY.Client/BBWYAppSettings.json +++ b/BBWY.Client/BBWYAppSettings.json @@ -4,6 +4,6 @@ "MDSApiHost": "http://mdsapi.qiyue666.com", "JOSApiHost": "", "1688ApiHost": "", - //"QKApiHost": "http://localhost:8080" - "QKApiHost": "http://qiku.qiyue666.com" + "QKApiHost": "http://localhost:8080" + //"QKApiHost": "http://qiku.qiyue666.com" } \ No newline at end of file diff --git a/BBWY.Client/GlobalContext.cs b/BBWY.Client/GlobalContext.cs index 8fa55316..8facce1c 100644 --- a/BBWY.Client/GlobalContext.cs +++ b/BBWY.Client/GlobalContext.cs @@ -13,7 +13,7 @@ namespace BBWY.Client { ShopServiceGroupList = new List(); ShopServiceGroupLowerList = new List(); - ClientVersion = "10159"; + ClientVersion = "10173"; } private User user; diff --git a/BBWY.Client/Helpers/ImageHelper.cs b/BBWY.Client/Helpers/ImageHelper.cs new file mode 100644 index 00000000..e6762441 --- /dev/null +++ b/BBWY.Client/Helpers/ImageHelper.cs @@ -0,0 +1,43 @@ +using BBWY.Client.Extensions; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; + +namespace BBWY.Client.Helpers +{ + public static class ImageHelper + { + /// + /// 下载图片 + /// + /// + /// + private static async Task< BitmapImage> LoadImageAsync(string imageUrl) + { + try + { + + + using (HttpClient client = new HttpClient()) + { + // 发送 HTTP 请求并获取图片数据 + var uri = new Uri(Uri.EscapeUriString(imageUrl)); + byte[] imageData = await client.GetByteArrayAsync(uri); + // 创建 BitmapImage 对象并设置图片数据 + var LogoImage = imageData.ByteToBitmapImage(); + return LogoImage; + + } + } + catch (Exception ex) + { + // 处理加载图片失败的异常 + Console.WriteLine("加载图片失败:" + ex.Message); + } + return null; + } + } +} diff --git a/BBWY.Client/Models/APIModel/Response/Order/ExportOrderSkuResponse.cs b/BBWY.Client/Models/APIModel/Response/Order/ExportOrderSkuResponse.cs new file mode 100644 index 00000000..88b9ad7e --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/Order/ExportOrderSkuResponse.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; + +namespace BBWY.Client.Models +{ + public class ExportOrderSkuResponse + { + public string OrderId { get; set; } + + public DateTime? StartTime { get; set; } + + public long ShopId { get; set; } + + public string ShopName { get; set; } + + public string Spu { get; set; } + + public string Sku { get; set; } + + public StorageType? StorageType { get; set; } + + public decimal? PurchaseSkuAmount { get; set; } + + public decimal? PurchaseFreight { get; set; } + + public decimal? PurchaseAmount { get { return PurchaseSkuAmount + PurchaseFreight; } } + + public decimal? SkuPrice { get; set; } + + public int? ItemTotal { get; set; } + + public string SpuName { get; set; } + + public OrderState? OrderState { get; set; } + + /// + /// 平台补贴 + /// + public decimal? PreferentialAmount { get; set; } + + /// + /// 商家优惠金额 + /// + public decimal? SellerPreferentialAmount { get; set; } + + public override string ToString() + { + return $"{StartTime},{ShopName},{OrderId},{OrderState},{Spu},{Sku},{StorageType},{PurchaseAmount},{PreferentialAmount},{SellerPreferentialAmount},{SkuPrice},{ItemTotal},{SpuName}"; + } + } + + public class ExportOrderSkuListResponse + { + public long Count { get; set; } + + public IList ItemList { get; set; } + } +} diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/SearchStoreGetSelfResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/SearchStoreGetSelfResponse.cs new file mode 100644 index 00000000..eaad8a64 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PackTask/SearchStoreGetSelfResponse.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + public class SearchStoreGetSelfResponse + { + /// + /// 总条数 + /// + public int TotalCount { get; set; } + + /// + /// 商家自取记录列表 + /// + public List StoreGetSelfResponseList { get; set; } + + } + + /// + /// 单挑自取记录数据 + /// + public class StoreGetSelfData:NotifyObject + { + /// + /// 打包任务id + /// + public long TaskId { get; set; } + ///// + ///// 取货时间 + ///// + //public DateTime OperatorTime { get; set; } + + /// + /// 取货人 + /// + public string PickerUserName { get; set; } + + /// + /// 自取数量 + /// + public int StoreGetCount { get; set; } + + #region 任务信息 + + /// + /// 任务创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 店铺 + /// + public string ShopName { get; set; } + + /// + /// 团队 + /// + public string DepartmentName { get; set; } + /// + /// 商品sku + /// + public string SkuId { get; set; } + + /// + /// 图片 + /// + public string Logo { get; set; } + + /// + /// 商品sku标题名称 + /// + public string SkuName { get; set; } + + /// + /// 商品品名 + /// + public string BrandName { get; set; } + + #endregion + } +} diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/SearchWaitFallWareResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/SearchWaitFallWareResponse.cs index 19e76826..93f35947 100644 --- a/BBWY.Client/Models/APIModel/Response/PackTask/SearchWaitFallWareResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackTask/SearchWaitFallWareResponse.cs @@ -116,7 +116,12 @@ namespace BBWY.Client.Models.APIModel /// /// 封箱sku列表 /// - public List SealBoxSkus { get; set; } + private List sealBoxSkus; + + /// + /// 封箱sku列表 + /// + public List SealBoxSkus { get => sealBoxSkus; set { Set(ref sealBoxSkus, value); } } /// /// 封箱的箱子数量 diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/SearchWaitSealBoxResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/SearchWaitSealBoxResponse.cs index bcedf94a..6c08fd14 100644 --- a/BBWY.Client/Models/APIModel/Response/PackTask/SearchWaitSealBoxResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackTask/SearchWaitSealBoxResponse.cs @@ -67,7 +67,7 @@ namespace BBWY.Client.Models.APIModel public class SealBoxSku { - + public DateTime? CreateTime { get; set; } /// /// 任务Id /// diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/ShopTotalV2Response.cs b/BBWY.Client/Models/APIModel/Response/PackTask/ShopTotalV2Response.cs new file mode 100644 index 00000000..d577aa8c --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PackTask/ShopTotalV2Response.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel.Response.PackTask +{ + public class ShopTotalV2Response + { + /// + ///总量 + /// + public int TotalCount { get; set; } + /// + /// + /// + public List ShopTotals { get; set; } + } + public class ShopTotalV2 + { + /// + /// 任务id + /// + public long TaskId { get; set; } + /// + /// 完成打包时间日期 + /// + public DateTime? CreateTime { get; set; } + /// + /// 是否结清 + /// + public Settle IsSettle { get; set; } + /// + /// 部门 + /// + public string DepartmentName { get; set; } + /// + /// 店铺 + /// + public string ShopName { get; set; } + /// + /// 对接人 + /// + public string AcceptUserName { get; set; } + /// + /// sku标题 + /// + public string SkuName { get; set; } + /// + /// sku数量(任务数量) + /// + public int SkuCount { get; set; } + /// + /// 耗材费 + /// + public decimal ConsumableFees { get; set; } + /// + /// 到货数量 + /// + public int? ArrivalQuantity { get; set; } + /// + /// 打包费(原价) + /// + public decimal PackFees { get; set; } + /// + /// 折扣系数 + /// + public decimal? DiscountFactor { get; set; } + /// + /// 打包费用折扣价 + /// + public decimal? PackDisCountFees { get; set; } + ///// + ///// 折扣类型 + ///// + //public FeesMode? FeesMode { get; set; } + /// + /// 总费用 + /// + public decimal? AllFees { get; set; } + /// + /// 工序类型名称 + /// + public string ProcessTypeName { get; set; } + /// + /// 工序套餐名称 + /// + public string ProcessComboName { get; set; } + /// + /// 工序套餐单价 + /// + public decimal ProcessComboPrice { get; set; } + /// + /// 工序套餐任务量 + /// + public int ProcessComboTaskCount { get; set; } + + /// + /// 耗材服务数据 + /// + public List ConsumableList { get; set; } + } +} diff --git a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxResponse.cs b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxResponse.cs index a42d459d..cc19678e 100644 --- a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxResponse.cs @@ -67,6 +67,8 @@ namespace BBWY.Client.Models.APIModel public class WareSealBoxSku { + public DateTime? CreateTime { get; set; } + public TaskState TaskState { get; set; } /// /// 任务Id diff --git a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxWaitConfigureResponse.cs b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxWaitConfigureResponse.cs index aeb70a6b..e574e294 100644 --- a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxWaitConfigureResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareSealBoxWaitConfigureResponse.cs @@ -52,6 +52,8 @@ namespace BBWY.Client.Models.APIModel public class WareNoSealBoxSku { + public DateTime? CreateTime { get; set; } + /// /// 任务Id /// diff --git a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareWaitTransportResponse.cs b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareWaitTransportResponse.cs index 3577158a..14c466cb 100644 --- a/BBWY.Client/Models/APIModel/Response/SealBox/GetWareWaitTransportResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/SealBox/GetWareWaitTransportResponse.cs @@ -4,16 +4,18 @@ using System.Text; namespace BBWY.Client.Models.APIModel { - public class GetWareWaitTransportResponse + public class GetWareWaitTransportResponse : NotifyObject { /// /// 数量 /// public int TotalCount { get; set; } - public List WareWaitTransports { get; set; } + + private List wareWaitTransports; + public List WareWaitTransports { get => wareWaitTransports; set { Set(ref wareWaitTransports, value); } } } - public class WareWaitTransport:NotifyObject + public class WareWaitTransport : NotifyObject { private string transportOverTimeMarkMsg; @@ -60,15 +62,18 @@ namespace BBWY.Client.Models.APIModel /// public string AcceptUserNames { get; set; } - /// /// sku列表 /// - public List WaitTransportSkus { get; set; } + private List waitTransportSkus; + /// + /// sku列表 + /// + public List WaitTransportSkus { get => waitTransportSkus; set { Set(ref waitTransportSkus, value); } } } public class WaitTransportSku { - + public DateTime? CreateTime { get; set; } ///// ///// 任务状态 ///// diff --git a/BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs b/BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs index 39369161..c4576a9b 100644 --- a/BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs +++ b/BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs @@ -33,7 +33,7 @@ namespace BBWY.Client.Models public ObservableCollection WorryList { get => worryList; set { Set(ref worryList, value); } } private ObservableCollection positionTypeList = new ObservableCollection { - "商家仓","云仓", "京仓","聚水潭齐越仓"}; + "商家仓","云仓", "京仓","聚水潭"}; public ObservableCollection PositionTypeList { get => positionTypeList; set { Set(ref positionTypeList, value); } } private ObservableCollection packTypeList = new ObservableCollection { @@ -60,10 +60,10 @@ namespace BBWY.Client.Models }; public ObservableCollection CertificatePositionList { get => certificatePositionList; set { Set(ref certificatePositionList, value); } } - private ObservableCollection availabilityList = new ObservableCollection { - "已到货","部分到货","未到货" - }; - public ObservableCollection AvailabilityList { get => availabilityList; set { Set(ref availabilityList, value); } } + //private ObservableCollection availabilityList = new ObservableCollection { + // "已到货","部分到货","未到货" + // }; + //public ObservableCollection AvailabilityList { get => availabilityList; set { Set(ref availabilityList, value); } } private int skuCount; /// @@ -120,11 +120,11 @@ namespace BBWY.Client.Models ///// //public Worry IsWorry { get => isWorry; set { Set(ref isWorry, value); } } - private Availability availability; - /// - /// 到货情况(待收货=0,部分收货=1,已到货=2) - /// - public Availability Availability { get => availability; set { Set(ref availability, value); } } + //private Availability availability; + ///// + ///// 到货情况(待收货=0,部分收货=1,已到货=2) + ///// + //public Availability Availability { get => availability; set { Set(ref availability, value); } } private PackType packType; /// diff --git a/BBWY.Client/Models/Enums.cs b/BBWY.Client/Models/Enums.cs index 1398e4e4..e1dc1816 100644 --- a/BBWY.Client/Models/Enums.cs +++ b/BBWY.Client/Models/Enums.cs @@ -225,7 +225,7 @@ 未到货 = 0, 部分到货 = 1, 待验收 = 2,//已到货 - 待打包 = 3, + 待包装 = 3, 待封箱 = 4, 待出库 = 5, 已完成 = 6, @@ -266,7 +266,7 @@ 商家仓 = 0, 云仓 = 1, 京仓 = 2, - 聚水潭齐越仓 = 3 + 聚水潭 = 3 } /// /// 合格证包装位置 @@ -463,7 +463,7 @@ } public enum WareType { - 京仓 = 0, 云仓 = 1, 商家仓 = 2, 聚水潭齐越仓 = 3 + 京仓 = 0, 云仓 = 1, 商家仓 = 2, 聚水潭 = 3 } public enum FeesMode { @@ -554,4 +554,11 @@ 需修改 = 2 } + + public enum QualityLookState + { + + } + + } diff --git a/BBWY.Client/Models/PackTask/CertificateModel.cs b/BBWY.Client/Models/PackTask/CertificateModel.cs index 90fe2664..30981c69 100644 --- a/BBWY.Client/Models/PackTask/CertificateModel.cs +++ b/BBWY.Client/Models/PackTask/CertificateModel.cs @@ -134,11 +134,11 @@ namespace BBWY.Client.Models - private long goodsNumber = 1; + private long? goodsNumber = 1; /// /// 配件序号 /// - public long GoodsNumber { get => goodsNumber; set { Set(ref goodsNumber, value); } } + public long? GoodsNumber { get => goodsNumber; set { Set(ref goodsNumber, value); } } diff --git a/BBWY.Client/Models/PackTask/PackTaskModel.cs b/BBWY.Client/Models/PackTask/PackTaskModel.cs index 00884eed..7bc93642 100644 --- a/BBWY.Client/Models/PackTask/PackTaskModel.cs +++ b/BBWY.Client/Models/PackTask/PackTaskModel.cs @@ -428,11 +428,14 @@ namespace BBWY.Client.Models /// public string ScheduleOverTimeMarkMsg { get; set; } - /// /// 物流信息 /// - public List ExpressOrderList { get; set; } + private List expressOrderList; + /// + /// 物流信息 + /// + public List ExpressOrderList { get => expressOrderList; set { Set(ref expressOrderList, value); } } /// /// 需求方店铺id diff --git a/BBWY.Client/Models/PackTask/SealBoxModel.cs b/BBWY.Client/Models/PackTask/SealBoxModel.cs index 27915440..c064e1bb 100644 --- a/BBWY.Client/Models/PackTask/SealBoxModel.cs +++ b/BBWY.Client/Models/PackTask/SealBoxModel.cs @@ -44,7 +44,12 @@ namespace BBWY.Client.Models.PackTask /// /// 封箱sku列表 /// - public List SealBoxSkus { get; set; } + private List sealBoxSkus; + + /// + /// 封箱sku列表 + /// + public List SealBoxSkus { get => sealBoxSkus; set { Set(ref sealBoxSkus, value); } } /// /// 封箱数 diff --git a/BBWY.Client/Models/PackTask/ShopTotal.cs b/BBWY.Client/Models/PackTask/ShopTotal.cs index 754c454b..40dfcb09 100644 --- a/BBWY.Client/Models/PackTask/ShopTotal.cs +++ b/BBWY.Client/Models/PackTask/ShopTotal.cs @@ -1,4 +1,5 @@ -using BBWY.Client.ViewModels; +using BBWY.Client.Models.APIModel.Response.PackTask; +using BBWY.Client.ViewModels; using System; using System.Collections.Generic; using System.Text; @@ -7,23 +8,29 @@ namespace BBWY.Client.Models.PackTask { public class ShopTotal :NotifyObject { + + private FeesItemResponse feesItemResponse; + + public FeesItemResponse FeesItemResponse { get => feesItemResponse; set { Set(ref feesItemResponse, value); } } + + private long id; public long Id { get => id; set { Set(ref id, value); } } private bool taskChecked; public bool TaskChecked { get => taskChecked; set { Set(ref taskChecked, value); } } - - + /// + /// 任务id + /// public long TaskId { get; set; } /// - /// 需求方创建日期 + /// 完成打包时间日期 /// - public DateTime CreateTime { get; set; } + public DateTime? CreateTime { get; set; } /// /// 是否结清 /// - // public Settle IsSettle { get; set; } /// /// 部门 @@ -38,101 +45,67 @@ namespace BBWY.Client.Models.PackTask /// public string AcceptUserName { get; set; } /// - /// sku + /// sku标题 /// public string SkuName { get; set; } /// /// sku数量(任务数量) /// public int SkuCount { get; set; } - - public decimal IncreaseFees { get; set; } - - public decimal PackFees { get; set; } - - public decimal ConsumableFees { get; set; } - - // public decimal Price { get; set; } - - //public decimal Discount { get; set; } - - public decimal DiscountPrice { get; set; } - /// - /// 注意事项(对接备注) - /// - public string MarkMessage { get; set; } - - /// - /// 打包单价 - /// - public decimal? PackSingleFees { get; set; } - /// - /// 打包费用 + /// 耗材费 /// - //public decimal? PackAllFees { get; set; } - - /// - /// 箱子费用 - /// - public decimal? BoxConsumableFees { get; set; } - /// - /// 气泡纸耗材费 - /// - public decimal? AirConsumableFees { get; set; } + public decimal ConsumableFees { get; set; } /// - /// 胶带耗材费 + /// 到货数量 /// - public decimal? TapeConsumableFees { get; set; } + public int? ArrivalQuantity { get; set; } /// - /// 其他耗材费 + /// 打包费(原价) /// - public decimal? OtherConsumableFees { get; set; } - - - + public decimal PackFees { get; set; } /// /// 折扣系数 /// public decimal? DiscountFactor { get; set; } /// - /// 到货数量 + /// 打包费用折扣价 /// - public int? ArrivalQuantity { get; set; } - + public decimal? PackDisCountFees { get; set; } + ///// + ///// 折扣类型 + ///// + //public FeesMode? FeesMode { get; set; } /// - /// 基础价格(基础包装费、仅贴码) + /// 总费用 /// - public decimal? BasicPrice { get; set; } + public decimal? AllFees { get; set; } /// - /// 增量价格 + /// 工序类型名称 /// - public decimal? IncrementPartPrice { get; set; } + public string ProcessTypeName { get; set; } /// - /// 增量工序价 + /// 工序套餐名称 /// - public decimal? IncrementProcessPrice { get; set; } - + public string ProcessComboName { get; set; } /// - /// 折扣类型 + /// 工序套餐单价 /// - public FeesMode? FeesMode { get; set; } - + public decimal ProcessComboPrice { get; set; } /// - /// 总费用 + /// 工序套餐任务量 /// - public decimal? AllFees { get; set; } + public int ProcessComboTaskCount { get; set; } /// - /// 打包费用折扣价 + /// 耗材服务数据 /// - public decimal? PackDisCountFees { get; set; } - + public List ConsumableList { get; set; } + // string title = "任务ID,日期,是否结清,所属部门,所属店铺,包装数量,收货数量,耗材总价,工序类型,工序套餐,工序单价,打包原价,打包折扣系数,打包折扣价,总收费"; public override string ToString() { - - return $"{TaskId},{CreateTime.ToString("MM-dd")},{IsSettle},{DepartmentName},{ShopName}" + - $",{SkuCount},{BoxConsumableFees},{AirConsumableFees},{TapeConsumableFees},{OtherConsumableFees},{ConsumableFees},{ArrivalQuantity},{BasicPrice},{IncrementPartPrice},{IncrementProcessPrice},{PackSingleFees},{PackFees},{FeesMode},{DiscountFactor},{PackDisCountFees},{IncreaseFees},{AllFees}"; + return $"{TaskId},{CreateTime?.ToString("MM-dd")},{IsSettle},{DepartmentName},{ShopName}" + + $",{SkuCount},{ArrivalQuantity},{ConsumableFees},{ProcessTypeName},{ProcessComboName},{ProcessComboPrice},{PackFees},{DiscountFactor},{PackDisCountFees},{AllFees}"; } } @@ -144,5 +117,15 @@ namespace BBWY.Client.Models.PackTask public int TotalCount { get; set; } public ShopTotal[] ShopTotals { get; set; } + + /// + /// 总打包费用 + /// + public decimal TotalPackDiscountFees { get; set; } + + /// + /// 总耗材费 + /// + public decimal TotalConsumableFees { get; set; } } } diff --git a/BBWY.Client/Models/PackTask/StoreGetSelfResponse.cs b/BBWY.Client/Models/PackTask/StoreGetSelfResponse.cs new file mode 100644 index 00000000..ad6336d7 --- /dev/null +++ b/BBWY.Client/Models/PackTask/StoreGetSelfResponse.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; + +namespace BBWY.Client.Models.PackTask +{ + public class StoreGetSelfResponse:NotifyObject + { /// + /// 团队用户列表(取件人) + /// + private ObservableCollection departmentUsers; + + /// + /// 团队用户列表(取件人) + /// + public ObservableCollection DepartmentUsers { get=> departmentUsers; set { Set(ref departmentUsers, value); } } + + /// + /// 可取的最大数 + /// + public int PickMaxCount { get; set; } + + /// + /// 提示消息 + /// + public string ShowMessage { get; set; } + } + public class DepartmentUser:NotifyObject + { + /// + /// 用户id + /// + public string UserId { get; set; } + + + + + private string userName; + /// + /// 名称 + /// + public string UserName { get => userName; set { Set(ref userName, value); } } // + } +} diff --git a/BBWY.Client/Models/Product/ProductSku.cs b/BBWY.Client/Models/Product/ProductSku.cs index ab10cce1..c1015cea 100644 --- a/BBWY.Client/Models/Product/ProductSku.cs +++ b/BBWY.Client/Models/Product/ProductSku.cs @@ -26,7 +26,6 @@ namespace BBWY.Client.Models /// 采购方案 /// public IList PurchaseSchemeList { get; set; } - /// /// 采购订单 /// diff --git a/BBWY.Client/Models/SealBox/SealBoxConfigureModel.cs b/BBWY.Client/Models/SealBox/SealBoxConfigureModel.cs index bf1b757a..b0a12b40 100644 --- a/BBWY.Client/Models/SealBox/SealBoxConfigureModel.cs +++ b/BBWY.Client/Models/SealBox/SealBoxConfigureModel.cs @@ -2,36 +2,65 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Text; +using System.Windows; namespace BBWY.Client.Models.SealBox { + + /// + /// 待配置 + /// public class SealBoxConfigureModel : NotifyObject { - - /// /// skuid /// public string SkuId { get; set; } + + /// + /// sku标题 + /// + public string SkuName { get; set; } /// /// 任务id /// public long TaskId { get; set; } + + /// + /// 任务状态 + /// + private TaskState? taskState; + /// + /// 任务状态 + /// + public TaskState? TaskState { get => taskState; set { Set(ref taskState, value); } } + + + private int skuCount; /// /// sku任务数 /// - public int SkuCount { get; set; } + public int SkuCount { get => skuCount; set { Set(ref skuCount, value); } } + + private int waitConfigureCount; /// - /// sku图片 + /// 待分配数量 /// - public string Logo { get; set; } + public int WaitConfigureCount + { + get + { + return waitConfigureCount; + } + set { Set(ref waitConfigureCount, value); } + } - private int splitCount; /// - /// 份数 + /// sku图片 /// - public int SplitCount { get=>splitCount; set {Set(ref splitCount,value); } } + public string Logo { get; set; } + private ObservableCollection wareHourseDatas = new ObservableCollection(); /// @@ -39,19 +68,48 @@ namespace BBWY.Client.Models.SealBox /// public ObservableCollection WareHourseDatas { get => wareHourseDatas; set { Set(ref wareHourseDatas, value); } } + + private WareType? wareType; + + public WareType? WareType { get => wareType; set { Set(ref wareType, value); } } } + + + + + + /// /// 封箱配置 装箱配置 /// public class SealBoxConfigureWareHourseModel : NotifyObject { - private int index; + public long TaskId { get; set; } - public int Index { get => index; set { Set(ref index, value); } } + public Action TotalWareCount { get; set; } private int count; - public int Count { get=>count; set {Set(ref count,value); } } + public int Count + { + get => count; set + { + Set(ref count, value); + OnCountChanged(); + } + } + + private void OnCountChanged() + { + + if (Count<0) + { + MessageBox.Show("数量不能为负数"); + return; + } + + if (TotalWareCount != null) TotalWareCount(Count, TaskId); + } private string wareId; @@ -63,21 +121,21 @@ namespace BBWY.Client.Models.SealBox public string WareName { get => wareName; set { Set(ref wareName, value); } } - private WareType? wareType; - - public WareType? WareType { get => wareType; set { Set(ref wareType, value); } } + private PositionState? wareState; /// - ///待封箱 = 0, 待落仓 = 1, 待完结 = 2 + ///待封箱 = 0, 待落仓 = 1, 待落仓已配置 = 2,待完结=3 /// - public PositionState? WareState { get; set; } + public PositionState? WareState { get => wareState; set { Set(ref wareState, value); } } /// ///封箱id /// public long? SealBoxId { get; set; } + //private WareType? wareType; + //public WareType? WareType { get => wareType; set { Set(ref wareType, value); } } } } diff --git a/BBWY.Client/Models/SealBox/SealBoxWaitConfigureModel.cs b/BBWY.Client/Models/SealBox/SealBoxWaitConfigureModel.cs index 0508740c..0e1db8a5 100644 --- a/BBWY.Client/Models/SealBox/SealBoxWaitConfigureModel.cs +++ b/BBWY.Client/Models/SealBox/SealBoxWaitConfigureModel.cs @@ -27,15 +27,13 @@ namespace BBWY.Client.Models /// public string Logo { get; set; } /// - /// 预计完成时间 - /// - public DateTime? PreCompletedTime { get; set; } - /// /// 任务状态 /// public TaskState? TaskState { get; set; } public string BrandName { get; set; } + public WareType? WareType { get; set; } + } } diff --git a/BBWY.Client/Models/SealBox/WareNoSealBoxModel.cs b/BBWY.Client/Models/SealBox/WareNoSealBoxModel.cs index 94e1dab4..2f1deee5 100644 --- a/BBWY.Client/Models/SealBox/WareNoSealBoxModel.cs +++ b/BBWY.Client/Models/SealBox/WareNoSealBoxModel.cs @@ -31,6 +31,11 @@ namespace BBWY.Client.Models /// /// 封箱sku列表 /// - public List SealBoxSkus { get; set; } + private List sealBoxSkus; + + /// + /// 封箱sku列表 + /// + public List SealBoxSkus { get=> sealBoxSkus; set {Set(ref sealBoxSkus, value); } } } } diff --git a/BBWY.Client/Models/Shop/Shop.cs b/BBWY.Client/Models/Shop/Shop.cs index 0ebec5fa..b35a35df 100644 --- a/BBWY.Client/Models/Shop/Shop.cs +++ b/BBWY.Client/Models/Shop/Shop.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; namespace BBWY.Client.Models { @@ -7,7 +8,19 @@ namespace BBWY.Client.Models private bool isSelected; private string shopName; - public bool IsSelected { get => isSelected; set { Set(ref isSelected, value); } } + public bool IsSelected + { + get => isSelected; set + { + if (Set(ref isSelected, value)) + { + OnIsSelectedChanged?.Invoke(); + } + } + } + + public Action OnIsSelectedChanged { get; set; } + /// /// 店铺Id /// diff --git a/BBWY.Client/ViewModels/BatchPurchase/BatchPublishTaskViewModel.cs b/BBWY.Client/ViewModels/BatchPurchase/BatchPublishTaskViewModel.cs index fdfd6fd1..53f61bbb 100644 --- a/BBWY.Client/ViewModels/BatchPurchase/BatchPublishTaskViewModel.cs +++ b/BBWY.Client/ViewModels/BatchPurchase/BatchPublishTaskViewModel.cs @@ -83,14 +83,14 @@ namespace BBWY.Client.ViewModels Logo = task.Logo, SkuName = task.SkuName, BrandName = task.BrandName, - Availability = (int)task.Availability, + //Availability = (int)task.Availability, BasicPack = (int)task.BasicPack, SkuId = task.SkuId, CreateTime = DateTime.Now, Increment1 = increateStr, CertificatePosition = (int)task.CertificatePosition, PackType = (int)task.PackType, - MarkMessage = task.MarkMessage, + //MarkMessage = task.MarkMessage, PositionType = (int)task.PositionType, GoodsNumber = task.GoodsNumber, SkuGoodsTitle = task.SkuTitle, diff --git a/BBWY.Client/ViewModels/MainViewModel.cs b/BBWY.Client/ViewModels/MainViewModel.cs index bb5c3dcc..125c3228 100644 --- a/BBWY.Client/ViewModels/MainViewModel.cs +++ b/BBWY.Client/ViewModels/MainViewModel.cs @@ -123,7 +123,7 @@ namespace BBWY.Client.ViewModels /// private void CreateMenu() { - if (this.packDepartment.Contains(GlobalContext.User.TeamName)) + if (this.packDepartment.Contains(GlobalContext.User.TeamName) || packDepartment.Any(m => GlobalContext.User.SonDepartmentNames.Contains(m))) { App.Current.Dispatcher.Invoke(() => @@ -133,7 +133,7 @@ namespace BBWY.Client.ViewModels Name = "齐库仓库端", ChildList = new List() { - new MenuModel(){ Name="打包任务",Url="/Views/PackTask/WareHouseList.xaml" }, + new MenuModel(){ Name="包装任务",Url="/Views/PackTask/WareHouseList.xaml" }, new MenuModel(){ Name="耗材管理",Url="/Views/PackTask/Consumable.xaml" }, new MenuModel(){ Name="账单管理",Url="/Views/PackTask/PackTaskTotal.xaml" }, new MenuModel(){ Name="收益账单",Url="/Views/TotalPackTask/PackUserSalaryList.xaml" } @@ -196,6 +196,7 @@ namespace BBWY.Client.ViewModels ChildList = new List() { new MenuModel(){ Name="发布任务",Url="/Views/PackTask/TaskList.xaml" }, + new MenuModel(){ Name="包装账单",Url="/Views/TotalPackTask/ShopPackTaskTotal.xaml" }, } @@ -213,7 +214,7 @@ namespace BBWY.Client.ViewModels Name = "齐库仓库端", ChildList = new List() { - new MenuModel(){ Name="打包任务",Url="/Views/PackTask/WareHouseList.xaml" }, + new MenuModel(){ Name="包装任务",Url="/Views/PackTask/WareHouseList.xaml" }, new MenuModel(){ Name="耗材管理",Url="/Views/PackTask/Consumable.xaml" }, new MenuModel(){ Name="账单管理",Url="/Views/PackTask/PackTaskTotal.xaml" }, new MenuModel(){ Name="收益账单",Url="/Views/TotalPackTask/PackUserSalaryList.xaml" } @@ -227,7 +228,8 @@ namespace BBWY.Client.ViewModels ChildList = new List() { new MenuModel(){ Name="采购审计",Url="/Views/FinancialTerminal/ProcurementAudit.xaml" }, - new MenuModel(){ Name="费用矫正",Url="/Views/BillCorrection/BillCorrectionView.xaml" } + new MenuModel(){ Name="费用矫正",Url="/Views/BillCorrection/BillCorrectionView.xaml" }, + new MenuModel(){ Name="订单导出",Url="/Views/Order/ExportOrderSkuView.xaml" } } })); } @@ -275,10 +277,8 @@ namespace BBWY.Client.ViewModels CreateMenu(); - - IList departmentList = null; - if (GlobalContext.User.TeamName == "刷单组" || this.packDepartment.Contains(GlobalContext.User.TeamName) || + if (GlobalContext.User.TeamName == "刷单组" || this.packDepartment.Contains(GlobalContext.User.TeamName) || packDepartment.Any(m => GlobalContext.User.SonDepartmentNames.Contains(m)) || managerDepartment.Contains(GlobalContext.User.TeamName) || managerDepartment.Any(m => GlobalContext.User.SonDepartmentNames.Contains(m))) { diff --git a/BBWY.Client/ViewModels/Order/ExportOrderSkuViewModel.cs b/BBWY.Client/ViewModels/Order/ExportOrderSkuViewModel.cs new file mode 100644 index 00000000..62ce2f87 --- /dev/null +++ b/BBWY.Client/ViewModels/Order/ExportOrderSkuViewModel.cs @@ -0,0 +1,223 @@ +using BBWY.Client.APIServices; +using BBWY.Client.Models; +using BBWY.Common.Models; +using BBWY.Controls; +using GalaSoft.MvvmLight.Command; +using Microsoft.Win32; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Input; + +namespace BBWY.Client.ViewModels +{ + public class ExportOrderSkuViewModel : BaseVM, IDenpendency + { + private DateTime startDate; + private DateTime endDate; + + private GlobalContext globalContext; + private KVModel selectedPlatform; + private int pageIndex; + private int pageSize; + private long totalCount; + private bool isLoading; + private bool isShowAll_Shop; + private bool isShowAll_Department; + + private OrderService orderService; + + public IList DepartmentList { get; set; } + + public IList ShopList { get; set; } + + public IList PlatformList { get; set; } + + public IList ExportSkuList { get; set; } + + public DateTime StartDate { get => startDate; set { Set(ref startDate, value); } } + public DateTime EndDate { get => endDate; set { Set(ref endDate, value); } } + + public KVModel SelectedPlatform { get => selectedPlatform; set { Set(ref selectedPlatform, value); } } + + public ICommand SearchCommand { get; set; } + + public ICommand ExportCommand { get; set; } + + public ICommand OrderPageIndexChangedCommand { get; set; } + + public int PageIndex { get => pageIndex; set { Set(ref pageIndex, value); } } + public int PageSize { get => pageSize; set { Set(ref pageSize, value); } } + + public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } + + public long TotalCount { get => totalCount; set { Set(ref totalCount, value); } } + + public bool IsShowAll_Shop { get => isShowAll_Shop; set { Set(ref isShowAll_Shop, value); } } + + public bool IsShowAll_Department { get => isShowAll_Department; set { Set(ref isShowAll_Department, value); } } + + public ExportOrderSkuViewModel(GlobalContext globalContext, OrderService orderService) + { + this.orderService = orderService; + + DepartmentList = new ObservableCollection(); + ShopList = new ObservableCollection(); + PlatformList = new ObservableCollection(); + ExportSkuList = new ObservableCollection(); + SearchCommand = new RelayCommand(Search); + ExportCommand = new RelayCommand(Export); + OrderPageIndexChangedCommand = new RelayCommand(p => + { + //this.PageIndex = p.PageIndex; + Task.Factory.StartNew(() => SearchCore(p.PageIndex)); + }); + + var platformEnumValues = Enum.GetValues(typeof(Platform)); + foreach (var ev in platformEnumValues) + { + var p = (Platform)ev; + PlatformList.Add(new KVModel() + { + Key = p.ToString(), + Value = ((int)p).ToString() + }); + } + IsShowAll_Department = IsShowAll_Shop = true; + this.globalContext = globalContext; + LoadDepartment(); + StartDate = DateTime.Now.Date; + EndDate = DateTime.Now.Date; + PageIndex = 1; + PageSize = 20; + } + + private void LoadDepartment() + { + var dlist = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(globalContext.User.DepartmentList)); + foreach (var d in dlist) + { + d.IsSelected = false; + DepartmentList.Add(d); + d.OnIsSelectedChanged = OnDeparmentSelectionChanged; + } + ShopList.Clear(); + } + + private void OnDeparmentSelectionChanged() + { + ShopList.Clear(); + foreach (var d in DepartmentList) + { + if (!d.IsSelected) + continue; + foreach (var s in d.ShopList) + { + s.OnIsSelectedChanged = OnShopSelectionChanged; + s.IsSelected = false; + ShopList.Add(s); + } + } + IsShowAll_Department = !DepartmentList.Any(d => d.IsSelected); + } + + private void OnShopSelectionChanged() + { + IsShowAll_Shop = !ShopList.Any(s => s.IsSelected); + } + + private void Search() + { + PageIndex = 1; + Task.Factory.StartNew(() => SearchCore(PageIndex)); + } + + private void SearchCore(int pageIndex) + { + IsLoading = true; + int? purchasePlatform = null; + if (SelectedPlatform != null) + purchasePlatform = int.Parse(SelectedPlatform.Value); + List shopIds = new List(); + if (ShopList.Count() > 0) + { + if (ShopList.Any(s => s.IsSelected)) + shopIds.AddRange(ShopList.Where(s => s.IsSelected).Select(s => s.ShopId)); + else + shopIds.AddRange(ShopList.Select(s => s.ShopId)); + } + var response = orderService.QueryOrderSkuList(StartDate, + EndDate, + purchasePlatform, + shopIds, + pageIndex, + PageSize); + IsLoading = false; + TotalCount = 0; + if (!response.Success) + { + App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "提示")); + return; + } + TotalCount = response.Data.Count; + App.Current.Dispatcher.Invoke(() => + { + ExportSkuList.Clear(); + foreach (var item in response.Data.ItemList) + ExportSkuList.Add(item); + }); + + } + + private void Export() + { + var sfd = new SaveFileDialog() { Filter = "csv files(*.csv)|*.csv" }; + if (sfd.ShowDialog() != true) + return; + + var ssaveFileName = sfd.FileName; + + int? purchasePlatform = null; + if (SelectedPlatform != null) + purchasePlatform = int.Parse(SelectedPlatform.Value); + IsLoading = true; + Task.Factory.StartNew(() => orderService.ExportOrderSkuList(StartDate, + EndDate, + purchasePlatform, + ShopList.Where(s => s.IsSelected).Select(s => s.ShopId).ToList())).ContinueWith(t => + { + var response = t.Result; + + if (!response.Success) + { + IsLoading = false; + App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "提示")); + return; + } + + try + { + var list = response.Data.Select(x => x.ToString()).ToList(); + list.Insert(0, "开始时间,店铺名称,订单Id,订单状态,SPU,SKU,仓储类型,采购成本(货款+运费),平台优惠,商家优惠,单价,数量,商品标题"); + System.IO.File.WriteAllLines(ssaveFileName, list, Encoding.UTF8); + App.Current.Dispatcher.Invoke(() => MessageBox.Show("导出完成", "导出")); + } + catch (Exception ex) + { + App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "导出")); + return; + } + finally + { + IsLoading = false; + } + }); + + } + } +} diff --git a/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs index 702a2460..ebf37214 100644 --- a/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs @@ -35,7 +35,7 @@ namespace BBWY.Client.ViewModels.PackTask public ObservableCollection WorryList { get => worryList; set { Set(ref worryList, value); } } private ObservableCollection positionTypeList = new ObservableCollection { - "商家仓","云仓", "京仓","聚水潭齐越仓"}; + "商家仓","云仓", "京仓","聚水潭"}; public ObservableCollection PositionTypeList { get => positionTypeList; set { Set(ref positionTypeList, value); } } private ObservableCollection packTypeList = new ObservableCollection { diff --git a/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs b/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs index c2c23284..9406456e 100644 --- a/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs @@ -906,12 +906,13 @@ namespace BBWY.Client.ViewModels.PackTask /// private void UpLoadPack(object obj) { - if (ProcessTaskCount > TaskCount) + if (PackUserModelList==null|| PackUserModelList.Count<=0) { - System.Windows.MessageBox.Show($"工序任务数:{ProcessTaskCount}不能超过打包总任务数:{TaskCount}"); + System.Windows.MessageBox.Show("信息不完整,打包人设置有误"); return; } + if (PackUserModelList != null && PackUserModelList.Count > 0) { if (PackUserModelList.Any(p => p.SelectUserId.IsNullOrEmpty() || p.TaskCount <= 0)) diff --git a/BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs b/BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs index e6911d84..a4a53ef8 100644 --- a/BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs @@ -18,6 +18,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; +using WebSocketSharp; namespace BBWY.Client.ViewModels.PackTask { @@ -56,7 +57,24 @@ namespace BBWY.Client.ViewModels.PackTask public int PageSize { get => pageSize; set { Set(ref pageSize, value); } } public int OrderCount { get => orderCount; set { Set(ref orderCount, value); } } - + + private decimal totalPackDiscountFees; + /// + /// 总打包费用 + /// + public decimal TotalPackDiscountFees { get => totalPackDiscountFees; set { Set(ref totalPackDiscountFees, value); } } + + private decimal totalConsumableFees; + /// + /// 总耗材费 + /// + public decimal TotalConsumableFees { get => totalConsumableFees; set { Set(ref totalConsumableFees, value); } } + + private decimal totalFees; + /// + /// 总耗材费 + /// + public decimal TotalFees { get => totalFees; set { Set(ref totalFees, value); } } public ICommand SetSearchDateCommand { get; set; } @@ -107,7 +125,7 @@ namespace BBWY.Client.ViewModels.PackTask SearchTaskTotal(); } - + private void Export() { @@ -125,12 +143,12 @@ namespace BBWY.Client.ViewModels.PackTask Task.Factory.StartNew(() => { IsLoading = true; - var res = packTaskService.ShopTotal(SearchSkuId, SearchTaskId, StartDate, EndDate, SearchShopName, + var res = packTaskService.ShopTotalV2(SearchSkuId, SearchTaskId, null, StartDate, EndDate, SearchShopName, SearchDepartment, 0, 0);//获取全部数据 if (res.Success) { //string title = "任务ID,日期,是否结清,部门,店铺,对接人,sku名称,sku数量,增值服务,打包服务,耗材服务,原价,促销折扣,结算价格,对接备注"; - string title = "任务ID,日期,是否结清,所属部门,所属店铺,打包数量,箱子,气泡纸,胶带,其他,耗材总价,收货数量,基础价格,增量配件价,增量工序价格,打包单价,打包原价,收费方式,打包折扣系数,打包折扣价,增值费用,总收费"; + string title = "任务ID,日期,是否结清,所属部门,所属店铺,包装数量,收货数量,耗材总价,工序类型,工序套餐,工序单价,包装原价,包装折扣系数,包装折扣价,总收费"; var excelList = res.Data.ShopTotals.Select(x => x.ToString()).ToList(); excelList.Insert(0, title); System.IO.File.WriteAllLines(fileName, excelList, Encoding.UTF8); @@ -196,18 +214,36 @@ namespace BBWY.Client.ViewModels.PackTask private void SearchTaskTotal() { - + PackTaskTotalList = new ObservableCollection(); Task.Factory.StartNew(() => { IsLoading = true; - var res = packTaskService.ShopTotal(SearchSkuId, SearchTaskId, StartDate, EndDate, SearchShopName, + var res = packTaskService.ShopTotalV2(SearchSkuId, SearchTaskId, null, StartDate, EndDate, SearchShopName, SearchDepartment, PageIndex, PageSize); if (res != null && res.Success) { OrderCount = res.Data.TotalCount; + TotalConsumableFees = res.Data.TotalConsumableFees; + TotalPackDiscountFees = res.Data.TotalPackDiscountFees; + TotalFees = TotalConsumableFees + TotalPackDiscountFees; foreach (var shopTotal in res.Data.ShopTotals) { + if (!shopTotal.ProcessComboName.IsNullOrEmpty()) + shopTotal.FeesItemResponse = new Models.APIModel.Response.PackTask.FeesItemResponse + { + AllFees = shopTotal.AllFees.Value, + PackFees=shopTotal.PackDisCountFees.Value, + TaskId = shopTotal.TaskId, + ProcessTypeName = shopTotal.ProcessTypeName, + ProcessComboName = shopTotal.ProcessComboName, + ConsumableFees =shopTotal.ConsumableFees, + ConsumableList = shopTotal.ConsumableList, + ProcessComboPrice = shopTotal.ProcessComboPrice, + ProcessComboTaskCount = shopTotal.ProcessComboTaskCount, + DiscountFoctor = shopTotal.DiscountFactor + }; + App.Current.Dispatcher.Invoke(() => { PackTaskTotalList.Add(shopTotal); diff --git a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs index 1acce909..12b059d0 100644 --- a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs @@ -42,7 +42,7 @@ namespace BBWY.Client.ViewModels.PackTask public ObservableCollection WorryList { get => worryList; set { Set(ref worryList, value); } } private ObservableCollection positionTypeList = new ObservableCollection { - "商家仓","云仓", "京仓","聚水潭齐越仓"}; + "商家仓","云仓", "京仓","聚水潭"}; public ObservableCollection PositionTypeList { get => positionTypeList; set { Set(ref positionTypeList, value); } } private ObservableCollection packTypeList = new ObservableCollection { @@ -145,7 +145,7 @@ namespace BBWY.Client.ViewModels.PackTask private PositionType positionType; /// - /// 落仓(商家仓=0,云仓=1,京仓=2,聚水潭齐越仓=3) + /// 落仓(商家仓=0,云仓=1,京仓=2,聚水潭=3) /// public PositionType PositionType { get => positionType; set { Set(ref positionType, value); } } @@ -552,6 +552,7 @@ namespace BBWY.Client.ViewModels.PackTask IsNeedCertificateModel = config.NeedCer ? Need.需要 : Need.不需要; IsSetBarCode = !config.NeedBar; bool isSelected = false; + IncreateList = new ObservableCollection(); foreach (var item in increates) { isSelected = false; diff --git a/BBWY.Client/ViewModels/PackTask/StorePickSelfViewModel.cs b/BBWY.Client/ViewModels/PackTask/StorePickSelfViewModel.cs new file mode 100644 index 00000000..0ce4ca24 --- /dev/null +++ b/BBWY.Client/ViewModels/PackTask/StorePickSelfViewModel.cs @@ -0,0 +1,11 @@ +using BBWY.Common.Models; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.ViewModels.PackTask +{ + public class StorePickSelfViewModel:BaseVM,IDenpendency + { + } +} diff --git a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs index e6d58a6a..d477608a 100644 --- a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs @@ -237,9 +237,15 @@ namespace BBWY.Client.ViewModels.PackTask public ObservableCollection PackTaskList { get => packTaskList; set { Set(ref packTaskList, value); } } #endregion + private ObservableCollection storeGetSelfDataList; + /// + /// 商家自取记录任务列表 + /// + public ObservableCollection StoreGetSelfDataList { get => storeGetSelfDataList; set { Set(ref storeGetSelfDataList, value); } } - public TaskListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService) + + public TaskListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService, ProductService productService) { this.globalContext = globalContext; @@ -282,6 +288,15 @@ namespace BBWY.Client.ViewModels.PackTask SetFallWareConfiguredCommand = new RelayCommand(SetFallWareConfigured); SubmitOverTimeMarkMsgCommand = new RelayCommand(SubmitOverTimeMarkMsg); + + AddSealBoxProductCommand = new RelayCommand(AddSealBoxProduct); + this.productService = productService; + } + ProductService productService; + private void AddSealBoxProduct() + { + AddProductWindow addProductWindow = new AddProductWindow(packTaskService, productService, ReflashTask); + addProductWindow.ShowDialog(); } private void SubmitOverTimeMarkMsg(object param) @@ -309,20 +324,9 @@ namespace BBWY.Client.ViewModels.PackTask WaybillNo = fallware.WaybillNo }; - //if (fallware.WareType== WareType.京仓) - //{ - - //SetJDWareBoxWindow window = new SetJDWareBoxWindow(model,sealBoxService,fallware.WareType.Value,ReflashTask); - //window.Show(); var w = new SetJDWareBoxWindow2(model, sealBoxService, fallware.WareType.Value, ReflashTask, fallware.TransportOverTime); w.ShowDialog(); - //} - //if (fallware.WareType == WareType.云仓) - //{ - // SetCloudWareBoxWindow window = new SetCloudWareBoxWindow(model, sealBoxService, fallware.WareType.Value, ReflashTask); - // window.Show(); - //} } private void UpdateSealBoxConfigured(SealBoxConfiguredModel model) @@ -330,7 +334,7 @@ namespace BBWY.Client.ViewModels.PackTask var sealBoxId = model.SealBoxId; var taskIds = model.SealBoxConfigureTasks.Select(s => s.TaskId).ToArray(); - var updateSealBoxConfig = sealBoxService.GetUpdateSealBoxConfigured(sealBoxId, taskIds); + var updateSealBoxConfig = sealBoxService.GetUpdateSealBoxConfiguredV2(sealBoxId, taskIds); if (updateSealBoxConfig == null) { MessageBox.Show("网络异常,获取不到带封箱数据"); @@ -342,10 +346,10 @@ namespace BBWY.Client.ViewModels.PackTask return; } + SetSealBoxPolicyWindow setSealBoxPolicyWindow = new SetSealBoxPolicyWindow(updateSealBoxConfig.Data.UpdateSealBoxConfiguredTaskDatas, ReflashTask, sealBoxId); + setSealBoxPolicyWindow.ShowDialog(); - SealBoxConfigureWindow sealBoxConfigureWindow = new SealBoxConfigureWindow(updateSealBoxConfig.Data.UpdateSealBoxConfiguredTaskDatas, ReflashTask, sealBoxId); - sealBoxConfigureWindow.ShowDialog(); } private void ConfiguredSealBox() @@ -366,24 +370,38 @@ namespace BBWY.Client.ViewModels.PackTask MessageBox.Show("已全部封箱!"); return; } - var taskIds = waitSealBoxRes.Data.SealBoxWaitConfigureModels.Select(w => w.TaskId).ToArray(); + //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.ShowDialog(); + //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.ShowDialog(); + var data = waitSealBoxRes.Data.SealBoxWaitConfigureModels.Select(x => new SealBoxConfigureModel + { + Logo = x.Logo, + WareType = x.WareType, + SkuCount = x.SkuCount, + SkuId = x.SkuId, + SkuName = x.SkuName, + TaskId = x.TaskId, + TaskState = x.TaskState, + WaitConfigureCount = x.SkuCount, + }).ToList(); + + SetSealBoxPolicyWindow setSealBoxPolicyWindow = new SetSealBoxPolicyWindow(data, ReflashTask, 0); + setSealBoxPolicyWindow.ShowDialog(); } private void DeletedTask(object obj) @@ -430,6 +448,10 @@ namespace BBWY.Client.ViewModels.PackTask #region 事件绑定 + /// + /// 添加封箱商品 + /// + public ICommand AddSealBoxProductCommand { get; set; } /// /// 提交过期时间数据 /// @@ -497,7 +519,7 @@ namespace BBWY.Client.ViewModels.PackTask } private List waitSealBoxTaskStates = new List { - Models.TaskState.待落仓, Models.TaskState.待封箱, Models.TaskState.待出库 + Models.TaskState.待落仓, Models.TaskState.待封箱, Models.TaskState.待出库, Models.TaskState.商家自取 };//配置封箱的任务状态范围 @@ -687,9 +709,9 @@ namespace BBWY.Client.ViewModels.PackTask } //任务状态为待打包 - if (TaskState == Models.TaskState.待打包) + if (TaskState == Models.TaskState.待包装) { - var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待打包 && p.PackCompletionOverTime != null).ToList(); + var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待包装 && p.PackCompletionOverTime != null).ToList(); if (packCompletedTasks.Count() > 0) { @@ -1048,6 +1070,38 @@ namespace BBWY.Client.ViewModels.PackTask IsLoading = false; }); } + if (TaskState == Models.TaskState.商家自取) + { + Task.Factory.StartNew(() => + { + StoreGetSelfDataList = new ObservableCollection(); + var datas = packTaskService.SearchStoreGetSelfList(SearchTaskId, SearchOrderSn, SearchSpuId, SearchSkuId, null, null, PageIndex, PageSize, globalContext.User.Shop.ShopId.ToString()); + if (datas != null && datas.Data != null && datas.Success) + { + var dataModel = datas.Data; + OrderCount = dataModel.TotalCount; + foreach (var item in dataModel.StoreGetSelfResponseList) + { + App.Current.Dispatcher.Invoke(new Action(() => + { + StoreGetSelfDataList.Add(item); + })); + + } + + } + else + { + App.Current.Dispatcher.Invoke(new Action(() => + { + MessageBox.Show(datas?.Msg); + })); + + } + IsLoading = false; + }); + + } } diff --git a/BBWY.Client/ViewModels/PackTask/UpdatePurchaseTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/UpdatePurchaseTaskViewModel.cs index 305ab8bb..3d255f19 100644 --- a/BBWY.Client/ViewModels/PackTask/UpdatePurchaseTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/UpdatePurchaseTaskViewModel.cs @@ -436,7 +436,7 @@ namespace BBWY.Client.ViewModels.PackTask if (!string.IsNullOrEmpty(BrandName)) model.CerDTO.BrandName = BrandName; - QualitySetCerWindow setCerWindow = new QualitySetCerWindow(); + QualitySetCerWindow setCerWindow = new QualitySetCerWindow(false); setCerWindow.LoadData(model.IsNeedCer, model.CerDTO, packPurchaseTaskService, spuCertificateModel, IsSetSpuCertificate, SaveType); setCerWindow.SaveResult = (s, PackCerState) => { @@ -525,108 +525,111 @@ namespace BBWY.Client.ViewModels.PackTask Brand = productApiResponse.Data.Items[0].BrandName; } - var productSku = packPurchaseTaskService.GetConfigPack(SkuId, "", OrderId); + } + else + { - if (productSku == null || !productSku.Success || productSku.Data == null) - { - MessageBox.Show(productSku.Msg); - return false; - } + App.Current.Dispatcher.Invoke(() => MessageBox.Show(skuResponse.Msg, "加载sku失败")); + } + var productSku = packPurchaseTaskService.GetConfigPack(SkuId, "", OrderId); - SkuPurchaseSchemeId = productSku.Data.SkuPurchaseSchemeId; - BarCodeModel = productSku.Data.BarCode; - if (BarCodeModel == null) - { - BarCodeModel = new BarCodeModel(); + if (productSku == null || !productSku.Success || productSku.Data == null) + { + MessageBox.Show(productSku.Msg); + return false; + } + + + SkuPurchaseSchemeId = productSku.Data.SkuPurchaseSchemeId; + BarCodeModel = productSku.Data.BarCode; + if (BarCodeModel == null) + { + BarCodeModel = new BarCodeModel(); + } + if (!string.IsNullOrEmpty(Brand)) + BarCodeModel.Brand = Brand; + if (!string.IsNullOrEmpty(BrandName)) + BarCodeModel.BrandName = BrandName; + BarCodeModel.ProductNo = ProductNo; + BarCodeModel.SkuId = SkuId; + BarCodeModel.SkuName = SkuName; + PurchaseSkuList = new ObservableCollection(); + foreach (var item in productSku.Data.PurchaseSkus) + { + var list = purchaseService.GetPurchaseSkuBasicInfo(item.PurchaseProductId); + if (list == null || !list.Success || list.Data == null) + continue; + var skuItem = list.Data.ItemList.FirstOrDefault(f => f.PurchaseSkuId == item.PurchaseSkuId); + if (skuItem == null) + { + MessageBox.Show($"{item.PurchaseProductId}采购商品列表不存在skuid:{item.PurchaseSkuId},sku商品可能被下架了."); + //return false; } - if (!string.IsNullOrEmpty(Brand)) - BarCodeModel.Brand = Brand; - if (!string.IsNullOrEmpty(BrandName)) - BarCodeModel.BrandName = BrandName; - BarCodeModel.ProductNo = ProductNo; - BarCodeModel.SkuId = SkuId; - BarCodeModel.SkuName = SkuName; - PurchaseSkuList = new ObservableCollection(); - foreach (var item in productSku.Data.PurchaseSkus) + App.Current.Dispatcher.Invoke(new Action(() => { - var list = purchaseService.GetPurchaseSkuBasicInfo(item.PurchaseProductId); - if (list == null ||!list.Success|| list.Data == null) - continue; - var skuItem = list.Data.ItemList.FirstOrDefault(f => f.PurchaseSkuId == item.PurchaseSkuId); - if (skuItem == null) + PurchaseSkuList.Add(new PurchaseSku { - MessageBox.Show($"{item.PurchaseProductId}采购商品列表不存在skuid:{item.PurchaseSkuId},sku商品可能被下架了."); - //return false; + Logo = skuItem?.Logo, + Title = skuItem?.Title, + IsNeedCer = item.IsNeedCer, + PurchaseSkuId = item.PurchaseSkuId, + CerDTO = item.CerDTO, + IsSetCertificate = item.CerDTO == null ? true : false, + }); + })); + } + + IsNeedBarCode = Need.需要; + IsSetBarCode = true; + IsSetCertificate = true; + if (productSku.Data.PackConfig != null) + { + var config = productSku.Data.PackConfig; + SkuTitle = config.SkuGoodsTitle; + BrandName = config.BrandName; + GoodsNumber = config.GoodsNumber; + PackType = (PackType)config.PackType; + BasicPack = (BasicPack)config.BasicPack; + //MarkMessage = config.MarkMessage; + CertificatePosition = config.CertificatePosition == null ? CertificatePosition.无需合格证 : (CertificatePosition)config.CertificatePosition.Value; + // Increment1 = config.Increment1; + + IsNeedBarCode = config.NeedBar ? Need.需要 : Need.不需要; + IsNeedCertificateModel = config.NeedCer ? Need.需要 : Need.不需要; + + IsSetBarCode = !config.NeedBar; + IsSetCertificate = !config.NeedCer; + + string[] increateDatas = config.Increment1?.Split(','); + bool isSelected = false; + + IncreateList = new ObservableCollection(); + foreach (var item in increates) + { + isSelected = false; + if (increateDatas != null && increateDatas.Count() > 0 && increateDatas.Contains(item)) + { + isSelected = true; } - App.Current.Dispatcher.Invoke(new Action(() => + App.Current.Dispatcher.Invoke(() => { - PurchaseSkuList.Add(new PurchaseSku + IncreateList.Add(new IncreateModel { - Logo = skuItem?.Logo, - Title = skuItem?.Title, - IsNeedCer = item.IsNeedCer, - PurchaseSkuId = item.PurchaseSkuId, - CerDTO = item.CerDTO, - IsSetCertificate = item.CerDTO == null ? true : false, + IncreateName = item, + IsSelected = isSelected }); - })); + }); } - IsNeedBarCode = Need.需要; - IsSetBarCode = true; - IsSetCertificate = true; - if (productSku.Data.PackConfig != null) - { - var config = productSku.Data.PackConfig; - SkuTitle = config.SkuGoodsTitle; - BrandName = config.BrandName; - GoodsNumber = config.GoodsNumber; - PackType = (PackType)config.PackType; - BasicPack = (BasicPack)config.BasicPack; - //MarkMessage = config.MarkMessage; - CertificatePosition = config.CertificatePosition == null ? CertificatePosition.无需合格证 : (CertificatePosition)config.CertificatePosition.Value; - // Increment1 = config.Increment1; - - IsNeedBarCode = config.NeedBar ? Need.需要 : Need.不需要; - IsNeedCertificateModel = config.NeedCer ? Need.需要 : Need.不需要; - - IsSetBarCode = !config.NeedBar; - IsSetCertificate = !config.NeedCer; - - string[] increateDatas = config.Increment1?.Split(','); - bool isSelected = false; - - IncreateList = new ObservableCollection(); - foreach (var item in increates) - { - isSelected = false; - if (increateDatas != null && increateDatas.Count() > 0 && increateDatas.Contains(item)) - { - isSelected = true; - } - App.Current.Dispatcher.Invoke(() => - { - IncreateList.Add(new IncreateModel - { - IncreateName = item, - IsSelected = isSelected - }); - }); - } + } + + - } - return true; - } - else - { - App.Current.Dispatcher.Invoke(() => MessageBox.Show(skuResponse.Msg, "加载sku")); - return false; - } return true; //加载配置文件 } diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index 593d6493..0858d256 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -1,24 +1,16 @@ using BBWY.Client.APIServices; -using BBWY.Client.Models.APIModel.Response.PackTask; using BBWY.Client.Models; -using BBWY.Client.Views.PackTask; using BBWY.Common.Models; using BBWY.Controls; using GalaSoft.MvvmLight.Command; using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Text; using System.Threading.Tasks; using System.Windows.Input; using System.Linq; -using System.Windows.Controls; -using System.ComponentModel; -using HandyControl.Controls; using System.Windows; -using System.Collections; -using NPOI.SS.Formula.Functions; -using GalaSoft.MvvmLight.Messaging; + using BBWY.Client.Models.APIModel; using BBWY.Client.Models.PackTask; using BBWY.Client.Views.SealBox; @@ -27,8 +19,13 @@ using BBWY.Client.Models.FallWare; using WebSocketSharp; using System.Threading; using BBWY.Client.Helpers; -using System.Diagnostics.Eventing.Reader; using BBWY.Client.Views.TaskOverTime; +using BBWY.Client.Views.StorePickSelf; +using System.Diagnostics.Eventing.Reader; +using BBWY.Client.Models.SealBox; +using Newtonsoft.Json; +using System.Diagnostics; +using BBWY.Client.Extensions; namespace BBWY.Client.ViewModels.PackTask { @@ -38,6 +35,13 @@ namespace BBWY.Client.ViewModels.PackTask //public RelayCommand SelectCmd => new RelayCommand(str => Growl.Info(str)); #region 属性绑定 + private ObservableCollection selectTitleList = new ObservableCollection { + "SKU名称","标题" + }; + + public ObservableCollection SelectTitleList { get => selectTitleList; set { Set(ref selectTitleList, value); } } + + private ObservableCollection selectExpressList = new ObservableCollection { "物流单号","物流公司名称" @@ -62,8 +66,39 @@ namespace BBWY.Client.ViewModels.PackTask }; public ObservableCollection SelectShopList { get => selectShopList; set { Set(ref selectShopList, value); } } + /// - /// 查询物流 + /// 查询名称 + /// + private string selectTitle = "SKU名称"; + public string SelectTitle + { + get => selectTitle; + + + set + { + Set(ref selectTitle, value); + + OnSelectTitleChanged(SelectTitle); + } + } + + private void OnSelectTitleChanged(string SelectTitle) + { + if (SelectTitle == "SKU名称") + { + SearchSpuTitle = null; + } + if (SelectTitle == "标题") + { + SearchSkuTitle = null; + } + + } + + /// + /// 查询店铺 /// private string selectShop = "店铺"; public string SelectShop @@ -274,18 +309,29 @@ namespace BBWY.Client.ViewModels.PackTask /// 待完结列表 /// public ObservableCollection WaitCompletedList { get => waitCompletedList; set { Set(ref waitCompletedList, value); } } + + private ObservableCollection waitTransportList; /// /// 待转运列表 /// public ObservableCollection WaitTransportList { get => waitTransportList; set { Set(ref waitTransportList, value); } } + public List WareWaitTransports { get; set; } + + + private ObservableCollection waitFallWareList; /// /// 待落仓列表 /// public ObservableCollection WaitFallWareList { get => waitFallWareList; set { Set(ref waitFallWareList, value); } } + public IList WaitFallWareLists { get; set; } + + + + private ObservableCollection wareNoSealBoxModels; /// @@ -293,12 +339,29 @@ namespace BBWY.Client.ViewModels.PackTask /// public ObservableCollection WareNoSealBoxModels { get => wareNoSealBoxModels; set { Set(ref wareNoSealBoxModels, value); } } + /// + /// 分箱列表 + /// + public List WaitSealBoxModelList { get; set; } + + + + + private ObservableCollection waitSealBoxModels; /// /// 分箱列表(已配置) /// public ObservableCollection WaitSealBoxModels { get => waitSealBoxModels; set { Set(ref waitSealBoxModels, value); } } + /// + /// 分箱列表(已配置) + /// + public List SealBoxModelList { get; set; } + + + + private ObservableCollection packTaskList; /// @@ -308,6 +371,12 @@ namespace BBWY.Client.ViewModels.PackTask + private ObservableCollection storeGetSelfDataList; + /// + /// 商家自取记录任务列表 + /// + public ObservableCollection StoreGetSelfDataList { get => storeGetSelfDataList; set { Set(ref storeGetSelfDataList, value); } } + private string searchShopName; public string SearchShopName { @@ -477,6 +546,28 @@ namespace BBWY.Client.ViewModels.PackTask } } + + + public string searchSpuTitle; + public string SearchSpuTitle + { + get => searchSpuTitle; set + { + Set(ref searchSpuTitle, value); + + } + } + + public string searchSkuTitle; + public string SearchSkuTitle + { + get => searchSkuTitle; set + { + Set(ref searchSkuTitle, value); + + } + } + private SealBoxConfigureType sealBoxConfigureType; /// /// 封箱配置状态 @@ -573,6 +664,72 @@ namespace BBWY.Client.ViewModels.PackTask SendToSetSkuConfigureCommand = new RelayCommand(SendToSetSkuConfigure); SelectSku = "SKU"; SelectExpress = "物流单号"; + LoadSkuDataCommand = new RelayCommand(LoadSkuData); + + LoadSealBoxSkuDataCommand = new RelayCommand(LoadSealBoxSkuData); + + LoadFallWareSkuDataCommand = new RelayCommand(LoadFallWareSkuData); + + + LoadTransportSkuDataCommand = new RelayCommand(LoadTransportSkuData); + } + + private void LoadTransportSkuData(WareWaitTransport model) + { + if (model.WaitTransportSkus == null || model.WaitTransportSkus.Count <= 0) + { + var skuDatas = WareWaitTransports.SingleOrDefault(w => w.SealBoxId == model.SealBoxId); + WaitTransportList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).WaitTransportSkus = skuDatas.WaitTransportSkus; + } + else + { + WaitTransportList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).WaitTransportSkus = null; + } + } + + + private void LoadFallWareSkuData(WaitFallWareModel model) + { + if (model.SealBoxSkus == null || model.SealBoxSkus.Count <= 0) + { + var skuDatas = WaitFallWareLists.SingleOrDefault(w => w.SealBoxId == model.SealBoxId); + WaitFallWareList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).SealBoxSkus = skuDatas.SealBoxSkus; + } + else + { + WaitFallWareList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).SealBoxSkus = null; + } + } + + private void LoadSealBoxSkuData(SealBoxModel model) + { + if (model.SealBoxSkus == null || model.SealBoxSkus.Count <= 0) + { + var skuDatas = SealBoxModelList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId); + WaitSealBoxModels.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).SealBoxSkus = skuDatas.SealBoxSkus; + } + else + { + WaitSealBoxModels.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).SealBoxSkus = null; + } + } + + + private void LoadSkuData(WareNoSealBoxModel model) + { + + if (model.SealBoxSkus == null || model.SealBoxSkus.Count <= 0) + { + var skuDatas = WaitSealBoxModelList.SingleOrDefault(w => w.ShopId == model.ShopId); + WareNoSealBoxModels.SingleOrDefault(w => w.ShopId == model.ShopId).SealBoxSkus = skuDatas.SealBoxSkus; + } + else + { + WareNoSealBoxModels.SingleOrDefault(w => w.ShopId == model.ShopId).SealBoxSkus = new List(); + } + + + } private void SendToSetSkuConfigure(PackTaskModel model) @@ -612,7 +769,7 @@ namespace BBWY.Client.ViewModels.PackTask case Models.TaskState.待排单: overTimeTaskType = Models.OverTimeTaskType.待排单; break; - case Models.TaskState.待打包: + case Models.TaskState.待包装: overTimeTaskType = Models.OverTimeTaskType.待打包; break; case Models.TaskState.待封箱: @@ -796,27 +953,49 @@ namespace BBWY.Client.ViewModels.PackTask System.Windows.MessageBox.Show(res.Msg); return; } + + Task.Factory.StartNew(() => SearchTaskList()); } private void StoreGetBySelf(long taskId) { - MessageBoxResult result = System.Windows.MessageBox.Show($"确定商家自取,任务id:{taskId}?", "提示", - MessageBoxButton.YesNo, - MessageBoxImage.Warning); - if (result != MessageBoxResult.Yes) return; - var res = packTaskService.StoreGetBySelf(taskId); - if (res == null) + //MessageBoxResult result = System.Windows.MessageBox.Show($"确定商家自取,任务id:{taskId}?", "提示", + // MessageBoxButton.YesNo, + // MessageBoxImage.Warning); + //if (result != MessageBoxResult.Yes) return; + + var data = packTaskService.GetStoreGetSelfData(taskId); + if (!data.Success) { + MessageBox.Show(data?.Msg); return; } - if (!res.Success) + + StorePickProductWindow sorePickProductWindow = new StorePickProductWindow(data.Data, (count, UserName) => { - System.Windows.MessageBox.Show(res.Msg, "错误信息"); - return; - } - Task.Factory.StartNew(() => SearchTaskList()); + + var res = packTaskService.StoreGetBySelfV2(taskId, count, UserName); + if (res == null) + { + return false; + } + if (!res.Success) + { + System.Windows.MessageBox.Show(res.Msg, "错误信息"); + return false; + } + + + Task.Factory.StartNew(() => SearchTaskList()); + + return true; + }); + sorePickProductWindow.ShowDialog(); + + + } private void DeletedTask(object obj) @@ -840,7 +1019,7 @@ namespace BBWY.Client.ViewModels.PackTask JDWareBoxModel model = new JDWareBoxModel { - ShopName = globalContext.User.Shop.ShopName, + ShopName = fallware.ShopName, WareName = fallware.WareName, SealBoxId = fallware.SealBoxId, ProductCount = fallware.ProductCount, @@ -861,10 +1040,17 @@ namespace BBWY.Client.ViewModels.PackTask private void LookBoxConfigure(object obj) { - var fallware = obj as WaitFallWareModel; + var fallware = obj as WaitFallWareModel;//WaitFallWareModel + if (fallware == null) + { + MessageBox.Show($"数据异常, {JsonConvert.SerializeObject(obj)}"); + return; + } + + JDWareBoxModel model = new JDWareBoxModel { - ShopName = globalContext.User.Shop.ShopName, + ShopName = fallware.ShopName, WareName = fallware.WareName, SealBoxId = fallware.SealBoxId, ProductCount = fallware.ProductCount, @@ -882,7 +1068,7 @@ namespace BBWY.Client.ViewModels.PackTask //var w = new SetJDWareBoxWindow2(model, sealBoxService, fallware.WareType, ReflashTask, false); //w.ShowDialog(); } - if (fallware.WareType == WareType.云仓 || fallware.WareType == WareType.聚水潭齐越仓) + if (fallware.WareType == WareType.云仓 || fallware.WareType == WareType.聚水潭) { SetCloudWareBoxWindow window = new SetCloudWareBoxWindow(model, fallware.WareType); window.ShowDialog(); @@ -922,7 +1108,7 @@ namespace BBWY.Client.ViewModels.PackTask { var model = (SealBoxModel)obj; - if (model.SealBoxSkus.Any(s => s.TaskState == Models.TaskState.待验收 || s.TaskState == Models.TaskState.待打包)) + if (model.SealBoxSkus.Any(s => s.TaskState == Models.TaskState.待验收 || s.TaskState == Models.TaskState.待包装)) { System.Windows.MessageBox.Show("无法封箱,存在未打包完成的任务"); return; @@ -939,6 +1125,7 @@ namespace BBWY.Client.ViewModels.PackTask #region 事件绑定 + /// /// 推送sku配置状态 /// @@ -1040,6 +1227,28 @@ namespace BBWY.Client.ViewModels.PackTask /// 商家自取 /// public ICommand StoreGetBySelfCommand { get; set; } + + + /// + /// 加载事件(待封箱) + /// + public ICommand LoadSkuDataCommand { get; set; } + + /// + /// 加载事件(封箱已配置) + /// + public ICommand LoadSealBoxSkuDataCommand { get; set; } + + /// + /// 落仓 + /// + public ICommand LoadFallWareSkuDataCommand { get; set; } + + /// + /// 转运 + /// + public ICommand LoadTransportSkuDataCommand { get; set; } + /// /// 完成封箱 /// @@ -1115,7 +1324,7 @@ namespace BBWY.Client.ViewModels.PackTask break; case Models.TaskState.待验收: break; - case Models.TaskState.待打包: + case Models.TaskState.待包装: var packModel = PackTaskList.SingleOrDefault(p => p.TaskId == taskId); if (packModel == null || packModel.FeesItemResponse == null || packModel.FeesItemResponse.DiscountAllFees == 0) @@ -1151,6 +1360,14 @@ namespace BBWY.Client.ViewModels.PackTask public void SetTaskState(TaskState? taskState) { + if (!(TaskState == Models.TaskState.未到货 && TaskState == Models.TaskState.待验收)) + { + SearchSkuTitle = ""; + SearchSpuTitle = ""; + } + + + TaskState = taskState; if (PageIndex == 1) @@ -1165,6 +1382,7 @@ namespace BBWY.Client.ViewModels.PackTask private Thread sealboxOverTimeThread = null; private Thread fallwareOverTimeThread = null; private Thread waitTransportOverTimeThread = null; + /// /// 搜索任务列表 /// @@ -1195,6 +1413,10 @@ namespace BBWY.Client.ViewModels.PackTask } Task.Factory.StartNew(() => { + + + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); if (TaskState == Models.TaskState.待出库) { WaitCompletedList = new ObservableCollection(); @@ -1216,8 +1438,6 @@ namespace BBWY.Client.ViewModels.PackTask { if (datas != null) System.Windows.MessageBox.Show(datas.Msg); } - IsLoadCount(); - IsLoading = false; } else if (TaskState == Models.TaskState.已超时) @@ -1242,13 +1462,12 @@ namespace BBWY.Client.ViewModels.PackTask { if (datas != null) System.Windows.MessageBox.Show(datas.Msg); } - IsLoadCount(); - IsLoading = false; + } else if (TaskState == Models.TaskState.待转运) { - + PageSize = 20; WaitTransportList = new ObservableCollection(); var datas = sealBoxService.GetWareWaitTransportList(SelectWareType, PageSize, PageIndex); @@ -1256,11 +1475,15 @@ namespace BBWY.Client.ViewModels.PackTask { var dataModel = datas.Data; OrderCount = dataModel.TotalCount; + WareWaitTransports = dataModel.WareWaitTransports; foreach (var item in dataModel.WareWaitTransports) { + + var skuItem = item.Copy(); + skuItem.WaitTransportSkus = null;//默认不加载 App.Current.Dispatcher.Invoke(new Action(() => { - WaitTransportList.Add(item); + WaitTransportList.Add(skuItem); })); } @@ -1308,14 +1531,16 @@ namespace BBWY.Client.ViewModels.PackTask { if (datas != null) System.Windows.MessageBox.Show(datas.Msg); } - IsLoadCount(); - IsLoadWaitTransportCount(); - IsLoading = false; + + Task.Factory.StartNew(() => + { + IsLoadWaitTransportCount(); + }); } else if (TaskState == Models.TaskState.待落仓) { - + PageSize = 20; WaitFallWareList = new ObservableCollection(); var datas = sealBoxService.SearchWareFallWareConfigureList(PositionState, SearchShopName, taskId, SearchSkuId, sealBoxId, PageIndex, PageSize); @@ -1323,6 +1548,7 @@ namespace BBWY.Client.ViewModels.PackTask { var dataModel = datas.Data; OrderCount = dataModel.TotalCount; + WaitFallWareLists = dataModel.WaitFallWareList; foreach (var item in dataModel.WaitFallWareList) { App.Current.Dispatcher.Invoke(new Action(() => @@ -1331,7 +1557,7 @@ namespace BBWY.Client.ViewModels.PackTask { AcceptUserNames = string.Join("|", item.AcceptUserNames), DepartmentName = item.DepartmentName, - SealBoxSkus = item.SealBoxSkus, + SealBoxSkus = null, ShopId = item.ShopId, ShopName = item.ShopName, WareId = item.WareId, @@ -1351,15 +1577,17 @@ namespace BBWY.Client.ViewModels.PackTask { if (datas != null) System.Windows.MessageBox.Show(datas.Msg); } - IsLoadCount(); - IsLoadFallWareCount(); - IsLoading = false; + + Task.Factory.StartNew(() => + { + IsLoadFallWareCount(); + }); } else if (TaskState == Models.TaskState.待封箱) { - + PageSize = 20; if (SealBoxConfigureType == SealBoxConfigureType.已配置) { WaitSealBoxModels = new ObservableCollection(); @@ -1369,6 +1597,8 @@ namespace BBWY.Client.ViewModels.PackTask { var dataModel = datas.Data; OrderCount = dataModel.TotalCount; + + SealBoxModelList = dataModel.WaitSealBoxModels; foreach (var item in dataModel.WaitSealBoxModels) { @@ -1378,12 +1608,7 @@ namespace BBWY.Client.ViewModels.PackTask { AcceptUserName = string.Join("|", item.AcceptUserNames), DepartmentName = item.DepartmentName, - SealBoxSkus = item.SealBoxSkus.Select(s => - { - - s.Logo = s.Logo; - return s; - }).ToList(), + SealBoxSkus = null, ShopId = item.ShopId, ShopName = item.ShopName, WareId = item.WareId, @@ -1442,33 +1667,30 @@ namespace BBWY.Client.ViewModels.PackTask } if (SealBoxConfigureType == SealBoxConfigureType.待配置) { - WareNoSealBoxModels = new ObservableCollection(); + WareNoSealBoxModels = new ObservableCollection(); var datas = sealBoxService.GetWareSealBoxWaitConfigureList(SearchShopName, taskId, SearchSkuId, PageIndex, PageSize); if (datas != null && datas.Data != null && datas.Success) { var dataModel = datas.Data; OrderCount = dataModel.TotalCount; - foreach (var item in dataModel.WaitSealBoxModels) - { + WaitSealBoxModelList = dataModel.WaitSealBoxModels; + foreach (var item in WaitSealBoxModelList) + { App.Current.Dispatcher.Invoke(new Action(() => { WareNoSealBoxModels.Add(new WareNoSealBoxModel { AcceptUserName = string.Join("|", item.AcceptUserNames), DepartmentName = item.DepartmentName, - SealBoxSkus = item.SealBoxSkus.Select(s => - { - s.Logo = s.Logo; - return s; - }).ToList(), + SealBoxSkus = new List(), + // SealBoxSkus = item.SealBoxSkus, ShopId = item.ShopId, ShopName = item.ShopName, }); })); - } } else @@ -1476,17 +1698,48 @@ namespace BBWY.Client.ViewModels.PackTask if (datas != null) System.Windows.MessageBox.Show(datas.Msg); } } - IsLoadSealBoxCount(); - IsLoadCount(); - IsLoading = false; + + Task.Factory.StartNew(() => + { + IsLoadSealBoxCount(); + }); + + } + else if (taskState == Models.TaskState.商家自取) + { + StoreGetSelfDataList = new ObservableCollection(); + var datas = packTaskService.SearchStoreGetSelfList(SearchTaskId, SearchOrderSn, SearchSpuId, SearchSkuId, SearchDepartment, SearchShopName, PageIndex, PageSize, null); + if (datas != null && datas.Data != null && datas.Success) + { + var dataModel = datas.Data; + OrderCount = dataModel.TotalCount; + foreach (var item in dataModel.StoreGetSelfResponseList) + { + App.Current.Dispatcher.Invoke(new Action(() => + { + StoreGetSelfDataList.Add(item); + })); + + } + + } + else + { + MessageBox.Show(datas?.Msg); + } } else { PackTaskList = new ObservableCollection();//初始化数据 - var datas = packTaskService.SearchTaskList(SearchWayBillNo, SearchExpressName, SearchDepartment, SearchSkuId, SearchTaskId, SearchSpuId, SearchOrderSn, this.TaskState, SearchShopName, - PageIndex, PageSize); + PageIndex, PageSize, SearchSkuTitle, SearchSpuTitle); + stopwatch.Stop(); + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + Debug.WriteLine($"查询接口耗时:{stopwatch.ElapsedMilliseconds}毫秒"); + })); + stopwatch.Restart(); if (datas != null && datas.Data != null && datas.Success) { var dataModel = datas.Data; @@ -1533,26 +1786,6 @@ namespace BBWY.Client.ViewModels.PackTask SendToSetSkuConfigureTime = item.SendToSetSkuConfigureTime, }; - - if (!item.OrderId.IsNullOrEmpty() && !item.SkuId.IsNullOrEmpty()) - { - var expressData = packTaskService.GetPurchaseExpressOrderList(item.OrderId, item.SkuId); - if (expressData != null && expressData.Success && expressData.Data != null) - { - expressData.Data.ForEach(e => - { - e.ExpressState = ExpressOrderHelper.GetExpressStateName(e.ExpressState); - - - }); - - data.ExpressOrderList = expressData.Data; - - - - } - } - if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) { @@ -1595,12 +1828,10 @@ namespace BBWY.Client.ViewModels.PackTask } - if (TaskState == Models.TaskState.待验收) { qualityOverTimeThread = new Thread(() => { - var packtasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待验收 && p.QualityCompletionOverTime != null).ToList(); if (packtasks.Count() > 0) { @@ -1645,9 +1876,9 @@ namespace BBWY.Client.ViewModels.PackTask //任务状态为待验收 } - if (TaskState == Models.TaskState.待打包) + if (TaskState == Models.TaskState.待包装) { - var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待打包 && p.PackCompletionOverTime != null).ToList(); + var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待包装 && p.PackCompletionOverTime != null).ToList(); if (packCompletedTasks.Count() > 0) { @@ -1685,8 +1916,6 @@ namespace BBWY.Client.ViewModels.PackTask } } - - if (TaskState == Models.TaskState.待排单) { var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待排单 && p.ScheduleOverTime != null).ToList(); @@ -1726,33 +1955,82 @@ namespace BBWY.Client.ViewModels.PackTask } } + //任务状态为待打包 - //任务状态为待打包 + Task.Factory.StartNew(() => { + foreach (var item in PackTaskList) + { + if (!item.OrderId.IsNullOrEmpty() && !item.SkuId.IsNullOrEmpty()) + { + var expressData = packTaskService.GetPurchaseExpressOrderList(item.OrderId, item.SkuId); + if (expressData != null && expressData.Success && expressData.Data != null) + { + + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + expressData.Data.ForEach(e => + { + e.ExpressState = ExpressOrderHelper.GetExpressStateName(e.ExpressState); + + + }); + item.ExpressOrderList = expressData.Data; + })); + + + + + } + } + } + + + + + }); } else { } - IsLoadCount(); - IsLoading = false; } - }); + Task.Factory.StartNew(() => + { + IsLoadCount(); + }); + + IsLoading = false; + stopwatch.Stop(); + App.Current.Dispatcher.BeginInvoke(new Action(() => + { + Debug.WriteLine($"查询耗时:{stopwatch.ElapsedMilliseconds}毫秒"); + })); + + + }); } + + + private void IsLoadWaitTransportCount() { var res = sealBoxService.GetWareTransportCounts(); if (res != null && res.Success && res.Data != null) { - WaitTransportCloudWareCount = res.Data.WaitTransportCloudWareCount; - WaitTransportJuShuiTanCount = res.Data.WaitTransportJuShuiTanCount; - WaitTransportStoreWareCount = res.Data.WaitTransportStoreWareCount; - WaitTransportJDWareCount = res.Data.WaitTransportJDWareCount; + App.Current.Dispatcher.Invoke(new Action(() => + { + WaitTransportCloudWareCount = res.Data.WaitTransportCloudWareCount; + WaitTransportJuShuiTanCount = res.Data.WaitTransportJuShuiTanCount; + WaitTransportStoreWareCount = res.Data.WaitTransportStoreWareCount; + WaitTransportJDWareCount = res.Data.WaitTransportJDWareCount; + })); } + } private void IsLoadSealBoxCount() @@ -1760,8 +2038,12 @@ namespace BBWY.Client.ViewModels.PackTask var res = sealBoxService.GetWareSealBoxConfigureCounts(); if (res != null && res.Success && res.Data != null) { - FallWareWaitConfigureCount = res.Data.SealBoxWaitConfigureCount.ToString(); - FallWareConfiguredCount = res.Data.SealBoxConfiguredCount.ToString(); + App.Current.Dispatcher.Invoke(new Action(() => + { + FallWareWaitConfigureCount = res.Data.SealBoxWaitConfigureCount.ToString(); + FallWareConfiguredCount = res.Data.SealBoxConfiguredCount.ToString(); + })); + } } @@ -1770,8 +2052,12 @@ namespace BBWY.Client.ViewModels.PackTask var res = sealBoxService.GetFallWareConfigureCounts(null); if (res != null && res.Success && res.Data != null) { - FallWareWaitConfigureCount = res.Data.FallWareWaitConfigureCount.ToString(); - FallWareConfiguredCount = res.Data.FallWareConfiguredCount.ToString(); + App.Current.Dispatcher.Invoke(new Action(() => + { + FallWareWaitConfigureCount = res.Data.FallWareWaitConfigureCount.ToString(); + FallWareConfiguredCount = res.Data.FallWareConfiguredCount.ToString(); + })); + } } private void IsLoadCount() diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index 12a4b4a8..fd37402b 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -31,18 +31,18 @@ namespace BBWY.Client.ViewModels #region 属性 - public int goodProductQuantity; - public int arrivalQuantity; + public int? goodProductQuantity; + public int? arrivalQuantity; /// /// 到货数量 /// - public int ArrivalQuantity { get => arrivalQuantity; set { Set(ref arrivalQuantity, value); } } + public int? ArrivalQuantity { get => arrivalQuantity; set { Set(ref arrivalQuantity, value); } } /// /// 良品数量 /// - public int GoodProductQuantity { get => goodProductQuantity; set { Set(ref goodProductQuantity, value); } } + public int? GoodProductQuantity { get => goodProductQuantity; set { Set(ref goodProductQuantity, value); } } ///// ///// 预计完成时间 @@ -65,7 +65,7 @@ namespace BBWY.Client.ViewModels public ObservableCollection WorryList { get => worryList; set { Set(ref worryList, value); } } private ObservableCollection positionTypeList = new ObservableCollection { - "商家仓","云仓", "京仓","聚水潭齐越仓"}; + "商家仓","云仓", "京仓","聚水潭"}; public ObservableCollection PositionTypeList { get => positionTypeList; set { Set(ref positionTypeList, value); } } private ObservableCollection packTypeList = new ObservableCollection { @@ -194,7 +194,7 @@ namespace BBWY.Client.ViewModels private PositionType positionType; /// - /// 落仓(商家仓=0,云仓=1,京仓=2,聚水潭齐越仓=3) + /// 落仓(商家仓=0,云仓=1,京仓=2,聚水潭=3) /// public PositionType PositionType { get => positionType; set { Set(ref positionType, value); } } @@ -395,6 +395,16 @@ namespace BBWY.Client.ViewModels #region 方法 private void CompeteQualityTask(object obj) { + if (ArrivalQuantity==null) + { + MessageBox.Show($"请输入到货数量"); + return; + } + if (GoodProductQuantity == null) + { + MessageBox.Show($"请输入良品数量"); + return; + } if (FloorDragNumber <= 0) { @@ -414,11 +424,15 @@ namespace BBWY.Client.ViewModels return; } + + + + var request = new Models.APIModel.Request.QualityTaskRequest { BasicPack = BasicPack, - ArrivalQuantity = ArrivalQuantity, - GoodProductQuantity = GoodProductQuantity, + ArrivalQuantity = ArrivalQuantity.Value, + GoodProductQuantity = GoodProductQuantity.Value, Increment1 = string.Join(",", IncreateList.Where(i => i.IsSelected).Select(i => i.IncreateName)), BrandName = BrandName, CertificatePosition = CertificatePosition, @@ -488,7 +502,7 @@ namespace BBWY.Client.ViewModels //{ // BarCodeModel.ShopName = OriginShopName; //} - batchPrint.SetData(GoodProductQuantity, + batchPrint.SetData(GoodProductQuantity.Value, PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Select(p => p.CerDTO).ToArray() , BarCodeModel); batchPrint.ShowDialog(); @@ -571,7 +585,8 @@ namespace BBWY.Client.ViewModels if (!string.IsNullOrEmpty(BrandName)) model.CerDTO.BrandName = BrandName; - QualitySetCerWindow setCerWindow = new QualitySetCerWindow(); + + QualitySetCerWindow setCerWindow = new QualitySetCerWindow(model.IsSetCertificate); setCerWindow.LoadData(model.IsNeedCer, model.CerDTO, packPurchaseTaskService, spuCertificateModel, IsSetSpuCertificate, saveType); setCerWindow.SaveResult = (s, PackCerState) => { @@ -653,8 +668,8 @@ namespace BBWY.Client.ViewModels SkuTitle = model.SkuTitle; BasicPack = model.BasicPack; CertificatePosition = model.CertificatePosition; - ArrivalQuantity = 0; - GoodProductQuantity = 0; + //ArrivalQuantity = 0; + //GoodProductQuantity = 0; IncreateList = new ObservableCollection(); string[] increateDatas = model.Increment1?.Split(','); diff --git a/BBWY.Client/ViewModels/SealBox/SealBoxConfigureViewModel.cs b/BBWY.Client/ViewModels/SealBox/SealBoxConfigureViewModel.cs index 651e4c8d..07a495ef 100644 --- a/BBWY.Client/ViewModels/SealBox/SealBoxConfigureViewModel.cs +++ b/BBWY.Client/ViewModels/SealBox/SealBoxConfigureViewModel.cs @@ -5,89 +5,583 @@ using BBWY.Client.Models.APIModel; using BBWY.Client.Models.QiKu; using BBWY.Client.Models.SealBox; using BBWY.Client.Views.BatchPurchase; +using BBWY.Client.Views.SealBox; using BBWY.Controls; using GalaSoft.MvvmLight.Command; +using NPOI.SS.Formula.Functions; +using NPOI.Util; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; +using System.Threading.Tasks; using System.Windows; +using System.Windows.Documents; using System.Windows.Input; +using WebSocketSharp; namespace BBWY.Client.ViewModels.SealBox { public class SealBoxConfigureViewModel : BaseVM { private IList storeList;//仓库列表 - private LogisticsService logisticsService; + public LogisticsService logisticsService; private SealBoxService sealBoxService; private GlobalContext globalContext; - private ObservableCollection sealBoxConfigureModelList; + private WareType selectWareType = WareType.京仓; + public WareType SelectWareType { get => selectWareType; set { Set(ref selectWareType, value); } } + private string searchSkuId; + public string SearchSkuId { get => searchSkuId; set { Set(ref searchSkuId, value); } } + + private List sealBoxConfigureModelList; /// /// 分箱配置列表 /// - public ObservableCollection SealBoxConfigureModelList { get => sealBoxConfigureModelList; set { Set(ref sealBoxConfigureModelList, value); } } + public List SealBoxConfigureModelList { get => sealBoxConfigureModelList; set { Set(ref sealBoxConfigureModelList, value); } } + + private ObservableCollection jdConfigureModelList; + + /// + /// 京仓配置列表 + /// + public ObservableCollection JdConfigureModelList { get => jdConfigureModelList; set { Set(ref jdConfigureModelList, value); } } + + private ObservableCollection cloudConfigureModelList; + /// + /// 云仓配置列表 + /// + public ObservableCollection CloudConfigureModelList { get => cloudConfigureModelList; set { Set(ref cloudConfigureModelList, value); } } + + private ObservableCollection jstConfigureModelList; + /// + /// 聚水潭配置列表 + /// + public ObservableCollection JstConfigureModelList { get => jstConfigureModelList; set { Set(ref jstConfigureModelList, value); } } + + private ObservableCollection storeConfigureModelList; + /// + /// 商家仓配置列表 + /// + public ObservableCollection StoreConfigureModelList { get => storeConfigureModelList; set { Set(ref storeConfigureModelList, value); } } + + + private ObservableCollection jdWareHourseHeaderList; + /// + /// 京仓仓库配置头列表 + /// + public ObservableCollection JdWareHourseHeaderList { get => jdWareHourseHeaderList; set { Set(ref jdWareHourseHeaderList, value); } } + + private ObservableCollection cloudWareHourseHeaderList; + /// + /// 云仓仓库配置头列表 + /// + public ObservableCollection CloudWareHourseHeaderList { get => cloudWareHourseHeaderList; set { Set(ref cloudWareHourseHeaderList, value); } } + + private ObservableCollection jstWareHourseHeaderList; + /// + /// 聚水潭仓库配置头列表 + /// + public ObservableCollection JstWareHourseHeaderList { get => jstWareHourseHeaderList; set { Set(ref jstWareHourseHeaderList, value); } } + + private ObservableCollection storeWareHourseHeaderList; + /// + /// 商家仓仓库配置头列表 + /// + public ObservableCollection StoreWareHourseHeaderList { get => storeWareHourseHeaderList; set { Set(ref storeWareHourseHeaderList, value); } } + + + + + private string jDWareTaskCount; + /// + /// 京仓任务数 + /// + public string JDWareTaskCount { get => jDWareTaskCount; set { Set(ref jDWareTaskCount, value); } } + + + private string cloudWareTaskCount; + /// + /// 京仓任务数 + /// + public string CloudWareTaskCount { get => cloudWareTaskCount; set { Set(ref cloudWareTaskCount, value); } } + + + private string jSTWareTaskCount; + /// + /// 京仓任务数 + /// + public string JSTWareTaskCount { get => jSTWareTaskCount; set { Set(ref jSTWareTaskCount, value); } } + + + private string storeWareTaskCount; + /// + /// 京仓任务数 + /// + public string StoreWareTaskCount { get => storeWareTaskCount; set { Set(ref storeWareTaskCount, 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(); + //SealBoxConfigureModelList = new ObservableCollection(); this.globalContext = globalContext; + + SelectWareTypeCommand = new RelayCommand(SearchSku); + + SearchSkuCommand = new RelayCommand(SearchSku); + AddWareCommand = new RelayCommand(AddWare); + + SpliteOtherWareCommand = new RelayCommand(SpliteOtherWare); + + BatchSetWareMaxCountCommand = new RelayCommand(BatchSetWareMaxCount); + + + SetWareMaxCountCommand = new RelayCommand(SetWareMaxCount); + } + + public void LoadCount() + { + App.Current.Dispatcher.Invoke(new Action(() => { + + JDWareTaskCount= SealBoxConfigureModelList.Where(s=>s.SkuCount>0 &&s.WareType== WareType.京仓).Count().ToString(); + + CloudWareTaskCount = SealBoxConfigureModelList.Where(s => s.SkuCount > 0 && s.WareType == WareType.云仓).Count().ToString(); + JSTWareTaskCount = SealBoxConfigureModelList.Where(s => s.SkuCount > 0 && s.WareType == WareType.聚水潭).Count().ToString(); + StoreWareTaskCount = SealBoxConfigureModelList.Where(s => s.SkuCount > 0 && s.WareType == WareType.商家仓).Count().ToString(); + })); + } + + + + + private void SetWareMaxCount(SealBoxConfigureWareHourseModel model) + { + SealBoxConfigureModelList.Where(s => s.WareType == SelectWareType && s.TaskId == model.TaskId) + .ForAll(s => + { + + s.WareHourseDatas?.ForAll(d => + { + if (d.WareId == model.WareId) + { + d.Count += s.WaitConfigureCount; + s.WaitConfigureCount = 0; + } + }); + + }); + } + + private void BatchSetWareMaxCount(string wareId) + { + SealBoxConfigureModelList.Where(s => s.WareType == SelectWareType) + .ForAll(s => + { + + s.WareHourseDatas?.ForAll(d => + { + if (d.WareId == wareId) + { + d.Count += s.WaitConfigureCount; + } + }); + + }); } 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) + public ICommand SearchSkuCommand { get; set; } + + public ICommand AddWareCommand { get; set; } + + public ICommand SpliteOtherWareCommand { get; set; } - ); - var otherCount = sealBoxConfigureModel.WareHourseDatas.Count(); - if (sealBoxConfigureModel.SplitCount <= 0 || sealBoxConfigureModel.SplitCount < otherCount) + public ICommand SelectWareTypeCommand { get; set; } + + public ICommand BatchSetWareMaxCountCommand { get; set; } + + + public ICommand SetWareMaxCountCommand { get; set; } + + + private void SearchSku() + { + if (SearchSkuId.IsNullOrEmpty()) { - MessageBox.Show("份数不正确"); - return; + switch (SelectWareType) + { + case WareType.京仓: + JdConfigureModelList = new ObservableCollection(); + SealBoxConfigureModelList.Where(s => s.WareType == WareType.京仓 && s.SkuCount > 0).ForAll(s => + { + App.Current.Dispatcher.Invoke(new Action(() => + { + JdConfigureModelList.Add(s); + })); + }); + + break; + case WareType.云仓: + CloudConfigureModelList = new ObservableCollection(); + SealBoxConfigureModelList.Where(s => s.WareType == WareType.云仓 && s.SkuCount > 0).ForAll(s => + { + App.Current.Dispatcher.Invoke(new Action(() => + { + CloudConfigureModelList.Add(s); + })); + + }); + break; + case WareType.商家仓: + StoreConfigureModelList = new ObservableCollection(); + SealBoxConfigureModelList.Where(s => s.WareType == WareType.商家仓 && s.SkuCount > 0).ForAll(s => + { + App.Current.Dispatcher.Invoke(new Action(() => + { + StoreConfigureModelList.Add(s); + })); + + }); + break; + case WareType.聚水潭: + JstConfigureModelList = new ObservableCollection(); + SealBoxConfigureModelList.Where(s => s.WareType == WareType.聚水潭 && s.SkuCount > 0).ForAll(s => + { + App.Current.Dispatcher.Invoke(new Action(() => + { + JstConfigureModelList.Add(s); + })); + + }); + break; + default: + break; + } + } + else + { + switch (SelectWareType) + { + case WareType.京仓: + JdConfigureModelList = new ObservableCollection(); + SealBoxConfigureModelList.Where(s => s.SkuId == SearchSkuId && s.WareType == WareType.京仓 && s.SkuCount > 0).ForAll(s => + { + App.Current.Dispatcher.Invoke(new Action(() => + { + JdConfigureModelList.Add(s); + })); + + }); + break; + case WareType.云仓: + CloudConfigureModelList = new ObservableCollection(); + SealBoxConfigureModelList.Where(s => s.SkuId == SearchSkuId && s.WareType == WareType.云仓 && s.SkuCount > 0).ForAll(s => + { + App.Current.Dispatcher.Invoke(new Action(() => + { + CloudConfigureModelList.Add(s); + })); + + }); + break; + case WareType.商家仓: + StoreConfigureModelList = new ObservableCollection(); + SealBoxConfigureModelList.Where(s => s.SkuId == SearchSkuId && s.WareType == WareType.商家仓 && s.SkuCount > 0).ForAll(s => + { + App.Current.Dispatcher.Invoke(new Action(() => + { + StoreConfigureModelList.Add(s); + })); + + }); + break; + case WareType.聚水潭: + JstConfigureModelList = new ObservableCollection(); + SealBoxConfigureModelList.Where(s => s.SkuId == SearchSkuId && s.WareType == WareType.聚水潭 && s.SkuCount > 0).ForAll(s => + { + App.Current.Dispatcher.Invoke(new Action(() => + { + JstConfigureModelList.Add(s); + })); + + }); + break; + default: + break; + } + } - int resetIndex = 1; - foreach (var item in sealBoxConfigureModel.WareHourseDatas) + + + switch (SelectWareType)//加载动态仓库头 { - item.Index = resetIndex; - resetIndex++; + case WareType.京仓: + if (JdConfigureModelList.Count > 0 && JdConfigureModelList[0].WareHourseDatas?.Count > 0) + { + JdWareHourseHeaderList = JdConfigureModelList[0].WareHourseDatas; + } + else + { + JdWareHourseHeaderList = new ObservableCollection(); + } + break; + case WareType.云仓: + if (CloudConfigureModelList.Count > 0 && CloudConfigureModelList[0].WareHourseDatas?.Count > 0) + { + CloudWareHourseHeaderList = CloudConfigureModelList[0].WareHourseDatas; + } + else + { + CloudWareHourseHeaderList = new ObservableCollection(); + } + break; + case WareType.商家仓: + if (StoreConfigureModelList.Count > 0 && StoreConfigureModelList[0].WareHourseDatas?.Count > 0) + { + StoreWareHourseHeaderList = StoreConfigureModelList[0].WareHourseDatas; + } + else + { + StoreWareHourseHeaderList = new ObservableCollection(); + } + break; + case WareType.聚水潭: + if (JstConfigureModelList.Count > 0 && JstConfigureModelList[0].WareHourseDatas?.Count > 0) + { + JstWareHourseHeaderList = JstConfigureModelList[0].WareHourseDatas; + } + else + { + JstWareHourseHeaderList = new ObservableCollection(); + } + break; + default: + break; } - for (var i = 1 + otherCount; i <= sealBoxConfigureModel.SplitCount; i++) + + + + LoadCount(); + } + private void AddWare() + { + AddWareListWindow addWareListWindow = new AddWareListWindow(SelectWareType, logisticsService, SealBoxConfigureModelList); + addWareListWindow.AddWareList = AddWareList; + addWareListWindow.ShowDialog(); + } + + void AddWareList(WareType wareType, List storeWares) + { + + var oldList = sealBoxConfigureModelList.Where(s => s.WareType == wareType).SelectMany(s => s.WareHourseDatas).Select(w => w.WareId).Distinct().ToList();//原ids + var newList = storeWares.Select(s => s.WareId).Distinct().ToList(); + var addList = newList.Except(oldList).ToList(); + var deletedList = oldList.Except(newList).ToList(); + + sealBoxConfigureModelList.Where(s => s.WareType == wareType).ForAll(s => { - sealBoxConfigureModel.WareHourseDatas.Add(new SealBoxConfigureWareHourseModel() + + if (s.WareHourseDatas == null) + s.WareHourseDatas = new ObservableCollection { }; + + foreach (var item in addList) { - Index = i, - Count = 0 + s.WareHourseDatas.Add(new SealBoxConfigureWareHourseModel + { + Count = 0, + SealBoxId = null, + WareId = item, + WareName = storeWares.FirstOrDefault(f => f.WareId == item)?.WareName, + TotalWareCount = TotalCount, + TaskId = s.TaskId + }); + } + + foreach (var item in deletedList) + { + var deletedCount = s.WareHourseDatas.Where(w => w.WareId == item).Select(w => w.Count).Sum(); + s.WaitConfigureCount += deletedCount; + + ObservableCollection d = new ObservableCollection(); + + foreach (var WareHourseData in s.WareHourseDatas) + { + if (item == WareHourseData.WareId) + continue; + d.Add(WareHourseData); + } + s.WareHourseDatas = d; + } + + + }); + SearchSku(); + } + + /// + /// + /// + /// + /// + public void TotalCount(int count, long taskId) + { + + var totalSkuItemCount = sealBoxConfigureModelList.Where(s => s.TaskId == taskId && s.WareType == SelectWareType).SelectMany(s => s.WareHourseDatas).Sum(s => s.Count); + + + + sealBoxConfigureModelList.Where(s => s.TaskId == taskId && s.WareType == SelectWareType).ForAll( + + s => + { + if (totalSkuItemCount > s.SkuCount) + { + MessageBox.Show($"总量超过可分配量,请重新分配,任务id:{s.TaskId}"); + } + s.WaitConfigureCount = s.SkuCount - totalSkuItemCount; }); + } + + + + + private void SpliteOtherWare(SealBoxConfigureModel model)// + { + if (model.WaitConfigureCount <= 0) + { + MessageBox.Show($"可分配量不足!当前可分配量:{model.WaitConfigureCount}", "提示"); + return; } + SplitOtherWareWindow splitOtherWareWindow = new SplitOtherWareWindow(model.WaitConfigureCount, SelectWareType, (count, waretype) => + { + model.WaitConfigureCount -= count; + model.SkuCount -= count; + var type = SealBoxConfigureModelList.SingleOrDefault(s => s.TaskId == model.TaskId && s.WareType == waretype); + if (type != null) + { + type.SkuCount += count; + type.WaitConfigureCount += count; - } + } + else + { + var data = new SealBoxConfigureModel + { + Logo = model.Logo, + WareType = waretype, + SkuCount = count, + SkuId = model.SkuId, + SkuName = model.SkuName, + TaskId = model.TaskId, + TaskState = model.TaskState, + WaitConfigureCount = count, + }; + data.WareHourseDatas = new ObservableCollection(); + switch (waretype) + { + case WareType.京仓: + + if (JdWareHourseHeaderList != null) + foreach (var item in JdWareHourseHeaderList) + { + data.WareHourseDatas.Add(new SealBoxConfigureWareHourseModel + { + TaskId = model.TaskId, + SealBoxId = item.SealBoxId, + TotalWareCount = TotalCount, + WareId = item.WareId, + WareName = item.WareName, + //WareType = s.WareType, + WareState = item.WareState + }); + } + break; + case WareType.云仓: + if (CloudWareHourseHeaderList != null) + foreach (var item in CloudWareHourseHeaderList) + { + data.WareHourseDatas.Add(new SealBoxConfigureWareHourseModel + { + TaskId = model.TaskId, + SealBoxId = item.SealBoxId, + TotalWareCount = TotalCount, + WareId = item.WareId, + WareName = item.WareName, + //WareType = s.WareType, + WareState = item.WareState + }); + } + + break; + case WareType.商家仓: + if (StoreWareHourseHeaderList != null) + foreach (var item in StoreWareHourseHeaderList) + { + data.WareHourseDatas.Add(new SealBoxConfigureWareHourseModel + { + TaskId = model.TaskId, + SealBoxId = item.SealBoxId, + TotalWareCount = TotalCount, + WareId = item.WareId, + WareName = item.WareName, + //WareType = s.WareType, + WareState = item.WareState + }); + } + + break; + case WareType.聚水潭: + if (JstWareHourseHeaderList != null) + foreach (var item in JstWareHourseHeaderList) + { + data.WareHourseDatas.Add(new SealBoxConfigureWareHourseModel + { + TaskId = model.TaskId, + SealBoxId = item.SealBoxId, + TotalWareCount = TotalCount, + WareId = item.WareId, + WareName = item.WareName, + //WareType = s.WareType, + WareState = item.WareState + }); + } + + break; + default: + break; + } + SealBoxConfigureModelList.Add(data); + } + SearchSku(); + + }); + splitOtherWareWindow.ShowDialog(); + } private StoreResponse store; private void SetPackCountAndStore(object obj) { @@ -110,27 +604,27 @@ namespace BBWY.Client.ViewModels.SealBox { Id = sealBoxConfigureWareHourseModel.WareId, Name = sealBoxConfigureWareHourseModel.WareName, - Type = ToStockType(sealBoxConfigureWareHourseModel.WareType), + //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; + //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; - } + //} } /// @@ -138,46 +632,68 @@ namespace BBWY.Client.ViewModels.SealBox /// 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 PositionType ToPositionType(WareType wareType) + //{ + // switch (wareType) + // { + // case WareType.京仓: + // return PositionType.京仓; + // break; + // case WareType.云仓: + // return PositionType.云仓; + // break; + // case WareType.商家仓: + // return PositionType.商家仓; + // break; + // case WareType.聚水潭: + // return PositionType.聚水潭; + // break; + // default: + // break; + // } + // return PositionType.聚水潭; + //} + + //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) { @@ -187,36 +703,24 @@ namespace BBWY.Client.ViewModels.SealBox SetSealBoxConfiguredRequest setSealBoxConfiguredRequest = new SetSealBoxConfiguredRequest(); setSealBoxConfiguredRequest.ShopId = globalContext.User.Shop.ShopId.ToString(); IList SetSealBoxConfiguredDatas = new List(); + foreach (var sealBoxConfigureModel in SealBoxConfigureModelList) { - if (sealBoxConfigureModel.WareHourseDatas==null|| !sealBoxConfigureModel.WareHourseDatas.Any(w=>w.Count>0)) + if (sealBoxConfigureModel.WareHourseDatas == null || !sealBoxConfigureModel.WareHourseDatas.Any(w => w.Count > 0))//未配置 { continue; } - - - //判断存在0的报错 - - if (sealBoxConfigureModel.WareHourseDatas.Any(w=>w.Count==0)) + if (sealBoxConfigureModel.WaitConfigureCount != 0) { - System.Windows.MessageBox.Show($"任务id:{sealBoxConfigureModel.TaskId}中,存在未配置的数据"); + MessageBox.Show($"任务id:{sealBoxConfigureModel.TaskId}中,采购数量:{sealBoxConfigureModel.SkuCount} 不等于 分箱总数量:{sealBoxConfigureModel.WareHourseDatas.Select(s => s.Count).Sum()}"); return; } - - - ////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()) + if (SealBoxConfigureModelList.Where(s => s.TaskId == sealBoxConfigureModel.TaskId).Any(s => s.WaitConfigureCount != 0)) { - MessageBox.Show($"任务id:{sealBoxConfigureModel.TaskId}中,采购数量:{sealBoxConfigureModel.SkuCount} 不等于 分箱总数量:{sealBoxConfigureModel.WareHourseDatas.Select(s => s.Count).Sum()}"); + MessageBox.Show($"任务id:{sealBoxConfigureModel.TaskId}中,存在部分落仓 未设置数据"); return; } SetSealBoxConfiguredDatas.Add(new SetSealBoxConfiguredData @@ -224,12 +728,12 @@ namespace BBWY.Client.ViewModels.SealBox SkuId = sealBoxConfigureModel.SkuId, TaskId = sealBoxConfigureModel.TaskId, TotalCount = sealBoxConfigureModel.SkuCount, - WareHourseDatas = sealBoxConfigureModel.WareHourseDatas.Select(x => new WareHourseData + WareHourseDatas = sealBoxConfigureModel.WareHourseDatas.Where(w => w.Count > 0).Select(x => new WareHourseData//上传过滤0数据 { Count = x.Count, WareId = x.WareId, WareName = x.WareName, - WareType = x.WareType.Value, + WareType = sealBoxConfigureModel.WareType.Value, }).ToList(), }); } @@ -246,7 +750,7 @@ namespace BBWY.Client.ViewModels.SealBox return; } if (ReflashWindow != null) ReflashWindow(); - + var window = obj as BWindow; window.Close(); } @@ -264,32 +768,30 @@ namespace BBWY.Client.ViewModels.SealBox 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()) + if (sealBoxConfigureModel.WaitConfigureCount != 0) { - MessageBox.Show($"任务id:{sealBoxConfigureModel.TaskId} 中,采购数量:{sealBoxConfigureModel.SkuCount} 不等于 分箱总数量:{sealBoxConfigureModel.WareHourseDatas.Select(s => s.Count).Sum()}"); + MessageBox.Show($"任务id:{sealBoxConfigureModel.TaskId}中,采购数量:{sealBoxConfigureModel.SkuCount} 不等于 分箱总数量:{sealBoxConfigureModel.WareHourseDatas.Select(s => s.Count).Sum()}"); + return; + } + if (SealBoxConfigureModelList.Where(s => s.TaskId == sealBoxConfigureModel.TaskId).Any(s => s.WaitConfigureCount != 0)) + { + MessageBox.Show($"任务id:{sealBoxConfigureModel.TaskId}中,存在部分落仓 未设置数据"); return; } + UpdateSealBoxConfiguredDatas.Add(new UpdateSealBoxConfiguredDataRequest { TaskId = sealBoxConfigureModel.TaskId, SkuCount = sealBoxConfigureModel.SkuCount, - SealBoxConfiguredWareHourseRequests = sealBoxConfigureModel.WareHourseDatas.Select(x => new SealBoxConfiguredWareHourseRequest + SealBoxConfiguredWareHourseRequests = sealBoxConfigureModel.WareHourseDatas.Where(w => w.Count > 0).Select(x => new SealBoxConfiguredWareHourseRequest { Count = x.Count, WareId = x.WareId, WareName = x.WareName, - WareType = x.WareType.Value, + WareType = sealBoxConfigureModel.WareType.Value, WareState = x.WareState, - SealBoxId=x.SealBoxId + SealBoxId = x.SealBoxId }).ToList(), }); @@ -303,7 +805,7 @@ namespace BBWY.Client.ViewModels.SealBox MessageBox.Show("网络异常"); return; } - if (!setSealBoxRes.Success || setSealBoxRes.Data == null || !setSealBoxRes.Data) + if (!setSealBoxRes.Success || !setSealBoxRes.Data) { MessageBox.Show(setSealBoxRes.Msg); return; @@ -316,8 +818,7 @@ namespace BBWY.Client.ViewModels.SealBox } - - public Action ReflashWindow { get; set; } + public Action ReflashWindow { get; set; } } } diff --git a/BBWY.Client/ViewModels/ServiceOrder/ServiceOrderViewModel.cs b/BBWY.Client/ViewModels/ServiceOrder/ServiceOrderViewModel.cs index b286832e..f3f4e305 100644 --- a/BBWY.Client/ViewModels/ServiceOrder/ServiceOrderViewModel.cs +++ b/BBWY.Client/ViewModels/ServiceOrder/ServiceOrderViewModel.cs @@ -47,9 +47,6 @@ namespace BBWY.Client.ViewModels public ICommand SetServiceOrderStateCommand { get; set; } public ICommand SetReturnDirectionCommand { get; set; } public ICommand OnPageIndexChangedCommand { get; set; } - - public ICommand CopyTextCommand { get; set; } - public ICommand SetSearchDateCommand { get; set; } public ICommand SearchServiceOrderCommand { get; set; } diff --git a/BBWY.Client/ViewModels/TotalPackTask/ShopPackTaskTotalViewModel.cs b/BBWY.Client/ViewModels/TotalPackTask/ShopPackTaskTotalViewModel.cs new file mode 100644 index 00000000..4dbac35f --- /dev/null +++ b/BBWY.Client/ViewModels/TotalPackTask/ShopPackTaskTotalViewModel.cs @@ -0,0 +1,207 @@ +using BBWY.Client.APIServices; +using BBWY.Client.Models.PackTask; +using BBWY.Common.Models; +using BBWY.Controls; +using GalaSoft.MvvmLight.Command; +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; +using System.Windows; +using System.Linq; +using AutoMapper.Internal; +using WebSocketSharp; + +namespace BBWY.Client.ViewModels.TotalPackTask +{ + + public class ShopPackTaskTotalViewModel : BaseVM, IDenpendency + { + private readonly PackTaskService packTaskService; + private bool isLoading; + private DateTime startDate; + private DateTime endDate; + private int pageIndex = 1; + private int pageSize = 15; + private int orderCount; + private string searchTaskId; + + private string searchSkuId; + private ObservableCollection packTaskTotalList; + + public ObservableCollection PackTaskTotalList { get => packTaskTotalList; set { Set(ref packTaskTotalList, value); } } + public string SearchSkuId { get => searchSkuId; set { Set(ref searchSkuId, value); } } + + public string SearchTaskId { get => searchTaskId; set { Set(ref searchTaskId, value); } } + + public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } + + + public DateTime StartDate { get => startDate; set { Set(ref startDate, value); } } + + public DateTime EndDate { get => endDate; set { Set(ref endDate, value); } } + + public int PageIndex { get => pageIndex; set { Set(ref pageIndex, value); } } + + public int PageSize { get => pageSize; set { Set(ref pageSize, value); } } + + public int OrderCount { get => orderCount; set { Set(ref orderCount, value); } } + + private decimal totalPackDiscountFees; + /// + /// 总打包费用 + /// + public decimal TotalPackDiscountFees { get => totalPackDiscountFees; set { Set(ref totalPackDiscountFees, value); } } + + private decimal totalConsumableFees; + /// + /// 总耗材费 + /// + public decimal TotalConsumableFees { get => totalConsumableFees; set { Set(ref totalConsumableFees, value); } } + + private decimal totalFees; + /// + /// 总耗材费 + /// + public decimal TotalFees { get => totalFees; set { Set(ref totalFees, value); } } + + + public ICommand SetSearchDateCommand { get; set; } + + public ICommand SearchTaskTotalCommand { get; set; } + + public ICommand ExportCommand { get; set; } + + public ICommand OrderPageIndexChangedCommand { get; set; } + + + + //public IList departmentList; + //ShopService shopService; + public ShopPackTaskTotalViewModel(PackTaskService packTaskService, GlobalContext globalContext) + { + this.packTaskService = packTaskService; + SearchTaskTotalCommand = new RelayCommand(() => + { + SearchTask(1); + }); + + StartDate = DateTime.Now; + EndDate = DateTime.Now; + + SetSearchDateCommand = new RelayCommand(d => + { + EndDate = d == 1 ? DateTime.Now.Date.AddDays(-1) : DateTime.Now; + StartDate = DateTime.Now.Date.AddDays(d * -1); + PageIndex = 1; + Task.Factory.StartNew(() => LoadOrder(1)); //点击日期查询订单 + }); + + OrderPageIndexChangedCommand = new RelayCommand(p => + { + LoadOrder(p.PageIndex); + }); + + ExportCommand = new RelayCommand(Export); + + SearchTaskTotal(); + this.globalContext = globalContext; + } + + + GlobalContext globalContext; + private void Export() + { + + SaveFileDialog save = new SaveFileDialog(); + save.Filter = "csv files(*.csv)|*.csv"; + var result = save.ShowDialog(); + if (result == null || !result.Value) + { + return; + } + + string fileName = save.FileName; + + Task.Factory.StartNew(() => + { + IsLoading = true; + var res = packTaskService.ShopTotalV2(SearchSkuId, SearchTaskId, globalContext.User.Shop.ShopId.ToString(), StartDate, EndDate, null, + null, 0, 0);//获取全部数据 + if (res.Success) + { + //string title = "任务ID,日期,是否结清,部门,店铺,对接人,sku名称,sku数量,增值服务,打包服务,耗材服务,原价,促销折扣,结算价格,对接备注"; + string title = "任务ID,日期,是否结清,所属部门,所属店铺,包装数量,收货数量,耗材总价,工序类型,工序套餐,工序单价,包装原价,包装折扣系数,包装折扣价,总收费"; + var excelList = res.Data.ShopTotals.Select(x => x.ToString()).ToList(); + excelList.Insert(0, title); + System.IO.File.WriteAllLines(fileName, excelList, Encoding.UTF8); + } + IsLoading = false; + + }); + + } + + + + private void SearchTaskTotal() + { + + PackTaskTotalList = new ObservableCollection(); + Task.Factory.StartNew(() => + { + IsLoading = true; + var res = packTaskService.ShopTotalV2(SearchSkuId, SearchTaskId, globalContext.User.Shop.ShopId.ToString(), StartDate, EndDate, null, + null, PageIndex, PageSize); + if (res != null && res.Success) + { + OrderCount = res.Data.TotalCount; + TotalConsumableFees = res.Data.TotalConsumableFees; + TotalPackDiscountFees = res.Data.TotalPackDiscountFees; + TotalFees = TotalConsumableFees + TotalPackDiscountFees; + foreach (var shopTotal in res.Data.ShopTotals) + { + if (!shopTotal.ProcessComboName.IsNullOrEmpty()) + shopTotal.FeesItemResponse = new Models.APIModel.Response.PackTask.FeesItemResponse + { + AllFees = shopTotal.AllFees.Value, + PackFees = shopTotal.PackDisCountFees.Value, + TaskId = shopTotal.TaskId, + ProcessTypeName = shopTotal.ProcessTypeName, + ProcessComboName = shopTotal.ProcessComboName, + ConsumableFees = shopTotal.ConsumableFees, + ConsumableList = shopTotal.ConsumableList, + ProcessComboPrice = shopTotal.ProcessComboPrice, + ProcessComboTaskCount = shopTotal.ProcessComboTaskCount, + DiscountFoctor = shopTotal.DiscountFactor + }; + + App.Current.Dispatcher.Invoke(() => + { + PackTaskTotalList.Add(shopTotal); + }); + } + + } + + IsLoading = false; + }); + + + } + + private void LoadOrder(int pageIndex) + { + SearchTask(pageIndex); + } + + private void SearchTask(int pageIndex) + { + PageIndex = pageIndex; + SearchTaskTotal(); + } + } +} diff --git a/BBWY.Client/ViewModels/ViewModelLocator.cs b/BBWY.Client/ViewModels/ViewModelLocator.cs index 15f647b0..0aa86d5c 100644 --- a/BBWY.Client/ViewModels/ViewModelLocator.cs +++ b/BBWY.Client/ViewModels/ViewModelLocator.cs @@ -100,6 +100,17 @@ namespace BBWY.Client.ViewModels } } + public ShopPackTaskTotalViewModel ShopPackTaskTotal + { + get + { + using (var s = sp.CreateScope()) + { + return s.ServiceProvider.GetRequiredService(); + } + } + } + public ServiceOrderViewModel ServiceOrderList { get @@ -356,6 +367,25 @@ namespace BBWY.Client.ViewModels } } + public ExportOrderSkuViewModel ExportOrderSkuVM + { + get + { + using var s = sp.CreateScope(); + return s.ServiceProvider.GetRequiredService(); + } + } + + public StorePickSelfViewModel StorePickSelfVM + { + get + { + using var s = sp.CreateScope(); + return s.ServiceProvider.GetRequiredService(); + } + } + + //public ShopSealBoxListViewModel ShopSealBoxListVM //{ // get diff --git a/BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml b/BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml index 8a82b085..1c252c83 100644 --- a/BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml +++ b/BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml @@ -132,7 +132,7 @@ - + @@ -147,7 +147,7 @@ + WaterRemark="包装备注" Margin="400 64 0 0 " AcceptsReturn="True" TextWrapping="Wrap"> - { diff --git a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml index dc9755aa..55c1b65c 100644 --- a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml +++ b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml @@ -71,8 +71,8 @@ - diff --git a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml.cs b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml.cs index 68c5aee7..301b73d7 100644 --- a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml.cs +++ b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml.cs @@ -76,7 +76,7 @@ namespace BBWY.Client.Views.FallWare break; case WareType.商家仓: break; - case WareType.聚水潭齐越仓: + case WareType.聚水潭: btn_yuncang.IsEnabled = false; btn_jingcang.IsEnabled = false; panel_jingcang.Visibility = Visibility.Collapsed; @@ -154,7 +154,7 @@ namespace BBWY.Client.Views.FallWare }); return; } - if (wareType == WareType.云仓|| wareType == WareType.聚水潭齐越仓) + if (wareType == WareType.云仓|| wareType == WareType.聚水潭) { if (JDWareBoxModel.PurchaseOrder.IsNullOrEmpty()) @@ -163,7 +163,7 @@ namespace BBWY.Client.Views.FallWare return; } - if (wareType == WareType.聚水潭齐越仓) + if (wareType == WareType.聚水潭) { if (JDWareBoxModel.PurchaseOrder.IsNullOrEmpty()) { diff --git a/BBWY.Client/Views/FallWare/WaitFallWareControl.xaml b/BBWY.Client/Views/FallWare/WaitFallWareControl.xaml index c657bbbc..ecb4227e 100644 --- a/BBWY.Client/Views/FallWare/WaitFallWareControl.xaml +++ b/BBWY.Client/Views/FallWare/WaitFallWareControl.xaml @@ -75,10 +75,10 @@ + > - + @@ -118,9 +118,21 @@ + + + + + - + @@ -191,12 +203,14 @@ - + + - + diff --git a/BBWY.Client/Views/Order/ExportOrderSkuView.xaml b/BBWY.Client/Views/Order/ExportOrderSkuView.xaml new file mode 100644 index 00000000..03e4dd2f --- /dev/null +++ b/BBWY.Client/Views/Order/ExportOrderSkuView.xaml @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/Order/ExportOrderSkuView.xaml.cs b/BBWY.Client/Views/Order/ExportOrderSkuView.xaml.cs new file mode 100644 index 00000000..9ad5dfe9 --- /dev/null +++ b/BBWY.Client/Views/Order/ExportOrderSkuView.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.Order +{ + /// + /// ExportOrderSkuView.xaml 的交互逻辑 + /// + public partial class ExportOrderSkuView : Page + { + public ExportOrderSkuView() + { + InitializeComponent(); + } + } +} diff --git a/BBWY.Client/Views/PackTask/CerControl.xaml b/BBWY.Client/Views/PackTask/CerControl.xaml index aabf219b..647f6066 100644 --- a/BBWY.Client/Views/PackTask/CerControl.xaml +++ b/BBWY.Client/Views/PackTask/CerControl.xaml @@ -24,9 +24,9 @@ - - - + + + @@ -37,8 +37,8 @@ - - + + @@ -62,8 +62,8 @@ - - + + @@ -74,8 +74,8 @@ - - + + @@ -96,8 +96,8 @@ - - + + @@ -108,8 +108,8 @@ - - + + @@ -137,8 +137,8 @@ - - + + @@ -149,8 +149,8 @@ - - + + diff --git a/BBWY.Client/Views/PackTask/FeesExcelControl.xaml b/BBWY.Client/Views/PackTask/FeesExcelControl.xaml index dfa33e31..2d7fab4d 100644 --- a/BBWY.Client/Views/PackTask/FeesExcelControl.xaml +++ b/BBWY.Client/Views/PackTask/FeesExcelControl.xaml @@ -51,10 +51,10 @@ - + - + diff --git a/BBWY.Client/Views/PackTask/FeesExcelControl.xaml.cs b/BBWY.Client/Views/PackTask/FeesExcelControl.xaml.cs index b2dfb232..5e813fde 100644 --- a/BBWY.Client/Views/PackTask/FeesExcelControl.xaml.cs +++ b/BBWY.Client/Views/PackTask/FeesExcelControl.xaml.cs @@ -184,7 +184,7 @@ namespace BBWY.Client.Views.PackTask /// - /// index 从1开始 0+1 增值服务 和打包耗材 + /// index 从1开始 0+1 增值服务 和包装耗材 /// string columnData = @" @@ -330,9 +330,9 @@ namespace BBWY.Client.Views.PackTask string increateService = @" "; - string workProcess = "\r\n \r\n "; + string workProcess = "\r\n \r\n "; - string consumableService = "\r\n \r\n "; + string consumableService = "\r\n \r\n "; @@ -436,7 +436,7 @@ namespace BBWY.Client.Views.PackTask - if (basicProcessList.Count > 0)//打包服务 + if (basicProcessList.Count > 0)//包装服务 { rowIndex++; diff --git a/BBWY.Client/Views/PackTask/FeesExcelV2Control.xaml b/BBWY.Client/Views/PackTask/FeesExcelV2Control.xaml index 30084201..97de50cb 100644 --- a/BBWY.Client/Views/PackTask/FeesExcelV2Control.xaml +++ b/BBWY.Client/Views/PackTask/FeesExcelV2Control.xaml @@ -43,7 +43,7 @@ - + diff --git a/BBWY.Client/Views/PackTask/FeesExcelV2Control.xaml.cs b/BBWY.Client/Views/PackTask/FeesExcelV2Control.xaml.cs index 0318a478..753df95c 100644 --- a/BBWY.Client/Views/PackTask/FeesExcelV2Control.xaml.cs +++ b/BBWY.Client/Views/PackTask/FeesExcelV2Control.xaml.cs @@ -25,6 +25,25 @@ namespace BBWY.Client.Views.PackTask { InitializeComponent(); } + public bool IsShopTotal + { + get + { + return (bool)GetValue(IsShopTotalProperty); + + } + set + { + SetValue(IsShopTotalProperty, value); + } + } + public static readonly DependencyProperty IsShopTotalProperty = + DependencyProperty.Register("IsShopTotal", typeof(bool), typeof(FeesExcelV2Control),new PropertyMetadata(false)); + //["IsShopTotal"] + + + + public FeesItemResponse FeesItem { get @@ -54,12 +73,9 @@ namespace BBWY.Client.Views.PackTask } - - - string xaml = @" - + [:Columns:] @@ -69,15 +85,9 @@ namespace BBWY.Client.Views.PackTask - - - - - - - + @@ -90,51 +100,6 @@ namespace BBWY.Client.Views.PackTask [:ListData:] "; - - - - - - - - string processComboStr1 = @" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "; - - - - string processComboStr = @" @@ -162,10 +127,6 @@ namespace BBWY.Client.Views.PackTask "; - - - - string discountFactorStr = @" @@ -188,10 +149,6 @@ namespace BBWY.Client.Views.PackTask "; - - - - string columnStr = ""; string workProcess = "\r\n \r\n "; @@ -329,10 +286,17 @@ namespace BBWY.Client.Views.PackTask //.Replace("[:DiscountFees:]", $"{discountFees.ToString(" 0.00")}"); - // + newGrid = newGrid.Replace(@"[:Visity:]", ""); - + if (IsShopTotal)//[:IsShopTotal:] + { + newGrid = newGrid.Replace(@"[:IsShopTotal:]", @"Width=""0"""); + } + else + { + newGrid = newGrid.Replace(@"[:IsShopTotal:]", ""); + } var grid = XamlReader.Parse(newGrid) as Grid; diff --git a/BBWY.Client/Views/PackTask/PackDetailWindow.xaml b/BBWY.Client/Views/PackTask/PackDetailWindow.xaml index 8e55cbcd..e6e0e354 100644 --- a/BBWY.Client/Views/PackTask/PackDetailWindow.xaml +++ b/BBWY.Client/Views/PackTask/PackDetailWindow.xaml @@ -83,7 +83,7 @@ - + @@ -96,14 +96,7 @@ - - - - - - - - + @@ -319,7 +312,7 @@ - + @@ -343,7 +336,7 @@ - + @@ -466,7 +459,7 @@ + CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBox}}, Path=ItemsSource}" Content="删除" Grid.Column="4"/> @@ -599,7 +592,7 @@ - + diff --git a/BBWY.Client/Views/PackTask/PackDetailWindow.xaml.cs b/BBWY.Client/Views/PackTask/PackDetailWindow.xaml.cs index cdee28c0..d53bb815 100644 --- a/BBWY.Client/Views/PackTask/PackDetailWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/PackDetailWindow.xaml.cs @@ -40,14 +40,14 @@ namespace BBWY.Client.Views.PackTask var serviceViewModel = this.DataContext as PackDetailViewModel; if (model.Brand.IsNullOrEmpty()) { - if (!model.BarCodeModel.Brand.IsNullOrEmpty()) + if (model.BarCodeModel!=null&&!model.BarCodeModel.Brand.IsNullOrEmpty()) model.Brand = model.BarCodeModel.Brand; else if (model.CertificateModel != null && model.CertificateModel.Any(c => c.Brand != null)) model.Brand = model.CertificateModel.FirstOrDefault(c => c.Brand != null)?.Brand; } if (model.BrandName.IsNullOrEmpty()) { - if (!model.BarCodeModel.BrandName.IsNullOrEmpty()) + if (model.BarCodeModel != null && !model.BarCodeModel.BrandName.IsNullOrEmpty()) model.BrandName = model.BarCodeModel.BrandName; else if (model.CertificateModel != null && model.CertificateModel.Any(c => c.BrandName != null)) model.BrandName = model.CertificateModel.FirstOrDefault(c => c.BrandName != null)?.BrandName; diff --git a/BBWY.Client/Views/PackTask/PackTaskTotal.xaml b/BBWY.Client/Views/PackTask/PackTaskTotal.xaml index 4500eb96..baec44bc 100644 --- a/BBWY.Client/Views/PackTask/PackTaskTotal.xaml +++ b/BBWY.Client/Views/PackTask/PackTaskTotal.xaml @@ -13,14 +13,12 @@ d:DesignHeight="450" d:DesignWidth="2048" Title="OrderList"> - 0 1 2 6 14 29 - @@ -37,9 +35,10 @@ - + - + + @@ -47,7 +46,7 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/SealBox/SetSealBoxPolicyWindow.xaml.cs b/BBWY.Client/Views/SealBox/SetSealBoxPolicyWindow.xaml.cs new file mode 100644 index 00000000..3e0e47f9 --- /dev/null +++ b/BBWY.Client/Views/SealBox/SetSealBoxPolicyWindow.xaml.cs @@ -0,0 +1,197 @@ +using BBWY.Client.Models.SealBox; +using BBWY.Client.ViewModels.SealBox; +using BBWY.Controls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Collections.ObjectModel; +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; +using AutoMapper.Internal; +using BBWY.Client.APIServices; + +namespace BBWY.Client.Views.SealBox +{ + /// + /// SetSealBoxPolicyWindow.xaml 的交互逻辑 + /// + public partial class SetSealBoxPolicyWindow : BWindow + { + public SetSealBoxPolicyWindow(IList sealBoxWaitConfigureModels, Action ReflashWindow, long sealboxId = 0) + { + InitializeComponent(); + var sealBoxConfigureVM = this.DataContext as SealBoxConfigureViewModel; + sealBoxConfigureVM.SealBoxConfigureModelList = sealBoxWaitConfigureModels.ToList(); + sealBoxConfigureVM.JdConfigureModelList = new ObservableCollection(); + sealBoxConfigureVM.CloudConfigureModelList = new ObservableCollection(); + sealBoxConfigureVM.JstConfigureModelList = new ObservableCollection(); + sealBoxConfigureVM.StoreConfigureModelList = new ObservableCollection(); + sealBoxConfigureVM.SealBoxId = sealboxId; + sealBoxConfigureVM.ReflashWindow = ReflashWindow; + LoadData(sealBoxWaitConfigureModels, sealboxId, sealBoxConfigureVM); + + sealBoxConfigureVM.LoadCount(); + } + + /// + /// 加载数据 + /// + /// + /// + /// + private void LoadData(IList sealBoxWaitConfigureModels, long sealboxId, SealBoxConfigureViewModel sealBoxConfigureVM) + { + + + if (sealboxId == 0)//设置 + { + sealBoxConfigureVM.JstWareHourseHeaderList = new ObservableCollection { + new SealBoxConfigureWareHourseModel{ + WareName = "齐越聚水潭",WareId="qiyuejushuitan" + } + }; + var storeListRes = sealBoxConfigureVM.logisticsService.GetStoreList(); + + if (storeListRes.Success) + { + //加载商家仓 全国仓 + var storeList = storeListRes.Data.Where(s=>s.Status== Models.StockStatus.使用); + + var store = storeList.FirstOrDefault(s => s.Id == "0");//商家全国仓 + if (store != null) + { + sealBoxConfigureVM.StoreWareHourseHeaderList = new ObservableCollection { + new SealBoxConfigureWareHourseModel{ + WareName = store.Name,WareId=store.Id + } + }; + } + + + //加载 泉州齐越云仓3号库 + var cloud = storeList.FirstOrDefault(s => s.Id == "800009450");//商家全国仓 + if (cloud != null) + { + sealBoxConfigureVM.CloudWareHourseHeaderList = new ObservableCollection { + new SealBoxConfigureWareHourseModel{ + WareName = cloud.Name,WareId=cloud.Id + } + }; + } + } + + //sealBoxConfigureVM.CloudWareHourseHeaderList = new ObservableCollection { + // new SealBoxConfigureWareHourseModel{ + // WareName = "泉州齐越云仓3号库",WareId="800009450" + // } + //}; + } + + + + foreach (var sealBoxWaitConfigureModel in sealBoxWaitConfigureModels) + { + if (sealBoxWaitConfigureModel.WareHourseDatas != null && sealBoxWaitConfigureModel.WareHourseDatas.Count > 0)//修改数据 + { + sealBoxWaitConfigureModel.WaitConfigureCount = 0; + sealBoxWaitConfigureModel.WareHourseDatas.ForAll(w => { w.TotalWareCount = sealBoxConfigureVM.TotalCount; w.TaskId = sealBoxWaitConfigureModel.TaskId; }); + } + else + { + sealBoxWaitConfigureModel.WaitConfigureCount = sealBoxWaitConfigureModel.SkuCount; + } + + + switch (sealBoxWaitConfigureModel.WareType.Value) + { + case Models.WareType.商家仓: + + if (sealboxId == 0) + { + if (sealBoxConfigureVM.StoreWareHourseHeaderList != null && sealBoxConfigureVM.StoreWareHourseHeaderList.Count > 0) + { + sealBoxConfigureVM.StoreWareHourseHeaderList.ForAll(s => + { + + sealBoxWaitConfigureModel.WareHourseDatas = new ObservableCollection { + new SealBoxConfigureWareHourseModel{ + WareName = s.WareName, + WareId=s.WareId, + TaskId=sealBoxWaitConfigureModel.TaskId, + TotalWareCount=sealBoxConfigureVM.TotalCount, + + } + }; + + }); + + } + + } + + + sealBoxConfigureVM.StoreConfigureModelList.Add(sealBoxWaitConfigureModel); + sealBoxConfigureVM.StoreWareHourseHeaderList = sealBoxWaitConfigureModel.WareHourseDatas; + break; + case Models.WareType.云仓: + if (sealboxId == 0) + { + if (sealBoxConfigureVM.CloudWareHourseHeaderList != null && sealBoxConfigureVM.CloudWareHourseHeaderList.Count > 0) + { + sealBoxConfigureVM.CloudWareHourseHeaderList.ForAll(s => + { + + sealBoxWaitConfigureModel.WareHourseDatas = new ObservableCollection { + new SealBoxConfigureWareHourseModel{ + WareName = s.WareName, + WareId=s.WareId, + TaskId=sealBoxWaitConfigureModel.TaskId, + TotalWareCount=sealBoxConfigureVM.TotalCount, + + } + }; + + }); + + } + + } + + + sealBoxConfigureVM.CloudConfigureModelList.Add(sealBoxWaitConfigureModel); + sealBoxConfigureVM.CloudWareHourseHeaderList = sealBoxWaitConfigureModel.WareHourseDatas; + break; + case Models.WareType.京仓: + sealBoxConfigureVM.JdConfigureModelList.Add(sealBoxWaitConfigureModel); + sealBoxConfigureVM.JdWareHourseHeaderList = sealBoxWaitConfigureModel.WareHourseDatas; + break; + case Models.WareType.聚水潭: + sealBoxConfigureVM.JstConfigureModelList.Add(sealBoxWaitConfigureModel); + if (sealboxId == 0) + { + sealBoxWaitConfigureModel.WareHourseDatas = new ObservableCollection { + new SealBoxConfigureWareHourseModel{ + WareName = "齐越聚水潭",WareId="qiyuejushuitan", TaskId=sealBoxWaitConfigureModel.TaskId, TotalWareCount=sealBoxConfigureVM.TotalCount, + + } + }; + } + + sealBoxConfigureVM.JstWareHourseHeaderList = sealBoxWaitConfigureModel.WareHourseDatas; + + + break; + default: + break; + } + + } + } + } +} diff --git a/BBWY.Client/Views/SealBox/ShopSealBoxListControl.xaml b/BBWY.Client/Views/SealBox/ShopSealBoxListControl.xaml index 1d767697..e16874ff 100644 --- a/BBWY.Client/Views/SealBox/ShopSealBoxListControl.xaml +++ b/BBWY.Client/Views/SealBox/ShopSealBoxListControl.xaml @@ -72,9 +72,14 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/SealBox/SplitOtherWareWindow.xaml.cs b/BBWY.Client/Views/SealBox/SplitOtherWareWindow.xaml.cs new file mode 100644 index 00000000..be2c39be --- /dev/null +++ b/BBWY.Client/Views/SealBox/SplitOtherWareWindow.xaml.cs @@ -0,0 +1,64 @@ +using BBWY.Client.Models; +using BBWY.Controls; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +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 +{ + /// + /// SplitOtherWareWindow.xaml 的交互逻辑 + /// + public partial class SplitOtherWareWindow : BWindow + { + public SplitOtherWareWindow(int waitCount, WareType wareType, Action SplitWare) + { + this. SplitWare = SplitWare; + WaitCount = waitCount; + WareTypeList.Remove(wareType);//移除当前落仓 + InitializeComponent(); + this.DataContext = this; + } + private Action SplitWare { get;set;} + private int waitCount; + public int WaitCount { get => waitCount; set { Set(ref waitCount, value); } } + + private int count; + public int Count { get => count; set { Set(ref count, value); } } + + private WareType selectWareType; + public WareType SelectWareType { get => selectWareType; set { Set(ref selectWareType, value); } } + + + private ObservableCollection wareTypeList=new ObservableCollection { + WareType.京仓, WareType.云仓, WareType.商家仓, WareType.聚水潭 + }; + public ObservableCollection WareTypeList { get => wareTypeList; set { Set(ref wareTypeList, value); } } + + private void BButton_Click(object sender, RoutedEventArgs e) + { + if (WaitCount< Count) + { + MessageBox.Show("可分配量不足!"); + return; + } + if (SplitWare != null) SplitWare(Count, SelectWareType); + + this.Close(); + } + + private void BButton_Click_1(object sender, RoutedEventArgs e) + { + Count = WaitCount; + } + } +} diff --git a/BBWY.Client/Views/SealBox/WaitSealBoxControl.xaml b/BBWY.Client/Views/SealBox/WaitSealBoxControl.xaml index 67535b76..4130954d 100644 --- a/BBWY.Client/Views/SealBox/WaitSealBoxControl.xaml +++ b/BBWY.Client/Views/SealBox/WaitSealBoxControl.xaml @@ -77,10 +77,10 @@ + > - + @@ -120,9 +120,19 @@ - + + + + - + @@ -132,13 +142,21 @@ - + - + + + + + + + @@ -192,12 +210,13 @@ - + - + @@ -210,77 +229,58 @@ - + - - - - - - - - - - - - - + + Text="{Binding WareHourseSkuCount}" + TextWrapping="Wrap" + HorizontalAlignment="Center" VerticalAlignment="Center" + /> - - + - + - - - + - - - - - + + + > + Visibility="{Binding IsSealBoxOverTime,Converter={StaticResource objConverter},ConverterParameter=false:Visible:Collapsed}" + > + Visibility="{Binding IsSealBoxOverTime,Converter={StaticResource objConverter},ConverterParameter=true:Visible:Collapsed}" + > + + > - + > @@ -299,7 +299,8 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BBWY.Client/Views/StorePickSelf/ShopStorePickSelfControl.xaml.cs b/BBWY.Client/Views/StorePickSelf/ShopStorePickSelfControl.xaml.cs new file mode 100644 index 00000000..76f69d3f --- /dev/null +++ b/BBWY.Client/Views/StorePickSelf/ShopStorePickSelfControl.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.StorePickSelf +{ + /// + /// ShopStorePickSelfControl.xaml 的交互逻辑 + /// + public partial class ShopStorePickSelfControl : UserControl + { + public ShopStorePickSelfControl() + { + InitializeComponent(); + } + } +} diff --git a/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml b/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml new file mode 100644 index 00000000..183ce15a --- /dev/null +++ b/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml.cs b/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml.cs new file mode 100644 index 00000000..6ce46085 --- /dev/null +++ b/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml.cs @@ -0,0 +1,59 @@ +using BBWY.Client.APIServices; +using BBWY.Client.Models.PackTask; +using BBWY.Controls; +using System; +using System.Collections.Generic; +using System.IO.Packaging; +using System.Text; +using System.Threading.Tasks; +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.StorePickSelf +{ + /// + /// StorePickProductWindow.xaml 的交互逻辑 + /// + public partial class StorePickProductWindow : BWindow + { + public StorePickProductWindow(StoreGetSelfResponse model, Func SaveData) + { + this. SaveData=SaveData; + StoreGetSelfResponse =model; + InitializeComponent(); + this.DataContext = this; + } + private string userName; + /// + /// 用户名 + /// + public string UserName { get => userName; set { Set(ref userName, value); } } + + private int count; + + public int Count { get => count; set { Set(ref count, value); } } + + private StoreGetSelfResponse storeGetSelfResponse; + + public StoreGetSelfResponse StoreGetSelfResponse { get=> storeGetSelfResponse; set {Set(ref storeGetSelfResponse,value); } } + private void BButton_Click(object sender, RoutedEventArgs e) + { + if (SaveData != null&& SaveData(Count, UserName)) + { + this.Close(); + } + + } + private Func SaveData { get; set; } + private void BButton_Click_1(object sender, RoutedEventArgs e) + { + Count = StoreGetSelfResponse.PickMaxCount; + } + } +} diff --git a/BBWY.Client/Views/StorePickSelf/StorePickSelfControl.xaml b/BBWY.Client/Views/StorePickSelf/StorePickSelfControl.xaml new file mode 100644 index 00000000..4c3e608a --- /dev/null +++ b/BBWY.Client/Views/StorePickSelf/StorePickSelfControl.xaml @@ -0,0 +1,303 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/StorePickSelf/StorePickSelfControl.xaml.cs b/BBWY.Client/Views/StorePickSelf/StorePickSelfControl.xaml.cs new file mode 100644 index 00000000..36e29dca --- /dev/null +++ b/BBWY.Client/Views/StorePickSelf/StorePickSelfControl.xaml.cs @@ -0,0 +1,253 @@ +using BBWY.Client.Helpers; +using BBWY.Client.Models.PackTask; +using BBWY.Client.ViewModels; +using BBWY.Common.Models; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +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; +using WebSocketSharp; + +namespace BBWY.Client.Views.StorePickSelf +{ + /// + /// StorePickSelfControl.xaml 的交互逻辑 + /// + public partial class StorePickSelfControl : UserControl + { + public StorePickSelfControl() + { + InitializeComponent(); + this.Loaded += Load; + } + GlobalContext globalContext; + + public void LoadShops(GlobalContext globalContext) + { + this.globalContext = globalContext; + shops = globalContext.User.ShopList.Select(s => s.ShopName).ToList(); + departments = globalContext.User.DepartmentList.Select(s => s.Name).ToList(); + + } + + private void Load(object sender, RoutedEventArgs e) + { + + try + { + var model = (App.Current.Resources["Locator"] as ViewModelLocator).Main; + + LoadShops(model.GlobalContext); + } + catch + { + + + } + } + public string QKApiHost { get; set; } + public void SelectionChangeCommand(object sender, SelectionChangedEventArgs e) + { + try + { + var list = (ListBox)sender; + if (list.Items.Count <= 0) + { + return; + } + var value = (ListBoxItem)list.SelectedValue; + var content = (Label)value.Content; + tb.Text = content.Content.ToString(); + tipBox.Visibility = Visibility.Collapsed; + } + catch (Exception) + { + + + } + + } + List departments = new List(); + + List shops = new List(); + private void tb_TextChanged(object sender, TextChangedEventArgs e) + { + + if (tipBox != null) + try + { + var textBoxt = (TextBox)sender; + //创建一个ListBox + + if (tipBox != null && tipBox.Items.Count > 0) + { + tipBox.Items.Clear(); + + } + + if (departments.Count <= 0) + { + if (QKApiHost.IsNullOrEmpty()) QKApiHost = "http://qiku.qiyue666.com"; + HttpClientHelper helper = new HttpClientHelper(QKApiHost); + + string url = $"{QKApiHost}/api/PackTask/GetAllDepartment";//获取所有数据 + var data = helper.Get(url); + + var res = JsonConvert.DeserializeObject>(data); + //创建一个ListBoxIem + if (res.Success) + { + if (res.Data != null && res.Data.Count() > 0) + { + foreach (var department in res.Data) + { + if (!departments.Contains(department.DePartmentName)) + { + departments.Add(department.DePartmentName); + } + + } + } + } + } + + if (string.IsNullOrEmpty(textBoxt.Text)) + { + tipBox.Visibility = Visibility.Collapsed; + return; + } + foreach (var department in departments) + { + if (department.Contains(textBoxt.Text)) + { + ListBoxItem item = new ListBoxItem(); + Label lb = new Label(); + lb.Content = department; + item.Content = lb; + tipBox.Items.Add(item); + } + + } + + tipBox.Visibility = Visibility.Visible; + } + catch (Exception) + { + + + } + + } + + private void tbShop_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + var textBoxt = (TextBox)sender; + //创建一个ListBox + + if (tipBoxShop != null && tipBoxShop.Items.Count > 0) + { + tipBoxShop.Items.Clear(); + + } + + if (shops.Count <= 0) + { + if (globalContext != null) + LoadShops(globalContext); + } + + if (string.IsNullOrEmpty(textBoxt.Text)) + { + tipBoxShop.Visibility = Visibility.Collapsed; + return; + } + foreach (var department in shops) + { + if (department.Contains(textBoxt.Text)) + { + ListBoxItem item = new ListBoxItem(); + Label lb = new Label(); + lb.Content = department; + item.Content = lb; + tipBoxShop.Items.Add(item); + } + + } + if (tipBoxShop != null) + tipBoxShop.Visibility = Visibility.Visible; + } + catch (Exception) + { + + + } + } + + private void tipBoxShop_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + try + { + var list = (ListBox)sender; + if (list.Items.Count <= 0) + { + return; + } + var value = (ListBoxItem)list.SelectedValue; + var content = (Label)value.Content; + tbShop.Text = content.Content.ToString(); + tipBoxShop.Visibility = Visibility.Collapsed; + } + catch (Exception) + { + + + } + } + + private void tb_LostFocus(object sender, RoutedEventArgs e) + { + try + { + if (tipBox != null && tipBox.Items.Count > 0) + { + tipBox.Items.Clear(); + + } + } + catch (Exception) + { + + + } + } + + private void tbShop_LostFocus(object sender, RoutedEventArgs e) + { + try + { + if (tipBoxShop != null && tipBoxShop.Items.Count > 0) + { + tipBoxShop.Items.Clear(); + + } + } + catch (Exception) + { + + + } + } + } +} diff --git a/BBWY.Client/Views/TotalPackTask/PackUserSalaryControl.xaml.cs b/BBWY.Client/Views/TotalPackTask/PackUserSalaryControl.xaml.cs index e52ba4f6..9dad9824 100644 --- a/BBWY.Client/Views/TotalPackTask/PackUserSalaryControl.xaml.cs +++ b/BBWY.Client/Views/TotalPackTask/PackUserSalaryControl.xaml.cs @@ -72,7 +72,7 @@ namespace BBWY.Client.Views.TotalPackTask [:Column:] - + diff --git a/BBWY.Client/Views/TotalPackTask/ShopPackTaskTotal.xaml b/BBWY.Client/Views/TotalPackTask/ShopPackTaskTotal.xaml new file mode 100644 index 00000000..228f8858 --- /dev/null +++ b/BBWY.Client/Views/TotalPackTask/ShopPackTaskTotal.xaml @@ -0,0 +1,344 @@ + + + 0 + 1 + 2 + 6 + 14 + 29 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +