订单金额统计利润计算功能

This commit is contained in:
wule committed 2025-09-02 19:03:37 +08:00
1 parent eca6a8a9e7
commit cc539ce604
27 files changed
+2090 -214

No files matched your search

@@ -39,6 +39,8 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProductThirdSelectListManageForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.btnStop = new DevComponents.DotNetBar.PanelEx();
this.btnExport = new DevComponents.DotNetBar.PanelEx();
this.btnDel = new DevComponents.DotNetBar.PanelEx();
this.pbFissionSetting = new System.Windows.Forms.PictureBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
@@ -141,6 +143,8 @@
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.btnStop);
this.splitContainer1.Panel1.Controls.Add(this.btnExport);
this.splitContainer1.Panel1.Controls.Add(this.btnDel);
this.splitContainer1.Panel1.Controls.Add(this.pbFissionSetting);
this.splitContainer1.Panel1.Controls.Add(this.tableLayoutPanel1);
@@ -155,6 +159,58 @@
this.splitContainer1.SplitterDistance = 70;
this.splitContainer1.TabIndex = 2;
//
// btnStop
//
this.btnStop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnStop.CanvasColor = System.Drawing.SystemColors.Control;
this.btnStop.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnStop.DisabledBackColor = System.Drawing.Color.Empty;
this.btnStop.Location = new System.Drawing.Point(1464, 39);
this.btnStop.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(90, 26);
this.btnStop.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnStop.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnStop.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnStop.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.btnStop.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnStop.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.btnStop.Style.GradientAngle = 90;
this.btnStop.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
this.btnStop.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnStop.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnStop.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnStop.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.btnStop.TabIndex = 511;
this.btnStop.Text = "停止上传";
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// btnExport
//
this.btnExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnExport.CanvasColor = System.Drawing.SystemColors.Control;
this.btnExport.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnExport.DisabledBackColor = System.Drawing.Color.Empty;
this.btnExport.Location = new System.Drawing.Point(1372, 39);
this.btnExport.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2);
this.btnExport.Name = "btnExport";
this.btnExport.Size = new System.Drawing.Size(90, 26);
this.btnExport.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnExport.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnExport.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnExport.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.btnExport.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnExport.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.btnExport.Style.GradientAngle = 90;
this.btnExport.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
this.btnExport.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnExport.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnExport.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnExport.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.btnExport.TabIndex = 498;
this.btnExport.Text = "导出数据表格";
this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
//
// btnDel
//
this.btnDel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -1081,11 +1137,13 @@
//
this.ucSplitPage1.CurrentPage = 1;
this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right;
this.ucSplitPage1.Location = new System.Drawing.Point(1196, 0);
this.ucSplitPage1.IsShowPageSize = true;
this.ucSplitPage1.Location = new System.Drawing.Point(1158, 0);
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
this.ucSplitPage1.Name = "ucSplitPage1";
this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
this.ucSplitPage1.Size = new System.Drawing.Size(362, 25);
this.ucSplitPage1.PageSize = 200;
this.ucSplitPage1.Size = new System.Drawing.Size(400, 25);
this.ucSplitPage1.TabIndex = 6;
this.ucSplitPage1.TotalPage = 1;
//
@@ -1211,5 +1269,7 @@
private System.Windows.Forms.DataGridViewLinkColumn colEditNotes;
private System.Windows.Forms.DataGridViewLinkColumn ColDelete;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
private DevComponents.DotNetBar.PanelEx btnExport;
private DevComponents.DotNetBar.PanelEx btnStop;
}
}
@@ -33,6 +33,8 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
/// </summary>
public partial class ProductThirdSelectListManageForm : LRBaseForm
{
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
List<TemuDBProductSelect> lstAdminTemuDBProductSelect = new List<TemuDBProductSelect>();
List<ShopLoginInfo> shopLst = new List<ShopLoginInfo>();
@@ -59,6 +61,8 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
chkUploadProd.Visible = true;
flowLayoutPanel1.Visible = true;
ucSplitPage1.IsShowPageSize = false; // 可调整分页
if (BaseClass.SaLevel == 1)
{
dgvSelectProduct.Columns["colSubSaNick"].Visible = true;
@@ -67,6 +71,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
chkNoSubSa.Visible = true;
pbFissionSetting.Visible = true;
btnReFission.Visible = true;
ucSplitPage1.IsShowPageSize = true; // 可调整分页
}
}
@@ -115,7 +120,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
Task.Run(() =>
{
int pageCount;
var list = GetSelectProductList(out pageCount, page, 200);
var list = GetSelectProductList(out pageCount, page, ucSplitPage1.PageSize);
lstAdminTemuDBProductSelect.AddRange(list);
this.ucSplitPage1.TotalPage = pageCount;
@@ -327,6 +332,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
DbProductSelectEditNotesForm editForm = new DbProductSelectEditNotesForm(dbSelectProduct, SetProductSelectNotesType.ThirdProduct);
editForm.ShowDialog();
dgvSelectProduct.Rows[e.RowIndex].Cells["colNotes"].Value = dbSelectProduct.notes;
dgvSelectProduct.Rows[e.RowIndex].Cells["colUserNotes"].Value = dbSelectProduct.user_notes;
break;
case "Skc图片":
ShowImgForm imgFrom = new ShowImgForm(dgvSelectProduct.Rows[e.RowIndex].Cells["colImgUrl"].Value.ParseToString());
@@ -520,6 +526,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
if (prodList.Count() > 0)
{
this.btnAdd.Enabled = false;
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
AddProductDraft(prodList);
@@ -527,7 +534,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
{
this.btnAdd.Enabled = true;
}));
});
}, cancellationTokenSource.Token);
}
else
{
@@ -555,6 +562,9 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
foreach (var prod in prodSelect)
{
if (cancellationTokenSource.IsCancellationRequested)
break;
Invoke(new Action(() =>
{
this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1);
@@ -724,13 +734,19 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
Invoke(new Action(() =>
{
BaseMsgForm.ShowInfo("上传" + (this.chkUploadProd.Checked ? "" : "草稿") + "完成!");
if (cancellationTokenSource.IsCancellationRequested)
BaseMsgForm.ShowInfo("上传" + (this.chkUploadProd.Checked ? "" : "草稿") + "停止!");
else
BaseMsgForm.ShowInfo("上传" + (this.chkUploadProd.Checked ? "" : "草稿") + "完成!");
}));
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
this.statusBar.lblTaskStatus.Text = "上传" + (this.chkUploadProd.Checked ? "" : "草稿") + "完成";
if (cancellationTokenSource.IsCancellationRequested)
this.statusBar.lblTaskStatus.Text = "上传" + (this.chkUploadProd.Checked ? "" : "草稿") + "停止";
else
this.statusBar.lblTaskStatus.Text = "上传" + (this.chkUploadProd.Checked ? "" : "草稿") + "完成";
this.statusBar.UpdateProgressBar(prodSelect.Length);
}));
}
@@ -1164,6 +1180,13 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
skuEnd.Add("");
foreach (var skuInfo in skcInfo.productSkuList)
{
if (cancellationTokenSource.IsCancellationRequested)
{
return "{\"success\":false,\"status\":\"未上传\"," +
"\"productDraftId\":\"" + prodParam.productDraftId.ParseToString() + "\"," +
"\"errMsg\":\"上传停止\"}";
}
//var speck = skuInfo.productSkuSpecList.FirstOrDefault(s => s.parentSpecName == "颜色");
var speck = skuInfo.productSkuSpecList.FirstOrDefault();
if (speck != null)
@@ -1319,8 +1342,15 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
prodParam.productSkcReqs.Add(skcItem);
}
string sizeError = "";
if (cancellationTokenSource.IsCancellationRequested)
{
return "{\"success\":false,\"status\":\"未上传\"," +
"\"productDraftId\":\"" + prodParam.productDraftId.ParseToString() + "\"," +
"\"errMsg\":\"上传停止\"}";
}
//上传尺码表(如果有)
string sizeError = "";
if (!string.IsNullOrEmpty(sTemuSizeSpec))
{
sTemuSizeSpec = GetHtml.UrlDecode(sTemuSizeSpec);
@@ -1350,6 +1380,13 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
}
}
if (cancellationTokenSource.IsCancellationRequested)
{
return "{\"success\":false,\"status\":\"未上传\"," +
"\"productDraftId\":\"" + prodParam.productDraftId.ParseToString() + "\"," +
"\"errMsg\":\"上传停止\"}";
}
if (cell != null)
{
Invoke(new Action(() =>
@@ -1360,8 +1397,11 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
html = SaveDraft(shop, prodParam.productDraftId.ToString(), prodParam);
if (html.Contains("\"success\":true"))
{
if (!chkUploadProd.Checked)
if (!chkUploadProd.Checked /*|| cancellationTokenSource.IsCancellationRequested*/)
{
//string sCancel = "";
//if (cancellationTokenSource.IsCancellationRequested)
// sCancel = "上传停止";
return "{\"success\":true,\"status\":\"草稿箱\"," +
"\"productDraftId\":\"" + prodParam.productDraftId.ParseToString() + "\"," +
"\"errMsg\":\"" + sizeError + "\"}";
@@ -1737,5 +1777,24 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
SearchDbProdSelect(this.ucSplitPage1.CurrentPage);
});
}
private void btnExport_Click(object sender, EventArgs e)
{
SaveFileDialog dialog = new SaveFileDialog();
dialog.Title = "Save file as...";
dialog.Filter = "Excel files (*.csv)|*.csv|All files (*.*)|*.*";
dialog.RestoreDirectory = true;
dialog.FileName = "库存上传:" + DateTime.Now.ToString("yyyy-MM-dd HH-mm") + ".csv";
if (dialog.ShowDialog() != DialogResult.OK)
return;
OutExcel.SaveFile(dialog.FileName, dgvSelectProduct);
}
private void btnStop_Click(object sender, EventArgs e)
{
if (cancellationTokenSource != null)
cancellationTokenSource.Cancel();
}
}
}