1店铺登录逻辑优化 2备货单查询显示
This commit is contained in:
1 parent
89eb9ce9d4
commit
862ad088f5
216 files changed
+3481
-1543
No files matched your search
@@ -1,8 +1,8 @@
|
||||
using AllBase;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model.Result;
|
||||
using LittleRabbit.Extension;
|
||||
using LittleRabbit.LittleRabbitForms.BaseForms;
|
||||
using TemuKJD.Extension;
|
||||
using TemuKJD.KJDForms.BaseForms;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Work.DouyinApiClass;
|
||||
|
||||
namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
namespace TemuKJD.KJDForms.UploadForms
|
||||
{
|
||||
public partial class StockSyncForm : Form
|
||||
{
|
||||
@@ -49,17 +49,17 @@ namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
private void RefreshShop()
|
||||
{
|
||||
// 更新选中的上货店铺Id
|
||||
lstShopId = lstShopId.Where(id => GlobalConfig.DouShopLoginList.Any(s => s.ShopAccountId == id && s.LoginStatus == "已授权")).ToList();
|
||||
lstShopId = lstShopId.Where(id => GlobalConfig.ShopLoginList.Any(s => s.ShopId == id && s.LoginStatus == "已授权")).ToList();
|
||||
// 获取被删除的店铺
|
||||
List<DataGridViewRow> dgvRowList = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
|
||||
=> !GlobalConfig.DouShopLoginList.Any(s => s.ShopAccountId == row.Cells["colShopId"]?.Value?.ToString())).ToList();
|
||||
=> !GlobalConfig.ShopLoginList.Any(s => s.ShopId == row.Cells["colShopId"]?.Value?.ToString())).ToList();
|
||||
// 更新被删除的店铺列表
|
||||
foreach (var row in dgvRowList)
|
||||
{
|
||||
dgvShop.Rows.Remove(row);
|
||||
}
|
||||
// 绑定其他店铺(含新导入的店铺)
|
||||
foreach (DouShopLoginInfo shopEntity in GlobalConfig.DouShopLoginList)
|
||||
foreach (DouShopLoginInfo shopEntity in GlobalConfig.ShopLoginList)
|
||||
{
|
||||
BindShop(shopEntity);
|
||||
}
|
||||
@@ -67,12 +67,12 @@ namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
|
||||
private void BindShop(DouShopLoginInfo shopEntity)
|
||||
{
|
||||
var row = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(p => p.Cells.GetCellValueFromColumnName("colShopId").ParseToString() == shopEntity.ShopAccountId);
|
||||
var row = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(p => p.Cells.GetCellValueFromColumnName("colShopId").ParseToString() == shopEntity.ShopId);
|
||||
if (row == null)
|
||||
{
|
||||
this.dgvShop.Rows.Add(
|
||||
false,
|
||||
shopEntity.ShopAccountId,
|
||||
shopEntity.ShopId,
|
||||
shopEntity.ShopAccount,
|
||||
shopEntity.ApiAuthStatus == "授权成功" ? true : false,
|
||||
"查看详情",
|
||||
@@ -84,7 +84,7 @@ namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
}
|
||||
else
|
||||
{
|
||||
row.Cells["colSelect"].Value = lstShopId.Contains(shopEntity.ShopAccountId);
|
||||
row.Cells["colSelect"].Value = lstShopId.Contains(shopEntity.ShopId);
|
||||
row.Cells["colShopName"].Value = shopEntity.ShopAccount;
|
||||
row.Cells["colCanUse"].Value = shopEntity.ApiAuthStatus == "授权成功" ? true : false;
|
||||
row.Cells["colOnSaleCount"].Value = shopEntity.OnlineProductCount >= 0 ? shopEntity.OnlineProductCount.ToString() : "";
|
||||
@@ -105,7 +105,7 @@ namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
else
|
||||
{
|
||||
lstShopId.Clear();
|
||||
var list = GlobalConfig.DouShopLoginList.Where(s => s.ApiAuthStatus == "授权成功").Select(ss => ss.ShopAccountId);
|
||||
var list = GlobalConfig.ShopLoginList.Where(s => s.ApiAuthStatus == "授权成功").Select(ss => ss.ShopId);
|
||||
lstShopId.AddRange(list);
|
||||
foreach (DataGridViewRow row in dgvShop.Rows)
|
||||
{
|
||||
@@ -148,7 +148,7 @@ namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
void GetShopProduct(bool isShowProgress = true)
|
||||
{
|
||||
int i = 0;
|
||||
var shopList = GlobalConfig.DouShopLoginList.Where(s => s.ApiAuthStatus == "授权成功" && lstShopId.Contains(s.ShopAccountId));
|
||||
var shopList = GlobalConfig.ShopLoginList.Where(s => s.ApiAuthStatus == "授权成功" && lstShopId.Contains(s.ShopId));
|
||||
foreach (var shop in shopList)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
@@ -180,7 +180,7 @@ namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
DataGridViewRow row = null;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopAccountId);
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
|
||||
if (row != null)
|
||||
{
|
||||
if (isShowResult)
|
||||
@@ -319,14 +319,14 @@ namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
this.statusBar.pgbTaskProgress.Maximum = total;
|
||||
}));
|
||||
|
||||
var shop = GlobalConfig.DouShopLoginList.FirstOrDefault(s => s.ShopAccountId == shopId);
|
||||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
|
||||
if (shop == null)
|
||||
continue;
|
||||
|
||||
DataGridViewRow row = null;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopAccountId);
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
|
||||
if (row != null) { row.Cells["colStatus"].Value = "正在设置库存"; }
|
||||
}));
|
||||
|
||||
@@ -350,7 +350,7 @@ namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
currentNum += pageSize;
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
{
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopAccountId);
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
|
||||
if (row != null) { Invoke(new Action(() => { row.Cells["colStatus"].Value = "下架中断"; })); }
|
||||
break;
|
||||
}
|
||||
@@ -371,7 +371,7 @@ namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopAccountId);
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
|
||||
if (row != null)
|
||||
{
|
||||
row.Cells["colOnSaleCount"].Value = totalNumBase;
|
||||
@@ -382,7 +382,7 @@ namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
offSaleMessage = "设置结束,店铺没有在售的商品";
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopAccountId);
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
|
||||
if (row != null) { row.Cells["colStatus"].Value = offSaleMessage; }
|
||||
}));
|
||||
break;
|
||||
@@ -401,7 +401,7 @@ namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
offSaleMessage = "正在获取商品,第" + currentNum + "件商品,共" + operateCount + "件商品";
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopAccountId);
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
|
||||
if (row != null) { row.Cells["colStatus"].Value = offSaleMessage; }
|
||||
}));
|
||||
}
|
||||
@@ -418,7 +418,7 @@ namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
offSaleMessage = ("设置库存失败," + failMessage).TrimEnd(',');
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopAccountId);
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
|
||||
if (row != null) { row.Cells["colStatus"].Value = offSaleMessage; }
|
||||
}));
|
||||
}
|
||||
@@ -439,7 +439,7 @@ namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
{
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
{
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopAccountId);
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
|
||||
if (row != null) { Invoke(new Action(() => { row.Cells["colStatus"].Value = "设置库存中断"; })); }
|
||||
break;
|
||||
}
|
||||
@@ -447,7 +447,7 @@ namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
offSaleMessage = "正在设置库存,第 " + (i + 1) + " 件商品,共" + operateCount + "件商品";
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopAccountId);
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
|
||||
if (row != null) { row.Cells["colStatus"].Value = offSaleMessage; }
|
||||
}));
|
||||
Thread.Sleep(50);
|
||||
@@ -499,7 +499,7 @@ namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
}
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopAccountId);
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
|
||||
if (row != null) { row.Cells["colStatus"].Value = offSaleMessage; }
|
||||
}));
|
||||
Thread.Sleep(Randomx.GetId(100, 200));
|
||||
@@ -514,7 +514,7 @@ namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
offSaleMessage = "设置库存完成";
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopAccountId);
|
||||
row = this.dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
|
||||
if (row != null) { row.Cells["colStatus"].Value = offSaleMessage; }
|
||||
}));
|
||||
}
|
||||
@@ -580,7 +580,7 @@ namespace LittleRabbit.LittleRabbitForms.UploadForms
|
||||
string headerText = dgvShop.Columns[e.ColumnIndex].HeaderText;
|
||||
long shopId = dgvShop.Rows[e.RowIndex].Cells["colShopId"].Value.ParseToLong();
|
||||
string shopName = dgvShop.Rows[e.RowIndex].Cells["colShopId"].Value.ToString();
|
||||
var shop = GlobalConfig.DouShopLoginList.FirstOrDefault(s => s.ShopAccountId == shopId.ToString());
|
||||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId.ToString());
|
||||
switch (headerText)
|
||||
{
|
||||
case "操作":
|
||||
|
||||
Reference in new issue
Block a user