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

+86 -24
View File
@@ -18,6 +18,7 @@ using TemuKJD.BaseForms;
using TemuKJD.BLL;
using TemuKJD.Extension;
using TemuKJD.KJDForms.AdminForms;
using TemuKJD.KJDForms.JITForms;
using TemuKJD.KJDForms.ProductForms.TemuJitSubForms;
using TemuKJD.KJDForms.ShopForms;
using TemuKJD.ToolForms;
@@ -27,7 +28,7 @@ namespace TemuKJD.KJDForms.ProductForms
{
public partial class TemuJitForm : BaseForm
{
public bool IsAdmin = false;
public bool IsClientJit { get; set; } = false;
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
public List<ShopLoginInfo> lstAdminShopInfo { get; set; } = new List<ShopLoginInfo>();
/// <summary>
@@ -50,7 +51,7 @@ namespace TemuKJD.KJDForms.ProductForms
/// 期望到货区域列表
/// </summary>
public List<SkcReceiveAreaPickOutInfo> lstReceiveArea = new List<SkcReceiveAreaPickOutInfo>();
/// <summary>
/// 界面参数配置
/// </summary>
@@ -61,6 +62,8 @@ namespace TemuKJD.KJDForms.ProductForms
/// </summary>
List<OpenJitFullParams> lstOpenJitParams = null;
CheckBox chkSelectAll;
public TemuJitForm()
{
InitializeComponent();
@@ -68,21 +71,30 @@ namespace TemuKJD.KJDForms.ProductForms
private void TemuJitForm_Load(object sender, EventArgs e)
{
if (IsAdmin)
if (!IsClientJit)
{
ucSplitPage1.Visible = true;
this.colJitStatus.Visible = false;
}
else
{
ucSplitPage1.Visible = false;
this.colJitStatus.Visible = true;
}
this.dgvShop.AddSelectorColumn("colSelect");
//this.dgvShop.AddSelectorColumn("colSelect");
chkSelectAll = dgvShop.Columns["colSelect"].AddHeaderCheckBox(HorizontalAlignment.Center, 0, 0, null, null, false, null, true);
chkSelectAll.CheckedChanged += chkSelectAll_CheckedChanged;
this.dgvOpenJit.AddSelectorColumn("colCheck");
var chkSelectExtCode = this.dgvExtCode.AddSelectorColumn("colSelectExtCode");
chkSelectExtCode.CheckedChanged += ChkSelectExtCode_CheckedChanged;
this.dgvOpenJit.AddSelectorColumn("colCheck");
this.dgvOpenJit.AddImgColumn("colProductSkcPic", "colImgUrl");
this.dtpEndTime.Value = DateTime.Now.Date.AddDays(1).AddMilliseconds(-1);
this.dtpStartTime.Value = DateTime.Now.Date.AddDays(-7);
if (IsAdmin)
if (!IsClientJit)
setJitConfig = NaiBa.Util.Helper.ConfigHelper.LoadConfig<SetJitConfig>("admin_set_jit_config");
else
setJitConfig = NaiBa.Util.Helper.ConfigHelper.LoadConfig<SetJitConfig>("set_jit_config");
@@ -113,6 +125,28 @@ namespace TemuKJD.KJDForms.ProductForms
lstOpenJitParams = new List<OpenJitFullParams>();
}
private void chkSelectAll_CheckedChanged(object sender, EventArgs e)
{
if (!chkSelectAll.Checked)
{
foreach (DataGridViewRow row in dgvShop.Rows)
{
row.Cells["colSelect"].Value = false;
}
}
else
{
var list = lstAdminShopInfo.Where(s => s.LoginStatus2 == "国际版在线").ToList();
if (IsClientJit)
list = list.Where(s => s.LoginStatus2 == "国际版在线" && s.jit_expire_time >= DateTime.Now.Date).ToList();
foreach (DataGridViewRow row in dgvShop.Rows)
{
if (list.Any(l => l.ShopId == row.Cells["colShopId"]?.Value?.ToString()))
row.Cells["colSelect"].Value = true;
}
}
}
private void Txt_TextChanged(object sender, EventArgs e)
{
setJitConfig.SearchNotes = this.txtNotes.Text.Trim();
@@ -124,7 +158,7 @@ namespace TemuKJD.KJDForms.ProductForms
setJitConfig.SearchExtCode = this.txtExtCode.Text.Trim();
setJitConfig.SearchDuration = this.chkSearchTime.Checked;
if (IsAdmin)
if (!IsClientJit)
NaiBa.Util.Helper.ConfigHelper.SaveConfig("admin_set_jit_config", setJitConfig);
else
NaiBa.Util.Helper.ConfigHelper.SaveConfig("set_jit_config", setJitConfig);
@@ -134,7 +168,7 @@ namespace TemuKJD.KJDForms.ProductForms
{
if (this.Visible)
{
if (IsAdmin)
if (!IsClientJit)
{
this.pbShopLoading.Visible = true;
SearchShop(this.ucSplitPage1.CurrentPage);
@@ -148,7 +182,7 @@ namespace TemuKJD.KJDForms.ProductForms
private void btnRefreshShop_Click(object sender, EventArgs e)
{
if (IsAdmin)
if (!IsClientJit)
{
if (this.ucSplitPage1.CurrentPage != 1)
this.ucSplitPage1.CurrentPage = 1;
@@ -216,6 +250,7 @@ namespace TemuKJD.KJDForms.ProductForms
shopEntity.ShopAccount,
shopEntity.Notes,
canUse ? "在线" : "掉线",
shopEntity.jit_expire_time >= DateTime.Now.Date ? "可用" : "失效",
canUse,
string.Empty
);
@@ -279,6 +314,7 @@ namespace TemuKJD.KJDForms.ProductForms
shop.ShopAccount,
shop.Notes,
canUse ? "在线" : "掉线",
shop.jit_expire_time >= DateTime.Now.Date ? "可用" : "失效",
canUse,
string.Empty
);
@@ -340,6 +376,11 @@ namespace TemuKJD.KJDForms.ProductForms
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightGreen : Color.OrangeRed;
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkGreen : Color.DarkRed;
}
if (IsClientJit)
{
var jitRow = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop?.ShopId);
jitRow.Cells["colJitStatus"].Style.ForeColor = JitShopActiveForm.GetJitStatusStyleColor(shop);
}
}
private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e)
@@ -350,7 +391,7 @@ namespace TemuKJD.KJDForms.ProductForms
string loginName = dgvShop.Rows[e.RowIndex].Cells["colLoginName"].Value.ParseToString();
string accountId = dgvShop.Rows[e.RowIndex].Cells["colShopId"].Value.ParseToString();
ShopLoginInfo shop = null;
if (IsAdmin)
if (!IsClientJit)
shop = lstAdminShopInfo.FirstOrDefault(v => v.LoginName == loginName && v.ShopId == accountId);
else
shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == loginName && v.ShopId == accountId);
@@ -361,7 +402,7 @@ namespace TemuKJD.KJDForms.ProductForms
case "登录":
case "状态":
{
if (IsAdmin)
if (!IsClientJit)
{
AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
if (shop.LoginStatus2 == "国际版在线")
@@ -401,9 +442,29 @@ namespace TemuKJD.KJDForms.ProductForms
}
}
break;
default:
case "":
if (IsClientJit)
{
if (shop != null && shop.jit_expire_time > DateTime.Now.Date)
{
if (shop.LoginStatus2 != "国际版在线")
{
dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value = false;
BaseMsgForm.ShowError("店铺未登录", "JIT-操作失败");
return;
}
}
else
{
dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value = false;
BaseMsgForm.ShowError("JIT卡密过期或未开通", "JIT-操作失败");
return;
}
}
dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value = !(bool)dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value;
break;
default:
break;
}
}
private void shopLoginForm_SaveComplete(object obj)
@@ -471,7 +532,7 @@ namespace TemuKJD.KJDForms.ProductForms
{
shopIndex++;
ShopLoginInfo shop = null;
if (IsAdmin)
if (!IsClientJit)
shop = lstAdminShopInfo.FirstOrDefault(s => shopId == s.ShopId);
else
shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => shopId == s.ShopId);
@@ -479,10 +540,10 @@ namespace TemuKJD.KJDForms.ProductForms
continue;
// 检测是否掉线
if (IsAdmin)
if (!IsClientJit)
AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
else
ShopListForm.Instance.CheckShopLogin(new string[] { shop.ShopAccount }, false);
ShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
if (shop.LoginStatus2 != "国际版在线")
{
@@ -511,10 +572,10 @@ namespace TemuKJD.KJDForms.ProductForms
var searchRst = this.SearchForChainSupplier(shop, page, pageSize, null, searchSpuIds, searchExtCodes, type, startTime, endTime);
if (searchRst.Contains("登录过期") || searchRst.Contains("Invalid Login State"))
{
if (IsAdmin)
if (!IsClientJit)
AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
else
ShopListForm.Instance.CheckShopLogin(new string[] { shop.ShopAccount }, false);
ShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
Invoke(new Action(() =>
{
displayShopStatus(shop);
@@ -964,7 +1025,7 @@ Content-Disposition: form-data; name=""upload_sign""
string skcId = dgvOpenJit.Rows[e.RowIndex].Cells["colProdSkc"].Value.ParseToString();
string accountId = dgvOpenJit.Rows[e.RowIndex].Cells["colSupplierId"].Value.ParseToString();
ShopLoginInfo shop = null;
if (IsAdmin)
if (!IsClientJit)
shop = lstAdminShopInfo.FirstOrDefault(v => v.ShopId == accountId);
else
shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.ShopId == accountId);
@@ -1090,6 +1151,7 @@ Content-Disposition: form-data; name=""upload_sign""
}
}
break;
case "库存":
case "修改库存":
{
var product = lstProductInfo.FirstOrDefault(p => p.productId.ParseToString() == prodId);
@@ -1490,7 +1552,7 @@ Content-Disposition: form-data; name=""upload_sign""
string skcId = dgvRow.Cells["colProdSkc"].Value.ParseToString();
string accountId = dgvRow.Cells["colSupplierId"].Value.ParseToString();
ShopLoginInfo shop = null;
if (IsAdmin)
if (!IsClientJit)
shop = lstAdminShopInfo.FirstOrDefault(v => v.ShopId == accountId);
else
shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.ShopId == accountId);
@@ -2093,7 +2155,7 @@ Content-Disposition: form-data; name=""upload_sign""
{
shopIndex++;
ShopLoginInfo shop = null;
if (IsAdmin)
if (!IsClientJit)
shop = lstAdminShopInfo.FirstOrDefault(s => shopId == s.ShopId);
else
shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => shopId == s.ShopId);
@@ -2101,10 +2163,10 @@ Content-Disposition: form-data; name=""upload_sign""
continue;
// 检测是否掉线
if (IsAdmin)
if (!IsClientJit)
AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
else
ShopListForm.Instance.CheckShopLogin(new string[] { shop.ShopAccount }, false);
ShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
if (shop.LoginStatus2 != "国际版在线")
{
@@ -2133,10 +2195,10 @@ Content-Disposition: form-data; name=""upload_sign""
var productReceiveAreaLstRst = this.GetProductReceiveAreaList(shop, page, pageSize);
if (productReceiveAreaLstRst.Contains("登录过期") || productReceiveAreaLstRst.Contains("Invalid Login State"))
{
if (IsAdmin)
if (!IsClientJit)
AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
else
ShopListForm.Instance.CheckShopLogin(new string[] { shop.ShopAccount }, false);
ShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
Invoke(new Action(() =>
{
displayShopStatus(shop);