diff --git a/BBWY.Client/APIServices/PackPurchaseTaskService.cs b/BBWY.Client/APIServices/PackPurchaseTaskService.cs new file mode 100644 index 00000000..dc395cb9 --- /dev/null +++ b/BBWY.Client/APIServices/PackPurchaseTaskService.cs @@ -0,0 +1,118 @@ +using BBWY.Client.Models; +using BBWY.Client.Models.APIModel; +using BBWY.Client.Models.APIModel.Request; +using BBWY.Client.Models.APIModel.Response.PackPurchaseTask; +using BBWY.Client.Models.APIModel.Response.PackTask; +using BBWY.Common.Http; +using BBWY.Common.Models; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; + +namespace BBWY.Client.APIServices +{ + public class PackPurchaseTaskService : BaseApiService, IDenpendency + { + public PackPurchaseTaskService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) + { + } + public ApiResponse UpdatePurchaseTask(UpdatePurchaseTaskRequest updatePurchaseTaskRequest) + { + return SendRequest(globalContext.QKApiHost, "api/PackPurchaseTask/UpdatePurchaseTask", updatePurchaseTaskRequest, null, HttpMethod.Post); + } + + public ApiResponse GetConfigPack(string skuId, string skuPurchaseSchemeId, string orderId) + { + return SendRequest(globalContext.QKApiHost, "api/PackPurchaseTask/GetConfigPack", new + { + skuId, + skuPurchaseSchemeId, + orderId + } + , null, HttpMethod.Post); + } + /// + /// + /// + /// + /// + /// 到货情况(物流状态)(已到货 = 0,部分到货 = 1,未到货 = 2) + /// + public ApiResponse UpdateAvailabilityState(string orderId, string skuId, int availability) + { + return SendRequest(globalContext.QKApiHost, "api/PackPurchaseTask/UpdatePurchaseTask", new + { + orderId, + skuId, + availability + }, null, HttpMethod.Post); + } + + public ApiResponse SaveBarCode(BarCodeRequest barCodeModel) + { + return SendRequest(globalContext.QKApiHost, "api/PackTask/CommitBarCode", barCodeModel + , null, HttpMethod.Post); + } + + public ApiResponse SaveCer(CerRequest cerRequest) + { + return SendRequest(globalContext.QKApiHost, "api/Certificate/CommitCerData", cerRequest + , null, HttpMethod.Post); + } + + + public ApiResponse GetProductSku(string skuId) + { + + return SendRequest(globalContext.QKApiHost, $"api/PackTask/SearchProduct?skuId={skuId}&ShopId={globalContext.User.Shop.ShopId}", null, null, HttpMethod.Get); + + } + + public ApiResponse UpdateOrderPackState(string skuId, string orderId) + { + + return SendRequest(globalContext.QKApiHost, $"api/PackPurchaseTask/UpdateOrderPackState", new + { + skuId, + orderId + }, null, HttpMethod.Post); + + } + + public ApiResponse IsExitQikuTask(string skuId, string orderId) + { + + return SendRequest(globalContext.QKApiHost, $"api/PackPurchaseTask/IsExitQikuTask", new + { + skuId, + orderId + }, null, HttpMethod.Post); + + } + + public ApiResponse GetQualityTask(long taskId) + { + + return SendRequest(globalContext.QKApiHost, $"api/PackPurchaseTask/GetQualityTask?taskId={taskId}", null, null, HttpMethod.Post); + + } + + public ApiResponse CompeteQualityTask(QualityTaskRequest competeQualityTask) + { + + return SendRequest(globalContext.QKApiHost, $"api/PackPurchaseTask/CompeteQualityTask", competeQualityTask, null, HttpMethod.Post); + + } + + public ApiResponse SearchBarCode(string skuId) + { + + return SendRequest(globalContext.QKApiHost, $"api/Barcode/SearchBarCodeBySkuId?skuId={skuId}", null, null, HttpMethod.Get); + + } + + + + } +} diff --git a/BBWY.Client/APIServices/PackTaskService.cs b/BBWY.Client/APIServices/PackTaskService.cs index 9c0d5bd7..2ef1068c 100644 --- a/BBWY.Client/APIServices/PackTaskService.cs +++ b/BBWY.Client/APIServices/PackTaskService.cs @@ -1,5 +1,6 @@ using BBWY.Client.Helpers; using BBWY.Client.Models; +using BBWY.Client.Models.APIModel; using BBWY.Client.Models.APIModel.Request; using BBWY.Client.Models.APIModel.Response.PackTask; using BBWY.Client.Models.PackTask; @@ -35,6 +36,18 @@ namespace BBWY.Client.APIServices ) { + + if (taskId!=null&&!string.IsNullOrEmpty(taskId.Trim())) + { + return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchNewPackTaskList", new + { + + + TaskId = taskId, + + ShopId = globalContext.User.Shop.ShopId.ToString() + }, null, HttpMethod.Post); + } return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchNewPackTaskList", new { @@ -49,17 +62,24 @@ namespace BBWY.Client.APIServices ShopId = globalContext.User.Shop.ShopId.ToString() }, null, HttpMethod.Post); } - public ApiResponse GetWareHouseList(int? isWorry = null, string departmentName = null, string skuId = null, string taskId = null, + public ApiResponse GetWareHouseList(int? isWorry = null, string departmentName = null, string skuId = null, string taskId = null, DateTime? startTime = null, DateTime? endTime = null, - TaskState? availability = null, - int? taskStatus = null, + PackTaskState? TaskState = null, + string ShopName = null, int pageIndex = 1, int pageSize = 10 - ) { - return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchNewPackTaskList", new + if (taskId != null && !string.IsNullOrEmpty(taskId.Trim())) + { + return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchTaskList", new + { + TaskId = taskId + + }, null, HttpMethod.Post); + } + return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchTaskList", new { IsWorry = isWorry, DepartmentName = departmentName, @@ -67,20 +87,20 @@ namespace BBWY.Client.APIServices TaskId = taskId, StartTime = startTime, EndTime = endTime, - Availability = availability, - TaskStatus = taskStatus, + TaskState = TaskState, PageIndex = pageIndex, - PageSize = pageSize + PageSize = pageSize, + ShopName = ShopName, }, null, HttpMethod.Post); } - + public ApiResponse GetAllCount() { - return SendRequest(globalContext.QKApiHost, "api/PackTask/GetProductSkuCount", - new { ShopId = globalContext.User.Shop.ShopId.ToString() } + return SendRequest(globalContext.QKApiHost, $"api/PackTask/GetProductSkuCount?shopId={globalContext.User.Shop.ShopId.ToString()}", + null , null, HttpMethod.Get); } public ApiResponse GetWareAllCount() @@ -148,6 +168,19 @@ namespace BBWY.Client.APIServices , null, HttpMethod.Post); } + + + + public ApiResponse SetPackTaskState(long taskId, PackTaskState packTaskState) + { + return SendRequest(globalContext.QKApiHost, "api/PackTask/SetPackTaskState", new + { + taskId = taskId, + TaskState= packTaskState + } + , null, HttpMethod.Post); + } + public ApiResponse SaveBarCode(BarCodeRequest barCodeModel) { return SendRequest(globalContext.QKApiHost, "api/PackTask/CommitBarCode", barCodeModel @@ -242,6 +275,9 @@ namespace BBWY.Client.APIServices userId = globalContext.User.Id.ToString(), }, null, HttpMethod.Post); } + + + } public class AddConsumableRequest { diff --git a/BBWY.Client/APIServices/PurchaseService.cs b/BBWY.Client/APIServices/PurchaseService.cs index 8a5c92ca..19bc8b84 100644 --- a/BBWY.Client/APIServices/PurchaseService.cs +++ b/BBWY.Client/APIServices/PurchaseService.cs @@ -80,5 +80,20 @@ namespace BBWY.Client.APIServices { return SendRequest(globalContext.BBYWApiHost, $"api/purchasescheme/DeletePurchaseScheme/{schemeId}", null, null, HttpMethod.Delete); } + + + + public ApiResponse GetPurchaseSkuBasicInfo(string purchaseProductId, Platform platform = Platform.阿里巴巴, int priceMode = 0, int firstApiMode = 0) + { + + + return SendRequest("http://bbwyb.qiyue666.com", $"Api/PurchaseScheme/GetPurchaseSkuBasicInfo", new + { + purchaseProductId, + platform, + priceMode, + firstApiMode + }, null, HttpMethod.Post); + } } } diff --git a/BBWY.Client/App.xaml.cs b/BBWY.Client/App.xaml.cs index e749423e..5014528f 100644 --- a/BBWY.Client/App.xaml.cs +++ b/BBWY.Client/App.xaml.cs @@ -6,8 +6,10 @@ using BBWY.Common.Http; using BBWY.Common.Models; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Newtonsoft.Json; using QuanTan.SDK.Client; using System; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.IO.MemoryMappedFiles; 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/Extensions/CopyExtensions.cs b/BBWY.Client/Extensions/CopyExtensions.cs index c2f2d442..b47fee80 100644 --- a/BBWY.Client/Extensions/CopyExtensions.cs +++ b/BBWY.Client/Extensions/CopyExtensions.cs @@ -1,4 +1,5 @@ using Newtonsoft.Json; +using System; namespace BBWY.Client.Extensions { @@ -9,4 +10,12 @@ namespace BBWY.Client.Extensions return JsonConvert.DeserializeObject(JsonConvert.SerializeObject(p)); } } + + public static class EnumExtension + { + public static T ToEnum(this string value) + { + return (T)Enum.Parse(typeof(T), value); + } + } } diff --git a/BBWY.Client/Models/APIModel/Request/CerRequest.cs b/BBWY.Client/Models/APIModel/Request/CerRequest.cs index 7a10d65d..194e8bee 100644 --- a/BBWY.Client/Models/APIModel/Request/CerRequest.cs +++ b/BBWY.Client/Models/APIModel/Request/CerRequest.cs @@ -71,5 +71,8 @@ namespace BBWY.Client.Models.APIModel.Request public int GoodsNumber { get; set; } public string ProduceDate { get; set; } + + + public string PurchaseSkuId { get; set; } } } diff --git a/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs b/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs new file mode 100644 index 00000000..fb10e901 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel.Request +{ + public class QualityTaskRequest + { + + /// + /// 任务id + /// + public long TaskId { get; set; } + /// + /// 拳探订单id + /// + public string OrderId { get; set; } + /// + /// skuid + /// + public string SkuId { get; set; } + /// + /// 备注信息 + /// + public string MarkMessage { get; set; } + /// + /// 配件数 + /// + public int GoodsNumber { get; set; } + /// + /// sku配件名称 + /// + public string SkuGoodsTitle { get; set; } + + /// + /// 增量1() + /// + public string Increment1 { get; set; } + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public BasicPack BasicPack { get; set; } + + /// + /// 打包类型(单件=0,多件=1) + /// + public PackType PackType { get; set; } + /// + /// 货号品名(手写上传) + /// + public string BrandName { get; set; } + + /// + /// 合格证位置(外部包装=0,产品包装=1) + /// + public CertificatePosition CertificatePosition { get; set; } + + /// + /// 合格证id + /// + public string CerId { get; set; } + /// + /// 显示的条码Id + /// + public long? BarcodeId { get; set; } + //public BarCodeDTO BarCodeDTO { get; set; } + /// + /// 是否需要合格证 + /// + public bool IsNeedBar { get; set; } + /// + /// 是否需要合格证 + /// + public bool IsNeedCer { get; set; } + + ///// + ///// 配件列表 + ///// + //public PurchaseSku[] PurchaseSkus { get; set; } + + /// + /// 到货数量 + /// + public int ArrivalQuantity { get; set; } + + /// + /// 良品数量 + /// + public int GoodProductQuantity { get; set; } + + /// + /// 预计完成时间 + /// + public DateTime? PreCompeteTime { get; set; } + + } +} diff --git a/BBWY.Client/Models/APIModel/Request/UpdatePurchaseTaskRequest.cs b/BBWY.Client/Models/APIModel/Request/UpdatePurchaseTaskRequest.cs new file mode 100644 index 00000000..09c44955 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Request/UpdatePurchaseTaskRequest.cs @@ -0,0 +1,139 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel.Request +{ + /// + /// 修改采购单任务 + /// + public class UpdatePurchaseTaskRequest + { + + /// + /// sku数量 + /// + public int SkuCount { get; set; } + /// + /// 到货情况(已到货 = 0,部分到货 = 1,未到货 = 2) + /// + public int Availability { get; set; } + /// + /// 落仓(本地仓=0,齐越仓=1,京东仓=2) + /// + public int PositionType { get; set; } + + /// + /// 打包类型(单件=0,多件=1) + /// + public int PackType { get; set; } + /// + /// 配件数量 + /// + public int GoodsNumber { get; set; } + /// + /// sku配件名称 + /// + public string SkuGoodsTitle { get; set; } + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public int BasicPack { get; set; } + /// + /// 增量耗材 + /// + public string Increment1 { get; set; } + + /// + /// 注意事项 + /// + public string MarkMessage { get; set; } + + /// + ///条形码Id + /// + public long? BarCodeId { get; set; } + + /// + /// 合格证Id 格式: id,id 186,187 + /// + public string CerId { get; set; } + /// + /// 是否需要条形码 + /// + public bool? NeedBar { get; set; } + /// + /// 是否需要合格证 + /// + public bool? NeedCer { get; set; } + /// + /// 合格证位置 + /// + public int? CertificatePosition { get; set; } + + /// + /// 加急 + /// + public int IsWorry { get; set; } + + /// + /// 拳探订单id + /// + public string OrderId { get; set; } + + /// + /// skuId + /// + public string SkuId { get; set; } + + #region 更新数据 + /// + /// 品名 + /// + public string BrandName { get; set; } + /// + /// 货号 + /// + public string ProductNo { get; set; } + + /// + /// 图 + /// + public string Logo { get; set; } + + /// + /// 名称 + /// + public string SkuName { get; set; } + /// + /// 品牌 + /// + public string Brand { get; set; } + #endregion + + /// + /// 采购方案id + /// + public string SkuPurchaseSchemeId { get; set; } + + /// + /// 保存 配置商品合格证状态配置信息 + /// + public PurchaseSkuSpec[] PurchaseSkuSpecs { get; set; } + } + + /// + /// 配置商品合格证状态 + /// + public class PurchaseSkuSpec + { + /// + /// 商品配件id + /// + public string PurchaseSkuId { get; set; } + /// + /// 合格证配置状态 + /// + public bool IsNeedCer { get; set; } + } +} diff --git a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs new file mode 100644 index 00000000..0e12d342 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs @@ -0,0 +1,63 @@ +using BBWY.Client.Models.APIModel.Response.PackTask; +using BBWY.Client.Models.QualityTask; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + /// + /// 配置打包信息数据 + /// + public class ConfigPackResponse + { + + /// + /// 配件列表 + /// + public PurchaseSku[] PurchaseSkus { get; set; } + + /// + /// 采购方案id + /// + public string SkuPurchaseSchemeId { get; set; } + /// + /// 条形码 + /// + public BarCodeModel BarCode { get; set; } + + public PackConfig PackConfig { get; set; } + } + ///// + ///// 配件sku + ///// + //public class PurchaseSku + //{ + // /// + // /// 配件图 + // /// + // public string Logo { get; set; } + // /// + // /// 配件商品Id + // /// + // public string PurchaseSkuId { get; set; } + + // /// + // /// 配件商品spuId + // /// + // public string PurchaseProductId { get; set; } + // /// + // /// 配件名称 + // /// + // public string Title { get; set; } + // /// + // /// 是否需要配置合格证 + // /// + // public bool IsNeedCer { get; set; } + + // /// + // /// 合格证配置信息 + // /// + // public CertificateModel CerDTO { get; set; } + //} +} diff --git a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs new file mode 100644 index 00000000..f8f767c6 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs @@ -0,0 +1,121 @@ +using BBWY.Client.Models.QualityTask; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel.Response.PackPurchaseTask +{ + public class QualityTaskResponse + { + /// + /// 任务id + /// + public long Id { get; set; } + /// + /// 拳探订单id + /// + public string OrderId { get; set; } + /// + /// 备注信息 + /// + public string MarkMessage { get; set; } + /// + /// Sku打包数量 + /// + public int SkuCount { get; set; } + /// + /// skuid + /// + public string SkuId { get; set; } + + /// + /// sku标题 + /// + public string SkuName { get; set; } + /// + /// 采购方案id + /// + public string SkuPurchaseSchemeId { get; set; } + + /// + /// 配件数 + /// + public int GoodsNumber { get; set; } + /// + /// sku配件名称 + /// + public string SkuGoodsTitle { get; set; } + + /// + /// 增量1() + /// + public string Increment1 { get; set; } + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public int BasicPack { get; set; } + + /// + /// 打包类型(单件=0,多件=1) + /// + public int PackType { get; set; } + /// + /// 货号品名(手写上传) + /// + public string BrandName { get; set; } + /// + /// 货号 + /// + public string ProductNo { get; set; } + /// + /// 分箱配置 + /// + public WareHourseDTO[] WareHourses { get; set; } + + + public BarCodeModel BarCodeDTO { get; set; } + /// + /// 是否需要合格证 + /// + public bool IsNeedBar { get; set; } + /// + /// 是否需要合格证 + /// + public bool IsNeedCer { get; set; } + + + /// + /// 合格证位置(外部包装=0,产品包装=1) + /// + public int? CertificatePosition { get; set; } + + /// + /// 配件列表 + /// + public PurchaseSku[] PurchaseSkus { get; set; } + } + public class WareHourseDTO + { + + /// + /// 序号 + /// + public int Index { get; set; } + /// + /// 仓库id + /// + public string WareId { get; set; } + /// + /// 仓库名称 + /// + public string WareName { get; set; } + /// + /// 数量 + /// + public int Count { get; set; } + /// + /// 仓库类型 + /// + public WareType? WareType { get; set; } + } +} diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuCountsResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuCountsResponse.cs index 4d7a8813..e6dd9cd9 100644 --- a/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuCountsResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuCountsResponse.cs @@ -6,13 +6,35 @@ namespace BBWY.Client.Models.APIModel.Response.PackTask { public class ProductSkuCountsResponse { - + /// + /// 已到货(质检) + /// public int ArrivedCount { get; set; } - + /// + /// 未到货 + /// public int NoArrivedCount { get; set; } - + /// + /// 部分到货 + /// public int SomeArrivedCount { get; set; } - + /// + /// 加急数量 + /// public int WorryCount { get; set; } + + /// + /// 待打包数 + /// + public int? WaitPackCount { get; set; } + + /// + /// 带封箱数 + /// + public int? WaitSealBox { get; set; } + /// + /// 待出库数 + /// + public int? WaitOutbound { get; set; } } } diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuResponse.cs index a27a9d28..713ae946 100644 --- a/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuResponse.cs @@ -48,6 +48,8 @@ namespace BBWY.Client.Models.APIModel.Response.PackTask public BarCodeModel BarCodeModel { get; set; } + + /// /// 合格证信息 /// diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs new file mode 100644 index 00000000..27dbc3f8 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs @@ -0,0 +1,169 @@ +using BBWY.Client.Models.APIModel.Response.PackPurchaseTask; +using BBWY.Client.Models.APIModel.Response.PackTask; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + public class SearchTaskListResponse + { + /// + /// 查询总数据(判断总页数) + /// + public int TotalCount { get; set; } + + /// + /// 页面返回的数据 + /// + public PackTaskData[] Items { get; set; } + } + + + public class PackTaskData + { + /// + /// 图片链接 + /// + public string Logo { get; set; } + + /// + /// 任务id + /// + public long TaskId { get; set; } + + /// + /// 需求方创建日期 + /// + public DateTime CreateTime { get; set; } + + /// + /// 任务状态 + /// + public PackTaskState TaskState { get; set; } + + /// + /// 需求方团队 + /// + public string DepartmentName { get; set; } + + /// + /// 需求方店铺 + /// + public string ShopName { get; set; } + + /// + /// 货号 + /// + public string ProductItemNum { get; set; } + + /// + /// 货号品名 + /// + public string BrandName { get; set; } + + /// + /// 对接人 + /// + public string UserName { get; set; } + + /// + /// 打包人 + /// + public string[] PackUserName { get; set; } + + /// + /// skuid + /// + public string SkuId { get; set; } + /// + /// SKU标题 + /// + public string SkuName { get; set; } + /// + /// sku数量 + /// + public int SkuCount { get; set; } + /// + /// 打包类型(单件=0,多件=1) + /// + public int PackType { get; set; } + + /// + /// 落仓(本地仓=0,齐越仓=1,京东仓=2,聚水潭=3) + /// + public string PositionType { get; set; } + + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public int BasicPack { get; set; } + + /// + /// 增量1() + /// + public string Increment1 { get; set; } + + + /// + /// 到货情况(待收货=0,部分收货=1,已到货=2) + /// + public int Availability { get; set; } + + + /// + /// 服务费用数据 + /// + public FeesItemResponse FeesItemResponse { get; set; } + + + /// + /// 合格证位置(外部包装=0,产品包装=1) + /// + public int? CertificatePosition { get; set; } + + + /// + /// sku配件名称 + /// + public string SkuGoodsTitle { get; set; } + + /// + /// 配件数 + /// + public int GoodsNumber { get; set; } + + + /// + /// 注意事项(对接备注) + /// + public string MarkMessage { get; set; } + + + /// + /// 条形码数据 + /// + public BarCodeModel BarCodeDTO { get; set; } + + /// + /// 合格证数据 + /// + public CertificateModel[] Cers { get; set; } + /// + /// 是否加急 + /// + public int IsWorry { get; set; } + + /// + /// 品牌 + /// + public string Brand { get; set; } + + public string OrderId { get; set; } + + /// + ///分箱情况 + /// + public WareHourseDTO[] WareHourses { get; set; } + } +} diff --git a/BBWY.Client/Models/APIModel/Response/PurchaseOrder/PurchaseSkuBasicInfoResponse.cs b/BBWY.Client/Models/APIModel/Response/PurchaseOrder/PurchaseSkuBasicInfoResponse.cs new file mode 100644 index 00000000..24e194cd --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PurchaseOrder/PurchaseSkuBasicInfoResponse.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models +{ + + /// + /// 采购Sku基础信息对象 + /// + public class PurchaseSkuBasicInfoResponse + { + /// + /// 采购SKU基础信息列表 + /// + public IList ItemList { get; set; } + + /// + /// 采购商 + /// + public Purchaser Purchaser { get; set; } + } + + /// + /// 采购Sku基础信息对象 + /// + public class PurchaseSkuItemBasicInfoResponse + { + /// + /// 采购SPU + /// + public string PurchaseProductId { get; set; } + + /// + /// 采购SKU + /// + public string PurchaseSkuId { get; set; } + + /// + /// 采购SPEC 1688独有属性 下单需要 + /// + public string PurchaseSkuSpecId { get; set; } + + /// + /// SKU标题 + /// + public string Title { get; set; } + + public string Logo { get; set; } + + /// + /// 单价 + /// + public decimal Price { get; set; } + } +} diff --git a/BBWY.Client/Models/Enums.cs b/BBWY.Client/Models/Enums.cs index c707ceb3..e729248f 100644 --- a/BBWY.Client/Models/Enums.cs +++ b/BBWY.Client/Models/Enums.cs @@ -209,9 +209,9 @@ } - /// - /// 快递到货情况 - /// + ///// + ///// 快递到货情况 + ///// public enum TaskState { 已到货 = 0, @@ -221,6 +221,24 @@ 全部 = 4, 加急 = 5 } + /// + /// 仓库打包任务状态 + /// + public enum PackTaskState + { + 未到货 = 0, + 部分到货 = 1, + 待质检 = 2,//已到货 + 待打包 = 3, + 待封箱 = 4, + 待出库 = 5, + 已完成 = 6, + 已取消 = 7 + } + + + + /// /// 打包类型 /// @@ -418,4 +436,13 @@ { 暂停 = 0, 使用 = 1 } + public enum PackCerState + { + 合格证信息 = 0, 无需合格证 = 1 + } + public enum WareType + { + 京仓 = 0, 云仓 = 1, 商家仓 = 2, 聚水潭 = 3 + } + } diff --git a/BBWY.Client/Models/PackTask/CertificateModel.cs b/BBWY.Client/Models/PackTask/CertificateModel.cs index cde4a7ad..437d9a1a 100644 --- a/BBWY.Client/Models/PackTask/CertificateModel.cs +++ b/BBWY.Client/Models/PackTask/CertificateModel.cs @@ -23,7 +23,7 @@ namespace BBWY.Client.Models private string spuId; /// - /// 品牌 + /// spu /// public string SpuId { get => spuId; set { Set(ref spuId, value); } } @@ -139,10 +139,10 @@ namespace BBWY.Client.Models } - - private int goodsNumber =1; + + private int goodsNumber = 1; /// /// 配件序号 /// @@ -154,5 +154,9 @@ namespace BBWY.Client.Models /// public string ProduceDate { get => produceDate; set { Set(ref produceDate, value); } } + /// + /// 配件商品Id + /// + public string PurchaseSkuId { get; set; } } } diff --git a/BBWY.Client/Models/PackTask/PackTaskModel.cs b/BBWY.Client/Models/PackTask/PackTaskModel.cs index 1f2f0dbd..ad43c341 100644 --- a/BBWY.Client/Models/PackTask/PackTaskModel.cs +++ b/BBWY.Client/Models/PackTask/PackTaskModel.cs @@ -1,7 +1,9 @@ using BBWY.Client.APIServices; using BBWY.Client.Models.APIModel.Response.PackTask; using BBWY.Client.ViewModels; +using BBWY.Client.ViewModels.PackTask; using BBWY.Client.Views.PackTask; +using BBWY.Client.Views.QualityTask; using GalaSoft.MvvmLight.Command; using System; using System.Collections.Generic; @@ -35,13 +37,13 @@ namespace BBWY.Client.Models public ICommand LookCerCommand { get; set; } public ICommand LookBarCommand { get; set; } public ICommand SetServiceCommand { get; set; } - /// /// 修改任务 /// public ICommand UpdateTaskCommand { get; set; } - + public ICommand QualityTaskCommand { get; set; } + public Action ReflashTask { get; set; } @@ -85,6 +87,32 @@ namespace BBWY.Client.Models LookCerCommand = new RelayCommand(LookCer); SetServiceCommand = new RelayCommand(SetService); UpdateTaskCommand = new RelayCommand(UpdateTask); + QualityTaskCommand=new RelayCommand(QualityTask); + } + + private void QualityTask() + { + QualityWindow service = new QualityWindow(); + //加载数据 + ViewModelLocator viewModelLocator = new ViewModelLocator(); + var qualityViewModel = viewModelLocator.QualityTask; + + if (qualityViewModel.ReflashWindow == null) + qualityViewModel.ReflashWindow = ReflashTask; + //qualityViewModel.TaskCount = SkuCount; + // qualityViewModel.TaskId = TaskId; + qualityViewModel.OrderId = OrderId; + qualityViewModel.SkuId = SkuId; + qualityViewModel.SearchSku(this); + //qualityViewModel.LoadPackDatas(); + //qualityViewModel.SetAllFees = new Action>((feesItem, packUsers) => + //{ + // FeesItemResponse = feesItem; + // PackUser = string.Join("\r\n", packUsers); + // FeesItemResponse.DiscountAllFees = feesItem.disCount * feesItem.AllFees; + // IsShowFees = feesItem.AllFees > 0 ? true : false; + //}); + service.Show(); } private void SetService() @@ -98,12 +126,16 @@ namespace BBWY.Client.Models serviceViewModel.OrderId= OrderId; serviceViewModel.SkuId =SkuId ; serviceViewModel.LoadPackDatas(); + + serviceViewModel.SetAllFees = new Action>((feesItem, packUsers) => { FeesItemResponse = feesItem; PackUser = string.Join("\r\n", packUsers); FeesItemResponse.DiscountAllFees = feesItem.disCount * feesItem.AllFees; IsShowFees = feesItem.AllFees > 0 ? true : false; + + if (ReflashTask != null) ReflashTask(); }); service.Show(); } @@ -310,6 +342,13 @@ namespace BBWY.Client.Models public TaskStateType TaskStatus { get => taskStatus; set { Set(ref taskStatus, value); } } + private PackTaskState taskState; + /// + /// 打包仓库任务状态 + /// + public PackTaskState TaskState { get => taskState; set { Set(ref taskState, value); } } + + private PackType packType; /// /// 打包类型(单件=0,多件=1) @@ -353,11 +392,11 @@ namespace BBWY.Client.Models public Increment Increment2 { get => increment2; set { Set(ref increment2, value); } } - private PositionType positionType; + private string positionType; /// /// 落仓(本地仓=0,齐越仓=1,京东仓=2) /// - public PositionType PositionType { get => positionType; set { Set(ref positionType, value); } } + public string PositionType { get => positionType; set { Set(ref positionType, value); } } diff --git a/BBWY.Client/Models/QualityTask/PurchaseSku.cs b/BBWY.Client/Models/QualityTask/PurchaseSku.cs new file mode 100644 index 00000000..67f253c9 --- /dev/null +++ b/BBWY.Client/Models/QualityTask/PurchaseSku.cs @@ -0,0 +1,73 @@ +using GalaSoft.MvvmLight; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.QualityTask +{ + /// + /// 配件sku + /// + public class PurchaseSku : NotifyObject + { + + public string PurchaseProductId { get; set; } + + /// + /// 配件图 + /// + private string logo; + /// + /// 配件商品Id + /// + private string purchaseSkuId; + /// + /// 配件名称 + /// + private string title; + /// + /// 是否需要配置合格证 + /// + private bool isNeedCer; + /// + /// 配件图 + /// + public string Logo { get => logo; set { Set(ref logo, value); } } + /// + /// 配件商品Id + /// + public string PurchaseSkuId { get => purchaseSkuId; set { Set(ref purchaseSkuId, value); } } + /// + /// 配件名称 + /// + public string Title { get => title; set { Set(ref title, value); } } + /// + /// 是否需要配置合格证 + /// + public bool IsNeedCer { get => isNeedCer; set { Set(ref isNeedCer, value); } } + + /// + /// 合格证配置信息 + /// + public CertificateModel cerDTO; + /// + /// 合格证配置信息 + /// + public CertificateModel CerDTO { get => cerDTO; set { Set(ref cerDTO, value); } } + + private bool isSetCertificate; + /// + /// 设置显示(合格证) + /// + public bool IsSetCertificate + { + get => isSetCertificate; set + { + + Set(ref isSetCertificate, value); + //IsNeedCertificateModel = IsSetCertificate ? Need.不需要 : Need.需要; + } + } + + } +} diff --git a/BBWY.Client/ViewModels/MainViewModel.cs b/BBWY.Client/ViewModels/MainViewModel.cs index 1cd0a7ce..0fc9c5ad 100644 --- a/BBWY.Client/ViewModels/MainViewModel.cs +++ b/BBWY.Client/ViewModels/MainViewModel.cs @@ -31,6 +31,7 @@ namespace BBWY.Client.ViewModels private bool showWB2RuntimeDownloadPanel; private double wb2DownloadProgress; private IList managerDepartment; + private IList packDepartment; private WebView2Manager w2m; public GlobalContext GlobalContext { get; set; } public IList MenuList { get; set; } @@ -91,6 +92,9 @@ namespace BBWY.Client.ViewModels { this.w2m = w2m; this.managerDepartment = new List() { "董事办", "财务部", "技术部", "总经办" }; + this.packDepartment = new List() { "打包组" ,"发货组" , "仓储部" }; + + this.httpClientFactory = httpClientFactory; this.mdsApiService = mdsApiService; this.logisticsService = logisticsService; @@ -119,7 +123,7 @@ namespace BBWY.Client.ViewModels /// private void CreateMenu() { - if (GlobalContext.User.TeamName == "打包组" || GlobalContext.User.TeamName == "发货组" || GlobalContext.User.TeamName == "仓储部") + if (this.packDepartment.Contains(GlobalContext.User.TeamName)) { App.Current.Dispatcher.Invoke(() => @@ -268,13 +272,10 @@ namespace BBWY.Client.ViewModels CreateMenu(); - if (GlobalContext.User.TeamName == "打包组" || GlobalContext.User.TeamName == "发货组" || GlobalContext.User.TeamName == "仓储部") - { - return; - } + IList departmentList = null; - if (GlobalContext.User.TeamName == "刷单组" || + if (GlobalContext.User.TeamName == "刷单组" || this.packDepartment.Contains(GlobalContext.User.TeamName) || managerDepartment.Contains(GlobalContext.User.TeamName) || managerDepartment.Any(m => GlobalContext.User.SonDepartmentNames.Contains(m))) { @@ -346,6 +347,9 @@ namespace BBWY.Client.ViewModels } GlobalContext.User.DepartmentList = departmentList; + if (this.packDepartment.Contains(GlobalContext.User.TeamName)) + return; + if (GlobalContext.User.TeamName == "刷单组") return; diff --git a/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs index 9905066c..0b56c063 100644 --- a/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs @@ -1,5 +1,6 @@ using BarcodeLib; using BBWY.Client.APIServices; +using BBWY.Client.Extensions; using BBWY.Client.Helpers; using BBWY.Client.Models; using BBWY.Client.Models.APIModel.Request; @@ -426,7 +427,7 @@ namespace BBWY.Client.ViewModels.PackTask return; } SaveTask = "保存"; - Logo = model.ItemList[0].Logo; + Logo = model.ItemList[0].Logo.Copy(); SearchSkuId = model.SkuId; SkuId = model.SkuId; SkuCount = model.SkuCount; @@ -443,7 +444,12 @@ namespace BBWY.Client.ViewModels.PackTask GoodsNumber = model.GoodsNumber; Availability = model.Availability; IsWorry = model.IsWorry; - PositionType = model.PositionType; + + if (string.IsNullOrEmpty(model.OrderId)) + { + PositionType = model.PositionType.ToEnum(); + } + PackType = model.PackType; BasicPack = model.BasicPack; IsNeedBarCode = model.BarCodeModel == null ? Need.不需要 : Need.需要; @@ -789,7 +795,7 @@ namespace BBWY.Client.ViewModels.PackTask } if (!string.IsNullOrEmpty(BrandName)) foreach (var item in CertificateModel) item.BrandName = BrandName; - //CertificateModel.Foreach(c=>c.BrandName = BrandName) ; + //CertificateModel.Foreach(c=>c.BrandName = BrandName) ; SetCerWindow setCerWindow = new SetCerWindow(); setCerWindow.LoadData(CertificateModel, packTaskService, spuCertificateModel, IsSetSpuCertificate); setCerWindow.SaveResult = s => @@ -905,7 +911,7 @@ namespace BBWY.Client.ViewModels.PackTask new TipsWindow("请设置合格证模板").Show(); return; } - createTaskModel.CerId =string.Join(",", CertificateModel.Select(c=>c.Id));// + createTaskModel.CerId = string.Join(",", CertificateModel.Select(c => c.Id));// } ApiResponse res = null; if (TaskId > 0)//修改界面 @@ -1014,7 +1020,7 @@ namespace BBWY.Client.ViewModels.PackTask IsSetCertificate = false; if (CertificateModel == null) { - CertificateModel = new CertificateModel[] { + CertificateModel = new CertificateModel[] { new CertificateModel{ } }; IsSetCertificate = true; @@ -1022,7 +1028,7 @@ namespace BBWY.Client.ViewModels.PackTask } foreach (var item in CertificateModel) item.Brand = Brand; - + if (!string.IsNullOrEmpty(BrandName)) foreach (var item in CertificateModel) { @@ -1030,8 +1036,8 @@ namespace BBWY.Client.ViewModels.PackTask item.ProductNo = ProductNo; item.SkuId = SkuId; } - - + + BarCodeModel = productSku.Data.BarCodeModel; IsSetBarCode = false; if (BarCodeModel == null) diff --git a/BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs b/BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs index 57fcaee4..af420084 100644 --- a/BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs @@ -106,25 +106,9 @@ namespace BBWY.Client.ViewModels.PackTask ExportCommand = new RelayCommand(Export); SearchTaskTotal(); - - //LoadShopList(); } - private void LoadShopList() - { - - //departmentList=new List(); - //var response = shopService.GetDepartmentList(); - //if (!response.Success) - // throw new Exception(response.Msg); - //departmentList = response.Data.Map>(); - - - //var shopList = new List(); - //foreach (var d in departmentList) - // shopList.AddRange(d.ShopList); - - } + private void Export() { @@ -213,10 +197,7 @@ namespace BBWY.Client.ViewModels.PackTask private void SearchTaskTotal() { - if (IsBatchChecked) - { - BatchCheck(); - } + PackTaskTotalList = new ObservableCollection(); Task.Factory.StartNew(() => { @@ -233,7 +214,10 @@ namespace BBWY.Client.ViewModels.PackTask PackTaskTotalList.Add(shopTotal); }); } - + if (IsBatchChecked) + { + BatchCheck(); + } } IsLoading = false; diff --git a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs index 9d71b00b..b21b907d 100644 --- a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs @@ -1,4 +1,5 @@ using BBWY.Client.APIServices; +using BBWY.Client.Extensions; using BBWY.Client.Models; using BBWY.Client.Models.PackTask; using BBWY.Client.Views.PackTask; @@ -20,8 +21,8 @@ namespace BBWY.Client.ViewModels.PackTask { public class PublishTaskViewModel : BaseVM, IDenpendency { - - #region 属性 + + #region 属性 private string searchSkuId; public string SearchSkuId { get => searchSkuId; set { Set(ref searchSkuId, value); } } @@ -624,23 +625,29 @@ namespace BBWY.Client.ViewModels.PackTask GoodsNumber = model.GoodsNumber; Availability = model.Availability; IsWorry = model.IsWorry; - PositionType = model.PositionType; + try + { + PositionType = model.PositionType.ToEnum();//多个仓库异常 + } + catch + { + + } + PackType = model.PackType; BasicPack = model.BasicPack; IsNeedBarCode = model.BarCodeModel == null ? Need.不需要 : Need.需要; IsNeedCertificateModel = model.CertificateModel == null ? Need.不需要 : Need.需要; CertificatePosition = model.CertificatePosition; TaskId = model.TaskId; - - List increateDatas = new List(); - if (model.Increment1 != null) - increateDatas = model.Increment1.Split(',').ToList(); + + string[] increateDatas = model.Increment1?.Split(','); bool isTrue = false; foreach (var item in increates) { isTrue = false; - if (increateDatas.Count()>0&& increateDatas.Contains(item)) + if (increateDatas!=null&& increateDatas .Count()>0&& increateDatas.Contains(item)) { isTrue = true; } @@ -696,7 +703,7 @@ namespace BBWY.Client.ViewModels.PackTask var createTaskModel = new Models.APIModel.Request.CreateTaskRequest { ProductNo = ProductNo, - Logo = Logo, + Logo = Logo.Replace( "200x200", "80x80"), SkuName = SkuName, TaskId = TaskId, BrandName = BrandName, diff --git a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs index 30903b91..8680ba77 100644 --- a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs @@ -275,6 +275,18 @@ namespace BBWY.Client.ViewModels.PackTask /// public void SearchTaskList() { + try + { + if (SearchTaskId != null && !string.IsNullOrEmpty(SearchTaskId.Trim())) + Convert.ToInt64(SearchTaskId); + } + catch + { + System.Windows.MessageBox.Show("任务id必须为数字"); + return; + + } + IsLoading = true; Task.Factory.StartNew(() => { @@ -314,7 +326,7 @@ namespace BBWY.Client.ViewModels.PackTask MarkMessage = item.MarkMessage, PackType = (PackType)item.PackType, - PositionType = (PositionType)item.PositionType, + PositionType = ((PositionType)item.PositionType).ToString(), SkuCount = item.SkuCount, SkuTitle = item.SkuGoodsTitle, TaskId = item.TaskId, diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index d6af7ec4..225a331b 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -18,6 +18,7 @@ using HandyControl.Controls; using System.Windows; using System.Collections; using NPOI.SS.Formula.Functions; +using GalaSoft.MvvmLight.Messaging; namespace BBWY.Client.ViewModels.PackTask { @@ -35,6 +36,20 @@ namespace BBWY.Client.ViewModels.PackTask private DateTime endTime; public DateTime EndTime { get => endTime; set { Set(ref endTime, value); } } + + + + + + private string searchShopName; + public string SearchShopName + { + get => searchShopName; set + { + Set(ref searchShopName, value); + } + } + /// /// 查询任务id /// @@ -53,11 +68,11 @@ namespace BBWY.Client.ViewModels.PackTask private string searchSkuId; public string SearchSkuId { get => searchSkuId; set { Set(ref searchSkuId, value); } } - public TaskState? taskState; + public PackTaskState? taskState; /// /// 任务状态 /// - public TaskState? TaskState + public PackTaskState? TaskState { get => taskState; private set { @@ -78,25 +93,46 @@ namespace BBWY.Client.ViewModels.PackTask /// /// 未到货数量 /// - public int NoArrivedCount { get => noArrivedCount; set { Set(ref noArrivedCount, value); } } - private int noArrivedCount; - private int someArrivedCount; + public string NoArrivedCount { get => noArrivedCount; set { Set(ref noArrivedCount, value); } } + private string noArrivedCount; + private string someArrivedCount; /// /// 部分到货数量 /// - public int SomeArrivedCount { get => someArrivedCount; set { Set(ref someArrivedCount, value); } } - private int worryCount; + public string SomeArrivedCount { get => someArrivedCount; set { Set(ref someArrivedCount, value); } } + private string worryCount; /// /// 加急数 /// - public int WorryCount { get => worryCount; set { Set(ref worryCount, value); } } + public string WorryCount { get => worryCount; set { Set(ref worryCount, value); } } - private int arrivedCount; + private string arrivedCount; /// /// 已到货数量 /// - public int ArrivedCount { get => arrivedCount; set { Set(ref arrivedCount, value); } } + public string ArrivedCount { get => arrivedCount; set { Set(ref arrivedCount, value); } } + + + + + private string waitPackCount; + /// + /// 待打包数 + /// + public string WaitPackCount { get => waitPackCount; set { Set(ref waitPackCount, value); } } + private string waitSealBox; + /// + /// 带封箱数 + /// + public string WaitSealBox { get => waitSealBox; set { Set(ref waitSealBox, value); } } + private string waitOutbound; + /// + /// 待出库数 + /// + public string WaitOutbound { get => waitOutbound; set { Set(ref waitOutbound, value); } } + + //private int totalCount; ///// ///// 全部数量 @@ -113,7 +149,7 @@ namespace BBWY.Client.ViewModels.PackTask private bool isLoading; public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } - + private int? IsWorry { get; set; } public int? taskStatus { get; set; } private ObservableCollection packTaskList; @@ -146,13 +182,19 @@ namespace BBWY.Client.ViewModels.PackTask private readonly WorkProcessService workProcessService; private readonly PackTaskService packTaskService; private readonly IncreateServiceService increateServiceService; - public WareHouseListViewModel(PackTaskService packTaskService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateServiceService, ProductService productService, BatchPurchaseService batchPurchaseService) + public GlobalContext globalContext; + public WareHouseListViewModel(PackTaskService packTaskService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateServiceService, ProductService productService, BatchPurchaseService batchPurchaseService, GlobalContext globalContext) { + this.globalContext = globalContext; + + this.packTaskService = packTaskService; this.consumableService = consumableService; + + //Messenger.Default.Send(globalContext, "AcceptGlobalContext"); PackTaskList = new ObservableCollection();//初始化数据 - SetTaskStateCommand = new RelayCommand(SetTaskState); + SetTaskStateCommand = new RelayCommand(SetTaskState); SearchTaskCommand = new RelayCommand(() => { @@ -184,12 +226,18 @@ namespace BBWY.Client.ViewModels.PackTask SetTaskStatusCommand = new RelayCommand(SetTaskStatus); //加载数据 - SetTaskState(Models.TaskState.全部); + SetTaskState(null); this.workProcessService = workProcessService; this.increateServiceService = increateServiceService; this.productService = productService; this.batchPurchaseService = batchPurchaseService; + + UpdateTaskStateCommand = new RelayCommand(UpdateTaskState); + + } + + #region 事件绑定 public ICommand SetTaskStatusCommand { get; set; } @@ -207,6 +255,10 @@ namespace BBWY.Client.ViewModels.PackTask /// public ICommand SetTaskStateCommand { get; set; } + /// + /// 修改任务状态 + /// + public ICommand UpdateTaskStateCommand { get; set; } /// /// 搜索数据 /// @@ -224,52 +276,94 @@ namespace BBWY.Client.ViewModels.PackTask BatchPurchaseService batchPurchaseService; - public void SetTaskStatus(object obj ) + + private void UpdateTaskState(object obj) { var objList = (object[])obj; - long taskId = (long)objList[0]; + var packTaskState = (PackTaskState)objList[1]; - string orderId=(string)objList[1]; - ///修改完成 - var model = packTaskService.UpdateTaskStatus(taskId, 1,orderId); - if (model != null && model.Success) - SearchTaskList(); - - } - - public void SetTaskState(TaskState? taskState) - { - IsWorry = null; - TaskState = null; - taskStatus = null; - switch (taskState) + ApiResponse res = null; + switch (packTaskState) { - case null: + case PackTaskState.未到货: break; - case Models.TaskState.已到货: - case Models.TaskState.部分到货: //未完成的数据 - case Models.TaskState.未到货: - TaskState = taskState; - taskStatus = 0; + case PackTaskState.部分到货: break; - case Models.TaskState.全部: //所有数据 - + case PackTaskState.待质检: break; - case Models.TaskState.已完成: - - taskStatus = 1; + case PackTaskState.待打包: + res= packTaskService.SetPackTaskState(taskId, PackTaskState.待封箱); + break; + case PackTaskState.待封箱: + break; + case PackTaskState.待出库: break; - case Models.TaskState.加急: - taskStatus = 0; - IsWorry = 1; + case PackTaskState.已完成: + break; + case PackTaskState.已取消: break; default: break; } + if (res!=null&&res.Success) + { + SearchTaskList(); + } + + + } + public void SetTaskStatus(object obj) + { + var objList = (object[])obj; + + long taskId = (long)objList[0]; + + string orderId = (string)objList[1]; + ///修改完成 + var model = packTaskService.UpdateTaskStatus(taskId, 1, orderId); + if (model != null && model.Success) + SearchTaskList(); + + } + public void SetTaskState(PackTaskState? taskState) + { + TaskState = taskState; SearchTaskList(); } + //public void SetTaskState(TaskState? taskState) + //{ + // IsWorry = null; + // TaskState = null; + // taskStatus = null; + // switch (taskState) + // { + // case null: + // break; + // case Models.TaskState.已到货: + // case Models.TaskState.部分到货: //未完成的数据 + // case Models.TaskState.未到货: + // TaskState = taskState; + // taskStatus = 0; + // break; + // case Models.TaskState.全部: //所有数据 + + // break; + // case Models.TaskState.已完成: + + // taskStatus = 1; + // break; + // case Models.TaskState.加急: + // taskStatus = 0; + // IsWorry = 1; + // break; + // default: + // break; + // } + // SearchTaskList(); + + //} /// @@ -277,11 +371,33 @@ namespace BBWY.Client.ViewModels.PackTask /// public void SearchTaskList() { + try + { + if (SearchTaskId != null && !string.IsNullOrEmpty(SearchTaskId.Trim())) + Convert.ToInt64(SearchTaskId); + } + catch + { + System.Windows.MessageBox.Show("任务id必须为数字"); + return; + + } + + //string shopId = null; + //if (!string.IsNullOrEmpty(SearchShopName)) + //{ + // var searchShop = globalContext.User.ShopList.FirstOrDefault(g => g.ShopName == SearchShopName); + // if (searchShop != null) shopId = searchShop.ShopId.ToString(); + //} + + + IsLoading = true; Task.Factory.StartNew(() => { PackTaskList = new ObservableCollection();//初始化数据 - var datas = packTaskService.GetWareHouseList(IsWorry, SearchDepartment, SearchSkuId, SearchTaskId, StartTime, EndTime, (this.TaskState), taskStatus, + + var datas = packTaskService.GetWareHouseList(IsWorry, SearchDepartment, SearchSkuId, SearchTaskId, StartTime, EndTime, (this.TaskState), SearchShopName, PageIndex, PageSize); if (datas != null && datas.Data != null && datas.Success) { @@ -299,7 +415,6 @@ namespace BBWY.Client.ViewModels.PackTask GoodsNumber = item.GoodsNumber, Increment1 = item.Increment1, - Increment2 = (Increment)item.Increment2, ItemList = new List() { new SkuMessage { BrandName = item.BrandName, GoodsNo = item.ProductItemNum, Logo= item.Logo, @@ -309,17 +424,16 @@ namespace BBWY.Client.ViewModels.PackTask } }, MarkMessage = item.MarkMessage, PackType = (PackType)item.PackType, - - PositionType = (PositionType)item.PositionType, + TaskState = item.TaskState, + PositionType = item.PositionType, SkuCount = item.SkuCount, SkuTitle = item.SkuGoodsTitle, TaskId = item.TaskId, - TaskStatus = (TaskStateType)item.TaskStatus, EndTime = item.CreateTime, - OrderId= item.OrderId, + OrderId = item.OrderId, SkuId = item.SkuId, SkuName = item.SkuName, - + }; if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) { @@ -327,12 +441,14 @@ namespace BBWY.Client.ViewModels.PackTask data.BarCodeModel = item.BarCodeDTO; } - if (item.cers != null) + if (item.Cers != null) { - data.CertificateModel = item.cers; + data.CertificateModel = item.Cers; } + data.ReflashTask = ReflashTask; + if (item.FeesItemResponse != null) { data.FeesItemResponse = item.FeesItemResponse; @@ -379,10 +495,13 @@ namespace BBWY.Client.ViewModels.PackTask { App.Current.Dispatcher.Invoke(() => { - ArrivedCount = packTaskResult.Data.ArrivedCount; - NoArrivedCount = packTaskResult.Data.NoArrivedCount; - SomeArrivedCount = packTaskResult.Data.SomeArrivedCount; - WorryCount = packTaskResult.Data.WorryCount; + ArrivedCount = packTaskResult.Data.ArrivedCount.ToString(); + NoArrivedCount = packTaskResult.Data.NoArrivedCount.ToString(); + SomeArrivedCount = packTaskResult.Data.SomeArrivedCount.ToString(); + WorryCount = packTaskResult.Data.WorryCount.ToString(); + WaitOutbound = packTaskResult.Data.WaitOutbound?.ToString(); + WaitPackCount = packTaskResult.Data.WaitPackCount?.ToString(); + WaitSealBox = packTaskResult.Data.WaitSealBox?.ToString(); }); } } @@ -391,10 +510,15 @@ namespace BBWY.Client.ViewModels.PackTask PageIndex = pageIndex;// SearchTaskList(); } + public void ReflashTask()//刷新界面 + { + SearchTaskList(); + } + private void OpenSkuDetail(object param) { - var paramList = (object[])param; + var paramList = (object[])param; var skuId = paramList[1].ToString(); var url = $"https://item.jd.com/{skuId}.html"; try diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs new file mode 100644 index 00000000..dc28d734 --- /dev/null +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -0,0 +1,745 @@ +using BBWY.Client.APIServices; +using BBWY.Client.Models.PackTask; +using BBWY.Client.Models; +using BBWY.Client.Views.PackTask; +using BBWY.Common.Models; +using GalaSoft.MvvmLight.Command; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Windows.Input; +using System.Windows; +using BBWY.Client.Models.QualityTask; +using BBWY.Client.Views.QualityTask; +using BBWY.Client.Models.APIModel.Response.PackPurchaseTask; +using NPOI.Util.ArrayExtensions; +using System.Threading.Tasks; +using Org.BouncyCastle.Asn1.Crmf; +using System.Runtime.InteropServices.WindowsRuntime; +using NPOI.Util; +using BBWY.Controls; + +namespace BBWY.Client.ViewModels +{ + public class QualityViewModel : BaseVM, IDenpendency + { + #region 属性 + + + public int goodProductQuantity; + public int arrivalQuantity; + + /// + /// 到货数量 + /// + public int ArrivalQuantity { get => arrivalQuantity; set { Set(ref arrivalQuantity, value); } } + + /// + /// 良品数量 + /// + public int GoodProductQuantity { get => goodProductQuantity; set { Set(ref goodProductQuantity, value); } } + + /// + /// 预计完成时间 + /// + public DateTime? PreCompeteTime { get; set; } + + private ObservableCollection purchaseSkuList; + public ObservableCollection PurchaseSkuList { get => purchaseSkuList; set { Set(ref purchaseSkuList, value); } } + + private string searchSkuId; + public string SearchSkuId { get => searchSkuId; set { Set(ref searchSkuId, value); } } + + // public long TaskId { get; set; } + //private bool isSelected; + //public bool IsSelected { get => isSelected; set { Set(ref isSelected, value); } } + + private ObservableCollection worryList = new ObservableCollection { + "否","是" + }; + 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 { + "单件","多件" + }; + public ObservableCollection PackTypeList { get => packTypeList; set { Set(ref packTypeList, value); } } + + private ObservableCollection basicPackList = new ObservableCollection { + "快递袋","纸箱","麻袋" + }; + public ObservableCollection BasicPackList { get => basicPackList; set { Set(ref basicPackList, value); } } + + private ObservableCollection isNeedBarCodeList = new ObservableCollection { + "需要", "不需要" }; + public ObservableCollection IsNeedBarCodeList { get => isNeedBarCodeList; set { Set(ref isNeedBarCodeList, value); } } + + private ObservableCollection isNeedCerList = new ObservableCollection { + "需要", "不需要" }; + public ObservableCollection IsNeedCerList { get => isNeedCerList; set { Set(ref isNeedCerList, value); } } + + + private ObservableCollection certificatePositionList = new ObservableCollection { + "无","外部包装","产品包装" + }; + 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 preCompeteTimeDayList = new ObservableCollection { + + }; + public ObservableCollection PreCompeteTimeDayList { get => preCompeteTimeDayList; set { Set(ref preCompeteTimeDayList, value); } } + + + private ObservableCollection preCompeteTimeHourList = new ObservableCollection { + "12点前","18点前","21点前" + }; + public ObservableCollection PreCompeteTimeHourList { get => preCompeteTimeHourList; set { Set(ref preCompeteTimeHourList, value); } } + + // + public string preCompeteTimeDay; + public string PreCompeteTimeDay { get => preCompeteTimeDay; set { Set(ref preCompeteTimeDay, value); } } + + + + public string preCompeteTimeHour; + public string PreCompeteTimeHour { get => preCompeteTimeHour; set { Set(ref preCompeteTimeHour, value); } } + + + private ObservableCollection wareHourseList = new ObservableCollection { }; + public ObservableCollection WareHourseList { get => wareHourseList; set { Set(ref wareHourseList, value); } } + + private int wareHourseCount; + public int WareHourseCount { get => wareHourseCount; set { Set(ref wareHourseCount, value); } } + + + + private int skuCount; + /// + /// Sku任务数 + /// + public int SkuCount { get => skuCount; set { Set(ref skuCount, value); } } + + private string skuId; + /// + /// Sku + /// + public string SkuId { get => skuId; set { Set(ref skuId, value); } } + + + + public string OrderId { get; set; } + + private string logo; + /// + /// 店铺Sku图链接 + /// + public string Logo { get => logo; set { Set(ref logo, value); } } + + private string skuName; + /// + /// 采购Sku名称 + /// + public string SkuName { get => skuName; set { Set(ref skuName, value); } } + + private string brand; + /// + /// 品牌 + /// + public string Brand { get => brand; set { Set(ref brand, value); } } + + + private string productNo; + /// + /// 货号 + /// + public string ProductNo { get => productNo; set { Set(ref productNo, value); } } + + private string brandName; + /// + /// 品名(手写上传) + /// + public string BrandName { get => brandName; set { Set(ref brandName, value); } } + + + private int goodsNumber; + /// + /// 配件数 + /// + public int GoodsNumber { get => goodsNumber; set { Set(ref goodsNumber, value); } } + private Worry isWorry; + /// + /// 是否加急 + /// + public Worry IsWorry { get => isWorry; set { Set(ref isWorry, value); } } + + private TaskState availability; + /// + /// 到货情况(待收货=0,部分收货=1,已到货=2) + /// + public TaskState Availability { get => availability; set { Set(ref availability, value); } } + + private PackType packType; + /// + /// 打包类型(单件=0,多件=1) + /// + public PackType PackType { get => packType; set { Set(ref packType, value); } } + + private BasicPack basicPack; + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public BasicPack BasicPack { get => basicPack; set { Set(ref basicPack, value); } } + + private PositionType positionType; + /// + /// 落仓(商家仓=0,齐越仓=1,京东仓=2,聚水潭仓=3) + /// + public PositionType PositionType { get => positionType; set { Set(ref positionType, value); } } + + private string skuTitle; + /// + /// sku配件商品名称 + /// + public string SkuTitle { get => skuTitle; set { Set(ref skuTitle, value); } } + + private Need isNeedBarCode; + /// + /// 是否需要合格证 + /// + public Need IsNeedBarCode { get => isNeedBarCode; set { Set(ref isNeedBarCode, value); } } + + + private Need isNeedCertificateModel; + /// + /// 是否需要条形码 + /// + public Need IsNeedCertificateModel { get => isNeedCertificateModel; set { Set(ref isNeedCertificateModel, value); } } + + + private BarCodeModel barCodeModel; + /// + /// 条形码 + /// + public BarCodeModel BarCodeModel { get => barCodeModel; set { Set(ref barCodeModel, value); } } + + + private bool isSetBarCode; + /// + /// 设置显示(条形码) + /// + public bool IsSetBarCode + { + get => isSetBarCode; + set + { + + Set(ref isSetBarCode, value); + // IsNeedBarCode = IsSetBarCode ? Need.不需要 : Need.需要; + } + } + + private bool isSetCertificate; + /// + /// 设置显示(合格证) + /// + public bool IsSetCertificate + { + get => isSetCertificate; set + { + + Set(ref isSetCertificate, value); + //IsNeedCertificateModel = IsSetCertificate ? Need.不需要 : Need.需要; + } + } + private string setSpuCerStatus; + + public string SetSpuCerStatus { get => setSpuCerStatus; set { Set(ref setSpuCerStatus, value); } } + private bool isSetSpuCertificate = true; + + + /// + /// 设置spu显示(合格证) + /// + public bool IsSetSpuCertificate + { + get => isSetSpuCertificate; set + { + + Set(ref isSetSpuCertificate, value); + SetSpuCerStatus = IsSetSpuCertificate ? "设置spu模板" : "修改spu模板"; + } + } + + + private string saveTask; + + /// + /// 设置显示(合格证) + /// + public string SaveTask { get => saveTask; set { Set(ref saveTask, value); } } + + + private string spuId; + /// + /// 合格证 + /// + public string SpuId { get => spuId; set { Set(ref spuId, value); } } + + private CertificateModel spuCertificateModel; + /// + /// spu合格证 + /// + public CertificateModel SpuCertificateModel { get => spuCertificateModel; set { Set(ref spuCertificateModel, value); } } + + + + private CertificateModel certificateModel; + /// + /// 合格证 + /// + public CertificateModel CertificateModel { get => certificateModel; set { Set(ref certificateModel, value); } } + + /// + /// 合格证位置(外部包装=0,产品包装=1) + /// + private CertificatePosition certificatePosition; + /// + /// 合格证位置(外部包装=0,产品包装=1) + /// + public CertificatePosition CertificatePosition { get => certificatePosition; set { Set(ref certificatePosition, value); } } + + /// + /// 注意事项(对接备注) + /// + private string markMessage; + /// + /// 注意事项(对接备注) + /// + public string MarkMessage { get => markMessage; set { Set(ref markMessage, value); } } + + + private ObservableCollection increateList; + /// + /// 增量耗材查询关键字 + /// + public ObservableCollection IncreateList { get => increateList; set { Set(ref increateList, value); } } + string[] increates = new string[] { "气泡纸", "气泡袋", "POP袋", "折纸箱", "气泡纸封边", "彩盒", "剪胶", "剪彩带", "快递袋", "收纳盒", "纸箱子", "装纸箱", "封边", "胶带", "折彩盒" }; + + PackPurchaseTaskService packPurchaseTaskService; + PackTaskService packTaskService; + ProductService productService; + GlobalContext globalContext; + private bool isLoading = false; + public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } + + PurchaseService purchaseService; + public string OriginShopName { get; set; } + public string SkuPurchaseSchemeId { get; set; } + public Platform Platform { get; set; } + public string ShopId { get; set; } + public long TaskId { get; set; } + public string UserName { get; set; } + + public ICommand SetBarCodeCommand { get; set; } + public ICommand SetCertificateCommand { get; set; } + public ICommand LookBarCommand { get; set; } + public ICommand LookCerCommand { get; set; } + + public ICommand OpenSkuDetailCommand { get; set; } + public ICommand CompeteQualityTaskCommand { get; set; } + public ICommand SearchSkuCommand { get; set; } + #endregion + + public QualityViewModel(ProductService productService, GlobalContext globalContext, PackPurchaseTaskService packPurchaseTaskService, PurchaseService purchaseService, PackTaskService packTaskService) + { + this.packPurchaseTaskService = packPurchaseTaskService; + this.productService = productService; + this.globalContext = globalContext; + + OpenSkuDetailCommand = new RelayCommand(OpenSkuDetail); + SetBarCodeCommand = new RelayCommand(SetBarCode); + SetCertificateCommand = new RelayCommand(SetCertificate); + LookBarCommand = new RelayCommand(LookBar); + LookCerCommand = new RelayCommand(LookCer); + CompeteQualityTaskCommand = new RelayCommand(CompeteQualityTask); + IncreateList = new ObservableCollection(); + foreach (var item in increates) + { + IncreateList.Add(new IncreateModel + { + IncreateName = item, + IsSelected = false + }); + } + + this.purchaseService = purchaseService; + this.packTaskService = packTaskService; + + } + + + #region 方法 + private void CompeteQualityTask(object obj) + { + + + if (GoodProductQuantity > ArrivalQuantity) + { + MessageBox.Show($"良品数量:{GoodProductQuantity}不能大于到货数量:{ArrivalQuantity}"); + return; + } + + if (ArrivalQuantity == 0) + { + MessageBox.Show($"到货数量不能:{ArrivalQuantity}!"); + return; + } + + var request = new Models.APIModel.Request.QualityTaskRequest + { + BasicPack = BasicPack, + ArrivalQuantity = ArrivalQuantity, + GoodProductQuantity = GoodProductQuantity, + Increment1 = string.Join(",", IncreateList.Where(i => i.IsSelected).Select(i => i.IncreateName)), + BrandName = BrandName, + CertificatePosition = CertificatePosition, + MarkMessage = MarkMessage, + OrderId = OrderId, + PackType = PackType, + GoodsNumber = GoodsNumber, + SkuGoodsTitle = SkuTitle, + SkuId = SkuId, + IsNeedBar = IsNeedBarCode == Need.需要, + IsNeedCer = IsNeedCertificateModel == Need.需要, + TaskId = TaskId + }; + if (IsNeedBarCode == Need.需要) + { + if (BarCodeModel.Id <= 0) + { + MessageBox.Show("条形码不能为空"); + return; + } + request.BarcodeId = BarCodeModel.Id; + } + if (IsNeedCertificateModel == Need.需要) + { + if (PurchaseSkuList == null && PurchaseSkuList.Count <= 0) + { + MessageBox.Show("无可用的合格证打印!"); + return; + } + if (PurchaseSkuList.Where(p => p.IsSetCertificate).Count() > 0) + { + MessageBox.Show("存在未确认的合格证,请先完成确认!"); + return; + } + if (PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Count() <= 0) + { + MessageBox.Show("无可选的合格证打印!"); + return; + } + request.CerId = string.Join(",", PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Select(p => p.CerDTO.Id)); + + } + + int hour = Convert.ToInt32(PreCompeteTimeHour.Replace("点前", "")); + + var date = Convert.ToDateTime(PreCompeteTimeDay); + + request.PreCompeteTime = date.AddHours(hour); + + + var competeRes = packPurchaseTaskService.CompeteQualityTask(request); + if (competeRes == null) + { + MessageBox.Show("网络异常"); + return; + } + if (!competeRes.Success) + { + MessageBox.Show(competeRes.Msg); + return; + } + BatchPrintWindow batchPrint = new BatchPrintWindow(); + + batchPrint.SetData(GoodProductQuantity, + PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Select(p => p.CerDTO).ToArray() + , BarCodeModel); + + batchPrint.ShowDialog(); + + + if (ReflashWindow != null) ReflashWindow(); + var window = obj as BWindow; + + window.Close(); + + + } + + + + private void SetBarCode() + { + if (string.IsNullOrEmpty(SkuId)) + { + return; + } + if (BarCodeModel == null) + { + var resCode = packPurchaseTaskService.SearchBarCode(SkuId); + if (resCode==null) + { + BarCodeModel = new BarCodeModel(); + BarCodeModel.ProductNo = ProductNo; + BarCodeModel.Brand = Brand; + BarCodeModel.SkuId = SkuId; + BarCodeModel.SkuName = SkuName; + } + else + { + BarCodeModel = resCode.Data; + } + + } + if (!string.IsNullOrEmpty(BrandName)) + BarCodeModel.BrandName = BrandName; + + SetBarCodeWindow setBarCodeWindow = new SetBarCodeWindow(); + setBarCodeWindow.LoadData(BarCodeModel, packTaskService); + setBarCodeWindow.SaveResult = b => + { + BarCodeModel = b; + IsSetBarCode = false; + IsNeedBarCode = Need.需要; + }; + setBarCodeWindow.Show(); + } + + /// + /// 设置合格证 + /// + private void SetCertificate(PurchaseSku model) + { + + if (model.CerDTO == null) + { + model.CerDTO = new CertificateModel + { + ProductNo = ProductNo, + Brand = Brand, + SkuId = SkuId, + PurchaseSkuId = model.PurchaseSkuId + + }; + } + if (!string.IsNullOrEmpty(BrandName)) + model.CerDTO.BrandName = BrandName; + + QualitySetCerWindow setCerWindow = new QualitySetCerWindow(); + setCerWindow.LoadData(model.IsNeedCer, model.CerDTO, packPurchaseTaskService, spuCertificateModel, IsSetSpuCertificate); + setCerWindow.SaveResult = (s, PackCerState) => + { + if (string.IsNullOrEmpty(s.PurchaseSkuId)) + { + var sku = PurchaseSkuList.SingleOrDefault(p => p.CerDTO.GoodsNumber == s.GoodsNumber); + sku.CerDTO = s; + sku.IsSetCertificate = false; + sku.IsNeedCer = PackCerState == PackCerState.合格证信息; + IsNeedCertificateModel = Need.需要; + return; + } + var skus = PurchaseSkuList.SingleOrDefault(p => p.PurchaseSkuId == s.PurchaseSkuId); + skus.CerDTO = s; + skus.IsSetCertificate = false; + skus.IsNeedCer = PackCerState == PackCerState.合格证信息; + IsNeedCertificateModel = Need.需要; + }; + setCerWindow.Show(); + } + + + /// + /// 查看合格证 + /// + private void LookCer(CertificateModel certificate) + { + + QualityLookCerWindow lookCerWindow = new QualityLookCerWindow(certificate); + lookCerWindow.Show(); + } + /// + /// 查看条形码 + /// + private void LookBar() + { + LookBarCodeWindow look = new LookBarCodeWindow(); + look.SetData(BarCodeModel); + look.Show(); + } + + /// + /// 搜索 skuId(todo:) + /// + public void SearchSku(PackTaskModel model) + { + InitData(); + TaskId = model.TaskId; + OrderId =model.OrderId; + SkuId = model.SkuId; + SkuName = model.ItemList[0].SkuName; + Logo = model.ItemList[0].Logo.Replace("80x80", "200x200").Replace("200x200", "150x150"); + BrandName = model.ItemList[0].BrandName; + + SkuCount = model.SkuCount; + brand = model.Brand; + + ProductNo = model.ProductNo; + MarkMessage = model.MarkMessage; + PackType = model.PackType; + GoodsNumber = model.GoodsNumber; + SkuTitle = model.SkuTitle; + BasicPack = model.BasicPack; + CertificatePosition = model.CertificatePosition; + + + string[] increateDatas = model.Increment1?.Split(','); + bool isSelected = false; + 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 + }); + }); + } + + + var packTaskRes = packPurchaseTaskService.GetQualityTask(model.TaskId); + if (packTaskRes == null || !packTaskRes.Success) return; + BarCodeModel = packTaskRes.Data.BarCodeDTO; + IsNeedBarCode = packTaskRes.Data.IsNeedBar ? Need.需要 : Need.不需要; + IsSetBarCode = packTaskRes.Data.IsNeedBar ? false : true; + IsNeedCertificateModel = packTaskRes.Data.IsNeedCer ? Need.需要 : Need.不需要; + if (packTaskRes.Data.WareHourses != null) + packTaskRes.Data.WareHourses.ToList().ForEach(w => + { + WareHourseList.Add(w); + }); + WareHourseCount = WareHourseList.Count(); + if (packTaskRes.Data.PurchaseSkus != null) + { + + + foreach (var item in packTaskRes.Data.PurchaseSkus) + { + item.IsSetCertificate = true; + if (string.IsNullOrEmpty(item.PurchaseProductId)) + { + PurchaseSkuList.Add(item); continue; + } + + var list = purchaseService.GetPurchaseSkuBasicInfo(item.PurchaseProductId); + if (list == null&&!list.Success) + { + PurchaseSkuList.Add(item); continue; + } + + var skuItem = list.Data.ItemList.FirstOrDefault(f => f.PurchaseSkuId == item.PurchaseSkuId); + App.Current.Dispatcher.Invoke(new Action(() => + { + PurchaseSkuList.Add(new PurchaseSku + { + Logo = skuItem.Logo, + Title = skuItem.Title, + IsNeedCer = item.IsNeedCer, + PurchaseSkuId = item.PurchaseSkuId, + CerDTO = item.CerDTO, + IsSetCertificate = item.IsSetCertificate, + }); + })); + //PurchaseSkuList.Add(item); + } + } + + + + + + + + + } + public Action ReflashWindow { get; set; } + public void InitData() + { + PurchaseSkuList = new ObservableCollection(); + WareHourseList = new ObservableCollection(); + PreCompeteTimeDayList = new ObservableCollection(); + + var date = DateTime.Now.Date; + for (int i = 0; i < 7; i++) + { + PreCompeteTimeDayList.Add(date.AddDays(i).ToString("yyyy-MM-dd")); + } + + PreCompeteTimeDay = date.ToString("yyyy-MM-dd"); + + IsSetBarCode = true; + SkuTitle = ""; + BrandName = ""; + GoodsNumber = 0; + PackType = PackType.单件; + BasicPack = BasicPack.快递袋; + // Availability = (TaskState.)config.Availability; + //MarkMessage = config.MarkMessage; + CertificatePosition = CertificatePosition.无; + // Increment1 = config.Increment1; + + IsNeedBarCode = Need.需要; + IsNeedCertificateModel = Need.不需要; + } + + private void OpenSkuDetail(object param) + { + var paramList = (object[])param; + // var orderId = paramList[0].ToString(); + var skuId = paramList[0].ToString(); + + + var url = $"https://item.jd.com/{skuId}.html"; + try + { + System.Diagnostics.Process.Start("explorer.exe", url); + } + catch (Exception ex) + { + Clipboard.SetText(url); + MessageBox.Show($"{ex.Message}\r\n调用浏览器失败,网页链接已复制到剪切板,请手动打开浏览器访问", "提示"); + } + + } + + #endregion + } +} diff --git a/BBWY.Client/ViewModels/ViewModelLocator.cs b/BBWY.Client/ViewModels/ViewModelLocator.cs index cfd7e27c..980ebe4c 100644 --- a/BBWY.Client/ViewModels/ViewModelLocator.cs +++ b/BBWY.Client/ViewModels/ViewModelLocator.cs @@ -303,5 +303,15 @@ namespace BBWY.Client.ViewModels return s.ServiceProvider.GetRequiredService(); } } + + + public QualityViewModel QualityTask + { + get + { + using var s = sp.CreateScope(); + return s.ServiceProvider.GetRequiredService(); + } + } } } diff --git a/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml b/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml index 489db23f..defbffe6 100644 --- a/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml +++ b/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml @@ -29,78 +29,9 @@ Background="{StaticResource Border.Background}"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml.cs b/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml.cs index f8a08d1a..c021ac07 100644 --- a/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml.cs @@ -23,10 +23,15 @@ namespace BBWY.Client.Views.PackTask { InitializeComponent(); + + } + + public BarCodeModel BarCodeModel { get; set; } public void SetData(BarCodeModel BarCodeModel) { - this.DataContext = BarCodeModel; + this.BarCodeModel = BarCodeModel; + this.DataContext = this; } } } diff --git a/BBWY.Client/Views/PackTask/PackTaskTotal.xaml b/BBWY.Client/Views/PackTask/PackTaskTotal.xaml index ad9ac1aa..8247fa47 100644 --- a/BBWY.Client/Views/PackTask/PackTaskTotal.xaml +++ b/BBWY.Client/Views/PackTask/PackTaskTotal.xaml @@ -121,10 +121,12 @@ - - + + - + + + @@ -132,26 +134,26 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -171,10 +173,11 @@ - + + - - + + - + + + @@ -201,7 +206,6 @@ - @@ -217,7 +221,7 @@ - + @@ -228,70 +232,76 @@ + Margin=" 5,0,0,0"> + + + + + + + Margin=" 5,0,0,0"> + + + + + + - + - - - - - - - + + - + - + - + - - + + - - + + + + - + - - - - - - - + - + + + + - + diff --git a/BBWY.Client/Views/PackTask/PackTaskTotal.xaml.cs b/BBWY.Client/Views/PackTask/PackTaskTotal.xaml.cs index 2ae3eb50..de7764b2 100644 --- a/BBWY.Client/Views/PackTask/PackTaskTotal.xaml.cs +++ b/BBWY.Client/Views/PackTask/PackTaskTotal.xaml.cs @@ -34,10 +34,10 @@ namespace BBWY.Client.Views.PackTask } - public ShopService shopService; + public ShopService shopService; private void Load(object sender, RoutedEventArgs e) { - + var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var builder = new ConfigurationBuilder().SetBasePath(applicationPath).AddJsonFile("BBWYAppSettings.json", false, true); @@ -90,10 +90,7 @@ namespace BBWY.Client.Views.PackTask } } - - List departments = new List(); - private void tb_TextChanged(object sender, TextChangedEventArgs e) { try diff --git a/BBWY.Client/Views/PackTask/PrintWindow.xaml b/BBWY.Client/Views/PackTask/PrintWindow.xaml index 12c39279..cd2c9821 100644 --- a/BBWY.Client/Views/PackTask/PrintWindow.xaml +++ b/BBWY.Client/Views/PackTask/PrintWindow.xaml @@ -7,7 +7,7 @@ xmlns:local="clr-namespace:BBWY.Client.Views.PackTask" mc:Ignorable="d" Style="{StaticResource bwstyle}" - Height="532" Width="486" + Height="525" Width="486" xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:b="http://schemas.microsoft.com/xaml/behaviors" xmlns:ctr="clr-namespace:BBWY.Client.Converters" @@ -18,8 +18,16 @@ MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" RightButtonGroupMargin="0,5,5,0" - ResizeMode="NoResize" > + + + + + + + + + @@ -32,230 +40,42 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs b/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs index 86c4772e..7f91e2a0 100644 --- a/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs @@ -83,25 +83,21 @@ namespace BBWY.Client.Views.PackTask // PrintData data = new PrintData(); if (CertificateModel != null) { - GoodsNumberCerList = new ObservableCollection(); foreach (CertificateModel certificateModel in CertificateModel) GoodsNumberCerList.Add(new GoodsNumberCer { CertificateModel = certificateModel.Copy(), }); - this.DataContext = this; - bar.Visibility = Visibility.Collapsed; cer.Visibility = Visibility.Visible; } - if (BarCodeModel != null) { - this.DataContext = BarCodeModel; cer.Visibility = Visibility.Collapsed; bar.Visibility = Visibility.Visible; } + this.DataContext = this; } public CertificateModel[] CertificateModel { get; set; } @@ -136,13 +132,8 @@ namespace BBWY.Client.Views.PackTask { PrintData(printCount, printName,null,cer); System.Threading.Thread.Sleep(100); - // MyPrintHelper.PrintCertificate(ref args, cer, font); } - } - - - }); } @@ -177,7 +168,7 @@ namespace BBWY.Client.Views.PackTask { App.Current.Dispatcher.Invoke(() => { - new TipsWindow("打印失败").ShowDialog(); + new TipsWindow($"打印失败,{ex.Message}").Show(); }); } diff --git a/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml b/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml index aaef69e6..890893c4 100644 --- a/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml +++ b/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml @@ -214,9 +214,9 @@ - + - - + diff --git a/BBWY.Client/Views/PackTask/SetBarCode.xaml b/BBWY.Client/Views/PackTask/SetBarCode.xaml index f797d050..8dc050ee 100644 --- a/BBWY.Client/Views/PackTask/SetBarCode.xaml +++ b/BBWY.Client/Views/PackTask/SetBarCode.xaml @@ -1,5 +1,5 @@  - + diff --git a/BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs b/BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs index 492d4cae..74627b12 100644 --- a/BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs @@ -158,6 +158,7 @@ namespace BBWY.Client.Views.PackTask cer.CertificateModel.Shader = SpuCertificateModel.Shader; cer.CertificateModel.ProductShop = SpuCertificateModel.ProductShop; cer.CertificateModel.ApplyAge = SpuCertificateModel.ApplyAge; + cer.CertificateModel.ProduceDate = SpuCertificateModel.ProduceDate; } diff --git a/BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml.cs b/BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml.cs index 65678572..d12c551e 100644 --- a/BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml.cs @@ -62,11 +62,10 @@ namespace BBWY.Client.Views.PackTask ProductAdress = SpuCertificateModel.ProductAdress, ProductShop = SpuCertificateModel.ProductShop, Shader = SpuCertificateModel.Shader, - SkuId = SpuCertificateModel.SkuId, + //SkuId = SpuCertificateModel.SkuId, ApplyAge = SpuCertificateModel.ApplyAge, - - - + ProduceDate=SpuCertificateModel.ProduceDate, + }); if (resData == null || !resData.Success) { diff --git a/BBWY.Client/Views/PackTask/TaskListControl.xaml b/BBWY.Client/Views/PackTask/TaskListControl.xaml index 84ee9353..39c31f7a 100644 --- a/BBWY.Client/Views/PackTask/TaskListControl.xaml +++ b/BBWY.Client/Views/PackTask/TaskListControl.xaml @@ -121,7 +121,7 @@ + Margin="5,0,0,0" Style="{StaticResource LinkButton}" Content="取消" /> diff --git a/BBWY.Client/Views/PackTask/WareHouseList.xaml b/BBWY.Client/Views/PackTask/WareHouseList.xaml index 71decbf0..df7c406b 100644 --- a/BBWY.Client/Views/PackTask/WareHouseList.xaml +++ b/BBWY.Client/Views/PackTask/WareHouseList.xaml @@ -14,23 +14,68 @@ d:DesignHeight="450" d:DesignWidth="2048" Title="TaskList"> + + + - + + + + + + + - + @@ -40,7 +85,7 @@ - + @@ -58,7 +103,14 @@ - + + + + + + + + @@ -74,229 +126,29 @@ - - - - - - - - - - - > - - - - - - - - - - - - - - - - - - - diff --git a/BBWY.Client/Views/PackTask/WareHouseList.xaml.cs b/BBWY.Client/Views/PackTask/WareHouseList.xaml.cs index 22385b47..2b5c7616 100644 --- a/BBWY.Client/Views/PackTask/WareHouseList.xaml.cs +++ b/BBWY.Client/Views/PackTask/WareHouseList.xaml.cs @@ -1,6 +1,8 @@ using BBWY.Client.Helpers; using BBWY.Client.Models.PackTask; +using BBWY.Client.ViewModels; using BBWY.Common.Models; +using GalaSoft.MvvmLight.Messaging; using Microsoft.Extensions.Configuration; using Newtonsoft.Json; using System; @@ -33,38 +35,81 @@ namespace BBWY.Client.Views.PackTask { InitializeComponent(); + + //Messenger.Default.Register(this,"AcceptGlobalContext", g => { globalContext = g; LoadShops(g); }); this.Loaded += Load; + + // this.Unloaded += WareHouseList_Unloaded; + + // GlobalContext.User.DepartmentList + } + + //private void WareHouseList_Unloaded(object sender, RoutedEventArgs e) + //{ + // Messenger.Default.Unregister("AcceptGlobalContext"); + //} + + GlobalContext globalContext; + + public void LoadShops(GlobalContext globalContext) + { + this.globalContext = globalContext; + shops = globalContext.User.ShopList.Select(s => s.ShopName).ToList(); } private void Load(object sender, RoutedEventArgs e) { - var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - var builder = new ConfigurationBuilder().SetBasePath(applicationPath).AddJsonFile("BBWYAppSettings.json", false, true); - var Configuration = builder.Build(); - QKApiHost = Configuration.GetSection("QKApiHost").Value; - HttpClientHelper helper = new HttpClientHelper(QKApiHost); + try + { + var model = new ViewModelLocator().Main; + + LoadShops(model.GlobalContext); + } + catch + { + + + } - string url = $"{QKApiHost}/api/PackTask/GetAllDepartment";//获取所有数据 - var data = helper.Get(url); - var res = JsonConvert.DeserializeObject>(data); - //创建一个ListBoxIem - if (res.Success) + try { - if (res.Data != null && res.Data.Count() > 0) + var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + var builder = new ConfigurationBuilder().SetBasePath(applicationPath).AddJsonFile("BBWYAppSettings.json", false, true); + var Configuration = builder.Build(); + + QKApiHost = Configuration.GetSection("QKApiHost").Value; + 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) { - foreach (var department in res.Data) + if (res.Data != null && res.Data.Count() > 0) { - if (!departments.Contains(department.DePartmentName)) + foreach (var department in res.Data) { - departments.Add(department.DePartmentName); + if (!departments.Contains(department.DePartmentName)) + { + departments.Add(department.DePartmentName); + } } } } } + catch (Exception) + { + + + } + + } - public string QKApiHost {get;set;} + public string QKApiHost { get; set; } public void SelectionChangeCommand(object sender, SelectionChangedEventArgs e) { try @@ -86,10 +131,9 @@ namespace BBWY.Client.Views.PackTask } } - - List departments = new List(); + List shops = new List(); private void tb_TextChanged(object sender, TextChangedEventArgs e) { try @@ -155,5 +199,72 @@ namespace BBWY.Client.Views.PackTask } } + + 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); + } + + } + + 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) + { + + + } + } } } diff --git a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml index 85c0bad7..3af203f9 100644 --- a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml +++ b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml @@ -43,9 +43,10 @@ + - + @@ -56,6 +57,8 @@ + + @@ -70,6 +73,7 @@ + + @@ -111,7 +116,7 @@ CommandParameter="{Binding TaskId}" Margin=" 5,0,7,0"/> - - - - - - - - - - - - - - - + @@ -151,6 +143,7 @@ + - - - - - - - - - + + + + + + @@ -345,7 +338,7 @@ - + @@ -369,215 +362,26 @@ - - + - + + + + + @@ -590,6 +394,51 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -605,6 +454,7 @@ + diff --git a/BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml b/BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml new file mode 100644 index 00000000..eb412902 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml.cs b/BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml.cs new file mode 100644 index 00000000..8f7a5be7 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml.cs @@ -0,0 +1,210 @@ +using BBWY.Client.Helpers; +using BBWY.Client.Models; +using BBWY.Client.Views.PackTask; +using BBWY.Controls; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Printing; +using System.Linq; +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.QualityTask +{ + /// + /// BatchPrintWindow.xaml 的交互逻辑 + /// + public partial class BatchPrintWindow : BWindow + { + public BatchPrintWindow() + { + InitializeComponent(); + this.Loaded += BatchPrintWindow_Loaded; + } + + public void SetData(int GoodProductQuantity, CertificateModel[] CertificateModel, BarCodeModel BarCodeModel) + { + this.BarCodeModel = BarCodeModel; + this.GoodProductQuantity = GoodProductQuantity; + goodProductQuantity.Text = GoodProductQuantity.ToString(); + this.CertificateModel = CertificateModel; + + this.DataContext = this; + } + + + + public CertificateModel[] CertificateModel { get; set; } + + public BarCodeModel BarCodeModel { get; set; } + + + public int GoodProductQuantity { get; set; } + + private void BatchPrintWindow_Loaded(object sender, RoutedEventArgs e) + { + LoadPrints(); + } + /// + /// 获取打印机名称 + /// + private void LoadPrints() + { + var printingNames = PrinterSettings.InstalledPrinters;//获取本机的打印机数据 + int index = -1; + int selectIndex = 0; + foreach (string name in printingNames) + { + if (name == "Microsoft XPS Document Writer" || name == "Microsoft Print to PDF" || name == "Fax") + { + continue; + } + index++; + if (name.Contains("Deli")) + { + selectIndex = index; + } + cbPrints.Items.Add(name); + } + if (cbPrints.Items.Count > selectIndex) + { + cbPrints.SelectedIndex = selectIndex; + } + } + + + + + private void PrintData(int printCount, string printName, BarCodeModel barCode = null, CertificateModel certificateModel = null) + { + try + { + + PrintDocument document = new PrintDocument(); + document.PrinterSettings.PrinterName = printName;//使用打印机名称,指定特定的打印机进行打印。 + //设置打印页面 + //document.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("Custom", 236, 157); + document.PrintPage += (s, a) => + { + Font font = new Font("宋体", 6, System.Drawing.FontStyle.Regular); + if (barCode != null) + { + MyPrintHelper.PrintBarcode(ref a, barCode, font); + } + if (certificateModel != null) + { + MyPrintHelper.PrintCertificate(ref a, certificateModel, font); + } + + }; + document.PrinterSettings.Copies = (short)printCount;//打印份数 + document.Print(); + + } + catch (Exception ex) + { + App.Current.Dispatcher.Invoke(() => + { + new TipsWindow($"打印失败,{ex.Message}").Show(); + }); + + } + } + + private void Document_PrintPage(object sender, PrintPageEventArgs args) + { + + Font font = new Font("宋体", 6, System.Drawing.FontStyle.Regular); + if (BarCodeModel != null) + { + MyPrintHelper.PrintBarcode(ref args, BarCodeModel, font); + } + if (CertificateModel != null) + { + foreach (var cer in CertificateModel) + { + MyPrintHelper.PrintCertificate(ref args, cer, font); + } + + } + + } + + private void BButton_Click(object sender, RoutedEventArgs e) + { + int cerNum = 0, barNum = 0; + if (!string.IsNullOrEmpty(cerNumber.Text)) + try + { + cerNum = Convert.ToInt32(cerNumber.Text); + } + catch + { + MessageBox.Show("请输入数字"); + return; + } + if (!string.IsNullOrEmpty(barNumber.Text)) + try + { + barNum = Convert.ToInt32(barNumber.Text); + } + catch + { + MessageBox.Show("请输入数字"); + return; + } + + + + if (barNum > 0) + { + if (BarCodeModel == null) + { + MessageBox.Show("未设置条形码模板"); + return; + } + } + if (cerNum > 0) + { + if (CertificateModel == null || CertificateModel.Count() <= 0) + { + MessageBox.Show("未设置合格证模板"); + return; + } + } + + string printName = cbPrints.Text; + Task.Factory.StartNew(() => + { + + if (barNum > 0) + { + if (BarCodeModel != null) + PrintData(barNum, printName, BarCodeModel); + + } + if (cerNum > 0) + { + if (CertificateModel != null && CertificateModel.Count() > 0) + foreach (var cer in CertificateModel) + PrintData(cerNum, printName, null, cer); + } + + App.Current.Dispatcher.Invoke(new Action(() => + { + this.Close(); + })); + }); + + } + } +} diff --git a/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml b/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml new file mode 100644 index 00000000..01c8f2fa --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml @@ -0,0 +1,26 @@ + + + + + + + + + + + + diff --git a/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml.cs b/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml.cs new file mode 100644 index 00000000..8bc37874 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml.cs @@ -0,0 +1,31 @@ +using BBWY.Client.Extensions; +using BBWY.Client.Models; +using BBWY.Controls; +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace BBWY.Client.Views.QualityTask +{ + /// + /// QualityLookCerWindow.xaml 的交互逻辑 + /// + public partial class QualityLookCerWindow : BWindow + { + public QualityLookCerWindow(CertificateModel certificate) + { + CertificateModel = certificate.Copy(); + InitializeComponent(); + this.DataContext = this; + } + public CertificateModel CertificateModel { get; set; } + } +} diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml b/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml new file mode 100644 index 00000000..1222c63d --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml.cs b/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml.cs new file mode 100644 index 00000000..265ff4bf --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml.cs @@ -0,0 +1,64 @@ +using BBWY.Client.Models; +using BBWY.Client.Views.PackTask; +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.QualityTask +{ + /// + /// QualitySetCerControl.xaml 的交互逻辑 + /// + public partial class QualitySetCerControl : UserControl + { + public QualitySetCerControl() + { + InitializeComponent(); + } + + /// + /// + /// + public CertificateModel model + { + get { return (CertificateModel)GetValue(modelProperty); } + set + { + SetValue(modelProperty, value); + } + } + public static readonly DependencyProperty modelProperty = + DependencyProperty.Register("model", typeof(CertificateModel), typeof(QualitySetCerControl), new PropertyMetadata(ChangedProperty)); + + private static void ChangedProperty(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //var control = d as CerControl; + //var data = e.NewValue as CertificateModel; + //if (data != null) + //{ + // control.SetData(data); + //} + } + private void RadioButton_Checked(object sender, RoutedEventArgs e) + { + var rabtn = sender as RadioButton; + if (rabtn != null && rabtn.CommandParameter != null) + { + var labModel = Enum.Parse(rabtn.CommandParameter.ToString()); + model.LabelModel = labModel; + model.IsLogo = labModel == CertificateLabelModel.标准有3c ? 1 : 0; + } + + var data = e.Source as string; + } + } +} diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml new file mode 100644 index 00000000..970feb65 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs new file mode 100644 index 00000000..477e0dbd --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs @@ -0,0 +1,137 @@ +using BBWY.Client.Models.APIModel.Request; +using BBWY.Client.Models; +using BBWY.Client.Views.PackTask; +using GalaSoft.MvvmLight.Command; +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using BBWY.Client.Extensions; +using BBWY.Client.APIServices; +using BBWY.Controls; + +namespace BBWY.Client.Views.QualityTask +{ + /// + /// QualitySetCerWindow.xaml 的交互逻辑 + /// + public partial class QualitySetCerWindow : BWindow + { + public QualitySetCerWindow() + { + InitializeComponent(); + SetPackCerStateCommand = new RelayCommand(SetPackCerState); + } + + private void SetPackCerState(PackCerState obj) + { + PackCerState = obj; + } + + public void LoadData(bool isNeedCer, CertificateModel CertificateModel, PackPurchaseTaskService packTaskService, CertificateModel SpuCertificateModel, bool IsSetSpuCertificate) + { + this.CertificateModel = CertificateModel.Copy(); + this.packTaskService = packTaskService; + PackCerState = isNeedCer ? PackCerState.合格证信息 : PackCerState.无需合格证; + this.DataContext = this; + } + + public ICommand SetPackCerStateCommand { get; set; } + + + public PackCerState PackCerState + { + get + { + return (PackCerState)GetValue(PackCerStateProperty); + + } + set + { + SetValue(PackCerStateProperty, value); + + } + } + + + public static readonly DependencyProperty PackCerStateProperty = + DependencyProperty.Register("PackCerState", typeof(PackCerState), typeof(QualitySetCerWindow)); + + public bool IsSetSpuCertificate { get; set; } + public PackPurchaseTaskService packTaskService { get; set; } + public CertificateModel CertificateModel { get; set; } + public CertificateModel SpuCertificateModel { get; set; } + + public Action SaveResult { get; set; } + + + private void save_btn_Click(object sender, RoutedEventArgs e) + { + + if (PackCerState== PackCerState.无需合格证) + { + if (SaveResult != null) SaveResult(CertificateModel, PackCerState); + this.Close(); + return; + } + if (string.IsNullOrEmpty(CertificateModel.ExcuteStander) + || string.IsNullOrEmpty(CertificateModel.Shader) || string.IsNullOrEmpty(CertificateModel.BrandName) + || string.IsNullOrEmpty(CertificateModel.Brand) || string.IsNullOrEmpty(CertificateModel.ProductShop) + || string.IsNullOrEmpty(CertificateModel.ProductAdress)) + { + //new TipsWindow("参数出错!请重新填写!").Show(); + MessageBox.Show("有未填写的参数"); + return; + } + if((CertificateModel.LabelModel== CertificateLabelModel.标准无3c|| CertificateModel.LabelModel == CertificateLabelModel.标准有3c) && string.IsNullOrEmpty( CertificateModel.ProductNo)) + { + MessageBox.Show("型号不能为空"); + return; + } + if ( CertificateModel.LabelModel == CertificateLabelModel.标准有3c && string.IsNullOrEmpty(CertificateModel.FactoryNumber)) + { + MessageBox.Show("工厂编号不能为空"); + return; + } + if (CertificateModel.LabelModel == CertificateLabelModel.适用年龄 && string.IsNullOrEmpty(CertificateModel.ApplyAge)) + { + MessageBox.Show("适用年龄不能为空"); + return; + } + var standers = CertificateModel.ExcuteStander.Split(',', StringSplitOptions.RemoveEmptyEntries); + var resData = packTaskService.SaveCer(new CerRequest + { + Brand = CertificateModel.Brand, + BrandName = CertificateModel.BrandName, + ProductNo = CertificateModel.ProductNo, + SkuId = CertificateModel.SkuId, + ExcuteStander = CertificateModel.ExcuteStander, + LabelModel = (int)CertificateModel.LabelModel, + FactoryNumber = CertificateModel.FactoryNumber, + IsLogo = CertificateModel.IsLogo, + ProductAdress = CertificateModel.ProductAdress, + ProductShop = CertificateModel.ProductShop, + Shader = CertificateModel.Shader, + ApplyAge = CertificateModel.ApplyAge, + GoodsNumber = CertificateModel.GoodsNumber, + ProduceDate = CertificateModel.ProduceDate, + PurchaseSkuId = CertificateModel.PurchaseSkuId, + }); + if (resData == null || !resData.Success) + { + return; + } + + CertificateModel.Id = resData.Data; + if (SaveResult != null) SaveResult(CertificateModel, PackCerState); + this.Close(); + } + } +} diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml b/BBWY.Client/Views/QualityTask/QualityWindow.xaml new file mode 100644 index 00000000..030267de --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs b/BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs new file mode 100644 index 00000000..fadef789 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs @@ -0,0 +1,16 @@ +using BBWY.Controls; + + +namespace BBWY.Client.Views.QualityTask +{ + /// + /// QualityWindow.xaml 的交互逻辑 + /// + public partial class QualityWindow : BWindow + { + public QualityWindow() + { + InitializeComponent(); + } + } +}