优化拍单
This commit is contained in:
1 parent
fe13744a9e
commit
a1e4ff1eea
3 files changed
+139
-4
No files matched your search
@@ -1454,7 +1454,7 @@ namespace TemuKJD.ToolForms
|
||||
// return;
|
||||
//}
|
||||
|
||||
if (BuyType == "transit" && string.IsNullOrEmpty(txtBuyTransitWarehouseStr))
|
||||
if ((BuyType == "transit" || BuyType == "transit_extra") && string.IsNullOrEmpty(txtBuyTransitWarehouseStr))
|
||||
{
|
||||
if (!IsAutoBuy)
|
||||
BaseMsgForm.ShowError("缺少中转地址,请重新绑定商品并选择仓库地址");
|
||||
@@ -1463,7 +1463,7 @@ namespace TemuKJD.ToolForms
|
||||
return;
|
||||
}
|
||||
var transit = TransitWarehouseData.TransitWarehouseList.FirstOrDefault(t => t.TransFullAddress == txtBuyTransitWarehouseStr);
|
||||
if (BuyType == "transit" && transit == null)
|
||||
if ((BuyType == "transit" || BuyType == "transit_extra") && transit == null)
|
||||
{
|
||||
if (!IsAutoBuy)
|
||||
BaseMsgForm.ShowError("中转地址对应的中转仓不存在,请核对");
|
||||
@@ -1547,7 +1547,7 @@ namespace TemuKJD.ToolForms
|
||||
}
|
||||
|
||||
if (updateBalanceAction != null)
|
||||
updateBalanceAction();
|
||||
await updateBalanceAction();
|
||||
|
||||
orderItem.ItemTransitOrders.Insert(0, new oms_wei_external_procurement_log_info()
|
||||
{
|
||||
@@ -1668,6 +1668,127 @@ namespace TemuKJD.ToolForms
|
||||
BaseMsgForm.ShowInfo("拍单信息保存成功");
|
||||
}
|
||||
|
||||
else if (BuyType == "transit_extra")
|
||||
{
|
||||
|
||||
#region 正常中转拍单
|
||||
if (AbnormalTransitWarehouseOrderInfo == null)
|
||||
{
|
||||
JObject body = new JObject();
|
||||
body["orderNo"] = orderItem.order_id; // 微信订单号
|
||||
body["orderSkuId"] = orderItem.sku_id; // 微信商品skuId
|
||||
body["outOrderNo"] = txtBuyOrderId.Text.Trim(); // 拍单订单号
|
||||
body["outAmount"] = (txtBuyPrice.Text.ParseToDecimal() * 100).ParseToInt() + ""; // 外采金额
|
||||
body["buyerAccount"] = buyer.buyer_nick; // 买手昵称
|
||||
body["purchaserNote"] = BaseClass.NickName; // 购买软件账户备注
|
||||
body["express1Company"] = ""; // 物流公司编号
|
||||
body["express1Waybill"] = ""; // 物流编号
|
||||
body["platform"] = transit.TransId; // 中转仓ID
|
||||
body["orderPlatformCode"] = "WEISHOP";
|
||||
body["randomCode"] = txtSourceCode.Text.Trim();
|
||||
if (GlobalConfig.BuyConfig.IsUseAppBalance)
|
||||
{
|
||||
body["userName"] = BaseClass.UserName; // 软件端用户名
|
||||
body["purchaserNote"] = BaseClass.UserName + "-" + BaseClass.NickName; // 购买软件账户备注
|
||||
|
||||
string basePostageKey = WarehousePostageInfo.DicWarehousePostage.Keys.FirstOrDefault(pk => (orderItem.ItemOrder?.province_name).ParseToString().Contains(pk));
|
||||
decimal basePostage = basePostageKey.IsNullOrEmpty() ? WarehousePostageInfo.DicWarehousePostage.Values.Min() : WarehousePostageInfo.DicWarehousePostage[basePostageKey];
|
||||
|
||||
body["parentOemId"] = BaseClass.ParentOemId;
|
||||
body["parentOemAmount"] = (BaseClass.ParentPostageOemAmount * 100).ParseToInt().ParseToString();
|
||||
body["oemId"] = BaseClass.OemId;
|
||||
body["oemAmount"] = (BaseClass.PostageOemAmount * 100).ParseToInt().ParseToString();
|
||||
body["postage"] = ((basePostage + BaseClass.ParentPostageOemAmount + BaseClass.PostageOemAmount) * 100).ParseToInt().ParseToString();
|
||||
}
|
||||
var url = "https://po.e57.cn/prod-api/api/oms-api/externalProcurement/saveOrUpdate";
|
||||
var dataStr = JsonHelper.SerializeObject(body);
|
||||
var exportRst = await HttpResponseWXBLL.e57PostResponseAsync(url, dataStr);
|
||||
if (!exportRst.ParseToString().Contains("\"code\":200"))
|
||||
{
|
||||
await Task.Delay(500);
|
||||
exportRst = await HttpResponseWXBLL.e57PostResponseAsync(url, dataStr);
|
||||
}
|
||||
if (!exportRst.ParseToString().Contains("\"code\":200"))
|
||||
{
|
||||
string msg = "";
|
||||
msg = BaseRegex.GetStringJsonByRegs(ref exportRst, exportRst, "msg");
|
||||
|
||||
if (!IsAutoBuy)
|
||||
BaseMsgForm.ShowError("拍单保存失败,服务端返回 " + msg, "拍单信息保存失败");
|
||||
else if (this.Created)
|
||||
Invoke(() => { lblErrMsg.Text = "拍单保存失败,服务端返回 " + msg; });
|
||||
btnManualUpdateBuyOrder.Enabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (updateBalanceAction != null)
|
||||
await updateBalanceAction();
|
||||
|
||||
orderItem.ItemTransitOrders.Insert(0, new oms_wei_external_procurement_log_info()
|
||||
{
|
||||
buyer_account = buyer.buyer_nick,
|
||||
id = 0,
|
||||
order_void_status = 0,
|
||||
platform = transit.TransId,
|
||||
order_no = orderItem.order_id,
|
||||
order_sku_id = orderItem.sku_id,
|
||||
out_amount = (txtBuyPrice.Text.ParseToDecimal() * 100).ParseToInt(),
|
||||
out_order_no = txtBuyOrderId.Text.Trim(),
|
||||
order_code = txtBuyOrderId.Text.Trim(),
|
||||
purchaser_note = body["purchaserNote"].ParseToString(),
|
||||
created_time = DateTime.Now,
|
||||
});
|
||||
orderItem.SetOrderItemTextProperty();
|
||||
// 利润计算重置为最小值,控件Resource更新时将计算利润
|
||||
orderItem.ProfitCount = decimal.MinValue;
|
||||
var order = orderItem?.ItemOrder;
|
||||
orderItem.SetOrderItemTextProperty();
|
||||
order.SetOrderTextProperty();
|
||||
if (filterOrderAction != null && order != null)
|
||||
{
|
||||
await filterOrderAction(order, true);
|
||||
}
|
||||
|
||||
//// 前一天的订单直接提前取号
|
||||
//if (DateTime.Now.Date > BaseClass.StampToDateTime(order.create_time).Date)
|
||||
//{
|
||||
// JObject data = new JObject();
|
||||
// data["outOrderNo"] = txtBuyOrderId.Text.Trim();
|
||||
// //data2["outOrderNo"] = orderItem.ItemTransitOrder.order_code;
|
||||
// data["warehouseCode"] = transit.TransId; // 中转仓仓库对应编码 XDYSZC XDYYWC ...
|
||||
// //data["warehouseCode"] = txtBuyOrderId.Text.Trim(); // 中转仓仓库对应编码
|
||||
// data["platform"] = "WEISHOP";
|
||||
// var getVirtualTicketUrl = "https://po.e57.cn/prod-api/api/oms-api/external_procurement/order/virtual/create";
|
||||
// var getVirtualTicketDataStr = JsonHelper.SerializeObject(data);
|
||||
|
||||
// var getVirtualTicketRst = HttpResponseWXBLL.e57PostResponse(getVirtualTicketUrl, getVirtualTicketDataStr, "");
|
||||
// if (!getVirtualTicketRst.ParseToString().Contains("<code>200</code>") && !getVirtualTicketRst.ParseToString().Contains("<code>0</code>"))
|
||||
// {
|
||||
// string msg = "";
|
||||
// string code = "";
|
||||
// try
|
||||
// {
|
||||
// System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
|
||||
// xmlDoc.LoadXml(getVirtualTicketRst);
|
||||
// code = xmlDoc["AjaxResult"]["code"].InnerText;
|
||||
// msg = xmlDoc["AjaxResult"]["msg"].InnerText;
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// msg = getVirtualTicketRst.ParseToString();
|
||||
// }
|
||||
// if (!IsAutoBuy)
|
||||
// BaseMsgForm.ShowError("拍单信息保存成功,接收到服务端传递的错误消息:" + msg, "订单提前取号失败");
|
||||
// else if (this.Created)
|
||||
// Invoke(() => { lblErrMsg.Text = "拍单信息保存成功,接收到服务端传递的错误消息:" + msg; });
|
||||
// btnManualUpdateBuyOrder.Enabled = true;
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
if (BuyType == "direct")
|
||||
{
|
||||
#region 直发拍单
|
||||
|
||||
Reference in new issue
Block a user