diff --git a/BBWYB.Client/APIServices/PackPurchaseTaskService.cs b/BBWYB.Client/APIServices/PackPurchaseTaskService.cs new file mode 100644 index 0000000..b70269d --- /dev/null +++ b/BBWYB.Client/APIServices/PackPurchaseTaskService.cs @@ -0,0 +1,123 @@ +using BBWYB.Client.Models; +using BBWYB.Client.Models.APIModel; +using BBWYB.Common.Http; +using BBWYB.Common.Models; +using Microsoft.Extensions.Logging.Abstractions; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; + +namespace BBWYB.Client.APIServices +{ + public class PackPurchaseTaskService : BaseApiService, IDenpendency + { + public PackPurchaseTaskService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) + { + } + /// + /// + /// + /// 店铺Id(采购方) + /// 来源店铺的skuid + /// 店铺来源 + /// 下单数量 + /// 下单人 + /// 订单id + /// 采购平台 + /// 分箱明细 + /// + /// + public ApiResponse PublicPurchaseTask(string shopId,string skuId, string originShopName, + int skuCount, string userName, string orderId, Platform Platform, + WareHourseDTO[] WareHourses, + string MarkMessage) + { + return SendRequest(globalContext.QKApiHost, "api/PackPurchaseTask/PublicPurchaseTask", new + { + shopId, + skuId, + originShopName, + skuCount, + userName, + orderId, + Platform, + WareHourses, + MarkMessage + }, null, HttpMethod.Post); + } + + public ApiResponse UpdatePurchaseTask(UpdatePurchaseTaskRequest updatePurchaseTaskRequest) + { + return SendRequest(globalContext.QKApiHost, "api/PackPurchaseTask/UpdatePurchaseTask", updatePurchaseTaskRequest, null, HttpMethod.Post); + } + + public ApiResponse GetConfigPack(string skuId, string skuPurchaseSchemeId) + { + return SendRequest(globalContext.QKApiHost, "api/PackPurchaseTask/GetConfigPack", new { + skuId, + skuPurchaseSchemeId + } + , 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/CommitSkuCer", 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); + // HttpClientHelper helper = new HttpClientHelper(globalContext.QKApiHost); + + //string url = $"{globalContext.QKApiHost}/api/PackTask/SearchProduct?skuId={skuId}&ShopId={globalContext.User.Shop.ShopId}"; + //var data = helper.Get(url); + + //return JsonConvert.DeserializeObject>(data); + } + + } + public class WareHourseDTO + { + + public string WareId { get; set; } + /// + /// 仓库名称 + /// + public string WareName { get; set; } + /// + /// 数量 + /// + public int Count { get; set; } + } + +} diff --git a/BBWYB.Client/APIServices/ProductService.cs b/BBWYB.Client/APIServices/ProductService.cs index 8f2f133..6bb7947 100644 --- a/BBWYB.Client/APIServices/ProductService.cs +++ b/BBWYB.Client/APIServices/ProductService.cs @@ -45,5 +45,45 @@ namespace BBWYB.Client.APIServices null, HttpMethod.Post); } + + + public ApiResponse GetProductList(string spu, string productName, string productItem, int pageIndex, Platform platform, string appKey, string appSecret, string appToken) + { + return SendRequest(globalContext.BBWYCApiHost, + "api/product/GetProductList", + new + { + Spu = spu, + ProductName = productName, + ProductItem = productItem, + PageIndex = pageIndex, + Platform = platform, + AppKey = appKey, + AppSecret = appSecret, + AppToken = appToken + }, + null, + HttpMethod.Post); + } + + public ApiResponse> GetProductSkuList(string spu, string sku, Platform platform, string appKey, string appSecret, string appToken) + { + return SendRequest>(globalContext.BBWYCApiHost, + "api/product/GetProductSkuList", + new + { + Spu = spu, + Sku = sku, + Platform = platform, + AppKey = appKey, + AppSecret = appSecret, + AppToken = appToken + }, + null, + HttpMethod.Post); + } + // } + + } diff --git a/BBWYB.Client/APIServices/PurchaseService.cs b/BBWYB.Client/APIServices/PurchaseService.cs index 49e2ccc..5473b54 100644 --- a/BBWYB.Client/APIServices/PurchaseService.cs +++ b/BBWYB.Client/APIServices/PurchaseService.cs @@ -1,4 +1,5 @@ using BBWYB.Client.Models; +using BBWYB.Client.Models.APIModel; using BBWYB.Common.Http; using BBWYB.Common.Models; using System.Collections.Generic; @@ -80,5 +81,18 @@ namespace BBWYB.Client.APIServices { return SendRequest(globalContext.BBWYApiHost, $"api/purchasescheme/DeletePurchaseScheme/{schemeId}", null, null, HttpMethod.Delete); } + //Api/PurchaseScheme/GetPurchaseSkuBasicInfo + + 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/BBWYB.Client/APIServices/ShopService.cs b/BBWYB.Client/APIServices/ShopService.cs index 170588c..5dd87ca 100644 --- a/BBWYB.Client/APIServices/ShopService.cs +++ b/BBWYB.Client/APIServices/ShopService.cs @@ -1,6 +1,7 @@ using BBWYB.Client.Models; using BBWYB.Common.Http; using BBWYB.Common.Models; +using System.Collections.Generic; using System.Net.Http; namespace BBWYB.Client.APIServices @@ -23,5 +24,18 @@ namespace BBWYB.Client.APIServices purchaseAccount.PurchasePlatformId }, null, HttpMethod.Post); } + + /// + /// 获取部门及下属店铺 + /// + /// + public ApiResponse> GetDepartmentList() + { + return SendRequest>(globalContext.BBWYCApiHost, "api/vender/GetDeparmentList", null, + new Dictionary() + { + { "bbwyTempKey", "21jfhayu27q" } + }, HttpMethod.Get); + } } } diff --git a/BBWYB.Client/App.xaml b/BBWYB.Client/App.xaml index 7e71157..5939b16 100644 --- a/BBWYB.Client/App.xaml +++ b/BBWYB.Client/App.xaml @@ -6,6 +6,7 @@ xmlns:ctr="clr-namespace:BBWYB.Client.Converters" StartupUri="/Views/MainWindow.xaml" ShutdownMode="OnExplicitShutdown"> + diff --git a/BBWYB.Client/App.xaml.cs b/BBWYB.Client/App.xaml.cs index 1b0f3e3..dcd5ecf 100644 --- a/BBWYB.Client/App.xaml.cs +++ b/BBWYB.Client/App.xaml.cs @@ -60,7 +60,9 @@ namespace BBWYB.Client var builder = new ConfigurationBuilder().SetBasePath(applicationPath).AddJsonFile("appsettings.json", false, true); Configuration = builder.Build(); gl.BBWYApiHost = Configuration.GetSection("BBWYApiHost").Value; + gl.BBWYCApiHost = Configuration.GetSection("BBWYCApiHost").Value; gl.MDSApiHost = Configuration.GetSection("MDSApiHost").Value; + gl.QKApiHost = Configuration.GetSection("QKApiHost").Value; IServiceCollection serviceCollection = new ServiceCollection(); serviceCollection.AddHttpClient(); diff --git a/BBWYB.Client/BBWYB.Client.csproj b/BBWYB.Client/BBWYB.Client.csproj index 1cbe17b..ead26f7 100644 --- a/BBWYB.Client/BBWYB.Client.csproj +++ b/BBWYB.Client/BBWYB.Client.csproj @@ -3,13 +3,16 @@ WinExe net6.0-windows - enable + + true Resources\Images\bbwylogo.ico + + @@ -27,6 +30,7 @@ + @@ -42,6 +46,8 @@ + + diff --git a/BBWYB.Client/GlobalContext.cs b/BBWYB.Client/GlobalContext.cs index eac8ac1..6936397 100644 --- a/BBWYB.Client/GlobalContext.cs +++ b/BBWYB.Client/GlobalContext.cs @@ -27,6 +27,8 @@ namespace BBWYB.Client public string BBWYApiHost { get; set; } public string MDSApiHost { get; set; } + public string BBWYCApiHost { get; set; } + public string QKApiHost { get; set; } #endregion } } \ No newline at end of file diff --git a/BBWYB.Client/Models/APIModel/Request/PackPurchaseTask/BarCodeRequest.cs b/BBWYB.Client/Models/APIModel/Request/PackPurchaseTask/BarCodeRequest.cs new file mode 100644 index 0000000..b625e19 --- /dev/null +++ b/BBWYB.Client/Models/APIModel/Request/PackPurchaseTask/BarCodeRequest.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BBWYB.Client.Models.APIModel +{ + public class BarCodeRequest + { + + /// + /// 品牌 + /// + public string Brand { get; set; } + + /// + /// 品名 + /// + public string BrandName { get; set; } + + /// + /// 货号 + /// + public string ProductNo { get; set; } + + /// + /// sku名称 + /// + public string SkuName { get; set; } + + /// + /// skuId(条形码号=POP+SkuId) + /// + public string SkuId { get; set; } + + /// + /// 条形码模板 + /// + public BarcodeLabelModel LabelModel { get; set; } + + } +} diff --git a/BBWYB.Client/Models/APIModel/Request/PackPurchaseTask/CerRequest.cs b/BBWYB.Client/Models/APIModel/Request/PackPurchaseTask/CerRequest.cs new file mode 100644 index 0000000..574acf8 --- /dev/null +++ b/BBWYB.Client/Models/APIModel/Request/PackPurchaseTask/CerRequest.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BBWYB.Client.Models.APIModel +{ + public class CerRequest + { + + public string SpuId { get; set; } + /// + /// skuid + /// + public string SkuId { get; set; } + + /// + /// 品牌 + /// + public string Brand { get; set; } + + /// + /// 品名 + /// + public string BrandName { get; set; } + + /// + /// 材质 + /// + public string Shader { get; set; } + + /// + /// 执行标准 + /// + public string ExcuteStander { get; set; } + + /// + /// 生产商 + /// + public string ProductShop { get; set; } + + /// + /// 地址 + /// + public string ProductAdress { get; set; } + + /// + /// 型号(货号) + /// + public string ProductNo { get; set; } + + /// + /// 是否含3cLogo(0是 ,1否) + /// + public int IsLogo { get; set; } + + /// + /// 工厂编号 + /// + public string FactoryNumber { get; set; } + + /// + /// 合格证模板 + /// + public int LabelModel { get; set; } + + /// + /// 适用年龄 + /// + public string ApplyAge { get; set; } + + public int GoodsNumber { get; set; } + + public string ProduceDate { get; set; } + + public string PurchaseSkuId { get; set; } + } +} diff --git a/BBWYB.Client/Models/APIModel/Request/PackPurchaseTask/UpdatePurchaseTaskRequest.cs b/BBWYB.Client/Models/APIModel/Request/PackPurchaseTask/UpdatePurchaseTaskRequest.cs new file mode 100644 index 0000000..d118e80 --- /dev/null +++ b/BBWYB.Client/Models/APIModel/Request/PackPurchaseTask/UpdatePurchaseTaskRequest.cs @@ -0,0 +1,141 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BBWYB.Client.Models.APIModel +{ + /// + /// 修改采购单任务 + /// + 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/BBWYB.Client/Models/APIModel/Response/Order/OrderResponse.cs b/BBWYB.Client/Models/APIModel/Response/Order/OrderResponse.cs index 0547981..b78c6b3 100644 --- a/BBWYB.Client/Models/APIModel/Response/Order/OrderResponse.cs +++ b/BBWYB.Client/Models/APIModel/Response/Order/OrderResponse.cs @@ -148,6 +148,9 @@ namespace BBWYB.Client.Models /// 订单成本明细列表 /// public IList OrderCostDetailList { get; set; } + + + public PackConfigState? PackConfigState { get; set; } } public class OrderListResponse diff --git a/BBWYB.Client/Models/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs b/BBWYB.Client/Models/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs new file mode 100644 index 0000000..b2be897 --- /dev/null +++ b/BBWYB.Client/Models/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs @@ -0,0 +1,101 @@ +using BBWYB.Client.Models.PackPurchaseTask; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BBWYB.Client.Models.APIModel +{ + /// + /// 配置打包信息数据 + /// + public class ConfigPackResponse + { + /// + /// 货号品名 + /// + public string BrandName { get; set; } + /// + /// 组合类型(单件=0,多件=1) + /// + public int PackType { get; set; } + + + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public int BasicPack { get; set; } + + /// + /// 增量耗材 + /// + public string Increment1 { get; set; } + + /// + /// 合格证位置(外部包装=0,产品包装=1) + /// + public int? CertificatePosition { get; set; } + + /// + /// sku配件商品名称 + /// + public string SkuGoodsTitle { get; set; } + + /// + /// 配件数量 + /// + public int GoodsNumber { get; set; } + /// + /// 是否需要条形码 + /// + public bool? NeedBar { get; set; } + /// + /// 是否需要合格证 + /// + public bool? NeedCer { get; set; } + /// + /// 配件列表 + /// + public PurchaseSku[] PurchaseSkus { 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/BBWYB.Client/Models/APIModel/Response/PackPurchaseTask/ProductSkuResponse.cs b/BBWYB.Client/Models/APIModel/Response/PackPurchaseTask/ProductSkuResponse.cs new file mode 100644 index 0000000..a710ba6 --- /dev/null +++ b/BBWYB.Client/Models/APIModel/Response/PackPurchaseTask/ProductSkuResponse.cs @@ -0,0 +1,136 @@ +using BBWYB.Client.Models.PackPurchaseTask; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BBWYB.Client.Models.APIModel +{ + public class ProductSkuResponse + { + /// + /// skuId + /// + public string Id { get; set; } + + /// + /// 图片链接 + /// + public string Logo { get; set; } + /// + /// SKU标题 + /// + public string Title { get; set; } + + /// + /// 品名 + /// + public string BrandName { get; set; } + + /// + /// 商品id + /// + public long ShopId { get; set; } + + /// + /// 货号 + /// + public string ProductItemNum { get; set; } + /// + /// spuId + /// + public string ProductId { get; set; } + + + public PackConfig PackConfig { get; set; } + + + public BarCodeModel BarCodeModel { get; set; } + + + /// + /// 合格证信息 + /// + public CertificateModel[] Cers { get; set; } + /// + /// 合格证信息 + /// + public CertificateModel SpuCertificate { get; set; } + + } + public class PackConfig + { + + + /// + /// skuid + /// + [Key] + public string SkuId { get; set; } + + /// + /// 货号品名(手写上传) + /// + public string BrandName { get; set; } + + + /// + /// 组合类型(单件=0,多件=1) + /// + public int PackType { get; set; } + + + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public int BasicPack { get; set; } + + /// + /// 增量1() + /// + public string Increment1 { get; set; } + + /// + /// 条形码id + /// + public long? BarcodeId { get; set; } + + /// + /// 合格证 + /// + public string CertificateId { 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; } + /// + /// 到货情况(待收货=2,部分收货=1,已到货=0) + /// + public int Availability { get; set; } + + + public bool NeedBar { get; set; } + + public bool NeedCer { get; set; } + } + +} diff --git a/BBWYB.Client/Models/APIModel/Response/PurchaseSkuResponse.cs b/BBWYB.Client/Models/APIModel/Response/PurchaseSkuResponse.cs new file mode 100644 index 0000000..2521073 --- /dev/null +++ b/BBWYB.Client/Models/APIModel/Response/PurchaseSkuResponse.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BBWYB.Client.Models.APIModel +{ + + + /// + /// 采购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/BBWYB.Client/Models/Enums.cs b/BBWYB.Client/Models/Enums.cs index 51453eb..2b89113 100644 --- a/BBWYB.Client/Models/Enums.cs +++ b/BBWYB.Client/Models/Enums.cs @@ -94,7 +94,8 @@ 锁定 = 5, 已取消 = 6, 暂停 = 7, - 已退款 = 8 + 已退款 = 8, + 待配置 = 101, } /// @@ -211,4 +212,113 @@ { 初级策略, 中级策略, 高级策略 } + + + /// + /// 条形码模板 + /// + public enum BarcodeLabelModel + { + /// + /// 标准模板 + /// + 标准模板 = 0, + /// + /// 精简模板 + /// + 精简模板 = 1, + /// + /// 无型号模板 + /// + 无型号模板 = 2 + } + /// + /// 合格证模板 + /// + public enum CertificateLabelModel + { + 标准无3c = 0, + 标准有3c = 1, + 无型号 = 2, + 适用年龄 = 3 + } + + /// + /// 加急 + /// + public enum Worry + { + 否 = 0, + 是 = 1 + } + /// + /// 任务状态 + /// + public enum TaskStateType + { + 未完成 = 0, + 已完成 = 1 + + } + public enum Need + { + 不需要 = 0, + 需要 = 1 + } + /// + /// 落仓 + /// + public enum PositionType + { + 商家仓 = 0, + 齐越仓 = 1, + 京东仓 = 2, + 聚水潭仓 = 3 + } + /// + /// 快递到货情况 + /// + public enum TaskState + { + 已到货 = 0, + 部分到货 = 1, + 未到货 = 2 + + } + /// + /// 打包类型 + /// + public enum PackType + { + 单件 = 0, + 多件 = 1 + } + /// + /// 基础包装 + /// + public enum BasicPack + { + 快递袋 = 0, + 纸箱 = 1, + 麻袋 = 2 + } + + /// + /// 合格证包装位置 + /// + public enum CertificatePosition + { + 外部包装 = 0, + 产品包装 = 1, + 无 = 2 + } + public enum PackConfigState + { + 待配置 = 0, + 已配置 = 1 + } + public enum PackCerState { + 合格证信息=0,无需合格证=1 + + } } diff --git a/BBWYB.Client/Models/Order/Order.cs b/BBWYB.Client/Models/Order/Order.cs index e73d727..471695c 100644 --- a/BBWYB.Client/Models/Order/Order.cs +++ b/BBWYB.Client/Models/Order/Order.cs @@ -140,6 +140,11 @@ namespace BBWYB.Client.Models /// public OrderCost OrderCost { get; set; } + /// + /// 配置状态 + /// + public PackConfigState? PackConfigState { get; set; } + public IList OrderPurchaseInfoList { get; set; } public IList ItemList { get; set; } @@ -148,7 +153,6 @@ namespace BBWYB.Client.Models /// 订单成本明细列表 /// public IList OrderCostDetailList { get; set; } - /// /// 订单成本明细分组列表 /// diff --git a/BBWYB.Client/Models/PackPurchaseTask/BarCodeModel.cs b/BBWYB.Client/Models/PackPurchaseTask/BarCodeModel.cs new file mode 100644 index 0000000..d3d19c9 --- /dev/null +++ b/BBWYB.Client/Models/PackPurchaseTask/BarCodeModel.cs @@ -0,0 +1,70 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BBWYB.Client.Models.PackPurchaseTask +{ + /// + /// 条形码 + /// + public class BarCodeModel : ObservableObject + { + + /// + /// 条形码id + /// + public long Id { get; set; } + + + private string brand; + /// + /// 品牌 + /// + public string Brand { get => brand; set { SetProperty(ref brand, value); } } + + private string brandName; + /// + /// 品名 + /// + public string BrandName { get => brandName; set { SetProperty(ref brandName, value); } } + + + private string producNo; + /// + /// 货号 + /// + public string ProductNo { get => producNo; set { SetProperty(ref producNo, value); } } + + private string skuName; + /// + /// sku名称 + /// + public string SkuName { get => skuName; set { SetProperty(ref skuName, value); } } + + + private string skuId; + /// + /// skuId(条形码号=POP+SkuId) + /// + public string SkuId { get => skuId; set { SetProperty(ref skuId, value); } } + + + private string modelNo; + /// + /// 型号 + /// + public string ModelNo { get => modelNo; set { SetProperty(ref modelNo, value); } } + + + + + private BarcodeLabelModel labelModel = BarcodeLabelModel.精简模板; + /// + /// 模板标签 + /// + public BarcodeLabelModel LabelModel { get => labelModel; set { SetProperty (ref labelModel, value); } } + } +} diff --git a/BBWYB.Client/Models/PackPurchaseTask/CertificateModel.cs b/BBWYB.Client/Models/PackPurchaseTask/CertificateModel.cs new file mode 100644 index 0000000..1db59f8 --- /dev/null +++ b/BBWYB.Client/Models/PackPurchaseTask/CertificateModel.cs @@ -0,0 +1,162 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BBWYB.Client.Models.PackPurchaseTask +{ + /// + /// 合格证 + /// + public class CertificateModel : ObservableObject + { + /// + /// 合格证id + /// + public long Id { get; set; } + + public string PurchaseSkuId { get; set; } + + /// + /// skuid + /// + public string SkuId { get; set; } + + + private string spuId; + /// + /// 品牌 + /// + public string SpuId { get => spuId; set { SetProperty (ref spuId, value); } } + + + private string brand; + /// + /// 品牌 + /// + public string Brand { get => brand; set { SetProperty(ref brand, value); } } + + + private string brandName; + /// + /// 品名 + /// + public string BrandName { get => brandName; set { SetProperty(ref brandName, value); } } + + private string shader; + /// + /// 材质 + /// + public string Shader { get => shader; set { SetProperty(ref shader, value); } } + + private string excuteStander; + /// + /// 执行标准 + /// + public string ExcuteStander + { + get => excuteStander; set + { + SetProperty(ref excuteStander, value); + GetExcuteStanderFormat(); + } + } + + + private string excuteStanderFormat; + /// + /// 执行标准 (,=>换行) + /// + public string ExcuteStanderFormat { get => excuteStanderFormat; set { SetProperty(ref excuteStanderFormat, value); } } + + private string productShop; + /// + /// 生产商 + /// + public string ProductShop { get => productShop; set { SetProperty(ref productShop, value); } } + + private string productAdress; + /// + /// 地址 + /// + public string ProductAdress { get => productAdress; set { SetProperty(ref productAdress, value); } } + + private string productNo; + /// + /// 型号(货号) + /// + public string ProductNo { get => productNo; set { SetProperty(ref productNo, value); } } + + ///// + ///// 生产日期 + ///// + //public DateTime ProductDate { get; set; } + + /// + /// 经销商 + /// + public string Reseller { get; set; } + + private int isLogo; + /// + /// 是否含3cLogo(0没有 ,1有) + /// + public int IsLogo { get => isLogo; set { SetProperty(ref isLogo, value); } } + + private string factoryNumber; + /// + /// 工厂编号 + /// + public string FactoryNumber { get => factoryNumber; set { SetProperty(ref factoryNumber, value); } } + private string applyAge; + /// + /// 适用年龄 + /// + public string ApplyAge { get => applyAge; set { SetProperty(ref applyAge, value); } } + + + private CertificateLabelModel labelModel; + public CertificateLabelModel LabelModel { get => labelModel; set { SetProperty(ref labelModel, value); } } + + void GetExcuteStanderFormat() + { + StringBuilder sb = new StringBuilder(); + if (!string.IsNullOrEmpty(ExcuteStander)) + if (this.ExcuteStander.Contains(",") || this.ExcuteStander.Contains(","))//有逗号就拆分 + { + var excutes = this.ExcuteStander.Split(new string[] { ",", "," }, StringSplitOptions.RemoveEmptyEntries); + for (int i = 0; i < excutes.Length; i++) + { + if (i % 2 == 0 && i > 0)//间隔两个换行 + { + sb.Append("\r\n"); + } + sb.Append(excutes[i]).Append(" "); + } + sb.Remove(sb.Length - 3, 3); + this.ExcuteStanderFormat = sb.ToString(); + return; + } + this.ExcuteStanderFormat = ExcuteStander; + } + + + + + + private int goodsNumber = 1; + /// + /// 配件序号 + /// + public int GoodsNumber { get => goodsNumber; set { SetProperty(ref goodsNumber, value); } } + + private string produceDate; + /// + /// 生产日期 + /// + public string ProduceDate { get => produceDate; set { SetProperty(ref produceDate, value); } } + + } +} diff --git a/BBWYB.Client/Models/PackPurchaseTask/IncreateModel.cs b/BBWYB.Client/Models/PackPurchaseTask/IncreateModel.cs new file mode 100644 index 0000000..01baf35 --- /dev/null +++ b/BBWYB.Client/Models/PackPurchaseTask/IncreateModel.cs @@ -0,0 +1,23 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BBWYB.Client.Models +{ + public class IncreateModel : ObservableObject + { + private string increateName; + public string IncreateName { get => increateName; set { SetProperty(ref increateName, value); } } + private bool isSelected; + public bool IsSelected { get => isSelected; set { SetProperty(ref isSelected, value); } } + + public override string ToString() + { + return IncreateName; + } + + } +} diff --git a/BBWYB.Client/Models/PackPurchaseTask/PurchaseSku.cs b/BBWYB.Client/Models/PackPurchaseTask/PurchaseSku.cs new file mode 100644 index 0000000..3895817 --- /dev/null +++ b/BBWYB.Client/Models/PackPurchaseTask/PurchaseSku.cs @@ -0,0 +1,68 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BBWYB.Client.Models.PackPurchaseTask +{ + /// + /// 配件sku + /// + public class PurchaseSku:ObservableObject + { + + /// + /// 配件图 + /// + private string logo; + /// + /// 配件商品Id + /// + private string purchaseSkuId; + /// + /// 配件名称 + /// + private string title; + /// + /// 是否需要配置合格证 + /// + private bool isNeedCer; + /// + /// 配件图 + /// + public string Logo { get=>logo; set { SetProperty(ref logo, value); } } + /// + /// 配件商品Id + /// + public string PurchaseSkuId { get => purchaseSkuId; set { SetProperty(ref purchaseSkuId, value); } } + /// + /// 配件名称 + /// + public string Title { get => title; set { SetProperty(ref title, value); } } + /// + /// 是否需要配置合格证 + /// + public bool IsNeedCer { get => isNeedCer; set { SetProperty(ref isNeedCer, value); } } + /// + /// 合格证配置信息 + /// + public CertificateModel CerDTO { get ; set ; } + + private bool isSetCertificate; + /// + /// 设置显示(合格证) + /// + public bool IsSetCertificate + { + get => isSetCertificate; set + { + + SetProperty(ref isSetCertificate, value); + //IsNeedCertificateModel = IsSetCertificate ? Need.不需要 : Need.需要; + } + } + + } +} diff --git a/BBWYB.Client/Models/Product/Product.cs b/BBWYB.Client/Models/Product/Product.cs index d66bc47..7010309 100644 --- a/BBWYB.Client/Models/Product/Product.cs +++ b/BBWYB.Client/Models/Product/Product.cs @@ -12,6 +12,12 @@ namespace BBWYB.Client.Models PurchasePlatformList = new List(); } + /// + /// 品牌 + /// + public string BrandName { get; set; } + + private Platform selectedPurchasePlatformModel; /// diff --git a/BBWYB.Client/Models/Product/ProductSku.cs b/BBWYB.Client/Models/Product/ProductSku.cs index 3cd1590..07febc3 100644 --- a/BBWYB.Client/Models/Product/ProductSku.cs +++ b/BBWYB.Client/Models/Product/ProductSku.cs @@ -1,4 +1,5 @@ using CommunityToolkit.Mvvm.ComponentModel; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -21,6 +22,7 @@ namespace BBWYB.Client.Models public string Logo { get; set; } + /// /// 采购方案 /// diff --git a/BBWYB.Client/Resources/Images/3c.png b/BBWYB.Client/Resources/Images/3c.png new file mode 100644 index 0000000..517f927 Binary files /dev/null and b/BBWYB.Client/Resources/Images/3c.png differ diff --git a/BBWYB.Client/Resources/Images/barcode.png b/BBWYB.Client/Resources/Images/barcode.png new file mode 100644 index 0000000..b8b6e98 Binary files /dev/null and b/BBWYB.Client/Resources/Images/barcode.png differ diff --git a/BBWYB.Client/Resources/Themes/Color.xaml b/BBWYB.Client/Resources/Themes/Color.xaml index e537f37..59e2910 100644 --- a/BBWYB.Client/Resources/Themes/Color.xaml +++ b/BBWYB.Client/Resources/Themes/Color.xaml @@ -22,6 +22,7 @@ + diff --git a/BBWYB.Client/ViewModels/MainViewModel.cs b/BBWYB.Client/ViewModels/MainViewModel.cs index d0b23d5..653e24f 100644 --- a/BBWYB.Client/ViewModels/MainViewModel.cs +++ b/BBWYB.Client/ViewModels/MainViewModel.cs @@ -22,7 +22,7 @@ namespace BBWYB.Client.ViewModels private MenuModel selectedMenuModel; private bool showShopChoosePanel; - + ShopService shopService; public GlobalContext GlobalContext { get; set; } public IList MenuList { get; set; } @@ -46,7 +46,6 @@ namespace BBWYB.Client.ViewModels } } } - /// /// 是否显示店铺选择列表 /// @@ -63,7 +62,8 @@ namespace BBWYB.Client.ViewModels #region Methods public MainViewModel(GlobalContext globalContext, - MdsApiService mdsApiService) + MdsApiService mdsApiService, + ShopService shopService) { this.mdsApiService = mdsApiService; @@ -77,7 +77,7 @@ namespace BBWYB.Client.ViewModels }; Task.Factory.StartNew(Login); - + this.shopService = shopService; } @@ -139,6 +139,19 @@ namespace BBWYB.Client.ViewModels //if (GlobalContext.User.TeamName == "刷单组") // return; + var res = shopService.GetDepartmentList(); + if (!res.Success) + throw new Exception(res.Msg); + var allDepartmentList = res.Data.Map>(); + + //if (GlobalContext.User.TeamName == "刷单组") + //{ + var shopList = new List(); + foreach (var d in allDepartmentList) + shopList.AddRange(d.ShopList); + GlobalContext.User.ShopList = shopList; + + IList departmentList = null; var response = mdsApiService.GetShopDetailList(); diff --git a/BBWYB.Client/ViewModels/Order/OrderViewModel.cs b/BBWYB.Client/ViewModels/Order/OrderViewModel.cs index 8016484..1a54548 100644 --- a/BBWYB.Client/ViewModels/Order/OrderViewModel.cs +++ b/BBWYB.Client/ViewModels/Order/OrderViewModel.cs @@ -1,6 +1,7 @@ using BBWYB.Client.APIServices; using BBWYB.Client.Models; using BBWYB.Client.Views.Order; +using BBWYB.Client.Views.PackPurchaseTaska; using BBWYB.Common.Extensions; using BBWYB.Common.Models; using CommunityToolkit.Mvvm.Input; @@ -64,7 +65,7 @@ namespace BBWYB.Client.ViewModels public ICommand EditPriceCommand { get; set; } - + public ICommand EditPackConfigCommand { get; set; } public OrderViewModel(GlobalContext globalContext, OrderService orderService) { @@ -89,6 +90,7 @@ namespace BBWYB.Client.ViewModels OnlinePurchaseCommand = new RelayCommand(OnlinePurchase); CancelOrderCommand = new RelayCommand(CancelOrder); EditPriceCommand = new RelayCommand(OpenEditPrice); + EditPackConfigCommand = new RelayCommand(EditPackConfig); PageIndex = 1; PageSize = 10; EndDate = DateTime.Now; @@ -98,6 +100,21 @@ namespace BBWYB.Client.ViewModels Task.Factory.StartNew(() => LoadOrder(PageIndex)); } + private void EditPackConfig(Order order) + { + ViewModelLocator view = new (); + var updatePackTask = view.UpdatePurchaseTask; + updatePackTask.Test(order); + UpdatePurchaseTaskWindow packTask = new(); + + packTask.ShowDialog(); + + } + + /// + /// + /// + /// private void LoadOrder(int pageIndex) { IsLoading = true; diff --git a/BBWYB.Client/ViewModels/PackPurchaseTask/UpdatePurchaseTaskViewModel.cs b/BBWYB.Client/ViewModels/PackPurchaseTask/UpdatePurchaseTaskViewModel.cs new file mode 100644 index 0000000..3b4746a --- /dev/null +++ b/BBWYB.Client/ViewModels/PackPurchaseTask/UpdatePurchaseTaskViewModel.cs @@ -0,0 +1,753 @@ +using BBWYB.Client.APIServices; +using BBWYB.Client.Models; +using BBWYB.Common.Models; +using CommunityToolkit.Mvvm.Input; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; +using System.Windows; +using BBWYB.Client.Models.PackPurchaseTask; +using BBWYB.Client.Views.PackPurchaseTask; +using BBWYB.Client.Models.APIModel; + +namespace BBWYB.Client.ViewModels +{ + public class UpdatePurchaseTaskViewModel : BaseVM, IDenpendency + { + + #region 属性 + + private ObservableCollection purchaseSkuList; + public ObservableCollection PurchaseSkuList { get => purchaseSkuList; set { SetProperty(ref purchaseSkuList, value); } } + + private string searchSkuId; + public string SearchSkuId { get => searchSkuId; set { SetProperty(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 { SetProperty(ref worryList, value); } } + + private ObservableCollection positionTypeList = new ObservableCollection { + "商家仓","齐越仓", "京东仓","聚水潭仓"}; + public ObservableCollection PositionTypeList { get => positionTypeList; set { SetProperty(ref positionTypeList, value); } } + + private ObservableCollection packTypeList = new ObservableCollection { + "单件","多件" + }; + public ObservableCollection PackTypeList { get => packTypeList; set { SetProperty(ref packTypeList, value); } } + + private ObservableCollection basicPackList = new ObservableCollection { + "快递袋","纸箱","麻袋" + }; + public ObservableCollection BasicPackList { get => basicPackList; set { SetProperty(ref basicPackList, value); } } + + private ObservableCollection isNeedBarCodeList = new ObservableCollection { + "需要", "不需要" }; + public ObservableCollection IsNeedBarCodeList { get => isNeedBarCodeList; set { SetProperty(ref isNeedBarCodeList, value); } } + + private ObservableCollection isNeedCerList = new ObservableCollection { + "需要", "不需要" }; + public ObservableCollection IsNeedCerList { get => isNeedCerList; set { SetProperty(ref isNeedCerList, value); } } + + + private ObservableCollection certificatePositionList = new ObservableCollection { + "无","外部包装","产品包装" + }; + public ObservableCollection CertificatePositionList { get => certificatePositionList; set { SetProperty(ref certificatePositionList, value); } } + + private ObservableCollection availabilityList = new ObservableCollection { + "已到货","部分到货","未到货" + }; + public ObservableCollection AvailabilityList { get => availabilityList; set { SetProperty(ref availabilityList, value); } } + + private int skuCount; + /// + /// Sku任务数 + /// + public int SkuCount { get => skuCount; set { SetProperty(ref skuCount, value); } } + + private string skuId; + /// + /// Sku + /// + public string SkuId { get => skuId; set { SetProperty(ref skuId, value); } } + + + + public string OrderId { get; set; } + + private string logo; + /// + /// 店铺Sku图链接 + /// + public string Logo { get => logo; set { SetProperty(ref logo, value); } } + + private string skuName; + /// + /// 采购Sku名称 + /// + public string SkuName { get => skuName; set { SetProperty(ref skuName, value); } } + + private string brand; + /// + /// 品牌 + /// + public string Brand { get => brand; set { SetProperty(ref brand, value); } } + + + private string productNo; + /// + /// 货号 + /// + public string ProductNo { get => productNo; set { SetProperty(ref productNo, value); } } + + private string brandName; + /// + /// 品名(手写上传) + /// + public string BrandName { get => brandName; set { SetProperty(ref brandName, value); } } + + + private int goodsNumber; + /// + /// 配件数 + /// + public int GoodsNumber { get => goodsNumber; set { SetProperty(ref goodsNumber, value); } } + private Worry isWorry; + /// + /// 是否加急 + /// + public Worry IsWorry { get => isWorry; set { SetProperty(ref isWorry, value); } } + + private TaskState availability; + /// + /// 到货情况(待收货=0,部分收货=1,已到货=2) + /// + public TaskState Availability { get => availability; set { SetProperty(ref availability, value); } } + + private PackType packType; + /// + /// 打包类型(单件=0,多件=1) + /// + public PackType PackType { get => packType; set { SetProperty(ref packType, value); } } + + private BasicPack basicPack; + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public BasicPack BasicPack { get => basicPack; set { SetProperty(ref basicPack, value); } } + + private PositionType positionType; + /// + /// 落仓(商家仓=0,齐越仓=1,京东仓=2,聚水潭仓=3) + /// + public PositionType PositionType { get => positionType; set { SetProperty(ref positionType, value); } } + + private string skuTitle; + /// + /// sku配件商品名称 + /// + public string SkuTitle { get => skuTitle; set { SetProperty(ref skuTitle, value); } } + + private Need isNeedBarCode; + /// + /// 是否需要合格证 + /// + public Need IsNeedBarCode { get => isNeedBarCode; set { SetProperty(ref isNeedBarCode, value); } } + + + private Need isNeedCertificateModel; + /// + /// 是否需要条形码 + /// + public Need IsNeedCertificateModel { get => isNeedCertificateModel; set { SetProperty(ref isNeedCertificateModel, value); } } + + + private BarCodeModel barCodeModel; + /// + /// 条形码 + /// + public BarCodeModel BarCodeModel { get => barCodeModel; set { SetProperty(ref barCodeModel, value); } } + + + private bool isSetBarCode; + /// + /// 设置显示(条形码) + /// + public bool IsSetBarCode + { + get => isSetBarCode; + set + { + + SetProperty(ref isSetBarCode, value); + // IsNeedBarCode = IsSetBarCode ? Need.不需要 : Need.需要; + } + } + + private bool isSetCertificate; + /// + /// 设置显示(合格证) + /// + public bool IsSetCertificate + { + get => isSetCertificate; set + { + + SetProperty(ref isSetCertificate, value); + //IsNeedCertificateModel = IsSetCertificate ? Need.不需要 : Need.需要; + } + } + private string setSpuCerStatus; + + public string SetSpuCerStatus { get => setSpuCerStatus; set { SetProperty(ref setSpuCerStatus, value); } } + private bool isSetSpuCertificate = true; + + + /// + /// 设置spu显示(合格证) + /// + public bool IsSetSpuCertificate + { + get => isSetSpuCertificate; set + { + + SetProperty(ref isSetSpuCertificate, value); + SetSpuCerStatus = IsSetSpuCertificate ? "设置spu模板" : "修改spu模板"; + } + } + + + private string saveTask; + + /// + /// 设置显示(合格证) + /// + public string SaveTask { get => saveTask; set { SetProperty(ref saveTask, value); } } + + + private string spuId; + /// + /// 合格证 + /// + public string SpuId { get => spuId; set { SetProperty(ref spuId, value); } } + + private CertificateModel spuCertificateModel; + /// + /// spu合格证 + /// + public CertificateModel SpuCertificateModel { get => spuCertificateModel; set { SetProperty(ref spuCertificateModel, value); } } + + + + private CertificateModel certificateModel; + /// + /// 合格证 + /// + public CertificateModel CertificateModel { get => certificateModel; set { SetProperty(ref certificateModel, value); } } + + /// + /// 合格证位置(外部包装=0,产品包装=1) + /// + private CertificatePosition certificatePosition; + /// + /// 合格证位置(外部包装=0,产品包装=1) + /// + public CertificatePosition CertificatePosition { get => certificatePosition; set { SetProperty(ref certificatePosition, value); } } + + /// + /// 注意事项(对接备注) + /// + private string markMessage; + /// + /// 注意事项(对接备注) + /// + public string MarkMessage { get => markMessage; set { SetProperty(ref markMessage, value); } } + + + private ObservableCollection increateList; + /// + /// 增量耗材查询关键字 + /// + public ObservableCollection IncreateList { get => increateList; set { SetProperty(ref increateList, value); } } + string[] increates = new string[] { "气泡纸", "气泡袋", "POP袋", "折纸箱", "气泡纸封边", "彩盒", "剪胶", "剪彩带", "快递袋", "收纳盒", "纸箱子", "装纸箱", "封边", "胶带", "折彩盒" }; + + PackPurchaseTaskService packPurchaseTaskService; + + ProductService productService; + GlobalContext globalContext; + private bool isLoading = false; + public bool IsLoading { get => isLoading; set { SetProperty(ref isLoading, value); } } + #endregion + + public UpdatePurchaseTaskViewModel(ProductService productService, GlobalContext globalContext, PackPurchaseTaskService packPurchaseTaskService, PurchaseService purchaseService) + { + this.packPurchaseTaskService = packPurchaseTaskService; + this.productService = productService; + this.globalContext = globalContext; + CreateTaskCommand = new RelayCommand(CreateTask); + OpenSkuDetailCommand = new RelayCommand(OpenSkuDetail); + SetBarCodeCommand = new RelayCommand(SetBarCode); + SetCertificateCommand = new RelayCommand(SetCertificate); + LookBarCommand = new RelayCommand(LookBar); + LookCerCommand = new RelayCommand(LookCer); + SearchSkuCommand = new RelayCommand(SearchSku); + IncreateList = new ObservableCollection(); + foreach (var item in increates) + { + IncreateList.Add(new IncreateModel + { + IncreateName = item, + IsSelected = false + }); + } + + this.purchaseService = purchaseService; +#if DEBUG + + //Test(); +#endif + } + PurchaseService purchaseService; + public string OriginShopName { get; set; } + public string SkuPurchaseSchemeId { get; set; } + public Platform Platform { get; set; } + public string ShopId { get; set; } + + public string UserName { get; set; } + public void Test(Order order) + { + SearchSku(order); + + + } + + #region 方法 + 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 CreateTaskCommand { get; set; } + + public ICommand SearchSkuCommand { get; set; } + + private void SetBarCode() + { + if (string.IsNullOrEmpty(SkuId)) + { + return; + } + //if (TaskId > 0 && string.IsNullOrEmpty(SpuId))//修改界面刷新配置数据 + //{ + // SearchSku(SkuId); + //} + + if (BarCodeModel == null) + { + BarCodeModel = new BarCodeModel(); + BarCodeModel.ProductNo = ProductNo; + BarCodeModel.Brand = Brand; + BarCodeModel.SkuId = SkuId; + BarCodeModel.SkuName = SkuName; + } + if (!string.IsNullOrEmpty(BrandName)) + BarCodeModel.BrandName = BrandName; + + SetBarCodeWindow setBarCodeWindow = new SetBarCodeWindow(); + setBarCodeWindow.LoadData(BarCodeModel, packPurchaseTaskService); + setBarCodeWindow.SaveResult = b => + { + BarCodeModel = b; + IsSetBarCode = false; + IsNeedBarCode = Need.需要; + }; + setBarCodeWindow.Show(); + } + + /// + /// 设置合格证 + /// + private void SetCertificate(Models.PackPurchaseTask.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; + + SetCerWindow setCerWindow = new SetCerWindow(); + setCerWindow.LoadData(model.IsNeedCer,model.CerDTO, packPurchaseTaskService, spuCertificateModel, IsSetSpuCertificate); + setCerWindow.SaveResult = (s, PackCerState) => + { + 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(string id) + { + LookCerWindow lookCerWindow = new LookCerWindow(PurchaseSkuList.SingleOrDefault(p => p.PurchaseSkuId == id).CerDTO); + lookCerWindow.Show(); + } + /// + /// 查看条形码 + /// + private void LookBar() + { + LookBarCodeWindow look = new LookBarCodeWindow(); + look.SetData(BarCodeModel); + look.Show(); + } + + /// + /// 搜索 skuId(todo:) + /// + public void SearchSku(object obj) + { + + Order order = (Order)obj; + + SkuId = order.SourceSku; + OrderId = order.Id; + SkuPurchaseSchemeId = "416647656341573"; + OriginShopName = order.SourceShopName; + //string PurchaseProductId = "687352811674"; + Platform = order.Platform; + ShopId = "11"; + UserName = order.BuyerAccount; + var shopList = globalContext.User.ShopList; + var shop = shopList.SingleOrDefault(s => s.ShopName == OriginShopName); + Logo = order.ItemList[0].Logo; + SkuName = order.ItemList[0].Title; + if (string.IsNullOrEmpty(SkuId)) + return; + + ApiResponse productApiResponse = null; + var skuResponse = productService.GetProductSkuList(string.Empty, SkuId, shop.Platform, shop.AppKey, shop.AppSecret, shop.AppToken); + if (skuResponse.Success) + { + if (skuResponse.Data.Count() == 0) + { + return; + } + Logo = skuResponse.Data[0].Logo.Replace("80x80", "200x200"); + SkuName = skuResponse.Data[0].Title; + + SpuId = skuResponse.Data[0].ProductId; + + productApiResponse = productService.GetProductList(skuResponse.Data[0].ProductId, string.Empty, string.Empty, 1, + shop.Platform, shop.AppKey, shop.AppSecret, shop.AppToken); + + if (productApiResponse.Success) + { + if (productApiResponse.Data.Count == 0) + { + + return; + } + + ProductNo = productApiResponse.Data.Items[0].ProductItemNum; + Brand = productApiResponse.Data.Items[0].BrandName; + + } + var productSku = packPurchaseTaskService.GetConfigPack(SkuId, SkuPurchaseSchemeId); + if (productSku == null || !productSku.Success || productSku.Data == null) + return; + BrandName = productSku.Data.BrandName; + + BarCodeModel = productSku.Data.BarCode; + if (BarCodeModel == null) + { + BarCodeModel = new BarCodeModel(); + + } + if (!string.IsNullOrEmpty(Brand)) + BarCodeModel.Brand = Brand; + if (!string.IsNullOrEmpty(BrandName)) + BarCodeModel.BrandName = BrandName; + BarCodeModel.ProductNo = ProductNo; + BarCodeModel.SkuId = SkuId; + BarCodeModel.SkuName = SkuName; + PurchaseSkuList = new ObservableCollection(); + foreach (var item in productSku.Data.PurchaseSkus) + { + var list = purchaseService.GetPurchaseSkuBasicInfo(item.PurchaseProductId); + if (list == null) continue; + var skuItem = list.Data.ItemList.FirstOrDefault(f => f.PurchaseSkuId == item.PurchaseSkuId); + App.Current.Dispatcher.Invoke(new Action(() => { + PurchaseSkuList.Add(new Models.PackPurchaseTask.PurchaseSku { + Logo=skuItem.Logo, + Title=skuItem.Title, + IsNeedCer=item.IsNeedCer, + PurchaseSkuId=item.PurchaseSkuId, + CerDTO=item.CerDTO, + IsSetCertificate= item.CerDTO==null?true:false , + }); + })); + } + + IsNeedBarCode = Need.需要; + IsSetBarCode = true; + IsSetCertificate = true; + if (productSku.Data.PackConfig != null) + { + var config = productSku.Data.PackConfig; + SkuTitle = config.SkuGoodsTitle; + brandName = config.BrandName; + GoodsNumber = config.GoodsNumber; + PackType = (PackType)config.PackType; + BasicPack = (BasicPack)config.BasicPack; + Availability = (TaskState)config.Availability; + MarkMessage = config.MarkMessage; + CertificatePosition = config.CertificatePosition == null ? CertificatePosition.无 : (CertificatePosition)config.CertificatePosition.Value; + // Increment1 = config.Increment1; + string[] increateDatas = config.Increment1.Split(','); + IsNeedBarCode = config.NeedBar ? Need.需要 : Need.不需要; + IsNeedCertificateModel = config.NeedCer ? Need.需要 : Need.不需要; + + IsSetBarCode = !config.NeedBar; + IsSetCertificate = !config.NeedCer; + + bool isSelected = false; + foreach (var item in increates) + { + isSelected = false; + if (increateDatas.Contains(item)) + { + isSelected = true; + } + App.Current.Dispatcher.Invoke(() => + { + IncreateList.Add(new IncreateModel + { + IncreateName = item, + IsSelected = isSelected + }); + }); + } + + } + } + else + { + + App.Current.Dispatcher.Invoke(() => MessageBox.Show(skuResponse.Msg, "加载sku")); + return; + } + + //加载配置文件 + } + + //public void SearSpuCer() + //{ + // if (string.IsNullOrEmpty(SpuId)) + // { + // SearchSku(SkuId); + // return; + // } + // SpuId = SpuId.Trim();//去掉空格 避免数据异常 + + + // var productSku = packPurchaseTaskService.GetSpuCer(SpuId); + // if (productSku == null || !productSku.Success) + // { + // IsSetSpuCertificate = true; + + // return; + // } + // SpuCertificateModel = productSku.Data; + // IsSetSpuCertificate = false; + // if (SpuCertificateModel == null) + // { + // SpuCertificateModel = new CertificateModel(); + // IsSetSpuCertificate = true; + // SpuCertificateModel.Brand = Brand; + // SpuCertificateModel.BrandName = BrandName; + // SpuCertificateModel.ProductNo = ProductNo; + // SpuCertificateModel.SpuId = SpuId; + + // } + + + //} + + public Action ReflashWindow { get; set; } + public void InitData() + { + + //IncreateList = new ObservableCollection(); + //SpuId = string.Empty; + + //SaveTask = "保存"; + //Logo = model.ItemList[0].Logo; + //SearchSkuId = model.SkuId; + //SkuId = model.SkuId; + //SkuCount = model.SkuCount; + //SkuName = model.ItemList[0].SkuName; + //ProductNo = model.ItemList[0].GoodsNo; + //Brand = model.Brand; + //BrandName = model.ItemList[0].BrandName; + //this.MarkMessage = model.MarkMessage; + //IsSetBarCode = model.BarCodeModel != null ? false : true; + //IsSetCertificate = model.CertificateModel != null ? false : true; + //BarCodeModel = model.BarCodeModel; + //CertificateModel = model.CertificateModel; + //SkuTitle = model.SkuTitle; + //GoodsNumber = model.GoodsNumber; + //Availability = model.Availability; + //IsWorry = model.IsWorry; + //PositionType = model.PositionType; + //PackType = model.PackType; + //BasicPack = model.BasicPack; + //IsNeedBarCode = model.BarCodeModel == null ? Need.不需要 : Need.需要; + //IsNeedCertificateModel = model.CertificateModel == null ? Need.不需要 : Need.需要; + //CertificatePosition = model.CertificatePosition; + //TaskId = model.TaskId; + //string[] increateDatas = model.Increment1.Split(','); + + //bool isTrue = false; + //foreach (var item in increates) + //{ + // isTrue = false; + // if (increateDatas.Contains(item)) + // { + // isTrue = true; + // } + // App.Current.Dispatcher.Invoke(() => + // { + // IncreateList.Add(new IncreateModel + // { + // IncreateName = item, + // IsSelected = isTrue + // }); + // }); + //} + // SearchSku(SkuId); + + } + 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调用浏览器失败,网页链接已复制到剪切板,请手动打开浏览器访问", "提示"); + } + + } + private void CreateTask(object obj) + { + + string increateStr = ""; + var increates = IncreateList.Where(i => i.IsSelected).Select(i => i.IncreateName); + if (increates != null && increates.Count() > 0) + { + increateStr = string.Join(",", increates); + } + var createTaskModel = new UpdatePurchaseTaskRequest + { + ProductNo = ProductNo, + Logo = Logo, + SkuName = SkuName, + OrderId = OrderId, + BrandName = BrandName, + Availability = (int)Availability, + BasicPack = (int)BasicPack, + SkuId = SkuId, + //CreateTime = DateTime.Now, + Increment1 = increateStr, + //Increment2 = (int)Increment2, + CertificatePosition = (int)CertificatePosition, + PackType = (int)PackType, + MarkMessage = MarkMessage, + PositionType = (int)PositionType, + GoodsNumber = GoodsNumber, + SkuGoodsTitle = SkuTitle, + SkuCount = SkuCount, + NeedBar = IsNeedBarCode == Need.需要, + NeedCer = IsNeedCertificateModel == Need.需要, + SkuPurchaseSchemeId = SkuPurchaseSchemeId, + Brand = Brand, + PurchaseSkuSpecs = PurchaseSkuList.Select(p => new PurchaseSkuSpec { + IsNeedCer=p.IsNeedCer, PurchaseSkuId=p.PurchaseSkuId, + }).ToArray() + + //IsWorry = IsWorry + }; + + + + + + + if (IsNeedBarCode == Need.需要) + { + if (BarCodeModel == null || IsSetBarCode || BarCodeModel.Id <= 0) + { + new TipsWindow("请设置条形码模板").Show(); + return; + } + createTaskModel.BarCodeId = BarCodeModel.Id; + } + if (IsNeedCertificateModel == Need.需要) + { + var cerList = purchaseSkuList.Where(p => p.IsNeedCer).Select(p => p.CerDTO).Select(c=>c.Id).Where(c => c > 0).ToList(); + if ( purchaseSkuList.Count() <= 0|| cerList.Count<=0) + { + new TipsWindow("请设置合格证模板").Show(); + return; + } + createTaskModel.CerId = string.Join(",", cerList);// + } + ApiResponse res = null; + + res = packPurchaseTaskService.UpdatePurchaseTask(createTaskModel); + + if (res.Success) + { + if (ReflashWindow != null) ReflashWindow();//刷新主界面 + + var win = obj as System.Windows.Window; + win.Close(); + } + } + #endregion + } +} diff --git a/BBWYB.Client/ViewModels/ViewModelLocator.cs b/BBWYB.Client/ViewModels/ViewModelLocator.cs index 16d3362..fe4ff35 100644 --- a/BBWYB.Client/ViewModels/ViewModelLocator.cs +++ b/BBWYB.Client/ViewModels/ViewModelLocator.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.DependencyInjection; + +using Microsoft.Extensions.DependencyInjection; using System; namespace BBWYB.Client.ViewModels @@ -108,5 +109,14 @@ namespace BBWYB.Client.ViewModels } } } + + public UpdatePurchaseTaskViewModel UpdatePurchaseTask + { + get + { + using var s = sp.CreateScope(); + return s.ServiceProvider.GetRequiredService(); + } + } } } diff --git a/BBWYB.Client/Views/Order/OrderList.xaml b/BBWYB.Client/Views/Order/OrderList.xaml index a3c40b5..c54fec7 100644 --- a/BBWYB.Client/Views/Order/OrderList.xaml +++ b/BBWYB.Client/Views/Order/OrderList.xaml @@ -159,6 +159,19 @@ + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -686,7 +754,7 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWYB.Client/Views/PackPurchaseTask/CerControl.xaml.cs b/BBWYB.Client/Views/PackPurchaseTask/CerControl.xaml.cs new file mode 100644 index 0000000..0060c0b --- /dev/null +++ b/BBWYB.Client/Views/PackPurchaseTask/CerControl.xaml.cs @@ -0,0 +1,47 @@ +using BBWYB.Client.Models.PackPurchaseTask; +using System; +using System.Collections.Generic; +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.Navigation; +using System.Windows.Shapes; + +namespace BBWYB.Client.Views.PackPurchaseTask +{ + /// + /// CerControl.xaml 的交互逻辑 + /// + public partial class CerControl : UserControl + { + public CerControl() + { + InitializeComponent(); + } + + /// + /// + /// + public CertificateModel model + { + get { return (CertificateModel)GetValue(modelProperty); } + set + { + SetValue(modelProperty, value); + } + } + public static readonly DependencyProperty modelProperty = + DependencyProperty.Register("model", typeof(CertificateModel), typeof(CerControl), new PropertyMetadata(ChangedProperty)); + + private static void ChangedProperty(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + } + } +} diff --git a/BBWYB.Client/Views/PackPurchaseTask/LookBarCodeWindow.xaml b/BBWYB.Client/Views/PackPurchaseTask/LookBarCodeWindow.xaml new file mode 100644 index 0000000..d48a0ca --- /dev/null +++ b/BBWYB.Client/Views/PackPurchaseTask/LookBarCodeWindow.xaml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWYB.Client/Views/PackPurchaseTask/LookBarCodeWindow.xaml.cs b/BBWYB.Client/Views/PackPurchaseTask/LookBarCodeWindow.xaml.cs new file mode 100644 index 0000000..ba3bb1e --- /dev/null +++ b/BBWYB.Client/Views/PackPurchaseTask/LookBarCodeWindow.xaml.cs @@ -0,0 +1,33 @@ +using BBWYB.Client.Models.PackPurchaseTask; +using SJ.Controls; +using System; +using System.Collections.Generic; +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 BBWYB.Client.Views.PackPurchaseTask +{ + /// + /// LookBarCodeWindow.xaml 的交互逻辑 + /// + public partial class LookBarCodeWindow : BWindow + { + public LookBarCodeWindow() + { + InitializeComponent(); + } + public void SetData(BarCodeModel BarCodeModel) + { + this.DataContext = BarCodeModel; + } + } +} diff --git a/BBWYB.Client/Views/PackPurchaseTask/LookCerWindow.xaml b/BBWYB.Client/Views/PackPurchaseTask/LookCerWindow.xaml new file mode 100644 index 0000000..8193012 --- /dev/null +++ b/BBWYB.Client/Views/PackPurchaseTask/LookCerWindow.xaml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + diff --git a/BBWYB.Client/Views/PackPurchaseTask/LookCerWindow.xaml.cs b/BBWYB.Client/Views/PackPurchaseTask/LookCerWindow.xaml.cs new file mode 100644 index 0000000..99a046b --- /dev/null +++ b/BBWYB.Client/Views/PackPurchaseTask/LookCerWindow.xaml.cs @@ -0,0 +1,37 @@ +using BBWYB.Client.Extensions; +using BBWYB.Client.Models.PackPurchaseTask; +using SJ.Controls; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.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 BBWYB.Client.Views.PackPurchaseTask +{ + /// + /// LookCerWindow.xaml 的交互逻辑 + /// + public partial class LookCerWindow : BWindow + { + public LookCerWindow(CertificateModel certificate) + { + CertificateModel= certificate.Copy(); + InitializeComponent(); + this.DataContext = this; + } + + + + public CertificateModel CertificateModel { get; set; } + } +} diff --git a/BBWYB.Client/Views/PackPurchaseTask/SetBarCodeWindow.xaml b/BBWYB.Client/Views/PackPurchaseTask/SetBarCodeWindow.xaml new file mode 100644 index 0000000..70d6113 --- /dev/null +++ b/BBWYB.Client/Views/PackPurchaseTask/SetBarCodeWindow.xaml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BBWYB.Client/Views/PackPurchaseTask/SetBarCodeWindow.xaml.cs b/BBWYB.Client/Views/PackPurchaseTask/SetBarCodeWindow.xaml.cs new file mode 100644 index 0000000..b24bfba --- /dev/null +++ b/BBWYB.Client/Views/PackPurchaseTask/SetBarCodeWindow.xaml.cs @@ -0,0 +1,96 @@ +using BBWYB.Client.Models.PackPurchaseTask; +using BBWYB.Client.Models; +using CommunityToolkit.Mvvm.Input; +using System; +using System.Collections.Generic; +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; +using SJ.Controls; +using BBWYB.Client.APIServices; +using BBWYB.Client.Models.APIModel; + +namespace BBWYB.Client.Views.PackPurchaseTask +{ + /// + /// SetBarCode.xaml 的交互逻辑 + /// + public partial class SetBarCodeWindow : BWindow + { + public SetBarCodeWindow() + { + InitializeComponent(); + BarLabelCheckCommand = new RelayCommand(BarLabelCheck); + } + public void LoadData(BarCodeModel barCodeModel, PackPurchaseTaskService PackTaskService) + { + BarCodeModel = barCodeModel; packTaskService = PackTaskService; + this.DataContext = this; + } + + public BarCodeModel BarCodeModel { get; set; } + public PackPurchaseTaskService packTaskService { get; set; } + public Action SaveResult { get; set; } + + + + + private void BButton_Click(object sender, RoutedEventArgs e) + { + if (BarCodeModel.LabelModel == BarcodeLabelModel.标准模板)//标准版 判断数据是否异常 + { + if (string.IsNullOrEmpty(BarCodeModel.ProductNo) || BarCodeModel.ProductNo == "待填写") + { + TipsWindow tips = new TipsWindow("该SKU无货号信息,将影响条形码打印\r\n请先设置好货号信息或调整打印模板类型"); + tips.Show(); + return; + } + } + + //保存到服务器中 返回id + var resData = packTaskService.SaveBarCode(new BarCodeRequest + { + Brand = BarCodeModel.Brand, + BrandName = BarCodeModel.BrandName, + ProductNo = BarCodeModel.ProductNo, + SkuId = BarCodeModel.SkuId, + SkuName = BarCodeModel.SkuName, + LabelModel = BarCodeModel.LabelModel + + }); + if (resData == null || !resData.Success) + { + return; + } + + BarCodeModel.Id = resData.Data; + if (SaveResult != null) + SaveResult(BarCodeModel); + + this.Close(); + } + + public ICommand BarLabelCheckCommand { get; set; } + public void BarLabelCheck(BarcodeLabelModel labelModel) + { + if (labelModel == BarcodeLabelModel.标准模板)//标准版 判断数据是否异常 + { + if (string.IsNullOrEmpty(BarCodeModel.ProductNo) || BarCodeModel.ProductNo == "待填写") + { + TipsWindow tips = new TipsWindow("该SKU无货号信息,将影响条形码打印\r\n请先设置好货号信息或调整打印模板类型"); + tips.ShowDialog(); + } + } + + + } + } +} diff --git a/BBWYB.Client/Views/PackPurchaseTask/SetCerControl.xaml b/BBWYB.Client/Views/PackPurchaseTask/SetCerControl.xaml new file mode 100644 index 0000000..ab6904c --- /dev/null +++ b/BBWYB.Client/Views/PackPurchaseTask/SetCerControl.xaml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWYB.Client/Views/PackPurchaseTask/SetCerControl.xaml.cs b/BBWYB.Client/Views/PackPurchaseTask/SetCerControl.xaml.cs new file mode 100644 index 0000000..a16dda1 --- /dev/null +++ b/BBWYB.Client/Views/PackPurchaseTask/SetCerControl.xaml.cs @@ -0,0 +1,82 @@ +using BBWYB.Client.Models.PackPurchaseTask; +using BBWYB.Client.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +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.Navigation; +using System.Windows.Shapes; + +namespace BBWYB.Client.Views.PackPurchaseTask +{ + /// + /// SetCerControl.xaml 的交互逻辑 + /// + public partial class SetCerControl : UserControl + { + public SetCerControl() + { + InitializeComponent(); + } + + public CertificateModel model + { + get + { + return (CertificateModel)GetValue(modelProperty); + + } + set + { + SetValue(modelProperty, value); + NotifyPropertyChanged("CertificateModel"); + } + } + + + public static readonly DependencyProperty modelProperty = + DependencyProperty.Register("model", typeof(CertificateModel), typeof(SetCerControl), new PropertyMetadata(ChangedProperty)); + + public event PropertyChangedEventHandler PropertyChanged; + protected virtual void NotifyPropertyChanged(string propertyName) + { + if (this.PropertyChanged != null) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + + private static void ChangedProperty(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + var control = d as SetCerControl; + var newValue = e.NewValue as CertificateModel; + if (control != null && newValue != null) + { + control.model = newValue; + } + } + + 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/BBWYB.Client/Views/PackPurchaseTask/SetCerWindow.xaml b/BBWYB.Client/Views/PackPurchaseTask/SetCerWindow.xaml new file mode 100644 index 0000000..62845cf --- /dev/null +++ b/BBWYB.Client/Views/PackPurchaseTask/SetCerWindow.xaml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWYB.Client/Views/PackPurchaseTask/SetCerWindow.xaml.cs b/BBWYB.Client/Views/PackPurchaseTask/SetCerWindow.xaml.cs new file mode 100644 index 0000000..3a8204e --- /dev/null +++ b/BBWYB.Client/Views/PackPurchaseTask/SetCerWindow.xaml.cs @@ -0,0 +1,139 @@ +using BBWYB.Client.APIServices; +using BBWYB.Client.Extensions; +using BBWYB.Client.Models; +using BBWYB.Client.Models.APIModel; +using BBWYB.Client.Models.PackPurchaseTask; +using CommunityToolkit.Mvvm.Input; +using SJ.Controls; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +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 BBWYB.Client.Views.PackPurchaseTask +{ + /// + /// SetCerWindow.xaml 的交互逻辑 + /// + public partial class SetCerWindow : BWindow + { + public SetCerWindow() + { + 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; set; } + + + public PackCerState PackCerState + { + get + { + return (PackCerState)GetValue(PackCerStateProperty); + + } + set + { + SetValue(PackCerStateProperty, value); + + } + } + + + public static readonly DependencyProperty PackCerStateProperty = + DependencyProperty.Register("PackCerState", typeof(PackCerState), typeof(SetCerWindow)); + + 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 (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(); + 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(); + } + + + + } + + public class GoodsNumberCer + { + /// + /// 配件序号 + /// + // public int GoodsNumber { get; set; } + public CertificateModel CertificateModel { get; set; } + } +} diff --git a/BBWYB.Client/Views/PackPurchaseTask/TipsWindow.xaml b/BBWYB.Client/Views/PackPurchaseTask/TipsWindow.xaml new file mode 100644 index 0000000..18f7ab7 --- /dev/null +++ b/BBWYB.Client/Views/PackPurchaseTask/TipsWindow.xaml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BBWYB.Client/Views/PackPurchaseTask/TipsWindow.xaml.cs b/BBWYB.Client/Views/PackPurchaseTask/TipsWindow.xaml.cs new file mode 100644 index 0000000..0610aed --- /dev/null +++ b/BBWYB.Client/Views/PackPurchaseTask/TipsWindow.xaml.cs @@ -0,0 +1,47 @@ +using SJ.Controls; +using System; +using System.Collections.Generic; +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; +using System.Windows.Threading; + +namespace BBWYB.Client.Views.PackPurchaseTask +{ + /// + /// TipsWindow.xaml 的交互逻辑 + /// + public partial class TipsWindow : BWindow + { + private DispatcherTimer timer; + public TipsWindow(string Content, int waitTime = 2) + { + InitializeComponent(); + tbContent.Text = Content; + this.WindowStartupLocation = WindowStartupLocation.CenterScreen; + timer = new DispatcherTimer(); + timer.Interval = TimeSpan.FromSeconds(waitTime); + timer.Tick += OnTimerTick; + timer.Start(); + + } + + private void OnTimerTick(object sender, EventArgs e) + { + timer.Stop(); + Close(); + } + private void BButton_Click(object sender, RoutedEventArgs e) + { + this.Close(); + } + } +} diff --git a/BBWYB.Client/Views/PackPurchaseTask/UpdatePurchaseTaskWindow.xaml b/BBWYB.Client/Views/PackPurchaseTask/UpdatePurchaseTaskWindow.xaml new file mode 100644 index 0000000..d0b228a --- /dev/null +++ b/BBWYB.Client/Views/PackPurchaseTask/UpdatePurchaseTaskWindow.xaml @@ -0,0 +1,350 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWYB.Client/Views/PackPurchaseTask/UpdatePurchaseTaskWindow.xaml.cs b/BBWYB.Client/Views/PackPurchaseTask/UpdatePurchaseTaskWindow.xaml.cs new file mode 100644 index 0000000..0dbd6bd --- /dev/null +++ b/BBWYB.Client/Views/PackPurchaseTask/UpdatePurchaseTaskWindow.xaml.cs @@ -0,0 +1,37 @@ +using SJ.Controls; +using System; +using System.Collections.Generic; +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 BBWYB.Client.Views.PackPurchaseTaska +{ + /// + /// UpdatePurchaseTaskWindow.xaml 的交互逻辑 + /// + public partial class UpdatePurchaseTaskWindow : BWindow + { + public UpdatePurchaseTaskWindow() + { + InitializeComponent(); + this.Loaded += UpdatePurchaseTaskWindow_Loaded; + } + + private void UpdatePurchaseTaskWindow_Loaded(object sender, RoutedEventArgs e) + { + + + + + } + } +} diff --git a/BBWYB.Client/appsettings.json b/BBWYB.Client/appsettings.json index 0d8a671..b06d195 100644 --- a/BBWYB.Client/appsettings.json +++ b/BBWYB.Client/appsettings.json @@ -1,5 +1,9 @@ { - //"BBWYApiHost": "http://localhost:5000", - "BBWYApiHost": "http://bbwyb.qiyue666.com", - "MDSApiHost": "http://mdsapi.qiyue666.com" + "BBWYApiHost": "http://localhost:5000", + //"BBWYApiHost": "http://bbwyb.qiyue666.com", + "MDSApiHost": "http://mdsapi.qiyue666.com", + "BBWYCApiHost": "http://bbwytest.qiyue666.com", + "QKApiHost": "http://localhost:8080" + //"QKApiHost": "http://qiku.qiyue666.com" + } \ No newline at end of file diff --git a/BBWYB.Server.API/Controllers/OrderController.cs b/BBWYB.Server.API/Controllers/OrderController.cs index b596368..917d137 100644 --- a/BBWYB.Server.API/Controllers/OrderController.cs +++ b/BBWYB.Server.API/Controllers/OrderController.cs @@ -28,6 +28,8 @@ namespace BBWYB.Server.API.Controllers return orderBusiness.GetOrderList(request); } + + /// /// 出库 /// diff --git a/BBWYB.Server.API/Properties/launchSettings.json b/BBWYB.Server.API/Properties/launchSettings.json index 38e19b3..38704b3 100644 --- a/BBWYB.Server.API/Properties/launchSettings.json +++ b/BBWYB.Server.API/Properties/launchSettings.json @@ -14,7 +14,7 @@ "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", - "applicationUrl": "https://localhost:7256;http://localhost:5256", + "applicationUrl": "http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/BBWYB.Server.Business/Order/OrderBusiness.cs b/BBWYB.Server.Business/Order/OrderBusiness.cs index fb2cac8..0a438ce 100644 --- a/BBWYB.Server.Business/Order/OrderBusiness.cs +++ b/BBWYB.Server.Business/Order/OrderBusiness.cs @@ -52,12 +52,14 @@ namespace BBWYB.Server.Business select = select.Where((o, ocs, oct) => childSelect.Where(opi => opi.OrderId == o.Id).Any()); } - select = select.WhereIf(request.OrderState != null, (o, ocs, oct) => o.OrderState == request.OrderState) + select = select.WhereIf(request.OrderState != null && request.OrderState != Enums.OrderState.待配置, (o, ocs, oct) => o.OrderState == request.OrderState) + .WhereIf(request.OrderState == Enums.OrderState.待配置, (o, ocs, oct) => o.PackConfigState != null&&o.OrderState!=Enums.OrderState.已取消) .WhereIf(request.StartDate != null, (o, ocs, oct) => o.StartTime >= request.StartDate) .WhereIf(request.EndDate != null, (o, ocs, oct) => o.StartTime <= request.EndDate) .WhereIf(!string.IsNullOrEmpty(request.ClientOrderId), (o, ocs, oct) => o.ClientOrderId == request.ClientOrderId) .WhereIf(!string.IsNullOrEmpty(request.SourceShopName), (o, ocs, oct) => o.SourceShopName == request.SourceShopName) .WhereIf(!string.IsNullOrEmpty(request.SourceSku), (o, ocs, oct) => o.SourceSku.Contains(request.SourceSku)); + } select = select.WhereIf(request.ShopId != null, (o, ocs, oct) => o.ShopId == request.ShopId); @@ -111,7 +113,8 @@ namespace BBWYB.Server.Business PlatformCommissionRatio = oct.PlatformCommissionRatio, Profit = oct.Profit, PurchaseAmount = oct.PurchaseAmount, - IsManualEdited = oct.IsManualEdited + IsManualEdited = oct.IsManualEdited, + PackConfigState= o.PackConfigState, }; } @@ -154,7 +157,7 @@ namespace BBWYB.Server.Business order.OrderPurchaseInfoList = orderPurchaseInfoList.Where(op => op.OrderId == order.Id).ToList(); foreach (var purchaseOrder in order.OrderPurchaseInfoList) { - purchaseOrder.ExpressState = orderPurchaseSkuInfoList.FirstOrDefault(x => !string.IsNullOrEmpty(x.ExpressState) && + purchaseOrder.ExpressState = orderPurchaseSkuInfoList.FirstOrDefault(x => !string.IsNullOrEmpty(x.ExpressState) && x.PurchaseOrderId == purchaseOrder.PurchaseOrderId)?.ExpressState; } } diff --git a/BBWYB.Server.Business/PurchaseScheme/PurchaseSchemeBusiness.cs b/BBWYB.Server.Business/PurchaseScheme/PurchaseSchemeBusiness.cs index f7e793f..6c9a1b9 100644 --- a/BBWYB.Server.Business/PurchaseScheme/PurchaseSchemeBusiness.cs +++ b/BBWYB.Server.Business/PurchaseScheme/PurchaseSchemeBusiness.cs @@ -1,6 +1,7 @@ using BBWYB.Common.Extensions; using BBWYB.Common.Log; using BBWYB.Common.Models; +using BBWYB.Server.Model; using BBWYB.Server.Model.Db; using BBWYB.Server.Model.Dto; using Yitter.IdGenerator; @@ -90,7 +91,7 @@ namespace BBWYB.Server.Business //ExtractNewPurchaser(batchCURDSchemeRequest.EditPurchaseSchemeList, newPurchaserList); deletePurchaseSchemeIdList.AddRange(batchCURDSchemeRequest.EditPurchaseSchemeList.Select(ps => ps.Id)); - var editPurchaseSchemeList = batchCURDSchemeRequest.EditPurchaseSchemeList.Map>(); + var editPurchaseSchemeList = batchCURDSchemeRequest.EditPurchaseSchemeList.Map>(); foreach (var scheme in editPurchaseSchemeList) { foreach (var purchaseProduct in scheme.PurchaseSchemeProductList) diff --git a/BBWYB.Server.Model/Db/Order/Order.cs b/BBWYB.Server.Model/Db/Order/Order.cs index c99fd79..e4fb543 100644 --- a/BBWYB.Server.Model/Db/Order/Order.cs +++ b/BBWYB.Server.Model/Db/Order/Order.cs @@ -1,4 +1,5 @@ using FreeSql.DataAnnotations; +using static BBWYB.Server.Model.Enums; namespace BBWYB.Server.Model.Db { @@ -223,6 +224,9 @@ namespace BBWYB.Server.Model.Db public string Town { get; set; } #endregion - } + [Column(DbType = "int(1)", MapType = typeof(int?))] + public PackConfigState? PackConfigState { get; set; } + +} } diff --git a/BBWYB.Server.Model/Db/PurchaseScheme/OrderPurchaseRelationInfo.cs b/BBWYB.Server.Model/Db/PurchaseScheme/OrderPurchaseRelationInfo.cs new file mode 100644 index 0000000..629c939 --- /dev/null +++ b/BBWYB.Server.Model/Db/PurchaseScheme/OrderPurchaseRelationInfo.cs @@ -0,0 +1,40 @@ +using FreeSql.DataAnnotations; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace BBWYB.Server.Model.Db.PurchaseScheme +{ + [Table(Name = "orderpurchaserelationinfo", DisableSyncStructure = true)] + public class OrderPurchaseRelationInfo + { + [Column( IsPrimary = true)] + public long Id { get; set; } + + /// + /// 采购单Id + /// + public string PurchaseOrderId { get; set; } + /// + /// 订单Id + /// + public string OrderId { get; set; } + + /// + /// 采购方案Id + /// + public string SchemeId { get; set; } + /// + /// 采购spu + /// + public string PurchaseProductId { get; set; } + /// + /// 采购sku + /// + public string PurchaseSkuId { get; set; } + } +} diff --git a/BBWYB.Server.Model/Db/PurchaseScheme/PurchaseScheme.cs b/BBWYB.Server.Model/Db/PurchaseScheme/PurchaseScheme.cs index 0a3366a..3b1ae95 100644 --- a/BBWYB.Server.Model/Db/PurchaseScheme/PurchaseScheme.cs +++ b/BBWYB.Server.Model/Db/PurchaseScheme/PurchaseScheme.cs @@ -1,7 +1,9 @@ + +using BBWYB.Server.Model.Db; using FreeSql.DataAnnotations; using System; using System.Collections.Generic; -namespace BBWYB.Server.Model.Db +namespace BBWYB.Server.Model { /// diff --git a/BBWYB.Server.Model/Dto/Request/Order/QueryOrderRequest.cs b/BBWYB.Server.Model/Dto/Request/Order/QueryOrderRequest.cs index 42b0be1..f1c73ff 100644 --- a/BBWYB.Server.Model/Dto/Request/Order/QueryOrderRequest.cs +++ b/BBWYB.Server.Model/Dto/Request/Order/QueryOrderRequest.cs @@ -62,5 +62,7 @@ /// 来源Sku /// public string SourceSku { get; set; } + + } } diff --git a/BBWYB.Server.Model/Dto/Response/Order/OrderResponse.cs b/BBWYB.Server.Model/Dto/Response/Order/OrderResponse.cs index 010eba0..be040ab 100644 --- a/BBWYB.Server.Model/Dto/Response/Order/OrderResponse.cs +++ b/BBWYB.Server.Model/Dto/Response/Order/OrderResponse.cs @@ -138,6 +138,11 @@ /// 订单成本明细列表 /// public IList OrderCostDetailList { get; set; } + + /// + /// 打包状态 + /// + public Enums.PackConfigState? PackConfigState { get; set; } } public class OrderListResponse diff --git a/BBWYB.Server.Model/Dto/Response/PurchaseScheme/PurchaseSchemeResponse.cs b/BBWYB.Server.Model/Dto/Response/PurchaseScheme/PurchaseSchemeResponse.cs index 582c034..30bbb75 100644 --- a/BBWYB.Server.Model/Dto/Response/PurchaseScheme/PurchaseSchemeResponse.cs +++ b/BBWYB.Server.Model/Dto/Response/PurchaseScheme/PurchaseSchemeResponse.cs @@ -1,8 +1,10 @@ -using System.Collections.Generic; + + +using BBWYB.Server.Model.Db; namespace BBWYB.Server.Model.Dto { - public class PurchaseSchemeResponse : Model.Db.PurchaseScheme + public class PurchaseSchemeResponse : PurchaseScheme { public string PurchaserName { get; set; } diff --git a/BBWYB.Server.Model/Enums.cs b/BBWYB.Server.Model/Enums.cs index 4089b7c..69e6ec5 100644 --- a/BBWYB.Server.Model/Enums.cs +++ b/BBWYB.Server.Model/Enums.cs @@ -84,7 +84,8 @@ 已取消 = 6, 暂停 = 7, 已退款 = 8, - Unknow = 100 + Unknow = 100, + 待配置 = 101, } /// @@ -265,5 +266,11 @@ Spider = 0, OneBound = 1 } + + public enum PackConfigState + { + 待配置 = 0, + 已配置 = 1 + } } }