订单列表增加 同步订单

This commit is contained in:
chfei committed 2026-08-19 15:35:42 +08:00
1 parent 4f606c3561
commit cef6300e8e
24 files changed
+2674 -1211

No files matched your search

+19 -24
View File
@@ -11,6 +11,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Xml;
using Work._29Tools.BLL;
using Work.ERP.API.Orders;
namespace _29WxOrderWpf.Services;
@@ -25,6 +26,11 @@ public class ShipGiftService
_155 = 2,
_160 = 5
}
private ShipGiftServiceApi _api;
public ShipGiftService()
{
_api = new ShipGiftServiceApi();
}
public async Task<bool> Send(string orderId, GiftType giftType)
{
var item = GlobalConfig.lstFilterOrder.FirstOrDefault(a => a.order_id == orderId);
@@ -58,30 +64,19 @@ public class ShipGiftService
amount += 12.15m;
}
string data = JsonConvert.SerializeObject(new
{
platformCode = "WEISHOP",
orderIds = new List<string> { orderId },
userId = BaseClass.UserId,
userName = BaseClass.UserName,
giftOrderType = (int)giftType,
amount = (int)(amount * 100),
oemAmount = (int)(BaseClass.OemGiftAmount * 100)
});
Debug.WriteLine($"礼品单:{data}");
string ret = await HttpResponseWXBLL.e57PostResponseAsync("https://po.e57.cn//prod-api/api/oms-api/gift/order/deliveryFor29Erp", data, "");
XmlDocument doc = new XmlDocument();
doc.LoadXml(ret);
//string data = JsonConvert.SerializeObject(new
//{
// platformCode = "WEISHOP",
// orderIds = new List<string> { orderId },
// userId = BaseClass.UserId,
// userName = BaseClass.UserName,
// giftOrderType = (int)giftType,
// amount = (int)(amount * 100),
// oemAmount = (int)(BaseClass.OemGiftAmount * 100)
//});
var ret = await _api.SendShipGift([orderId], (int)giftType, amount, BaseClass.OemGiftAmount);
return ret;
//使用 Newtonsoft.Json 进行转换
string jsonText = JsonConvert.SerializeXmlNode(doc);
JObject jsonObject = JObject.Parse(jsonText);
int code = jsonObject["AjaxResult"]?["code"]?.Value<int>() ?? 0;
string msg = jsonObject["AjaxResult"]?["msg"]?.Value<string>() ?? "";
if (code == 200 && msg.ToUpper() == "SUCCESS")
{
return true;
}
return false;
}
}