待上传列表查询 批量上传到草稿箱功能

This commit is contained in:
wule committed 2025-07-18 09:25:19 +08:00
1 parent f2135af339
commit 13f536e840
31 files changed
+3881 -635

No files matched your search

+2 -1
View File
@@ -8,4 +8,5 @@ packages
.user
bin
.zip
.rar
.rar
*.zip
+1
View File
@@ -189,6 +189,7 @@
<Compile Include="Model\Param\DyProductManage\ViolateRuleParam.cs" />
<Compile Include="Model\Param\SalesManage\PromotionAddParam.cs" />
<Compile Include="Model\Param\ShopManage\DouShopSettingParam.cs" />
<Compile Include="Model\Result\TemuDBProductSelect.cs" />
<Compile Include="Model\Result\TemuPriceAdjustInfo.cs" />
<Compile Include="Model\Result\TemuProductInfo.cs" />
<Compile Include="Model\Param\TemuProductManage\TemuProductParam.cs" />
+1 -1
View File
@@ -110,7 +110,7 @@ namespace AllBase.Model.Result
/// </summary>
public AuthInfo BuyApiAuth { get; set; } = new AuthInfo();
/// <summary>
/// 子账户
/// 主账户
/// </summary>
public string UserName { get; set; }
/// <summary>
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AllBase.Model.Result
{
/// <summary>
/// 用户选品结果
/// </summary>
public class TemuDBProductSelect
{
public int id { get; set; }
public string out_product_Id { get; set; }
public string shop_id { get; set; }
public string shop_account { get; set; }
public string user_name { get; set; }
public string sub_user_name { get; set; }
public string notes { get; set; }
public string status { get; set; }
public string draft_id { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
#region 外键连接属性
public string cat_id { get; set; }
public string cat_name { get; set; }
public string ext_code { get; set; }
public string product_name { get; set; }
public string main_img { get; set; }
public string spu_id { get; set; }
public string skc_id { get; set; }
#endregion
}
}
+212 -21
View File
@@ -1,6 +1,7 @@
using KJD_Web.Model;
using KJD_Web.Utils;
using MySql.Data.MySqlClient;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Data;
@@ -62,12 +63,11 @@ namespace KJD_Web.BLL
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetProductList(string inputData, bool isAdmin = false)
public string GetProductList(string inputData, bool isDetail = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":20000,\"msg\":\"校验失败\"}";
@@ -80,14 +80,10 @@ namespace KJD_Web.BLL
var search_ext_code = RegexUtils.GetStringQuery(ref inputData, "search_ext_code")?.Replace("'", "\\'");
var search_prod_name = RegexUtils.GetStringQuery(ref inputData, "search_prod_name")?.Replace("'", "\\'");
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes")?.Replace("'", "\\'");
var s_page = RegexUtils.GetStringQuery(ref inputData, "page");
int page = 0;
int.TryParse(s_page, out page);
var s_page_size = RegexUtils.GetStringQuery(ref inputData, "page_size");
int page_size;
int.TryParse(s_page_size, out page_size);
if (page_size == 0)
page_size = 50;
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size= RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
@@ -105,6 +101,8 @@ namespace KJD_Web.BLL
sql += " and product_name like '%" + search_prod_name + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
sql += " and notes like '%" + search_notes + "%'";
if (!string.IsNullOrEmpty(search_db_ids))
sql += " and id in (" + search_db_ids + ")";
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
@@ -114,7 +112,11 @@ namespace KJD_Web.BLL
}
else
{
sql = "select id,spu_id,skc_id,cat_id,cat_name,ext_code,product_name,main_img,notes,add_time,mdy_time from kjd.product where 1=1";
if (isDetail)
sql = "select * from kjd.product where 1=1";
else
sql = "select id,spu_id,skc_id,cat_id,cat_name,ext_code,product_name,main_img,notes,add_time,mdy_time from kjd.product where 1=1";
if (!string.IsNullOrWhiteSpace(search_spu))
sql += " and spu_id like '%" + search_spu + "%'";
if (!string.IsNullOrWhiteSpace(search_skc))
@@ -127,6 +129,8 @@ namespace KJD_Web.BLL
sql += " and product_name like '%" + search_prod_name + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
sql += " and notes like '%" + search_notes + "%'";
if (!string.IsNullOrEmpty(search_db_ids))
sql += " and id in (" + search_db_ids + ")";
sql += " order by id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
@@ -156,6 +160,11 @@ namespace KJD_Web.BLL
mdy_time = Convert.ToDateTime(row["mdy_time"]),
notes = row["notes"].ToString(),
};
if (isDetail)
{
prod.product_json = row["product_json"].ToString();
prod.size_json = row["size_json"].ToString();
}
productLst.Add(prod);
}
var data = JsonUtils.SerializerObjectToString(productLst);
@@ -163,12 +172,12 @@ namespace KJD_Web.BLL
}
catch (Exception ex)
{
return "{\"code\":200,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
else
{
return "{\"code\":200,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
@@ -178,8 +187,7 @@ namespace KJD_Web.BLL
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":20000,\"msg\":\"校验失败\"}";
@@ -208,8 +216,7 @@ namespace KJD_Web.BLL
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":20000,\"msg\":\"校验失败\"}";
@@ -250,8 +257,7 @@ namespace KJD_Web.BLL
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":20000,\"msg\":\"校验失败\"}";
@@ -270,7 +276,7 @@ namespace KJD_Web.BLL
}
if (string.IsNullOrEmpty(shop_id))
{
return "{\"code\":500,\"msg\":\"店铺信息\"}";
return "{\"code\":500,\"msg\":\"没有店铺信息\"}";
}
@@ -294,5 +300,190 @@ namespace KJD_Web.BLL
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyUserSelectProductStatus(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":20000,\"msg\":\"校验失败\"}";
var id = RegexUtils.GetStringQuery(ref inputData, "db_id");
var draft_id = RegexUtils.GetStringQuery(ref inputData, "draft_id");
var status = RegexUtils.GetStringQuery(ref inputData, "status");
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update kjd.product_select set";
if (draft_id != null)
sql += " draft_id='" + draft_id + "',";
if (status != null)
sql += " status='" + status + "',";
sql += " mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
sql += " where id=" + id + ";";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetUserSelectProductList(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":20000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids")?.Replace("'", "\\'");
var search_shop_id = RegexUtils.GetStringQuery(ref inputData, "search_shop_id")?.Replace("'", "\\'");
var search_shop_account = RegexUtils.GetStringQuery(ref inputData, "search_shop_account")?.Replace("'", "\\'");
var search_spu = RegexUtils.GetStringQuery(ref inputData, "search_spu")?.Replace("'", "\\'");
var search_skc = RegexUtils.GetStringQuery(ref inputData, "search_skc")?.Replace("'", "\\'");
var search_cat = RegexUtils.GetStringQuery(ref inputData, "search_cat")?.Replace("'", "\\'");
var search_ext_code = RegexUtils.GetStringQuery(ref inputData, "search_ext_code")?.Replace("'", "\\'");
var search_prod_name = RegexUtils.GetStringQuery(ref inputData, "search_prod_name")?.Replace("'", "\\'");
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes")?.Replace("'", "\\'");
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(s.id) from kjd.product_select s left join kjd.product p on s.out_product_id=p.id" +
" where 1=1";
if (!isAdmin)
sql += " and (s.user_name='" + user_name + "' or s.sub_user_name like'%" + user_name + "%')";
if (!string.IsNullOrEmpty(search_db_ids))
sql += " and s.id in (" + search_db_ids + ")";
if (!string.IsNullOrEmpty(shop_ids))
sql += " and s.shop_id in (" + shop_ids + ")";
if (!string.IsNullOrWhiteSpace(status))
sql += " and s.status = '" + status + "'";
if (!string.IsNullOrWhiteSpace(search_shop_id))
sql += " and s.shop_id like '%" + search_shop_id + "%'";
if (!string.IsNullOrWhiteSpace(search_shop_account))
sql += " and s.shop_account like '%" + search_shop_account + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
sql += " and s.notes like '%" + search_notes + "%'";
if (!string.IsNullOrWhiteSpace(search_spu))
sql += " and p.spu_id like '%" + search_spu + "%'";
if (!string.IsNullOrWhiteSpace(search_skc))
sql += " and p.skc_id like '%" + search_skc + "%'";
if (!string.IsNullOrWhiteSpace(search_cat))
sql += " and p.cat_name like '%" + search_cat + "%'";
if (!string.IsNullOrWhiteSpace(search_ext_code))
sql += " and p.ext_code like '%" + search_ext_code + "%'";
if (!string.IsNullOrWhiteSpace(search_prod_name))
sql += " and p.product_name like '%" + search_prod_name + "%'";
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
//if (isDetail)
//sql = "select * from kjd.product_select where 1=1";
//else
sql = "select s.id,s.out_product_id,s.shop_id,s.shop_account,s.user_name," +
"s.sub_user_name,s.notes,s.status,s.draft_id,s.add_time,s.mdy_time," +
"p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img " +
"from kjd.product_select s left join kjd.product p on s.out_product_id=p.id where 1=1";
if (!isAdmin)
sql += " and (s.user_name='" + user_name + "' or s.sub_user_name like'%" + user_name + "%')";
if (!string.IsNullOrEmpty(search_db_ids))
sql += " and s.id in (" + search_db_ids + ")";
if (!string.IsNullOrEmpty(shop_ids))
sql += " and s.shop_id in (" + shop_ids + ")";
if (!string.IsNullOrWhiteSpace(status))
sql += " and s.status = '" + status + "'";
if (!string.IsNullOrWhiteSpace(search_shop_id))
sql += " and s.shop_id like '%" + search_shop_id + "%'";
if (!string.IsNullOrWhiteSpace(search_shop_account))
sql += " and s.shop_account like '%" + search_shop_account + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
sql += " and s.notes like '%" + search_notes + "%'";
if (!string.IsNullOrWhiteSpace(search_spu))
sql += " and p.spu_id like '%" + search_spu + "%'";
if (!string.IsNullOrWhiteSpace(search_skc))
sql += " and p.skc_id like '%" + search_skc + "%'";
if (!string.IsNullOrWhiteSpace(search_cat))
sql += " and p.cat_name like '%" + search_cat + "%'";
if (!string.IsNullOrWhiteSpace(search_ext_code))
sql += " and p.ext_code like '%" + search_ext_code + "%'";
if (!string.IsNullOrWhiteSpace(search_prod_name))
sql += " and p.product_name like '%" + search_prod_name + "%'";
sql += " order by id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
try
{
List<ProductSelectResultParam> productLst = new List<ProductSelectResultParam>();
foreach (DataRow row in dt.Rows)
{
ProductSelectResultParam prodSelect = new ProductSelectResultParam()
{
id = row["id"].ParseToInt(),
out_product_Id = row["out_product_Id"].ParseToString(),
shop_account = row["shop_account"].ParseToString(),
shop_id = row["shop_id"].ParseToString(),
status = row["status"].ParseToString(),
sub_user_name = row["sub_user_name"].ParseToString(),
user_name = row["user_name"].ParseToString(),
cat_id = row["cat_id"].ParseToString(),
cat_name = row["cat_name"].ParseToString(),
product_name = row["product_name"].ParseToString(),
main_img = row["main_img"].ParseToString(),
ext_code = row["ext_code"].ParseToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
notes = row["notes"].ParseToString(),
draft_id = row["draft_id"].ParseToString(),
skc_id = row["skc_id"].ToString(),
spu_id = row["spu_id"].ToString(),
//product_json = row["product_json"].ToString(),
//size_json = row["size_json"].ToString(),
};
productLst.Add(prodSelect);
}
var data = JsonUtils.SerializerObjectToString(productLst);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
}
@@ -115,6 +115,15 @@
<SubType>Component</SubType>
</Compile>
<Compile Include="Utils\EncrypUtil.cs" />
<Compile Include="Utils\Extension\Extension.Convert.cs" />
<Compile Include="Utils\Extension\Extension.Enum.cs" />
<Compile Include="Utils\Extension\Extension.Exception.cs" />
<Compile Include="Utils\Extension\Extension.Linq.cs" />
<Compile Include="Utils\Extension\Extension.Validate.cs" />
<Compile Include="Utils\Helper\HtmlHelper.cs" />
<Compile Include="Utils\Helper\JsonHelper.cs" />
<Compile Include="Utils\Helper\ReflectionHelper.cs" />
<Compile Include="Utils\Helper\RegexHelper.cs" />
<Compile Include="Utils\HtmlUtils.cs" />
<Compile Include="Utils\JsonUtils.cs" />
<Compile Include="Utils\MySqlUtils.cs" />
@@ -19,7 +19,20 @@ namespace KJD_Web.Model
public string sub_user_name { get; set; }
public string notes { get; set; }
public string status { get; set; }
public string draft_id { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
#region 外键连接属性
public string cat_id { get; set; }
public string cat_name { get; set; }
public string ext_code { get; set; }
public string product_name { get; set; }
public string main_img { get; set; }
public string spu_id { get; set; }
public string skc_id { get; set; }
#endregion
}
}
@@ -60,6 +60,18 @@ namespace KJD_Web
Context.Response.End();
}
[WebMethod]
public void get_product_detail_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ProductManage().GetProductList(jsontext, true);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void add_product()
{
@@ -120,5 +132,42 @@ namespace KJD_Web
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void mdy_user_select_product_status()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ProductManage().MdyUserSelectProductStatus(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void get_user_select_product_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ProductManage().GetUserSelectProductList(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void admin_get_user_select_product_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ProductManage().GetUserSelectProductList(jsontext, true);
Context.Response.Write(result);
Context.Response.End();
}
}
}
@@ -0,0 +1,573 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
using NaiBa.Util.Helper;
using Newtonsoft.Json;
namespace NaiBa.Util.Extension
{
public static partial class Extensions
{
#region 转换为long
/// <summary>
/// 将object转换为long,若转换失败,则返回0。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static long ParseToLong(this object obj)
{
try
{
string str = obj.ParseToString();
if (string.IsNullOrEmpty(str))
{
return 0;
}
return long.Parse(str);
}
catch
{
return 0L;
}
}
/// <summary>
/// 将object转换为long,若转换失败,则返回指定值。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public static long ParseToLong(this string str, long defaultValue)
{
try
{
return long.Parse(str);
}
catch
{
return defaultValue;
}
}
#endregion
#region 转换为int
/// <summary>
/// 将object转换为int,若转换失败,则返回0。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static int ParseToInt(this object str)
{
try
{
return Convert.ToInt32(str);
}
catch
{
return 0;
}
}
public static int DecimalPointParseToInt(this object str)
{
try
{
string temp = str.ParseToString();
int i = temp.IndexOf('.');
if (i > 0)
{
temp = temp.Substring(0, i);
}
return Convert.ToInt32(temp);
}
catch
{
return 0;
}
}
/// <summary>
/// 将object转换为int,若转换失败,则返回指定值。不抛出异常。
/// null返回默认值
/// </summary>
/// <param name="str"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public static int ParseToInt(this object str, int defaultValue)
{
if (str == null)
{
return defaultValue;
}
try
{
return Convert.ToInt32(str);
}
catch
{
return defaultValue;
}
}
#endregion
#region 转换为short
/// <summary>
/// 将object转换为short,若转换失败,则返回0。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static short ParseToShort(this object obj)
{
try
{
return short.Parse(obj.ToString());
}
catch
{
return 0;
}
}
/// <summary>
/// 将object转换为short,若转换失败,则返回指定值。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static short ParseToShort(this object str, short defaultValue)
{
try
{
return short.Parse(str.ToString());
}
catch
{
return defaultValue;
}
}
#endregion
#region 转换为demical
/// <summary>
/// 将object转换为demical,若转换失败,则返回指定值。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static decimal ParseToDecimal(this object str, decimal defaultValue)
{
try
{
return decimal.Parse(str.ToString());
}
catch
{
return defaultValue;
}
}
/// <summary>
/// 将object转换为demical,若转换失败,则返回0。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static decimal ParseToDecimal(this object str)
{
try
{
return decimal.Parse(str.ToString());
}
catch
{
return 0;
}
}
#endregion
#region 转化为bool
/// <summary>
/// 将object转换为bool,若转换失败,则返回false。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static bool ParseToBool(this object str)
{
try
{
return bool.Parse(str.ToString());
}
catch
{
return false;
}
}
/// <summary>
/// 将object转换为bool,若转换失败,则返回指定值。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static bool ParseToBool(this object str, bool result)
{
try
{
return bool.Parse(str.ToString());
}
catch
{
return result;
}
}
#endregion
#region 转换为float
/// <summary>
/// 将object转换为float,若转换失败,则返回0。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static float ParseToFloat(this object str)
{
try
{
return float.Parse(str.ToString());
}
catch
{
return 0;
}
}
/// <summary>
/// 将object转换为float,若转换失败,则返回指定值。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static float ParseToFloat(this object str, float result)
{
try
{
return float.Parse(str.ToString());
}
catch
{
return result;
}
}
#endregion
#region 转换为Guid
/// <summary>
/// 将string转换为Guid,若转换失败,则返回Guid.Empty。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static Guid ParseToGuid(this string str)
{
try
{
return new Guid(str);
}
catch
{
return Guid.Empty;
}
}
#endregion
#region 转换为DateTime
/// <summary>
/// 将string转换为DateTime,若转换失败,则返回日期最小值。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static DateTime ParseToDateTime(this string str)
{
try
{
if (string.IsNullOrWhiteSpace(str))
{
return DateTime.MinValue;
}
if (str.Contains("-") || str.Contains("/"))
{
return DateTime.Parse(str);
}
else
{
int length = str.Length;
switch (length)
{
case 4:
return DateTime.ParseExact(str, "yyyy", System.Globalization.CultureInfo.CurrentCulture);
case 6:
return DateTime.ParseExact(str, "yyyyMM", System.Globalization.CultureInfo.CurrentCulture);
case 8:
return DateTime.ParseExact(str, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
case 10:
return DateTime.ParseExact(str, "yyyyMMddHH", System.Globalization.CultureInfo.CurrentCulture);
case 12:
return DateTime.ParseExact(str, "yyyyMMddHHmm", System.Globalization.CultureInfo.CurrentCulture);
case 14:
return DateTime.ParseExact(str, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
default:
return DateTime.ParseExact(str, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
}
}
}
catch
{
return DateTime.MinValue;
}
}
/// <summary>
/// 将string转换为DateTime,若转换失败,则返回默认值。
/// </summary>
/// <param name="str"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public static DateTime ParseToDateTime(this string str, DateTime? defaultValue)
{
try
{
if (string.IsNullOrWhiteSpace(str))
{
return defaultValue.GetValueOrDefault();
}
if (str.Contains("-") || str.Contains("/"))
{
return DateTime.Parse(str);
}
else
{
int length = str.Length;
switch (length)
{
case 4:
return DateTime.ParseExact(str, "yyyy", System.Globalization.CultureInfo.CurrentCulture);
case 6:
return DateTime.ParseExact(str, "yyyyMM", System.Globalization.CultureInfo.CurrentCulture);
case 8:
return DateTime.ParseExact(str, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
case 10:
return DateTime.ParseExact(str, "yyyyMMddHH", System.Globalization.CultureInfo.CurrentCulture);
case 12:
return DateTime.ParseExact(str, "yyyyMMddHHmm", System.Globalization.CultureInfo.CurrentCulture);
case 14:
return DateTime.ParseExact(str, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
default:
return DateTime.ParseExact(str, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
}
}
}
catch
{
return defaultValue.GetValueOrDefault();
}
}
#endregion
#region 转换为string
/// <summary>
/// 将object转换为string,若转换失败,则返回""。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static string ParseToString(this object obj)
{
try
{
if (obj == null)
{
return string.Empty;
}
else
{
return obj.ToString();
}
}
catch
{
return string.Empty;
}
}
public static string ParseToStrings<T>(this object obj, string split = ",")
{
try
{
var list = obj as IEnumerable<T>;
if (list != null)
{
return string.Join(split, list);
}
else
{
return obj.ToString();
}
}
catch
{
return string.Empty;
}
}
#endregion
#region 转换为double
/// <summary>
/// 将object转换为double,若转换失败,则返回0。不抛出异常。
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public static double ParseToDouble(this object obj)
{
try
{
return double.Parse(obj.ToString());
}
catch
{
return 0;
}
}
/// <summary>
/// 将object转换为double,若转换失败,则返回指定值。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public static double ParseToDouble(this object str, double defaultValue)
{
try
{
return double.Parse(str.ToString());
}
catch
{
return defaultValue;
}
}
#endregion
#region 字符串转指定类型Array
public static T[] SplitToArray<T>(this string value, string split = ",")
{
if (string.IsNullOrEmpty(value))
{
return default(T[]);
}
var arr = value.Split(new string[] { split }, StringSplitOptions.RemoveEmptyEntries).CastSuper<T>().ToArray();
return arr;
}
public static T[] SplitToArray<T>(this string value, string[] split)
{
if (string.IsNullOrEmpty(value))
{
return default(T[]);
}
var arr = value.Split(split, StringSplitOptions.RemoveEmptyEntries).CastSuper<T>().ToArray();
return arr;
}
#endregion
#region 字符串转指定类型List
public static List<T> SplitToList<T>(this string value, string split = ",")
{
if (string.IsNullOrEmpty(value))
{
return new List<T>();
}
var list = value.Split(new string[] { split }, StringSplitOptions.RemoveEmptyEntries).CastSuper<T>().ToList();
return list;
}
public static List<T> SplitToList<T>(this string value, string[] split)
{
if (string.IsNullOrEmpty(value))
{
return new List<T>();
}
var list = value.Split(split, StringSplitOptions.RemoveEmptyEntries).CastSuper<T>().ToList();
return list;
}
#endregion
#region 强制转换类型
/// <summary>
/// 强制转换类型
/// </summary>
/// <typeparam name="TResult"></typeparam>
/// <param name="source"></param>
/// <returns></returns>
public static IEnumerable<TResult> CastSuper<TResult>(this IEnumerable source)
{
foreach (object item in source)
{
yield return (TResult)Convert.ChangeType(item, typeof(TResult));
}
}
#endregion
#region Object转换为Json
public static string ParseToJson(this object obj)
{
return JsonConvert.SerializeObject(obj);
}
#endregion
#region Json转为Object
public static T ParseToObject<T>(this string json)
{
if (string.IsNullOrEmpty(json))
{
return Activator.CreateInstance<T>();
}
return JsonConvert.DeserializeObject<T>(json);
}
#endregion
#region 深拷贝(克隆出一个新对象,拷贝对象里面的数据和子对象)
public static T DeepClone<T>(this T o)
{
return o.ParseToJson().ParseToObject<T>();
// 这种方式在用 Obfuscator 的时候有问题
//using (MemoryStream stream = new MemoryStream())
//{
// BinaryFormatter formatter = new BinaryFormatter();
// formatter.Serialize(stream, o);
// stream.Position = 0;
// return (T)formatter.Deserialize(stream);
//}
}
#endregion
#region 浅拷贝(拷贝对象里面的数据[property and field],但不拷贝对象里面的子对象)
public static void ShadowClone<T1, T2>(this T1 source, ref T2 destination)
{
var sourceMembers = ReflectionHelper.GetMembers(source.GetType());
var destinationMembers = ReflectionHelper.GetMembers(destination.GetType());
// Copy data from source to destination
foreach (var sourceMember in sourceMembers)
{
if (!ReflectionHelper.CanRead(sourceMember))
{
continue;
}
var destinationMember = destinationMembers.FirstOrDefault(x => x.Name.ToLower() == sourceMember.Name.ToLower());
if (destinationMember == null || !ReflectionHelper.CanWrite(destinationMember))
{
continue;
}
ReflectionHelper.SetObjectValue(ref destination, destinationMember, ReflectionHelper.GetMemberValue(source, sourceMember));
}
}
#endregion
}
}
@@ -0,0 +1,114 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace NaiBa.Util.Extension
{
public static partial class Extensions
{
#region 枚举成员转成dictionary类型
/// <summary>
/// 转成dictionary类型
/// </summary>
/// <param name="enumType"></param>
/// <returns></returns>
public static Dictionary<int, string> EnumToDictionary(this Type enumType)
{
Dictionary<int, string> dictionary = new Dictionary<int, string>();
Type typeDescription = typeof(DescriptionAttribute);
FieldInfo[] fields = enumType.GetFields();
int sValue = 0;
string sText = string.Empty;
foreach (FieldInfo field in fields)
{
if (field.FieldType.IsEnum)
{
sValue = ((int)enumType.InvokeMember(field.Name, BindingFlags.GetField, null, null, null));
object[] arr = field.GetCustomAttributes(typeDescription, true);
if (arr.Length > 0)
{
DescriptionAttribute da = (DescriptionAttribute)arr[0];
sText = da.Description;
}
else
{
sText = field.Name;
}
dictionary.Add(sValue, sText);
}
}
return dictionary.OrderBy(p => p.Key).ToDictionary(p => p.Key, p => p.Value);
}
/// <summary>
/// 枚举成员转成键值对Json字符串
/// </summary>
/// <param name="enumType"></param>
/// <returns></returns>
public static string EnumToDictionaryString(this Type enumType)
{
List<KeyValuePair<int, string>> dictionaryList = EnumToDictionary(enumType).ToList();
var sJson = JsonConvert.SerializeObject(dictionaryList);
return sJson;
}
#endregion
#region 根据类型获取枚举的描述
/// <summary>
/// 获取枚举值对应的描述
/// </summary>
/// <param name="enumType"></param>
/// <returns></returns>
public static string GetDescription(this System.Enum enumType)
{
FieldInfo EnumInfo = enumType.GetType().GetField(enumType.ToString());
if (EnumInfo != null)
{
DescriptionAttribute[] EnumAttributes = (DescriptionAttribute[])EnumInfo.GetCustomAttributes(typeof(DescriptionAttribute), false);
if (EnumAttributes.Length > 0)
{
return EnumAttributes[0].Description;
}
}
return enumType.ToString();
}
#endregion
#region 根据值获取枚举的描述
public static string GetDescriptionByEnum<T>(this object obj)
{
var tEnum = System.Enum.Parse(typeof(T), obj.ParseToString()) as System.Enum;
var description = tEnum.GetDescription();
return description;
}
#endregion
#region 根据描述获取枚举值
public static int GetEnumValueByDescription<T>(this string description)
{
Dictionary<int, string> dict = typeof(T).EnumToDictionary();
int value = dict.Where(p => p.Value == description).Select(p => p.Key).FirstOrDefault();
return value;
}
#endregion
#region 根据枚举名称获取值
public static int GetEnumValueByName<T>(this string name)
{
return (int)System.Enum.Parse(typeof(T), name);
}
#endregion
#region 根据枚举值获取名称
public static object GetEnumNameByValue<T>(this int value)
{
return System.Enum.ToObject(typeof(T), value);
}
#endregion
}
}
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NaiBa.Util.Extension
{
public static partial class Extensions
{
public static Exception GetOriginalException(this Exception ex)
{
if (ex.InnerException == null) return ex;
return ex.InnerException.GetOriginalException();
}
}
}
@@ -0,0 +1,110 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace NaiBa.Util.Extension
{
public static class LinqExtensions
{
public static Expression Property(this Expression expression, string propertyName)
{
return Expression.Property(expression, propertyName);
}
public static Expression AndAlso(this Expression left, Expression right)
{
return Expression.AndAlso(left, right);
}
public static Expression Call(this Expression instance, string methodName, params Expression[] arguments)
{
return Expression.Call(instance, instance.Type.GetMethod(methodName), arguments);
}
public static Expression GreaterThan(this Expression left, Expression right)
{
return Expression.GreaterThan(left, right);
}
public static Expression<T> ToLambda<T>(this Expression body, params ParameterExpression[] parameters)
{
return Expression.Lambda<T>(body, parameters);
}
public static Expression<Func<T, bool>> True<T>() { return param => true; }
public static Expression<Func<T, bool>> False<T>() { return param => false; }
/// <summary>
/// 组合And
/// </summary>
/// <returns></returns>
public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> first, Expression<Func<T, bool>> second)
{
return first.Compose(second, Expression.AndAlso);
}
/// <summary>
/// 组合Or
/// </summary>
/// <returns></returns>
public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> first, Expression<Func<T, bool>> second)
{
return first.Compose(second, Expression.OrElse);
}
/// <summary>
/// Combines the first expression with the second using the specified merge function.
/// </summary>
static Expression<T> Compose<T>(this Expression<T> first, Expression<T> second, Func<Expression, Expression, Expression> merge)
{
var map = first.Parameters
.Select((f, i) => new { f, s = second.Parameters[i] })
.ToDictionary(p => p.s, p => p.f);
var secondBody = ParameterRebinder.ReplaceParameters(map, second.Body);
return Expression.Lambda<T>(merge(first.Body, secondBody), first.Parameters);
}
/// <summary>
/// ParameterRebinder
/// </summary>
private class ParameterRebinder : ExpressionVisitor
{
/// <summary>
/// The ParameterExpression map
/// </summary>
readonly Dictionary<ParameterExpression, ParameterExpression> map;
/// <summary>
/// Initializes a new instance of the <see cref="ParameterRebinder"/> class.
/// </summary>
/// <param name="map">The map.</param>
ParameterRebinder(Dictionary<ParameterExpression, ParameterExpression> map)
{
this.map = map ?? new Dictionary<ParameterExpression, ParameterExpression>();
}
/// <summary>
/// Replaces the parameters.
/// </summary>
/// <param name="map">The map.</param>
/// <param name="exp">The exp.</param>
/// <returns>Expression</returns>
public static Expression ReplaceParameters(Dictionary<ParameterExpression, ParameterExpression> map, Expression exp)
{
return new ParameterRebinder(map).Visit(exp);
}
/// <summary>
/// Visits the parameter.
/// </summary>
/// <param name="p">The p.</param>
/// <returns>Expression</returns>
protected override Expression VisitParameter(ParameterExpression p)
{
ParameterExpression replacement;
if (map.TryGetValue(p, out replacement))
{
p = replacement;
}
return base.VisitParameter(p);
}
}
}
}
@@ -0,0 +1,117 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using NaiBa.Util.Helper;
using Newtonsoft.Json.Linq;
namespace NaiBa.Util.Extension
{
public static partial class Extensions
{
public static bool IsNullOrEmpty(this object value)
{
if (value != null && !string.IsNullOrEmpty(value.ParseToString()))
{
return false;
}
else
{
return true;
}
}
public static bool IsNullOrZero(this object value)
{
if (value == null || string.IsNullOrEmpty(value.ParseToString()) || value.ParseToString().Trim() == "0")
{
return true;
}
else
{
return false;
}
}
public static bool IsNumericType(this object value)
{
if (value == null)
{
return false;
}
switch (Type.GetTypeCode(value.GetType()))
{
case TypeCode.Byte:
case TypeCode.SByte:
case TypeCode.UInt16:
case TypeCode.UInt32:
case TypeCode.UInt64:
case TypeCode.Int16:
case TypeCode.Int32:
case TypeCode.Int64:
case TypeCode.Decimal:
case TypeCode.Double:
case TypeCode.Single:
return true;
default:
return false;
}
}
public static bool IsStringType(this object value)
{
if (value == null)
{
return false;
}
switch (Type.GetTypeCode(value.GetType()))
{
case TypeCode.String:
return true;
default:
return false;
}
}
public static bool IsNumber(this string value)
{
return RegexHelper.IsNumber(value);
}
public static bool IsAlphabet(this string value)
{
return RegexHelper.IsAlphabet(value);
}
public static bool IsAlphabetOrNumber(this string value)
{
return RegexHelper.IsAlphabetOrNumber(value);
}
public static bool IsJson(this string value)
{
return JsonHelper.IsJson(value);
}
public static bool IsJTokenNullOrEmpty(this JToken token)
{
return (token == null) ||
(token.Type == JTokenType.Array && !token.HasValues) ||
(token.Type == JTokenType.Object && !token.HasValues) ||
(token.Type == JTokenType.String && token.ToString() == string.Empty) ||
(token.Type == JTokenType.Null);
}
public static bool IsAjaxRequest(this HttpRequest request)
{
if (request == null)
throw new ArgumentNullException("request");
if (request.Headers != null)
return request.Headers["X-Requested-With"] == "XMLHttpRequest";
return false;
}
}
}
@@ -0,0 +1,215 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web;
using NaiBa.Util.Extension;
namespace NaiBa.Util.Helper
{
public class HtmlHelper
{
public static string HtmlEncode(string html)
{
if (string.IsNullOrEmpty(html))
{
return string.Empty;
}
else
{
return HttpUtility.HtmlEncode(html);
}
}
public static string HtmlDecode(string url)
{
if (string.IsNullOrEmpty(url))
{
return string.Empty;
}
else
{
return HttpUtility.HtmlDecode(url);
}
}
/// <summary>
/// Unicode解码
/// </summary>
/// <param name="html"></param>
/// <returns></returns>
public static string UnicodeDecode(string html)
{
html = WebUtility.HtmlDecode(html);
Regex reUnicode = new Regex(@"\\u([0-9a-fA-F]{4})", RegexOptions.Compiled);
return reUnicode.Replace(html, m =>
{
short c;
if (short.TryParse(m.Groups[1].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out c))
{
return "" + (char)c;
}
return m.Value;
});
}
#region Resove
public static string Resove(string html, string prefix, string subfix = "")
{
int inl = html.IndexOf(prefix);
if (inl == -1)
{
prefix = prefix.Replace("\"", "'");
subfix = subfix.Replace("\"", "'");
inl = html.IndexOf(prefix);
}
if (inl == -1)
{
return null;
}
inl += prefix.Length;
if (!string.IsNullOrEmpty(subfix))
{
int inl2 = html.IndexOf(subfix, inl);
if (inl2 == -1)
{
return null;
}
string result = html.Substring(inl, inl2 - inl);
return result;
}
else
{
string result = html.Substring(inl);
return result;
}
}
#endregion
#region ResoveReverse
public static string ResoveReverse(string html, string subfix, string prefix)
{
int inl = html.IndexOf(subfix);
if (inl == -1)
{
return null;
}
string subString = html.Substring(0, inl);
int inl2 = subString.LastIndexOf(prefix);
if (inl2 == -1)
{
return null;
}
string s = subString.Substring(inl2 + prefix.Length, subString.Length - inl2 - prefix.Length);
return s;
}
#endregion
#region ResoveList
public static List<string> ResoveList(string html, string prefix, string subfix)
{
List<string> list = new List<string>();
int index = 0;
do
{
index = html.IndexOf(prefix, index);
if (index == -1)
{
break;
}
index += prefix.Length;
int indexEnd = html.IndexOf(subfix, index);
if (indexEnd > 0)
{
string content = html.Substring(index, indexEnd - index);
list.Add(content);
}
index = indexEnd;
}
while (index > -1);
return list;
}
#endregion
#region ResoveListByAT
public static List<string> ResoveListByAT(string html)
{
List<string> list = new List<string>();
int index = html.IndexOf('@');
while (index > 0)
{
int indexx = html.LastIndexOf("'", index); //向前一个单引号
int indexy = html.IndexOf("'", index + 1); //向后一个单引号
string s78 = html.Substring(indexx, indexy - indexx);
s78 = s78.Replace("'", "");
list.Add(s78);
index = html.IndexOf('@', indexy);
}
return list;
}
#endregion
/// <summary>
/// 清除HTML代码
/// </summary>
/// <param name="html"></param>
public static string ClearHtml(string html)
{
html = html.ParseToString();
html = Regex.Replace(html, @"(<head[\w\W]*?</head>|<script[\w\W]*?</script>|<style[\w\W]*?</style>|<!--[\w\W]*?-->)", string.Empty);
html = Regex.Replace(html, @"(<span[\w\W]*?</span>)", string.Empty);
html = Regex.Replace(html, "(<[^>]*?>)", string.Empty);
return html;
}
public static string GetHtmlText(string html)
{
html = html.ParseToString();
html = Regex.Replace(html, "<.*?>", string.Empty);
return html;
}
/// <summary>
/// 清除HTML代码A标签
/// </summary>
/// <param name="html"></param>
/// <returns></returns>
public static string ClearHtmlA(string html)
{
html = html.ParseToString();
html = Regex.Replace(html, "(</?a[^>]*>)", "", RegexOptions.IgnoreCase);
return html.Trim();
}
public static string AddEscapeCharacter(string html)
{
html = html.ParseToString();
html = html.Replace("\"", "\\\"");
html = html.Replace("'", "\\'");
return html;
}
public static string TrimBOM(string html)
{
html = html.Trim(new char[] { '\uFEFF' });
return html;
}
public static string TrimJsonp(string json)
{
int start = json.IndexOf("{");
int end = json.LastIndexOf("}");
if (start > 0 && end > 0)
{
return json.Substring(start, end - start + 1);
}
return json;
}
}
}
@@ -0,0 +1,122 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using NaiBa.Util.Extension;
namespace NaiBa.Util.Helper
{
public class JsonHelper
{
public static bool IsJson(string html)
{
if (string.IsNullOrEmpty(html))
{
return false;
}
html = html.Trim();
if ((html.StartsWith("{") && html.EndsWith("}")) || // For object
(html.StartsWith("[") && html.EndsWith("]"))) // For array
{
try
{
var obj = JToken.Parse(html);
return true;
}
catch
{
return false;
}
}
return false;
}
public static string JsonAlphabeticaly(string json)
{
json = json.ParseToString().Trim();
if (json.StartsWith("{"))
{
var jObj = JObject.Parse(json);
JObject result = new JObject();
OrderJson(result, jObj);
return result.ToString();
}
else
{
var jArr = JArray.Parse(json);
JArray result = new JArray();
foreach (var arr in jArr)
{
result.Add(new JObject());
OrderJson((JObject)result[result.Count - 1], (JObject)arr);
}
return result.ToString();
}
}
public static string SerializeAlphabeticaly(object obj)
{
return JsonConvert.SerializeObject(obj, Formatting.Indented, new JsonSerializerSettings { ContractResolver = new OrderedContractResolver() });
}
public static string TrimJsonp(string json)
{
return HtmlHelper.TrimJsonp(json);
}
#region 私有方法
private static void OrderJson(JObject jObj, JObject item)
{
foreach (var property in item.Children<JProperty>().OrderBy(p => p.Name))
{
switch (property.Value.Type.ToString())
{
case "Array":
var jArr = new JArray();
jObj.Add(property.Name, jArr);
for (int i = 0; i < property.Value.Count(); i++)
{
switch (property.Value[i].Type.ToString())
{
case "Object":
var obj = new JObject();
jArr.Add(obj);
OrderJson(obj, (JObject)property.Value[i]);
break;
default:
jArr.Add(property.Value[i]);
break;
}
}
break;
case "Object":
jObj.Add(property.Name, new JObject());
OrderJson((JObject)jObj[property.Name], (JObject)property.Value);
break;
default:
jObj.Add(property.Name, property.Value);
break;
}
}
}
#endregion
}
public class OrderedContractResolver : DefaultContractResolver
{
protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
{
return base.CreateProperties(type, memberSerialization)
.OrderBy(p => p.Order ?? int.MaxValue) // Honour any explit ordering first
.ThenBy(p => p.PropertyName)
.ToList();
}
}
}
@@ -0,0 +1,220 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Concurrent;
using System.Reflection;
using System.Linq.Expressions;
using NaiBa.Util.Extension;
namespace NaiBa.Util.Helper
{
public class ReflectionHelper
{
private static ConcurrentDictionary<string, object> dictCache = new ConcurrentDictionary<string, object>();
#region 得到类里面的属性集合
public static PropertyInfo[] GetProperties(Type type, string[] columns = null)
{
PropertyInfo[] properties = null;
if (dictCache.ContainsKey(type.FullName))
{
properties = dictCache[type.FullName] as PropertyInfo[];
}
else
{
properties = type.GetProperties();
dictCache.TryAdd(type.FullName, properties);
}
if (columns != null && columns.Length > 0)
{
// 按columns顺序返回属性
var columnPropertyList = new List<PropertyInfo>();
foreach (var column in columns)
{
var columnProperty = properties.Where(p => p.Name == column).FirstOrDefault();
if (columnProperty != null)
{
columnPropertyList.Add(columnProperty);
}
}
return columnPropertyList.ToArray();
}
else
{
return properties;
}
}
#endregion
public static List<MemberInfo> GetMembers(Type type)
{
var flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
var members = new List<MemberInfo>();
members.AddRange(type.GetProperties(flags));
members.AddRange(type.GetFields(flags));
return members;
}
public static void SetObjectPropertyValue<T>(string propertyName, object value)
{
var type = typeof(T);
var field = type.GetProperty(propertyName);
if (field != null)
{
field.SetValue(null, value);
}
}
public static void SetObjectPropertyValue(object obj, string propertyName, object value)
{
if (obj != null)
{
PropertyInfo propertyInfo = GetProperties(obj.GetType()).Where(p => p.Name == propertyName).FirstOrDefault();
// make sure object has the property we are after
if (propertyInfo != null)
{
switch (propertyInfo.PropertyType.FullName)
{
case "System.Int32": propertyInfo.SetValue(obj, value.ParseToInt(), null); break;
case "System.Int64": propertyInfo.SetValue(obj, value.ParseToLong(), null); break;
case "System.Decimal": propertyInfo.SetValue(obj, value.ParseToDecimal(), null); break;
case "System.Double": propertyInfo.SetValue(obj, value.ParseToDouble(), null); break;
default:
if (propertyInfo.PropertyType.GenericTypeArguments.Length > 0)
{
switch (propertyInfo.PropertyType.GenericTypeArguments[0].FullName)
{
case "System.DateTime":
if (!string.IsNullOrEmpty(value.ParseToString()))
{
propertyInfo.SetValue(obj, value.ParseToString().ParseToDateTime(), null);
}
break;
case "System.Decimal":
propertyInfo.SetValue(obj, value.ParseToDecimal(), null);
break;
}
}
else
{
propertyInfo.SetValue(obj, value, null);
}
break;
}
}
}
}
public static object GetObjectPropertyValue(object obj, string propertyName)
{
if (obj != null)
{
PropertyInfo propertyInfo = GetProperties(obj.GetType()).Where(p => p.Name == propertyName).FirstOrDefault();
// make sure object has the property we are after
if (propertyInfo != null)
{
return propertyInfo.GetValue(obj);
}
}
return null;
}
public static string GetGenericName(Type type)
{
if (type.GetGenericArguments().Length > 0)
{
return GetGenericName(type.GetGenericArguments().FirstOrDefault());
}
else
{
if (type.GetGenericArguments().FirstOrDefault() != null)
{
return type.GetGenericArguments().FirstOrDefault().Name;
}
else
{
return type.Name;
}
}
}
public static string GetMemberName<T>(Expression<Func<T>> memberExpression)
{
MemberExpression expressionBody = (MemberExpression)memberExpression.Body;
return expressionBody.Member.Name;
}
public static void SetObjectValue<T>(ref T obj, MemberInfo member, object value)
{
// Boxing method used for modifying structures
var boxed = obj.GetType().IsValueType ? (object)obj : obj;
SetMemberValue(ref boxed, member, value);
obj = (T)boxed;
}
public static void SetMemberValue<T>(ref T obj, MemberInfo member, object value)
{
if (IsProperty(member))
{
var prop = (PropertyInfo)member;
if (prop.SetMethod != null)
{
prop.SetValue(obj, value);
}
}
else if (IsField(member))
{
var field = (FieldInfo)member;
field.SetValue(obj, value);
}
}
public static object GetMemberValue(object obj, MemberInfo member)
{
object result = null;
if (IsProperty(member))
{
var prop = (PropertyInfo)member;
result = prop.GetValue(obj, prop.GetIndexParameters().Count() == 1 ? new object[] { null } : null);
}
else if (IsField(member))
{
var field = (FieldInfo)member;
result = field.GetValue(obj);
}
return result;
}
public static bool CanWrite(MemberInfo member)
{
return IsProperty(member) ? ((PropertyInfo)member).CanWrite : IsField(member);
}
public static bool CanRead(MemberInfo member)
{
return IsProperty(member) ? ((PropertyInfo)member).CanRead : IsField(member);
}
#region 私有方法
private static bool IsProperty(MemberInfo member)
{
return IsType(member.GetType(), typeof(PropertyInfo));
}
private static bool IsField(MemberInfo member)
{
return IsType(member.GetType(), typeof(FieldInfo));
}
private static bool IsType(System.Type type, System.Type targetType)
{
return type.Equals(targetType) || type.IsSubclassOf(targetType);
}
#endregion
}
}
@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace NaiBa.Util.Helper
{
public class RegexHelper
{
// <span\\sclass=\"rantings-num\".*?>(.+?)</span>
/// <summary>
/// 返回正则对象所有结果
/// </summary>
/// <param name="html"></param>
/// <param name="regex"></param>
/// <returns></returns>
public static MatchCollection GetMatchCollection(string html, string regex)
{
if (string.IsNullOrEmpty(html))
{
return null;
}
return Regex.Matches(html, regex, RegexOptions.IgnoreCase);
}
/// <summary>
/// 返回单个正则分析结果
/// </summary>
/// <param name="html"></param>
/// <param name="regex"></param>
/// <returns></returns>
public static string GetMatch(string html, string regex, int index = 0)
{
if (string.IsNullOrEmpty(html))
{
return string.Empty;
}
MatchCollection mc = Regex.Matches(html, regex, RegexOptions.IgnoreCase);
if (mc.Count > 0)
{
return mc[index].Groups[1].Value.ToString();
}
return string.Empty;
}
public static string GetMatchWithSingleLine(string html, string regex)
{
if (string.IsNullOrEmpty(html))
{
return string.Empty;
}
MatchCollection mc = Regex.Matches(html, regex, RegexOptions.IgnoreCase | RegexOptions.Singleline);
if (mc.Count > 0)
{
return mc[0].Groups[1].ToString();
}
return string.Empty;
}
public static bool IsNumber(string str)
{
Regex regex = new Regex(@"^[0-9\.]+$");
return regex.IsMatch(str);
}
public static bool IsAlphabet(string str)
{
Regex regex = new Regex(@"^[A-Za-z]+$");
return regex.IsMatch(str);
}
public static bool IsAlphabetOrNumber(string str)
{
Regex regex = new Regex(@"^[A-Za-z0-9]+$");
return regex.IsMatch(str);
}
}
}
+5 -5
View File
@@ -301,11 +301,11 @@
<Compile Include="KJDForms\ProductSelectForms\DbProductEditNotesForm.Designer.cs">
<DependentUpon>DbProductEditNotesForm.cs</DependentUpon>
</Compile>
<Compile Include="KJDForms\ProductSelectForms\ProductSelectListForm.cs">
<Compile Include="KJDForms\ProductSelectForms\DbProductSelectListManageForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="KJDForms\ProductSelectForms\ProductSelectListForm.Designer.cs">
<DependentUpon>ProductSelectListForm.cs</DependentUpon>
<Compile Include="KJDForms\ProductSelectForms\DbProductSelectListManageForm.Designer.cs">
<DependentUpon>DbProductSelectListManageForm.cs</DependentUpon>
</Compile>
<Compile Include="KJDForms\ProductSelectForms\UserSelectDbProductForm.cs">
<SubType>Form</SubType>
@@ -899,8 +899,8 @@
<EmbeddedResource Include="KJDForms\ProductSelectForms\DbProductEditNotesForm.resx">
<DependentUpon>DbProductEditNotesForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="KJDForms\ProductSelectForms\ProductSelectListForm.resx">
<DependentUpon>ProductSelectListForm.cs</DependentUpon>
<EmbeddedResource Include="KJDForms\ProductSelectForms\DbProductSelectListManageForm.resx">
<DependentUpon>DbProductSelectListManageForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="KJDForms\ProductSelectForms\UserSelectDbProductForm.resx">
<DependentUpon>UserSelectDbProductForm.cs</DependentUpon>
@@ -159,7 +159,7 @@ namespace TemuKJD.KJDForms.AdminForms
private string SizeSpecQuery(ShopLoginInfo shop, string prodId, string sizeSpecId)
{
string url = "https://seller.kuajingmaihuo.com/bg-anniston-mms/sizespec/query";
string body = @"{""businessId"":17593513382470,""reusable"":false}";
string body = @"{""businessId"":" + sizeSpecId + @",""reusable"":false}";
string refere = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?from=productList&productId=" + prodId;
return KJDHttpResponse.PostResponse(shop, url, body, refere);
}
@@ -25,7 +25,12 @@ namespace TemuKJD.KJDForms.ProductSelectForms
List<TemuDBProduct> lstTemuDbProduct = new List<TemuDBProduct>();
public DbProductListForm(ShopLoginInfo _shop = null)
public DbProductListForm()
{
InitializeComponent();
}
public DbProductListForm(ShopLoginInfo _shop)
{
InitializeComponent();
shop = _shop;
@@ -230,7 +235,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
dgvDbProduct.Rows[e.RowIndex].Cells["col_notes"].Value = dbProduct.notes;
break;
case "认领":
SelectProduct(dbId);
Task.Run(() => { SelectProduct(new TemuDBProduct[] { dbProduct }); });
break;
case "":
dgvDbProduct.Rows[e.RowIndex].Cells["colSelect"].Value = !(bool)dgvDbProduct.Rows[e.RowIndex].Cells["colSelect"].Value;
@@ -240,35 +245,87 @@ namespace TemuKJD.KJDForms.ProductSelectForms
}
}
private void SelectProduct(string dbId)
private void SelectProduct(TemuDBProduct[] prods)
{
if (shop == null)
{
BaseMsgForm.ShowError("店铺不能为空!");
return;
}
var url = BaseClass.BuildObjString("product/add_user_select_product");
var data = UserLogin.GetSignaturex() +
"&out_product_id=" + dbId +
"&shop_id=" + shop.ShopId +
"&shop_account=" + shop.ShopAccount +
"&main_user_name=" + shop.UserName +
"&sub_user_name=" + shop.SubUserName +
"&status=待审核";
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"))
if (prods == null || prods.Count() == 0)
{
BaseMsgForm.ShowError("认领商品失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg"));
BaseMsgForm.ShowError("认领商品不能为空!");
return;
}
Invoke(new Action(() =>
{
this.pbLoading.Visible = true;
this.statusBar.lblTaskStatus.Text = "正在认领...";
this.statusBar.pgbTaskProgress.Value = 0;
this.statusBar.pgbTaskProgress.Maximum = prods.Length;
this.statusBar.pgbTaskProgress.Text = "0" + "/" + prods.Length;
}));
string errorMsg = "";
foreach (var prod in prods)
{
Invoke(new Action(() =>
{
this.statusBar.pgbTaskProgress.Value++;
}));
if (prod == null)
{
errorMsg += "prod null; ";
continue;
}
try
{
var url = BaseClass.BuildObjString("product/add_user_select_product");
var data = UserLogin.GetSignaturex() +
"&out_product_id=" + prod.id +
"&shop_id=" + shop.ShopId +
"&shop_account=" + shop.ShopAccount +
"&main_user_name=" + shop.UserName +
"&sub_user_name=" + shop.SubUserName +
"&status=待审核";
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"))
{
errorMsg += prod.spu_id + " " + BaseRegex.GetStringJson(ref html, "msg") + "; ";
}
}
catch (Exception ex) {
errorMsg += ex.Message + "; ";
}
}
if (!string.IsNullOrEmpty(errorMsg))
{
Invoke(new Action(() =>
{
BaseMsgForm.ShowError("认领商品失败,请重试!\r\n" + errorMsg);
}));
}
else
{
BaseMsgForm.ShowInfo("认领商品成功!");
Invoke(new Action(() =>
{
BaseMsgForm.ShowInfo("认领商品成功!");
}));
}
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
this.statusBar.lblTaskStatus.Text = "认领完成";
this.statusBar.pgbTaskProgress.Value = prods.Length;
}));
}
private void DeleteProduct(string dbId)
@@ -294,7 +351,25 @@ namespace TemuKJD.KJDForms.ProductSelectForms
private void btnSelect_Click(object sender, EventArgs e)
{
var lstProdId = dgvDbProduct.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["col_spu_id"]?.Value.ToString()).ToList();
var prodList = this.lstTemuDbProduct.Where(p => lstProdId.Contains(p.spu_id)).ToArray();
if (prodList.Count() > 0)
{
this.btnSelect.Enabled = false;
Task.Run(() => {
SelectProduct(prodList);
Invoke(new Action(() =>
{
this.btnSelect.Enabled = true;
}));
});
}
else
{
BaseMsgForm.ShowError("请选择商品!");
}
}
}
}
@@ -0,0 +1,557 @@
namespace TemuKJD.KJDForms.ProductSelectForms
{
partial class DbProductSelectListManageForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DbProductSelectListManageForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.txtShopName = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.txtShopId = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.btnAdd = new TemuKJD.UserControls.ButtonEx();
this.txtSPU = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.txtSKC = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.pnlEmpty = new DevComponents.DotNetBar.PanelEx();
this.btnSearch = new TemuKJD.UserControls.ButtonEx();
this.txtExtCode = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.txtProdName = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.txtCat = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.pbLoading = new System.Windows.Forms.PictureBox();
this.dgvSelectProduct = new TemuKJD.UserComponent.DataGridViewEx();
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colSelectId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSupplierName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn();
this.colSkcId = new System.Windows.Forms.DataGridViewLinkColumn();
this.colProductSkcPic = new System.Windows.Forms.DataGridViewImageColumn();
this.colProductName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colProductCat = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colExtCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colMsg = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colDraftId = new System.Windows.Forms.DataGridViewLinkColumn();
this.ColDelete = new System.Windows.Forms.DataGridViewLinkColumn();
this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dgvSelectProduct)).BeginInit();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.BackColor = System.Drawing.Color.White;
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(1, 33);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.txtShopName);
this.splitContainer1.Panel1.Controls.Add(this.label7);
this.splitContainer1.Panel1.Controls.Add(this.txtShopId);
this.splitContainer1.Panel1.Controls.Add(this.label6);
this.splitContainer1.Panel1.Controls.Add(this.btnAdd);
this.splitContainer1.Panel1.Controls.Add(this.txtSPU);
this.splitContainer1.Panel1.Controls.Add(this.label5);
this.splitContainer1.Panel1.Controls.Add(this.txtSKC);
this.splitContainer1.Panel1.Controls.Add(this.label1);
this.splitContainer1.Panel1.Controls.Add(this.pnlEmpty);
this.splitContainer1.Panel1.Controls.Add(this.btnSearch);
this.splitContainer1.Panel1.Controls.Add(this.txtExtCode);
this.splitContainer1.Panel1.Controls.Add(this.label4);
this.splitContainer1.Panel1.Controls.Add(this.txtProdName);
this.splitContainer1.Panel1.Controls.Add(this.label3);
this.splitContainer1.Panel1.Controls.Add(this.txtCat);
this.splitContainer1.Panel1.Controls.Add(this.label2);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(1278, 686);
this.splitContainer1.SplitterDistance = 53;
this.splitContainer1.TabIndex = 2;
//
// txtShopName
//
this.txtShopName.Location = new System.Drawing.Point(197, 16);
this.txtShopName.Name = "txtShopName";
this.txtShopName.Size = new System.Drawing.Size(90, 23);
this.txtShopName.TabIndex = 451;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(140, 19);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(68, 17);
this.label7.TabIndex = 452;
this.label7.Text = "店铺名称:";
//
// txtShopId
//
this.txtShopId.Location = new System.Drawing.Point(46, 16);
this.txtShopId.Name = "txtShopId";
this.txtShopId.Size = new System.Drawing.Size(90, 23);
this.txtShopId.TabIndex = 448;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(1, 19);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(56, 17);
this.label6.TabIndex = 449;
this.label6.Text = "店铺Id:";
//
// btnSelect
//
this.btnAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnAdd.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnAdd.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAdd.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnAdd.ForeColor = System.Drawing.Color.White;
this.btnAdd.Location = new System.Drawing.Point(1181, 14);
this.btnAdd.Margin = new System.Windows.Forms.Padding(2);
this.btnAdd.Name = "btnSelect";
this.btnAdd.Size = new System.Drawing.Size(91, 26);
this.btnAdd.TabIndex = 444;
this.btnAdd.Text = "一键上传草稿";
this.btnAdd.UseVisualStyleBackColor = false;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// txtSPU
//
this.txtSPU.Location = new System.Drawing.Point(324, 16);
this.txtSPU.Name = "txtSPU";
this.txtSPU.Size = new System.Drawing.Size(90, 23);
this.txtSPU.TabIndex = 434;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(291, 19);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(43, 17);
this.label5.TabIndex = 435;
this.label5.Text = "SPU:";
//
// txtSKC
//
this.txtSKC.Location = new System.Drawing.Point(451, 16);
this.txtSKC.Name = "txtSKC";
this.txtSKC.Size = new System.Drawing.Size(90, 23);
this.txtSKC.TabIndex = 432;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(418, 19);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(43, 17);
this.label1.TabIndex = 433;
this.label1.Text = "SKC:";
//
// pnlEmpty
//
this.pnlEmpty.CanvasColor = System.Drawing.SystemColors.Control;
this.pnlEmpty.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.pnlEmpty.DisabledBackColor = System.Drawing.Color.Empty;
this.pnlEmpty.Location = new System.Drawing.Point(996, 14);
this.pnlEmpty.Name = "pnlEmpty";
this.pnlEmpty.Size = new System.Drawing.Size(56, 26);
this.pnlEmpty.Style.Alignment = System.Drawing.StringAlignment.Center;
this.pnlEmpty.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.pnlEmpty.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.pnlEmpty.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.pnlEmpty.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.pnlEmpty.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.pnlEmpty.Style.GradientAngle = 90;
this.pnlEmpty.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
this.pnlEmpty.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.pnlEmpty.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.pnlEmpty.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.pnlEmpty.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.pnlEmpty.TabIndex = 431;
this.pnlEmpty.Text = "清空条件";
this.pnlEmpty.Click += new System.EventHandler(this.pnlEmpty_Click);
//
// btnSearch
//
this.btnSearch.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSearch.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSearch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSearch.ForeColor = System.Drawing.Color.White;
this.btnSearch.Location = new System.Drawing.Point(935, 14);
this.btnSearch.Margin = new System.Windows.Forms.Padding(2);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(56, 26);
this.btnSearch.TabIndex = 424;
this.btnSearch.Text = "搜索";
this.btnSearch.UseVisualStyleBackColor = false;
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
//
// txtExtCode
//
this.txtExtCode.Location = new System.Drawing.Point(835, 16);
this.txtExtCode.Name = "txtExtCode";
this.txtExtCode.Size = new System.Drawing.Size(90, 23);
this.txtExtCode.TabIndex = 429;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(801, 19);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 17);
this.label4.TabIndex = 430;
this.label4.Text = "货号:";
//
// txtProdName
//
this.txtProdName.Location = new System.Drawing.Point(707, 16);
this.txtProdName.Name = "txtProdName";
this.txtProdName.Size = new System.Drawing.Size(90, 23);
this.txtProdName.TabIndex = 427;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(673, 19);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 17);
this.label3.TabIndex = 428;
this.label3.Text = "标题:";
//
// txtCat
//
this.txtCat.Location = new System.Drawing.Point(579, 16);
this.txtCat.Name = "txtCat";
this.txtCat.Size = new System.Drawing.Size(90, 23);
this.txtCat.TabIndex = 425;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(545, 19);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 17);
this.label2.TabIndex = 426;
this.label2.Text = "类目:";
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.pbLoading);
this.splitContainer2.Panel1.Controls.Add(this.dgvSelectProduct);
this.splitContainer2.Panel1.Padding = new System.Windows.Forms.Padding(4, 0, 4, 0);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.ucSplitPage1);
this.splitContainer2.Panel2.Controls.Add(this.statusBar);
this.splitContainer2.Size = new System.Drawing.Size(1278, 629);
this.splitContainer2.SplitterDistance = 600;
this.splitContainer2.TabIndex = 0;
//
// pbLoading
//
this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue;
this.pbLoading.Location = new System.Drawing.Point(614, 259);
this.pbLoading.Name = "pbLoading";
this.pbLoading.Size = new System.Drawing.Size(50, 50);
this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pbLoading.TabIndex = 7;
this.pbLoading.TabStop = false;
//
// dgvSelectProduct
//
this.dgvSelectProduct.AllowUserToAddRows = false;
this.dgvSelectProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgvSelectProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvSelectProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.dgvSelectProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvSelectProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colSelect,
this.colSelectId,
this.colSupplierId,
this.colSupplierName,
this.colSpuId,
this.colSkcId,
this.colProductSkcPic,
this.colProductName,
this.colProductCat,
this.colExtCode,
this.colMsg,
this.colDraftId,
this.ColDelete,
this.colOpResult});
this.dgvSelectProduct.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvSelectProduct.Location = new System.Drawing.Point(4, 0);
this.dgvSelectProduct.Name = "dgvSelectProduct";
this.dgvSelectProduct.ReadOnly = true;
dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.dgvSelectProduct.RowsDefaultCellStyle = dataGridViewCellStyle3;
this.dgvSelectProduct.RowTemplate.Height = 23;
this.dgvSelectProduct.Size = new System.Drawing.Size(1270, 600);
this.dgvSelectProduct.TabIndex = 188;
this.dgvSelectProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSelectProduct_CellContentClick);
//
// ucSplitPage1
//
this.ucSplitPage1.CurrentPage = 1;
this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right;
this.ucSplitPage1.Location = new System.Drawing.Point(916, 0);
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
this.ucSplitPage1.Name = "ucSplitPage1";
this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
this.ucSplitPage1.Size = new System.Drawing.Size(362, 25);
this.ucSplitPage1.TabIndex = 6;
this.ucSplitPage1.TotalPage = 1;
//
// statusBar
//
this.statusBar.BackColor = System.Drawing.Color.White;
this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill;
this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.statusBar.Location = new System.Drawing.Point(0, 0);
this.statusBar.Margin = new System.Windows.Forms.Padding(0);
this.statusBar.Name = "statusBar";
this.statusBar.Size = new System.Drawing.Size(1278, 25);
this.statusBar.TabIndex = 5;
//
// colSelect
//
this.colSelect.HeaderText = "选择";
this.colSelect.Name = "colSelect";
this.colSelect.ReadOnly = true;
this.colSelect.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colSelect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colSelect.Width = 30;
//
// colSelectId
//
this.colSelectId.HeaderText = "认领Id";
this.colSelectId.Name = "colSelectId";
this.colSelectId.ReadOnly = true;
this.colSelectId.Visible = false;
//
// colSupplierId
//
this.colSupplierId.HeaderText = "店铺Id";
this.colSupplierId.Name = "colSupplierId";
this.colSupplierId.ReadOnly = true;
//
// colSupplierName
//
this.colSupplierName.HeaderText = "店铺名称";
this.colSupplierName.Name = "colSupplierName";
this.colSupplierName.ReadOnly = true;
this.colSupplierName.Width = 110;
//
// colSpuId
//
this.colSpuId.HeaderText = "商品SPU";
this.colSpuId.Name = "colSpuId";
this.colSpuId.ReadOnly = true;
this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
//
// colSkcId
//
this.colSkcId.FillWeight = 150F;
this.colSkcId.HeaderText = "商品SKC";
this.colSkcId.Name = "colSkcId";
this.colSkcId.ReadOnly = true;
this.colSkcId.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colSkcId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colSkcId.Width = 80;
//
// colProductSkcPic
//
this.colProductSkcPic.HeaderText = "Skc图片";
this.colProductSkcPic.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom;
this.colProductSkcPic.Name = "colProductSkcPic";
this.colProductSkcPic.ReadOnly = true;
this.colProductSkcPic.Width = 60;
//
// colProductName
//
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
this.colProductName.Width = 260;
//
// colProductCat
//
this.colProductCat.HeaderText = "商品类目";
this.colProductCat.Name = "colProductCat";
this.colProductCat.ReadOnly = true;
this.colProductCat.Width = 90;
//
// colExtCode
//
this.colExtCode.HeaderText = "商品货号";
this.colExtCode.Name = "colExtCode";
this.colExtCode.ReadOnly = true;
//
// colMsg
//
this.colMsg.HeaderText = "状态";
this.colMsg.Name = "colMsg";
this.colMsg.ReadOnly = true;
//
// colDraftId
//
this.colDraftId.HeaderText = "草稿箱Id";
this.colDraftId.Name = "colDraftId";
this.colDraftId.ReadOnly = true;
//
// ColDelete
//
this.ColDelete.HeaderText = "删除";
this.ColDelete.Name = "ColDelete";
this.ColDelete.ReadOnly = true;
this.ColDelete.Visible = false;
//
// colOpResult
//
this.colOpResult.HeaderText = "操作结果";
this.colOpResult.Name = "colOpResult";
this.colOpResult.ReadOnly = true;
this.colOpResult.Width = 150;
//
// DbProductSelectListManageForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1280, 720);
this.Controls.Add(this.splitContainer1);
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.Name = "DbProductSelectListManageForm";
this.Text = "用户选品列表";
this.TitleText = "用户选品列表";
this.Load += new System.EventHandler(this.DbProductSelectListForm_Load);
this.VisibleChanged += new System.EventHandler(this.DbProductSelectListManageForm_VisibleChanged);
this.Controls.SetChildIndex(this.splitContainer1, 0);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgvSelectProduct)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private UserControls.ButtonEx btnAdd;
private System.Windows.Forms.TextBox txtSPU;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox txtSKC;
private System.Windows.Forms.Label label1;
private DevComponents.DotNetBar.PanelEx pnlEmpty;
private UserControls.ButtonEx btnSearch;
private System.Windows.Forms.TextBox txtExtCode;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox txtProdName;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtCat;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.PictureBox pbLoading;
private UserControls.UcSplitPage ucSplitPage1;
private UserControls.StatusBarUserControl statusBar;
private System.Windows.Forms.TextBox txtShopName;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox txtShopId;
private System.Windows.Forms.Label label6;
private UserComponent.DataGridViewEx dgvSelectProduct;
private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect;
private System.Windows.Forms.DataGridViewTextBoxColumn colSelectId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
private System.Windows.Forms.DataGridViewLinkColumn colSkcId;
private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductName;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductCat;
private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode;
private System.Windows.Forms.DataGridViewTextBoxColumn colMsg;
private System.Windows.Forms.DataGridViewLinkColumn colDraftId;
private System.Windows.Forms.DataGridViewLinkColumn ColDelete;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
}
}
@@ -0,0 +1,818 @@
using AllBase.Helper;
using AllBase.Model.Result;
using TemuKJD.KJDForms.BaseForms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Net;
using AllBase;
using Work;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using TemuKJD.Extension;
using AllBase.Model.Param.TemuProductManage;
using System.Threading;
namespace TemuKJD.KJDForms.ProductSelectForms
{
public partial class DbProductSelectListManageForm : LRBaseForm
{
List<TemuDBProductSelect> lstAdminTemuDBProductSelect = new List<TemuDBProductSelect>();
public DbProductSelectListManageForm()
{
InitializeComponent();
}
private void DbProductSelectListForm_Load(object sender, EventArgs e)
{
this.ucSplitPage1.PageChange += UcSplitPage1_PageChange;
this.dgvSelectProduct.AddSelectorColumn("colSelect");
}
private void DbProductSelectListManageForm_VisibleChanged(object sender, EventArgs e)
{
if (this.Visible == true)
{
this.pbLoading.Visible = true;
SearchDbProdSelect(this.ucSplitPage1.CurrentPage);
}
}
private void UcSplitPage1_PageChange(object obj)
{
SearchDbProdSelect(this.ucSplitPage1.CurrentPage);
}
private void btnSearch_Click(object sender, EventArgs e)
{
if (this.ucSplitPage1.CurrentPage != 1)
this.ucSplitPage1.CurrentPage = 1;
else
SearchDbProdSelect(1);
}
public void SearchDbProdSelect(int page)
{
if (InvokeRequired)
{
Invoke(new Action(() =>
{
this.pbLoading.Visible = true;
this.dgvSelectProduct.Rows.Clear();
lstAdminTemuDBProductSelect.Clear();
}));
}
else
{
this.pbLoading.Visible = true;
this.dgvSelectProduct.Rows.Clear();
lstAdminTemuDBProductSelect.Clear();
}
Task.Run(() =>
{
int pageCount;
var list = GetSelectProductList(out pageCount, page, 200);
lstAdminTemuDBProductSelect.AddRange(list);
this.ucSplitPage1.TotalPage = pageCount;
foreach (var prodSelect in lstAdminTemuDBProductSelect)
{
Image image = null;
try
{
using (Stream stream = WebRequest.Create(prodSelect.main_img.Replace("https", "http")).GetResponse().GetResponseStream())
{
image = Image.FromStream(stream);
}
}
catch (Exception ex)
{
}
Invoke(new Action(() =>
{
int rowIndex = this.dgvSelectProduct.Rows.Add(
false,
prodSelect.id,
prodSelect.shop_id,
prodSelect.shop_account,
prodSelect.spu_id,
prodSelect.skc_id,
image,//prod.main_img,
prodSelect.product_name,
prodSelect.cat_name,
prodSelect.ext_code,
prodSelect.status,
prodSelect.draft_id,
"删除");
dgvSelectProduct.Rows[rowIndex].Height = 60;
}));
}
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
}));
});
}
public List<TemuDBProductSelect> GetSelectProductList(out int pageCount, int page = 1, int pageSize = 50)
{
List<TemuDBProductSelect> list = new List<TemuDBProductSelect>();
pageCount = 1;
var url = BaseClass.BuildObjString("product/admin_get_user_select_product_list");
var data = UserLogin.GetSignaturex() +
"&page=" + page +
"&page_size=" + pageSize +
"&search_spu=" + txtSPU.Text +
"&search_skc=" + txtSKC.Text +
"&search_cat=" + txtCat.Text +
"&search_ext_code=" + txtExtCode.Text +
"&search_prod_name=" + txtProdName.Text +
"&search_shop_id=" + txtShopId.Text +
"&search_shop_account=" + txtShopName.Text +
//"&status=待审核";
"&status=";
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"))
{
Invoke(new Action(() =>
{
BaseMsgForm.ShowError("认领商品查询失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg"));
}));
return new List<TemuDBProductSelect>();
}
int count = BaseRegex.GetIntJson(ref html, "count");
pageCount = Math.Ceiling(1.0 * count / pageSize).ParseToInt();
pageCount = Math.Max(pageCount, 1);
var jArr = JObject.Parse(html)["data"];
if (jArr.Count() == 0)
return list;
var sProd = JsonHelper.SerializeObject(jArr);
try
{
list = JsonHelper.DeserializeJsonToList<TemuDBProductSelect>(sProd);
return list;
}
catch (Exception ex)
{
return new List<TemuDBProductSelect>();
}
}
private void pnlEmpty_Click(object sender, EventArgs e)
{
this.txtCat.Text = "";
this.txtExtCode.Text = "";
this.txtProdName.Text = "";
this.txtShopId.Text = "";
this.txtShopName.Text = "";
this.txtSKC.Text = "";
this.txtSPU.Text = "";
}
private void dgvSelectProduct_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex < 0 || e.RowIndex < 0)
return;
string headerText = dgvSelectProduct.Columns[e.ColumnIndex].HeaderText;
var dbId = dgvSelectProduct.Rows[e.RowIndex].Cells["colSelectId"].Value.ParseToString();
var dbProduct = lstAdminTemuDBProductSelect.FirstOrDefault(p => p.id.ToString() == dbId);
switch (headerText)
{
case "删除":
//if (BaseMsgForm.ShowConfirm("确定删除商品吗?删除后不可恢复!").DialogResult == DialogResult.Cancel)
// return;
//DeleteProduct(dbId);
break;
case "编辑备注":
//DbProductEditNotesForm editForm = new DbProductEditNotesForm(dbProduct);
//editForm.ShowDialog();
//dgvDbProduct.Rows[e.RowIndex].Cells["col_notes"].Value = dbProduct.notes;
break;
case "认领":
//Task.Run(() => { SelectProduct(new TemuDBProduct[] { dbProduct }); });
break;
case "":
dgvSelectProduct.Rows[e.RowIndex].Cells["colSelect"].Value = !(bool)dgvSelectProduct.Rows[e.RowIndex].Cells["colSelect"].Value;
break;
default:
break;
}
}
private void btnAdd_Click(object sender, EventArgs e)
{
var lstProdId = dgvSelectProduct.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colSelectId"]?.Value.ToString()).ToList();
var prodList = this.lstAdminTemuDBProductSelect.Where(p => lstProdId.Contains(p.id.ParseToString())).ToArray();
if (prodList.Count() > 0)
{
this.btnAdd.Enabled = false;
Task.Run(() =>
{
AddProductDraft(prodList);
Invoke(new Action(() =>
{
this.btnAdd.Enabled = true;
}));
});
}
else
{
BaseMsgForm.ShowError("请选择要上传的商品!");
}
}
void AddProductDraft(TemuDBProductSelect[] prodSelect)
{
List<ShopLoginInfo> shopLst = new List<ShopLoginInfo>();
if (prodSelect == null || prodSelect.Count() == 0)
{
BaseMsgForm.ShowError("上传内容不能为空!");
return;
}
Invoke(new Action(() =>
{
this.pbLoading.Visible = true;
this.statusBar.lblTaskStatus.Text = "正在上传...";
this.statusBar.pgbTaskProgress.Value = 0;
this.statusBar.pgbTaskProgress.Maximum = prodSelect.Length;
this.statusBar.pgbTaskProgress.Text = "0" + "/" + prodSelect.Length;
}));
string errorMsg = "";
foreach (var prod in prodSelect)
{
Invoke(new Action(() =>
{
this.statusBar.pgbTaskProgress.Value++;
}));
if (prod == null)
{
Invoke(new Action(() =>
{
BaseMsgForm.ShowError("商品为空,将为您跳过该商品!");
}));
continue;
}
var row = dgvSelectProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r =>
r.Cells["colSelectId"]?.Value.ToString() == prod.id.ToString());
if (row == null)
{
Invoke(new Action(() =>
{
BaseMsgForm.ShowError("商品已被清除,将为您跳过该商品!");
}));
continue;
}
var shop = shopLst.FirstOrDefault(s=>s.ShopId == prod.shop_id);
if (shop == null)
{
shop = AdminGetServerShop(prod.shop_id);
if (shop == null)
{
shop = new ShopLoginInfo() { ShopId = prod.shop_id };
shop.LoginStatus = "不存在";
}
shopLst.Add(shop);
}
if(shop.LoginStatus != "登录成功")
{
Invoke(new Action(() =>
{
row.Cells["colOpResult"].Value = "店铺" + shop.LoginStatus;
}));
continue;
}
var temuDBProd = GetProductDetail(prod.out_product_Id.ToString());
if (temuDBProd == null)
{
Invoke(new Action(() =>
{
row.Cells["colOpResult"].Value = "选品数据库商品已被清除";
}));
continue;
}
var prodDetailStr = GetHtml.UrlDecode(temuDBProd.product_json);
var productDetail = JsonHelper.DeserializeJsonToObject<TemuProductInfo>(prodDetailStr);
var result = UploadProduct(shop, productDetail);
Thread.Sleep(200);
if (result.StartsWith("上传草稿箱成功"))
{
var url = BaseClass.BuildObjString("product/mdy_user_select_product_status");
var data = UserLogin.GetSignaturex() +
"&db_id=" + prod.id +
"&draft_id=" + result.Replace("上传草稿箱成功", "") +
"&status=已上传";
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"))
{
Invoke(new Action(() =>
{
row.Cells["colOpResult"].Value = "已成功上传草稿箱但保存到服务端失败:" + BaseRegex.GetStringJson(ref html, "msg") + "; ";
}));
}
else
{
Invoke(new Action(() =>
{
row.Cells["colDraftId"].Value = result.Replace("上传草稿箱成功", ""); // 草稿箱id
row.Cells["colOpResult"].Value = "已成功上传草稿箱";
}));
}
}
else
{
Invoke(new Action(() =>
{
row.Cells["colOpResult"].Value = result;
}));
}
//try
//{
// var url = BaseClass.BuildObjString("product/add_user_select_product");
// var data = UserLogin.GetSignaturex() +
// "&out_product_id=" + prod.id +
// "&shop_id=" + shop.ShopId +
// "&shop_account=" + shop.ShopAccount +
// "&main_user_name=" + shop.UserName +
// "&sub_user_name=" + shop.SubUserName +
// "&status=待审核";
// 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"))
// {
// errorMsg += prod.spu_id + " " + BaseRegex.GetStringJson(ref html, "msg") + "; ";
// }
//}
//catch (Exception ex)
//{
// errorMsg += ex.Message + "; ";
//}
}
if (!string.IsNullOrEmpty(errorMsg))
{
Invoke(new Action(() =>
{
BaseMsgForm.ShowError("认领商品失败,请重试!\r\n" + errorMsg);
}));
}
else
{
Invoke(new Action(() =>
{
BaseMsgForm.ShowInfo("认领商品成功!");
}));
}
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
this.statusBar.lblTaskStatus.Text = "上传草稿完成";
this.statusBar.pgbTaskProgress.Value = prodSelect.Length;
}));
}
public ShopLoginInfo AdminGetServerShop(string shop_id)
{
List<ShopLoginInfo> list = new List<ShopLoginInfo>();
var url = BaseClass.BuildObjString("shop/admin_get_shop_list");
var data = UserLogin.GetSignaturex() +
"&search_id=" + shop_id;
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("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass"))
{
return null;
}
var jArr = JObject.Parse(html)["data"];
if (jArr.Count() == 0)
return null;
foreach (JObject jObj in jArr)
{
string shopStr = jObj.ToString();
ShopLoginInfo shop = new ShopLoginInfo();
shop.DbId = BaseRegex.GetStringJson(ref shopStr, "id");
if (shop.DbId == null)
continue;
shop.LoginName = BaseRegex.GetStringJson(ref shopStr, "login_name");
shop.Password = BaseRegex.GetStringJson(ref shopStr, "login_pass");
shop.ShopId = BaseRegex.GetStringJson(ref shopStr, "shop_id");
shop.ShopAccount = BaseRegex.GetStringJson(ref shopStr, "shop_account");
shop.UserName = BaseRegex.GetStringJson(ref shopStr, "user_name");
shop.SubUserName = BaseRegex.GetStringJson(ref shopStr, "sub_user_name");
shop.GroupName = BaseRegex.GetStringJson(ref shopStr, "shop_group");
shop.Cookies = BaseRegex.GetStringJson(ref shopStr, "cookie");
shop.Cookies = shop.Cookies.Replace("&", "&").Replace("%", "%").Replace("+", "+");
shop.CompanyName = BaseRegex.GetStringJson(ref shopStr, "company_name");
shop.Notes = BaseRegex.GetStringJson(ref shopStr, "notes");
shop.LoginStatus = BaseRegex.GetStringJson(ref shopStr, "login_status");
list.Add(shop);
}
return list.FirstOrDefault();
}
public TemuDBProduct GetProductDetail(string prodDbId)
{
if (string.IsNullOrEmpty(prodDbId))
return null;
List<TemuDBProduct> list = new List<TemuDBProduct>();
var url = BaseClass.BuildObjString("product/get_product_detail_list");
var data = "";
data = UserLogin.GetSignaturex() + "&search_db_ids=" + prodDbId;
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"))
{
return null;
}
var jArr = JObject.Parse(html)["data"];
if (jArr.Count() == 0)
return null;
var sProd = JsonHelper.SerializeObject(jArr);
try
{
list = JsonHelper.DeserializeJsonToList<TemuDBProduct>(sProd);
return list.FirstOrDefault();
}
catch (Exception ex)
{
return null;
}
}
string UploadProduct(ShopLoginInfo shop, TemuProductInfo prodInfo)
{
if (shop == null || string.IsNullOrEmpty(shop.ShopId) || shop.LoginStatus != "登录成功")
{
return "店铺为空或未登录!";
}
TemuProductParam prodParam = new TemuProductParam();
prodParam.carouselImageI18nReqs = prodInfo.carouselImageI18nVOList;
prodParam.carouselImageUrls = prodInfo.carouselImageUrls;
prodParam.cat1Id = prodInfo.categories.cat1.catId;
prodParam.cat2Id = prodInfo.categories.cat2.catId;
prodParam.cat3Id = prodInfo.categories.cat3.catId;
prodParam.cat4Id = prodInfo.categories.cat4.catId;
prodParam.cat5Id = prodInfo.categories.cat5.catId;
prodParam.cat6Id = prodInfo.categories.cat6.catId;
prodParam.cat7Id = prodInfo.categories.cat7.catId;
prodParam.cat8Id = prodInfo.categories.cat8.catId;
prodParam.cat9Id = prodInfo.categories.cat9.catId;
prodParam.cat10Id = prodInfo.categories.cat10.catId;
prodParam.goodsAdvantageLabelTypes = prodInfo.goodsAdvantageLabelVOList != null ?
prodInfo.goodsAdvantageLabelVOList : new List<object>();
prodParam.goodsLayerDecorationCustomizeI18nReqs = prodInfo.goodsLayerDecorationCustomizeI18nVOList;
prodParam.goodsLayerDecorationReqs = new List<GoodsLayerDecorationReqsItem>();
foreach (var goodsLayerDecorationVOInfo in
(prodInfo.goodsLayerDecorationVOList == null ? new List<TemuGoodsLayerDecorationVO>() : prodInfo.goodsLayerDecorationVOList))
{
var goodsLayerDecorationItem = new GoodsLayerDecorationReqsItem()
{
floorId = goodsLayerDecorationVOInfo.floorId,
key = goodsLayerDecorationVOInfo.key,
lang = goodsLayerDecorationVOInfo.lang,
priority = goodsLayerDecorationVOInfo.priority,
type = goodsLayerDecorationVOInfo.type,
contentList = new List<ContentListItem>(),
};
foreach (var contentInfo in goodsLayerDecorationVOInfo.contentList)
{
var contentItem = new ContentListItem()
{
width = contentInfo.width,
height = contentInfo.height,
imgUrl = contentInfo.imgUrl,
};
goodsLayerDecorationItem.contentList.Add(contentItem);
}
prodParam.goodsLayerDecorationReqs.Add(goodsLayerDecorationItem);
}
prodParam.goodsModelReqs = prodInfo.goodsModelList != null ? prodInfo.goodsModelList : new List<object>();
prodParam.materialImgUrl = prodInfo.materialImgUrl;
prodParam.materialMultiLanguages = prodInfo.productLocalExtAttr.materialMultiLanguages != null ?
prodInfo.productLocalExtAttr.materialMultiLanguages : new List<object>();
prodParam.personalizationSwitch = prodInfo.productWhExtAttr.personalizationSwitch.ParseToInt();
var carouseVideoVOList = JsonHelper.SerializeObject(prodInfo.carouseVideoVOList);
prodParam.productCarouseVideoReqList = JsonHelper.DeserializeJsonToList<productCarouseVideoReqItem>(carouseVideoVOList);
if (prodParam.productCarouseVideoReqList == null)
prodParam.productCarouseVideoReqList = new List<productCarouseVideoReqItem>();
//此处打开商品编辑详情无法获取到,如何查询存疑
prodParam.productComplianceStatementReq = new ProductComplianceStatementReq
{
protocolVersion = "V1.0",
protocolUrl = "https://bdl.cdnfe.com/upload_bdl/seller-protocol/00f56a69-7bee-4768-8cef-e1682ffd58e3.html",
};
prodParam.productDetailVideoReqList = prodInfo.detailVideoVOList;
//是否需要存疑
prodParam.productDraftId = 0;
prodParam.productGuideFileI18nReqs = prodInfo.productGuideFileI18nList;
prodParam.productGuideFileNewReqList = prodInfo.productGuideFileNewVOList;
prodParam.productName = prodInfo.productName;
prodParam.productNonAuditExtAttrReq = new ProductNonAuditExtAttrReq()
{
california65WarningInfoReq = new California65WarningInfoReq()
{
california65ChemicalNames = prodInfo.productNonAuditExtAttr.california65WarningInfoVO.california65ChemicalNames,
},
cosmeticInfoReq = new CosmeticInfoReq()
{
},
};
//内容存疑
prodParam.productOriginCertFileReqs = new List<object>();
prodParam.productOuterPackageImageReqs = new List<ProductOuterPackageImageReqsItem>();
foreach (var picInfo in prodInfo.outerPackageImages)
{
prodParam.productOuterPackageImageReqs.Add(new ProductOuterPackageImageReqsItem()
{
imageUrl = picInfo.imageUrl,
});
}
prodParam.productOuterPackageReq = new ProductOuterPackageReq()
{
packageShape = prodInfo.productWhExtAttr.productOuterPackage.packageShape,
packageType = prodInfo.productWhExtAttr.productOuterPackage.packageType,
};
prodParam.productPropertyReqs = new List<ProductPropertyReqsItem>();
foreach (var propInfo in prodInfo.productPropertyList)
{
prodParam.productPropertyReqs.Add(new ProductPropertyReqsItem
{
numberInputValue = propInfo.numberInputValue,
pid = propInfo.pid,
propName = propInfo.propName,
propValue = propInfo.propValue,
refPid = propInfo.refPid,
templatePid = propInfo.templatePid,
valueExtendInfo = propInfo.valueExtendInfo,
valueUnit = propInfo.valueUnit,
vid = propInfo.vid,
});
}
prodParam.productSaleExtAttrReq = new ProductSaleExtAttrReq
{
bodyShape = prodInfo.productSaleExtAttr.bodyShape,
};
prodParam.productSpecPropertyReqs = new List<ProductSpecPropertyReqsItem>();
foreach (var specPropInfo in prodInfo.productSpecPropertyVOS)
{
try
{
var jStr = JsonHelper.SerializeObject(specPropInfo);
ProductSpecPropertyReqsItem specItem = JsonHelper.DeserializeJsonToObject<ProductSpecPropertyReqsItem>(jStr);
prodParam.productSpecPropertyReqs.Add(specItem);
}
catch (Exception ex)
{
BaseMsgForm.ShowError(ex.Message);
}
}
prodParam.productWhExtAttrReq = new ProductWhExtAttrReq()
{
outerGoodsUrl = prodInfo.productWhExtAttr.outerGoodsUrl,
productOrigin = new ProductOrigin
{
countryShortName = prodInfo.productWhExtAttr.productOrigin.countryShortName,
region2Id = prodInfo.productWhExtAttr.productOrigin.region2Id,
},
};
prodParam.sensitiveTransNormalFileReqs = prodInfo.productWhExtAttr.sensitiveTransNormalFiles;
prodParam.showSizeTemplateIds = prodInfo.showSizeTemplateIds != null ? prodInfo.showSizeTemplateIds : new List<long?>();
prodParam.sizeTemplateIds = prodInfo.sizeTemplateIds != null ? prodInfo.sizeTemplateIds : new List<long?>();
prodParam.productSkcReqs = new List<ProductSkcReqsItem>();
foreach (var skcInfo in prodInfo.productSkcList)
{
ProductSkcReqsItem skcItem = new ProductSkcReqsItem();
skcItem.extCode = skcInfo.extCode;
skcItem.isBasePlate = 0;
skcItem.mainProductSkuSpecReqs = new List<MainProductSkuSpecReqsItem>();
foreach (var skuSpecInfo in skcInfo.productSkcSpecList)
{
skcItem.mainProductSkuSpecReqs.Add(new MainProductSkuSpecReqsItem
{
parentSpecId = skuSpecInfo.parentSpecId,
parentSpecName = skuSpecInfo.parentSpecName,
specId = skuSpecInfo.specId,
specName = skuSpecInfo.specName,
});
}
skcItem.previewImgUrls = skcInfo.previewImgUrls;
skcItem.productSkcCarouselImageI18nReqs = skcInfo.productSkcCarouselImageI18nVOList;
skcItem.productSkcId = 0;
skcItem.productSkuReqs = new List<ProductSkuReqsItem>();
foreach (var skuInfo in skcInfo.productSkuList)
{
ProductSkuReqsItem skuItem = new ProductSkuReqsItem();
skuItem.currencyType = skuInfo.currencyType;
skuItem.extCode = skuInfo.extCode;
skuItem.productSkuAccessoriesReq = new ProductSkuAccessoriesReq()
{
productSkuAccessories = skuInfo.productSkuSaleExtAttr.productSkuAccessories?.productSkuAccessories,
};
skuItem.productSkuId = 0;
skuItem.productSkuMultiPackReq = new ProductSkuMultiPackReq()
{
numberOfPieces = skuInfo.productSkuMultiPack.numberOfPieces,
pieceUnitCode = skuInfo.productSkuMultiPack.pieceUnitCode,
productSkuNetContentReq = JsonHelper.DeserializeJsonToObject<ProductSkuNetContentReq>(
JsonHelper.SerializeObject(skuInfo.productSkuMultiPack.productSkuNetContent)),
skuClassification = skuInfo.productSkuMultiPack.skuClassification,
};
skuItem.productSkuNonAuditExtAttrReq = JsonHelper.DeserializeJsonToObject<ProductSkuNonAuditExtAttrReq>(
JsonHelper.SerializeObject(skuInfo.productSkuNonAuditExtAttr));
if (skuItem.productSkuNonAuditExtAttrReq == null)
skuItem.productSkuNonAuditExtAttrReq = new ProductSkuNonAuditExtAttrReq();
skuItem.productSkuSpecReqs = new List<ProductSkuSpecReqsItem>();
int groupId = 0;
foreach (var skuSpecInfo in skuInfo.productSkuSpecList)
{
groupId++;
ProductSkuSpecReqsItem skuSpecItem = new ProductSkuSpecReqsItem()
{
groupId = groupId,
parentSpecId = skuSpecInfo.parentSpecId,
parentSpecName = skuSpecInfo.parentSpecName,
specId = skuSpecInfo.specId,
specName = skuSpecInfo.specName,
vid = prodParam.productSpecPropertyReqs.FirstOrDefault(p => p.specId == skuSpecInfo.specId)?.vid,
};
skuItem.productSkuSpecReqs.Add(skuSpecItem);
}
skuItem.productSkuSuggestedPriceReq = JsonHelper.DeserializeJsonToObject<ProductSkuSuggestedPriceReq>(
JsonHelper.SerializeObject(skuInfo.productSkuSuggestedPrice));
// 建议售价不能为空
if (skuItem.productSkuSuggestedPriceReq == null)
{
skuItem.productSkuSuggestedPriceReq = new ProductSkuSuggestedPriceReq();
}
if (skuItem.productSkuSuggestedPriceReq.suggestedPrice == null && skuItem.productSkuSuggestedPriceReq.specialSuggestedPrice == null)
{
skuItem.productSkuSuggestedPriceReq.specialSuggestedPrice = "NA";
}
skuItem.productSkuThumbUrlI18nReqs = skuInfo.productSkuThumbUrlI18nVOList;
skuItem.productSkuUsSuggestedPriceReq = JsonHelper.DeserializeJsonToObject<ProductSkuUsSuggestedPriceReq>(
JsonHelper.SerializeObject(skuInfo.productSkuUsSuggestedPrice));
skuItem.productSkuWhExtAttrReq = new ProductSkuWhExtAttrReq()
{
productSkuBarCodeReqs = skuInfo.productSkuWhExtAttr.productSkuBarCodes,
productSkuSensitiveAttrReq = new ProductSkuSensitiveAttrReq()
{
isSensitive = skuInfo.productSkuWhExtAttr.productSkuSensitiveAttr.isSensitive,
sensitiveList = skuInfo.productSkuWhExtAttr.productSkuSensitiveAttr.sensitiveList,
},
productSkuSensitiveLimitReq = JsonHelper.DeserializeJsonToObject<ProductSkuSensitiveLimitReq>(
JsonHelper.SerializeObject(skuInfo.productSkuWhExtAttr.productSkuSensitiveLimit)),
productSkuVolumeReq = JsonHelper.DeserializeJsonToObject<ProductSkuVolumeReq>(
JsonHelper.SerializeObject(skuInfo.productSkuWhExtAttr.productSkuVolume)),
productSkuWeightReq = JsonHelper.DeserializeJsonToObject<ProductSkuWeightReq>(
JsonHelper.SerializeObject(skuInfo.productSkuWhExtAttr.productSkuWeight)),
};
skuItem.supplierPrice = skuInfo.supplierPrice;
skuItem.thumbUrl = skuInfo.thumbUrl;
skcItem.productSkuReqs.Add(skuItem);
}
prodParam.productSkcReqs.Add(skcItem);
}
long catId = prodParam.cat10Id.ParseToLong();
if (catId == 0) catId = prodParam.cat9Id.ParseToLong();
if (catId == 0) catId = prodParam.cat8Id.ParseToLong();
if (catId == 0) catId = prodParam.cat7Id.ParseToLong();
if (catId == 0) catId = prodParam.cat6Id.ParseToLong();
if (catId == 0) catId = prodParam.cat5Id.ParseToLong();
if (catId == 0) catId = prodParam.cat4Id.ParseToLong();
if (catId == 0) catId = prodParam.cat3Id.ParseToLong();
if (catId == 0) catId = prodParam.cat2Id.ParseToLong();
if (catId == 0) catId = prodParam.cat1Id.ParseToLong();
var html = AddDraft(shop, catId.ToString());
if (html.Contains("{\"success\":true"))
prodParam.productDraftId = BaseRegex.GetLongJson(ref html, "productDraftId");
else
{
var error = BaseRegex.GetStringJson(ref html, "errorMsg");
return "上传失败" + error;
}
if (prodParam.productDraftId <= 0)
{
return "上传失败" + html;
}
html = SaveDraft(shop, prodParam.productDraftId.ToString(), prodParam);
if (html.Contains("{\"success\":true"))
return "上传草稿箱成功" + prodParam.productDraftId.ToString();
else
{
var error = BaseRegex.GetStringJson(ref html, "errorMsg");
return "上传草稿箱失败" + error;
}
#region 草稿箱后立即上传商品 暂时注释
//Thread.Sleep(Randomx.GetId(2000, 3000));
//html = AddProduct(shop, prodParam.productDraftId.ToString(), prodParam);
//if (html.Contains("{\"success\":true"))
// BaseMsgForm.ShowInfo("上传商品成功");
//else
//{
// var error = BaseRegex.GetStringJson(ref html, "errorMsg");
// if (string.IsNullOrWhiteSpace(error))
// error = BaseRegex.GetStringJson(ref html, "error_msg");
// BaseMsgForm.ShowError(("上传商品失败\r\n" + error + "\r\n请在草稿箱查找商品!").Replace("\r\n\r\n", "\r\n"));
// return;
//}
#endregion
}
private string AddDraft(ShopLoginInfo shop, string catId)
{
string url = "https://seller.kuajingmaihuo.com/bg-visage-mms/product/draft/add";
string refere = "https://seller.kuajingmaihuo.com/goods/product-create/category?from=productList";
string body = @"{""catId"":" + catId + "}";
return KJDHttpResponse.PostResponse(shop, url, body, refere);
}
private string SaveDraft(ShopLoginInfo shop, string draftId, TemuProductParam prodParam)
{
string url = "https://seller.kuajingmaihuo.com/bg-visage-mms/product/draft/save";
string body = JsonHelper.SerializeObject(prodParam);
string refere = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" +
draftId + "&from=productDraftList";
return KJDHttpResponse.PostResponse(shop, url, body, refere);
}
private string AddProduct(ShopLoginInfo shop, string draftId, TemuProductParam prodParam)
{
string url = "https://seller.kuajingmaihuo.com/bg-visage-mms/product/add";
string body = JsonHelper.SerializeObject(prodParam);
string refere = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" +
draftId + "&from=productDraftList";
return KJDHttpResponse.PostResponse(shop, url, body, refere);
}
}
}
@@ -117,6 +117,45 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="colSelect.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSelectId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSupplierId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSupplierName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSpuId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colProductSkcPic.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colProductName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colProductCat.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colExtCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colMsg.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDraftId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColDelete.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colOpResult.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
@@ -1,322 +0,0 @@
namespace TemuKJD.KJDForms.ProductSelectForms
{
partial class ProductSelectListForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProductSelectListForm));
this.panel2 = new System.Windows.Forms.Panel();
this.label8 = new System.Windows.Forms.Label();
this.txtNotes = new DevComponents.DotNetBar.Controls.TextBoxX();
this.label7 = new System.Windows.Forms.Label();
this.cmbGroup = new System.Windows.Forms.ComboBox();
this.txtBuyAccount = new DevComponents.DotNetBar.Controls.TextBoxX();
this.label6 = new System.Windows.Forms.Label();
this.txtChatAccount = new DevComponents.DotNetBar.Controls.TextBoxX();
this.label4 = new System.Windows.Forms.Label();
this.txtUploadAccount = new DevComponents.DotNetBar.Controls.TextBoxX();
this.label3 = new System.Windows.Forms.Label();
this.txtShopPassword = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.txtLoginName = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.btnOk = new TemuKJD.UserControls.ButtonEx();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.White;
this.panel2.Controls.Add(this.label8);
this.panel2.Controls.Add(this.txtNotes);
this.panel2.Controls.Add(this.label7);
this.panel2.Controls.Add(this.cmbGroup);
this.panel2.Controls.Add(this.txtBuyAccount);
this.panel2.Controls.Add(this.label6);
this.panel2.Controls.Add(this.txtChatAccount);
this.panel2.Controls.Add(this.label4);
this.panel2.Controls.Add(this.txtUploadAccount);
this.panel2.Controls.Add(this.label3);
this.panel2.Controls.Add(this.txtShopPassword);
this.panel2.Controls.Add(this.label2);
this.panel2.Controls.Add(this.txtLoginName);
this.panel2.Controls.Add(this.label1);
this.panel2.Controls.Add(this.label5);
this.panel2.Controls.Add(this.btnOk);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(1, 33);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(1011, 648);
this.panel2.TabIndex = 1;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(29, 135);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(56, 17);
this.label8.TabIndex = 386;
this.label8.Text = " 备注";
this.label8.Visible = false;
//
// txtNotes
//
//
//
//
this.txtNotes.Border.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtNotes.Border.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtNotes.Border.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtNotes.Border.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtNotes.Border.Class = "CrumbBarBackgroundKey";
this.txtNotes.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.txtNotes.Border.PaddingBottom = 2;
this.txtNotes.Border.PaddingLeft = 2;
this.txtNotes.Border.PaddingRight = 2;
this.txtNotes.Border.PaddingTop = 2;
this.txtNotes.Location = new System.Drawing.Point(91, 133);
this.txtNotes.Name = "txtNotes";
this.txtNotes.Size = new System.Drawing.Size(172, 23);
this.txtNotes.TabIndex = 385;
this.txtNotes.Visible = false;
//
// label7
//
this.label7.AutoSize = true;
this.label7.ForeColor = System.Drawing.Color.DarkGray;
this.label7.Location = new System.Drawing.Point(31, 214);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(164, 17);
this.label7.TabIndex = 384;
this.label7.Text = "登录密码为空表示不更新密码";
this.label7.Visible = false;
//
// cmbGroup
//
this.cmbGroup.FormattingEnabled = true;
this.cmbGroup.Items.AddRange(new object[] {
"客服",
"采购",
"上货",
"数据",
"登录"});
this.cmbGroup.Location = new System.Drawing.Point(91, 269);
this.cmbGroup.Name = "cmbGroup";
this.cmbGroup.Size = new System.Drawing.Size(172, 25);
this.cmbGroup.TabIndex = 383;
this.cmbGroup.Visible = false;
//
// txtBuyAccount
//
//
//
//
this.txtBuyAccount.Border.Class = "CrumbBarBackgroundKey";
this.txtBuyAccount.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.txtBuyAccount.Border.PaddingBottom = 2;
this.txtBuyAccount.Border.PaddingLeft = 2;
this.txtBuyAccount.Border.PaddingRight = 2;
this.txtBuyAccount.Border.PaddingTop = 2;
this.txtBuyAccount.Location = new System.Drawing.Point(91, 240);
this.txtBuyAccount.Name = "txtBuyAccount";
this.txtBuyAccount.Size = new System.Drawing.Size(172, 23);
this.txtBuyAccount.TabIndex = 382;
this.txtBuyAccount.Visible = false;
this.txtBuyAccount.WatermarkText = "点击添加店铺子账户";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(29, 243);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(56, 17);
this.label6.TabIndex = 381;
this.label6.Text = "采购账户";
this.label6.Visible = false;
//
// txtChatAccount
//
//
//
//
this.txtChatAccount.Border.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtChatAccount.Border.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtChatAccount.Border.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtChatAccount.Border.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtChatAccount.Border.Class = "CrumbBarBackgroundKey";
this.txtChatAccount.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.txtChatAccount.Border.PaddingBottom = 2;
this.txtChatAccount.Border.PaddingLeft = 2;
this.txtChatAccount.Border.PaddingRight = 2;
this.txtChatAccount.Border.PaddingTop = 2;
this.txtChatAccount.Location = new System.Drawing.Point(91, 99);
this.txtChatAccount.Name = "txtChatAccount";
this.txtChatAccount.Size = new System.Drawing.Size(172, 23);
this.txtChatAccount.TabIndex = 380;
this.txtChatAccount.Visible = false;
this.txtChatAccount.WatermarkText = "点击添加店铺子账户";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(29, 102);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(56, 17);
this.label4.TabIndex = 379;
this.label4.Text = " 子账户";
this.label4.Visible = false;
//
// txtUploadAccount
//
//
//
//
this.txtUploadAccount.Border.Class = "CrumbBarBackgroundKey";
this.txtUploadAccount.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.txtUploadAccount.Border.PaddingBottom = 2;
this.txtUploadAccount.Border.PaddingLeft = 2;
this.txtUploadAccount.Border.PaddingRight = 2;
this.txtUploadAccount.Border.PaddingTop = 2;
this.txtUploadAccount.Location = new System.Drawing.Point(91, 99);
this.txtUploadAccount.Name = "txtUploadAccount";
this.txtUploadAccount.Size = new System.Drawing.Size(172, 23);
this.txtUploadAccount.TabIndex = 374;
this.txtUploadAccount.Visible = false;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(29, 102);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(56, 17);
this.label3.TabIndex = 373;
this.label3.Text = "上货账户";
this.label3.Visible = false;
//
// txtShopPassword
//
this.txtShopPassword.Location = new System.Drawing.Point(91, 64);
this.txtShopPassword.Name = "txtShopPassword";
this.txtShopPassword.PasswordChar = '●';
this.txtShopPassword.Size = new System.Drawing.Size(172, 23);
this.txtShopPassword.TabIndex = 338;
this.txtShopPassword.Visible = false;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(29, 67);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 17);
this.label2.TabIndex = 337;
this.label2.Text = "登录密码";
this.label2.Visible = false;
//
// txtLoginName
//
this.txtLoginName.Location = new System.Drawing.Point(91, 29);
this.txtLoginName.Name = "txtLoginName";
this.txtLoginName.Size = new System.Drawing.Size(172, 23);
this.txtLoginName.TabIndex = 336;
this.txtLoginName.Visible = false;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(29, 32);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 17);
this.label1.TabIndex = 0;
this.label1.Text = "登录账号";
this.label1.Visible = false;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(29, 272);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(56, 17);
this.label5.TabIndex = 377;
this.label5.Text = "店铺分组";
this.label5.Visible = false;
//
// btnOk
//
this.btnOk.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnOk.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnOk.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnOk.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOk.ForeColor = System.Drawing.Color.White;
this.btnOk.Location = new System.Drawing.Point(208, 209);
this.btnOk.Margin = new System.Windows.Forms.Padding(2);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(55, 26);
this.btnOk.TabIndex = 372;
this.btnOk.Text = "新增";
this.btnOk.UseVisualStyleBackColor = false;
this.btnOk.Visible = false;
//
// ProductSelectListForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1013, 682);
this.Controls.Add(this.panel2);
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.Name = "ProductSelectListForm";
this.Text = "选品列表";
this.TitleText = "选品列表";
this.Load += new System.EventHandler(this.ProductSelectListForm_Load);
this.Controls.SetChildIndex(this.panel2, 0);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtShopPassword;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtLoginName;
private UserControls.ButtonEx btnOk;
private System.Windows.Forms.Label label5;
private DevComponents.DotNetBar.Controls.TextBoxX txtUploadAccount;
private System.Windows.Forms.Label label3;
private DevComponents.DotNetBar.Controls.TextBoxX txtBuyAccount;
private System.Windows.Forms.Label label6;
private DevComponents.DotNetBar.Controls.TextBoxX txtChatAccount;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox cmbGroup;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private DevComponents.DotNetBar.Controls.TextBoxX txtNotes;
}
}
@@ -1,28 +0,0 @@
using AllBase.Helper;
using AllBase.Model.Result;
using TemuKJD.KJDForms.BaseForms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TemuKJD.KJDForms.ProductSelectForms
{
public partial class ProductSelectListForm : LRBaseForm
{
public ProductSelectListForm()
{
InitializeComponent();
}
private void ProductSelectListForm_Load(object sender, EventArgs e)
{
}
}
}
@@ -44,6 +44,15 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx();
this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colShopLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colShopName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colLoginStatus = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSelectProduct = new System.Windows.Forms.DataGridViewLinkColumn();
this.colCanUse = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.pbLoading = new System.Windows.Forms.PictureBox();
this.dgvSelectProduct = new TemuKJD.UserComponent.DataGridViewEx();
this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colSelectId = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -54,19 +63,15 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.colProductSkcPic = new System.Windows.Forms.DataGridViewImageColumn();
this.colProductName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colProductCat = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColDelete = new System.Windows.Forms.DataGridViewLinkColumn();
this.colExtCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colMsg = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colDraftId = new System.Windows.Forms.DataGridViewLinkColumn();
this.ColDelete = new System.Windows.Forms.DataGridViewLinkColumn();
this.splitContainer4 = new System.Windows.Forms.SplitContainer();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
this.panelEx1 = new DevComponents.DotNetBar.PanelEx();
this.btnClear = new DevComponents.DotNetBar.PanelEx();
this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colShopLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colShopName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSelectProduct = new System.Windows.Forms.DataGridViewLinkColumn();
this.colCanUse = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -82,6 +87,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvShop)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dgvSelectProduct)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainer4)).BeginInit();
this.splitContainer4.Panel1.SuspendLayout();
@@ -146,6 +152,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.btnSearch.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnSearch.TabIndex = 427;
this.btnSearch.Text = "认领商品查询";
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
//
// ucGroupBoxEx1
//
@@ -219,6 +226,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.pbLoading);
this.splitContainer2.Panel2.Controls.Add(this.dgvSelectProduct);
this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0);
this.splitContainer2.Size = new System.Drawing.Size(1152, 392);
@@ -247,6 +255,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.colShopLoginName,
this.colShopId,
this.colShopName,
this.colLoginStatus,
this.colSelectProduct,
this.colCanUse,
this.colMessage});
@@ -262,207 +271,6 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.dgvShop.TabIndex = 6;
this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick);
//
// dgvSelectProduct
//
this.dgvSelectProduct.AllowUserToAddRows = false;
this.dgvSelectProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle4.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4;
this.dgvSelectProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvSelectProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
this.dgvSelectProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvSelectProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
this.colSelectId,
this.colSupplierId,
this.colSupplierName,
this.colSpuId,
this.colSkcId,
this.colProductSkcPic,
this.colProductName,
this.colProductCat,
this.ColDelete,
this.colMsg});
this.dgvSelectProduct.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvSelectProduct.Location = new System.Drawing.Point(0, 0);
this.dgvSelectProduct.Name = "dgvSelectProduct";
this.dgvSelectProduct.ReadOnly = true;
dataGridViewCellStyle6.Font = new System.Drawing.Font("微软雅黑", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.dgvSelectProduct.RowsDefaultCellStyle = dataGridViewCellStyle6;
this.dgvSelectProduct.RowTemplate.Height = 23;
this.dgvSelectProduct.Size = new System.Drawing.Size(874, 392);
this.dgvSelectProduct.TabIndex = 187;
//
// colCheck
//
this.colCheck.HeaderText = "选择";
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;
//
// colSelectId
//
this.colSelectId.HeaderText = "认领Id";
this.colSelectId.Name = "colSelectId";
this.colSelectId.ReadOnly = true;
this.colSelectId.Visible = false;
//
// colSupplierId
//
this.colSupplierId.HeaderText = "店铺Id";
this.colSupplierId.Name = "colSupplierId";
this.colSupplierId.ReadOnly = true;
//
// colSupplierName
//
this.colSupplierName.HeaderText = "店铺名称";
this.colSupplierName.Name = "colSupplierName";
this.colSupplierName.ReadOnly = true;
this.colSupplierName.Width = 110;
//
// colSpuId
//
this.colSpuId.HeaderText = "商品SPU";
this.colSpuId.Name = "colSpuId";
this.colSpuId.ReadOnly = true;
this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
//
// colSkcId
//
this.colSkcId.FillWeight = 150F;
this.colSkcId.HeaderText = "商品SKC";
this.colSkcId.Name = "colSkcId";
this.colSkcId.ReadOnly = true;
this.colSkcId.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colSkcId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colSkcId.Width = 80;
//
// colProductSkcPic
//
this.colProductSkcPic.HeaderText = "Skc图片";
this.colProductSkcPic.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom;
this.colProductSkcPic.Name = "colProductSkcPic";
this.colProductSkcPic.ReadOnly = true;
this.colProductSkcPic.Width = 60;
//
// colProductName
//
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
this.colProductName.Width = 220;
//
// colProductCat
//
this.colProductCat.HeaderText = "商品类目";
this.colProductCat.Name = "colProductCat";
this.colProductCat.ReadOnly = true;
this.colProductCat.Width = 90;
//
// ColDelete
//
this.ColDelete.HeaderText = "删除";
this.ColDelete.Name = "ColDelete";
this.ColDelete.ReadOnly = true;
//
// colMsg
//
this.colMsg.HeaderText = "状态";
this.colMsg.Name = "colMsg";
this.colMsg.ReadOnly = true;
this.colMsg.Visible = false;
this.colMsg.Width = 400;
//
// splitContainer4
//
this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer4.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer4.Location = new System.Drawing.Point(0, 0);
this.splitContainer4.Name = "splitContainer4";
//
// splitContainer4.Panel1
//
this.splitContainer4.Panel1.Controls.Add(this.statusBar);
//
// splitContainer4.Panel2
//
this.splitContainer4.Panel2.Controls.Add(this.panelEx1);
this.splitContainer4.Panel2.Controls.Add(this.btnClear);
this.splitContainer4.Size = new System.Drawing.Size(1152, 26);
this.splitContainer4.SplitterDistance = 874;
this.splitContainer4.TabIndex = 3;
//
// statusBar
//
this.statusBar.BackColor = System.Drawing.Color.White;
this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill;
this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.statusBar.Location = new System.Drawing.Point(0, 0);
this.statusBar.Margin = new System.Windows.Forms.Padding(0);
this.statusBar.Name = "statusBar";
this.statusBar.Size = new System.Drawing.Size(874, 26);
this.statusBar.TabIndex = 2;
//
// panelEx1
//
this.panelEx1.CanvasColor = System.Drawing.SystemColors.Control;
this.panelEx1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.panelEx1.DisabledBackColor = System.Drawing.Color.Empty;
this.panelEx1.Location = new System.Drawing.Point(155, 0);
this.panelEx1.Name = "panelEx1";
this.panelEx1.Size = new System.Drawing.Size(115, 21);
this.panelEx1.Style.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx1.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.panelEx1.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.panelEx1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.panelEx1.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx1.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.panelEx1.Style.GradientAngle = 90;
this.panelEx1.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx1.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx1.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx1.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx1.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.panelEx1.TabIndex = 668;
this.panelEx1.Text = "停止当前操作";
//
// btnClear
//
this.btnClear.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.btnClear.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnClear.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnClear.DisabledBackColor = System.Drawing.Color.Empty;
this.btnClear.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnClear.Location = new System.Drawing.Point(47, 0);
this.btnClear.Name = "btnClear";
this.btnClear.Size = new System.Drawing.Size(90, 21);
this.btnClear.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnClear.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClear.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClear.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnClear.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnClear.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnClear.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnClear.Style.GradientAngle = 90;
this.btnClear.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnClear.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnClear.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnClear.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.btnClear.TabIndex = 440;
this.btnClear.Text = "清空结果";
this.btnClear.Visible = false;
//
// colSelect
//
this.colSelect.HeaderText = "全选";
@@ -496,6 +304,13 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.colShopName.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colShopName.Width = 75;
//
// colLoginStatus
//
this.colLoginStatus.HeaderText = "登录状态";
this.colLoginStatus.Name = "colLoginStatus";
this.colLoginStatus.ReadOnly = true;
this.colLoginStatus.Visible = false;
//
// colSelectProduct
//
this.colSelectProduct.HeaderText = "认领商品";
@@ -521,12 +336,255 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.colMessage.Name = "colMessage";
this.colMessage.ReadOnly = true;
//
// pbLoading
//
this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue;
this.pbLoading.Location = new System.Drawing.Point(414, 171);
this.pbLoading.Name = "pbLoading";
this.pbLoading.Size = new System.Drawing.Size(50, 50);
this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pbLoading.TabIndex = 188;
this.pbLoading.TabStop = false;
this.pbLoading.Visible = false;
//
// dgvSelectProduct
//
this.dgvSelectProduct.AllowUserToAddRows = false;
this.dgvSelectProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle4.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4;
this.dgvSelectProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvSelectProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
this.dgvSelectProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvSelectProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
this.colSelectId,
this.colSupplierId,
this.colSupplierName,
this.colSpuId,
this.colSkcId,
this.colProductSkcPic,
this.colProductName,
this.colProductCat,
this.colExtCode,
this.colMsg,
this.colDraftId,
this.ColDelete});
this.dgvSelectProduct.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvSelectProduct.Location = new System.Drawing.Point(0, 0);
this.dgvSelectProduct.Name = "dgvSelectProduct";
this.dgvSelectProduct.ReadOnly = true;
dataGridViewCellStyle6.Font = new System.Drawing.Font("微软雅黑", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.dgvSelectProduct.RowsDefaultCellStyle = dataGridViewCellStyle6;
this.dgvSelectProduct.RowTemplate.Height = 23;
this.dgvSelectProduct.Size = new System.Drawing.Size(874, 392);
this.dgvSelectProduct.TabIndex = 187;
this.dgvSelectProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSelectProduct_CellContentClick);
//
// colCheck
//
this.colCheck.HeaderText = "选择";
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;
//
// colSelectId
//
this.colSelectId.HeaderText = "认领Id";
this.colSelectId.Name = "colSelectId";
this.colSelectId.ReadOnly = true;
//
// colSupplierId
//
this.colSupplierId.HeaderText = "店铺Id";
this.colSupplierId.Name = "colSupplierId";
this.colSupplierId.ReadOnly = true;
//
// colSupplierName
//
this.colSupplierName.HeaderText = "店铺名称";
this.colSupplierName.Name = "colSupplierName";
this.colSupplierName.ReadOnly = true;
this.colSupplierName.Width = 110;
//
// colSpuId
//
this.colSpuId.HeaderText = "商品SPU";
this.colSpuId.Name = "colSpuId";
this.colSpuId.ReadOnly = true;
this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colSpuId.Visible = false;
//
// colSkcId
//
this.colSkcId.FillWeight = 150F;
this.colSkcId.HeaderText = "商品SKC";
this.colSkcId.Name = "colSkcId";
this.colSkcId.ReadOnly = true;
this.colSkcId.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colSkcId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colSkcId.Visible = false;
this.colSkcId.Width = 80;
//
// colProductSkcPic
//
this.colProductSkcPic.HeaderText = "Skc图片";
this.colProductSkcPic.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom;
this.colProductSkcPic.Name = "colProductSkcPic";
this.colProductSkcPic.ReadOnly = true;
this.colProductSkcPic.Width = 60;
//
// colProductName
//
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
this.colProductName.Width = 260;
//
// colProductCat
//
this.colProductCat.HeaderText = "商品类目";
this.colProductCat.Name = "colProductCat";
this.colProductCat.ReadOnly = true;
this.colProductCat.Width = 90;
//
// colExtCode
//
this.colExtCode.HeaderText = "商品货号";
this.colExtCode.Name = "colExtCode";
this.colExtCode.ReadOnly = true;
//
// colMsg
//
this.colMsg.HeaderText = "状态";
this.colMsg.Name = "colMsg";
this.colMsg.ReadOnly = true;
//
// colDraftId
//
this.colDraftId.HeaderText = "草稿箱Id";
this.colDraftId.Name = "colDraftId";
this.colDraftId.ReadOnly = true;
this.colDraftId.Visible = false;
//
// ColDelete
//
this.ColDelete.HeaderText = "删除";
this.ColDelete.Name = "ColDelete";
this.ColDelete.ReadOnly = true;
//
// splitContainer4
//
this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer4.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer4.Location = new System.Drawing.Point(0, 0);
this.splitContainer4.Name = "splitContainer4";
//
// splitContainer4.Panel1
//
this.splitContainer4.Panel1.Controls.Add(this.statusBar);
//
// splitContainer4.Panel2
//
this.splitContainer4.Panel2.Controls.Add(this.ucSplitPage1);
this.splitContainer4.Panel2.Controls.Add(this.panelEx1);
this.splitContainer4.Panel2.Controls.Add(this.btnClear);
this.splitContainer4.Size = new System.Drawing.Size(1152, 26);
this.splitContainer4.SplitterDistance = 539;
this.splitContainer4.TabIndex = 3;
//
// statusBar
//
this.statusBar.BackColor = System.Drawing.Color.White;
this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill;
this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.statusBar.Location = new System.Drawing.Point(0, 0);
this.statusBar.Margin = new System.Windows.Forms.Padding(0);
this.statusBar.Name = "statusBar";
this.statusBar.Size = new System.Drawing.Size(539, 26);
this.statusBar.TabIndex = 2;
//
// ucSplitPage1
//
this.ucSplitPage1.CurrentPage = 1;
this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right;
this.ucSplitPage1.Location = new System.Drawing.Point(36, 0);
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
this.ucSplitPage1.Name = "ucSplitPage1";
this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
this.ucSplitPage1.Size = new System.Drawing.Size(573, 26);
this.ucSplitPage1.TabIndex = 675;
this.ucSplitPage1.TotalPage = 1;
//
// panelEx1
//
this.panelEx1.CanvasColor = System.Drawing.SystemColors.Control;
this.panelEx1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.panelEx1.DisabledBackColor = System.Drawing.Color.Empty;
this.panelEx1.Location = new System.Drawing.Point(99, 2);
this.panelEx1.Name = "panelEx1";
this.panelEx1.Size = new System.Drawing.Size(115, 21);
this.panelEx1.Style.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx1.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.panelEx1.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.panelEx1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.panelEx1.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx1.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.panelEx1.Style.GradientAngle = 90;
this.panelEx1.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx1.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx1.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx1.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx1.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.panelEx1.TabIndex = 668;
this.panelEx1.Text = "停止当前操作";
this.panelEx1.Visible = false;
//
// btnClear
//
this.btnClear.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.btnClear.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnClear.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnClear.DisabledBackColor = System.Drawing.Color.Empty;
this.btnClear.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnClear.Location = new System.Drawing.Point(3, 2);
this.btnClear.Name = "btnClear";
this.btnClear.Size = new System.Drawing.Size(90, 21);
this.btnClear.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnClear.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClear.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClear.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnClear.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnClear.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnClear.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnClear.Style.GradientAngle = 90;
this.btnClear.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnClear.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnClear.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnClear.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.btnClear.TabIndex = 440;
this.btnClear.Text = "清空结果";
this.btnClear.Visible = false;
//
// UserSelectDbProductForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1152, 546);
this.Controls.Add(this.splitContainer1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "UserSelectDbProductForm";
this.Text = "UserSelectDbProductForm";
this.Load += new System.EventHandler(this.UserSelectDbProductForm_Load);
@@ -546,6 +604,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvShop)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgvSelectProduct)).EndInit();
this.splitContainer4.Panel1.ResumeLayout(false);
this.splitContainer4.Panel2.ResumeLayout(false);
@@ -566,6 +625,20 @@ namespace TemuKJD.KJDForms.ProductSelectForms
private System.Windows.Forms.SplitContainer splitContainer2;
private UserComponent.DataGridViewEx dgvShop;
private UserComponent.DataGridViewEx dgvSelectProduct;
private System.Windows.Forms.SplitContainer splitContainer4;
private UserControls.StatusBarUserControl statusBar;
private DevComponents.DotNetBar.PanelEx panelEx1;
private DevComponents.DotNetBar.PanelEx btnClear;
private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect;
private System.Windows.Forms.DataGridViewTextBoxColumn colShopLoginName;
private System.Windows.Forms.DataGridViewTextBoxColumn colShopId;
private System.Windows.Forms.DataGridViewTextBoxColumn colShopName;
private System.Windows.Forms.DataGridViewTextBoxColumn colLoginStatus;
private System.Windows.Forms.DataGridViewLinkColumn colSelectProduct;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse;
private System.Windows.Forms.DataGridViewTextBoxColumn colMessage;
private System.Windows.Forms.PictureBox pbLoading;
private UserControls.UcSplitPage ucSplitPage1;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colSelectId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
@@ -575,18 +648,9 @@ namespace TemuKJD.KJDForms.ProductSelectForms
private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductName;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductCat;
private System.Windows.Forms.DataGridViewLinkColumn ColDelete;
private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode;
private System.Windows.Forms.DataGridViewTextBoxColumn colMsg;
private System.Windows.Forms.SplitContainer splitContainer4;
private UserControls.StatusBarUserControl statusBar;
private DevComponents.DotNetBar.PanelEx panelEx1;
private DevComponents.DotNetBar.PanelEx btnClear;
private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect;
private System.Windows.Forms.DataGridViewTextBoxColumn colShopLoginName;
private System.Windows.Forms.DataGridViewTextBoxColumn colShopId;
private System.Windows.Forms.DataGridViewTextBoxColumn colShopName;
private System.Windows.Forms.DataGridViewLinkColumn colSelectProduct;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse;
private System.Windows.Forms.DataGridViewTextBoxColumn colMessage;
private System.Windows.Forms.DataGridViewLinkColumn colDraftId;
private System.Windows.Forms.DataGridViewLinkColumn ColDelete;
}
}
@@ -1,23 +1,29 @@
using AllBase.Helper;
using AllBase;
using AllBase.Helper;
using AllBase.Model.Result;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.Extension;
using TemuKJD.KJDForms.BaseForms;
using Work;
namespace TemuKJD.KJDForms.ProductSelectForms
{
public partial class UserSelectDbProductForm : Form
{
CheckBox chkSelectAll = null;
List<TemuDBProductSelect> lstTemuDBProductSelect = new List<TemuDBProductSelect>();
public UserSelectDbProductForm()
{
InitializeComponent();
@@ -31,6 +37,12 @@ namespace TemuKJD.KJDForms.ProductSelectForms
chkSelectAll.CheckedChanged += chkSelectAll_CheckedChanged;
this.dgvSelectProduct.AddSelectorColumn("colCheck");
this.ucSplitPage1.PageChange += UcSplitPage1_PageChange;
}
private void UcSplitPage1_PageChange(object obj)
{
SearchDbProdSelect(this.ucSplitPage1.CurrentPage);
}
private void chkSelectAll_CheckedChanged(object sender, EventArgs e)
@@ -101,6 +113,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
shopEntity.LoginName,
shopEntity.ShopId,
shopEntity.ShopAccount,
shopEntity.LoginStatus,
"选择商品",
canUse,
string.Empty
@@ -152,5 +165,145 @@ namespace TemuKJD.KJDForms.ProductSelectForms
break;
}
}
private void btnSearch_Click(object sender, EventArgs e)
{
var lstShopId = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
if (lstShopId.Count == 0)
{
BaseMsgForm.ShowInfo("请选择店铺!");
return;
}
if (this.ucSplitPage1.CurrentPage != 1)
this.ucSplitPage1.CurrentPage = 1;
else
SearchDbProdSelect(1);
}
public void SearchDbProdSelect(int page)
{
if (InvokeRequired)
{
Invoke(new Action(() =>
{
this.pbLoading.Visible = true;
this.dgvSelectProduct.Rows.Clear();
lstTemuDBProductSelect.Clear();
}));
}
else
{
this.pbLoading.Visible = true;
this.dgvSelectProduct.Rows.Clear();
lstTemuDBProductSelect.Clear();
}
Task.Run(() =>
{
int pageCount;
var list = GetSelectProductList(out pageCount, page);
lstTemuDBProductSelect.AddRange(list);
this.ucSplitPage1.TotalPage = pageCount;
foreach (var prodSelect in lstTemuDBProductSelect)
{
Image image = null;
try
{
using (Stream stream = WebRequest.Create(prodSelect.main_img.Replace("https", "http")).GetResponse().GetResponseStream())
{
image = Image.FromStream(stream);
}
}
catch (Exception ex)
{
}
Invoke(new Action(() =>
{
int rowIndex = this.dgvSelectProduct.Rows.Add(
false,
prodSelect.id,
prodSelect.shop_id,
prodSelect.shop_account,
"",//prodSelect.spu_id,
"",//prodSelect.skc_id,
image,//prod.main_img,
prodSelect.product_name,
prodSelect.cat_name,
prodSelect.ext_code,
prodSelect.status,
prodSelect.draft_id,
"删除");
dgvSelectProduct.Rows[rowIndex].Height = 80;
}));
}
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
}));
});
}
public List<TemuDBProductSelect> GetSelectProductList(out int pageCount, int page = 1, int pageSize = 50)
{
var lstShopId = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
List<TemuDBProductSelect> list = new List<TemuDBProductSelect>();
pageCount = 1;
var url = BaseClass.BuildObjString("product/get_user_select_product_list");
var data = UserLogin.GetSignaturex() +
"&page=" + page +
"&page_size=" + pageSize +
//"&out_product_id=" + dbId +
//"&shop_id=" + shop.ShopId +
//"&shop_account=" + shop.ShopAccount +
//"&main_user_name=" + shop.UserName +
//"&sub_user_name=" + shop.SubUserName +
//"&status=待审核" +
"&shop_ids=\"" + string.Join("\",\"", lstShopId) + "\"";
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"))
{
Invoke(new Action(() =>
{
BaseMsgForm.ShowError("认领商品查询失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg"));
}));
return new List<TemuDBProductSelect>();
}
int count = BaseRegex.GetIntJson(ref html, "count");
pageCount = Math.Ceiling(1.0 * count / pageSize).ParseToInt();
pageCount = Math.Max(pageCount, 1);
var jArr = JObject.Parse(html)["data"];
if (jArr.Count() == 0)
return list;
var sProd = JsonHelper.SerializeObject(jArr);
try
{
list = JsonHelper.DeserializeJsonToList<TemuDBProductSelect>(sProd);
return list;
}
catch (Exception ex)
{
return new List<TemuDBProductSelect>();
}
}
private void dgvSelectProduct_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
}
}
@@ -126,6 +126,9 @@
<metadata name="colShopId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colLoginStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSelectProduct.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -159,10 +162,16 @@
<metadata name="colProductCat.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColDelete.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colExtCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colMsg.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDraftId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColDelete.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>
+12 -8
View File
@@ -35,8 +35,9 @@
System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("素材库管理");
System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("超级店铺管理");
System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("超级用户管理");
System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("选品数据管理");
System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("店铺管理", new System.Windows.Forms.TreeNode[] {
System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("选品数据库");
System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("认领待上传");
System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("店铺管理", new System.Windows.Forms.TreeNode[] {
treeNode1,
treeNode2,
treeNode3,
@@ -44,7 +45,8 @@
treeNode5,
treeNode6,
treeNode7,
treeNode8});
treeNode8,
treeNode9});
this.panel1 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
@@ -149,12 +151,14 @@
treeNode6.Text = "超级店铺管理";
treeNode7.Name = "超级用户管理";
treeNode7.Text = "超级用户管理";
treeNode8.Name = "选品数据管理";
treeNode8.Text = "选品数据管理";
treeNode9.Name = "店铺管理";
treeNode9.Text = "店铺管理";
treeNode8.Name = "选品数据库";
treeNode8.Text = "选品数据库";
treeNode9.Name = "认领待上传";
treeNode9.Text = "认领待上传";
treeNode10.Name = "店铺管理";
treeNode10.Text = "店铺管理";
this.tv.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
treeNode9});
treeNode10});
this.tv.OverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.tv.Size = new System.Drawing.Size(140, 461);
this.tv.TabIndex = 1;
+8 -3
View File
@@ -24,6 +24,7 @@ namespace TemuKJD.KJDForms.ShopForms
public Lazy<AdminAccountForm> adminAccountForm = new Lazy<AdminAccountForm>();
public Lazy<AdminShopForm> adminShopForm = new Lazy<AdminShopForm>();
public Lazy<DbProductListForm> dbProductListForm = new Lazy<DbProductListForm>();
public Lazy<DbProductSelectListManageForm> dbProductSelectListManageForm = new Lazy<DbProductSelectListManageForm>();
public ShopForm()
{
@@ -34,7 +35,7 @@ namespace TemuKJD.KJDForms.ShopForms
tv.SelectedNode = tv.Nodes[0].Nodes[0];
tv.ExpandGroup(tv.Nodes[0].Name);
List<string> hideName = new List<string>() { "用户管理", "高级运费模板", "运费模板", "素材库管理", "超级用户管理", "超级店铺管理", "选品数据管理" };
List<string> hideName = new List<string>() { "用户管理", "高级运费模板", "运费模板", "素材库管理", "超级用户管理", "超级店铺管理", "选品数据库", "认领待上传" };
if (BaseClass.GroupId == 3)
{
@@ -43,7 +44,8 @@ namespace TemuKJD.KJDForms.ShopForms
{
hideName.Remove("超级用户管理");
hideName.Remove("超级店铺管理");
hideName.Remove("选品数据管理");
hideName.Remove("选品数据库");
hideName.Remove("认领待上传");
}
}
@@ -91,9 +93,12 @@ namespace TemuKJD.KJDForms.ShopForms
case "超级店铺管理":
SetForm(adminShopForm.Value);
break;
case "选品数据管理":
case "选品数据库":
SetForm(dbProductListForm.Value);
break;
case "认领待上传":
SetForm(dbProductSelectListManageForm.Value);
break;
}
}));
}).Start();
+2 -2
View File
@@ -26,11 +26,11 @@ namespace TemuKJD.UserControls
{
Invoke(new Action(() =>
{
this.lblTotal.Text = "共" + totalPage + "页";
this.lblTotal.Text = "共 " + totalPage + " 页";
}));
}
else
this.lblTotal.Text = "共" + totalPage + "页";
this.lblTotal.Text = "共 " + totalPage + " 页";
}
}
}