493 lines
26 KiB
C#
493 lines
26 KiB
C#
using AllBase;
|
|
using AllBase.DouYinModel.Result;
|
|
using AllBase.Model.Result;
|
|
using _29WxOrder.OrderForms;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using Work;
|
|
using Work.Api;
|
|
using Work.BaseForms;
|
|
using AllBase.Helper;
|
|
using AllBase.Model.DBModel;
|
|
|
|
namespace _29WxOrder.FactoryExportForms
|
|
{
|
|
public partial class FactoryExportForm : BaseGeneralForm
|
|
{
|
|
public List<string> productIdList = new List<string>();
|
|
List<DouYinOrderModel> lstDouYinOrder = new List<DouYinOrderModel>();
|
|
public FactoryExportForm()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
private void FactoryExportForm_Load(object sender, EventArgs e)
|
|
{
|
|
Task.Run(() =>
|
|
{
|
|
ReadServerOrder();
|
|
});
|
|
}
|
|
|
|
void ReadServerOrder()
|
|
{
|
|
lstDouYinOrder = new List<DouYinOrderModel>();
|
|
foreach (var prodId in productIdList)
|
|
{
|
|
int totalCount = 0, currentCount = 0, page = 1, pageSize = 100, readPages = 1000;
|
|
|
|
reads:
|
|
List<DouYinOrderModel> lstDouYinOrderTemp = new List<DouYinOrderModel>();
|
|
|
|
string url = BaseClass.Build29WxObjString("order&act=get");
|
|
string data = "&order_status_buy=1&page=" + (page - 1) + "&pageSize=" + pageSize;
|
|
// 按时间升序排列
|
|
data += "&order_by=create_time";
|
|
// 按时间升序排列
|
|
data += "&order_by_asc=asc";
|
|
// 商品id作为搜索条件
|
|
data += "&search=" + prodId;
|
|
string html = GetHtml.PostUtf8(url, UserLogin.GetSignaturex("", "") + data);
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("\"data\""))
|
|
{
|
|
html = GetHtml.PostUtf8(url, UserLogin.GetSignaturex("", "") + data);
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("\"data\""))
|
|
return;
|
|
}
|
|
var jObject = JObject.Parse(html);
|
|
string code = jObject["code"].ToString();
|
|
if (code != "0" && code != "200")
|
|
{
|
|
return;
|
|
}
|
|
var jArr = jObject["data"]["list"];
|
|
totalCount = Convert.ToInt32(jObject["data"]["count"]);
|
|
foreach (JObject jObj in jArr)
|
|
{
|
|
try
|
|
{
|
|
string orderStr = jObj.ToString();
|
|
DouYinOrderModel douYinOrderModel = JsonConvert.DeserializeObject<DouYinOrderModel>(orderStr.Replace("\r\n", ""));
|
|
lstDouYinOrderTemp.Add(douYinOrderModel);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
}
|
|
}
|
|
lstDouYinOrder.AddRange(lstDouYinOrderTemp);
|
|
ShowDouYinOrderInDgv(lstDouYinOrderTemp);
|
|
currentCount += lstDouYinOrderTemp.Count;
|
|
|
|
readPages--;
|
|
if (readPages > 0 && currentCount < totalCount)
|
|
{
|
|
page++;
|
|
goto reads;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void ShowDouYinOrderInDgv(List<DouYinOrderModel> orderModels)
|
|
{
|
|
var tasklst = new List<Task>();
|
|
Dictionary<DataGridViewRow, string> dic = new Dictionary<DataGridViewRow, string>();
|
|
Invoke(new Action(() =>
|
|
{
|
|
for (int i = 0; i < orderModels.Count; i++)
|
|
{
|
|
var douYinOrderModel = orderModels[i];
|
|
|
|
TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(douYinOrderModel.create_time == "2000-00-00 00:00:00" ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : douYinOrderModel.create_time).Ticks);
|
|
TimeSpan ts2 = new TimeSpan(DateTime.Now.AddHours(-48).Ticks);
|
|
TimeSpan ts = ts1.Subtract(ts2).Duration();
|
|
|
|
DataGridViewRow r = new DataGridViewRow();
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = douYinOrderModel.shop_id, }); /*"店铺编号"*/
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = douYinOrderModel.shop_name, }); /*"店铺名称"*/
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = douYinOrderModel.title, });
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = string.IsNullOrEmpty(douYinOrderModel.default_up_ids) ? douYinOrderModel.up_product_id : douYinOrderModel.default_up_ids, }); /*"上家ID"*/
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = douYinOrderModel.product_id, }); /*"本店ID"*/
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = douYinOrderModel.c_biz_desc, }); /*"描述"*/
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = douYinOrderModel.sku, }); /*"规格"*/
|
|
r.Cells.Add(new DataGridViewImageCell() { Value = BuyOrderListForm.skuImgDefault, }); /*"图片"*/
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = douYinOrderModel.price, }); /*"售价"*/
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = douYinOrderModel.buy_price, }); /*"进价"*/
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = string.IsNullOrEmpty(douYinOrderModel.commission_scale) ? "0.00" : douYinOrderModel.commission_scale, }); /*"佣金比例"*/
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = string.IsNullOrEmpty(douYinOrderModel.commission) ? "0.00" : douYinOrderModel.commission, }); /*"佣金"*/
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = douYinOrderModel.count, }); /*"数量"*/
|
|
r.Cells.Add(new DataGridViewLinkCell() { Value = douYinOrderModel.order_id, }); /*"买家订单号"*/
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = douYinOrderModel.name, }); /*"买家姓名"*/
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = douYinOrderModel.mobile, }); /*"买家电话"*/
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = douYinOrderModel.address, }); /*"买家地址"*/
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = (douYinOrderModel.create_time == "2000-00-00 00:00:00" ? "2021-01-01 01:01:01" : douYinOrderModel.create_time), }); /*"订单确认时间"*/
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = Convert.ToDateTime(douYinOrderModel.create_time == "2000-00-00 00:00:00" ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : douYinOrderModel.create_time).AddHours(48).ToString("yyyy-MM-dd HH:mm:ss"), }); /*"延迟发货时间"*/
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = (ts2 > ts1 ? "超 " : "") + ts.Days.ToString("D2") + "天" + ts.Hours.ToString("D2") + "时" + ts.Minutes.ToString("D2") + "分", }); /*"延迟剩余"*/
|
|
r.Cells.Add(new DataGridViewLinkCell() { Value = "开始拍单", });
|
|
r.Cells.Add(new DataGridViewTextBoxCell() { Value = douYinOrderModel.remark, });
|
|
dgvOrder.Rows.Add(r);
|
|
|
|
dic.Add(r, douYinOrderModel.sku_img);
|
|
}
|
|
dgvOrder.ClearSelection();
|
|
}));
|
|
|
|
foreach (var r in dic.Keys)
|
|
{
|
|
var t = Task.Run(() =>
|
|
{
|
|
try
|
|
{
|
|
Bitmap skuImg = BuyOrderListForm.GetSkuImage(dic[r]);
|
|
if (dgvOrder.Rows.Contains(r))
|
|
r.Cells["productImgSku"].Value = skuImg;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
}
|
|
});
|
|
tasklst.Add(t);
|
|
if (tasklst.Count >= 100)
|
|
{
|
|
Task.WaitAll(tasklst.ToArray());
|
|
tasklst = new List<Task>();
|
|
}
|
|
}
|
|
Task.WaitAll(tasklst.ToArray());
|
|
}
|
|
|
|
private void 更新选中订单ToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
if (!isUpadateOrderRun)
|
|
{
|
|
new Thread(UpdateOrderDetail).Start();
|
|
}
|
|
else
|
|
{
|
|
BaseMsgForm.ShowInfo("订单更新中,请等待当前更新任务完成。", "提示");
|
|
}
|
|
}
|
|
|
|
private void 导出订单列表ToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
outexcel();
|
|
}
|
|
|
|
bool isUpadateOrderRun = false;
|
|
void UpdateOrderDetail()
|
|
{
|
|
List<string> orderIds = new List<string>();
|
|
var rows = this.dgvOrder.SelectedCells.Cast<DataGridViewCell>().Select(c => c.OwningRow).Distinct().ToList();
|
|
Thread.Sleep(1000);
|
|
foreach (DataGridViewRow dgvrows in rows)
|
|
{
|
|
orderIds.Add(dgvrows.Cells["col_order_id"].Value.ToString());
|
|
}
|
|
isUpadateOrderRun = true;
|
|
try
|
|
{
|
|
foreach (string orderId in orderIds)
|
|
{
|
|
#region 更新订单
|
|
UpdateOrderStatusAndEncrypt(orderId);
|
|
if (orderIds.Count > 1)
|
|
Thread.Sleep(Randomx.GetId(500, 1500));
|
|
#endregion
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
isUpadateOrderRun = false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新订单状态和解密
|
|
/// </summary>
|
|
/// <param name="orderId"></param>
|
|
public void UpdateOrderStatusAndEncrypt(string orderId)
|
|
{
|
|
DouYinOrderModel douYinOrderModel = this.lstDouYinOrder.Find(x => x.order_id == orderId);
|
|
ShopLoginInfo shop = GlobalConfig.ShopLoginList.FirstOrDefault(x => x.ShopId == douYinOrderModel.shop_id.ToString());
|
|
if (douYinOrderModel != null && shop != null)
|
|
{
|
|
DouyinApi dyapi = new DouyinApi(shop);
|
|
Dictionary<string, string> dic = new Dictionary<string, string>() { };
|
|
dic.Add("shop_order_id", douYinOrderModel.order_id);
|
|
dyapi.JsonData = dic;
|
|
string htmljm = dyapi.GetOrderDetail();
|
|
string code = JObject.Parse(htmljm)["code"].ToString();
|
|
if (code == "10000")
|
|
{
|
|
//3 已发货(全部发货)
|
|
//2 备货中(待发货)
|
|
string order_status = JObject.Parse(htmljm)["data"]["shop_order_detail"]["order_status"].ToString();
|
|
if (order_status != "2") // 抖店订单状态不是备货中(2),则修改服务端状态为已完成(0)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.Append("&order_id=" + douYinOrderModel.order_id);
|
|
sb.Append("&order_status_buy=0");
|
|
sb.Append("&is_update_order=1"); // 1修改状态0不修改状态
|
|
sb.Append("&remark=" + douYinOrderModel.remark);
|
|
string url = BaseClass.Build29WxObjString("order&act=update");
|
|
GetHtml.PostUtf8(url, UserLogin.GetSignaturex() + sb.ToString());
|
|
CollectionClass.orderDataList.Remove(douYinOrderModel);
|
|
this.lstDouYinOrder.Remove(douYinOrderModel);
|
|
SetOrderEditShowInDgvRows(douYinOrderModel, 2);
|
|
}
|
|
else
|
|
{
|
|
var updateOrderType = UpdateOrderType.UpdateAll;
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
if (douYinOrderModel.name.Contains("解密失败") || douYinOrderModel.name.Contains("#1##") || douYinOrderModel.name == "******" ||
|
|
douYinOrderModel.mobile.Contains("解密失败") || douYinOrderModel.mobile.Contains("$1$$") || douYinOrderModel.mobile == "******" ||
|
|
douYinOrderModel.address.Contains("解密失败") || douYinOrderModel.address.Contains("#1##") || douYinOrderModel.address == "******")
|
|
{
|
|
#region 解密
|
|
string name_encrypt = JObject.Parse(htmljm)["data"]["shop_order_detail"]["encrypt_post_receiver"].ToString();
|
|
string mobile_encrypt = JObject.Parse(htmljm)["data"]["shop_order_detail"]["encrypt_post_tel"].ToString();
|
|
string address_encrypt = JObject.Parse(htmljm)["data"]["shop_order_detail"]["post_addr"]["encrypt_detail"].ToString();
|
|
dic = new Dictionary<string, string>() { };
|
|
string cipher_infos = "[";
|
|
if ((updateOrderType == UpdateOrderType.UpdateAll || updateOrderType == UpdateOrderType.UpdateName) &&
|
|
(douYinOrderModel.name.Contains("解密失败") || douYinOrderModel.name.Contains("#1##") || douYinOrderModel.name == "******"))
|
|
cipher_infos += "{\"auth_id\":\"" + douYinOrderModel.main_order_id + "\",\"cipher_text\":\"" + name_encrypt + "\"},";
|
|
if ((updateOrderType == UpdateOrderType.UpdateAll || updateOrderType == UpdateOrderType.UpdateMobile) &&
|
|
(douYinOrderModel.mobile.Contains("解密失败") || douYinOrderModel.mobile.Contains("$1$$") || douYinOrderModel.mobile == "******"))
|
|
cipher_infos += "{\"auth_id\":\"" + douYinOrderModel.main_order_id + "\",\"cipher_text\":\"" + mobile_encrypt + "\"},";
|
|
if ((updateOrderType == UpdateOrderType.UpdateAll || updateOrderType == UpdateOrderType.UpdateAddress) &&
|
|
(douYinOrderModel.address.Contains("解密失败") || douYinOrderModel.address.Contains("#1##") || douYinOrderModel.address == "******"))
|
|
cipher_infos += "{\"auth_id\":\"" + douYinOrderModel.main_order_id + "\",\"cipher_text\":\"" + address_encrypt + "\"}";
|
|
cipher_infos = cipher_infos.TrimEnd(',') + "]";
|
|
dic.Add("cipher_infos", cipher_infos);
|
|
string expname = douYinOrderModel.name, expmobile = douYinOrderModel.mobile, expaddress = douYinOrderModel.address;
|
|
if (shop != null)
|
|
{
|
|
DouyinApi apix = new DouyinApi(shop);
|
|
apix.JsonData = dic;
|
|
string htmljm_h = apix.GetOrderBatchDecrypt();
|
|
string codejm = JObject.Parse(htmljm_h)["code"].ToString();
|
|
if (codejm == "10000")
|
|
{
|
|
var jArrJM = JObject.Parse(htmljm_h)["data"]["decrypt_infos"];
|
|
foreach (var itemjm in jArrJM)
|
|
{
|
|
string cipher_text = JObject.Parse(itemjm.ToString())["cipher_text"].ToString();
|
|
if (cipher_text == name_encrypt)
|
|
{
|
|
expname = JObject.Parse(itemjm.ToString())["decrypt_text"].ToString();
|
|
}
|
|
else if (cipher_text == mobile_encrypt)
|
|
{
|
|
expmobile = JObject.Parse(itemjm.ToString())["decrypt_text"].ToString();
|
|
}
|
|
else
|
|
{
|
|
//省
|
|
string province = JObject.Parse(htmljm)["data"]["shop_order_detail"]["post_addr"]["province"]["name"].ToString();
|
|
//市
|
|
string city = JObject.Parse(htmljm)["data"]["shop_order_detail"]["post_addr"]["city"]["name"].ToString();
|
|
//区
|
|
string town = JObject.Parse(htmljm)["data"]["shop_order_detail"]["post_addr"]["town"]["name"].ToString();
|
|
//街道
|
|
string street = JObject.Parse(htmljm)["data"]["shop_order_detail"]["post_addr"]["street"]["name"].ToString();
|
|
expaddress = province + city + town + street + JObject.Parse(itemjm.ToString())["decrypt_text"].ToString();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
douYinOrderModel.name = expname;
|
|
douYinOrderModel.mobile = expmobile;
|
|
douYinOrderModel.address = expaddress;
|
|
#endregion
|
|
sb.Append("&name=" + GetHtml.UrlEncodeUtf8(expname));
|
|
sb.Append("&mobile=" + GetHtml.UrlEncodeUtf8(expmobile));
|
|
sb.Append("&address=" + GetHtml.UrlEncodeUtf8(expaddress));
|
|
}
|
|
douYinOrderModel.remark = JObject.Parse(htmljm)["data"]["shop_order_detail"]["seller_words"].ToString();
|
|
sb.Append("&order_id=" + douYinOrderModel.order_id);
|
|
sb.Append("&is_update_order=0");//1修改状态0不修改状态
|
|
string url = BaseClass.Build29WxObjString("order&act=update");
|
|
string htmjg = GetHtml.PostUtf8(url, UserLogin.GetSignaturex() + sb.ToString());
|
|
douYinOrderModel.remark = JObject.Parse(htmljm)["data"]["shop_order_detail"]["seller_words"].ToString();
|
|
SetOrderEditShowInDgvRows(douYinOrderModel, 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新列订单显示
|
|
/// </summary>
|
|
/// <param name="order"></param>
|
|
/// <param name="type">1 添加 修改 2删除 3更新佣金</param>
|
|
public void SetOrderEditShowInDgvRows(DouYinOrderModel douYinOrderModel, int type)
|
|
{
|
|
Invoke(new Action(() =>
|
|
{
|
|
if (douYinOrderModel != null)
|
|
{
|
|
if (douYinOrderModel.order_status_buy != 1)
|
|
{
|
|
MainForm.instance.chaqi(douYinOrderModel.order_id, 3, douYinOrderModel.shop_id.ToString());
|
|
}
|
|
}
|
|
IEnumerable<DataGridViewRow> enumerableList = this.dgvOrder.Rows.Cast<DataGridViewRow>();
|
|
List<DataGridViewRow> list = (from item in enumerableList where item.Cells["col_order_id"].Value.ToString() == douYinOrderModel.order_id select item).ToList();
|
|
if (type == 1)
|
|
{
|
|
Bitmap skuImg = BuyOrderListForm.GetSkuImage(douYinOrderModel.sku_img);
|
|
TimeSpan ts1;
|
|
if (douYinOrderModel.create_time.Contains("-"))
|
|
{
|
|
ts1 = new TimeSpan(Convert.ToDateTime(douYinOrderModel.create_time).Ticks);
|
|
}
|
|
else
|
|
{
|
|
ts1 = new TimeSpan(Convert.ToDateTime(BaseClass.StampToDateTimex(long.Parse(douYinOrderModel.create_time))).Ticks);
|
|
}
|
|
|
|
TimeSpan ts2 = new TimeSpan(DateTime.Now.AddHours(-48).Ticks);
|
|
TimeSpan ts = ts1.Subtract(ts2).Duration();
|
|
if (list.Count > 0)
|
|
{
|
|
var item = dgvOrder.Rows[list[0].Index];
|
|
item.Cells["col_name"].Value = douYinOrderModel.name;
|
|
item.Cells["col_mobile"].Value = douYinOrderModel.mobile;
|
|
item.Cells["col_address"].Value = douYinOrderModel.address;
|
|
item.Cells["col_remark"].Value = douYinOrderModel.remark;
|
|
}
|
|
else
|
|
{
|
|
dgvOrder.Rows.Add(
|
|
/*"店铺编号"*/douYinOrderModel.shop_id,
|
|
/*"店铺名称"*/douYinOrderModel.shop_name,
|
|
douYinOrderModel.title,
|
|
/*"上家ID"*/string.IsNullOrEmpty(douYinOrderModel.default_up_ids) ? douYinOrderModel.up_product_id : douYinOrderModel.default_up_ids,
|
|
/*"本店ID"*/douYinOrderModel.product_id,
|
|
/*"描述"*/douYinOrderModel.c_biz_desc,
|
|
/*"规格"*/douYinOrderModel.sku,
|
|
/*"图片"*/ skuImg,
|
|
/*"售价"*/ douYinOrderModel.price,
|
|
/*"进价"*/douYinOrderModel.buy_price,
|
|
/*"佣金比例"*/ string.IsNullOrEmpty(douYinOrderModel.commission_scale) ? "0.00" : douYinOrderModel.commission_scale,
|
|
/*"佣金"*/ string.IsNullOrEmpty(douYinOrderModel.commission) ? "0.00" : douYinOrderModel.commission,
|
|
/*"数量"*/douYinOrderModel.count,
|
|
/*"买家订单号"*/douYinOrderModel.order_id,
|
|
/*"买家姓名"*/douYinOrderModel.name,
|
|
/*"买家电话"*/douYinOrderModel.mobile,
|
|
/*"买家地址"*/douYinOrderModel.address,
|
|
/*"订单确认时间"*/douYinOrderModel.create_time,
|
|
/*"延迟发货时间"*/Convert.ToDateTime(douYinOrderModel.create_time).AddHours(48).ToString("yyyy-MM-dd HH:mm:ss"),
|
|
/*"延迟剩余"*/ts.Days.ToString() + "天" + ts.Hours.ToString() + "小时" + ts.Minutes.ToString() + "分钟",
|
|
"开始拍单",
|
|
douYinOrderModel.remark);
|
|
}
|
|
}
|
|
else if (type == 2)
|
|
{
|
|
if (list.Count > 0)
|
|
{
|
|
this.dgvOrder.Rows.RemoveAt(list[0].Index);
|
|
}
|
|
|
|
}
|
|
else if (type == 3)
|
|
{
|
|
if (list.Count > 0)
|
|
{
|
|
var item = list[0];
|
|
item.Cells["commission"].Value = douYinOrderModel.commission;
|
|
item.Cells["commission_scale"].Value = douYinOrderModel.commission_scale;
|
|
}
|
|
}
|
|
}));
|
|
}
|
|
|
|
public void outexcel()
|
|
{
|
|
string idsStr = "";
|
|
foreach (var id in productIdList)
|
|
{
|
|
idsStr += id + "_";
|
|
}
|
|
OutExcel.ExportToExcel(OutExcel.ToDataTable(dgvOrder), idsStr);
|
|
}
|
|
|
|
private void 已完成ToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
Task.Run(() =>
|
|
{
|
|
List<string> orderIds = new List<string>();
|
|
var rows = this.dgvOrder.SelectedCells.Cast<DataGridViewCell>().Select(c => c.OwningRow).Distinct().ToList();
|
|
|
|
foreach (DataGridViewRow dgvrows in rows)
|
|
{
|
|
orderIds.Add(dgvrows.Cells["col_order_id"].Value.ToString());
|
|
}
|
|
|
|
foreach (var buyOrderId in orderIds)
|
|
{
|
|
if (buyOrderId == "0")
|
|
return;
|
|
|
|
this.updateStatus(buyOrderId, 0);
|
|
}
|
|
});
|
|
}
|
|
|
|
void updateStatus(string order_id, int status)
|
|
{
|
|
if (status != 1)
|
|
{
|
|
DouYinOrderModel orderDetail = CollectionClass.orderDataList.Find(x => x.order_id == order_id);
|
|
if (orderDetail != null && string.IsNullOrEmpty(orderDetail.remark))
|
|
{
|
|
MainForm.instance.chaqi(order_id, 3, orderDetail.shop_id.ToString());
|
|
}
|
|
else
|
|
{
|
|
}
|
|
}
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.Append("&order_id=" + order_id);
|
|
sb.Append("&order_status_buy=" + status);
|
|
sb.Append("&is_update_order=1"); // 1修改状态0不修改状态
|
|
string upjmurl = BaseClass.Build29WxObjString("order&act=update");
|
|
string html = GetHtml.PostUtf8(upjmurl, UserLogin.GetSignaturex() + sb.ToString());
|
|
string code = JObject.Parse(html)["code"].ToString();
|
|
|
|
DouYinOrderModel douYinOrderModel = this.lstDouYinOrder.FirstOrDefault(x => x.order_id == order_id);
|
|
if (douYinOrderModel != null)
|
|
{
|
|
if (!CollectionClass.successOrderDataList.Any(d => d.order_id == douYinOrderModel.order_id))
|
|
CollectionClass.successOrderDataList.Add(douYinOrderModel);
|
|
MainForm.instance.successOrderListForm.SetOrderEditShowInDgvRows(douYinOrderModel, 1);
|
|
}
|
|
|
|
Invoke(new Action(() =>
|
|
{
|
|
this.lstDouYinOrder.RemoveAll(x => x.order_id == order_id);
|
|
DataGridViewRow r = dgvOrder.Rows.Cast<DataGridViewRow>().FirstOrDefault(item => item.Cells["col_order_id"].Value.ToString() == order_id);
|
|
if (r != null)
|
|
this.dgvOrder.Rows.Remove(r);
|
|
|
|
CollectionClass.orderDataList.RemoveAll(x => x.order_id == order_id);
|
|
DataGridViewRow r1 = MainForm.instance.buyOrderListForm.DgvOrderList.Rows.Cast<DataGridViewRow>()
|
|
.FirstOrDefault(item => item.Cells["col_order_id"].Value.ToString() == order_id);
|
|
if (r1 != null)
|
|
MainForm.instance.buyOrderListForm.DgvOrderList.Rows.Remove(r);
|
|
}));
|
|
}
|
|
}
|
|
}
|