其他平台买手拍单发送功能 店铺筛选功能逻辑优化

This commit is contained in:
wule committed 2026-05-15 19:27:52 +08:00
1 parent 2dece676c1
commit aa45b35145
46 files changed
+4038 -2223

No files matched your search

+93 -29
View File
@@ -150,11 +150,15 @@ namespace TemuKJD.WXForms.ShopForms
BindShop(shopEntity, selectIds);
}
cmbFilterShopNotes.Items.Clear();
//cmbFilterShopNotes.Items.Add("");
foreach (var note in GlobalConfig.ShopLoginList.Select(s => s.Notes).Where(s => !s.IsNullOrEmpty()).Distinct())
{
cmbFilterShopNotes.Items.Add(note);
}
cmbFilterShopGroup.Items.Clear();
foreach (var note in GlobalConfig.ShopLoginList.Select(s => s.GroupName).Where(s => !s.IsNullOrEmpty()).Distinct())
{
cmbFilterShopGroup.Items.Add(note);
}
}
private void BindShop(ShopLoginInfo shopEntity, List<string> selectShopId = null, string msg = "")
@@ -179,9 +183,10 @@ namespace TemuKJD.WXForms.ShopForms
shopEntity.ShopId,
shopEntity.ShopAccount,
shopEntity.Notes,
shopEntity.GroupName,
"选择商品",
canUse ? "在线" : "掉线",
"", //lstShopAuthInfo.FirstOrDefault(sa => sa.ShopId == shopEntity.ShopId)?.ExpiresTime > DateTime.Now.AddMinutes(5) ? "可用" : "过期",
GlobalConfig.lstWxShopAuthInfo.FirstOrDefault(sa => sa.ShopId == shopEntity.ShopId)?.ExpiresTime > DateTime.Now.AddMinutes(5) ? "可用" : "过期",
canUse,
shopEntity.AddProductRemaining,
"",
@@ -194,10 +199,11 @@ namespace TemuKJD.WXForms.ShopForms
row.Cells["colShopLoginName"].Value = shopEntity.LoginName;
row.Cells["colShopName"].Value = shopEntity.ShopAccount;
row.Cells["colShopNotes"].Value = shopEntity.Notes;
row.Cells["colGroup"].Value = shopEntity.GroupName;
row.Cells["colLoginStatus"].Value = canUse ? "在线" : "掉线";
row.Cells["colLoginStatus"].Style.ForeColor = canUse ? Color.Green : Color.Red;
row.Cells["colCanUse"].Value = canUse;
row.Cells["colApi"].Value = ""; //lstShopAuthInfo.FirstOrDefault(sa => sa.ShopId == shopEntity.ShopId)?.ExpiresTime > DateTime.Now.AddMinutes(5) ? "可用" : "过期";
row.Cells["colApi"].Value = GlobalConfig.lstWxShopAuthInfo.FirstOrDefault(sa => sa.ShopId == shopEntity.ShopId)?.ExpiresTime > DateTime.Now.AddMinutes(5) ? "可用" : "过期";
row.Cells["colRemaining"].Value = shopEntity.AddProductRemaining;
row.Cells["colMessage"].Value = msg;
}
@@ -296,13 +302,18 @@ namespace TemuKJD.WXForms.ShopForms
private void btnFilterShop_Click(object sender, EventArgs e)
{
foreach(DataGridViewRow row in dgvShop.Rows)
{
string notes = cmbFilterShopNotes.Text.Trim().Trim(';');
if (notes == "全部")
notes = "";
List<string> notesLst = notes.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
string notes = cmbFilterShopNotes.Text.Trim().Trim(';');
if (notes == "全部")
notes = "";
List<string> notesLst = notes.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
string group = cmbFilterShopGroup.Text.Trim().Trim(';');
if (group == "全部")
group = "";
List<string> groupLst = group.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
foreach (DataGridViewRow row in dgvShop.Rows)
{
if (!row.Cells["colShopName"].Value.ParseToString().Contains(txtFilterShopName.Text.Trim()))
{
row.Visible = false;
@@ -315,6 +326,12 @@ namespace TemuKJD.WXForms.ShopForms
row.Cells["colSelect"].Value = false;
continue;
}
if (!string.IsNullOrWhiteSpace(group) && !groupLst.Contains(row.Cells["colGroup"].Value.ParseToString()))
{
row.Visible = false;
row.Cells["colSelect"].Value = false;
continue;
}
row.Visible = true;
}
}
@@ -323,6 +340,7 @@ namespace TemuKJD.WXForms.ShopForms
{
txtFilterShopName.Text = "";
cmbFilterShopNotes.Text = "全部";
cmbFilterShopGroup.Text = "全部";
btnFilterShop_Click(null, null);
}
@@ -342,16 +360,24 @@ namespace TemuKJD.WXForms.ShopForms
notes = "";
List<string> notesLst = notes.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
string group = cmbFilterShopGroup.Text.Trim().Trim(';');
if (group == "全部")
group = "";
List<string> groupLst = group.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
foreach (DataGridViewRow row in dgvShop.Rows)
{
if (row.Visible == true)
{
if (row.Cells["colShopName"].Value.ParseToString().Contains(txtFilterShopName.Text.Trim()) &&
(string.IsNullOrWhiteSpace(notes) || notesLst.Contains(row.Cells["colShopNotes"].Value.ParseToString())))
{
row.Cells["colSelect"].Value = true;
}
}
if (row.Visible == false)
continue;
if (!row.Cells["colShopName"].Value.ParseToString().Contains(txtFilterShopName.Text.Trim()))
continue;
if (!string.IsNullOrWhiteSpace(notes) && !notesLst.Contains(row.Cells["colShopNotes"].Value.ParseToString()))
continue;
if (!string.IsNullOrWhiteSpace(group) && !groupLst.Contains(row.Cells["colGroup"].Value.ParseToString()))
continue;
row.Cells["colSelect"].Value = true;
}
}
@@ -362,16 +388,24 @@ namespace TemuKJD.WXForms.ShopForms
notes = "";
List<string> notesLst = notes.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
string group = cmbFilterShopGroup.Text.Trim().Trim(';');
if (group == "全部")
group = "";
List<string> groupLst = group.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
foreach (DataGridViewRow row in dgvShop.Rows)
{
if (row.Visible == true)
{
if (row.Cells["colShopName"].Value.ParseToString().Contains(txtFilterShopName.Text.Trim()) &&
(string.IsNullOrWhiteSpace(notes) || notesLst.Contains(row.Cells["colShopNotes"].Value.ParseToString())))
{
row.Cells["colSelect"].Value = false;
}
}
if (row.Visible == false)
continue;
if (!row.Cells["colShopName"].Value.ParseToString().Contains(txtFilterShopName.Text.Trim()))
continue;
if (!string.IsNullOrWhiteSpace(notes) && !notesLst.Contains(row.Cells["colShopNotes"].Value.ParseToString()))
continue;
if (!string.IsNullOrWhiteSpace(group) && !groupLst.Contains(row.Cells["colGroup"].Value.ParseToString()))
continue;
row.Cells["colSelect"].Value = false;
}
}
@@ -1967,7 +2001,7 @@ namespace TemuKJD.WXForms.ShopForms
return;
}
orderId = orderId.Split(new string[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
if (!string.IsNullOrEmpty(orderId))
if (string.IsNullOrEmpty(orderId))
{
BaseMsgForm.ShowError("缺少订单编号无法补发!");
return;
@@ -1981,18 +2015,18 @@ namespace TemuKJD.WXForms.ShopForms
var orderId = row.Cells[$"colDgv{dgvNum}OrderId"].Value.ParseToString();
if (orderId.Contains("未获取到对应订单号"))
{
BaseMsgForm.ShowError("缺少单编号无法补发!");
BaseMsgForm.ShowError("缺少单编号无法备注!");
return;
}
if (orderId.Contains("获取到多条订单号"))
{
BaseMsgForm.ShowError("订单编号不符合补发条件!");
BaseMsgForm.ShowError("订单编号不符合备注条件!");
return;
}
orderId = orderId.Split(new string[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
if (string.IsNullOrEmpty(orderId))
{
BaseMsgForm.ShowError("缺少订单编号无法补发!");
BaseMsgForm.ShowError("缺少订单编号无法备注!");
return;
}
pnlUpdateRemark.Tag = row.Cells[$"colDgv{dgvNum}Remark"];
@@ -2069,6 +2103,36 @@ namespace TemuKJD.WXForms.ShopForms
lblShopName.Text = "";
pnlUpdateRemark.Visible = false;
}
private void btnFilter_Click(object sender, EventArgs e)
{
var orderId = txtFilterOrderId.Text.Trim();
List<DataGridView> dgvList = new List<DataGridView>() { dgvData1, dgvData2, dgvData3, dgvData4, dgvData5 };
for (int i = 0; i < dgvList.Count; i++)
{
var dgvNum = i + 1;
foreach (DataGridViewRow row in dgvList[i].Rows)
{
if (row.Cells[$"colDgv{dgvNum}OrderId"].Value.ParseToString().Contains(orderId))
row.Visible = true;
else
row.Visible = false;
}
}
}
private void btnRestoreFilter_Click(object sender, EventArgs e)
{
txtFilterOrderId.Text = "";
List<DataGridView> dgvList = new List<DataGridView>() { dgvData1, dgvData2, dgvData3, dgvData4, dgvData5 };
for (int i = 0; i< dgvList.Count; i++)
{
foreach(DataGridViewRow row in dgvList[i].Rows)
{
row.Visible = true;
}
}
}
}
public static class ShopOptimize