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

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

@@ -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;