diff --git a/BBWY.Client/APIServices/ServiceOrderService.cs b/BBWY.Client/APIServices/ServiceOrderService.cs new file mode 100644 index 00000000..b4436205 --- /dev/null +++ b/BBWY.Client/APIServices/ServiceOrderService.cs @@ -0,0 +1,44 @@ +using BBWY.Client.Models; +using BBWY.Common.Http; +using BBWY.Common.Models; +using System; +using System.Net.Http; + +namespace BBWY.Client.APIServices +{ + public class ServiceOrderService : BaseApiService, IDenpendency + { + public ServiceOrderService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) + { + } + + public ApiResponse GetList(string orderId, + string sku, + string spu, + string serviceId, + string shopId, + ServiceOrderState? serviceOrderState, + ReturnDirection? returnDirection, + int pageIndex, + int pageSize, + DateTime? startDate, + DateTime? endDate) + { + return SendRequest(globalContext.BBYWApiHost, "Api/ServiceOrder/GetList", new + { + orderId, + sku, + spu, + serviceId, + shopId, + serviceOrderState, + returnDirection, + pageIndex, + pageSize, + startDate, + endDate + }, null, HttpMethod.Post); + } + } + +} \ No newline at end of file diff --git a/BBWY.Client/Models/APIModel/Response/ServiceOrder/ServiceOrderItemResponse.cs b/BBWY.Client/Models/APIModel/Response/ServiceOrder/ServiceOrderItemResponse.cs new file mode 100644 index 00000000..50837c5d --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/ServiceOrder/ServiceOrderItemResponse.cs @@ -0,0 +1,262 @@ +using System; +using System.Collections.Generic; + +namespace BBWY.Client.Models +{ + public class ServiceOrderItemResponse + { + + public long Id { get; set; } + + /// + /// 售后成本(不含退款采购成本) + /// + public decimal? AfterTotalCost { get; set; } = 0.00M; + + /// + /// 申请时间 + /// + public DateTime? ApplyTime { get; set; } + + /// + /// 耗材费 + /// + public decimal? ConsumableAmount { get; set; } = 0.00M; + + public DateTime? CreateTime { get; set; } + + /// + /// 发货快递费 + /// + public decimal? DeliveryExpressFreight { get; set; } = 0.00M; + + /// + /// 头程费 + /// + public decimal? FirstFreight { get; set; } = 0.00M; + + /// + /// 退货拍摄图(名称) + /// + public string ImageName { get; set; } + + /// + /// 入仓操作费 + /// + public decimal? InStorageAmount { get; set; } = 0.00M; + + /// + /// 是否订阅快递100 + /// + + public bool? IsSubscribeKuaiDi100 { get; set; } + + /// + /// 是否需要订阅快递100 + /// + public bool? IsNeedSubscribeKuaiDi100 { get; set; } + + public string OrderId { get; set; } + + /// + /// 出仓操作费 + /// + public decimal? OutStorageAmount { get; set; } = 0.00M; + + /// + /// 产品外观 (严重损=0 轻微损=1 新=2) + /// + + public ProductAppearance? ProductAppearance { get; set; } + + /// + /// 产品功能 (坏=0 好=1) + /// + + public ProductFunction? ProductFunction { get; set; } + + /// + /// 商品健康状态 (残次品=0 良品=1) + /// + + public NewProductHealth? ProductHealth { get; set; } + + public string ProductId { get; set; } + + /// + /// 产品包装(无=0 非新=1 新=2) + /// + + public ProductPackage? ProductPackage { get; set; } + + + /// + /// 采购方式 + /// + + public PurchaseMethod? PurchaseMethod { get; set; } + + /// + /// 采购单号 + /// + public string PurchaseOrderId { get; set; } + + /// + /// 采购单主键 + /// + + public long? PurchaseOrderPKId { get; set; } + + /// + /// 采购平台 + /// + + public Platform? PurchasePlatform { get; set; } + + /// + /// 退款支付宝订单号 + /// + public string RefundAlipayOrderNo { get; set; } + + /// + /// 退款金额 + /// + public decimal? RefundAmount { get; set; } = 0.00M; + + /// + /// 退货入仓操作费 + /// + public decimal? RefundInStorageAmount { get; set; } = 0.00M; + + /// + /// 退款商户订单号 + /// + public string RefundMerchantOrderNo { get; set; } + + /// + /// 退款采购成本 + /// + public decimal? RefundPurchaseAmount { get; set; } = 0.00M; + + /// + /// 退款时间 + /// + public DateTime? RefundTime { get; set; } + + /// + /// 售后补发成本 + /// + public decimal? ReissueAfterSaleAmount { get; set; } = 0.00M; + + /// + /// 补发快递费 + /// + public decimal? ReissueFreight { get; set; } = 0.00M; + + /// + /// 补发货款成本 + /// + public decimal? ReissueProductAmount { get; set; } = 0.00M; + + /// + /// 退货去向(退货仓=0,采购商=1,原返=2,无退货=3) + /// + + public ReturnDirection? ReturnDirection { get; set; } + + /// + /// SD退货运费 + /// + public decimal? SDRefundFreight { get; set; } = 0.00M; + + /// + /// 服务单号 + /// + public string ServiceId { get; set; } + + /// + /// 服务单租备注 + /// + public string ServiceOrderRemark { get; set; } + + /// + /// 服务单处理结果 + /// + + public ServiceResult? ServiceResult { get; set; } + + public string ShopId { get; set; } + + public string SkuId { get; set; } + + /// + /// SKU销售件数 + /// + + public int? SkuItemCount { get; set; } + + /// + /// 服务单状态 待收货 = 10005,取消 = 10011,完成 = 10010 + /// + + public ServiceOrderState? Status { get; set; } + + /// + /// 变更时间 + /// + public DateTime? StatusUpdateTime { get; set; } + + /// + /// 仓储费 + /// + public decimal? StorageAmount { get; set; } = 0.00M; + + /// + /// 服务单物流状态(0=待质检,1=已入库,2=派送中,3=运输中) + /// + + public TransportState? TransportDetails { get; set; } + + /// + /// 仓库组备注 + /// + public string WareHouseGrounpRemark { get; set; } + + + /// + /// 快递单号 + /// + public string WayBillNo { get; set; } + + /// + /// 快递公司名称 + /// + public string ExpressName { get; set; } + + /// + /// 质检入库时间 + /// + public DateTime? QualityInspectionInStoreTime { get; set; } + + #region Sku + public string Logo { get; set; } + + public string Title { get; set; } + + //public string ContactName { get; set; } + + //public string Mobile { get; set; } + + public int ItemTotal { get; set; } + + public decimal Price { get; set; } + #endregion + } + + public class ServiceOrderResponse + { + public IList Items { get; set; } + + public long Count { get; set; } + } +} diff --git a/BBWY.Client/Models/Enums.cs b/BBWY.Client/Models/Enums.cs index 61cdaa35..309e33ea 100644 --- a/BBWY.Client/Models/Enums.cs +++ b/BBWY.Client/Models/Enums.cs @@ -254,7 +254,7 @@ { 外部包装 = 0, 产品包装 = 1, - 无 =2 + 无 = 2 } public enum Increment @@ -317,4 +317,60 @@ } + /// + /// 服务单状态 + /// + public enum ServiceOrderState + { + 待收货 = 10005, + 已取消 = 10011, + 已完成 = 10010 + } + + public enum ReturnDirection + { + 退货仓 = 0, 采购商 = 1, 原返 = 2, 无退货 = 3 + } + + + /// + /// 运输状态 0=待质检,1=已入库,2=派送中,3=运输中 + /// + public enum TransportState + { + 待质检 = 0, 已入库 = 1, 派送中 = 2, 运输中 = 3 + } + + /// + /// 商品健康状态 残次品=0 良品=1 + /// + public enum NewProductHealth + { + 残次品 = 0, 良品 = 1 + } + + /// + /// 产品功能 坏=0 好=1 + /// + public enum ProductFunction + { + 坏 = 0, 好 = 1 + } + + /// + /// 产品外观 (严重损=0 轻微损=1 新=2) + /// + public enum ProductAppearance + { + 严重损 = 0, 轻微损 = 1, 新 = 2 + } + + /// + /// 产品包装(无=0 非新=1 新=2) + /// + public enum ProductPackage + { + 无 = 0, 非新 = 1, 新 = 2 + } + } diff --git a/BBWY.Client/Models/MappingProfile.cs b/BBWY.Client/Models/MappingProfile.cs index 865a7a5d..8ff89753 100644 --- a/BBWY.Client/Models/MappingProfile.cs +++ b/BBWY.Client/Models/MappingProfile.cs @@ -30,6 +30,7 @@ namespace BBWY.Client.Models CreateMap(); CreateMap(); CreateMap(); + CreateMap(); } } } diff --git a/BBWY.Client/Models/PackTask/PackTaskModel.cs b/BBWY.Client/Models/PackTask/PackTaskModel.cs index 232d1fec..05d91313 100644 --- a/BBWY.Client/Models/PackTask/PackTaskModel.cs +++ b/BBWY.Client/Models/PackTask/PackTaskModel.cs @@ -159,15 +159,14 @@ namespace BBWY.Client.Models { if (CertificateModel == null) { - new TipsWindow("该任务无设置合格证信息,无法打印!").ShowDialog(); + new TipsWindow("该任务无设置合格证信息,无法打印!").Show(); return; } PrintWindow printWindow = new PrintWindow(); - printWindow.LabelName = CertificateModel.LabelModel.ToString();//加载模板信息 - - printWindow.certificateModel = certificateModel; + + printWindow.CertificateModel = certificateModel; printWindow.LoadData(); - printWindow.Datas = LoadCerLabelModels(); + //printWindow.Datas = LoadCerLabelModels(); printWindow.Show(); } @@ -178,13 +177,13 @@ namespace BBWY.Client.Models { if (BarCodeModel == null) { - new TipsWindow("该任务无设置条形码信息,无法打印!").ShowDialog(); + new TipsWindow("该任务无设置条形码信息,无法打印!").Show(); return; } PrintWindow printWindow = new PrintWindow(); - printWindow.LabelName = BarCodeModel.LabelModel.ToString();//加载模板信息 - printWindow.barCodeModel = new BarCodeModel + // printWindow.LabelName = BarCodeModel.LabelModel.ToString();//加载模板信息 + printWindow.BarCodeModel = new BarCodeModel { Brand = BarCodeModel.Brand, BrandName = BarCodeModel.BrandName, @@ -194,7 +193,7 @@ namespace BBWY.Client.Models SkuName = BarCodeModel.SkuName }; printWindow.LoadData(); - printWindow.Datas = LoadBarLabelModels(); + //printWindow.Datas = LoadBarLabelModels(); printWindow.Show(); } @@ -214,71 +213,71 @@ namespace BBWY.Client.Models new TipsWindow("修改成功").Show(); } } - - public Dictionary LoadBarLabelModels() - { - Dictionary data = new Dictionary(); - data.Add("pinming", $"品名: {BarCodeModel.BrandName}"); - data.Add("guige", $"规格: {BarCodeModel.SkuName}"); - data.Add("pop", $"POP{BarCodeModel.SkuId}"); - switch (BarCodeModel.LabelModel) - { - case BarcodeLabelModel.barstander: - data.Add("pinpai", $"品牌: {BarCodeModel.Brand}"); - data.Add("xinghao", $"型号: {BarCodeModel.ProductNo}"); - return data; - case BarcodeLabelModel.barsimplify: - return data; - default: - break; - } - return data; - } - - public Dictionary LoadCerLabelModels() - { - Dictionary data = new Dictionary(); - data.Add("pinming", $"品名: {CertificateModel.BrandName}"); - data.Add("pinpai", $"品牌: {CertificateModel.Brand}"); - data.Add("xinghao", $"型号: {CertificateModel.ProductNo}"); - data.Add("dizhi", $"地址: {CertificateModel.ProductAdress}"); - data.Add("caizhi", $"材质: {CertificateModel.Shader}"); - data.Add("changshang", $"生产商: {CertificateModel.ProductShop}"); - - - switch (CertificateModel.IsLogo) - { - case 0://无图 - data.Add("gongchangid", $"无"); - break; - case 1://有图 - data.Add("gongchangid", $"{CertificateModel.FactoryNumber}"); - break; - default: - break; - } - - string[] excutes = CertificateModel.ExcuteStander.Split(',', StringSplitOptions.RemoveEmptyEntries); - StringBuilder sb = new StringBuilder(); - sb.Append("执行标准: "); - for (int i = 0; i < excutes.Count(); i++) - { - if (i % 2 == 0 && i > 0)//间隔两个换行 - { - sb.Append("\r\n").Append(" "); - } - sb.Append(excutes[i]).Append(" "); - } - sb.Remove(sb.Length - 3, 3); - - - data.Add("biaozhun", sb.ToString()); - - - - return data; - } - + /* + public Dictionary LoadBarLabelModels() + { + Dictionary data = new Dictionary(); + data.Add("pinming", $"品名: {BarCodeModel.BrandName}"); + data.Add("guige", $"规格: {BarCodeModel.SkuName}"); + data.Add("pop", $"POP{BarCodeModel.SkuId}"); + switch (BarCodeModel.LabelModel) + { + case BarcodeLabelModel.barstander: + data.Add("pinpai", $"品牌: {BarCodeModel.Brand}"); + data.Add("xinghao", $"型号: {BarCodeModel.ProductNo}"); + return data; + case BarcodeLabelModel.barsimplify: + return data; + default: + break; + } + return data; + } + + public Dictionary LoadCerLabelModels() + { + Dictionary data = new Dictionary(); + data.Add("pinming", $"品名: {CertificateModel.BrandName}"); + data.Add("pinpai", $"品牌: {CertificateModel.Brand}"); + data.Add("xinghao", $"型号: {CertificateModel.ProductNo}"); + data.Add("dizhi", $"地址: {CertificateModel.ProductAdress}"); + data.Add("caizhi", $"材质: {CertificateModel.Shader}"); + data.Add("changshang", $"生产商: {CertificateModel.ProductShop}"); + + + switch (CertificateModel.IsLogo) + { + case 0://无图 + data.Add("gongchangid", $"无"); + break; + case 1://有图 + data.Add("gongchangid", $"{CertificateModel.FactoryNumber}"); + break; + default: + break; + } + + string[] excutes = CertificateModel.ExcuteStander.Split(',', StringSplitOptions.RemoveEmptyEntries); + StringBuilder sb = new StringBuilder(); + sb.Append("执行标准: "); + for (int i = 0; i < excutes.Count(); i++) + { + if (i % 2 == 0 && i > 0)//间隔两个换行 + { + sb.Append("\r\n").Append(" "); + } + sb.Append(excutes[i]).Append(" "); + } + sb.Remove(sb.Length - 3, 3); + + + data.Add("biaozhun", sb.ToString()); + + + + return data; + } + */ private DateTime endTime; /// diff --git a/BBWY.Client/Models/ServiceOrder/ServiceOrder.cs b/BBWY.Client/Models/ServiceOrder/ServiceOrder.cs new file mode 100644 index 00000000..48804be8 --- /dev/null +++ b/BBWY.Client/Models/ServiceOrder/ServiceOrder.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; + +namespace BBWY.Client.Models +{ + public class ServiceOrder : ServiceOrderItemResponse + { + public ServiceOrder() + { + ThumbnailImageList = new List(); + } + + /// + /// 是否显示商品情况 + /// + public bool IsShowProductInfo + { + get + { + return ProductAppearance != null || ProductFunction != null || ProductHealth != null || ProductPackage != null; + } + } + + public IList ThumbnailImageList { get; set; } + + public void Init() + { + if (!string.IsNullOrEmpty(ImageName)) + { + var imageNameArray = ImageName.Split(',', System.StringSplitOptions.RemoveEmptyEntries); + foreach (var imgItemName in imageNameArray) + { + ThumbnailImageList.Add($"https://qiyue-qiku.oss-cn-beijing.aliyuncs.com/tuihuo/{imgItemName}.jpg?x-oss-process=image/resize,m_lfit,w_35/quality,q_100"); + } + } + } + } +} diff --git a/BBWY.Client/ViewModels/MainViewModel.cs b/BBWY.Client/ViewModels/MainViewModel.cs index dbeceb9b..1a7d75d8 100644 --- a/BBWY.Client/ViewModels/MainViewModel.cs +++ b/BBWY.Client/ViewModels/MainViewModel.cs @@ -159,7 +159,8 @@ namespace BBWY.Client.ViewModels Name = "订单管理", ChildList = new List() { - new MenuModel(){ Name="最近订单",Url="/Views/Order/OrderList.xaml" } + new MenuModel(){ Name="最近订单",Url="/Views/Order/OrderList.xaml" }, + new MenuModel(){ Name="服务单管理",Url="/Views/ServiceOrder/ServiceOrderList.xaml" } } }); diff --git a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs index 51bca137..6cc36e2d 100644 --- a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs @@ -120,13 +120,7 @@ namespace BBWY.Client.ViewModels.PackTask /// public ObservableCollection PackTaskList { get => packTaskList; set { Set(ref packTaskList, value); } } - //private ObservableCollection feesItems; - ///// - ///// 动态数据表 - ///// - //public ObservableCollection FeesItems { get => feesItems; set { Set(ref feesItems, value); } } - - + #endregion diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index 23cf4832..252d9e16 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -204,13 +204,8 @@ namespace BBWY.Client.ViewModels.PackTask SomeArrivedCount = packTaskResult.Data.SomeArrivedCount; WorryCount = packTaskResult.Data.WorryCount; }); - - } - - } - private void LoadIndex(int pageIndex) { PageIndex = pageIndex;// @@ -218,8 +213,6 @@ namespace BBWY.Client.ViewModels.PackTask } - - #region 事件绑定 /// @@ -275,7 +268,7 @@ namespace BBWY.Client.ViewModels.PackTask taskStatus = 1; break; case Models.TaskState.加急: - + taskStatus = 0; IsWorry = 1; break; default: @@ -370,9 +363,6 @@ namespace BBWY.Client.ViewModels.PackTask })); } - - - } else { @@ -384,23 +374,14 @@ namespace BBWY.Client.ViewModels.PackTask IsLoadCount(); IsLoading = false; }); - - - } - - - private void OpenSkuDetail(object param) { - var paramList = (object[])param; - // var orderId = paramList[0].ToString(); + var paramList = (object[])param; var skuId = paramList[1].ToString(); - - var url = $"https://item.jd.com/{skuId}.html"; try { @@ -411,7 +392,6 @@ namespace BBWY.Client.ViewModels.PackTask Clipboard.SetText(url); System.Windows.MessageBox.Show($"{ex.Message}\r\n调用浏览器失败,网页链接已复制到剪切板,请手动打开浏览器访问", "提示"); } - } diff --git a/BBWY.Client/ViewModels/ServiceOrder/ServiceOrderViewModel.cs b/BBWY.Client/ViewModels/ServiceOrder/ServiceOrderViewModel.cs new file mode 100644 index 00000000..875a298a --- /dev/null +++ b/BBWY.Client/ViewModels/ServiceOrder/ServiceOrderViewModel.cs @@ -0,0 +1,245 @@ +using BBWY.Client.APIServices; +using BBWY.Client.Helpers; +using BBWY.Client.Models; +using BBWY.Common.Extensions; +using BBWY.Common.Http; +using BBWY.Common.Models; +using BBWY.Controls; +using GalaSoft.MvvmLight.Command; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Net.Http; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Input; + +namespace BBWY.Client.ViewModels +{ + public class ServiceOrderViewModel : BaseVM, IDenpendency + { + private ServiceOrderService serviceOrderService; + private IHttpClientFactory httpClientFactory; + + private bool isLoading; + private ServiceOrderState? serviceOrderState; + private ReturnDirection? returnDirection; + private long serviceOrderCount; + private int pageIndex; + private int pageSize; + private string orderId; + private string spu; + private string sku; + private string serviceId; + private DateTime? startDate; + private DateTime? endDate; + + public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } + + public ServiceOrderState? ServiceOrderState { get => serviceOrderState; set { Set(ref serviceOrderState, value); } } + + public ReturnDirection? ReturnDirection { get => returnDirection; set { Set(ref returnDirection, value); } } + + + public ICommand SetServiceOrderStateCommand { get; set; } + public ICommand SetReturnDirectionCommand { get; set; } + public ICommand OnPageIndexChangedCommand { get; set; } + + public ICommand CopyTextCommand { get; set; } + + public ICommand SetSearchDateCommand { get; set; } + + public ICommand SearchServiceOrderCommand { get; set; } + + public ICommand NavigateToDetailCommand { get; set; } + + public ICommand PreviewImgCommand { get; set; } + + public IList ServiceOrderList { get; set; } + + public long ServiceOrderCount { get => serviceOrderCount; set { Set(ref serviceOrderCount, value); } } + + public int PageIndex { get => pageIndex; set { Set(ref pageIndex, value); } } + + public int PageSize { get => pageSize; set { Set(ref pageSize, value); } } + + public string OrderId { get => orderId; set { Set(ref orderId, value); } } + + public string Spu { get => spu; set { Set(ref spu, value); } } + + public string Sku { get => sku; set { Set(ref sku, value); } } + + public string ServiceId { get => serviceId; set { Set(ref serviceId, value); } } + + public DateTime? StartDate { get => startDate; set { Set(ref startDate, value); } } + + public DateTime? EndDate { get => endDate; set { Set(ref endDate, value); } } + + public GlobalContext GlobalContext { get; set; } + + public ServiceOrderViewModel(ServiceOrderService serviceOrderService, GlobalContext globalContext, IHttpClientFactory httpClientFactory) + { + this.httpClientFactory = httpClientFactory; + this.serviceOrderService = serviceOrderService; + SetServiceOrderStateCommand = new RelayCommand(SetServiceOrderState); + SetReturnDirectionCommand = new RelayCommand(SetReturnDirection); + CopyTextCommand = new RelayCommand(s => { try { Clipboard.SetText(s); } catch (Exception ex) { } }); + SetSearchDateCommand = new RelayCommand(SetSearchDate); + SearchServiceOrderCommand = new RelayCommand(InitQueryServiceOrder); + NavigateToDetailCommand = new RelayCommand(NavigateToDetail); + OnPageIndexChangedCommand = new RelayCommand(OnPageIndexChanged); + PreviewImgCommand = new RelayCommand(PreviewImg); + ServiceOrderList = new ObservableCollection() { new ServiceOrder(), new ServiceOrder(), new ServiceOrder() }; + PageSize = 10; + GlobalContext = globalContext; + EndDate = DateTime.Now.Date; + StartDate = DateTime.Now.Date.AddDays(-15); + InitQueryServiceOrder(); + } + + private void InitQueryServiceOrder() + { + PageIndex = 1; + Task.Factory.StartNew(() => QueryServiceOrder(PageIndex)); + } + + private void SetSearchDate(int d) + { + EndDate = d == 1 ? DateTime.Now.Date.AddDays(-1) : DateTime.Now; + StartDate = DateTime.Now.Date.AddDays(d * -1); + InitQueryServiceOrder(); + } + + private void SetServiceOrderState(ServiceOrderState? state) + { + this.ServiceOrderState = state; + //query + InitQueryServiceOrder(); + } + + private void SetReturnDirection(ReturnDirection? returnDirection) + { + this.ReturnDirection = returnDirection; + //query + InitQueryServiceOrder(); + } + + private void QueryServiceOrder(int pageIndex) + { + IsLoading = true; + var response = serviceOrderService.GetList(OrderId, Sku, Spu, ServiceId, GlobalContext.User.Shop.ShopId.ToString(), ServiceOrderState, ReturnDirection, pageIndex, PageSize, StartDate, EndDate); + if (!response.Success) + { + IsLoading = false; + App.Current.Dispatcher.Invoke(() => + { + MessageBox.Show(response.Msg, "提示"); + return; + }); + } + + IsLoading = false; + ServiceOrderCount = response.Data.Count; + App.Current.Dispatcher.Invoke(() => ServiceOrderList.Clear()); + + if (response.Data.Items == null || response.Data.Items.Count() == 0) + return; + + var list = response.Data.Items.Map>(); + + App.Current.Dispatcher.Invoke(() => + { + foreach (var s in list) + { + #region Test + //转换ImageName + if (int.Parse(s.ServiceId) % 2 == 0) + { + s.ProductPackage = ProductPackage.新; s.ImageName = "20230317071208762563,8d58b491-7859-4187-9f43-4fd177a0f25f,b0df0763-9cf4-40ca-a1fc-57695e4b8d33"; + } + + s.Init(); + #endregion + + ServiceOrderList.Add(s); + } + }); + } + + private void NavigateToDetail(string serviceId) + { + var url = $"https://sh.shop.jd.com/afs/detail/waitReceive?afsApplyId=undefined&afsServiceId={serviceId}"; + try + { + //System.Diagnostics.Process.Start("explorer.exe", url); + ShellExecuteHelper.ShellExecute(IntPtr.Zero, "open", url, string.Empty, string.Empty, ShellExecuteHelper.ShowCommands.SW_SHOWNORMAL); + } + catch (Exception ex) + { + Clipboard.SetText(url); + MessageBox.Show($"{ex.Message}\r\n调用浏览器失败,网页链接已复制到剪切板,请手动打开浏览器访问", "提示"); + } + } + + private void OnPageIndexChanged(PageArgs pageArgs) + { + Task.Factory.StartNew(() => QueryServiceOrder(pageArgs.PageIndex)); + } + + private void PreviewImg(string thumbnailImg) + { + var fullUrl = thumbnailImg.Substring(0, thumbnailImg.IndexOf("?")); + var fileName = fullUrl.Substring(fullUrl.LastIndexOf("/") + 1); + var localPath = Path.Combine(Path.GetTempPath(), fileName); + if (!File.Exists(localPath)) + { + IsLoading = true; + var downloader = new HttpDownloader(httpClientFactory); + downloader.OnDownloadComplated += (s, e) => + { + IsLoading = false; + if (e.Error != null) + { + App.Current.Dispatcher.Invoke(() => MessageBox.Show(e.Error.Message)); + return; + } + CallWindowsPhoto(localPath); + }; + Task.Factory.StartNew(() => downloader.DownloadFile(fullUrl, Path.GetTempPath(), fileName, null)); + } + else + { + CallWindowsPhoto(localPath); + } + } + + private void CallWindowsPhoto(string path) + { + //建立新的系统进程 + try + { + System.Diagnostics.Process process = new System.Diagnostics.Process(); + + //设置图片的真实路径和文件名 + process.StartInfo.FileName = path; + + //设置进程运行参数,这里以最大化窗口方法显示图片。 + process.StartInfo.Arguments = "rundl132.exe C://WINDOWS//system32//shimgvw.dll,ImageView_Fullscreen"; + + //此项为是否使用Shell执行程序,因系统默认为true,此项也可不设,但若设置必须为true + process.StartInfo.UseShellExecute = true; + + //此处可以更改进程所打开窗体的显示样式,可以不设 + process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; + process.Start(); + process.Close(); + } + catch (Exception ex) + { + App.Current.Dispatcher.Invoke(() => MessageBox.Show($"打开照片查看器失败 {ex.Message}")); + } + } + } +} diff --git a/BBWY.Client/ViewModels/ViewModelLocator.cs b/BBWY.Client/ViewModels/ViewModelLocator.cs index 945aaa93..39b69427 100644 --- a/BBWY.Client/ViewModels/ViewModelLocator.cs +++ b/BBWY.Client/ViewModels/ViewModelLocator.cs @@ -85,6 +85,18 @@ namespace BBWY.Client.ViewModels } } } + + public ServiceOrderViewModel ServiceOrderList + { + get + { + using (var s = sp.CreateScope()) + { + return s.ServiceProvider.GetRequiredService(); + } + } + } + public ConsumableViewModel Consumable { get @@ -157,8 +169,6 @@ namespace BBWY.Client.ViewModels public CreatePackTaskViewModel CreateTaskView { - - get { using (var s = sp.CreateScope()) @@ -169,7 +179,7 @@ namespace BBWY.Client.ViewModels } } } - + public ChoosePurchaseSchemeViewModel ChoosePurchaseScheme { diff --git a/BBWY.Client/Views/Order/OrderList.xaml b/BBWY.Client/Views/Order/OrderList.xaml index 53017b49..e462e3ec 100644 --- a/BBWY.Client/Views/Order/OrderList.xaml +++ b/BBWY.Client/Views/Order/OrderList.xaml @@ -409,913 +409,7 @@ - - - - - - - - - - - - - - - + - - diff --git a/BBWY.Client/Views/PackTask/CreatePackTask.xaml b/BBWY.Client/Views/PackTask/CreatePackTask.xaml index 46624568..ad3bfd10 100644 --- a/BBWY.Client/Views/PackTask/CreatePackTask.xaml +++ b/BBWY.Client/Views/PackTask/CreatePackTask.xaml @@ -13,7 +13,7 @@ xmlns:sys="clr-namespace:System;assembly=mscorlib" CloseButtonVisibility="Visible" CloseButtonColor="{StaticResource WindowButtonColor}" - DataContext="{Binding CreateTaskView,Source={StaticResource Locator}}" + DataContext="{Binding CreateTaskView,Source={StaticResource Locator}}" MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" RightButtonGroupMargin="0,5,5,0" diff --git a/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml b/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml index 327ca486..f44897c8 100644 --- a/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml +++ b/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml @@ -7,7 +7,7 @@ xmlns:local="clr-namespace:BBWY.Client.Views.PackTask" mc:Ignorable="d" Style="{StaticResource bwstyle}" - Height="259" Width="320" + Height="240" Width="320" xmlns:b="http://schemas.microsoft.com/xaml/behaviors" xmlns:ctr="clr-namespace:BBWY.Client.Converters" xmlns:cmodel="clr-namespace:BBWY.Client.Models" @@ -16,7 +16,9 @@ CloseButtonColor="{StaticResource WindowButtonColor}" MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" - RightButtonGroupMargin="0,5,5,0"> + RightButtonGroupMargin="0,5,5,0" + ResizeMode="NoResize" + > diff --git a/BBWY.Client/Views/PackTask/LookCerWindow.xaml b/BBWY.Client/Views/PackTask/LookCerWindow.xaml index 38664334..dc4a2bd8 100644 --- a/BBWY.Client/Views/PackTask/LookCerWindow.xaml +++ b/BBWY.Client/Views/PackTask/LookCerWindow.xaml @@ -7,7 +7,7 @@ xmlns:local="clr-namespace:BBWY.Client.Views.PackTask" mc:Ignorable="d" Style="{StaticResource bwstyle}" - Height="357" Width="386" + Height="340" Width="382" xmlns:b="http://schemas.microsoft.com/xaml/behaviors" xmlns:ctr="clr-namespace:BBWY.Client.Converters" xmlns:cmodel="clr-namespace:BBWY.Client.Models" @@ -16,7 +16,9 @@ CloseButtonColor="{StaticResource WindowButtonColor}" MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" - RightButtonGroupMargin="0,5,5,0"> + RightButtonGroupMargin="0,5,5,0" + ResizeMode="NoResize" + > diff --git a/BBWY.Client/Views/PackTask/PersonList.xaml b/BBWY.Client/Views/PackTask/PersonList.xaml index d95c3b8d..0b6eb677 100644 --- a/BBWY.Client/Views/PackTask/PersonList.xaml +++ b/BBWY.Client/Views/PackTask/PersonList.xaml @@ -1,20 +1,19 @@  - 0 1 2 diff --git a/BBWY.Client/Views/PackTask/PrintWindow.xaml b/BBWY.Client/Views/PackTask/PrintWindow.xaml index 5e90a7c4..bfd0ec63 100644 --- a/BBWY.Client/Views/PackTask/PrintWindow.xaml +++ b/BBWY.Client/Views/PackTask/PrintWindow.xaml @@ -17,7 +17,7 @@ MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" RightButtonGroupMargin="0,5,5,0"> - + diff --git a/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs b/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs index 1ceec309..af5e0644 100644 --- a/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs @@ -30,7 +30,7 @@ namespace BBWY.Client.Views.PackTask { InitializeComponent(); - var printingNames = System.Drawing.Printing.PrinterSettings.InstalledPrinters;//获取本机的打印机数据 + var printingNames = PrinterSettings.InstalledPrinters;//获取本机的打印机数据 int index = -1; int selectIndex = 0; foreach (string name in printingNames) @@ -58,7 +58,7 @@ namespace BBWY.Client.Views.PackTask /// public void LoadData() { - if (certificateModel==null) + if (CertificateModel==null) { cer.Visibility = Visibility.Collapsed; } @@ -69,20 +69,20 @@ namespace BBWY.Client.Views.PackTask CertificateModel data = new CertificateModel { - Brand = certificateModel.Brand, - BrandName = certificateModel.BrandName, - ExcuteStander = certificateModel.ExcuteStander, - FactoryNumber = certificateModel.FactoryNumber, - IsLogo = certificateModel.IsLogo, - LabelModel = certificateModel.LabelModel, - ProductAdress = certificateModel.ProductAdress, - Id = certificateModel.Id, - ProductDate = certificateModel.ProductDate, - ProductNo = certificateModel.ProductNo, - ProductShop = certificateModel.ProductShop, - Shader = certificateModel.Shader, - SkuId = certificateModel.SkuId, - Reseller = certificateModel.Reseller + Brand = CertificateModel.Brand, + BrandName = CertificateModel.BrandName, + ExcuteStander = CertificateModel.ExcuteStander, + FactoryNumber = CertificateModel.FactoryNumber, + IsLogo =CertificateModel.IsLogo, + LabelModel = CertificateModel.LabelModel, + ProductAdress = CertificateModel.ProductAdress, + Id = CertificateModel.Id, + ProductDate = CertificateModel.ProductDate, + ProductNo = CertificateModel.ProductNo, + ProductShop = CertificateModel.ProductShop, + Shader = CertificateModel.Shader, + SkuId = CertificateModel.SkuId, + Reseller = CertificateModel.Reseller }; StringBuilder sb = new StringBuilder(); @@ -116,7 +116,7 @@ namespace BBWY.Client.Views.PackTask } } - if (barCodeModel == null) + if (BarCodeModel == null) { bar.Visibility = Visibility.Collapsed; } @@ -124,8 +124,8 @@ namespace BBWY.Client.Views.PackTask { bar.Visibility = Visibility.Visible; cer.Visibility = Visibility.Collapsed; - this.DataContext = barCodeModel; - if (barCodeModel.LabelModel == BarcodeLabelModel.barsimplify) + this.DataContext = BarCodeModel; + if (BarCodeModel.LabelModel == BarcodeLabelModel.barsimplify) {//精简版 jingjian.Visibility = Visibility.Visible; biaozhun.Visibility = Visibility.Collapsed; @@ -138,13 +138,13 @@ namespace BBWY.Client.Views.PackTask } } - public CertificateModel certificateModel { get; set; } + public CertificateModel CertificateModel { get; set; } - public BarCodeModel barCodeModel { get; set; } + public BarCodeModel BarCodeModel { get; set; } - public string LabelName { get; set; } + // public string LabelName { get; set; } - public Dictionary Datas { get; set; } + //public Dictionary Datas { get; set; } private void BButton_Click(object sender, RoutedEventArgs e) { @@ -185,13 +185,13 @@ namespace BBWY.Client.Views.PackTask Font font = new Font("宋体", 6, System.Drawing.FontStyle.Regular); - if (barCodeModel!=null) + if (BarCodeModel != null) { - MyPrintHelper.PrintBarcode(ref args, barCodeModel, font); + MyPrintHelper.PrintBarcode(ref args, BarCodeModel, font); } - if (certificateModel!=null) + if (CertificateModel !=null) { - MyPrintHelper.PrintCertificate(ref args, certificateModel, font); + MyPrintHelper.PrintCertificate(ref args, CertificateModel, font); } } diff --git a/BBWY.Client/Views/PackTask/ServiceWindow.xaml b/BBWY.Client/Views/PackTask/ServiceWindow.xaml index 385726dc..145559ed 100644 --- a/BBWY.Client/Views/PackTask/ServiceWindow.xaml +++ b/BBWY.Client/Views/PackTask/ServiceWindow.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:BBWY.Client.Views.PackTask" mc:Ignorable="d" - Title="TipsWindow" Height="769" Width="350" + Title="TipsWindow" Height="769" Width="360" xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" xmlns:b="http://schemas.microsoft.com/xaml/behaviors" xmlns:ctr="clr-namespace:BBWY.Client.Converters" @@ -14,7 +14,6 @@ CloseButtonVisibility="Visible" WindowStartupLocation="CenterScreen" CloseButtonColor="{StaticResource WindowButtonColor}" - MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" RightButtonGroupMargin="0,5,5,0"> @@ -161,8 +160,8 @@ - - + + @@ -224,7 +223,7 @@ - diff --git a/BBWY.Client/Views/ServiceOrder/ServiceOrderList.xaml b/BBWY.Client/Views/ServiceOrder/ServiceOrderList.xaml new file mode 100644 index 00000000..c99e8315 --- /dev/null +++ b/BBWY.Client/Views/ServiceOrder/ServiceOrderList.xaml @@ -0,0 +1,470 @@ + + + + 0 + 1 + 2 + 6 + 14 + 29 + + 10005 + 10010 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +