一些运行中卡死的问题优化修复

This commit is contained in:
wule committed 2025-07-07 09:16:45 +08:00
1 parent b48f320099
commit 2b21ecf62a
6 files changed
+143 -111

No files matched your search

+6 -6
View File
@@ -216,9 +216,9 @@ namespace AllBase.Model.Result
public string catName { get; set; }
public string productSkcId { get; set; }
public string productSkcPicture { get; set; }
public long supplierId { get; set; }
public long? supplierId { get; set; }
public string supplierName { get; set; }
public bool punishVmiUrgencyOrder { get; set; }
public bool? punishVmiUrgencyOrder { get; set; }
public string purchaseConfig { get; set; }
public List<purchaseConfigDetail> purchaseConfigDetailList { get; set; } = new List<purchaseConfigDetail>();
}
@@ -227,8 +227,8 @@ namespace AllBase.Model.Result
/// </summary>
public class purchaseConfigDetail
{
public bool isReducePricePass { get; set; }
public bool isVerifyPrice { get; set; }
public bool? isReducePricePass { get; set; }
public bool? isVerifyPrice { get; set; }
/// <summary>
/// 价格单位 CNY
/// </summary>
@@ -236,12 +236,12 @@ namespace AllBase.Model.Result
/// <summary>
/// sku价格 2800 分
/// </summary>
public int supplierPrice { get; set; }
public int? supplierPrice { get; set; }
/// <summary>
/// sku名称 12color gel pens
/// </summary>
public string className { get; set; }
public long productSkuId { get; set; }
public long? productSkuId { get; set; }
public int? exceptQuantity { get; set; }
public int? applyQuantity { get; set; }
public int? lastSevenDaysSaleVolume { get; set; }
@@ -561,6 +561,7 @@ namespace TemuKJD.KJDForms.ProductForms
this.colProductSkcPic.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom;
this.colProductSkcPic.Name = "colProductSkcPic";
this.colProductSkcPic.ReadOnly = true;
this.colProductSkcPic.Visible = false;
this.colProductSkcPic.Width = 60;
//
// colProductId
@@ -272,12 +272,16 @@ namespace TemuKJD.KJDForms.ProductForms
tryCount++;
goto tryAgain;
}
if (jsonStr.Contains("当前操作人数太多,请稍后重试"))
{
}
if (!jsonStr.Contains("\"success\":true"))
{
isError = true;
string sErr = BaseRegex.GetStringJson(ref jsonStr, "errorMsg");
if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr))
errMsg += sErr + " ";
page++;
continue;
}
@@ -300,8 +304,8 @@ namespace TemuKJD.KJDForms.ProductForms
{
lstPriceAdjustInfo.Add(pInfo);
string url = pInfo.image.Replace("https", "http");
var image = Image.FromStream(WebRequest.Create(url).GetResponse().GetResponseStream());
//string url = pInfo.image.Replace("https", "http");
//var image = Image.FromStream(WebRequest.Create(url).GetResponse().GetResponseStream());
Invoke(new Action(() =>
{
@@ -310,7 +314,7 @@ namespace TemuKJD.KJDForms.ProductForms
pInfo.supplierId,
shop.ShopAccount, // pInfo.supplierName, // 列表里取不到,这里取shop里的
pInfo.priceOrderSn,
image, // skc图片
null,//image, // skc图片
pInfo.productId,
pInfo.skcId,
pInfo.productName + "\r\n" + pInfo.skuSpecs, // 商品标题+sku名称
@@ -395,6 +399,18 @@ namespace TemuKJD.KJDForms.ProductForms
{
if (cancellationTokenSource != null)
cancellationTokenSource.Cancel();
Task.Run(() => {
for (int i = 0; i < 100; i++)
{
Thread.Sleep(100);
}
Invoke(new Action(() =>
{
ucGroupBoxEx2.Enabled = true;
ucGroupBoxEx4.Enabled = true;
}));
});
}
private void btnStartStockUp_Click(object sender, EventArgs e)
@@ -546,6 +562,8 @@ namespace TemuKJD.KJDForms.ProductForms
private void dgvStock_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex < 0 || e.ColumnIndex < 0)
return;
string columnName = dgvAdjust.Columns[e.ColumnIndex].Name;
var row = dgvAdjust.Rows[e.RowIndex];
switch (columnName)
+85 -84
View File
@@ -109,6 +109,10 @@ namespace TemuKJD.KJDForms.ProductForms
this.btnStopAdd = new DevComponents.DotNetBar.PanelEx();
this.chkLimited = new System.Windows.Forms.CheckBox();
this.dgvStock = new TemuKJD.UserComponent.DataGridViewEx();
this.splitContainer4 = new System.Windows.Forms.SplitContainer();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.panelEx1 = new DevComponents.DotNetBar.PanelEx();
this.btnClear = new DevComponents.DotNetBar.PanelEx();
this.colUpId = new System.Windows.Forms.DataGridViewLinkColumn();
this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -128,10 +132,6 @@ namespace TemuKJD.KJDForms.ProductForms
this.colWaitReceiveNum = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colNeedStockUp = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colMsg = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.splitContainer4 = new System.Windows.Forms.SplitContainer();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.panelEx1 = new DevComponents.DotNetBar.PanelEx();
this.btnClear = new DevComponents.DotNetBar.PanelEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -1234,6 +1234,86 @@ namespace TemuKJD.KJDForms.ProductForms
this.dgvStock.TabIndex = 187;
this.dgvStock.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvStock_CellContentClick);
//
// splitContainer4
//
this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer4.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer4.Location = new System.Drawing.Point(0, 0);
this.splitContainer4.Name = "splitContainer4";
//
// splitContainer4.Panel1
//
this.splitContainer4.Panel1.Controls.Add(this.statusBar);
//
// splitContainer4.Panel2
//
this.splitContainer4.Panel2.Controls.Add(this.panelEx1);
this.splitContainer4.Panel2.Controls.Add(this.btnClear);
this.splitContainer4.Size = new System.Drawing.Size(1148, 26);
this.splitContainer4.SplitterDistance = 870;
this.splitContainer4.TabIndex = 3;
//
// 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(870, 26);
this.statusBar.TabIndex = 2;
//
// panelEx1
//
this.panelEx1.CanvasColor = System.Drawing.SystemColors.Control;
this.panelEx1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.panelEx1.DisabledBackColor = System.Drawing.Color.Empty;
this.panelEx1.Location = new System.Drawing.Point(155, 0);
this.panelEx1.Name = "panelEx1";
this.panelEx1.Size = new System.Drawing.Size(115, 21);
this.panelEx1.Style.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx1.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.panelEx1.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.panelEx1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.panelEx1.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx1.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.panelEx1.Style.GradientAngle = 90;
this.panelEx1.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx1.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx1.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx1.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx1.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.panelEx1.TabIndex = 668;
this.panelEx1.Text = "停止当前操作";
this.panelEx1.Click += new System.EventHandler(this.btnStop_Click);
//
// btnClear
//
this.btnClear.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.btnClear.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnClear.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnClear.DisabledBackColor = System.Drawing.Color.Empty;
this.btnClear.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnClear.Location = new System.Drawing.Point(47, 0);
this.btnClear.Name = "btnClear";
this.btnClear.Size = new System.Drawing.Size(90, 21);
this.btnClear.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnClear.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClear.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClear.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnClear.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnClear.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnClear.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnClear.Style.GradientAngle = 90;
this.btnClear.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnClear.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnClear.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnClear.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.btnClear.TabIndex = 440;
this.btnClear.Text = "清空结果";
this.btnClear.Visible = false;
//
// colUpId
//
this.colUpId.HeaderText = "上家Id";
@@ -1290,6 +1370,7 @@ namespace TemuKJD.KJDForms.ProductForms
this.colProductSkcPic.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom;
this.colProductSkcPic.Name = "colProductSkcPic";
this.colProductSkcPic.ReadOnly = true;
this.colProductSkcPic.Visible = false;
this.colProductSkcPic.Width = 60;
//
// colProductId
@@ -1386,86 +1467,6 @@ namespace TemuKJD.KJDForms.ProductForms
this.colMsg.ReadOnly = true;
this.colMsg.Width = 400;
//
// splitContainer4
//
this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer4.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer4.Location = new System.Drawing.Point(0, 0);
this.splitContainer4.Name = "splitContainer4";
//
// splitContainer4.Panel1
//
this.splitContainer4.Panel1.Controls.Add(this.statusBar);
//
// splitContainer4.Panel2
//
this.splitContainer4.Panel2.Controls.Add(this.panelEx1);
this.splitContainer4.Panel2.Controls.Add(this.btnClear);
this.splitContainer4.Size = new System.Drawing.Size(1148, 26);
this.splitContainer4.SplitterDistance = 870;
this.splitContainer4.TabIndex = 3;
//
// 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(870, 26);
this.statusBar.TabIndex = 2;
//
// panelEx1
//
this.panelEx1.CanvasColor = System.Drawing.SystemColors.Control;
this.panelEx1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.panelEx1.DisabledBackColor = System.Drawing.Color.Empty;
this.panelEx1.Location = new System.Drawing.Point(155, 0);
this.panelEx1.Name = "panelEx1";
this.panelEx1.Size = new System.Drawing.Size(115, 21);
this.panelEx1.Style.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx1.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.panelEx1.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.panelEx1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.panelEx1.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx1.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.panelEx1.Style.GradientAngle = 90;
this.panelEx1.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx1.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx1.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx1.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx1.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.panelEx1.TabIndex = 668;
this.panelEx1.Text = "停止当前操作";
this.panelEx1.Click += new System.EventHandler(this.btnStop_Click);
//
// btnClear
//
this.btnClear.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.btnClear.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnClear.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnClear.DisabledBackColor = System.Drawing.Color.Empty;
this.btnClear.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnClear.Location = new System.Drawing.Point(47, 0);
this.btnClear.Name = "btnClear";
this.btnClear.Size = new System.Drawing.Size(90, 21);
this.btnClear.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnClear.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClear.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClear.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnClear.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnClear.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnClear.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnClear.Style.GradientAngle = 90;
this.btnClear.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnClear.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnClear.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnClear.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.btnClear.TabIndex = 440;
this.btnClear.Text = "清空结果";
this.btnClear.Visible = false;
//
// SaleStockUpForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -174,8 +174,6 @@ namespace TemuKJD.KJDForms.ProductForms
}
string searchText = txtStockid.Text.Trim();
btnSearch.Enabled = false;
chkHasCreate.Enabled = false;
ucGroupBoxEx2.Enabled = false;
ucGroupBoxEx3.Enabled = false;
ucGroupBoxEx4.Enabled = false;
@@ -280,8 +278,8 @@ namespace TemuKJD.KJDForms.ProductForms
{
lstStockInfo.Add(sInfo);
string url = sInfo.productSkcPicture.Replace("https", "http");
var image = Image.FromStream(WebRequest.Create(url).GetResponse().GetResponseStream());
//string url = sInfo.productSkcPicture.Replace("https", "http");
//var image = Image.FromStream(WebRequest.Create(url).GetResponse().GetResponseStream());
Invoke(new Action(() =>
{
@@ -292,7 +290,7 @@ namespace TemuKJD.KJDForms.ProductForms
sInfo.supplierName,
sInfo.subPurchaseOrderSn,
sInfo.originalPurchaseOrderSn,
image,
null,//image,
sInfo.productId,
sInfo.productSkcId,
sInfo.productName,
@@ -339,8 +337,6 @@ namespace TemuKJD.KJDForms.ProductForms
}
Invoke(new Action(() =>
{
btnSearch.Enabled = true;
chkHasCreate.Enabled = true;
ucGroupBoxEx2.Enabled = true;
ucGroupBoxEx3.Enabled = true;
ucGroupBoxEx4.Enabled = true;
@@ -474,10 +470,19 @@ namespace TemuKJD.KJDForms.ProductForms
{
if (cancellationTokenSource != null)
cancellationTokenSource.Cancel();
Invoke(new Action(() =>
{
ucGroupBoxEx2.Enabled = true;
ucGroupBoxEx3.Enabled = true;
ucGroupBoxEx4.Enabled = true;
}));
}
private void dgvStock_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex < 0 || e.ColumnIndex < 0)
return;
string columnName = dgvStock.Columns[e.ColumnIndex].Name;
var row = dgvStock.Rows[e.RowIndex];
switch (columnName)
@@ -598,7 +603,6 @@ namespace TemuKJD.KJDForms.ProductForms
}
Invoke(new Action(() =>
{
btnCancelSubPurchaseOrder.Enabled = true;
ucGroupBoxEx2.Enabled = true;
ucGroupBoxEx3.Enabled = true;
ucGroupBoxEx4.Enabled = true;
@@ -651,7 +655,6 @@ namespace TemuKJD.KJDForms.ProductForms
string searchText = txtStockid.Text.Trim();
btnListWarehouse.Enabled = false;
btnSearch.Enabled = false;
chkHasCreate.Enabled = false;
ucGroupBoxEx2.Enabled = false;
ucGroupBoxEx3.Enabled = false;
ucGroupBoxEx4.Enabled = false;
@@ -775,19 +778,29 @@ namespace TemuKJD.KJDForms.ProductForms
sInfo.needStockUp = false;
lstSubOrderInfo.Add(sInfo);
string url = sInfo.productSkcPicture.Replace("https", "http");
var image = Image.FromStream(WebRequest.Create(url).GetResponse().GetResponseStream());
//string url = sInfo.productSkcPicture.Replace("https", "http");
//// var stream = WebRequest.Create(url).GetResponse().GetResponseStream();
//Image image = null;
//using (Stream stream = WebRequest.Create(url).GetResponse().GetResponseStream())
//{
// try {
// image = Image.FromStream(stream);
// }
// catch (Exception ex)
// {
// }
//}
Invoke(new Action(() =>
{
int rowId = this.dgvStock.Rows.Add(
var rowId = this.dgvStock.Rows.Add(
"",
true,
sInfo.supplierId,
sInfo.supplierName,
"",//sInfo.subPurchaseOrderSn,
"",//sInfo.originalPurchaseOrderSn,
image,
null,//image,
sInfo.productId,
sInfo.productSkcId,
sInfo.productName,
@@ -801,8 +814,9 @@ namespace TemuKJD.KJDForms.ProductForms
sInfo.needStockUp == false ? "无需备货" : "可备货",
""
);
dgvStock.Rows[rowId].Height = 60;
if (rowId >= 0)
dgvStock.Rows[rowId].Height = 60;
//dgvStock.Rows.Cast[dgvStock.Rows].Height=60;
}));
}
}
@@ -836,9 +850,6 @@ namespace TemuKJD.KJDForms.ProductForms
}
Invoke(new Action(() =>
{
btnListWarehouse.Enabled = true;
btnSearch.Enabled = true;
chkHasCreate.Enabled = true;
ucGroupBoxEx2.Enabled = true;
ucGroupBoxEx3.Enabled = true;
ucGroupBoxEx4.Enabled = true;
@@ -762,6 +762,7 @@ namespace TemuKJD.KJDForms.ShopForms
string cook = shop.Cookies;
cook = BaseRegex.GetStringCookie(ref cook, "SUB_PASS_ID");
cook = "SUB_PASS_ID=" + cook;
cook = "document.cookie='" + cook + "';window.location.href='https://seller.kuajingmaihuo.com'";
Clipboard.SetDataObject(cook);
BaseMsgForm.ShowInfo("复制成功");
break;