优化加入jit操作中的卡顿问题

This commit is contained in:
wule committed 2025-11-20 09:42:23 +08:00
1 parent d0ee274e2f
commit b23eb0e497
10 files changed
+1552 -547

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@ namespace AllBase
/// <summary> /// <summary>
/// 版本ID /// 版本ID
/// </summary> /// </summary>
public static int VersionCount = 678; public static int VersionCount = 683;
//public static int VersionCount = 613; //public static int VersionCount = 613;
/// <summary> /// <summary>
@@ -24,6 +24,8 @@ namespace TemuKJD.KJDForms.ProductForms
/// </summary> /// </summary>
public partial class ProductChangePriceForm : LRBaseForm public partial class ProductChangePriceForm : LRBaseForm
{ {
public bool IsAuto = false;
decimal wantPrice;
string skcId = ""; string skcId = "";
string productId = ""; string productId = "";
string productName = ""; string productName = "";
@@ -31,7 +33,8 @@ namespace TemuKJD.KJDForms.ProductForms
TemuListProductInfo productInfo = null; TemuListProductInfo productInfo = null;
WarehouseProductSubOrderInfo wareHouseOrderInfo = null; WarehouseProductSubOrderInfo wareHouseOrderInfo = null;
Dictionary<string, int> dicAdjustReason = new Dictionary<string, int>(); Dictionary<string, int> dicAdjustReason = new Dictionary<string, int>();
public bool IsAdjustPrice = false; public string ErrMsg = "";
public bool IsAdjustPrice = false; // 是否调价成功
public ProductChangePriceForm(ShopLoginInfo _shop, WarehouseProductSubOrderInfo _wareHouseOrderInfo) public ProductChangePriceForm(ShopLoginInfo _shop, WarehouseProductSubOrderInfo _wareHouseOrderInfo)
{ {
@@ -44,7 +47,7 @@ namespace TemuKJD.KJDForms.ProductForms
} }
//TemuListProductInfo //TemuListProductInfo
public ProductChangePriceForm(ShopLoginInfo _shop, TemuListProductInfo _prod) public ProductChangePriceForm(ShopLoginInfo _shop, TemuListProductInfo _prod, decimal _wantPrice = 0)
{ {
InitializeComponent(); InitializeComponent();
shop = _shop; shop = _shop;
@@ -52,6 +55,7 @@ namespace TemuKJD.KJDForms.ProductForms
skcId = productInfo?.productSkcId.ParseToString(); skcId = productInfo?.productSkcId.ParseToString();
productId = productInfo?.productId.ParseToString(); productId = productInfo?.productId.ParseToString();
productName = productInfo?.productName.ParseToString(); productName = productInfo?.productName.ParseToString();
wantPrice = _wantPrice;
} }
private void ProductChangePriceForm_Load(object sender, EventArgs e) private void ProductChangePriceForm_Load(object sender, EventArgs e)
@@ -88,6 +92,10 @@ namespace TemuKJD.KJDForms.ProductForms
{ {
pbLoading.Visible = false; pbLoading.Visible = false;
})); }));
if (IsAuto)
{
SaveNewPrice();
}
}); });
} }
@@ -95,6 +103,9 @@ namespace TemuKJD.KJDForms.ProductForms
{ {
if (shop == null || productId.IsNullOrEmpty() || skcId.IsNullOrEmpty() || productName.IsNullOrEmpty()) if (shop == null || productId.IsNullOrEmpty() || skcId.IsNullOrEmpty() || productName.IsNullOrEmpty())
{ {
if (IsAuto)
ErrMsg = "店铺商品信息为空!";
else
BaseMsgForm.ShowError("店铺商品信息为空!"); BaseMsgForm.ShowError("店铺商品信息为空!");
return; return;
} }
@@ -102,12 +113,18 @@ namespace TemuKJD.KJDForms.ProductForms
#region 检测登录 #region 检测登录
if (shop.LoginStatus2 != "国际版在线") if (shop.LoginStatus2 != "国际版在线")
{ {
if (IsAuto)
ErrMsg = "店铺未登录!";
else
BaseMsgForm.ShowError("店铺未登录!"); BaseMsgForm.ShowError("店铺未登录!");
return; return;
} }
ShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); ShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
if (shop.LoginStatus2 != "国际版在线") if (shop.LoginStatus2 != "国际版在线")
{ {
if (IsAuto)
ErrMsg = "店铺未登录!";
else
BaseMsgForm.ShowError("店铺未登录!"); BaseMsgForm.ShowError("店铺未登录!");
return; return;
} }
@@ -129,6 +146,9 @@ namespace TemuKJD.KJDForms.ProductForms
if (string.IsNullOrEmpty(sErr)) if (string.IsNullOrEmpty(sErr))
sErr = adjustRst; sErr = adjustRst;
if (IsAuto)
ErrMsg = "查询失败:" + sErr;
else
BaseMsgForm.ShowError("查询失败:" + sErr); BaseMsgForm.ShowError("查询失败:" + sErr);
return; return;
} }
@@ -142,6 +162,7 @@ namespace TemuKJD.KJDForms.ProductForms
foreach (var item in adjustPriceInfo.spuAdjustResult[productId].skcItems[0].items) foreach (var item in adjustPriceInfo.spuAdjustResult[productId].skcItems[0].items)
{ {
int mainRowId = -1; int mainRowId = -1;
// 修改日常价格
Invoke(new Action(() => Invoke(new Action(() =>
{ {
mainRowId = this.dgvOrder.Rows.Add( mainRowId = this.dgvOrder.Rows.Add(
@@ -153,7 +174,7 @@ namespace TemuKJD.KJDForms.ProductForms
"", "",
"日常价格", //申报价格类型 "日常价格", //申报价格类型
item.originSupplyPrice.ParseToDecimal() / 100m, //原申报价格 item.originSupplyPrice.ParseToDecimal() / 100m, //原申报价格
"", //调整后的申报价格 wantPrice == 0 ? "" : wantPrice.ToString("0.00"), //调整后的申报价格
"调价成功之后生成的交易订单", "调价成功之后生成的交易订单",
"" ""
); );
@@ -161,13 +182,14 @@ namespace TemuKJD.KJDForms.ProductForms
})); }));
if (item?.marketingActivityPriceDTOList == null) if (item?.marketingActivityPriceDTOList == null)
continue; continue;
// 修改活动价格
foreach (var activityPriceDTO in item.marketingActivityPriceDTOList) foreach (var activityPriceDTO in item.marketingActivityPriceDTOList)
{ {
int rowId = -1; int rowId = -1;
Invoke(new Action(() => Invoke(new Action(() =>
{ {
rowId = this.dgvOrder.Rows.Add( rowId = this.dgvOrder.Rows.Add(
true, IsAuto ? false : true,
productId, productId,
skcId, skcId,
item.productSkuId, item.productSkuId,
@@ -285,9 +307,22 @@ namespace TemuKJD.KJDForms.ProductForms
} }
} }
private async void btnSave_Click(object sender, EventArgs e) public async void btnSave_Click(object sender, EventArgs e)
{ {
txtReason.Focus(); txtReason.Focus();
await Task.Run(() =>
{
Thread.Sleep(10);
});
Task.Run(() =>
{
SaveNewPrice();
});
}
public void SaveNewPrice()
{
if (shop == null || productId.IsNullOrEmpty() || skcId.IsNullOrEmpty() || productName.IsNullOrEmpty()) if (shop == null || productId.IsNullOrEmpty() || skcId.IsNullOrEmpty() || productName.IsNullOrEmpty())
{ {
BaseMsgForm.ShowError("店铺商品信息为空!"); BaseMsgForm.ShowError("店铺商品信息为空!");
@@ -310,11 +345,17 @@ namespace TemuKJD.KJDForms.ProductForms
} }
} }
Invoke(new Action(() =>
{
pbLoading.Visible = true; pbLoading.Visible = true;
}));
#region 检测登录 #region 检测登录
if (shop.LoginStatus2 != "国际版在线") if (shop.LoginStatus2 != "国际版在线")
{ {
if (IsAuto)
ErrMsg = "店铺未登录!";
else
BaseMsgForm.ShowError("店铺未登录!"); BaseMsgForm.ShowError("店铺未登录!");
pbLoading.Visible = false; pbLoading.Visible = false;
return; return;
@@ -322,17 +363,18 @@ namespace TemuKJD.KJDForms.ProductForms
ShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); ShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
if (shop.LoginStatus2 != "国际版在线") if (shop.LoginStatus2 != "国际版在线")
{ {
if (IsAuto)
ErrMsg = "店铺未登录!";
else
BaseMsgForm.ShowError("店铺未登录!"); BaseMsgForm.ShowError("店铺未登录!");
pbLoading.Visible = false; pbLoading.Visible = false;
return; return;
} }
#endregion #endregion
await Task.Run(() =>
{
Thread.Sleep(200);
});
AdjustParam param = new AdjustParam(); AdjustParam param = new AdjustParam();
Invoke(new Action(() =>
{
if (dicAdjustReason.Keys.Contains(cmbChangePriceReason.Text)) if (dicAdjustReason.Keys.Contains(cmbChangePriceReason.Text))
param.adjustReason = dicAdjustReason[cmbChangePriceReason.Text]; param.adjustReason = dicAdjustReason[cmbChangePriceReason.Text];
if (!string.IsNullOrWhiteSpace(txtReason.Text)) if (!string.IsNullOrWhiteSpace(txtReason.Text))
@@ -366,6 +408,7 @@ namespace TemuKJD.KJDForms.ProductForms
adjItem.activityInvitationId = null; adjItem.activityInvitationId = null;
} }
} }
}));
int tryCount = 0; int tryCount = 0;
tryAgain: tryAgain:
@@ -385,14 +428,21 @@ namespace TemuKJD.KJDForms.ProductForms
sErr = adjustBatchRst; sErr = adjustBatchRst;
sErr = sErr.Replace("\\n", "\n").Replace("\n", "\r\n").Replace("\r\r", "\r"); sErr = sErr.Replace("\\n", "\n").Replace("\n", "\r\n").Replace("\r\r", "\r");
if (IsAuto)
ErrMsg = "调价失败:" + sErr;
else
BaseMsgForm.ShowError("调价失败:" + sErr); BaseMsgForm.ShowError("调价失败:" + sErr);
Invoke(new Action(() =>
{
pbLoading.Visible = false; pbLoading.Visible = false;
}));
return; return;
} }
IsAdjustPrice = true;
// 更新统计列表的数据价格 // 更新统计列表的数据价格
foreach (DataGridViewRow row in dgvOrder.Rows) foreach (DataGridViewRow row in dgvOrder.Rows)
{
Invoke(new Action(() =>
{ {
if (row.Cells["colSelect"].Value.ParseToBool() == true) if (row.Cells["colSelect"].Value.ParseToBool() == true)
{ {
@@ -417,17 +467,28 @@ namespace TemuKJD.KJDForms.ProductForms
if (productInfo != null) if (productInfo != null)
{ {
var sku = productInfo.productSkuSummaries.FirstOrDefault(s => s.productSkuId.ParseToLong() == adjItem.skuId); var sku = productInfo.productSkuSummaries.FirstOrDefault(s => s.productSkuId.ParseToLong() == adjItem.skuId);
if (sku!= null) if (sku != null)
{ {
sku.supplierPrice = adjItem.targetSupplyPrice; sku.supplierPrice = adjItem.targetSupplyPrice;
} }
} }
} }
} }
}));
} }
BaseMsgForm.ShowInfo("调价成功!"); Invoke(new Action(() =>
{
pbLoading.Visible = false; pbLoading.Visible = false;
}));
IsAdjustPrice = true;
if (!IsAuto)
{
BaseMsgForm.ShowInfo("调价成功!");
Invoke(new Action(() =>
{
this.Close(); this.Close();
}));
}
} }
} }
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -117,6 +117,12 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="colSelectExtCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colFilterExtCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSelect.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="colSelect.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
@@ -17,15 +17,19 @@ namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms
{ {
public partial class ChangeStockForm : LRBaseForm public partial class ChangeStockForm : LRBaseForm
{ {
public bool IsSuccess = false; public bool IsEditSuccess = false;
public bool IsAuto = false;
public string ErrMsg = "";
public changeStockParam stockParam; public changeStockParam stockParam;
ShopLoginInfo shop; ShopLoginInfo shop;
TemuListProductInfo product; TemuListProductInfo product;
public ChangeStockForm(ShopLoginInfo _shop, TemuListProductInfo _product) int wantStock;
public ChangeStockForm(ShopLoginInfo _shop, TemuListProductInfo _product, int _wantStock = 0)
{ {
InitializeComponent(); InitializeComponent();
shop = _shop; shop = _shop;
product = _product; product = _product;
wantStock = _wantStock;
} }
private void btnBatchFill_Click(object sender, EventArgs e) private void btnBatchFill_Click(object sender, EventArgs e)
@@ -57,12 +61,42 @@ namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms
edit.txtStockNow.Text = sku.virtualStock == null ? "-" : sku.virtualStock.ParseToString(); edit.txtStockNow.Text = sku.virtualStock == null ? "-" : sku.virtualStock.ParseToString();
edit.lblStockAfterChange.Text = ""; edit.lblStockAfterChange.Text = "";
edit.Tag = sku; edit.Tag = sku;
if (wantStock > 0)
{
if (sku.virtualStock.ParseToInt() > wantStock)
{
edit.cmbIsAddOrReduce.Text = "减少";
edit.txtAddOrReduceNum.Text = "" + (sku.virtualStock.ParseToInt() - wantStock);
}
else if (sku.virtualStock.ParseToInt() < wantStock)
{
edit.cmbIsAddOrReduce.Text = "增加";
edit.txtAddOrReduceNum.Text = "" + (wantStock - sku.virtualStock.ParseToInt());
}
}
this.flowLayoutPanel1.Controls.Add(edit); this.flowLayoutPanel1.Controls.Add(edit);
} }
} }
if (IsAuto)
{
Task.Run(() =>
{
SaveStock();
});
}
} }
private void btnSave_Click(object sender, EventArgs e) public void btnSave_Click(object sender, EventArgs e)
{
Task.Run(() =>
{
SaveStock();
});
}
void SaveStock()
{ {
stockParam = new changeStockParam(); stockParam = new changeStockParam();
stockParam.productId = this.product.productId; stockParam.productId = this.product.productId;
@@ -73,6 +107,8 @@ namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms
stockChangeDtoParam.productSkcId = this.product.productSkcId; stockChangeDtoParam.productSkcId = this.product.productSkcId;
stockChangeDtoParam.stockUpdateSource = 1; stockChangeDtoParam.stockUpdateSource = 1;
stockChangeDtoParam.skuVirtualStockChangeList = new List<skuVirtualStockChange>(); stockChangeDtoParam.skuVirtualStockChangeList = new List<skuVirtualStockChange>();
Invoke(new Action(() =>
{
foreach (var control in flowLayoutPanel1.Controls) foreach (var control in flowLayoutPanel1.Controls)
{ {
var edit = control as UcStockEdit; var edit = control as UcStockEdit;
@@ -96,12 +132,23 @@ namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms
if (change.virtualStockDiff != 0) if (change.virtualStockDiff != 0)
stockChangeDtoParam.skuVirtualStockChangeList.Add(change); stockChangeDtoParam.skuVirtualStockChangeList.Add(change);
} }
}));
if (stockChangeDtoParam.skuVirtualStockChangeList.Count == 0) if (stockChangeDtoParam.skuVirtualStockChangeList.Count == 0)
{ {
if (IsAuto)
IsEditSuccess = true;
else
BaseMsgForm.ShowError("请至少改动一项价格!"); BaseMsgForm.ShowError("请至少改动一项价格!");
return; return;
} }
var rst = EditStock(shop, stockParam); var rst = EditStock(shop, stockParam);
for (int i = 0; i < 5 && rst.Contains("修改库存失败:请勿频繁提交"); i++)
{
rst = EditStock(shop, stockParam);
System.Threading.Thread.Sleep(Randomx.GetId(3000, 5000));
}
//{"result":null,"success":true,"errorCode":1000000,"errorMsg":null} // 修改失败
//{"result":null,"success":true,"errorCode":1000000,"errorMsg":null} // 修改成功
if (!rst.Contains("\"success\":true")) if (!rst.Contains("\"success\":true"))
{ {
var msg = BaseRegex.GetStringJson(ref rst, "errorMsg").ParseToString(); var msg = BaseRegex.GetStringJson(ref rst, "errorMsg").ParseToString();
@@ -109,18 +156,21 @@ namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms
msg = BaseRegex.GetStringJson(ref rst, "error_msg").ParseToString(); msg = BaseRegex.GetStringJson(ref rst, "error_msg").ParseToString();
if (string.IsNullOrEmpty(msg)) if (string.IsNullOrEmpty(msg))
msg = rst; msg = rst;
if (IsAuto)
this.ErrMsg = "修改库存失败:" + msg;
else
BaseMsgForm.ShowError("修改库存失败:" + msg); BaseMsgForm.ShowError("修改库存失败:" + msg);
return;
} }
else else
{ {
IsSuccess = true; IsEditSuccess = true;
if (!IsAuto)
{
BaseMsgForm.ShowInfo("修改库存成功!"); BaseMsgForm.ShowInfo("修改库存成功!");
this.Close(); this.Close();
} }
} }
}
private string EditStock(ShopLoginInfo shop, changeStockParam stockParam) private string EditStock(ShopLoginInfo shop, changeStockParam stockParam)
{ {
@@ -161,8 +161,8 @@ namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "ComplianceForm"; this.Name = "ComplianceForm";
this.Text = "ComplianceForm"; this.Text = "合规信息";
this.TitleText = "ComplianceForm"; this.TitleText = "合规信息";
this.Load += new System.EventHandler(this.ComplianceForm_Load); this.Load += new System.EventHandler(this.ComplianceForm_Load);
this.Controls.SetChildIndex(this.panel2, 0); this.Controls.SetChildIndex(this.panel2, 0);
this.panel2.ResumeLayout(false); this.panel2.ResumeLayout(false);
@@ -16,11 +16,17 @@ using TemuKJD.BLL;
namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms
{ {
/// <summary>
/// 修改合规信息
/// </summary>
public partial class ComplianceForm : LRBaseForm public partial class ComplianceForm : LRBaseForm
{ {
/// <summary>
/// 批量自动操作,不弹框
/// </summary>
public bool IsAuto = false; public bool IsAuto = false;
public string ErrMsg = ""; public string ErrMsg = "";
public bool EditSuccess = false; public bool IsEditComplianceSuccess = false;
public ShopLoginInfo shop; public ShopLoginInfo shop;
public complianceInfo complianceInfo; public complianceInfo complianceInfo;
public complianceDetailInfo complianceDetailInfo; public complianceDetailInfo complianceDetailInfo;
@@ -37,7 +43,22 @@ namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms
private void ComplianceForm_Load(object sender, EventArgs e) private void ComplianceForm_Load(object sender, EventArgs e)
{ {
if (shop != null && complianceInfo != null) if (shop != null && complianceInfo != null)
{
this.Enabled = false;
Task.Run(() =>
{
this.GetComplianceInfo(); this.GetComplianceInfo();
Invoke(new Action(() =>
{
this.Enabled = true;
if (IsAuto)
{
this.btnSave_Click(null, null);
}
}));
});
}
} }
void GetComplianceInfo() void GetComplianceInfo()
@@ -70,6 +91,8 @@ namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms
JObject jObj = JObject.Parse(compDetailTemplateRst); JObject jObj = JObject.Parse(compDetailTemplateRst);
lstComplianceDetailTemplateInfo = JsonHelper.DeserializeJsonToList<complianceDetailTemplateInfo>(jObj["result"]["template_list"].ToString()); lstComplianceDetailTemplateInfo = JsonHelper.DeserializeJsonToList<complianceDetailTemplateInfo>(jObj["result"]["template_list"].ToString());
Invoke(new Action(() =>
{
this.cmbLaw65.Text = "无需警示"; this.cmbLaw65.Text = "无需警示";
var complianceDetailTemp = lstComplianceDetailTemplateInfo.FirstOrDefault(t => t.task_type == 4); var complianceDetailTemp = lstComplianceDetailTemplateInfo.FirstOrDefault(t => t.task_type == 4);
if (complianceDetailTemp != null && complianceDetailTemp.template_property_dtolist != null && complianceDetailTemp.template_property_dtolist.Count > 0) if (complianceDetailTemp != null && complianceDetailTemp.template_property_dtolist != null && complianceDetailTemp.template_property_dtolist.Count > 0)
@@ -79,15 +102,15 @@ namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms
this.cmbLaw65.Items.Add(item.lang_prompt_map["zh-Hans"]); this.cmbLaw65.Items.Add(item.lang_prompt_map["zh-Hans"]);
} }
} }
}));
} }
catch (Exception ex) catch (Exception ex)
{ {
if (IsAuto) if (IsAuto)
{
ErrMsg = ex.Message; ErrMsg = ex.Message;
Close(); else
}
BaseMsgForm.ShowError(ex.Message); BaseMsgForm.ShowError(ex.Message);
return;
} }
} }
@@ -100,44 +123,47 @@ namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms
JObject jObj = JObject.Parse(compDetailRst); JObject jObj = JObject.Parse(compDetailRst);
complianceDetailInfo = JsonHelper.DeserializeJsonToObject<complianceDetailInfo>(jObj["result"].ToString()); complianceDetailInfo = JsonHelper.DeserializeJsonToObject<complianceDetailInfo>(jObj["result"].ToString());
// 欧盟负责人 Invoke(new Action(() =>
cmbEUPerson.Text = complianceDetailInfo.template_list.FirstOrDefault(t => t.task_type == 25)?.rep_detail_list.FirstOrDefault()?.rep_name;
if (complianceDetailInfo.template_list.FirstOrDefault(t => t.task_type == 25)?.rep_detail_list != null)
{ {
foreach (var item in complianceDetailInfo.template_list.FirstOrDefault(t => t.task_type == 25)?.rep_detail_list) // 欧盟负责人
cmbEUPerson.Text = complianceDetailInfo?.template_list?.FirstOrDefault(t => t.task_type == 25)?.rep_detail_list.FirstOrDefault()?.rep_name;
if (complianceDetailInfo?.template_list?.FirstOrDefault(t => t.task_type == 25)?.rep_detail_list != null)
{
foreach (var item in complianceDetailInfo?.template_list?.FirstOrDefault(t => t.task_type == 25)?.rep_detail_list)
{ {
cmbEUPerson.Items.Add(item.rep_name); cmbEUPerson.Items.Add(item.rep_name);
} }
} }
// 制造商信息 // 制造商信息
cmbMakerInfo.Text = complianceDetailInfo.template_list.FirstOrDefault(t => t.task_type == 60)?.rep_detail_list.FirstOrDefault()?.rep_name; cmbMakerInfo.Text = complianceDetailInfo?.template_list?.FirstOrDefault(t => t.task_type == 60)?.rep_detail_list.FirstOrDefault()?.rep_name;
if (complianceDetailInfo.template_list.FirstOrDefault(t => t.task_type == 60)?.rep_detail_list != null) if (complianceDetailInfo?.template_list?.FirstOrDefault(t => t.task_type == 60)?.rep_detail_list != null)
{ {
foreach (var item in complianceDetailInfo.template_list.FirstOrDefault(t => t.task_type == 60)?.rep_detail_list) foreach (var item in complianceDetailInfo?.template_list?.FirstOrDefault(t => t.task_type == 60)?.rep_detail_list)
{ {
cmbMakerInfo.Items.Add(item.rep_name); cmbMakerInfo.Items.Add(item.rep_name);
} }
} }
// 商品识别码 // 商品识别码
var complianceDetail = complianceDetailInfo.template_list.FirstOrDefault(t => t.task_type == 61); var complianceDetail = complianceDetailInfo?.template_list?.FirstOrDefault(t => t.task_type == 61);
if (complianceDetail != null && complianceDetail.task_status == 3) if (complianceDetail != null && complianceDetail.task_status == 3)
{ {
this.txtCode.Text = complianceDetail?.input_text?.Values?.FirstOrDefault()?.multi_line_inputs?.FirstOrDefault()?.name; this.txtCode.Text = complianceDetail?.input_text?.Values?.FirstOrDefault()?.multi_line_inputs?.FirstOrDefault()?.name;
} }
}));
} }
catch (Exception ex) catch (Exception ex)
{ {
if (IsAuto) if (IsAuto)
{
ErrMsg = ex.Message; ErrMsg = ex.Message;
Close(); else
}
BaseMsgForm.ShowError(ex.Message); BaseMsgForm.ShowError(ex.Message);
} }
} }
} }
public void btnSave_Click(object sender, EventArgs e) public void btnSave_Click(object sender, EventArgs e)
{
Task.Run(() =>
{ {
try try
{ {
@@ -146,17 +172,18 @@ namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms
catch (Exception ex) catch (Exception ex)
{ {
if (IsAuto) if (IsAuto)
{
ErrMsg = ex.Message; ErrMsg = ex.Message;
Close(); else
}
BaseMsgForm.ShowError(ex.Message); BaseMsgForm.ShowError(ex.Message);
} }
});
} }
private void EditCompliance() private void EditCompliance()
{ {
JObject compObj = new JObject(); JObject compObj = new JObject();
Invoke(new Action(() =>
{
compObj.Add("cat_id", complianceInfo.cat_id); compObj.Add("cat_id", complianceInfo.cat_id);
compObj.Add("spu_id", complianceInfo.spu_id); compObj.Add("spu_id", complianceInfo.spu_id);
compObj.Add("goods_id", complianceInfo.goods_id); compObj.Add("goods_id", complianceInfo.goods_id);
@@ -262,16 +289,19 @@ namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms
} }
} }
} }
}));
var data = JsonHelper.SerializeObject(compObj); var data = JsonHelper.SerializeObject(compObj);
var editComplianceRst = EditCompliance(shop, compObj); // {"success":true,"error_code":1000000,"result":{"result":true}} var editComplianceRst = EditCompliance(shop, compObj); // {"success":true,"error_code":1000000,"result":{"result":true}}
editComplianceRst = GetHtml.Unicode2String(editComplianceRst); editComplianceRst = GetHtml.Unicode2String(editComplianceRst);
if (editComplianceRst.Contains("\"success\":true")) if (editComplianceRst.Contains("\"success\":true"))
{ {
EditSuccess = true; IsEditComplianceSuccess = true;
if (!IsAuto) if (!IsAuto)
{
BaseMsgForm.ShowInfo("修改成功!"); BaseMsgForm.ShowInfo("修改成功!");
this.Close(); this.Close();
} }
}
else else
{ {
string sErrMsg = BaseRegex.GetStringJson(ref editComplianceRst, "errorMsg").ParseToString(); string sErrMsg = BaseRegex.GetStringJson(ref editComplianceRst, "errorMsg").ParseToString();
@@ -281,10 +311,8 @@ namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms
sErrMsg = editComplianceRst; sErrMsg = editComplianceRst;
if (IsAuto) if (IsAuto)
{
ErrMsg = sErrMsg; ErrMsg = sErrMsg;
Close(); else
}
BaseMsgForm.ShowError(sErrMsg); BaseMsgForm.ShowError(sErrMsg);
} }
} }
@@ -30,6 +30,12 @@ namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms
private void ReceiveAreaForm_Load(object sender, EventArgs e) private void ReceiveAreaForm_Load(object sender, EventArgs e)
{ {
if (receiveArea == null)
{
BaseMsgForm.ShowError("修改期望到货区域失败:期望到货区域参数为空!");
return;
}
if (receiveArea.expectReceiveAreaConfigType == 1) if (receiveArea.expectReceiveAreaConfigType == 1)
{ {
this.radioButton1.Checked = true; this.radioButton1.Checked = true;
@@ -49,6 +55,12 @@ namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms
private void btnSave_Click(object sender, EventArgs e) private void btnSave_Click(object sender, EventArgs e)
{ {
if (receiveArea == null)
{
BaseMsgForm.ShowError("修改期望到货区域失败:期望到货区域参数为空!");
return;
}
int areaId = 1; int areaId = 1;
if (this.radioButton2.Checked) if (this.radioButton2.Checked)
areaId = 2; areaId = 2;
@@ -81,7 +93,7 @@ namespace TemuKJD.KJDForms.ProductForms.TemuJitSubForms
} }
} }
private string EditReceiveArea(ShopLoginInfo shop, int AreaId, string skcIds) public static string EditReceiveArea(ShopLoginInfo shop, int AreaId, string skcIds)
{ {
string url = "https://agentseller.temu.com/mms/turbo/supplier/pick/out/config/editExpectReceiveArea"; string url = "https://agentseller.temu.com/mms/turbo/supplier/pick/out/config/editExpectReceiveArea";
string body; string body;
+25
View File
@@ -47,16 +47,41 @@ namespace TemuKJD.UserComponent
} }
} }
private bool autoRowNumber = true;
/// <summary>
/// 边框颜色
/// </summary>
[Description("自动行号"), Category("UserProperty")]
public bool AutoRowNumber
{
get
{
return autoRowNumber;
}
set
{
if (autoRowNumber != value)
{
autoRowNumber = value;
this.Invalidate();
}
}
}
/// <summary> /// <summary>
/// 自动生成行号 /// 自动生成行号
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void DataGridViewEx_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) private void DataGridViewEx_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
if (AutoRowNumber)
{ {
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, RowHeadersWidth - 4, e.RowBounds.Height); Rectangle rectangle = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, RowHeadersWidth - 4, e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), RowHeadersDefaultCellStyle.Font, rectangle, Color.DarkGray, TextFormatFlags.VerticalCenter | TextFormatFlags.Right); TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), RowHeadersDefaultCellStyle.Font, rectangle, Color.DarkGray, TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
} }
}
/// <summary> /// <summary>
/// 绘制边框颜色 /// 绘制边框颜色