using AllBase; using AllBase.Helper; using AllBase.Model.Result; using NaiBa.Util; 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.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using TemuKJD.BaseForms; using TemuKJD.BLL; using TemuKJD.Extension; using TemuKJD.KJDForms.AdminForms; using TemuKJD.KJDForms.JITForms; using TemuKJD.KJDForms.ProductForms.TemuJitSubForms; using TemuKJD.KJDForms.ShopForms; using TemuKJD.ToolForms; using Work; namespace TemuKJD.KJDForms.ProductForms { public partial class TemuJitForm : BaseForm { public bool IsClientJit { get; set; } = false; public CancellationTokenSource cancellationTokenSource { get; set; } = null; public ConcurrentList lstAdminShopInfo { get; set; } = new ConcurrentList(); /// /// 生命周期商品列表 /// public ConcurrentList lstChainProdInfo = new ConcurrentList(); /// /// 商品合规信息列表 /// public ConcurrentList lstComplianceInfo = new ConcurrentList(); /// /// 实拍图 /// public ConcurrentList lstRealPictureInfo = new ConcurrentList(); /// /// 商品信息(含虚拟库存)列表 /// public ConcurrentList lstProductInfo = new ConcurrentList(); /// /// 期望到货区域列表 /// public ConcurrentList lstReceiveArea = new ConcurrentList(); /// /// 界面参数配置 /// SetJitConfig setJitConfig = null; /// /// jit开通参数配置 /// List lstOpenJitParams = null; CheckBox chkSelectAll; public TemuJitForm() { InitializeComponent(); } private void TemuJitForm_Load(object sender, EventArgs e) { if (!IsClientJit) { ucSplitPage1.Visible = true; this.colJitStatus.Visible = false; } else { ucSplitPage1.Visible = false; this.colJitStatus.Visible = true; } //this.dgvShop.AddSelectorColumn("colSelect"); chkSelectAll = dgvShop.Columns["colSelect"].AddHeaderCheckBox(HorizontalAlignment.Center, 0, 0, null, null, false, null, true); chkSelectAll.CheckedChanged += chkSelectAll_CheckedChanged; this.dgvOpenJit.AddSelectorColumn("colCheck"); var chkSelectExtCode = this.dgvExtCode.AddSelectorColumn("colSelectExtCode"); chkSelectExtCode.CheckedChanged += ChkSelectExtCode_CheckedChanged; this.dgvOpenJit.AddImgColumn("colProductSkcPic", "colImgUrl"); this.dtpEndTime.Value = DateTime.Now.Date.AddDays(1).AddMilliseconds(-1); this.dtpStartTime.Value = DateTime.Now.Date.AddDays(-7); if (!IsClientJit) setJitConfig = NaiBa.Util.Helper.ConfigHelper.LoadConfig("admin_set_jit_config"); else setJitConfig = NaiBa.Util.Helper.ConfigHelper.LoadConfig("set_jit_config"); if (setJitConfig == null) setJitConfig = new SetJitConfig(); this.txtNotes.Text = setJitConfig.SearchNotes; this.txtShopId.Text = setJitConfig.SearchShopId; this.txtShopName.Text = setJitConfig.SearchShopName; this.chkSearchAllShop.Checked = setJitConfig.SearchAllShop; this.txtSpuId.Text = setJitConfig.SearchSpuId; this.txtExtCode.Text = setJitConfig.SearchExtCode; this.chkSearchTime.Checked = setJitConfig.SearchDuration; this.txtNotes.TextChanged += Txt_TextChanged; this.txtShopId.TextChanged += Txt_TextChanged; this.txtShopName.TextChanged += Txt_TextChanged; this.chkSearchAllShop.CheckedChanged += Txt_TextChanged; this.txtSpuId.TextChanged += Txt_TextChanged; this.txtExtCode.TextChanged += Txt_TextChanged; this.chkSearchTime.CheckedChanged += Txt_TextChanged; // 读取货号开通jit参数 lstOpenJitParams = NaiBa.Util.Helper.ConfigHelper.LoadConfig>("open_jit_params"); if (lstOpenJitParams == null) lstOpenJitParams = new List(); } private void chkSelectAll_CheckedChanged(object sender, EventArgs e) { if (!chkSelectAll.Checked) { foreach (DataGridViewRow row in dgvShop.Rows) { row.Cells["colSelect"].Value = false; } } else { var list = lstAdminShopInfo.Where(s => s.LoginStatus2 == "国际版在线").ToList(); if (IsClientJit) list = GlobalConfig.ShopLoginList.Where(s => s.LoginStatus2 == "国际版在线" && s.jit_expire_time >= DateTime.Now.Date).ToList(); foreach (DataGridViewRow row in dgvShop.Rows) { if (list.Any(l => l.ShopId == row.Cells["colShopId"]?.Value?.ToString())) row.Cells["colSelect"].Value = true; } } } private void Txt_TextChanged(object sender, EventArgs e) { setJitConfig.SearchNotes = this.txtNotes.Text.Trim(); setJitConfig.SearchShopId = this.txtShopId.Text.Trim(); setJitConfig.SearchShopName = this.txtShopName.Text.Trim(); setJitConfig.SearchAllShop = this.chkSearchAllShop.Checked; setJitConfig.SearchSpuId = this.txtSpuId.Text.Trim(); setJitConfig.SearchExtCode = this.txtExtCode.Text.Trim(); setJitConfig.SearchDuration = this.chkSearchTime.Checked; if (!IsClientJit) NaiBa.Util.Helper.ConfigHelper.SaveConfig("admin_set_jit_config", setJitConfig); else NaiBa.Util.Helper.ConfigHelper.SaveConfig("set_jit_config", setJitConfig); } private void TemuJitForm_VisibleChanged(object sender, EventArgs e) { if (this.Visible) { if (!IsClientJit) { this.pbShopLoading.Visible = true; SearchShop(this.ucSplitPage1.CurrentPage); } else { RefreshShop(); } } } private void btnRefreshShop_Click(object sender, EventArgs e) { if (!IsClientJit) { if (this.ucSplitPage1.CurrentPage != 1) this.ucSplitPage1.CurrentPage = 1; else SearchShop(1); } else { RefreshShop(); } } private void RefreshShop() { // 店铺Id var selectIds = dgvShop.Rows.Cast().Where(row => row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList(); var shopLst = GlobalConfig.ShopLoginList.ToList(); if (!string.IsNullOrWhiteSpace(txtShopId.Text.Trim())) { shopLst = shopLst.Where(s => ("," + txtShopId.Text.Trim() + ",").Contains("," + s.ShopId + ",") || s.ShopId.Contains(txtShopId.Text.Trim())).ToList(); } if (!string.IsNullOrWhiteSpace(txtShopName.Text.Trim())) { shopLst = shopLst.Where(s => ("," + txtShopName.Text.Trim() + ",").Contains("," + s.ShopAccount + ",") || s.ShopAccount.ToLower().Contains(txtShopName.Text.Trim().ToLower())).ToList(); } if (!string.IsNullOrWhiteSpace(txtNotes.Text.Trim())) { shopLst = shopLst.Where(s => ("," + txtNotes.Text.Trim() + ",").Contains("," + s.Notes + ",") || s.Notes.ToLower().Contains(txtNotes.Text.Trim().ToLower())).ToList(); } // 获取被删除的店铺 List dgvRowList = dgvShop.Rows.Cast().Where(row => !shopLst.Any(s => s.ShopId == row.Cells["colShopId"]?.Value?.ToString())).ToList(); // 更新被删除的店铺列表 foreach (var row in dgvRowList) { dgvShop.Rows.Remove(row); } // 绑定其他店铺(含新导入的店铺) foreach (ShopLoginInfo shopEntity in shopLst) { if (!string.IsNullOrEmpty(shopEntity.ShopId)) BindShop(shopEntity, selectIds); } } private void BindShop(ShopLoginInfo shopEntity, List selectShopId = null) { if (shopEntity == null) return; if (selectShopId == null) selectShopId = new List(); bool canUse = shopEntity.LoginStatus2 == "国际版在线"; var row = dgvShop.Rows.Cast().FirstOrDefault(p => p.Cells.GetCellValueFromColumnName("colShopId").ParseToString() == shopEntity.ShopId); if (row == null) { int id = this.dgvShop.Rows.Add( selectShopId.Contains(shopEntity.ShopId) && canUse, shopEntity.UserName, shopEntity.LoginName, shopEntity.ShopId, shopEntity.ShopAccount, shopEntity.Notes, canUse ? "在线" : "掉线", shopEntity.jit_expire_time >= DateTime.Now.Date ? "可用" : "失效", canUse, string.Empty ); displayShopStatus(shopEntity); } else { row.Cells["colSelect"].Value = selectShopId.Contains(shopEntity.ShopId) && canUse; row.Cells["colLoginName"].Value = shopEntity.LoginName; row.Cells["colShopName"].Value = shopEntity.ShopAccount; row.Cells["colShopNotes"].Value = shopEntity.Notes; row.Cells["colLoginStatus"].Value = canUse ? "在线" : "掉线"; displayShopStatus(shopEntity); } } private void ucSplitPage1_PageChange(object obj) { SearchShop(this.ucSplitPage1.CurrentPage); } private void btnEmpty_Click(object sender, EventArgs e) { txtNotes.Text = txtShopId.Text = txtShopName.Text = ""; } /// /// 管理员查询店铺列表 /// /// public void SearchShop(int page) { List userShopIdList = dgvShop.Rows.Cast() .Where(r => r.Cells["colSelect"].Value.ParseToBool()) .Select(r => r.Cells["colShopId"].Value.ParseToString() + r.Cells["colUser"].Value.ParseToString()).ToList(); Invoke(new Action(() => { this.pbShopLoading.Visible = true; this.dgvShop.Rows.Clear(); lstAdminShopInfo.Clear(); })); Task.Run(() => { int pageCount; var list = AdminGetServerShopLst(out pageCount, page); lstAdminShopInfo.AddRange(list); this.ucSplitPage1.TotalPage = pageCount; foreach (var shop in lstAdminShopInfo) { bool canUse = shop.LoginStatus2 == "国际版在线"; Invoke(new Action(() => { int rowIndex = this.dgvShop.Rows.Add( userShopIdList.Contains(shop.ShopId + shop.UserName), shop.UserName, shop.LoginName, shop.ShopId, shop.ShopAccount, shop.Notes, canUse ? "在线" : "掉线", shop.jit_expire_time >= DateTime.Now.Date ? "可用" : "失效", canUse, string.Empty ); displayShopStatus(shop); })); } Invoke(new Action(() => { this.pbShopLoading.Visible = false; })); }); } public List AdminGetServerShopLst(out int pageCount, int page = 1, int pageSize = 50) { List list = new List(); pageCount = 1; var url = BaseClass.BuildObjString("shop/admin_get_shop_list"); if (BaseClass.SaLevel > 1 && !chkSearchAllShop.Checked) url = BaseClass.BuildObjString("shop/sub_sa_get_select_prod_shop"); var data = UserLogin.GetSignaturex() + "&page=" + page + "&page_size=" + pageSize + "&shop_ids=" + txtShopId.Text.Trim().Trim(',') + "&shop_names=" + txtShopName.Text.Trim().Trim(',') + "&search_notes=" + txtNotes.Text.Trim().Trim(','); if (BaseClass.SaLevel > 1 && !chkSearchAllShop.Checked) data += "&operate_sub_sa_name=" + BaseClass.UserName; 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 list; } int count = BaseRegex.GetIntJson(ref html, "count"); pageCount = Math.Ceiling(1.0 * count / pageSize).ParseToInt(); pageCount = Math.Max(pageCount, 1); return ShopBLL.DeserializationShop(html); } void displayShopStatus(ShopLoginInfo shop) { bool canUse = shop.LoginStatus2 == "国际版在线"; var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colLoginName"].Value.ParseToString() == shop?.LoginName); foreach (var row in rows) { row.Cells["colCanUse"].Value = canUse; row.Cells["colLoginStatus"].Value = canUse ? "在线" : "掉线"; (row.Cells["colLoginStatus"] as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Green : Color.Red; (row.Cells["colLoginStatus"] as DataGridViewLinkCell).LinkColor = canUse ? Color.Green : Color.Red; (row.Cells["colLoginStatus"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightGreen : Color.OrangeRed; (row.Cells["colLoginStatus"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkGreen : Color.DarkRed; } if (IsClientJit) { var jitRow = this.dgvShop.Rows.Cast().FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop?.ShopId); jitRow.Cells["colJitStatus"].Style.ForeColor = JitShopActiveForm.GetJitStatusStyleColor(shop); } } private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex < 0 || e.RowIndex < 0) return; string headerText = dgvShop.Columns[e.ColumnIndex].HeaderText; string loginName = dgvShop.Rows[e.RowIndex].Cells["colLoginName"].Value.ParseToString(); string accountId = dgvShop.Rows[e.RowIndex].Cells["colShopId"].Value.ParseToString(); ShopLoginInfo shop = null; if (!IsClientJit) shop = lstAdminShopInfo.FirstOrDefault(v => v.LoginName == loginName && v.ShopId == accountId); else shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == loginName && v.ShopId == accountId); switch (headerText) { case "登录": case "状态": { if (!IsClientJit) { AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false); if (shop.LoginStatus2 == "国际版在线") { AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop); adminLoginForm.openType = EnumOpenType.manage; adminLoginForm.WindowState = FormWindowState.Maximized; adminLoginForm.InitUrl = "https://agentseller.temu.com"; adminLoginForm.Show(); } else { AdminShopLoginForm shopLoginForm = new AdminShopLoginForm(shop); shopLoginForm.openType = EnumOpenType.login; shopLoginForm.SaveComplete += shopLoginForm_SaveComplete; shopLoginForm.ShowDialog(); } } else { ShopListForm.Instance.CheckShopLogin(new string[] { shop.ShopAccount }, false); if (shop.LoginStatus2 == "国际版在线") { ShopLoginForm adminLoginForm = new ShopLoginForm(shop); adminLoginForm.openType = EnumOpenType.manage; adminLoginForm.WindowState = FormWindowState.Maximized; adminLoginForm.InitUrl = "https://agentseller.temu.com"; adminLoginForm.Show(); } else { ShopLoginForm shopLoginForm = new ShopLoginForm(shop); shopLoginForm.openType = EnumOpenType.login; shopLoginForm.SaveComplete += shopLoginForm_SaveComplete; shopLoginForm.ShowDialog(); } } } break; case "": if (IsClientJit) { if (shop != null && shop.jit_expire_time > DateTime.Now.Date) { if (shop.LoginStatus2 != "国际版在线") { dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value = false; BaseMsgForm.ShowError("店铺未登录", "JIT-操作失败"); return; } } else { dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value = false; BaseMsgForm.ShowError("JIT卡密过期或未开通", "JIT-操作失败"); return; } } dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value = !(bool)dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value; break; default: break; } } private void shopLoginForm_SaveComplete(object obj) { var shop = obj as ShopLoginInfo; if (shop == null) return; displayShopStatus(shop); } private void btnSearch1_Click(object sender, EventArgs e) { chkFilterJit.Checked = false; chkFilterNotJit.Checked = false; SearchPrice("已发布到站点"); } private void btnSearch2_Click(object sender, EventArgs e) { chkFilterJit.Checked = false; chkFilterNotJit.Checked = false; SearchPrice("待创建首单"); } private void SearchPrice(string type = "待创建首单") { var selectShopIdLst = this.dgvShop.Rows.Cast().Where(r => r.Cells["colSelect"].Value.ParseToBool() == true) .Select(r => r.Cells["colShopId"].Value.ParseToString()).Distinct().ToList(); if (selectShopIdLst.Count == 0) { BaseMsgForm.ShowError("没有选择店铺!"); return; } if (chkSearchTime.Checked) { if (dtpStartTime.Value.Date.AddMonths(3) < dtpEndTime.Value.Date.AddDays(1).AddMilliseconds(-1)) { BaseMsgForm.ShowError("一次最多只支持查询三个月!"); return; } } string[] colNames = new string[] { "colCheck", "colSkuName", "colExtCode", "colExtCodePrice", "colPrcie", "colCreatTime", "colChangePrice", "colCompliance", "colRealPicture", "colJit", "colStock", "colRecevieArea" }; foreach (DataGridViewColumn column in dgvOpenJit.Columns) { if (colNames.Contains(column.Name)) column.Visible = true; } dgvExtCode.Rows.Clear(); this.dgvOpenJit.Rows.Clear(); this.lstChainProdInfo.Clear(); this.lstComplianceInfo.Clear(); this.lstRealPictureInfo.Clear(); this.lstProductInfo.Clear(); this.lstReceiveArea.Clear(); this.pbLoading.Visible = true; cancellationTokenSource = new CancellationTokenSource(); Task.Run(() => { int shopIndex = 0; int totalProdIndex = 0; foreach (var shopId in selectShopIdLst) { shopIndex++; ShopLoginInfo shop = null; if (!IsClientJit) shop = lstAdminShopInfo.FirstOrDefault(s => shopId == s.ShopId); else shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => shopId == s.ShopId); if (shop == null) continue; // 检测是否掉线 if (!IsClientJit) AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false); else ShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false); if (shop.LoginStatus2 != "国际版在线") { Invoke(new Action(() => { displayShopStatus(shop); })); } int page = 0; int totalPage = 1; int prodIndex = 0; int pageSize = 50; while (page < totalPage) { if (cancellationTokenSource.IsCancellationRequested) break; page++; long startTime = 0, endTime = 0; if (chkSearchTime.Checked) { startTime = BaseClass.DateTimeToTimestampMilliseconds(dtpStartTime.Value.Date); endTime = BaseClass.DateTimeToTimestampMilliseconds(dtpEndTime.Value.Date.AddDays(1).AddMilliseconds(-1)); } string searchSpuIds = txtSpuId.Text.Trim().Trim(','); string searchExtCodes = txtExtCode.Text.Trim().Trim(','); var searchRst = this.SearchForChainSupplier(shop, page, pageSize, null, searchSpuIds, searchExtCodes, type, startTime, endTime); if (searchRst.Contains("登录过期") || searchRst.Contains("Invalid Login State")) { if (!IsClientJit) AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false); else ShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false); Invoke(new Action(() => { displayShopStatus(shop); })); } if (searchRst.Contains("\"success\":true")) { try { int total = BaseRegex.GetStringJson(ref searchRst, "total").ParseToInt(); totalPage = Math.Ceiling(total * 1.0 / pageSize).ParseToInt(); var jObj = JObject.Parse(searchRst); var jArr = jObj["result"]["dataList"] as JArray; if (jArr == null) jArr = new JArray(); List extCodeLst = new List(); List spuIdLst = new List(); List chainProductTmpLst = new List(); foreach (var item in jArr) { var jStr = JsonHelper.SerializeObject(item); TemuForChainProductInfo chainProdInfo = JsonHelper.DeserializeJsonToObject(jStr); lstChainProdInfo.Add(chainProdInfo); chainProductTmpLst.Add(chainProdInfo); extCodeLst.Add(chainProdInfo.skcList.FirstOrDefault()?.extCode); spuIdLst.Add(chainProdInfo.productId.ParseToString()); } // 查询货号原售价 List extCodePriceList = AdminProductPriceCheckForm.GetServerExtCodePriceLst(extCodeLst.Distinct().ToList()); // 获取产品数据库中的成本价格 List upProdList = AdminProductPriceCheckForm.GetUpSpuIdLst(spuIdLst); // 查询合规信息,实拍图等 var spuIds = string.Join(",", spuIdLst); spuIds = "\"" + spuIds.Trim(',').Replace(",", "\",\"") + "\""; List complianceInfoTmpLst = null; string sComplianceErrMsg = ""; List realPictureInfoTmpLst = null; string sRealPictureErrMsg = ""; List productInfoLst = new List(); // 包含虚拟库存信息的商品列表 if (spuIds.Length > 2) { Thread.Sleep(Randomx.GetId(25, 75)); var queryComplianceRst = this.QueryComplianceInfoList(shop, pageSize, spuIds); queryComplianceRst = GetHtml.Unicode2String(queryComplianceRst); if (queryComplianceRst.Contains("\"success\":true")) { JObject complianceRstObj = JObject.Parse(queryComplianceRst); string sData = JsonHelper.SerializeObject(complianceRstObj["result"]["data"]); complianceInfoTmpLst = JsonHelper.DeserializeJsonToList(sData); lstComplianceInfo.AddRange(complianceInfoTmpLst); } else { sComplianceErrMsg = BaseRegex.GetStringJson(ref queryComplianceRst, "errorMsg").ParseToString(); if (string.IsNullOrEmpty(sComplianceErrMsg)) sComplianceErrMsg = BaseRegex.GetStringJson(ref queryComplianceRst, "error_msg").ParseToString(); if (string.IsNullOrEmpty(sComplianceErrMsg)) sComplianceErrMsg = queryComplianceRst; } // 实拍图 Thread.Sleep(Randomx.GetId(25, 75)); var queryRealPictureRst = this.QueryRealPictureList(shop, pageSize, spuIds); queryRealPictureRst = GetHtml.Unicode2String(queryRealPictureRst); if (queryRealPictureRst.Contains("\"success\":true")) { JObject complianceRstObj = JObject.Parse(queryRealPictureRst); string sData = JsonHelper.SerializeObject(complianceRstObj["result"]["items"]); realPictureInfoTmpLst = JsonHelper.DeserializeJsonToList(sData); lstRealPictureInfo.AddRange(realPictureInfoTmpLst); } else { sRealPictureErrMsg = BaseRegex.GetStringJson(ref queryRealPictureRst, "errorMsg").ParseToString(); if (string.IsNullOrEmpty(sRealPictureErrMsg)) sRealPictureErrMsg = BaseRegex.GetStringJson(ref queryRealPictureRst, "error_msg").ParseToString(); if (string.IsNullOrEmpty(sRealPictureErrMsg)) sRealPictureErrMsg = queryRealPictureRst; } // 获取库存 Thread.Sleep(Randomx.GetId(25, 75)); string jsonStr = GetProductList(shop, 1, spuIds); if (jsonStr.Contains("\"success\":true")) { jArr = JObject.Parse(jsonStr)["result"]?["pageItems"] as JArray; if (jArr == null) jArr = new JArray(); productInfoLst = JsonHelper.DeserializeJsonToList(jArr.ToString()); lstProductInfo.AddRange(productInfoLst); } else { var err = BaseRegex.GetStringJson(ref jsonStr, "errorMsg").ParseToString(); if (string.IsNullOrEmpty(err)) err = BaseRegex.GetStringJson(ref jsonStr, "error_msg").ParseToString(); if (string.IsNullOrEmpty(err)) err = jsonStr; BaseMsgForm.ShowError(err); } // 获取到货地 GetProductReceiveAreaList Thread.Sleep(Randomx.GetId(25, 75)); string getProductReceiveAreaRst = GetProductReceiveAreaList(shop, 1, 50, spuIds); if (getProductReceiveAreaRst.Contains("\"success\":true")) { jArr = JObject.Parse(getProductReceiveAreaRst)["result"]?["items"] as JArray; if (jArr == null) jArr = new JArray(); var receiveAreaLst = JsonHelper.DeserializeJsonToList(jArr.ToString()); lstReceiveArea.AddRange(receiveAreaLst); } else { var err = BaseRegex.GetStringJson(ref getProductReceiveAreaRst, "errorMsg").ParseToString(); if (string.IsNullOrEmpty(err)) err = BaseRegex.GetStringJson(ref getProductReceiveAreaRst, "error_msg").ParseToString(); if (string.IsNullOrEmpty(err)) err = getProductReceiveAreaRst; BaseMsgForm.ShowError(err); } } foreach (var chainProdInfo in chainProductTmpLst) { if (cancellationTokenSource.IsCancellationRequested) break; prodIndex++; totalProdIndex++; Invoke(new Action(() => { this.statusBar.lblTaskStatus.Text = "正在查询" + type + ",店铺:" + shop.ShopAccount + " " + prodIndex + "/" + total + " 件商品"; this.statusBar.pgbTaskProgress.Maximum = selectShopIdLst.Count; this.statusBar.UpdateProgressBar(shopIndex); })); string skuNames = ""; foreach (var reviewInfo in chainProdInfo.skcList.FirstOrDefault().supplierPriceReviewInfoList) { if (cancellationTokenSource.IsCancellationRequested) break; if (reviewInfo.status == 3) //放弃调整报价,报价显示已作废 continue; var product = productInfoLst.FirstOrDefault(p => p.productId == chainProdInfo.productId); // sku组合 + 单价 + 库存 var prodSkuList = reviewInfo?.productSkuList; if (prodSkuList != null && product != null) { foreach (var sku in prodSkuList) { foreach (var prop in sku.productPropertyList) { skuNames += prop.value + ","; } skuNames = skuNames.TrimEnd(',') + ";"; skuNames += "价格:" + reviewInfo.productSkuList.FirstOrDefault()?.supplierPrice + ";"; var skuWithVirtualStock = product?.productSkuSummaries?.FirstOrDefault(s => s.productSkuId == sku.skuId); skuNames += "库存:" + (skuWithVirtualStock?.virtualStock == null ? "-" : skuWithVirtualStock?.virtualStock?.ParseToString()); skuNames += "\r\n"; } } } // 产品货号与货号价格 var reviewExtCode = chainProdInfo.skcList.FirstOrDefault()?.extCode; var extCodePrice = extCodePriceList.FirstOrDefault(p => reviewExtCode == p.ext_code); var upSpuIdPrice = upProdList.FirstOrDefault(p => chainProdInfo.productId == p.draft_id); var original_price = extCodePrice?.original_price / 100m; if (upSpuIdPrice?.cost_price > 0) original_price = upSpuIdPrice?.cost_price; // 合规信息 var complianceStr = sComplianceErrMsg; if (sComplianceErrMsg.IsNullOrEmpty()) { var complianceInfo = complianceInfoTmpLst.FirstOrDefault(c => c.spu_id == chainProdInfo.productId); if (complianceInfo == null) complianceInfo = new complianceInfo(); var complianceTaskNames = complianceInfo.wait_task_show_dtolist.Where(ta => ta.status == 2) .Where(t => t.wait_task_dtolist.Any(ta => ta.task_name == "欧盟负责人" || ta.task_name == "制造商信息" || ta.is_not_required == false)) .Select(t => t.show_name).ToList(); complianceStr = string.Join("\r\n", complianceTaskNames); } // 实拍图 var realPictureStr = sRealPictureErrMsg; if (sRealPictureErrMsg.IsNullOrEmpty()) { var realPicInfo = realPictureInfoTmpLst.FirstOrDefault(c => c.spu_id == chainProdInfo.productId); if (realPicInfo == null || realPicInfo.rule_check_result_list?.FirstOrDefault(p => p.check_type == 494) == null) { realPictureStr = "实拍图查询失败"; } else { if (realPicInfo.rule_check_result_list.FirstOrDefault(p => p.check_type == 494).rule_status != 2) realPictureStr += realPicInfo.rule_check_result_list.FirstOrDefault(p => p.check_type == 494).rule_name + "\r\n"; } } // 期望到货区域 var receiveAreaInfo = lstReceiveArea.FirstOrDefault(r => r.productId == chainProdInfo.productId); Invoke(new Action(() => { int rowId = this.dgvOpenJit.Rows.Add( false, totalProdIndex, "", // reviewInfo.priceOrderId, // 同价格单号 chainProdInfo.supplierId, chainProdInfo.supplierName, chainProdInfo.skcList.FirstOrDefault()?.previewImgUrlList?.FirstOrDefault().ParseToString().Replace("https://", "http://").Replace("img.kwcdn.com", "img.cdnfe.com") + "?imageMogr2/thumbnail/60x", // 图片地址 DataGridViewExtension.defaultBitmap, // 展示图片 chainProdInfo.productId, chainProdInfo.skcList.FirstOrDefault()?.skcId, chainProdInfo.productName, skuNames, reviewExtCode, original_price, //extCodePrice == null ? "-" : (extCodePrice.original_price / 100.0).ParseToString(), //货号价格 chainProdInfo.supplierPrice, // 申报价格范围 //reviewInfo.productSkuList.FirstOrDefault()?.supplierPrice, // 同价格单号申报价格 BaseClass.StampToDateTime((chainProdInfo.skcList.FirstOrDefault()?.statusTime.createdTime.ParseToLong() / 1000).ParseToInt()).ToString("yy/MM/dd HH:mm:ss"), // 创建时间 "调价", complianceStr.IsNullOrEmpty() ? "已填写" : complianceStr, // 合规信息 realPictureStr.IsNullOrEmpty() ? "已上传" : realPictureStr, // 实拍图 chainProdInfo.skcList.FirstOrDefault()?.applyJitStatus == 1 ? "开通JIT" : "已开通", "修改库存", // 库存 具体数值在skuNames里显示 receiveAreaInfo?.expectReceiveAreaConfigDesc, // 期望到货区域 "" ); dgvOpenJit.Rows[rowId].Height = 60; if (totalProdIndex % 2 == 1) dgvOpenJit.Rows[rowId].DefaultCellStyle.BackColor = Color.White; else dgvOpenJit.Rows[rowId].DefaultCellStyle.BackColor = Color.WhiteSmoke; })); } } catch (Exception ex) { BaseMsgForm.ShowError("查询商品失败 " + ex.Message); break; } } } } Invoke(new Action(() => { this.pbLoading.Visible = false; string sRst = type + " 查询结束!"; if (cancellationTokenSource.IsCancellationRequested) sRst = type + " 已取消查询!"; BaseMsgForm.ShowInfo(sRst); this.statusBar.lblTaskStatus.Text = sRst; var extCodeLst = this.dgvOpenJit.Rows.Cast() .Select(r => r.Cells["colExtCode"].Value.ParseToString()) .Where(s => !string.IsNullOrEmpty(s.Trim('-'))).Distinct().ToList(); this.dgvExtCode.Rows.Clear(); foreach (var ext in extCodeLst) { var paramsExist = lstOpenJitParams.FirstOrDefault(p => p.ExtCode == ext); this.dgvExtCode.Rows.Add( false, ext, paramsExist != null ? ("价:" + paramsExist.PriceMin + "-" + paramsExist.PriceMax + ";库:" + paramsExist.Stock) : "未设置" ); } })); }, cancellationTokenSource.Token); } private string SearchForChainSupplier(ShopLoginInfo shop, int page, int pageSize = 50, string prodSkcIds = null, string prodSpuIds = null, string skcExtCode = null, string type = "待创建首单", long startTime = 0, long endTime = 0) { string url = "https://agentseller.temu.com/api/kiana/mms/robin/searchForChainSupplier"; string body = ""; body = "{\"pageSize\":" + pageSize + ",\"pageNum\":" + page + ","; if (!string.IsNullOrEmpty(skcExtCode)) body += "\"skcExtCodeKeyword\":\"" + skcExtCode + "\","; if (startTime != 0 && endTime != 0) // 查询创建时间 body += "\"timeType\":1,\"timeBegin\":" + startTime + ",\"timeEnd\":" + endTime + ","; if (type == "待卖家确认") body += "\"priceReviewStatusList\":[1],\"secondarySelectStatusList\":[7],"; else if (type == "待创建首单") body += "\"secondarySelectStatusList\":[10],"; else if (type == "已发布到站点") body += "\"secondarySelectStatusList\":[12],\"supplierTodoTypeList\":[],"; body += "\"supplierTodoTypeList\":[],"; if (!string.IsNullOrEmpty(prodSkcIds)) body += "\"productSkcIdList\":[" + prodSpuIds + "],"; if (!string.IsNullOrEmpty(prodSpuIds)) body += "\"productSpuIdList\":[" + prodSpuIds + "],"; //":[],"productSpuIdList":[5296122040]} body = body.TrimEnd(','); body += "}"; string referer = "https://agentseller.temu.com/newon/product-select"; return HttpResponseBLL.PostResponse2(shop, url, body, referer); } private string QueryComplianceInfoList(ShopLoginInfo shop, int pageSize = 50, string prodSpuIds = null) { string url = "https://agentseller.temu.com/ms/bg-flux-ms/compliance_property/page_query"; string body = ""; body = @"{""page_num"":1,""page_size"":" + pageSize + @",""type"":2,""spu_id_list"":[" + prodSpuIds + "]}"; string referer = "https://agentseller.temu.com/govern/information-supplementation"; return HttpResponseBLL.PostResponse2(shop, url, body, referer); } /// /// 根据商品id查询实拍图列表 /// /// /// /// /// private string QueryRealPictureList(ShopLoginInfo shop, int pageSize = 50, string prodSpuIds = null) { string url = "https://agentseller.temu.com/api/flash/real_picture/list"; string body = ""; body = @"{""page"":1,""page_size"":" + pageSize + @",""spu_id_list"":[" + prodSpuIds + "]}"; string referer = "https://agentseller.temu.com/govern/compliant-live-photos"; return HttpResponseBLL.PostResponse2(shop, url, body, referer); } private string GetPrictureSign(ShopLoginInfo shop) { string url = "https://agentseller.temu.com/ms/bg-flux-ms/compliance_property/signature"; string body = @"{""tag"":""flash-tag""}"; string refere = "https://agentseller.temu.com/govern/compliant-live-photos"; return HttpResponseBLL.PostResponse2(shop, url, body, refere); } private string UploadRealPricture(ShopLoginInfo shop, string fileFullName, string uploadSign, string tag_name = "flash-tag") { string abc = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; string boundaryRandom = ""; while (boundaryRandom.Length < 16) boundaryRandom += abc[Randomx.GetId(abc.Length)]; if (fileFullName == null) fileFullName = ""; string fileName = fileFullName.Split('\\').LastOrDefault(); string url = "https://agentseller.temu.com/api/galerie/v3/store_image?sdk_version=js-0.0.40&tag_name=" + tag_name; string boundary = "----WebKitFormBoundarybJAaZCwJYancPxhq"; boundary = "----WebKitFormBoundary" + boundaryRandom; string body = @"--" + boundary + @" Content-Disposition: form-data; name=""url_width_height"" true --" + boundary + @" Content-Disposition: form-data; name=""image""; filename=""" + fileName + @""" Content-Type: image/jpeg " + fileFullName + @" --" + boundary + @" Content-Disposition: form-data; name=""upload_sign"" " + uploadSign + @" --" + boundary + @"-- "; string refere = "https://agentseller.temu.com/govern/compliant-live-photos"; return HttpResponseBLL.PostResponseUpload(shop, url, body, refere, boundary); } private string UploadPrictureUrl(ShopLoginInfo shop, RealPictureParam realPictureParam) { string url = "https://agentseller.temu.com/api/flash/real_picture/upload_new"; string body = JsonHelper.SerializeObject(realPictureParam); string refere = "https://agentseller.temu.com/govern/compliant-live-photos"; return HttpResponseBLL.PostResponse2(shop, url, body, refere); } private string QuerySupplierJit(ShopLoginInfo shop) { string url = "https://agentseller.temu.com/visage-agent-seller/supplier/jit/exam/result/query"; string body = @"{}"; string refere = "https://agentseller.temu.com/newon/product-select"; return HttpResponseBLL.PostResponse2(shop, url, body, refere); } private string batchOpenJit(ShopLoginInfo shop, Dictionary skcIdSpuIdDic) { string url = "https://agentseller.temu.com/visage-agent-seller/product/skc/batchOpenJit"; string str = ""; foreach (var key in skcIdSpuIdDic.Keys) { str += "{\"productSkcId\":" + key + ",\"productId\":" + skcIdSpuIdDic[key] + "},"; } string body = @"{""productSkcSubSellModeReqList"":[" + str.Trim(',') + "]}"; //@"{""productSkcSubSellModeReqList"":[{""productSkcId"":57773077711,""productId"":5230217458}]}"; string refere = "https://agentseller.temu.com/newon/product-select"; return HttpResponseBLL.PostResponse2(shop, url, body, refere); } private string GetProductList(ShopLoginInfo shop, int page = 1, string spuIds = "") { page = Math.Max(page, 1); string url = "https://agentseller.temu.com/visage-agent-seller/product/skc/pageQuery"; string body; body = @"{""page"":" + page + @",""pageSize"":50}"; if (!string.IsNullOrEmpty(spuIds)) body = @"{""productIds"":[" + spuIds + @"],""page"":" + page + @",""pageSize"":50}"; string refere = "https://agentseller.temu.com/goods/list"; return HttpResponseBLL.PostResponse2(shop, url, body, refere); } private string GetProductReceiveAreaList(ShopLoginInfo shop, int page = 1, int pageSize = 50, string spuIds = "") { page = Math.Max(page, 1); string url = "https://agentseller.temu.com/mms/turbo/supplier/pick/out/config/pageQuerySkcPickOutConfig"; string body; body = @"{""productIdList"":[" + spuIds + @"],""pageSize"":" + pageSize + @",""pageNumber"":" + page + "}"; if (spuIds.IsNullOrEmpty()) body = @"{""pageSize"":" + pageSize + @",""pageNumber"":" + page + "}"; string refere = "https://agentseller.temu.com/stock/fully-mgt/sale-manage/main"; return HttpResponseBLL.PostResponse2(shop, url, body, refere); } private void dgvOpenJit_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex < 0 || e.RowIndex < 0) return; string headerText = dgvOpenJit.Columns[e.ColumnIndex].HeaderText; string orderId = dgvOpenJit.Rows[e.RowIndex].Cells["colOrderId"].Value.ParseToString(); string prodId = dgvOpenJit.Rows[e.RowIndex].Cells["colProductId"].Value.ParseToString(); string skcId = dgvOpenJit.Rows[e.RowIndex].Cells["colProdSkc"].Value.ParseToString(); string accountId = dgvOpenJit.Rows[e.RowIndex].Cells["colSupplierId"].Value.ParseToString(); ShopLoginInfo shop = null; if (!IsClientJit) shop = lstAdminShopInfo.FirstOrDefault(v => v.ShopId == accountId); else shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.ShopId == accountId); var compInfo = this.lstComplianceInfo.FirstOrDefault(c => c.spu_id.ParseToString() == prodId); var realPicInfo = this.lstRealPictureInfo.FirstOrDefault(p => p.spu_id.ParseToString() == prodId); var receiveArea = this.lstReceiveArea.FirstOrDefault(r => r.productId.ParseToString() == prodId); switch (headerText) { case "Skc图片": string url = dgvOpenJit.Rows[e.RowIndex].Cells["colImgUrl"].Value.ParseToString().Replace("img.kwcdn.com", "img.cdnfe.com"); url = url.IndexOf("?") < 0 ? url : url.Substring(0, url.IndexOf("?")); ShowImgForm imgForm = new ShowImgForm(url); imgForm.ShowDialog(); break; case "规格名称": { var chainProdInfo = lstChainProdInfo.FirstOrDefault(p => p.productId.ParseToString() == prodId); var product = lstProductInfo.FirstOrDefault(p => p.productId.ParseToString() == prodId); if (chainProdInfo != null) { this.pnlSpecDetail.Visible = true; string skuName = ""; var prodSkuList = chainProdInfo.skcList.FirstOrDefault().skuList; if (prodSkuList != null) { foreach (var sku in prodSkuList) { foreach (var prop in sku.productPropertyList) { skuName += prop.value + ","; } skuName = skuName.TrimEnd(',') + ";"; skuName += "价格:" + sku.supplierPrice + ";"; var skuWithVirtualStock = product.productSkuSummaries.FirstOrDefault(s => s.productSkuId == sku.skuId); skuName += "库存:" + (skuWithVirtualStock.virtualStock == null ? "-" : skuWithVirtualStock.virtualStock.ParseToString()); skuName += "\r\n"; } } this.textBox1.Text = skuName; } } break; case "调价": case "一键调价": { if (shop != null) { var product = lstProductInfo.FirstOrDefault(p => p.productId.ParseToString() == prodId); // 弹出调价窗口 ProductChangePriceForm changePriceForm = new ProductChangePriceForm(shop, product); changePriceForm.ShowDialog(); // 显示调价结果 this.UpdatePriceChange(changePriceForm.IsAdjustPrice, changePriceForm.ErrMsg, product); } } break; case "合规": case "合规信息": { //填写以下信息: //加州65号提案 //欧盟负责人 //制造商信息 //其他合规信息-商品识别码 ComplianceForm compForm = new ComplianceForm(shop, compInfo); compForm.ShowDialog(); if (compForm.IsEditComplianceSuccess == true) { var rows = dgvOpenJit.Rows.Cast().Where(r => r.Cells["colProductId"].Value.ParseToString() == prodId).ToList(); foreach (var row in rows) { row.Cells["colCompliance"].Value = "已填写"; } } } break; case "实拍图": case "实拍图信息": { OpenFileDialog openFileDialog = new OpenFileDialog(); //openFileDialog.Multiselect = true; // 设置过滤条件,只显示文本文件 openFileDialog.Filter = "图片文件 (*.jpeg;*.jpg;*.png)|*.jpeg;*.jpg;*.png|All files (*.*)|*.*"; // 显示对话框并获取结果 if (openFileDialog.ShowDialog() == DialogResult.OK) { try { // 读取文件内容 //text = File.ReadAllText(openFileDialog.FileName); var fileFullName = openFileDialog.FileName; var uploadRst = UploadRealPicture(shop, fileFullName, realPicInfo); if (uploadRst) { BaseMsgForm.ShowInfo("上传成功"); var rows = dgvOpenJit.Rows.Cast().Where(r => r.Cells["colProductId"].Value.ParseToString() == prodId).ToList(); foreach (var row in rows) { row.Cells["colRealPicture"].Value = "已上传"; } } } catch (Exception ex) { BaseMsgForm.ShowError("打开自定义图片失败 " + ex.Message); return; } } } break; case "Jit": case "JIT": if (BaseMsgForm.ShowConfirm("确定开通Jit?").DialogResult == DialogResult.OK) { var jitRst = CreateJit(shop, skcId, prodId); if (jitRst) { var rows = dgvOpenJit.Rows.Cast().Where(r => r.Cells["colProductId"].Value.ParseToString() == prodId).ToList(); foreach (var row in rows) { row.Cells["colJit"].Value = "已开通"; if (row.Cells["colRecevieArea"].Value.ParseToString().IsNullOrEmpty()) row.Cells["colRecevieArea"].Value = "去设置"; } } } break; case "库存": case "修改库存": { var product = lstProductInfo.FirstOrDefault(p => p.productId.ParseToString() == prodId); ChangeStockForm stockForm = new ChangeStockForm(shop, product); //ChangeStockForm stockForm = new ChangeStockForm(shop, product, txtBatchStock.Text.ParseToInt()); stockForm.ShowDialog(); if (stockForm.IsEditSuccess) { var rows = dgvOpenJit.Rows.Cast().Where(r => r.Cells["colProductId"].Value.ParseToString() == prodId).ToList(); foreach (var sku in product.productSkuSummaries) { var skuChangeVirtualStock = stockForm.stockParam?.skcVirtualStockChangeDTOList?.FirstOrDefault()? .skuVirtualStockChangeList?.FirstOrDefault(s => s.productSkuId == sku.productSkuId); if (skuChangeVirtualStock != null && skuChangeVirtualStock.virtualStockDiff != 0) { var oldVirtualStock = sku.virtualStock == null ? "-" : sku.virtualStock.ParseToString(); sku.virtualStock = sku.virtualStock.ParseToInt() + skuChangeVirtualStock.virtualStockDiff.ParseToInt(); foreach (var row in rows) { var skuName = string.Join(",", sku.productSkuSpecList.Select(s => s.specName).ToList()) + ";"; string oldSkuName = skuName + "价格:¥" + (sku.supplierPrice.ParseToDecimal() / 100).ToString("0.00") + ";库存:" + oldVirtualStock; string newSkuName = skuName + "价格:¥" + (sku.supplierPrice.ParseToDecimal() / 100).ToString("0.00") + ";库存:" + sku.virtualStock; row.Cells["colSkuName"].Value = row.Cells["colSkuName"].Value.ParseToString().Replace(oldSkuName, newSkuName); } } } } } break; case "期望到货": case "期望到货区域": if (receiveArea == null) { var product = lstProductInfo.FirstOrDefault(p => p.productId.ParseToString() == prodId); receiveArea = new SkcReceiveAreaPickOutInfo() { canEditExpectReceiveArea = true, cat4Id = product.categories.cat4.catId, cat4Name = product.categories.cat4.catName, expectReceiveAreaConfigDesc = "按照历史发货地就近推荐", expectReceiveAreaConfigType = 1, historyDeliveryTwoLevelAddressCode = -1, historyDeliveryTwoLevelAddressDesc = null, isCustom = false, isJit = true, leafCatId = product.leafCat.catId, leafCatName = product.leafCat.catName, productId = product.productId, productName = product.productName, productSkcId = product.productSkcId, productSkcPictureUrl = product.mainImageUrl, }; lstReceiveArea.Add(receiveArea); } ReceiveAreaForm areaForm = new ReceiveAreaForm(shop, receiveArea); areaForm.ShowDialog(); if (areaForm.IsSuccess) { var rows = dgvOpenJit.Rows.Cast().Where(r => r.Cells["colProductId"].Value.ParseToString() == prodId).ToList(); foreach (var row in rows) { row.Cells["colRecevieArea"].Value = receiveArea.expectReceiveAreaConfigDesc; } } break; case "": dgvOpenJit.Rows[e.RowIndex].Cells["colCheck"].Value = !(bool)dgvOpenJit.Rows[e.RowIndex].Cells["colCheck"].Value; break; default: break; } } private bool CreateJit(ShopLoginInfo shop, string skcId, string spuId, DataGridViewCell cell = null) { var rst = QuerySupplierJit(shop); if (!rst.Contains("\"success\":true")) { var msg = BaseRegex.GetStringJson(ref rst, "errorMsg").ParseToString(); if (string.IsNullOrEmpty(msg)) msg = BaseRegex.GetStringJson(ref rst, "error_msg").ParseToString(); if (string.IsNullOrEmpty(msg)) msg = rst; if (cell != null) cell.Value = "请去店铺后台参加Jit开通考试。"; else BaseMsgForm.ShowError("读取Jit条件失败:" + msg); return false; } if (rst.Contains("\"passed\":false")) { if (cell != null) cell.Value = "请去店铺后台参加Jit开通考试。"; else BaseMsgForm.ShowError("请去店铺后台参加Jit开通考试。"); return false; } Dictionary dic = new Dictionary(); dic[skcId.ParseToLong()] = spuId.ParseToLong(); rst = batchOpenJit(shop, dic); if (!rst.Contains("\"success\":true") || !BaseRegex.GetStringJson(ref rst, "errorMsg").IsNullOrEmpty()) { var msg = BaseRegex.GetStringJson(ref rst, "errorMsg").ParseToString(); if (string.IsNullOrEmpty(msg)) msg = BaseRegex.GetStringJson(ref rst, "error_msg").ParseToString(); if (string.IsNullOrEmpty(msg)) msg = rst; if (cell != null) cell.Value = "开通Jit失败:" + msg; else BaseMsgForm.ShowError("开通Jit失败:" + msg); return false; } return true; } private bool UploadRealPicture(ShopLoginInfo shop, string fileFullName, RealPictureInfo realPicInfo, DataGridViewCell cell = null) { var signRst = this.GetPrictureSign(shop); var sign = BaseRegex.GetStringJson(ref signRst, "result"); if (string.IsNullOrEmpty(sign)) { var msg = BaseRegex.GetStringJson(ref signRst, "errorMsg").ParseToString(); if (string.IsNullOrEmpty(msg)) msg = BaseRegex.GetStringJson(ref signRst, "error_msg").ParseToString(); if (string.IsNullOrEmpty(msg)) msg = signRst; if (cell != null) cell.Value = "获取图片上传签名失败:" + msg; else BaseMsgForm.ShowError("获取图片上传签名失败:" + msg); return false; } var uploadRst = UploadRealPricture(shop, fileFullName, sign); Thread.Sleep(Randomx.GetId(50, 100)); var imgUrl = BaseRegex.GetStringJson(ref uploadRst, "url"); // { "url":"https://pos.file.temu.com/flash-tag/20add702d6/ec66d76c-841f-439f-8d8f-7480c341df92_1280x1707.jpeg","width":1280,"height":1707,"size":423774,"etag":"ef7c83be7a05c297e84855d3e6ad6c12"} if (imgUrl.IsNullOrEmpty() && !uploadRst.Contains("\"success\":true")) { var msg = BaseRegex.GetStringJson(ref uploadRst, "errorMsg").ParseToString(); if (string.IsNullOrEmpty(msg)) msg = BaseRegex.GetStringJson(ref uploadRst, "error_msg").ParseToString(); if (string.IsNullOrEmpty(msg)) msg = uploadRst; if (cell != null) cell.Value = "图片上传失败:" + msg; else BaseMsgForm.ShowError("图片上传失败:" + msg); return false; } RealPictureParam param = new RealPictureParam() { confirm_type = 4, spu_id = realPicInfo.spu_id, goods_id = realPicInfo.goods_id, real_picture_info_list = new List(), }; real_picture_info real_picture_info1 = new real_picture_info(); real_picture_info1.position = 1; real_picture_info1.is_same_sku = 1; real_picture_info1.sku_photo_info_list = new List(); real_picture_info real_picture_info2 = new real_picture_info(); real_picture_info2.position = 2; real_picture_info2.is_same_sku = 1; real_picture_info2.sku_photo_info_list = new List(); foreach (var sku in realPicInfo.sku_info) { real_picture_info1.sku_photo_info_list.Add(new sku_photo_info() { image_list = new List(), sku_id = sku.sku_id, }); real_picture_info2.sku_photo_info_list.Add(new sku_photo_info() { image_list = new List() { new image_param() { image_url = imgUrl } }, sku_id = sku.sku_id, }); } param.real_picture_info_list.Add(real_picture_info1); param.real_picture_info_list.Add(real_picture_info2); var uploadPrictureUrlRst = this.UploadPrictureUrl(shop, param); uploadPrictureUrlRst = GetHtml.Unicode2String(uploadPrictureUrlRst); if (!uploadPrictureUrlRst.Contains("\"success\":true")) { var msg = BaseRegex.GetStringJson(ref uploadPrictureUrlRst, "errorMsg").ParseToString(); if (string.IsNullOrEmpty(msg)) msg = BaseRegex.GetStringJson(ref uploadPrictureUrlRst, "error_msg").ParseToString(); if (string.IsNullOrEmpty(msg)) msg = uploadPrictureUrlRst; if (cell != null) cell.Value = "实拍图片保存失败:" + msg; else BaseMsgForm.ShowError("实拍图片保存失败:" + msg); return false; } try { JObject jObj = JObject.Parse(uploadPrictureUrlRst); List checkRstInfoLst = JsonHelper.DeserializeJsonToList(jObj["result"]["rule_check_result"].ToString()); var rstInfo = checkRstInfoLst.FirstOrDefault(c => c.check_type == 494); if (rstInfo == null) { if (cell != null) cell.Value = "实拍图片保存失败:未获取到校验结果"; else BaseMsgForm.ShowError("实拍图片保存失败:未获取到校验结果"); return false; } if (rstInfo.rule_status != 2) { if (cell != null) cell.Value = "实拍图片保存失败:" + rstInfo.rule_name + rstInfo.rule_status_toast; else BaseMsgForm.ShowError("实拍图片保存失败:" + rstInfo.rule_name + rstInfo.rule_status_toast); return false; } } catch (Exception ex) { return false; } return true; } private void btnClose_Click(object sender, EventArgs e) { this.pnlSpecDetail.Visible = false; } private void btnResetExtCode_Click(object sender, EventArgs e) { this.txtSpuId.Text = ""; this.txtExtCode.Text = ""; } private void btnBatchJit_Click(object sender, EventArgs e) { var dgvRows = this.dgvOpenJit.Rows.Cast().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true).ToList(); if (dgvRows.Count == 0) { BaseMsgForm.ShowError("请查询并选择商品!"); return; } string checkJitParamRst = CheckJitParam(); if (!string.IsNullOrEmpty(checkJitParamRst)) { BaseMsgForm.ShowError(checkJitParamRst); return; } checkJitParamRst = CheckExtCodeJitParam(); if (!string.IsNullOrEmpty(checkJitParamRst)) { BaseMsgForm.ShowError(checkJitParamRst); return; } cancellationTokenSource = new CancellationTokenSource(); pbLoading.Visible = true; Task.Run(() => { AutoJit(); Invoke(new Action(() => { this.pbLoading.Visible = false; string sRst = "开通JIT结束!"; if (cancellationTokenSource.IsCancellationRequested) sRst = "已取消开通JIT操作!"; BaseMsgForm.ShowInfo(sRst); this.statusBar.lblTaskStatus.Text = sRst; })); }, cancellationTokenSource.Token); } /// /// 检测开通Jit配置是否合理 /// /// string CheckJitParam() { var minPriceFen = (txtBatchPriceMin.Text.Trim(' ', '¥').ParseToDecimal() * 100).ParseToInt(); var maxPriceFen = (txtBatchPriceMax.Text.Trim(' ', '¥').ParseToDecimal() * 100).ParseToInt(); if (chkBatchPrice.Checked && (minPriceFen < 500 || maxPriceFen < 500 || maxPriceFen < minPriceFen)) { return "请合理设置价格!至少为 5 且最大值不能小于最小值!"; } var identifyCode = txtBatchIdentifyCode.Text.Trim(); if (chkBatchIdentifyCode.Checked && identifyCode.IsNullOrEmpty()) { return "请填写识别码!"; } var realPicture = pbBatchRealPicture.Tag.ParseToString(); if (chkBatchRealPicture.Checked && realPicture.IsNullOrEmpty()) { return "请选择实拍图!"; } var stock = txtBatchStock.Text.Trim().ParseToInt(); if (chkBatchStock.Checked && stock < 1) { return "请设置合理库存!大于 0 !"; } return ""; } string CheckExtCodeJitParam() { var dgvRows = this.dgvExtCode.Rows.Cast().Where(r => r.Cells["colSelectExtCode"].Value.ParseToBool() == true).ToList(); foreach (var dgvRow in dgvRows) { // 如果货号存在Jit开通配置,按货号指定配置开通 var extCode = dgvRow.Cells["colFilterExtCode"].Value.ParseToString(); var extCodeOpenJitParams = lstOpenJitParams.FirstOrDefault(p => p.ExtCode == extCode); if (extCodeOpenJitParams != null) { var minPriceFen = (extCodeOpenJitParams.PriceMin * 100).ParseToInt(); var maxPriceFen = (extCodeOpenJitParams.PriceMax * 100).ParseToInt(); var identifyCode = extCodeOpenJitParams.IdentifyCode; var realPicture = extCodeOpenJitParams.RealPicture; var stock = extCodeOpenJitParams.Stock; if (chkBatchPrice.Checked && (minPriceFen < 500 || maxPriceFen < 500 || maxPriceFen < minPriceFen)) { return "请为选中的货号:" + extCode + " 合理设置价格!至少为 5 且最大值不能小于最小值!"; } if (chkBatchIdentifyCode.Checked && identifyCode.IsNullOrEmpty()) { return "请为选中的货号:" + extCode + " 填写识别码!"; } if (chkBatchRealPicture.Checked && realPicture.IsNullOrEmpty()) { return "请为选中的货号:" + extCode + " 选择实拍图!"; } if (chkBatchStock.Checked && stock < 1) { return "请为选中的货号:" + extCode + " 设置合理库存!大于 0 !"; } } } return ""; } void AutoJit(int type = 1) { //var batchExtCodeLst = txtBatchExtCode.Text.Trim().Split(new string[] { ",", " " }, StringSplitOptions.RemoveEmptyEntries); //if (batchExtCodeLst == null) //{ // BaseMsgForm.ShowError("请输入货号!"); // return; //} //foreach (var extCode in batchExtCodeLst) //{ //var dgvRows = this.dgvOpenJit.Rows.Cast().Where(r => r.Cells[""].Value.ParseToString() == extCode).ToList(); //if (dgvRows.Count == 0) //{ // BaseMsgForm.ShowError("请选择商品!"); // return; //} var dgvRows = this.dgvOpenJit.Rows.Cast().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true).ToList(); foreach (var dgvRow in dgvRows) { if (cancellationTokenSource.IsCancellationRequested) break; var minPriceFen = (txtBatchPriceMin.Text.Trim(' ', '¥').ParseToDecimal() * 100).ParseToInt(); var maxPriceFen = (txtBatchPriceMax.Text.Trim(' ', '¥').ParseToDecimal() * 100).ParseToInt(); var identifyCode = txtBatchIdentifyCode.Text.Trim(); var realPicture = pbBatchRealPicture.Tag.ParseToString(); var stock = txtBatchStock.Text.Trim().ParseToInt(); // 如果货号存在Jit开通配置,按货号指定配置开通 var extCode = dgvRow.Cells["colExtCode"].Value.ParseToString(); var extCodeOpenJitParams = lstOpenJitParams.FirstOrDefault(p => p.ExtCode == extCode); if (extCodeOpenJitParams != null) { minPriceFen = (extCodeOpenJitParams.PriceMin * 100).ParseToInt(); maxPriceFen = (extCodeOpenJitParams.PriceMax * 100).ParseToInt(); identifyCode = extCodeOpenJitParams.IdentifyCode; realPicture = extCodeOpenJitParams.RealPicture; stock = extCodeOpenJitParams.Stock; } string orderId = dgvRow.Cells["colOrderId"].Value.ParseToString(); string prodId = dgvRow.Cells["colProductId"].Value.ParseToString(); string skcId = dgvRow.Cells["colProdSkc"].Value.ParseToString(); string accountId = dgvRow.Cells["colSupplierId"].Value.ParseToString(); ShopLoginInfo shop = null; if (!IsClientJit) shop = lstAdminShopInfo.FirstOrDefault(v => v.ShopId == accountId); else shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.ShopId == accountId); var compInfo = this.lstComplianceInfo.FirstOrDefault(c => c.spu_id.ParseToString() == prodId); var realPicInfo = this.lstRealPictureInfo.FirstOrDefault(p => p.spu_id.ParseToString() == prodId); Thread.Sleep(Randomx.GetId(50, 100)); // 调整价格 // ---------------------------------------------------------------------------------- if (chkBatchPrice.Checked && type == 1 && 1 == 1) { var product = lstProductInfo.FirstOrDefault(p => p.productId.ParseToString() == prodId); var minSkuPrice = product.productSkuSummaries.Min(s => s.supplierPrice); if (minPriceFen >= minSkuPrice) { Invoke(new Action(() => { dgvRow.Cells["colMsg"].Value = "价格不在期望范围内,跳过该商品。"; })); continue; } // 根据价格区间随机生成期望价格 var nWantPrice = Randomx.GetId(minPriceFen, Math.Min(maxPriceFen + 1, minSkuPrice.ParseToInt())); ProductChangePriceForm changePriceForm = null; Invoke(new Action(() => { changePriceForm = new ProductChangePriceForm(shop, product, nWantPrice / 100m); changePriceForm.IsAuto = true; changePriceForm.TopLevel = false; changePriceForm.Left = 10; changePriceForm.Top = 10; MainForm.instance.Controls.Add(changePriceForm); changePriceForm.SendToBack(); changePriceForm.Show(); })); Thread.Sleep(200); // 成功、失败或超时后继续 for (int i = 0; i < 600 && !changePriceForm.IsAdjustPrice && string.IsNullOrEmpty(changePriceForm.ErrMsg); i++) { Thread.Sleep(100); } if (!changePriceForm.IsAdjustPrice && string.IsNullOrEmpty(changePriceForm.ErrMsg)) changePriceForm.ErrMsg = "操作超时"; // 显示调价结果 this.UpdatePriceChange(changePriceForm.IsAdjustPrice, changePriceForm.ErrMsg, product); Thread.Sleep(500); Invoke(new Action(() => { changePriceForm.Close(); })); Thread.Sleep(Randomx.GetId(50, 100)); } // 修改合规信息 // ---------------------------------------------------------------------------------- if (chkBatchIdentifyCode.Checked && type == 1 && 1 == 1) { //填写以下信息: //加州65号提案 //欧盟负责人 //制造商信息 //其他合规信息-商品识别码 ComplianceForm complianceForm = null; Invoke(new Action(() => { complianceForm = new ComplianceForm(shop, compInfo); complianceForm.IsAuto = true; complianceForm.TopLevel = false; complianceForm.Left = 10; complianceForm.Top = 10; MainForm.instance.Controls.Add(complianceForm); complianceForm.SendToBack(); complianceForm.Show(); complianceForm.txtCode.Text = identifyCode; })); Thread.Sleep(200); // 成功、失败或超时后继续 for (int i = 0; i < 300 && !complianceForm.IsEditComplianceSuccess && string.IsNullOrEmpty(complianceForm.ErrMsg); i++) { Thread.Sleep(100); } if (!complianceForm.IsEditComplianceSuccess && string.IsNullOrEmpty(complianceForm.ErrMsg)) complianceForm.ErrMsg = "操作超时"; var rows = dgvOpenJit.Rows.Cast().Where(r => r.Cells["colProductId"].Value.ParseToString() == prodId).ToList(); if (complianceForm.IsEditComplianceSuccess == true) { foreach (var row in rows) { Invoke(new Action(() => { row.Cells["colCompliance"].Value = "已填写 √"; })); } } else { foreach (var row in rows) { Invoke(new Action(() => { row.Cells["colMsg"].Value = complianceForm.ErrMsg; })); } continue; } Thread.Sleep(500); Invoke(new Action(() => { complianceForm.Close(); })); Thread.Sleep(Randomx.GetId(50, 100)); } // 实拍图 // ---------------------------------------------------------------------------------- if (chkBatchRealPicture.Checked && type == 1 && 1 == 1) { var uploadRst = UploadRealPicture(shop, realPicture, realPicInfo, dgvRow.Cells["colMsg"]); if (uploadRst) { var rows = dgvOpenJit.Rows.Cast().Where(r => r.Cells["colProductId"].Value.ParseToString() == prodId).ToList(); foreach (var row in rows) { Invoke(new Action(() => { row.Cells["colRealPicture"].Value = "已上传 √"; })); } } else { continue; } Thread.Sleep(Randomx.GetId(50, 100)); } // 开通Jit // ---------------------------------------------------------------------------------- if (chkBatchJit.Checked && type == 1 && 1 == 1) { var jitRst = CreateJit(shop, skcId, prodId, dgvRow.Cells["colMsg"]); for (int i = 0; i < 5 && dgvRow.Cells["colMsg"].Value.ParseToString().Contains("繁忙"); i++) { dgvRow.Cells["colMsg"].Value = dgvRow.Cells["colMsg"].Value.ParseToString() + "重试第" + i + "次"; Thread.Sleep(Randomx.GetId(5000, 10000)); dgvRow.Cells["colMsg"].Value = ""; jitRst = CreateJit(shop, skcId, prodId, dgvRow.Cells["colMsg"]); } if (jitRst) { Invoke(new Action(() => { var rows = dgvOpenJit.Rows.Cast().Where(r => r.Cells["colProductId"].Value.ParseToString() == prodId).ToList(); foreach (var row in rows) { row.Cells["colJit"].Value = "已开通 √"; if (row.Cells["colJit"].Value.ParseToString().IsNullOrEmpty()) row.Cells["colJit"].Value = "去设置"; } })); } else { continue; } Thread.Sleep(Randomx.GetId(100, 200)); Thread.Sleep(Randomx.GetId(10000, 12000)); } // 修改库存 // ---------------------------------------------------------------------------------- if (chkBatchStock.Checked && type == 1 && 1 == 1) { var product = lstProductInfo.FirstOrDefault(p => p.productId.ParseToString() == prodId); ChangeStockForm stockForm = null; Invoke(new Action(() => { stockForm = new ChangeStockForm(shop, product, stock); stockForm.IsAuto = true; stockForm.TopLevel = false; stockForm.Left = 10; stockForm.Top = 10; MainForm.instance.Controls.Add(stockForm); stockForm.SendToBack(); stockForm.Show(); })); Thread.Sleep(200); // 成功、失败或超时后继续 for (int i = 0; i < 600 && !stockForm.IsEditSuccess && string.IsNullOrEmpty(stockForm.ErrMsg); i++) { Thread.Sleep(100); } if (!stockForm.IsEditSuccess && string.IsNullOrEmpty(stockForm.ErrMsg)) stockForm.ErrMsg = "操作超时"; var rows = dgvOpenJit.Rows.Cast().Where(r => r.Cells["colProductId"].Value.ParseToString() == prodId).ToList(); if (stockForm.IsEditSuccess) { Invoke(new Action(() => { dgvRow.Cells["colStock"].Value = "已修改 √"; })); foreach (var sku in product.productSkuSummaries) { var skuChangeVirtualStock = stockForm.stockParam?.skcVirtualStockChangeDTOList?.FirstOrDefault()? .skuVirtualStockChangeList?.FirstOrDefault(s => s.productSkuId == sku.productSkuId); if (skuChangeVirtualStock != null && skuChangeVirtualStock.virtualStockDiff != 0) { var oldVirtualStock = sku.virtualStock == null ? "-" : sku.virtualStock.ParseToString(); sku.virtualStock = sku.virtualStock.ParseToInt() + skuChangeVirtualStock.virtualStockDiff.ParseToInt(); foreach (var row in rows) { Invoke(new Action(() => { var skuName = string.Join(",", sku.productSkuSpecList.Select(s => s.specName).ToList()) + ";"; string oldSkuName = skuName + "价格:¥" + (sku.supplierPrice.ParseToDecimal() / 100).ToString("0.00") + ";库存:" + oldVirtualStock; string newSkuName = skuName + "价格:¥" + (sku.supplierPrice.ParseToDecimal() / 100).ToString("0.00") + ";库存:" + sku.virtualStock; row.Cells["colSkuName"].Value = row.Cells["colSkuName"].Value.ParseToString().Replace(oldSkuName, newSkuName); })); } } } } else { Invoke(new Action(() => { foreach (var row in rows) { row.Cells["colMsg"].Value = stockForm.ErrMsg; } })); continue; } Invoke(new Action(() => { stockForm.Close(); })); Thread.Sleep(Randomx.GetId(50, 100)); } // 修改期望到货 // ---------------------------------------------------------------------------------- //if (chkBatchReceiveArea.Checked && type == 2 && 1 == 1) //{ // Thread.Sleep(Randomx.GetId(300, 700)); // var product = lstProductInfo.FirstOrDefault(p => p.productId.ParseToString() == prodId); // var receiveArea = this.lstReceiveArea.FirstOrDefault(r => r?.productId?.ParseToString() == prodId); // if (receiveArea == null) // { // receiveArea = new SkcReceiveAreaPickOutInfo() // { // canEditExpectReceiveArea = true, // cat4Id = product.categories.cat4.catId, // cat4Name = product.categories.cat4.catName, // expectReceiveAreaConfigDesc = "按照历史发货地就近推荐", // expectReceiveAreaConfigType = 1, // historyDeliveryTwoLevelAddressCode = -1, // historyDeliveryTwoLevelAddressDesc = null, // isCustom = false, // isJit = true, // leafCatId = product.leafCat.catId, // leafCatName = product.leafCat.catName, // productId = product.productId, // productName = product.productName, // productSkcId = product.productSkcId, // productSkcPictureUrl = product.mainImageUrl, // }; // lstReceiveArea.Add(receiveArea); // } // int areaId = 1; // if (this.rbGuangdong.Checked) // areaId = 1; // if (this.rbYiwu.Checked) // areaId = 2; // var areaEditRst = ReceiveAreaForm.EditReceiveArea(shop, areaId, receiveArea.productSkcId.ParseToString()); // var rows = dgvOpenJit.Rows.Cast().Where(r => r.Cells["colProductId"].Value.ParseToString() == prodId).ToList(); // if (!areaEditRst.Contains("\"success\":true")) // { // var msg = BaseRegex.GetStringJson(ref areaEditRst, "errorMsg").ParseToString(); // if (string.IsNullOrEmpty(msg)) // msg = BaseRegex.GetStringJson(ref areaEditRst, "error_msg").ParseToString(); // if (string.IsNullOrEmpty(msg)) // msg = areaEditRst; // Invoke(new Action(() => // { // foreach (var row in rows) // { // row.Cells["colMsg"].Value = "修改期望到货区域失败:" + msg; // } // })); // continue; // } // else // { // receiveArea.expectReceiveAreaConfigType = areaId; // if (areaId == 1) // receiveArea.expectReceiveAreaConfigDesc = "广东"; // if (areaId == 2) // receiveArea.expectReceiveAreaConfigDesc = "义乌"; // if (areaId == 3) // receiveArea.expectReceiveAreaConfigDesc = "按照历史发货地就近推荐"; // Invoke(new Action(() => // { // foreach (var row in rows) // { // row.Cells["colRecevieArea"].Value = receiveArea.expectReceiveAreaConfigDesc; // } // })); // } //} Invoke(new Action(() => { dgvRow.Cells["colMsg"].Value = "操作成功 √"; })); } //} } public void UpdatePriceChange(bool IsAdjustPrice, string errMsg, TemuListProductInfo product) { var prodId = product.productId.ParseToString(); var rows = dgvOpenJit.Rows.Cast().Where(r => r.Cells["colProductId"].Value.ParseToString() == prodId).ToList(); if (IsAdjustPrice) { Invoke(new Action(() => { var chainProdInfo = lstChainProdInfo.FirstOrDefault(p => p.productId.ParseToString() == prodId); if (chainProdInfo != null) { var minPriceStr = (product.productSkuSummaries.Min(s => s.supplierPrice).ParseToDecimal() / 100).ToString("0.00"); var maxPriceStr = (product.productSkuSummaries.Max(s => s.supplierPrice).ParseToDecimal() / 100).ToString("0.00"); // 根据改价商品更新生命周期商品申报价数值 chainProdInfo.supplierPrice = "¥" + minPriceStr; if (minPriceStr != maxPriceStr) { chainProdInfo.supplierPrice += "~" + maxPriceStr; } foreach (var sku in product.productSkuSummaries) { var chainSku = chainProdInfo?.skcList?.FirstOrDefault()?.skuList?.FirstOrDefault(s => s.skuId == sku.productSkuId); if (chainSku != null) { chainSku.supplierPrice = "¥" + (sku.supplierPrice.ParseToDecimal() / 100).ToString("0.00"); chainSku.supplierPriceValue = sku.supplierPrice; } foreach (var reviewInfo in chainProdInfo?.skcList?.FirstOrDefault()?.supplierPriceReviewInfoList) { var reviewSku = reviewInfo.productSkuList.FirstOrDefault(s => s.skuId == sku.productSkuId); if (reviewSku != null) { reviewSku.supplierPrice = "¥" + (sku.supplierPrice.ParseToDecimal() / 100).ToString("0.00"); reviewSku.supplierPriceValue = sku.supplierPrice; } } } // 显示生命周期商品申报价价格文本 foreach (var row in rows) { row.Cells["colPrcie"].Value = chainProdInfo.supplierPrice; } } // 显示sku价格改变 foreach (var sku in product.productSkuSummaries) { foreach (var row in rows) { var skuSpecNames = string.Join(",", sku.productSkuSpecList.Select(s => s.specName).ToList()) + ";"; var skuNameStrLst = row.Cells["colSkuName"].Value.ParseToString().Split(new string[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries); string oldSkuName = skuNameStrLst.FirstOrDefault(s => s.StartsWith(skuSpecNames)); string newSkuName = skuSpecNames + "价格:¥" + (sku.supplierPrice.ParseToDecimal() / 100).ToString("0.00") + ";库存:" + (sku.virtualStock == null ? "-" : sku.virtualStock.ParseToString()); row.Cells["colSkuName"].Value = row.Cells["colSkuName"].Value.ParseToString().Replace(oldSkuName, newSkuName); } } })); } else { Invoke(new Action(() => { foreach (var row in rows) { row.Cells["colMsg"].Value = errMsg; } })); } } public static bool IsFormOpen(string formName) { foreach (Form form in Application.OpenForms) { if (form.Name == formName) { return true; } } return false; } private void btnAddRealPic_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); //openFileDialog.Multiselect = true; // 设置过滤条件,只显示文本文件 openFileDialog.Filter = "图片文件 (*.jpeg;*.jpg;*.png)|*.jpeg;*.jpg;*.png|All files (*.*)|*.*"; // 显示对话框并获取结果 if (openFileDialog.ShowDialog() == DialogResult.OK) { try { // 读取文件内容 var fileFullName = openFileDialog.FileName; Image image = Image.FromFile(fileFullName); using (MemoryStream memoryStream = new MemoryStream()) { image.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] imageBytes = memoryStream.ToArray(); } this.pbBatchRealPicture.Tag = fileFullName; this.pbBatchRealPicture.Image = image; } catch (Exception ex) { BaseMsgForm.ShowError("打开自定义图片失败 " + ex.Message); return; } } } private void btnStop_Click(object sender, EventArgs e) { if (cancellationTokenSource != null) cancellationTokenSource.Cancel(); } private void btnCancelJit_Click(object sender, EventArgs e) { if (cancellationTokenSource != null) cancellationTokenSource.Cancel(); } private void ChkSelectExtCode_CheckedChanged(object sender, EventArgs e) { FilterRows(); } private void dgvExtCode_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex < 0 || e.RowIndex < 0) return; string headerText = dgvExtCode.Columns[e.ColumnIndex].HeaderText; var row = dgvExtCode.Rows[e.RowIndex]; switch (headerText) { case "": case "选": case "货号": row.Cells["colSelectExtCode"].Value = !row.Cells["colSelectExtCode"].Value.ParseToBool(); FilterRows(); break; case "JIT配置": case "JIT配置(点击显示详情)": if (row.Cells[e.ColumnIndex].Value.ParseToString() != "未设置") { var extCode = row.Cells["colFilterExtCode"].Value.ParseToString(); var jitParam = lstOpenJitParams.FirstOrDefault(p => p.ExtCode == extCode); if (jitParam == null) { BaseMsgForm.ShowError("配置不存在"); } else { var displayRst = DisplayOpenJitParams(jitParam); if (!string.IsNullOrEmpty(displayRst)) BaseMsgForm.ShowError(displayRst); } } break; } } string DisplayOpenJitParams(OpenJitFullParams jitParam) { this.txtBatchPriceMin.Text = jitParam.PriceMin.ToString(); this.txtBatchPriceMax.Text = jitParam.PriceMax.ToString(); this.txtBatchIdentifyCode.Text = jitParam.IdentifyCode; this.txtBatchStock.Text = jitParam.Stock.ToString(); try { if (!string.IsNullOrEmpty(jitParam.RealPicture)) { Image image = Image.FromFile(jitParam.RealPicture); using (MemoryStream memoryStream = new MemoryStream()) { image.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] imageBytes = memoryStream.ToArray(); } this.pbBatchRealPicture.Image = image; } else { this.pbBatchRealPicture.Image = new Bitmap(1,1); } this.pbBatchRealPicture.Tag = jitParam.RealPicture; } catch (Exception ex) { return ex.Message; } return ""; } void FilterRows() { var filterExtCodeLst = dgvExtCode.Rows.Cast() .Where(r => r.Cells["colSelectExtCode"].Value.ParseToBool() == true) .Select(r => r.Cells["colFilterExtCode"].Value.ParseToString()).Distinct().ToList(); this.pbLoading.Visible = true; Task.Run(() => { foreach (DataGridViewRow row in dgvOpenJit.Rows) //for (int i = dgvOpenJit.Rows.Count - 1; i >= 0; i--) { Invoke(new Action(() => { //var row = dgvOpenJit.Rows[i]; //row.Visible = true; row.Cells["colCheck"].Value = false; bool isVisible = true; if (filterExtCodeLst != null && filterExtCodeLst.Count > 0) { if (filterExtCodeLst.Contains(row.Cells["colExtCode"].Value.ParseToString())) { //row.Cells["colCheck"].Value = true; //row.Visible = true; isVisible = true; } else { //row.Cells["colCheck"].Value = false; //row.Visible = false; isVisible = false; } } if (chkFilterJit.Checked) { if (row.Cells["colJit"].Value.ParseToString().Contains("已开通")) { //row.Cells["colCheck"].Value = false; //row.Visible = false; isVisible = false; } } if (chkFilterNotJit.Checked) { if (!row.Cells["colJit"].Value.ParseToString().Contains("已开通")) { //row.Cells["colCheck"].Value = false; //row.Visible = false; isVisible = false; } } if (row.Visible != isVisible) row.Visible = isVisible; row.Cells["colCheck"].Value = isVisible; })); } Invoke(new Action(() => { pbLoading.Visible = false; })); }); } private void btnSetReceiveArea_Click(object sender, EventArgs e) { //cancellationTokenSource = new CancellationTokenSource(); //pbLoading.Visible = true; //Task.Run(() => //{ // AutoJit(2); // Invoke(new Action(() => // { // this.pbLoading.Visible = false; // string sRst = "设置期望到货区域结束!"; // if (cancellationTokenSource.IsCancellationRequested) // sRst = "已取消设置期望到货区域!"; // BaseMsgForm.ShowInfo(sRst); // this.statusBar.lblTaskStatus.Text = sRst; // })); //}, cancellationTokenSource.Token); var selectShopIdLst = this.dgvShop.Rows.Cast().Where(r => r.Cells["colSelect"].Value.ParseToBool() == true) .Select(r => r.Cells["colShopId"].Value.ParseToString()).Distinct().ToList(); if (selectShopIdLst.Count == 0) { BaseMsgForm.ShowError("没有选择店铺!"); return; } string[] colNames = new string[] { "colCheck", "colSkuName", "colExtCode", "colExtCodePrice", "colPrcie", "colCreatTime", "colChangePrice", "colCompliance", "colRealPicture", "colJit", "colStock", "colRecevieArea" }; foreach (DataGridViewColumn column in dgvOpenJit.Columns) { if (colNames.Contains(column.Name)) column.Visible = false; } dgvExtCode.Rows.Clear(); this.dgvOpenJit.Rows.Clear(); this.pbLoading.Visible = true; cancellationTokenSource = new CancellationTokenSource(); Task.Run(() => { int shopIndex = 0; int totalProdIndex = 0; foreach (var shopId in selectShopIdLst) { shopIndex++; ShopLoginInfo shop = null; if (!IsClientJit) shop = lstAdminShopInfo.FirstOrDefault(s => shopId == s.ShopId); else shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => shopId == s.ShopId); if (shop == null) continue; // 检测是否掉线 if (!IsClientJit) AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false); else ShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false); if (shop.LoginStatus2 != "国际版在线") { Invoke(new Action(() => { displayShopStatus(shop); })); } int page = 0; int totalPage = 1; int prodIndex = 0; int pageSize = 100; while (page < totalPage) { if (cancellationTokenSource.IsCancellationRequested) break; page++; long startTime = 0, endTime = 0; if (chkSearchTime.Checked) { startTime = BaseClass.DateTimeToTimestampMilliseconds(dtpStartTime.Value.Date); endTime = BaseClass.DateTimeToTimestampMilliseconds(dtpEndTime.Value.Date.AddDays(1).AddMilliseconds(-1)); } string searchSpuIds = txtSpuId.Text.Trim().Trim(','); string searchExtCodes = txtExtCode.Text.Trim().Trim(','); var productReceiveAreaLstRst = this.GetProductReceiveAreaList(shop, page, pageSize); if (productReceiveAreaLstRst.Contains("登录过期") || productReceiveAreaLstRst.Contains("Invalid Login State")) { if (!IsClientJit) AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false); else ShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false); Invoke(new Action(() => { displayShopStatus(shop); })); } else if (!productReceiveAreaLstRst.Contains("\"success\":true")) { var err = BaseRegex.GetStringJson(ref productReceiveAreaLstRst, "errorMsg").ParseToString(); if (string.IsNullOrEmpty(err)) err = BaseRegex.GetStringJson(ref productReceiveAreaLstRst, "error_msg").ParseToString(); if (string.IsNullOrEmpty(err)) err = productReceiveAreaLstRst; BaseMsgForm.ShowError(err); } if (productReceiveAreaLstRst.Contains("\"success\":true")) { try { int total = BaseRegex.GetStringJson(ref productReceiveAreaLstRst, "total").ParseToInt(); totalPage = Math.Ceiling(total * 1.0 / pageSize).ParseToInt(); // 获取到货区域 GetProductReceiveAreaList var jArr = JObject.Parse(productReceiveAreaLstRst)["result"]?["items"] as JArray; if (jArr == null) jArr = new JArray(); var receiveAreaLst = JsonHelper.DeserializeJsonToList(jArr.ToString()); int num = 0; foreach (var erceiveArea in receiveAreaLst) { num++; if (cancellationTokenSource.IsCancellationRequested) break; prodIndex++; totalProdIndex++; Invoke(new Action(() => { this.statusBar.lblTaskStatus.Text = "正在查询,店铺:" + shop.ShopAccount + " " + prodIndex + "/" + total + " 件商品"; this.statusBar.pgbTaskProgress.Maximum = selectShopIdLst.Count; this.statusBar.UpdateProgressBar(shopIndex); })); Invoke(new Action(() => { int rowId = this.dgvOpenJit.Rows.Add( false, totalProdIndex, "", // reviewInfo.priceOrderId, // 同价格单号 shop.ShopId, shop.ShopAccount, erceiveArea.productSkcPictureUrl.Replace("https://", "http://").Replace("img.kwcdn.com", "img.cdnfe.com") + "?imageMogr2/thumbnail/60x", // 图片地址 DataGridViewExtension.defaultBitmap, // 展示图片 erceiveArea.productId, erceiveArea.productSkcId, erceiveArea.productName, "", //skuNames, "", //reviewExtCode, "", //extCodePrice == null ? "-" : (extCodePrice.original_price / 100.0).ParseToString(), //货号价格 "", //erceiveArea.supplierPrice, // 申报价格范围 //reviewInfo.productSkuList.FirstOrDefault()?.supplierPrice, // 同价格单号申报价格 "", //BaseClass.StampToDateTime((erceiveArea.skcList.FirstOrDefault()?.statusTime.createdTime.ParseToLong() / 1000).ParseToInt()).ToString("yy/MM/dd HH:mm:ss"), // 创建时间 "", //"调价", "", //complianceStr.IsNullOrEmpty() ? "已填写" : complianceStr, // 合规信息 "", //realPictureStr.IsNullOrEmpty() ? "已上传" : realPictureStr, // 实拍图 "", //erceiveArea.skcList.FirstOrDefault()?.applyJitStatus == 1 ? "开通JIT" : "已开通", "", //"修改库存", // 库存 具体数值在skuNames里显示 erceiveArea.expectReceiveAreaConfigDesc, // 期望到货区域 "" ); dgvOpenJit.Rows[rowId].Height = 60; if (num % 2 == 1) dgvOpenJit.Rows[rowId].DefaultCellStyle.BackColor = Color.White; else dgvOpenJit.Rows[rowId].DefaultCellStyle.BackColor = Color.WhiteSmoke; })); } int areaId = 1; if (this.rbGuangdong.Checked) areaId = 1; if (this.rbYiwu.Checked) areaId = 2; var skcIds = receiveAreaLst.Select(s => s.productSkcId.ParseToString()).ToList(); var rows = dgvOpenJit.Rows.Cast().Where(r => skcIds.Contains(r.Cells["colProdSkc"].Value.ParseToString())).ToList(); var areaEditRst = ReceiveAreaForm.EditReceiveArea(shop, areaId, string.Join(",", skcIds)); if (!areaEditRst.Contains("\"success\":true")) { var msg = BaseRegex.GetStringJson(ref areaEditRst, "errorMsg").ParseToString(); if (string.IsNullOrEmpty(msg)) msg = BaseRegex.GetStringJson(ref areaEditRst, "error_msg").ParseToString(); if (string.IsNullOrEmpty(msg)) msg = areaEditRst; Invoke(new Action(() => { foreach (var row in rows) { row.Cells["colMsg"].Value = "修改期望到货区域失败:" + msg; } })); continue; } else { var expectReceiveAreaConfigDesc = ""; if (areaId == 1) expectReceiveAreaConfigDesc = "广东"; if (areaId == 2) expectReceiveAreaConfigDesc = "义乌"; if (areaId == 3) expectReceiveAreaConfigDesc = "按照历史发货地就近推荐"; Invoke(new Action(() => { foreach (var row in rows) { row.Cells["colMsg"].Value = "期望到货区域已改为:" + expectReceiveAreaConfigDesc; } })); } } catch (Exception ex) { BaseMsgForm.ShowError("设置期望到货区域失败 " + ex.Message); break; } } } } Invoke(new Action(() => { this.pbLoading.Visible = false; string sRst = "设置期望到货区域结束!"; if (cancellationTokenSource.IsCancellationRequested) sRst = "已取消设置期望到货区域!"; BaseMsgForm.ShowInfo(sRst); this.statusBar.lblTaskStatus.Text = sRst; //var extCodeLst = this.dgvOpenJit.Rows.Cast() // .Select(r => r.Cells["colExtCode"].Value.ParseToString()) // .Where(s => !string.IsNullOrEmpty(s.Trim('-'))).Distinct().ToList(); //this.dgvExtCode.Rows.Clear(); //foreach (var ext in extCodeLst) //{ // this.dgvExtCode.Rows.Add(false, ext); //} })); }, cancellationTokenSource.Token); } private void btnCancel_Click(object sender, EventArgs e) { if (cancellationTokenSource != null) cancellationTokenSource.Cancel(); } private void chkFilterJit_CheckedChanged(object sender, EventArgs e) { FilterRows(); } private void chkFilterNotJit_CheckedChanged(object sender, EventArgs e) { FilterRows(); } private void btnSaveExtCodeJitConfig_Click(object sender, EventArgs e) { var rows = this.dgvExtCode.Rows.Cast() .Where(r => r.Cells["colSelectExtCode"].Value.ParseToBool() == true).ToList(); var extCodeLst = rows.Select(r => r.Cells["colFilterExtCode"].Value.ParseToString()).Distinct().ToList(); if (extCodeLst.Count == 0) { BaseMsgForm.ShowError("请查询商品后在左边列表选择货号!"); return; } string checkJitParamRst = CheckJitParam(); if (!string.IsNullOrEmpty(checkJitParamRst)) { BaseMsgForm.ShowError(checkJitParamRst); return; } foreach (var extCode in extCodeLst) { lstOpenJitParams.RemoveAll(p => p.ExtCode == extCode); var jitParam = new OpenJitFullParams() { ExtCode = extCode, IdentifyCode = txtBatchIdentifyCode.Text.Trim(), PriceMax = txtBatchPriceMax.Text.Trim().ParseToDecimal(), PriceMin = txtBatchPriceMin.Text.Trim().ParseToDecimal(), RealPicture = pbBatchRealPicture.Tag.ParseToString(), Stock = txtBatchStock.Text.Trim().ParseToInt(), }; lstOpenJitParams.Add(jitParam); } NaiBa.Util.Helper.ConfigHelper.SaveConfig("open_jit_params", JsonHelper.DeserializeJsonToList(JsonHelper.SerializeObject(lstOpenJitParams))); BaseMsgForm.ShowInfo("选中货号的JIT配置已保存!"); foreach (var row in rows) { var ext = row.Cells["colFilterExtCode"].Value.ParseToString(); var paramsExist = lstOpenJitParams.FirstOrDefault(p => p.ExtCode == ext); row.Cells["colJitConfig"].Value = ("价:" + paramsExist.PriceMin + "-" + paramsExist.PriceMax + ";库:" + paramsExist.Stock); // "查看"; } } private void btnRestoreJitParams_Click(object sender, EventArgs e) { var rows = this.dgvExtCode.Rows.Cast() .Where(r => r.Cells["colSelectExtCode"].Value.ParseToBool() == true).ToList(); var extCodeLst = rows.Select(r => r.Cells["colFilterExtCode"].Value.ParseToString()).Distinct().ToList(); if (extCodeLst.Count == 0) { BaseMsgForm.ShowError("请查询商品后在左边列表选择货号!"); return; } if (BaseMsgForm.ShowConfirm("确定要清除选中货号的JIT配置吗?", "提示").DialogResult == DialogResult.OK) { foreach (var extCode in extCodeLst) { lstOpenJitParams.RemoveAll(p => p.ExtCode == extCode); } NaiBa.Util.Helper.ConfigHelper.SaveConfig("open_jit_params", lstOpenJitParams); BaseMsgForm.ShowInfo("选中货号的JIT配置已清除!"); foreach (var row in rows) { row.Cells["colJitConfig"].Value = "未设置"; } } } private void pbBatchRealPicture_Click(object sender, EventArgs e) { ShowImgForm imgForm = new ShowImgForm(pbBatchRealPicture.Image); imgForm.ShowDialog(); } } // jit操作查询相关设置 public class SetJitConfig { public string SearchShopId { get; set; } = ""; public string SearchShopName { get; set; } = ""; public string SearchNotes { get; set; } = ""; public bool SearchAllShop { get; set; } = true; public string SearchSpuId { get; set; } = ""; public string SearchSkcId { get; set; } = ""; public string SearchExtCode { get; set; } = ""; public bool SearchDuration { get; set; } = true; } /// /// 开通jit配置参数 /// public class OpenJitFullParams { public string ExtCode { get; set; } public decimal PriceMin { get; set; } public decimal PriceMax { get; set; } public string IdentifyCode { get; set; } public string RealPicture { get; set; } public int Stock { get; set; } } /// /// 因为每家店铺图片不一致,所以保存价格和数量,但是图片和识别码不保存 /// public class OpenJitParamsNoImg { public string ExtCode { get; set; } public decimal PriceMin { get; set; } public decimal PriceMax { get; set; } public int Stock { get; set; } } /// /// 合规信息 /// public class complianceInfo { public long? spu_id { get; set; } // 5230217458, public string spu_name { get; set; } // "XIXITIAO 女款韩式拖鞋 - 夏季休闲纯色 EVA 拖鞋,舒适防滑低跟沙滩凉鞋,室内/室外使用,夏季凉鞋,女式人字拖,夹趾凉鞋时尚女士轻质夏季一脚蹬沙滩人字拖凉鞋,女式人字拖夹趾凉鞋休闲凉鞋淋浴鞋沙滩拖鞋拖鞋凉鞋一脚蹬淌水鞋,百搭设计,适合日常穿着,女式平底凉鞋", public long? cat_id { get; set; } // 29186, public string cat_name { get; set; } // "女士人字拖", public long? goods_id { get; set; } // 601103852497488, public string goods_url { get; set; } // "https://img.kwcdn.com/product/fancy/0f52acc1-edfe-4f70-8032-012505ad0da5.jpg", public List wait_task_dtolist { get; set; } public List wait_task_show_dtolist { get; set; } public bool? on_sale { get; set; } // false } public class wait_task_show_dto { public string show_name { get; set; } // "加州 65 号提案" public int? status { get; set; } // 2 public List wait_task_dtolist { get; set; } } public class task_dto { public long? task_id { get; set; } // 101042759897649, public int? task_type { get; set; } // 25, public bool? is_not_required { get; set; } // true, public string task_name { get; set; } // "欧盟负责人", public int? status { get; set; } // 2, public long? punish_time { get; set; } // 0, public sale_effect_info sale_effect_info { get; set; } } public class sale_effect_info { public long? punish_time { get; set; } // 0, public bool? on_site { get; set; } // false, public List region_list { get; set; } // [105, 106, 107, 108, 109, ...], public string content { get; set; } // "德国站、法国站、意大利站、荷兰站、西班牙站、葡萄牙站、波兰站、瑞典站、希腊站、爱尔兰站、塞浦路斯站、捷克站、匈牙利站、丹麦站、罗马尼亚站、保加利亚站、比利时站、奥地利站、芬兰站、斯洛伐克站、克罗地亚站、斯洛文尼亚站、立陶宛站、爱沙尼亚站、拉脱维亚站、马耳他站、卢森堡站" } //----------------------------------------------------------------------------------------- //合规实拍图片 public class RealPictureQueryRsult { public int? total { get; set; } // 50 public List items { get; set; } public bool? show_effect_result { get; set; } // true, public bool? is_semi_managed_mall { get; set; } // false, public string notice_toast { get; set; } // "如商品标签缺失/不全或者存在弄虚作假情形(例如上传虚假图片),将会影响商品备货销售。" } public class RealPictureInfo { public long? spu_id { get; set; } // 5230217458, public string spu_name { get; set; } // "XIXITIAO 女款韩式拖鞋 - 夏季休闲纯色 EVA 拖鞋,舒适防滑低跟沙滩凉鞋,室内/室外使用,夏季凉鞋,女式人字拖,夹趾凉鞋时尚女士轻质夏季一脚蹬沙滩人字拖凉鞋,女式人字拖夹趾凉鞋休闲凉鞋淋浴鞋沙滩拖鞋拖鞋凉鞋一脚蹬淌水鞋,百搭设计,适合日常穿着,女式平底凉鞋", public string material_img_url { get; set; } // "https://img.kwcdn.com/product/fancy/0f52acc1-edfe-4f70-8032-012505ad0da5.jpg", public bool? is_same_sku { get; set; } // true, public same_sku_vo_info same_sku_vo { get; set; } public int? upload_status { get; set; } // 1 public bool? no_have_pack { get; set; } // false, public List no_have_pack_list { get; set; } // [], public List rule_check_result_list { get; set; } public int? button_status { get; set; } // 0, public long? goods_id { get; set; } // 601103727939214, public object gray_control { get; set; } // {}, public bool? new_pop_up_gray { get; set; } // true, public List position_detail { get; set; } public bool can_audit { get; set; } // true, public List sku_info { get; set; } public guide_file_info guide_File_Info { get; set; } } public class guide_file_info { public bool? uploaded { get; set; } // false, public bool? hit_guide_file { get; set; } // false } public class position_detail_info { public int? position { get; set; } // 1, public bool? is_same_sku { get; set; } // true, public List sku_info { get; set; } public List sku_photo_info_list { get; set; } public List photo_requirement_list { get; set; } } public class same_sku_vo_info { public List sku_list { get; set; } } public class sku_info { public long? sku_id { get; set; } // 66094708278, public string sku_name { get; set; } // "66094708278(黑色,36)", public string sku_image { get; set; } // "https://img.kwcdn.com/product/fancy/b68693cc-8f17-45f1-bee8-9a89b8df7e8c.jpg" public long? material_id { get; set; } // 5905935642 public string refuse_reason { get; set; } // "{\"goodsPackInfoExtDTOMap\":{\"tur_manufacturer_name_address\":{\"mallShow\":true,\"mallModelCheck\":true,\"openCheckSendGoods\":true,\"noPackageCheckSendGoods\":false,\"qcShow\":true,\"qcShowStartTime\":1640966400904,\"qcModelCheck\":true,\"qcModelCheckStartTime\":1640966400553,\"openCheckSendGoodsStartTime\":1640966400883,\"noPackageCheckSendGoodsStartTime\":null,\"noUpload\":false,\"checkAdvice\":{\"tur_authorized_representative\":[8],\"manufacturer_name_address_and_electronic_address\":[6],\"tur_manufacturer_name_address\":[8],\"tur_additional_safety_information\":[6],\"Packaging\":[6],\"gpsr_warning_or_safety_information\":[6],\"eu_rep_name_address_and_electronic_address\":[6],\"false_information\":[6],\"tur_production_batch_number_model_serial_number\":[8],\"Textile_etc\":[6],\"product_batch_model_serial_numbers\":[6],\"ce_mark_misuse\":[6]},\"isSemiManagedGoods\":false,\"mallOpenPunish\":false,\"mallOpenPunishStartTime\":null},\"false_information\":{\"mallShow\":true,\"mallModelCheck\":true,\"openCheckSendGoods\":true,\"noPackageCheckSendGoods\":false,\"qcShow\":true,\"qcShowStartTime\":1672544860294,\"qcModelCheck\":true,\"qcModelCheckStartTime\":1672584937377,\"openCheckSendGoodsStartTime\":1672544856346,\"noPackageCheckSendGoodsStartTime\":null,\"noUpload\":false,\"checkAdvice\":{\"tur_authorized_representative\":[8],\"manufacturer_name_address_and_electronic_address\":[6],\"tur_manufacturer_name_address\":[8],\"tur_additional_safety_information\":[6],\"Packaging\":[6],\"gpsr_warning_or_safety_information\":[6],\"eu_rep_name_address_and_electronic_address\":[6],\"false_information\":[6],\"tur_production_batch_number_model_serial_number\":[8],\"Textile_etc\":[6],\"product_batch_model_serial_numbers\":[6],\"ce_mark_misuse\":[6]},\"isSemiManagedGoods\":false,\"mallOpenPunish\":false,\"mallOpenPunishStartTime\":null},\"product_batch_model_serial_numbers\":{\"mallShow\":true,\"mallModelCheck\":true,\"openCheckSendGoods\":true,\"noPackageCheckSendGoods\":false,\"qcShow\":true,\"qcShowStartTime\":1640966400677,\"qcModelCheck\":true,\"qcModelCheckStartTime\":1640966400040,\"openCheckSendGoodsStartTime\":1640966400572,\"noPackageCheckSendGoodsStartTime\":null,\"noUpload\":false,\"checkAdvice\":{\"tur_authorized_representative\":[8],\"manufacturer_name_address_and_electronic_address\":[6],\"tur_manufacturer_name_address\":[8],\"tur_additional_safety_information\":[6],\"Packaging\":[6],\"gpsr_warning_or_safety_information\":[6],\"eu_rep_name_address_and_electronic_address\":[6],\"false_information\":[6],\"tur_production_batch_number_model_serial_number\":[8],\"Textile_etc\":[6],\"product_batch_model_serial_numbers\":[6],\"ce_mark_misuse\":[6]},\"isSemiManagedGoods\":false,\"mallOpenPunish\":false,\"mallOpenPunishStartTime\":null},\"Plastic_Bag\":{\"mallShow\":true,\"mallModelCheck\":false,\"openCheckSendGoods\":false,\"noPackageCheckSendGoods\":false,\"qcShow\":false,\"qcShowStartTime\":null,\"qcModelCheck\":false,\"qcModelCheckStartTime\":null,\"openCheckSendGoodsStartTime\":null,\"noPackageCheckSendGoodsStartTime\":null,\"noUpload\":false,\"checkAdvice\":{\"tur_authorized_representative\":[8],\"manufacturer_name_address_and_electronic_address\":[6],\"tur_manufacturer_name_address\":[8],\"tur_additional_safety_information\":[6],\"Packaging\":[6],\"gpsr_warning_or_safety_information\":[6],\"eu_rep_name_address_and_electronic_address\":[6],\"false_information\":[6],\"tur_production_batch_number_model_serial_number\":[8],\"Textile_etc\":[6],\"product_batch_model_serial_numbers\":[6],\"ce_mark_misuse\":[6]},\"isSemiManagedGoods\":false,\"mallOpenPunish\":false,\"mallOpenPunishStartTime\":null},\"tur_authorized_representative\":{\"mallShow\":true,\"mallModelCheck\":true,\"openCheckSendGoods\":true,\"noPackageCheckSendGoods\":false,\"qcShow\":true,\"qcShowStartTime\":1640966400904,\"qcModelCheck\":true,\"qcModelCheckStartTime\":1640966400553,\"openCheckSendGoodsStartTime\":1640966400883,\"noPackageCheckSendGoodsStartTime\":null,\"noUpload\":false,\"checkAdvice\":{\"tur_authorized_representative\":[8],\"manufacturer_name_address_and_electronic_address\":[6],\"tur_manufacturer_name_address\":[8],\"tur_additional_safety_information\":[6],\"Packaging\":[6],\"gpsr_warning_or_safety_information\":[6],\"eu_rep_name_address_and_electronic_address\":[6],\"false_information\":[6],\"tur_production_batch_number_model_serial_number\":[8],\"Textile_etc\":[6],\"product_batch_model_serial_numbers\":[6],\"ce_mark_misuse\":[6]},\"isSemiManagedGoods\":false,\"mallOpenPunish\":false,\"mallOpenPunishStartTime\":null},\"manufacturer_name_address_and_electronic_address\":{\"mallShow\":true,\"mallModelCheck\":true,\"openCheckSendGoods\":true,\"noPackageCheckSendGoods\":false,\"qcShow\":true,\"qcShowStartTime\":1640966400677,\"qcModelCheck\":true,\"qcModelCheckStartTime\":1640966400040,\"openCheckSendGoodsStartTime\":1640966400572,\"noPackageCheckSendGoodsStartTime\":null,\"noUpload\":false,\"checkAdvice\":{\"tur_authorized_representative\":[8],\"manufacturer_name_address_and_electronic_address\":[6],\"tur_manufacturer_name_address\":[8],\"tur_additional_safety_information\":[6],\"Packaging\":[6],\"gpsr_warning_or_safety_information\":[6],\"eu_rep_name_address_and_electronic_address\":[6],\"false_information\":[6],\"tur_production_batch_number_model_serial_number\":[8],\"Textile_etc\":[6],\"product_batch_model_serial_numbers\":[6],\"ce_mark_misuse\":[6]},\"isSemiManagedGoods\":false,\"mallOpenPunish\":false,\"mallOpenPunishStartTime\":null},\"recycling_symbol_es\":{\"mallShow\":true,\"mallModelCheck\":false,\"openCheckSendGoods\":false,\"noPackageCheckSendGoods\":false,\"qcShow\":false,\"qcShowStartTime\":null,\"qcModelCheck\":true,\"qcModelCheckStartTime\":null,\"openCheckSendGoodsStartTime\":null,\"noPackageCheckSendGoodsStartTime\":null,\"noUpload\":false,\"checkAdvice\":{\"tur_authorized_representative\":[8],\"manufacturer_name_address_and_electronic_address\":[6],\"tur_manufacturer_name_address\":[8],\"tur_additional_safety_information\":[6],\"Packaging\":[6],\"gpsr_warning_or_safety_information\":[6],\"eu_rep_name_address_and_electronic_address\":[6],\"false_information\":[6],\"tur_production_batch_number_model_serial_number\":[8],\"Textile_etc\":[6],\"product_batch_model_serial_numbers\":[6],\"ce_mark_misuse\":[6]},\"isSemiManagedGoods\":false,\"mallOpenPunish\":false,\"mallOpenPunishStartTime\":null},\"tur_additional_safety_information\":{\"mallShow\":true,\"mallModelCheck\":true,\"openCheckSendGoods\":false,\"noPackageCheckSendGoods\":false,\"qcShow\":false,\"qcShowStartTime\":null,\"qcModelCheck\":false,\"qcModelCheckStartTime\":null,\"openCheckSendGoodsStartTime\":null,\"noPackageCheckSendGoodsStartTime\":null,\"noUpload\":false,\"checkAdvice\":{\"tur_authorized_representative\":[8],\"manufacturer_name_address_and_electronic_address\":[6],\"tur_manufacturer_name_address\":[8],\"tur_additional_safety_information\":[6],\"Packaging\":[6],\"gpsr_warning_or_safety_information\":[6],\"eu_rep_name_address_and_electronic_address\":[6],\"false_information\":[6],\"tur_production_batch_number_model_serial_number\":[8],\"Textile_etc\":[6],\"product_batch_model_serial_numbers\":[6],\"ce_mark_misuse\":[6]},\"isSemiManagedGoods\":false,\"mallOpenPunish\":false,\"mallOpenPunishStartTime\":null},\"gpsr_warning_or_safety_information\":{\"mallShow\":true,\"mallModelCheck\":true,\"openCheckSendGoods\":true,\"noPackageCheckSendGoods\":false,\"qcShow\":true,\"qcShowStartTime\":1640966400677,\"qcModelCheck\":true,\"qcModelCheckStartTime\":1640966400040,\"openCheckSendGoodsStartTime\":1640966400572,\"noPackageCheckSendGoodsStartTime\":null,\"noUpload\":false,\"checkAdvice\":{\"tur_authorized_representative\":[8],\"manufacturer_name_address_and_electronic_address\":[6],\"tur_manufacturer_name_address\":[8],\"tur_additional_safety_information\":[6],\"Packaging\":[6],\"gpsr_warning_or_safety_information\":[6],\"eu_rep_name_address_and_electronic_address\":[6],\"false_information\":[6],\"tur_production_batch_number_model_serial_number\":[8],\"Textile_etc\":[6],\"product_batch_model_serial_numbers\":[6],\"ce_mark_misuse\":[6]},\"isSemiManagedGoods\":false,\"mallOpenPunish\":false,\"mallOpenPunishStartTime\":null},\"Packaging\":{\"mallShow\":true,\"mallModelCheck\":true,\"openCheckSendGoods\":true,\"noPackageCheckSendGoods\":true,\"qcShow\":true,\"qcShowStartTime\":1705248000000,\"qcModelCheck\":true,\"qcModelCheckStartTime\":1712851200000,\"openCheckSendGoodsStartTime\":1705248000000,\"noPackageCheckSendGoodsStartTime\":null,\"noUpload\":false,\"checkAdvice\":{\"tur_authorized_representative\":[8],\"manufacturer_name_address_and_electronic_address\":[6],\"tur_manufacturer_name_address\":[8],\"tur_additional_safety_information\":[6],\"Packaging\":[6],\"gpsr_warning_or_safety_information\":[6],\"eu_rep_name_address_and_electronic_address\":[6],\"false_information\":[6],\"tur_production_batch_number_model_serial_number\":[8],\"Textile_etc\":[6],\"product_batch_model_serial_numbers\":[6],\"ce_mark_misuse\":[6]},\"isSemiManagedGoods\":false,\"mallOpenPunish\":false,\"mallOpenPunishStartTime\":null},\"eu_rep_name_address_and_electronic_address\":{\"mallShow\":true,\"mallModelCheck\":true,\"openCheckSendGoods\":true,\"noPackageCheckSendGoods\":false,\"qcShow\":true,\"qcShowStartTime\":1640966400677,\"qcModelCheck\":true,\"qcModelCheckStartTime\":1640966400040,\"openCheckSendGoodsStartTime\":1640966400572,\"noPackageCheckSendGoodsStartTime\":null,\"noUpload\":false,\"checkAdvice\":{\"tur_authorized_representative\":[8],\"manufacturer_name_address_and_electronic_address\":[6],\"tur_manufacturer_name_address\":[8],\"tur_additional_safety_information\":[6],\"Packaging\":[6],\"gpsr_warning_or_safety_information\":[6],\"eu_rep_name_address_and_electronic_address\":[6],\"false_information\":[6],\"tur_production_batch_number_model_serial_number\":[8],\"Textile_etc\":[6],\"product_batch_model_serial_numbers\":[6],\"ce_mark_misuse\":[6]},\"isSemiManagedGoods\":false,\"mallOpenPunish\":false,\"mallOpenPunishStartTime\":null},\"tur_production_batch_number_model_serial_number\":{\"mallShow\":true,\"mallModelCheck\":true,\"openCheckSendGoods\":true,\"noPackageCheckSendGoods\":false,\"qcShow\":true,\"qcShowStartTime\":1640966400904,\"qcModelCheck\":true,\"qcModelCheckStartTime\":1640966400553,\"openCheckSendGoodsStartTime\":1640966400883,\"noPackageCheckSendGoodsStartTime\":null,\"noUpload\":false,\"checkAdvice\":{\"tur_authorized_representative\":[8],\"manufacturer_name_address_and_electronic_address\":[6],\"tur_manufacturer_name_address\":[8],\"tur_additional_safety_information\":[6],\"Packaging\":[6],\"gpsr_warning_or_safety_information\":[6],\"eu_rep_name_address_and_electronic_address\":[6],\"false_information\":[6],\"tur_production_batch_number_model_serial_number\":[8],\"Textile_etc\":[6],\"product_batch_model_serial_numbers\":[6],\"ce_mark_misuse\":[6]},\"isSemiManagedGoods\":false,\"mallOpenPunish\":false,\"mallOpenPunishStartTime\":null},\"Textile_etc\":{\"mallShow\":true,\"mallModelCheck\":true,\"openCheckSendGoods\":true,\"noPackageCheckSendGoods\":true,\"qcShow\":true,\"qcShowStartTime\":1705248000000,\"qcModelCheck\":true,\"qcModelCheckStartTime\":1713369600000,\"openCheckSendGoodsStartTime\":1705248000000,\"noPackageCheckSendGoodsStartTime\":null,\"noUpload\":false,\"checkAdvice\":{\"tur_authorized_representative\":[8],\"manufacturer_name_address_and_electronic_address\":[6],\"tur_manufacturer_name_address\":[8],\"tur_additional_safety_information\":[6],\"Packaging\":[6],\"gpsr_warning_or_safety_information\":[6],\"eu_rep_name_address_and_electronic_address\":[6],\"false_information\":[6],\"tur_production_batch_number_model_serial_number\":[8],\"Textile_etc\":[6],\"product_batch_model_serial_numbers\":[6],\"ce_mark_misuse\":[6]},\"isSemiManagedGoods\":false,\"mallOpenPunish\":false,\"mallOpenPunishStartTime\":null},\"ce_mark_misuse\":{\"mallShow\":true,\"mallModelCheck\":true,\"openCheckSendGoods\":true,\"noPackageCheckSendGoods\":true,\"qcShow\":true,\"qcShowStartTime\":1760858561196,\"qcModelCheck\":true,\"qcModelCheckStartTime\":1762697895174,\"openCheckSendGoodsStartTime\":1760858566137,\"noPackageCheckSendGoodsStartTime\":null,\"noUpload\":false,\"checkAdvice\":{\"tur_authorized_representative\":[8],\"manufacturer_name_address_and_electronic_address\":[6],\"tur_manufacturer_name_address\":[8],\"tur_additional_safety_information\":[6],\"Packaging\":[6],\"gpsr_warning_or_safety_information\":[6],\"eu_rep_name_address_and_electronic_address\":[6],\"false_information\":[6],\"tur_production_batch_number_model_serial_number\":[8],\"Textile_etc\":[6],\"product_batch_model_serial_numbers\":[6],\"ce_mark_misuse\":[6]},\"isSemiManagedGoods\":false,\"mallOpenPunish\":false,\"mallOpenPunishStartTime\":null}}}" public List rule_check_result { get; set; } } public class rule_check_result_info { public int? check_type { get; set; } // 883, public string rule_name { get; set; } // "土耳其标签合规-土耳其负责人", public int? rule_status { get; set; } // 4, // 2为合格,其他为有问题 public string rule_status_toast { get; set; } // "待传图", public int affected_site_count { get; set; } // 1, public example_info example_info { get; set; } public List rule_result { get; set; } public string effect_result { get; set; } // "

请立即上传实拍图并确保实物标签均符合适用法律法规,避免影响商品发货入库

", public bool? show_specification { get; set; } // false, public List example_content_list { get; set; } public List material_list { get; set; } // [], public List error_code { get; set; } // [] } public class example_content { public int content_type { get; set; } // 0, public string text { get; set; } // "依据西班牙法规要求,应根据商品包装分类在商品包装上展示对应的回收标识,示例如下:" // content_type==0时 public string url { get; set; } // "https://commimg.kwcdn.com/oms-public-file/2029de4b78/9660ae7e-66c3-40c9-a493-0ea9f6e54275_2441x1013.jpeg" // content_type==1时 } public class rule_result_info { public int? type { get; set; } // 1, public string toast { get; set; } // "标签识别有异常", public string color { get; set; } // "#F71010", public bool? need_language { get; set; } // false } public class example_info { public string example_name { get; set; } // "土耳其标签合规-土耳其负责人", public string example_desc { get; set; } // "根据土耳其法规要求,销售往土耳其的商品,产品上应标注土耳其负责人信息;如果制造商未在土耳其境内设立,土耳其负责人可以为土耳其授权代表(即土代)、进口商或履行服务商;您需要自行判断您的土耳其负责人属于哪一类,并制作相关标签信息;具体需展示负责人名称、邮政地址,参考表述如下。
\nAd: XXXXXXXX
\nAdres:XXXXXXXX
\n注意:
\n1)土耳其负责人名称、邮政地址的标题和值需使用土耳其语标注
\n2)该信息应标注在产品上,只有在无法标注在产品上时,才可以标注在其包装上或随附产品的文件中;
\n3)负责人地址需要是真实有效的、详细的、能联系到该负责人的地址。例如:门牌号(如有),街道号,乡镇/街道,县/区,市/区,省/直辖市;
\n4)负责人地址涉及的行政区划的翻译不可用中文拼音代替,如lu、jiedao、qu、shi、sheng等均为不合规信息;
\n5)如您所上传的资质文件包含负责人名称、地址信息,为了保证信息的真实性,请确保您商品印刷的负责人名称、地址和资质文件中的负责人名称、地址一致。\n", public List example_pic_list { get; set; } // ["https://commimg.kwcdn.com/oms-public-file/2013f77872c/77e1ac90-2e5b-4a93-b134-35c9654bd169_522x248.jpeg"], public List materials { get; set; } } public class material { public int? content_type { get; set; } // 1, public string text { get; set; } // "Üretici: {0}\nÜretici Adres:{0}" public List value_list { get; set; } // ["https://commimg.kwcdn.com/oms-public-file/2013f771338/7e2c5fec-5fe2-4534-a448-d3901d44acea_522x248.jpeg"] // content_type==1 } //------------------------------------------------------ public class RealPictureParam { public int? confirm_type { get; set; } // 4 public long? spu_id { get; set; } // 5230217458 public long? goods_id { get; set; } // 601103852497488 public List real_picture_info_list { get; set; } } public class real_picture_info { public int? position { get; set; } // 1, public int? is_same_sku { get; set; } // 1, public List sku_photo_info_list { get; set; } } public class sku_photo_info { public long? sku_id { get; set; } public List image_list { get; set; } // {"image_url": "https://pos.file.temu.com/flash-tag/20add702d6/615ab801-6ef7-4820-8c1e-9886decc5e56_1280x1707.jpeg"} } public class image_param { public string image_url { get; set; } } //--------------------------------------------------------------- /// /// 期望到货区域读取结果 /// public class SkcReceiveAreaPickOutInfo { public long? productId { get; set; } // 4889882179, public string productName { get; set; } // "1对女士触屏冬季手套 - 加绒保暖防风,户外活动,冷天配件,适用于骑行、智能手机、徒步旅行 - 米色/粉色/白色/黑色/灰色多色可选 - 适合通勤、滑雪、摩托车驾驶 - 仅限手洗,加绒内衬手套,冬季装备", public long? leafCatId { get; set; } // 29296, public string leafCatName { get; set; } // "女士防寒分指手套", public long? cat4Id { get; set; } // 29294, public string cat4Name { get; set; } // "女士手套", public bool? isJit { get; set; } // true, public bool? isCustom { get; set; } // false, public long? productSkcId { get; set; } // 27082284620, public string productSkcPictureUrl { get; set; } // "https://img.kwcdn.com/product/20add70192/d5f9f012-3f46-4781-90a2-2d76bc8cbd4b_800x800.jpeg", public long? historyDeliveryTwoLevelAddressCode { get; set; } // -1, public object historyDeliveryTwoLevelAddressDesc { get; set; } // null, public int? expectReceiveAreaConfigType { get; set; } // 1, public string expectReceiveAreaConfigDesc { get; set; } // "广东", public bool? canEditExpectReceiveArea { get; set; } // true } //------------------------------------------------------------------------- }