1.Jit客户端功能 2.pdd活动报名新增及优化

This commit is contained in:
wule committed 2025-12-01 10:01:54 +08:00
1 parent e77914bafc
commit 480d8c2cd4
41 files changed
+5136 -2863

No files matched your search

@@ -69,12 +69,6 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.lblProdName = new System.Windows.Forms.Label();
this.numCount = new System.Windows.Forms.NumericUpDown();
this.dgvSelectShop = new TemuKJD.UserComponent.DataGridViewEx();
this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colUserName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSubUserName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colShopName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colShopNotes = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.btnCancel = new DevComponents.DotNetBar.PanelEx();
this.btnAddToSelectDb = new DevComponents.DotNetBar.PanelEx();
this.btnGetShop = new DevComponents.DotNetBar.PanelEx();
@@ -108,6 +102,13 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.col_select_product = new System.Windows.Forms.DataGridViewLinkColumn();
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colUserName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSubUserName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colShopName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colShopNotes = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colJitStatus = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -468,19 +469,21 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.panel2.Controls.Add(this.label7);
this.panel2.Controls.Add(this.txtShopId);
this.panel2.Controls.Add(this.label8);
this.panel2.Location = new System.Drawing.Point(406, 53);
this.panel2.Location = new System.Drawing.Point(336, 53);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(508, 447);
this.panel2.Size = new System.Drawing.Size(606, 447);
this.panel2.TabIndex = 8;
this.panel2.Visible = false;
//
// lbxProdName
//
this.lbxProdName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lbxProdName.FormattingEnabled = true;
this.lbxProdName.ItemHeight = 17;
this.lbxProdName.Location = new System.Drawing.Point(19, 258);
this.lbxProdName.Name = "lbxProdName";
this.lbxProdName.Size = new System.Drawing.Size(468, 140);
this.lbxProdName.Size = new System.Drawing.Size(566, 140);
this.lbxProdName.TabIndex = 525;
//
// lblProdName
@@ -494,7 +497,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
//
// numCount
//
this.numCount.Location = new System.Drawing.Point(297, 408);
this.numCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.numCount.Location = new System.Drawing.Point(395, 408);
this.numCount.Maximum = new decimal(new int[] {
1000,
0,
@@ -515,6 +519,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.dgvSelectShop.AllowUserToDeleteRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgvSelectShop.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgvSelectShop.AutoRowNumber = true;
this.dgvSelectShop.BackgroundColor = System.Drawing.Color.White;
this.dgvSelectShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
@@ -533,66 +539,24 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.colSubUserName,
this.colShopId,
this.colShopName,
this.colShopNotes});
this.colShopNotes,
this.colJitStatus});
this.dgvSelectShop.Location = new System.Drawing.Point(17, 46);
this.dgvSelectShop.Name = "dgvSelectShop";
this.dgvSelectShop.ReadOnly = true;
this.dgvSelectShop.RowHeadersWidth = 28;
this.dgvSelectShop.RowTemplate.Height = 23;
this.dgvSelectShop.Size = new System.Drawing.Size(470, 184);
this.dgvSelectShop.Size = new System.Drawing.Size(568, 184);
this.dgvSelectShop.TabIndex = 504;
this.dgvSelectShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSelectShop_CellContentClick);
//
// colCheck
//
this.colCheck.HeaderText = "选择";
this.colCheck.MinimumWidth = 6;
this.colCheck.Name = "colCheck";
this.colCheck.ReadOnly = true;
this.colCheck.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colCheck.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colCheck.Width = 30;
//
// colUserName
//
this.colUserName.HeaderText = "用户名称";
this.colUserName.MinimumWidth = 6;
this.colUserName.Name = "colUserName";
this.colUserName.ReadOnly = true;
this.colUserName.Width = 90;
//
// colSubUserName
//
this.colSubUserName.HeaderText = "子账户名称";
this.colSubUserName.Name = "colSubUserName";
this.colSubUserName.ReadOnly = true;
this.colSubUserName.Visible = false;
this.colSubUserName.Width = 150;
//
// colShopId
//
this.colShopId.HeaderText = "店铺Id";
this.colShopId.Name = "colShopId";
this.colShopId.ReadOnly = true;
//
// colShopName
//
this.colShopName.HeaderText = "店铺名称";
this.colShopName.Name = "colShopName";
this.colShopName.ReadOnly = true;
//
// colShopNotes
//
this.colShopNotes.HeaderText = "店铺备注";
this.colShopNotes.Name = "colShopNotes";
this.colShopNotes.ReadOnly = true;
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.CanvasColor = System.Drawing.SystemColors.Control;
this.btnCancel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnCancel.DisabledBackColor = System.Drawing.Color.Empty;
this.btnCancel.Location = new System.Drawing.Point(445, 408);
this.btnCancel.Location = new System.Drawing.Point(543, 408);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(42, 23);
this.btnCancel.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -613,11 +577,12 @@ namespace TemuKJD.KJDForms.ProductSelectForms
//
// btnAddToSelectDb
//
this.btnAddToSelectDb.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnAddToSelectDb.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnAddToSelectDb.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnAddToSelectDb.DisabledBackColor = System.Drawing.Color.Empty;
this.btnAddToSelectDb.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnAddToSelectDb.Location = new System.Drawing.Point(397, 408);
this.btnAddToSelectDb.Location = new System.Drawing.Point(495, 408);
this.btnAddToSelectDb.Name = "btnAddToSelectDb";
this.btnAddToSelectDb.Size = new System.Drawing.Size(42, 23);
this.btnAddToSelectDb.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -637,11 +602,12 @@ namespace TemuKJD.KJDForms.ProductSelectForms
//
// btnGetShop
//
this.btnGetShop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnGetShop.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnGetShop.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnGetShop.DisabledBackColor = System.Drawing.Color.Empty;
this.btnGetShop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnGetShop.Location = new System.Drawing.Point(445, 13);
this.btnGetShop.Location = new System.Drawing.Point(543, 13);
this.btnGetShop.Name = "btnGetShop";
this.btnGetShop.Size = new System.Drawing.Size(42, 23);
this.btnGetShop.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -661,9 +627,11 @@ namespace TemuKJD.KJDForms.ProductSelectForms
//
// txtShopName
//
this.txtShopName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtShopName.Location = new System.Drawing.Point(279, 13);
this.txtShopName.Name = "txtShopName";
this.txtShopName.Size = new System.Drawing.Size(160, 23);
this.txtShopName.Size = new System.Drawing.Size(258, 23);
this.txtShopName.TabIndex = 433;
//
// label7
@@ -951,6 +919,57 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.statusBar.Size = new System.Drawing.Size(1278, 25);
this.statusBar.TabIndex = 5;
//
// colCheck
//
this.colCheck.HeaderText = "选择";
this.colCheck.MinimumWidth = 6;
this.colCheck.Name = "colCheck";
this.colCheck.ReadOnly = true;
this.colCheck.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colCheck.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colCheck.Width = 30;
//
// colUserName
//
this.colUserName.HeaderText = "用户名称";
this.colUserName.MinimumWidth = 6;
this.colUserName.Name = "colUserName";
this.colUserName.ReadOnly = true;
this.colUserName.Width = 90;
//
// colSubUserName
//
this.colSubUserName.HeaderText = "子账户名称";
this.colSubUserName.Name = "colSubUserName";
this.colSubUserName.ReadOnly = true;
this.colSubUserName.Visible = false;
this.colSubUserName.Width = 150;
//
// colShopId
//
this.colShopId.HeaderText = "店铺Id";
this.colShopId.Name = "colShopId";
this.colShopId.ReadOnly = true;
//
// colShopName
//
this.colShopName.HeaderText = "店铺名称";
this.colShopName.Name = "colShopName";
this.colShopName.ReadOnly = true;
//
// colShopNotes
//
this.colShopNotes.HeaderText = "店铺备注";
this.colShopNotes.Name = "colShopNotes";
this.colShopNotes.ReadOnly = true;
//
// colJitStatus
//
this.colJitStatus.HeaderText = "JIT状态";
this.colJitStatus.Name = "colJitStatus";
this.colJitStatus.ReadOnly = true;
this.colJitStatus.Visible = false;
//
// DbProductListForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -1024,12 +1043,6 @@ namespace TemuKJD.KJDForms.ProductSelectForms
private DevComponents.DotNetBar.PanelEx btnBatchSelect;
private DevComponents.DotNetBar.PanelEx btnSearch;
private DevComponents.DotNetBar.PanelEx btnSelect;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colUserName;
private System.Windows.Forms.DataGridViewTextBoxColumn colSubUserName;
private System.Windows.Forms.DataGridViewTextBoxColumn colShopId;
private System.Windows.Forms.DataGridViewTextBoxColumn colShopName;
private System.Windows.Forms.DataGridViewTextBoxColumn colShopNotes;
private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect;
private System.Windows.Forms.DataGridViewTextBoxColumn col_db_id;
private System.Windows.Forms.DataGridViewTextBoxColumn col_spu_id;
@@ -1053,5 +1066,12 @@ namespace TemuKJD.KJDForms.ProductSelectForms
private System.Windows.Forms.DataGridViewLinkColumn col_edit;
private System.Windows.Forms.DataGridViewLinkColumn col_delete;
private System.Windows.Forms.DataGridViewLinkColumn col_select_product;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colUserName;
private System.Windows.Forms.DataGridViewTextBoxColumn colSubUserName;
private System.Windows.Forms.DataGridViewTextBoxColumn colShopId;
private System.Windows.Forms.DataGridViewTextBoxColumn colShopName;
private System.Windows.Forms.DataGridViewTextBoxColumn colShopNotes;
private System.Windows.Forms.DataGridViewTextBoxColumn colJitStatus;
}
}
@@ -19,6 +19,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.BaseForms;
using TemuKJD.Extension;
using TemuKJD.KJDForms.JITForms;
using TemuKJD.KJDForms.ToolForms;
using TemuKJD.ToolForms;
using Work;
@@ -27,11 +28,11 @@ namespace TemuKJD.KJDForms.ProductSelectForms
{
public partial class DbProductListForm : LRBaseForm
{
public bool IsClientJit { get; set; } = false;
ShopLoginInfo shop = null; // 单店认领
List<ShopLoginInfo> lstAdminShopInfo = new List<ShopLoginInfo>(); // 服务端直传店铺列表
List<KJDDBProduct> lstTemuDbProduct = new List<KJDDBProduct>();
public bool IsAdmin { get; set; } = false;
public bool IsClientJit { get; set; } = false;
public DbProductListForm()
{
@@ -59,8 +60,9 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.cmbGroup.Visible = false;
this.btnImportHtml.Visible = false;
this.btnBatchSelect.Visible = false;
this.dgvSelectShop.Columns["colJitStatus"].Visible = false;
if (BaseClass.SaLevel == 1 && shop == null) // 一级管理员且不是选品状态
if (BaseClass.SaLevel == 1 && shop == null && !IsClientJit) // 一级管理员且不是选品状态
{
this.dgvDbProduct.Columns["col_delete"].Visible = true; // 删除
this.dgvDbProduct.Columns["col_edit"].Visible = true; // 编辑
@@ -76,7 +78,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.btnImportHtml.Visible = true; // 导入前端直采商品
this.btnBatchSelect.Visible = true; // 批量直传
}
else if (BaseClass.SaLevel > 1 && shop == null)
else if (BaseClass.SaLevel > 1 && shop == null && !IsClientJit)
{
this.dgvDbProduct.Columns["colHeadWords"].Visible = true; // 头词
this.dgvDbProduct.Columns["colEndWords"].Visible = true; // 尾词
@@ -87,6 +89,13 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.lblGroup.Visible = true; // 分组
this.cmbGroup.Visible = true; // 分组
}
if (IsClientJit)
{
this.dgvDbProduct.Columns["colSelectProd"].Visible = true; // 商品直传(不经过客户选品)
this.btnBatchSelect.Visible = true; // 批量直传
this.cmbGroup.Text = "jit分组";
this.dgvSelectShop.Columns["colJitStatus"].Visible = true;
}
btnSelect.Visible = false;
this.dgvDbProduct.Columns["col_select_product"].Visible = false;
@@ -418,7 +427,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
{
if (!isDbToDb)
BaseMsgForm.ShowError("认领商品不能为空!");
return "店铺不能为空!";
return "认领商品不能为空!";
}
Invoke(new Action(() =>
@@ -443,7 +452,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
continue;
}
if (selectShop.AddProductRemaining <= 0 && !isDbToDb) // 管理员发起的数据直传不消耗次数
if (selectShop.AddProductRemaining <= 0 && !isDbToDb) // 数据直传不消耗次数
{
Invoke(new Action(() =>
{
@@ -481,10 +490,12 @@ namespace TemuKJD.KJDForms.ProductSelectForms
//{
// data += "&main_user_name=" + BaseClass.UserName;
//}
if (!isDbToDb) // 管理员发起的数据直传不消耗次数,不计算认领次数
if (!isDbToDb) // 数据直传不消耗次数,不计算认领次数
data += "&add_product_remaining=" + selectShop.AddProductRemaining;
data += "&add_fission_product_name=" + GetHtml.UrlEncodeUtf8(fissionProductName) +
"&status=待上传";
if (IsClientJit)
data += "&is_client_jit=true";
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
@@ -1133,8 +1144,22 @@ namespace TemuKJD.KJDForms.ProductSelectForms
return;
string headerText = dgvSelectShop.Columns[e.ColumnIndex].HeaderText;
string shopId = dgvSelectShop.Rows[e.RowIndex].Cells["colShopId"].Value.ParseToString();
if (headerText == "选择")
{
if (IsClientJit)
{
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
if (shop != null && shop.jit_expire_time > DateTime.Now.Date)
{
}
else
{
dgvSelectShop.Rows[e.RowIndex].Cells["colCheck"].Value = false;
BaseMsgForm.ShowError("JIT卡密过期或未开通", "JIT商品选品-操作失败");
return;
}
}
foreach (DataGridViewRow row in dgvSelectShop.Rows)
{
row.Cells["colCheck"].Value = false;
@@ -1162,10 +1187,15 @@ namespace TemuKJD.KJDForms.ProductSelectForms
void GetShop()
{
this.pbLoading.Visible = true;
this.dgvSelectShop.Rows.Clear();
var list = GlobalConfig.ShopLoginList.Where(s => s.ShopId.Contains(txtShopId.Text.Trim()) && s.ShopAccount.Contains(txtShopName.Text.Trim())).Take(10).ToList();
foreach (var shop in lstAdminShopInfo)
string searchShopId = txtShopId.Text.Trim();
string searchShopAccount = txtShopName.Text.Trim();
var list = GlobalConfig.ShopLoginList
.Where(s => (searchShopId.IsNullOrEmpty() || s.ShopId.Contains(searchShopId)) &&
(searchShopAccount.IsNullOrEmpty() || s.ShopAccount.Contains(searchShopAccount)))
.Where(s => !s.ShopId.IsNullOrEmpty())
.ToList();
foreach (var shop in list)
{
Invoke(new Action(() =>
{
@@ -1175,11 +1205,17 @@ namespace TemuKJD.KJDForms.ProductSelectForms
shop.SubUserName,
shop.ShopId,
shop.ShopAccount,
shop.Notes);
if (rowIndex == 0)
shop.Notes
);
if (!IsClientJit && rowIndex == 0)
{
this.dgvSelectShop.Rows[rowIndex].Cells["colCheck"].Value = true;
}
if (IsClientJit)
{
this.dgvSelectShop.Rows[rowIndex].Cells["colJitStatus"].Value = JitShopActiveForm.GetJitStatus(shop);
this.dgvSelectShop.Rows[rowIndex].Cells["colJitStatus"].Style.ForeColor = JitShopActiveForm.GetJitStatusStyleColor(shop);
}
}));
}
}
@@ -1193,7 +1229,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
{
int pageCount;
var list = AdminForms.AdminShopListForm.Instance.AdminGetServerShopLst(out pageCount, "", "", "",
txtShopId.Text.Trim(), txtShopName.Text.Trim(), 1, 10);
txtShopId.Text.Trim(), txtShopName.Text.Trim(), 1, 20);
lstAdminShopInfo.AddRange(list);
foreach (var shop in lstAdminShopInfo)
@@ -1231,6 +1267,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
var selectUserNames = this.dgvSelectShop.Rows.Cast<DataGridViewRow>()
.Where(r => r.Cells["colCheck"].Value.ParseToBool() == true).Select(r => r.Cells["colUserName"].Value.ParseToString()).ToList();
var selectShopLst = lstAdminShopInfo.Where(s => selectShopIds.Contains(s.ShopId) && selectUserNames.Contains(s.UserName)).ToList();
if (IsClientJit)
selectShopLst = GlobalConfig.ShopLoginList.Where(s => selectShopIds.Contains(s.ShopId) && selectUserNames.Contains(s.UserName)).ToList();
if (selectShopLst.Count <= 0)
{
BaseMsgForm.ShowError("未选择店铺!");
@@ -135,6 +135,9 @@
<metadata name="colShopNotes.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colJitStatus.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">
<value>True</value>
</metadata>
@@ -18,6 +18,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
{
public partial class DbProductSelectEditNotesForm : LRBaseForm
{
public bool IsClientJit { get; set; } = false;
TemuDBProductSelect dbProdSelect = null;
SetProductSelectNotesType selectNotesType;
@@ -68,6 +70,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
var data = UserLogin.GetSignaturex() +
"&db_id=" + dbProdSelect.id + "&notes=" + this.txtNotes.Text.Trim();
data += "&user_notes=" + this.cmbUserNotes.Text.Trim();
if (IsClientJit)
data += "&is_client_jit=true";
if (selectNotesType == SetProductSelectNotesType.DbProduct)
{
byte[] bytes = Encoding.GetEncoding("gb2312").GetBytes(txtProdName.Text.Trim());
File diff suppressed because it is too large. Load diff
@@ -33,6 +33,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
{
public partial class DbProductSelectListManageForm : LRBaseForm
{
public bool IsClientJit { get; set; } = false;
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
List<string> skuRandomLetterArr = new List<string> { "~", "#", "¥", "%", "&", "*", "(", ")", "(", ")", "+", "-", "_", "=", "【", "】", "·", "|", "《", "》" };
@@ -120,41 +121,107 @@ namespace TemuKJD.KJDForms.ProductSelectForms
private void DbProductSelectListForm_Load(object sender, EventArgs e)
{
this.ucSplitPage1.PageChange += UcSplitPage1_PageChange;
this.dgvSelectProduct.AddSelectorColumn("colSelect");
//var chkSel = this.dgvSelectProduct.AddSelectorColumn("colSelect");
var chkSel = this.dgvSelectProduct.Columns["colSelect"].AddHeaderCheckBox(HorizontalAlignment.Center, 0, 0, null, null, false, null, true);
chkSel.CheckedChanged += ChkSel_CheckedChanged;
this.dgvSelectProduct.AddImgColumn("colProductSkcPic", "colImgUrl");
dgvSelectProduct.Columns["colSubSaNick"].Visible = false;
dgvSelectProduct.Columns["colDelete"].Visible = false;
chkShowDel.Visible = false;
btnReFission.Visible = false;
btnSetSubSa.Visible = false;
chkNoSubSa.Visible = false;
btnReFission.Visible = false;
tableLayoutPanel1.Width += 86;
chkUploadProd.Visible = false; // 直接上传
flowLayoutPanel1.Visible = false; // 一些测试操作项目显示在此处
chkUploadProd.Visible = true;
flowLayoutPanel1.Visible = true;
if (BaseClass.SaLevel == 1)
if (BaseClass.SaLevel == 1 && !IsClientJit)
{
dgvSelectProduct.Columns["colSubSaNick"].Visible = true;
chkShowDel.Visible = true;
btnReFission.Visible = true;
btnSetSubSa.Visible = true;
chkNoSubSa.Visible = true;
btnReFission.Visible = true;
tableLayoutPanel1.Width -= 86;
//chkReFissionAllProdName.Checked = true;
//chkRandomSkuOrder.Checked = true;
//chkSkuRandomPrice.Checked = true;
}
if (IsClientJit)
{
chkShowDel.Visible = true;
btnReFission.Visible = true;
cmbUserNotes.Visible = false;
lblUserNotes.Visible = false;
colUserNotes.Visible = false;
var columnStyles = tableLayoutPanel1.ColumnStyles.Cast<ColumnStyle>().ToList();
columnStyles[columnStyles.Count - 1].SizeType = SizeType.Absolute;
columnStyles[columnStyles.Count - 1].Width = 0;
columnStyles[columnStyles.Count - 2].SizeType = SizeType.Absolute;
columnStyles[columnStyles.Count - 2].Width = 0;
int colsWidth = 0;
foreach(DataGridViewColumn col in dgvSelectProduct.Columns)
{
if (col.Visible)
{
colsWidth += col.Width;
}
}
if (dgvSelectProduct.Width - colsWidth - dgvSelectProduct.RowHeadersWidth > 0)
{
colOpResult.Width += dgvSelectProduct.Width - colsWidth - dgvSelectProduct.RowHeadersWidth;
}
}
this.lblSkuRandomLetterNotes.Text = "备注:SKU特殊字符包括 " + string.Join(" ", skuRandomLetterArr) + " ";
}
private void ChkSel_CheckedChanged(object sender, EventArgs e)
{
var chkSelectAll = sender as CheckBox;
if (!chkSelectAll.Checked)
{
foreach (DataGridViewRow row in dgvSelectProduct.Rows)
{
row.Cells["colSelect"].Value = false;
}
}
else
{
if (IsClientJit)
{
foreach (DataGridViewRow row in dgvSelectProduct.Rows)
{
var shopId = row.Cells["colSupplierId"].Value.ParseToString();
var clientShop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
if (clientShop != null && clientShop.jit_expire_time >= DateTime.Now.Date)
{
row.Cells["colSelect"].Value = true;
}
}
}
else
{
foreach (DataGridViewRow row in dgvSelectProduct.Rows)
{
row.Cells["colSelect"].Value = true;
}
}
}
}
bool isFirst = true;
private void DbProductSelectListManageForm_VisibleChanged(object sender, EventArgs e)
{
if (this.Visible == true)
if (this.Visible == true && isFirst)
{
isFirst = false;
this.pbLoading.Visible = true;
SearchDbProdSelect(this.ucSplitPage1.CurrentPage);
}
@@ -246,6 +313,14 @@ namespace TemuKJD.KJDForms.ProductSelectForms
dgvSelectProduct.Rows[rowIndex].Height = 60;
displayLoginStatusColor(dgvSelectProduct.Rows[rowIndex].Cells["colLogin"], dgvSelectProduct.Rows[rowIndex].Cells["colLogin"].Value.ParseToString());
if (IsClientJit)
{
var clientShop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == prodSelect.shop_id);
if (clientShop == null || clientShop.jit_expire_time.IsNullOrEmpty() || clientShop.jit_expire_time < DateTime.Now.Date)
{
dgvSelectProduct.Rows[rowIndex].DefaultCellStyle.ForeColor = Color.LightGray;
}
}
}));
}
@@ -286,6 +361,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
data += "&operate_sub_sa_name=" + BaseClass.UserName;
if (chkNoSubSa.Checked)
data += "&no_sub_sa=true";
if (IsClientJit)
data += "&is_client_jit=true";
}));
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
@@ -333,6 +410,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.cmbStatus.Text = "待上传";
this.cmbNotes.Text = "全部";
this.cmbUserNotes.Text = "全部";
this.chkNoSubSa.Checked = false;
}
private void dgvSelectProduct_CellContentClick(object sender, DataGridViewCellEventArgs e)
@@ -343,7 +421,17 @@ namespace TemuKJD.KJDForms.ProductSelectForms
var dbId = dgvSelectProduct.Rows[e.RowIndex].Cells["colSelectId"].Value.ParseToString();
var dbSelectProduct = lstAdminTemuDBProductSelect.FirstOrDefault(p => p.id.ToString() == dbId);
var shopId = dgvSelectProduct.Rows[e.RowIndex].Cells["colSupplierId"].Value.ParseToString();
var draftId = dgvSelectProduct.Rows[e.RowIndex].Cells["colDraftId"].Value.ParseToString();
var draftId = dgvSelectProduct.Rows[e.RowIndex].Cells["colDraftId"].Value.ParseToString();
if (IsClientJit)
{
var clientShop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
if (clientShop == null || clientShop.jit_expire_time.IsNullOrEmpty() || clientShop.jit_expire_time < DateTime.Now.Date)
{
BaseMsgForm.ShowError("JIT卡密过期或未开通", "JIT商品上传-操作失败");
return;
}
}
switch (headerText)
{
@@ -358,6 +446,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
break;
case "编辑备注":
DbProductSelectEditNotesForm editForm = new DbProductSelectEditNotesForm(dbSelectProduct);
editForm.IsClientJit = this.IsClientJit;
editForm.ShowDialog();
dgvSelectProduct.Rows[e.RowIndex].Cells["colNotes"].Value = dbSelectProduct.notes;
dgvSelectProduct.Rows[e.RowIndex].Cells["colUserNotes"].Value = dbSelectProduct.user_notes;
@@ -373,57 +462,68 @@ namespace TemuKJD.KJDForms.ProductSelectForms
case "草稿箱Id":
if (!string.IsNullOrEmpty(draftId))
{
var shop = GetShop(shopId);
AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop);
//adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" +
adminLoginForm.InitUrl = "https://agentseller.temu.com/goods/edit?productDraftId=" +
draftId + "&from=productDraftList";
adminLoginForm.openType = EnumOpenType.manage;
adminLoginForm.WindowState = FormWindowState.Maximized;
adminLoginForm.ShowDialog();
return;
var url = BaseClass.BuildObjString("product/get_select_product_map_draft_id_list");
var data = UserLogin.GetSignaturex() + "&select_db_id=" + dbId;
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
}
else
if (!IsClientJit)
{
var shop = GetShop(shopId);
AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop);
//adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" +
adminLoginForm.InitUrl = "https://agentseller.temu.com/goods/edit?productDraftId=" +
draftId + "&from=productDraftList";
adminLoginForm.openType = EnumOpenType.manage;
adminLoginForm.WindowState = FormWindowState.Maximized;
adminLoginForm.ShowDialog();
}
// 查看map映射列表
//return;
//var url = BaseClass.BuildObjString("product/get_select_product_map_draft_id_list");
//var data = UserLogin.GetSignaturex() + "&select_db_id=" + dbId;
//if (IsClientJit)
// data += "&is_client_jit=true";
//var html = GetHtml.PostUtf8(url, data);
//if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
// html = GetHtml.PostUtf8(url, data);
//if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
// html = GetHtml.PostUtf8(url, data);
//if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
//{
//}
//else
//{
//}
}
break;
case "进店":
{
var shop = GetShop(shopId);
AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop);
//adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product/draft";
adminLoginForm.InitUrl = "https://agentseller.temu.com/goods/draft";
adminLoginForm.openType = EnumOpenType.manage;
adminLoginForm.WindowState = FormWindowState.Maximized;
adminLoginForm.ShowDialog();
if (!IsClientJit)
{
var shop = GetShop(shopId);
AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop);
//adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product/draft";
adminLoginForm.InitUrl = "https://agentseller.temu.com/goods/draft";
adminLoginForm.openType = EnumOpenType.manage;
adminLoginForm.WindowState = FormWindowState.Maximized;
adminLoginForm.ShowDialog();
}
}
break;
case "登录":
{
var shop = GetShop(shopId);
// 登录店铺
AdminShopLoginForm shopLoginForm = new AdminShopLoginForm(shop);
shopLoginForm.openType = EnumOpenType.login;
shopLoginForm.SaveComplete += ShopLoginForm_SaveComplete;
shopLoginForm.ShowDialog();
foreach (DataGridViewRow row in this.dgvSelectProduct.Rows)
if (!IsClientJit)
{
if (row.Cells["colSupplierId"].Value.ParseToString() == shop.ShopId)
var shop = GetShop(shopId);
// 登录店铺
AdminShopLoginForm shopLoginForm = new AdminShopLoginForm(shop);
shopLoginForm.openType = EnumOpenType.login;
shopLoginForm.SaveComplete += ShopLoginForm_SaveComplete;
shopLoginForm.ShowDialog();
foreach (DataGridViewRow row in this.dgvSelectProduct.Rows)
{
row.Cells["colLogin"].Value = shop.LoginStatus2 == "国际版在线" ? "在线" : "登录";
displayLoginStatusColor(row.Cells["colLogin"], row.Cells["colLogin"].Value.ParseToString());
if (row.Cells["colSupplierId"].Value.ParseToString() == shop.ShopId)
{
row.Cells["colLogin"].Value = shop.LoginStatus2 == "国际版在线" ? "在线" : "登录";
displayLoginStatusColor(row.Cells["colLogin"], row.Cells["colLogin"].Value.ParseToString());
}
}
}
}
@@ -503,6 +603,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
var url = BaseClass.BuildObjString("product/del_select_product");
var data = UserLogin.GetSignaturex() +
"&db_id=" + dbId;
if (IsClientJit)
data += "&is_client_jit=true";
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
@@ -599,6 +701,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
});
}
int timeOutSeconds = 120;
void AddProductDraft(TemuDBProductSelect[] prodSelect)
{
if (prodSelect == null || prodSelect.Count() == 0)
@@ -697,6 +800,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
var empty_data = UserLogin.GetSignaturex() +
"&db_id=" + prod.id +
"&status=已清除";
if (IsClientJit)
empty_data += "&is_client_jit=true";
GetHtml.PostUtf8(empty_url, empty_data);
}
@@ -710,20 +815,28 @@ namespace TemuKJD.KJDForms.ProductSelectForms
}
var result = "";
try
var t = Task.Run(() =>
{
result = UploadProduct(shop, temuDBProd, prod, row.Cells["colOpResult"]); //将商品上传至草稿箱
if (result.Contains("登录过期") || result.Contains("Invalid Login State"))
try
{
AdminShopListForm.Instance.CheckShopLogin(shopLst.Where(s => s.LoginName == shop.LoginName).ToArray(), false);
result = UploadProduct(shop, temuDBProd, prod, row.Cells["colOpResult"]); //将商品上传至草稿箱
if (result.Contains("登录过期") || result.Contains("Invalid Login State"))
{
AdminShopListForm.Instance.CheckShopLogin(shopLst.Where(s => s.LoginName == shop.LoginName).ToArray(), false);
}
}
}
catch (Exception ex)
catch (Exception ex)
{
result = "{\"success\":false,\"status\":\"未上传\",\"errMsg\":\"" + ex.Message + "\"}";
}
});
t.Wait(timeOutSeconds * 1000);
if (!t.IsCompleted)
{
result = "{\"success\":false,\"status\":\"未上传\",\"errMsg\":\"" + ex.Message + "\"}";
result = "{\"success\":false,\"status\":\"未上传\",\"errMsg\":\"上传超时\"}";
}
Thread.Sleep(200);
Thread.Sleep(Randomx.GetId(200, 500));
var error = BaseRegex.GetStringJson(ref result, "errMsg");
if (!result.Contains("\"success\":true"))
@@ -746,6 +859,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
"&up_spu_id=" + prod.spu_id +
"&shop_id=" + prod.shop_id +
"&status=" + prod.status;
if (IsClientJit)
data += "&is_client_jit=true";
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
@@ -3055,6 +3170,8 @@ Content-Disposition: form-data; name=""sign""
var empty_data = UserLogin.GetSignaturex() +
"&db_id=" + prod.id +
"&status=已清除";
if (IsClientJit)
empty_data += "&is_client_jit=true";
GetHtml.PostUtf8(empty_url, empty_data);
}
@@ -3075,6 +3192,8 @@ Content-Disposition: form-data; name=""sign""
var data = UserLogin.GetSignaturex() +
"&db_id=" + prod.id;
data += "&fission_product_name=" + GetHtml.UrlEncodeUtf8(fissionProductName.Trim());
if (IsClientJit)
data += "&is_client_jit=true";
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
@@ -3293,5 +3412,10 @@ Content-Disposition: form-data; name=""sign""
this.btnAdd.Enabled = true;
}
}
private void numMaxWaitSecond_ValueChanged(object sender, EventArgs e)
{
this.timeOutSeconds = numMaxWaitSecond.Value.ParseToInt();
}
}
}