From 4eac19b37d39d78e6d96a8a9781b2050bc6e0948 Mon Sep 17 00:00:00 2001 From: wule Date: Fri, 5 Sep 2025 13:32:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E4=BC=98=E5=8C=96=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E7=BB=9F=E8=AE=A1=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AllBase/BaseClass.cs | 4 +- AllBase/Model/Result/TemuStockInfo.cs | 8 +- .../ShopOrderStatisticsDetailForm.Designer.cs | 114 ++++++++------ .../ShopOrderStatisticsDetailForm.cs | 100 +++++++++++- .../ShopOrderStatisticsDetailForm.resx | 14 +- .../ShopOrderStatisticsForm.Designer.cs | 144 ++++++++++++------ .../Statistics/ShopOrderStatisticsForm.cs | 94 +++++++----- .../ShopSetPurchasePriceForm.Designer.cs | 49 ++++-- .../Statistics/ShopSetPurchasePriceForm.cs | 13 +- 9 files changed, 379 insertions(+), 161 deletions(-) diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index b520f71..a8d4ac0 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,8 +27,8 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 572; - //public static int VersionCount = 572; + public static int VersionCount = 575; + //public static int VersionCount = 575; /// /// 版本号 diff --git a/AllBase/Model/Result/TemuStockInfo.cs b/AllBase/Model/Result/TemuStockInfo.cs index 1d1e29c..d213272 100644 --- a/AllBase/Model/Result/TemuStockInfo.cs +++ b/AllBase/Model/Result/TemuStockInfo.cs @@ -205,7 +205,7 @@ namespace AllBase.Model.Result public int wantStockUpBound { get; set; } = 0; /// - /// 进货价,保存于KJD库 + /// 进货价,保存于KJD库 单位分 /// public int purchasePrice { get; set; } = 0; /// @@ -217,15 +217,15 @@ namespace AllBase.Model.Result /// public int goodsCost { get; set; } /// - /// 今日利润(通过KJD库获取进货价计算获得) + /// 今日利润(通过KJD库获取进货价计算获得)单位元 /// public decimal? todayProfit { get; set; } = null; /// - /// 近7日利润(通过KJD库获取进货价计算获得) + /// 近7日利润(通过KJD库获取进货价计算获得)单位元 /// public decimal? sevenDaysProfit { get; set; } = null; /// - /// 近30日利润(通过KJD库获取进货价计算获得) + /// 近30日利润(通过KJD库获取进货价计算获得)单位元 /// public decimal? thirtyDaysProfit { get; set; } = null; } diff --git a/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsDetailForm.Designer.cs b/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsDetailForm.Designer.cs index ee1f43f..482a799 100644 --- a/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsDetailForm.Designer.cs +++ b/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsDetailForm.Designer.cs @@ -41,10 +41,10 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.pbLoading = new System.Windows.Forms.PictureBox(); this.dgvOrder = new TemuKJD.UserComponent.DataGridViewEx(); - this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.colSpu = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSkc = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colProductSkcPic = new System.Windows.Forms.DataGridViewImageColumn(); this.colSaleVolume = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colTodayProfit = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -52,15 +52,17 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.colSevenDaysProfit = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colThirtyDaysSaleVolume = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colThirtyDaysProfit = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colProductValue = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colProductCost = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colGoodsValue = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colGoodsCost = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colAddDays = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colTotalSaleVolume = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colInCartVolume = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colInventory = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colDiscount = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colScore = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colLastMonthIncomeAmount = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colAvailableBalance = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colNotes = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colOperate = new System.Windows.Forms.DataGridViewLinkColumn(); + this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -233,6 +235,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.colSelect, this.colSpu, this.colSkc, + this.colImgUrl, this.colProductSkcPic, this.colSaleVolume, this.colTodayProfit, @@ -240,15 +243,16 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.colSevenDaysProfit, this.colThirtyDaysSaleVolume, this.colThirtyDaysProfit, - this.colProductValue, - this.colProductCost, + this.colGoodsValue, + this.colGoodsCost, this.colAddDays, this.colTotalSaleVolume, this.colInCartVolume, + this.colInventory, this.colDiscount, this.colScore, - this.colLastMonthIncomeAmount, - this.colAvailableBalance}); + this.colNotes, + this.colOperate}); this.dgvOrder.Dock = System.Windows.Forms.DockStyle.Fill; this.dgvOrder.Location = new System.Drawing.Point(4, 0); this.dgvOrder.Name = "dgvOrder"; @@ -258,20 +262,10 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.dgvOrder.Size = new System.Drawing.Size(1356, 628); this.dgvOrder.TabIndex = 5; this.dgvOrder.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvOrder_CellContentClick); + this.dgvOrder.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dgvOrder_Scroll); + this.dgvOrder.Sorted += new System.EventHandler(this.dgvOrder_Sorted); this.dgvOrder.Resize += new System.EventHandler(this.dgvShop_Resize); // - // statusBar - // - this.statusBar.BackColor = System.Drawing.Color.White; - this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill; - this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.statusBar.Location = new System.Drawing.Point(0, 0); - this.statusBar.Margin = new System.Windows.Forms.Padding(0); - this.statusBar.Name = "statusBar"; - this.statusBar.Size = new System.Drawing.Size(1364, 25); - this.statusBar.TabIndex = 1; - this.statusBar.Visible = false; - // // colSelect // this.colSelect.FillWeight = 28F; @@ -298,6 +292,13 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.colSkc.Name = "colSkc"; this.colSkc.ReadOnly = true; // + // colImgUrl + // + this.colImgUrl.HeaderText = "图片地址"; + this.colImgUrl.Name = "colImgUrl"; + this.colImgUrl.ReadOnly = true; + this.colImgUrl.Visible = false; + // // colProductSkcPic // this.colProductSkcPic.FillWeight = 20F; @@ -351,20 +352,20 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.colThirtyDaysProfit.ReadOnly = true; this.colThirtyDaysProfit.Visible = false; // - // colProductValue + // colGoodsValue // - this.colProductValue.FillWeight = 70F; - this.colProductValue.HeaderText = "货值"; - this.colProductValue.Name = "colProductValue"; - this.colProductValue.ReadOnly = true; + this.colGoodsValue.FillWeight = 70F; + this.colGoodsValue.HeaderText = "货值"; + this.colGoodsValue.Name = "colGoodsValue"; + this.colGoodsValue.ReadOnly = true; // - // colProductCost + // colGoodsCost // - this.colProductCost.FillWeight = 70F; - this.colProductCost.HeaderText = "成本"; - this.colProductCost.Name = "colProductCost"; - this.colProductCost.ReadOnly = true; - this.colProductCost.Visible = false; + this.colGoodsCost.FillWeight = 70F; + this.colGoodsCost.HeaderText = "成本"; + this.colGoodsCost.Name = "colGoodsCost"; + this.colGoodsCost.ReadOnly = true; + this.colGoodsCost.Visible = false; // // colAddDays // @@ -385,6 +386,13 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.colInCartVolume.Name = "colInCartVolume"; this.colInCartVolume.ReadOnly = true; // + // colInventory + // + this.colInventory.FillWeight = 40F; + this.colInventory.HeaderText = "库存"; + this.colInventory.Name = "colInventory"; + this.colInventory.ReadOnly = true; + // // colDiscount // this.colDiscount.FillWeight = 40F; @@ -399,19 +407,31 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.colScore.Name = "colScore"; this.colScore.ReadOnly = true; // - // colLastMonthIncomeAmount + // colNotes // - this.colLastMonthIncomeAmount.HeaderText = "备注"; - this.colLastMonthIncomeAmount.Name = "colLastMonthIncomeAmount"; - this.colLastMonthIncomeAmount.ReadOnly = true; + this.colNotes.HeaderText = "备注"; + this.colNotes.Name = "colNotes"; + this.colNotes.ReadOnly = true; // - // colAvailableBalance + // colOperate // - this.colAvailableBalance.FillWeight = 50F; - this.colAvailableBalance.HeaderText = "操作"; - this.colAvailableBalance.Name = "colAvailableBalance"; - this.colAvailableBalance.ReadOnly = true; - this.colAvailableBalance.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colOperate.FillWeight = 50F; + this.colOperate.HeaderText = "操作"; + this.colOperate.Name = "colOperate"; + this.colOperate.ReadOnly = true; + this.colOperate.Resizable = System.Windows.Forms.DataGridViewTriState.True; + // + // statusBar + // + this.statusBar.BackColor = System.Drawing.Color.White; + this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill; + this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.statusBar.Location = new System.Drawing.Point(0, 0); + this.statusBar.Margin = new System.Windows.Forms.Padding(0); + this.statusBar.Name = "statusBar"; + this.statusBar.Size = new System.Drawing.Size(1364, 25); + this.statusBar.TabIndex = 1; + this.statusBar.Visible = false; // // ShopOrderStatisticsDetailForm // @@ -456,6 +476,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect; private System.Windows.Forms.DataGridViewTextBoxColumn colSpu; private System.Windows.Forms.DataGridViewTextBoxColumn colSkc; + private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl; private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic; private System.Windows.Forms.DataGridViewTextBoxColumn colSaleVolume; private System.Windows.Forms.DataGridViewTextBoxColumn colTodayProfit; @@ -463,14 +484,15 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics private System.Windows.Forms.DataGridViewTextBoxColumn colSevenDaysProfit; private System.Windows.Forms.DataGridViewTextBoxColumn colThirtyDaysSaleVolume; private System.Windows.Forms.DataGridViewTextBoxColumn colThirtyDaysProfit; - private System.Windows.Forms.DataGridViewTextBoxColumn colProductValue; - private System.Windows.Forms.DataGridViewTextBoxColumn colProductCost; + private System.Windows.Forms.DataGridViewTextBoxColumn colGoodsValue; + private System.Windows.Forms.DataGridViewTextBoxColumn colGoodsCost; private System.Windows.Forms.DataGridViewTextBoxColumn colAddDays; private System.Windows.Forms.DataGridViewTextBoxColumn colTotalSaleVolume; private System.Windows.Forms.DataGridViewTextBoxColumn colInCartVolume; + private System.Windows.Forms.DataGridViewTextBoxColumn colInventory; private System.Windows.Forms.DataGridViewTextBoxColumn colDiscount; private System.Windows.Forms.DataGridViewTextBoxColumn colScore; - private System.Windows.Forms.DataGridViewTextBoxColumn colLastMonthIncomeAmount; - private System.Windows.Forms.DataGridViewLinkColumn colAvailableBalance; + private System.Windows.Forms.DataGridViewTextBoxColumn colNotes; + private System.Windows.Forms.DataGridViewLinkColumn colOperate; } } \ No newline at end of file diff --git a/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsDetailForm.cs b/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsDetailForm.cs index 611f395..3b07978 100644 --- a/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsDetailForm.cs +++ b/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsDetailForm.cs @@ -1,4 +1,5 @@ -using AllBase.Model.Result; +using AllBase; +using AllBase.Model.Result; using NaiBa.Util.Extension; using System; using System.Collections.Generic; @@ -10,6 +11,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using TemuKJD.KJDForms.BaseForms; +using TemuKJD.KJDForms.ToolForms; namespace TemuKJD.KJDForms.ShopForms.Statistics { @@ -68,10 +70,11 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics { foreach (WarehouseProductSubOrderInfo order in lstSubOrderInfo) { - this.dgvOrder.Rows.Add( + int rowId = this.dgvOrder.Rows.Add( false, order.productId, order.productSkcId, + order.productSkcPicture.Replace("https://", "http://"), defaultBitmap, order.skuQuantityTotalInfo.todaySaleVolume, order.skuQuantityTotalInfo.todayProfit.Value.ToString("0.00"), @@ -84,15 +87,72 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics order.onSalesDurationOffline, // 加入站点时间 order.skuQuantityTotalInfo.totalSaleVolume, //总销量 order.skuQuantityTotalInfo.inCardNumber, //加购数量 - order.discount.ParseToDecimal() * 0.01m, + order.skuQuantityTotalInfo.inventoryNumInfo.warehouseInventoryNum, //可用库存 + order.discount.ParseToDecimal() * 0.01m, //折扣 order.goodsAfsScore == null ? null : order.goodsAfsScore?.ToString("f2"), //品质分 - "", //备注 + order.purchasePriceInfo?.notes, //备注 "设置进价" ); + this.dgvOrder.Rows[rowId].Height = 50; } + ShowDgvImg(); } - Bitmap defaultBitmap = new Bitmap(50, 50); + Bitmap defaultBitmap = new Bitmap(50, 50); + void ShowDgvImg() + { + foreach (DataGridViewRow row in this.dgvOrder.Rows) + { + var t = Task.Run(() => + { + if (row.Index > 0 && row.Cells["colProductSkcPic"].Displayed == false) + { + try + { + Invoke(new Action(() => + { + row.Cells["colProductSkcPic"].Value = defaultBitmap; + })); + } + catch + { + } + //continue; + return false; + } + + if (row.Cells["colProductSkcPic"].Value != null && row.Cells["colProductSkcPic"].Value != defaultBitmap) + { + //continue; + return false; + } + + Image image = null; + string imgUrl = row.Cells["colImgUrl"]?.Value.ParseToString(); + string getImgError = ""; + if (!string.IsNullOrWhiteSpace(imgUrl)) + { + imgUrl = imgUrl.Replace("img.kwcdn.com", "img.cdnfe.com") + "?imageMogr2/thumbnail/60x"; + image = GetHtml.GetUrlImg(imgUrl, out getImgError); + } + //if (!string.IsNullOrEmpty(getImgError)) + // BaseMsgForm.ShowError("图片加载失败" + getImgError); + + try + { + Invoke(new Action(() => + { + row.Cells["colProductSkcPic"].Value = image; + })); + } + catch + { + return false; + } + return true; + }); + } + } private void dgvOrder_CellContentClick(object sender, DataGridViewCellEventArgs e) { @@ -106,13 +166,31 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics { case "检测": break; + case "图片": + string url = dgvOrder.Rows[e.RowIndex].Cells["colImgUrl"].Value.ParseToString().Replace("img.kwcdn.com", "img.cdnfe.com"); + url = url.IndexOf("?") < 0 ? url : url.Substring(0, url.IndexOf("?")); + ShowImgForm imgFrom = new ShowImgForm(url); + imgFrom.ShowDialog(); + break; case "操作": { if (shop != null) { - var subOrders = lstSubOrderInfo.Where(o => o.supplierId.ParseToString() == shop.ShopId).ToList(); + //var subOrders = lstSubOrderInfo.Where(o => o.supplierId.ParseToString() == shop.ShopId).ToList(); ShopSetPurchasePriceForm detailForm = new ShopSetPurchasePriceForm(shop, order); detailForm.ShowDialog(); + if (ShopOrderStatisticsForm.OrderStatisticsInstance != null) + { + ShopOrderStatisticsForm.OrderStatisticsInstance.CountPrice(shop); + ShopOrderStatisticsForm.OrderStatisticsInstance.RefreshShop(); + } + dgvOrder.Rows[e.RowIndex].Cells["colDiscount"].Value = order.discount.ParseToDecimal() * 0.01m; + dgvOrder.Rows[e.RowIndex].Cells["colNotes"].Value = order.purchasePriceInfo?.notes; + dgvOrder.Rows[e.RowIndex].Cells["colTodayProfit"].Value = order.skuQuantityTotalInfo.todayProfit.Value.ToString("0.00"); + dgvOrder.Rows[e.RowIndex].Cells["colSevenDaysProfit"].Value = order.skuQuantityTotalInfo.sevenDaysProfit.Value.ToString("0.00"); + dgvOrder.Rows[e.RowIndex].Cells["colThirtyDaysProfit"].Value = order.skuQuantityTotalInfo.thirtyDaysProfit.Value.ToString("0.00"); + dgvOrder.Rows[e.RowIndex].Cells["colGoodsValue"].Value = order.skuQuantityTotalInfo.goodsValue * 0.01m; + dgvOrder.Rows[e.RowIndex].Cells["colGoodsCost"].Value = order.skuQuantityTotalInfo.goodsCost * 0.01m; } } break; @@ -124,5 +202,15 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics break; } } + + private void dgvOrder_Scroll(object sender, ScrollEventArgs e) + { + ShowDgvImg(); + } + + private void dgvOrder_Sorted(object sender, EventArgs e) + { + ShowDgvImg(); + } } } diff --git a/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsDetailForm.resx b/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsDetailForm.resx index b7f0844..4368c2a 100644 --- a/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsDetailForm.resx +++ b/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsDetailForm.resx @@ -126,6 +126,9 @@ True + + True + True @@ -147,10 +150,10 @@ True - + True - + True @@ -162,16 +165,19 @@ True + + True + True True - + True - + True diff --git a/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsForm.Designer.cs b/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsForm.Designer.cs index 58732ca..d20ee57 100644 --- a/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsForm.Designer.cs +++ b/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsForm.Designer.cs @@ -57,7 +57,6 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.pbLoading = new System.Windows.Forms.PictureBox(); this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx(); - this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.colLoginStatus = new System.Windows.Forms.DataGridViewLinkColumn(); this.colDetail = new System.Windows.Forms.DataGridViewLinkColumn(); @@ -81,6 +80,11 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.colAvailableBalance = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colMallDepositLimitAmount = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colWithdrawCashAmount = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); + this.lblTodayProfit = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.lblSevenDaysProfit = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -203,29 +207,35 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.tableLayoutPanel1.ColumnCount = 6; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel1.ColumnCount = 7; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 10F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 10F)); - this.tableLayoutPanel1.Controls.Add(this.lblWithdrawCashAmount, 3, 3); - this.tableLayoutPanel1.Controls.Add(this.lblAvailableBalance, 2, 3); - this.tableLayoutPanel1.Controls.Add(this.lblMallDepositLimitAmount, 1, 3); - this.tableLayoutPanel1.Controls.Add(this.lblLastMonthIncomeAmount, 0, 3); - this.tableLayoutPanel1.Controls.Add(this.lblThisMonthIncomeAmount, 3, 1); - this.tableLayoutPanel1.Controls.Add(this.lblYesterdayIncomeAmount, 2, 1); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.Controls.Add(this.lblSevenDaysProfit, 3, 1); this.tableLayoutPanel1.Controls.Add(this.lblSevenDaysSaleVolume, 1, 1); - this.tableLayoutPanel1.Controls.Add(this.label8, 3, 2); - this.tableLayoutPanel1.Controls.Add(this.label7, 2, 2); - this.tableLayoutPanel1.Controls.Add(this.label6, 1, 2); - this.tableLayoutPanel1.Controls.Add(this.label5, 0, 2); - this.tableLayoutPanel1.Controls.Add(this.label4, 3, 0); - this.tableLayoutPanel1.Controls.Add(this.label3, 2, 0); + this.tableLayoutPanel1.Controls.Add(this.label10, 3, 0); this.tableLayoutPanel1.Controls.Add(this.label2, 1, 0); this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); this.tableLayoutPanel1.Controls.Add(this.lblSaleVolume, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.label8, 4, 2); + this.tableLayoutPanel1.Controls.Add(this.lblWithdrawCashAmount, 4, 3); + this.tableLayoutPanel1.Controls.Add(this.label7, 3, 2); + this.tableLayoutPanel1.Controls.Add(this.lblAvailableBalance, 3, 3); + this.tableLayoutPanel1.Controls.Add(this.label6, 2, 2); + this.tableLayoutPanel1.Controls.Add(this.lblMallDepositLimitAmount, 2, 3); + this.tableLayoutPanel1.Controls.Add(this.label5, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.lblLastMonthIncomeAmount, 1, 3); + this.tableLayoutPanel1.Controls.Add(this.label4, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.lblThisMonthIncomeAmount, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.label3, 4, 0); + this.tableLayoutPanel1.Controls.Add(this.lblYesterdayIncomeAmount, 4, 1); + this.tableLayoutPanel1.Controls.Add(this.lblTodayProfit, 2, 1); + this.tableLayoutPanel1.Controls.Add(this.label9, 2, 0); this.tableLayoutPanel1.Location = new System.Drawing.Point(31, 19); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 4; @@ -241,7 +251,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.lblWithdrawCashAmount.Anchor = System.Windows.Forms.AnchorStyles.Left; this.lblWithdrawCashAmount.AutoSize = true; this.lblWithdrawCashAmount.Font = new System.Drawing.Font("微软雅黑", 11F); - this.lblWithdrawCashAmount.Location = new System.Drawing.Point(861, 87); + this.lblWithdrawCashAmount.Location = new System.Drawing.Point(919, 87); this.lblWithdrawCashAmount.Name = "lblWithdrawCashAmount"; this.lblWithdrawCashAmount.Size = new System.Drawing.Size(18, 20); this.lblWithdrawCashAmount.TabIndex = 15; @@ -252,7 +262,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.lblAvailableBalance.Anchor = System.Windows.Forms.AnchorStyles.Left; this.lblAvailableBalance.AutoSize = true; this.lblAvailableBalance.Font = new System.Drawing.Font("微软雅黑", 11F); - this.lblAvailableBalance.Location = new System.Drawing.Point(575, 87); + this.lblAvailableBalance.Location = new System.Drawing.Point(690, 87); this.lblAvailableBalance.Name = "lblAvailableBalance"; this.lblAvailableBalance.Size = new System.Drawing.Size(18, 20); this.lblAvailableBalance.TabIndex = 15; @@ -263,7 +273,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.lblMallDepositLimitAmount.Anchor = System.Windows.Forms.AnchorStyles.Left; this.lblMallDepositLimitAmount.AutoSize = true; this.lblMallDepositLimitAmount.Font = new System.Drawing.Font("微软雅黑", 11F); - this.lblMallDepositLimitAmount.Location = new System.Drawing.Point(289, 87); + this.lblMallDepositLimitAmount.Location = new System.Drawing.Point(461, 87); this.lblMallDepositLimitAmount.Name = "lblMallDepositLimitAmount"; this.lblMallDepositLimitAmount.Size = new System.Drawing.Size(18, 20); this.lblMallDepositLimitAmount.TabIndex = 15; @@ -274,7 +284,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.lblLastMonthIncomeAmount.Anchor = System.Windows.Forms.AnchorStyles.Left; this.lblLastMonthIncomeAmount.AutoSize = true; this.lblLastMonthIncomeAmount.Font = new System.Drawing.Font("微软雅黑", 11F); - this.lblLastMonthIncomeAmount.Location = new System.Drawing.Point(3, 87); + this.lblLastMonthIncomeAmount.Location = new System.Drawing.Point(232, 87); this.lblLastMonthIncomeAmount.Name = "lblLastMonthIncomeAmount"; this.lblLastMonthIncomeAmount.Size = new System.Drawing.Size(18, 20); this.lblLastMonthIncomeAmount.TabIndex = 15; @@ -285,7 +295,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.lblThisMonthIncomeAmount.Anchor = System.Windows.Forms.AnchorStyles.Left; this.lblThisMonthIncomeAmount.AutoSize = true; this.lblThisMonthIncomeAmount.Font = new System.Drawing.Font("微软雅黑", 11F); - this.lblThisMonthIncomeAmount.Location = new System.Drawing.Point(861, 30); + this.lblThisMonthIncomeAmount.Location = new System.Drawing.Point(3, 87); this.lblThisMonthIncomeAmount.Name = "lblThisMonthIncomeAmount"; this.lblThisMonthIncomeAmount.Size = new System.Drawing.Size(18, 20); this.lblThisMonthIncomeAmount.TabIndex = 15; @@ -296,7 +306,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.lblYesterdayIncomeAmount.Anchor = System.Windows.Forms.AnchorStyles.Left; this.lblYesterdayIncomeAmount.AutoSize = true; this.lblYesterdayIncomeAmount.Font = new System.Drawing.Font("微软雅黑", 11F); - this.lblYesterdayIncomeAmount.Location = new System.Drawing.Point(575, 30); + this.lblYesterdayIncomeAmount.Location = new System.Drawing.Point(919, 30); this.lblYesterdayIncomeAmount.Name = "lblYesterdayIncomeAmount"; this.lblYesterdayIncomeAmount.Size = new System.Drawing.Size(18, 20); this.lblYesterdayIncomeAmount.TabIndex = 15; @@ -307,7 +317,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.lblSevenDaysSaleVolume.Anchor = System.Windows.Forms.AnchorStyles.Left; this.lblSevenDaysSaleVolume.AutoSize = true; this.lblSevenDaysSaleVolume.Font = new System.Drawing.Font("微软雅黑", 11F); - this.lblSevenDaysSaleVolume.Location = new System.Drawing.Point(289, 30); + this.lblSevenDaysSaleVolume.Location = new System.Drawing.Point(232, 30); this.lblSevenDaysSaleVolume.Name = "lblSevenDaysSaleVolume"; this.lblSevenDaysSaleVolume.Size = new System.Drawing.Size(18, 20); this.lblSevenDaysSaleVolume.TabIndex = 15; @@ -318,7 +328,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.label8.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label8.AutoSize = true; this.label8.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.label8.Location = new System.Drawing.Point(861, 60); + this.label8.Location = new System.Drawing.Point(919, 60); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(80, 17); this.label8.TabIndex = 13; @@ -329,7 +339,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.label7.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label7.AutoSize = true; this.label7.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.label7.Location = new System.Drawing.Point(575, 60); + this.label7.Location = new System.Drawing.Point(690, 60); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(92, 17); this.label7.TabIndex = 12; @@ -340,7 +350,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.label6.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label6.AutoSize = true; this.label6.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.label6.Location = new System.Drawing.Point(289, 60); + this.label6.Location = new System.Drawing.Point(461, 60); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(92, 17); this.label6.TabIndex = 11; @@ -351,7 +361,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.label5.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label5.AutoSize = true; this.label5.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.label5.Location = new System.Drawing.Point(3, 60); + this.label5.Location = new System.Drawing.Point(232, 60); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(104, 17); this.label5.TabIndex = 10; @@ -362,7 +372,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.label4.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label4.AutoSize = true; this.label4.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.label4.Location = new System.Drawing.Point(861, 3); + this.label4.Location = new System.Drawing.Point(3, 60); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(104, 17); this.label4.TabIndex = 9; @@ -373,7 +383,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.label3.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label3.AutoSize = true; this.label3.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.label3.Location = new System.Drawing.Point(575, 3); + this.label3.Location = new System.Drawing.Point(919, 3); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(104, 17); this.label3.TabIndex = 8; @@ -384,7 +394,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.label2.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label2.AutoSize = true; this.label2.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.label2.Location = new System.Drawing.Point(289, 3); + this.label2.Location = new System.Drawing.Point(232, 3); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(63, 17); this.label2.TabIndex = 7; @@ -499,17 +509,6 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.dgvShop.TabIndex = 5; this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick); // - // statusBar - // - this.statusBar.BackColor = System.Drawing.Color.White; - this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill; - this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.statusBar.Location = new System.Drawing.Point(0, 0); - this.statusBar.Margin = new System.Windows.Forms.Padding(0); - this.statusBar.Name = "statusBar"; - this.statusBar.Size = new System.Drawing.Size(1350, 26); - this.statusBar.TabIndex = 1; - // // colSelect // this.colSelect.FillWeight = 28F; @@ -672,6 +671,61 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.colWithdrawCashAmount.Name = "colWithdrawCashAmount"; this.colWithdrawCashAmount.ReadOnly = true; // + // statusBar + // + this.statusBar.BackColor = System.Drawing.Color.White; + this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill; + this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.statusBar.Location = new System.Drawing.Point(0, 0); + this.statusBar.Margin = new System.Windows.Forms.Padding(0); + this.statusBar.Name = "statusBar"; + this.statusBar.Size = new System.Drawing.Size(1350, 26); + this.statusBar.TabIndex = 1; + // + // lblTodayProfit + // + this.lblTodayProfit.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblTodayProfit.AutoSize = true; + this.lblTodayProfit.Font = new System.Drawing.Font("微软雅黑", 11F); + this.lblTodayProfit.Location = new System.Drawing.Point(461, 30); + this.lblTodayProfit.Name = "lblTodayProfit"; + this.lblTodayProfit.Size = new System.Drawing.Size(18, 20); + this.lblTodayProfit.TabIndex = 16; + this.lblTodayProfit.Text = "0"; + // + // label10 + // + this.label10.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label10.AutoSize = true; + this.label10.ForeColor = System.Drawing.SystemColors.ControlDarkDark; + this.label10.Location = new System.Drawing.Point(690, 3); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(63, 17); + this.label10.TabIndex = 13; + this.label10.Text = "近7日利润"; + // + // label9 + // + this.label9.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label9.AutoSize = true; + this.label9.ForeColor = System.Drawing.SystemColors.ControlDarkDark; + this.label9.Location = new System.Drawing.Point(461, 3); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(56, 17); + this.label9.TabIndex = 14; + this.label9.Text = "今日利润"; + // + // lblSevenDaysProfit + // + this.lblSevenDaysProfit.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblSevenDaysProfit.AutoSize = true; + this.lblSevenDaysProfit.Font = new System.Drawing.Font("微软雅黑", 11F); + this.lblSevenDaysProfit.Location = new System.Drawing.Point(690, 30); + this.lblSevenDaysProfit.Name = "lblSevenDaysProfit"; + this.lblSevenDaysProfit.Size = new System.Drawing.Size(18, 20); + this.lblSevenDaysProfit.TabIndex = 17; + this.lblSevenDaysProfit.Text = "0"; + // // ShopOrderStatisticsForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -751,5 +805,9 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics private System.Windows.Forms.DataGridViewTextBoxColumn colAvailableBalance; private System.Windows.Forms.DataGridViewTextBoxColumn colMallDepositLimitAmount; private System.Windows.Forms.DataGridViewTextBoxColumn colWithdrawCashAmount; + private System.Windows.Forms.Label lblTodayProfit; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label lblSevenDaysProfit; + private System.Windows.Forms.Label label9; } } \ No newline at end of file diff --git a/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsForm.cs b/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsForm.cs index 80e0df6..bf3824f 100644 --- a/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsForm.cs +++ b/TEMUKJD/KJDForms/ShopForms/Statistics/ShopOrderStatisticsForm.cs @@ -21,6 +21,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics { public partial class ShopOrderStatisticsForm : Form { + public static ShopOrderStatisticsForm OrderStatisticsInstance { get; set; } public List lstShopStatisticsInfo = new List(); public List lstSubOrderInfo = new List(); public bool IsOperate = false; @@ -29,6 +30,8 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics public ShopOrderStatisticsForm() { InitializeComponent(); + + OrderStatisticsInstance = this; } private void ShopOrderStatisticsForm_Load(object sender, EventArgs e) @@ -42,7 +45,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics RefreshShop(); } - private void RefreshShop() + public void RefreshShop() { this.pbLoading.Visible = true; // 店铺Id @@ -105,6 +108,8 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics { this.lblSaleVolume.Text = this.lstShopStatisticsInfo.Sum(s => s.saleVolume).ToString(); this.lblSevenDaysSaleVolume.Text = this.lstShopStatisticsInfo.Sum(s => s.sevenDaysSaleVolume).ToString(); + this.lblTodayProfit.Text = this.lstShopStatisticsInfo.Sum(s => s.todayProfit).ParseToDecimal().ToString("f2"); + this.lblSevenDaysProfit.Text = this.lstShopStatisticsInfo.Sum(s => s.sevenDaysProfit).ParseToDecimal().ToString("f2"); this.lblYesterdayIncomeAmount.Text = this.lstShopStatisticsInfo.Sum(s => s.yesterdayIncomeAmount).ToString(); this.lblThisMonthIncomeAmount.Text = this.lstShopStatisticsInfo.Sum(s => s.thisMonthIncomeAmount).ToString(); this.lblLastMonthIncomeAmount.Text = this.lstShopStatisticsInfo.Sum(s => s.lastMonthIncomeAmount).ToString(); @@ -416,46 +421,59 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics if (string.IsNullOrEmpty(rst)) { statistics.is_search_5 = true; + //计算成本和利润 + CountPrice(shop); + } + } + } - var orderInfoLstTmp = lstSubOrderInfo.Where(o => o.supplierId.ParseToString() == shop.ShopId); - statistics.todayProfit = 0; - statistics.sevenDaysProfit = 0; - statistics.thirtyDaysProfit = 0; - int num = 0; - int num7 = 0; - int num30 = 0; - foreach (var prodOrder in orderInfoLstTmp) - { - prodOrder.skuQuantityTotalInfo.goodsValue = 0; - prodOrder.skuQuantityTotalInfo.goodsCost = 0; - prodOrder.skuQuantityTotalInfo.todayProfit = 0; - prodOrder.skuQuantityTotalInfo.sevenDaysProfit = 0; - prodOrder.skuQuantityTotalInfo.thirtyDaysProfit = 0; - foreach (var sku in prodOrder.skuQuantityDetailList) - { - var discount = prodOrder.discount.ParseToInt() * 0.01m; - sku.goodsValue = sku.supplierPrice.ParseToInt() * (sku.inventoryNumInfo?.warehouseInventoryNum).ParseToInt(); - sku.goodsValue = (sku.goodsValue * 0.01m * discount).ParseToInt(); // sku货值 = 单价 * 数量 * 乘以折扣 - sku.goodsCost = sku.purchasePrice * (sku.inventoryNumInfo?.warehouseInventoryNum).ParseToInt(); - prodOrder.skuQuantityTotalInfo.goodsValue += sku.goodsValue; // 合计得到总货值 - prodOrder.skuQuantityTotalInfo.goodsCost += sku.goodsCost; + /// + /// 计算成本和利润 + /// + /// + /// + public void CountPrice(ShopLoginInfo shop) + { + var statistics = lstShopStatisticsInfo.FirstOrDefault(s => s.shop_id.ParseToString() == shop.ShopId); + if (statistics == null) + return; - sku.todayProfit = 0.01m * sku.todaySaleVolume.ParseToInt() * (sku.supplierPrice.ParseToInt() * discount - sku.purchasePrice); - prodOrder.skuQuantityTotalInfo.todayProfit += sku.todayProfit; - sku.sevenDaysProfit = 0.01m * sku.lastSevenDaysSaleVolume.ParseToInt() * (sku.supplierPrice.ParseToInt() * discount - sku.purchasePrice); - prodOrder.skuQuantityTotalInfo.sevenDaysProfit += sku.sevenDaysProfit; - sku.thirtyDaysProfit = 0.01m * sku.lastThirtyDaysSaleVolume.ParseToInt() * (sku.supplierPrice.ParseToInt() * discount - sku.purchasePrice); - prodOrder.skuQuantityTotalInfo.thirtyDaysProfit += sku.thirtyDaysProfit; + var orderInfoLstTmp = lstSubOrderInfo.Where(o => o.supplierId.ParseToString() == shop.ShopId); + statistics.todayProfit = 0; + statistics.sevenDaysProfit = 0; + statistics.thirtyDaysProfit = 0; + int num = 0; + int num7 = 0; + int num30 = 0; + foreach (var prodOrder in orderInfoLstTmp) + { + prodOrder.skuQuantityTotalInfo.goodsValue = 0; + prodOrder.skuQuantityTotalInfo.goodsCost = 0; + prodOrder.skuQuantityTotalInfo.todayProfit = 0; + prodOrder.skuQuantityTotalInfo.sevenDaysProfit = 0; + prodOrder.skuQuantityTotalInfo.thirtyDaysProfit = 0; + foreach (var sku in prodOrder.skuQuantityDetailList) + { + var discount = prodOrder.discount.ParseToInt() * 0.01m; + sku.goodsValue = sku.supplierPrice.ParseToInt() * (sku.inventoryNumInfo?.warehouseInventoryNum).ParseToInt(); + sku.goodsValue = (sku.goodsValue * discount).ParseToInt(); // sku货值 = 单价 * 数量 * 折扣 单位分 + sku.goodsCost = sku.purchasePrice * (sku.inventoryNumInfo?.warehouseInventoryNum).ParseToInt(); + prodOrder.skuQuantityTotalInfo.goodsValue += sku.goodsValue; // 合计得到总货值 + prodOrder.skuQuantityTotalInfo.goodsCost += sku.goodsCost; - num += sku.todaySaleVolume.ParseToInt(); - num7 += sku.lastSevenDaysSaleVolume.ParseToInt(); - num30 += sku.lastThirtyDaysSaleVolume.ParseToInt(); - statistics.todayProfit += sku.todayProfit; - statistics.sevenDaysProfit += sku.sevenDaysProfit; - statistics.thirtyDaysProfit += sku.lastThirtyDaysSaleVolume; - - } - } + sku.todayProfit = 0.01m * sku.todaySaleVolume.ParseToInt() * (sku.supplierPrice.ParseToInt() * discount - sku.purchasePrice); + prodOrder.skuQuantityTotalInfo.todayProfit += sku.todayProfit; + sku.sevenDaysProfit = 0.01m * sku.lastSevenDaysSaleVolume.ParseToInt() * (sku.supplierPrice.ParseToInt() * discount - sku.purchasePrice); + prodOrder.skuQuantityTotalInfo.sevenDaysProfit += sku.sevenDaysProfit; + sku.thirtyDaysProfit = 0.01m * sku.lastThirtyDaysSaleVolume.ParseToInt() * (sku.supplierPrice.ParseToInt() * discount - sku.purchasePrice); + prodOrder.skuQuantityTotalInfo.thirtyDaysProfit += sku.thirtyDaysProfit; + + num += sku.todaySaleVolume.ParseToInt(); + num7 += sku.lastSevenDaysSaleVolume.ParseToInt(); + num30 += sku.lastThirtyDaysSaleVolume.ParseToInt(); + statistics.todayProfit += sku.todayProfit; + statistics.sevenDaysProfit += sku.sevenDaysProfit; + statistics.thirtyDaysProfit += sku.lastThirtyDaysSaleVolume; } } } diff --git a/TEMUKJD/KJDForms/ShopForms/Statistics/ShopSetPurchasePriceForm.Designer.cs b/TEMUKJD/KJDForms/ShopForms/Statistics/ShopSetPurchasePriceForm.Designer.cs index 0641630..c05b9b1 100644 --- a/TEMUKJD/KJDForms/ShopForms/Statistics/ShopSetPurchasePriceForm.Designer.cs +++ b/TEMUKJD/KJDForms/ShopForms/Statistics/ShopSetPurchasePriceForm.Designer.cs @@ -37,7 +37,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.numDiscount = new System.Windows.Forms.NumericUpDown(); this.btnMultiChangePurchasePrice = new DevComponents.DotNetBar.PanelEx(); - this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); + this.numPurchasePrice = new System.Windows.Forms.NumericUpDown(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); @@ -56,12 +56,14 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.colSkuPurchasePrice = new DevComponents.DotNetBar.Controls.DataGridViewDoubleInputColumn(); this.colAvailableBalance = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.btnSave = new DevComponents.DotNetBar.PanelEx(); + this.label3 = new System.Windows.Forms.Label(); + this.txtNotes = new System.Windows.Forms.TextBox(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numDiscount)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numPurchasePrice)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); this.splitContainer2.Panel1.SuspendLayout(); this.splitContainer2.Panel2.SuspendLayout(); @@ -82,9 +84,11 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics // // splitContainer1.Panel1 // + this.splitContainer1.Panel1.Controls.Add(this.txtNotes); + this.splitContainer1.Panel1.Controls.Add(this.label3); this.splitContainer1.Panel1.Controls.Add(this.numDiscount); this.splitContainer1.Panel1.Controls.Add(this.btnMultiChangePurchasePrice); - this.splitContainer1.Panel1.Controls.Add(this.numericUpDown1); + this.splitContainer1.Panel1.Controls.Add(this.numPurchasePrice); this.splitContainer1.Panel1.Controls.Add(this.label1); this.splitContainer1.Panel1.Controls.Add(this.label2); // @@ -105,7 +109,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics 0, 0, 65536}); - this.numDiscount.Location = new System.Drawing.Point(70, 21); + this.numDiscount.Location = new System.Drawing.Point(68, 21); this.numDiscount.Maximum = new decimal(new int[] { 99999, 0, @@ -142,16 +146,16 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics // // numericUpDown1 // - this.numericUpDown1.DecimalPlaces = 2; - this.numericUpDown1.Location = new System.Drawing.Point(425, 21); - this.numericUpDown1.Maximum = new decimal(new int[] { + this.numPurchasePrice.DecimalPlaces = 2; + this.numPurchasePrice.Location = new System.Drawing.Point(425, 21); + this.numPurchasePrice.Maximum = new decimal(new int[] { 99999, 0, 0, 0}); - this.numericUpDown1.Name = "numericUpDown1"; - this.numericUpDown1.Size = new System.Drawing.Size(134, 23); - this.numericUpDown1.TabIndex = 0; + this.numPurchasePrice.Name = "numericUpDown1"; + this.numPurchasePrice.Size = new System.Drawing.Size(134, 23); + this.numPurchasePrice.TabIndex = 0; // // label1 // @@ -165,7 +169,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(15, 24); + this.label2.Location = new System.Drawing.Point(13, 24); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(56, 17); this.label2.TabIndex = 444; @@ -418,9 +422,26 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics this.btnSave.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); this.btnSave.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); this.btnSave.TabIndex = 435; + this.btnSave.TabStop = true; this.btnSave.Text = "保存"; this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(151, 24); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(32, 17); + this.label3.TabIndex = 447; + this.label3.Text = "备注"; + // + // textBox1 + // + this.txtNotes.Location = new System.Drawing.Point(183, 21); + this.txtNotes.Name = "textBox1"; + this.txtNotes.Size = new System.Drawing.Size(161, 23); + this.txtNotes.TabIndex = 448; + // // ShopSetPurchasePriceForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -439,7 +460,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.numDiscount)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numPurchasePrice)).EndInit(); this.splitContainer2.Panel1.ResumeLayout(false); this.splitContainer2.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); @@ -470,10 +491,12 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics private DevComponents.DotNetBar.Controls.DataGridViewDoubleInputColumn colSkuPurchasePrice; private System.Windows.Forms.DataGridViewTextBoxColumn colAvailableBalance; private DevComponents.DotNetBar.PanelEx btnMultiChangePurchasePrice; - private System.Windows.Forms.NumericUpDown numericUpDown1; + private System.Windows.Forms.NumericUpDown numPurchasePrice; private DevComponents.DotNetBar.PanelEx btnSave; private System.Windows.Forms.Label label1; private System.Windows.Forms.NumericUpDown numDiscount; private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox txtNotes; + private System.Windows.Forms.Label label3; } } \ No newline at end of file diff --git a/TEMUKJD/KJDForms/ShopForms/Statistics/ShopSetPurchasePriceForm.cs b/TEMUKJD/KJDForms/ShopForms/Statistics/ShopSetPurchasePriceForm.cs index adaa3fb..d1a5ee3 100644 --- a/TEMUKJD/KJDForms/ShopForms/Statistics/ShopSetPurchasePriceForm.cs +++ b/TEMUKJD/KJDForms/ShopForms/Statistics/ShopSetPurchasePriceForm.cs @@ -35,7 +35,8 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics return; this.numDiscount.Value = orderInfo.discount.ParseToDecimal() * 0.01m; - this.numericUpDown1.Value = (orderInfo.skuQuantityDetailList.FirstOrDefault()?.supplierPrice).ParseToDecimal() * 0.01m; + this.numPurchasePrice.Value = (orderInfo.skuQuantityDetailList.FirstOrDefault()?.supplierPrice).ParseToDecimal() * 0.01m; + this.txtNotes.Text = orderInfo.purchasePriceInfo?.notes; this.TitleText = ("进货价修改 - " + orderInfo.productName); foreach (var sku in this.orderInfo.skuQuantityDetailList) @@ -45,7 +46,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics orderInfo.productId, orderInfo.productSkcId, sku.productSkuId, - "", + sku.className, sku.supplierPrice * 0.01m, sku.purchasePrice * 0.01m, "" @@ -58,7 +59,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics { foreach(DataGridViewRow row in this.dgvOrder.Rows) { - row.Cells["colSkuPurchasePrice"].Value = this.numericUpDown1.Value; + row.Cells["colSkuPurchasePrice"].Value = this.numPurchasePrice.Value; } } @@ -67,6 +68,8 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics if (orderInfo == null) return; + txtNotes.Focus(); + TemuDBProductPurchasePriceInfo purchasePriceItem = new TemuDBProductPurchasePriceInfo() { add_time = DateTime.Now, @@ -75,7 +78,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics ext_code = orderInfo.skcExtCode, main_img = orderInfo.productSkcPicture, mdy_time = DateTime.Now, - notes = "", + notes = txtNotes.Text.Trim(), price_text = "", product_name = orderInfo.productName, skc_id = orderInfo.productSkcId.ParseToString(), @@ -132,7 +135,7 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics // html = GetHtml.PostUtf8(url, data); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) { - BaseMsgForm.ShowError("商品备注编辑失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg")); + BaseMsgForm.ShowError("商品进价信息编辑失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg")); } else {