订单图片不显示问题修复 读单拍单卡死问题修复
This commit is contained in:
1 parent
fb4bafd4d8
commit
4a7af051b2
13 files changed
+295
-120
No files matched your search
@@ -24,7 +24,7 @@ namespace _29WxOrderWpf.Converters
|
||||
//var bitMap = new BitmapImage(new Uri(url));
|
||||
BitmapImage bitMap = null;
|
||||
//bitMap = LoadImageFromUrl(url + "?imageView2/1/w/100/format/webp|imageMogr2/auto-orient=");
|
||||
bitMap = LoadImageFromUrl(url);
|
||||
bitMap = AllBase.ImageBuild.LoadBitmipImageFromUrl(url);
|
||||
return bitMap;
|
||||
//string errStr = "";
|
||||
//var bitmapImg = GetUrlImg(url, out errStr);
|
||||
@@ -43,38 +43,5 @@ namespace _29WxOrderWpf.Converters
|
||||
{
|
||||
throw new NotImplementedException(); // 不需要反向转换,所以不实现。
|
||||
}
|
||||
|
||||
|
||||
public static BitmapImage LoadImageFromUrl(string url)
|
||||
{
|
||||
BitmapImage bitmap = new BitmapImage();
|
||||
|
||||
try
|
||||
{
|
||||
using (WebClient webClient = new WebClient())
|
||||
{
|
||||
// 下载图片数据到内存流
|
||||
using (MemoryStream stream = new MemoryStream(webClient.DownloadData(url)))
|
||||
{
|
||||
stream.Position = 0; // 重置流的位置到开始处
|
||||
bitmap.BeginInit();
|
||||
bitmap.CreateOptions = BitmapCreateOptions.PreservePixelFormat;
|
||||
bitmap.CacheOption = BitmapCacheOption.OnLoad; // 或者使用 BitmapCacheOption.OnLoad 以减少内存使用
|
||||
bitmap.UriSource = null; // 清除可能的旧UriSource,防止缓存问题
|
||||
bitmap.StreamSource = stream;
|
||||
bitmap.EndInit();
|
||||
bitmap.Freeze(); // 防止后续更改,提高性能
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 处理异常,例如打印错误信息或设置一个默认图片等
|
||||
//Console.WriteLine("Error loading image: " + ex.Message);
|
||||
return null;
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,9 +53,9 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
{
|
||||
ChromiumWebBrowser cefWebBrowser = null;
|
||||
public string cefAddress = "";
|
||||
public static ObservableCollectionThreadSafe<PddBuyerOrderLiteInfo> lstPddBuyerOrderInfoLite { get; set; } = new ObservableCollectionThreadSafe<PddBuyerOrderLiteInfo>();
|
||||
public static ObservableCollectionThreadSafe<PddBuyerOrderLiteInfo> lstFilterPddBuyerOrderInfoLite { get; set; } = new ObservableCollectionThreadSafe<PddBuyerOrderLiteInfo>();
|
||||
public static ObservableCollectionThreadSafe<PddBuyerAfterSaleLiteInfo> lstPddBuyerAfterSaleInfoLite { get; set; } = new ObservableCollectionThreadSafe<PddBuyerAfterSaleLiteInfo>();
|
||||
public static ConcurrentList<PddBuyerOrderLiteInfo> lstPddBuyerOrderInfoLite { get; set; } = new ConcurrentList<PddBuyerOrderLiteInfo>();
|
||||
public static ObservableCollection<PddBuyerOrderLiteInfo> lstFilterPddBuyerOrderInfoLite { get; set; } = new ObservableCollection<PddBuyerOrderLiteInfo>();
|
||||
public static ConcurrentList<PddBuyerAfterSaleLiteInfo> lstPddBuyerAfterSaleInfoLite { get; set; } = new ConcurrentList<PddBuyerAfterSaleLiteInfo>();
|
||||
public static ObservableCollectionThreadSafe<PddBuyerAfterSaleLiteInfo> lstFilterPddBuyerAfterSaleInfoLite { get; set; } = new ObservableCollectionThreadSafe<PddBuyerAfterSaleLiteInfo>();
|
||||
public static ConcurrentList<string> lstPddBuyerOrderVoidAfterSaleOrderSn { get; set; } = new ConcurrentList<string>();
|
||||
public CancellationTokenSource cancellationTokenSource { get; set; } = new CancellationTokenSource();
|
||||
@@ -100,7 +100,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
|
||||
void filterBuyerOrder()
|
||||
{
|
||||
lstFilterPddBuyerOrderInfoLite = new ObservableCollectionThreadSafe<PddBuyerOrderLiteInfo>(lstPddBuyerOrderInfoLite.Where(o => filterOneBuyerOrder(o) == false));
|
||||
lstFilterPddBuyerOrderInfoLite = new ObservableCollection<PddBuyerOrderLiteInfo>(lstPddBuyerOrderInfoLite.Where(o => filterOneBuyerOrder(o) == false));
|
||||
if (dgBuyerOrder != null)
|
||||
this.dgBuyerOrder.ItemsSource = lstFilterPddBuyerOrderInfoLite;
|
||||
|
||||
@@ -155,9 +155,12 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
this.chkAutoReadBuyerOrder.IsChecked = buyerReadOrderConfig.IsAutoReadOrder;
|
||||
this.chkAutoAfterSale.IsChecked = buyerReadOrderConfig.IsAutoAfterSale;
|
||||
|
||||
lstPddBuyerOrderInfoLite = NaiBa.Util.Helper.ConfigHelper.LoadConfig<ObservableCollectionThreadSafe<PddBuyerOrderLiteInfo>>("pdd_buyer_order_list");
|
||||
lstPddBuyerOrderInfoLite = NaiBa.Util.Helper.ConfigHelper.LoadConfig<ConcurrentList<PddBuyerOrderLiteInfo>>("pdd_buyer_order_list");
|
||||
if (lstPddBuyerOrderInfoLite == null)
|
||||
lstPddBuyerOrderInfoLite = new ObservableCollectionThreadSafe<PddBuyerOrderLiteInfo>();
|
||||
lstPddBuyerOrderInfoLite = new ConcurrentList<PddBuyerOrderLiteInfo>();
|
||||
|
||||
// 移除所有null值
|
||||
lstPddBuyerOrderInfoLite.RemoveAll(o => o == null);
|
||||
foreach (var item in lstPddBuyerOrderInfoLite.ToList())
|
||||
{
|
||||
if (item.OrderTime < DateTime.Now.AddMonths(-1))
|
||||
@@ -166,11 +169,12 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
item.WxSendTypeStr = "直发";
|
||||
}
|
||||
|
||||
lstPddBuyerAfterSaleInfoLite = NaiBa.Util.Helper.ConfigHelper.LoadConfig<ObservableCollectionThreadSafe<PddBuyerAfterSaleLiteInfo>>("pdd_buyer_after_sale_list");
|
||||
lstPddBuyerAfterSaleInfoLite = NaiBa.Util.Helper.ConfigHelper.LoadConfig<ConcurrentList<PddBuyerAfterSaleLiteInfo>>("pdd_buyer_after_sale_list");
|
||||
if (lstPddBuyerAfterSaleInfoLite == null)
|
||||
lstPddBuyerAfterSaleInfoLite = new ObservableCollectionThreadSafe<PddBuyerAfterSaleLiteInfo>();
|
||||
lstPddBuyerAfterSaleInfoLite = new ConcurrentList<PddBuyerAfterSaleLiteInfo>();
|
||||
|
||||
lstPddBuyerAfterSaleInfoLite = new ObservableCollectionThreadSafe<PddBuyerAfterSaleLiteInfo>(lstPddBuyerAfterSaleInfoLite.Where(af => af != null));
|
||||
// 移除所有null值
|
||||
lstPddBuyerAfterSaleInfoLite.RemoveAll(af => af == null);
|
||||
foreach (var item in lstPddBuyerAfterSaleInfoLite.ToList())
|
||||
{
|
||||
if (item.orderDate < DateTime.Now.AddMonths(-2).ToString("yyMMdd").ParseToInt())
|
||||
@@ -740,6 +744,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
}
|
||||
}
|
||||
|
||||
bool isUpdate = false;
|
||||
PddBuyerOrderLiteInfo order = null;
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
@@ -748,6 +753,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
if (order == null)
|
||||
{
|
||||
order = o;
|
||||
isUpdate = true;
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
lstPddBuyerOrderInfoLite.Add(order);
|
||||
@@ -755,8 +761,10 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
}
|
||||
else
|
||||
{
|
||||
// 现在先注释掉,每次刷新订单都复写数据库,后面跑稳了以后拿掉,有更新才复写数据库
|
||||
//if (JsonHelper.SerializeObject(order) != JsonHelper.SerializeObject(o))
|
||||
|
||||
string orderStr = JsonHelper.SerializeObject(order);
|
||||
string oStr = JsonHelper.SerializeObject(o);
|
||||
if (JsonHelper.SerializeObject(order) != JsonHelper.SerializeObject(o))
|
||||
{
|
||||
if (order.order_sn == "260730-501334709841478")
|
||||
{
|
||||
@@ -860,6 +868,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
{
|
||||
// 待发货直接售后,并通知中转仓接口修改退货状态
|
||||
var afterSaleRst = PddDirectAutoAfterSale(order);
|
||||
isUpdate = true;
|
||||
}
|
||||
}
|
||||
SendOrderE57(order);
|
||||
@@ -873,6 +882,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
{
|
||||
// 待发货直接售后,并通知中转仓接口修改退货状态
|
||||
var afterSaleRst = PddTransitAutoAfterSale(order);
|
||||
isUpdate = true;
|
||||
}
|
||||
}
|
||||
if (order.TransitWarehouseRawMessage.ParseToString().Contains("超出派送范围"))
|
||||
@@ -881,12 +891,13 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
{
|
||||
// 待发货直接售后,并通知中转仓接口修改退货状态
|
||||
var afterSaleRst = PddTransitAutoAfterSale(order);
|
||||
isUpdate = true;
|
||||
}
|
||||
}
|
||||
SendTransitOrderE57(order);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(order.ShopOrderIdStr)/* && order.WxSendTypeStr != "直发"*/)
|
||||
if (isUpdate && !string.IsNullOrEmpty(order.ShopOrderIdStr)/* && order.WxSendTypeStr != "直发"*/)
|
||||
{
|
||||
// 买手订单状态记录到数据库
|
||||
order_pdd_buyer_order pddBuyerOrder = new order_pdd_buyer_order()
|
||||
@@ -1052,7 +1063,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
{
|
||||
afterSale = lstPddBuyerAfterSaleInfoLite.FirstOrDefault(aft => aft.afterSalesId == af.afterSalesId);
|
||||
var afterSaleTmp = JsonHelper.DeserializeJsonToObject<PddBuyerAfterSaleLiteInfo>(JsonHelper.SerializeObject(afterSale));
|
||||
afterSaleTmp.sendStatus = ""; // 比较订单变化,如果有变化,才写库或者处理(设置为空强制变化)
|
||||
//afterSaleTmp.sendStatus = ""; // 比较订单变化,如果有变化,才写库或者处理(设置为空强制变化)
|
||||
afterSaleTmp.AfterSaleStatusOldStr = null; // 设置null,比较订单变化,如果有变化,才写
|
||||
afterSaleTmp.listItemMallVO = new ListItemMallVO(); // 这个值每次获取的时候都会变,设置为新对象,不干扰比较订单变化
|
||||
var afTmp = JsonHelper.DeserializeJsonToObject<PddBuyerAfterSaleLiteInfo>(JsonHelper.SerializeObject(af));
|
||||
@@ -1210,7 +1221,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
}
|
||||
|
||||
// 买手已退款,尝试作废仓库订单
|
||||
if (afterSale.TransitBuyerOrderRefundStatus == "买手退款成功" && afterSale.WxSendTypeStr != "直发")
|
||||
if (isUpdate && afterSale.TransitBuyerOrderRefundStatus == "买手退款成功" && afterSale.WxSendTypeStr != "直发")
|
||||
{
|
||||
// 订单是未退款的仓库单(因一个微信订单,可以作废重拍多次,可能存在多个拼多多买手单,此处要使用买手单号对应的 transitItem 作为是否作废的判断依据
|
||||
if (orderItem != null && orderItem.refund_status <= 1 && transitItem != null && transitItem.order_void_status == 0)
|
||||
@@ -1233,7 +1244,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
}
|
||||
|
||||
// 获取买手退款地址并显示,如果是中转仓,填写退货地址并发送包裹
|
||||
if (!string.IsNullOrEmpty(afterSale?.ShopOrderIdStr))
|
||||
if (isUpdate && !string.IsNullOrEmpty(afterSale?.ShopOrderIdStr))
|
||||
{
|
||||
// 待用户发货 获取地址
|
||||
if(string.IsNullOrWhiteSpace(afterSale.AfterSaleAddress))
|
||||
@@ -1242,7 +1253,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
}
|
||||
|
||||
// 记录到买手退货表
|
||||
if (!string.IsNullOrEmpty(afterSale?.ShopOrderIdStr) /* && afterSale.WxSendTypeStr != "直发"*/)
|
||||
if (isUpdate && !string.IsNullOrEmpty(afterSale?.ShopOrderIdStr) /* && afterSale.WxSendTypeStr != "直发"*/)
|
||||
{
|
||||
// 买手退款单状态记录到数据库
|
||||
order_pdd_buyer_after_sale pddBuyerAfterSale = new order_pdd_buyer_after_sale()
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
//lstOrder.Add(new oms_wei_order_info() { id = 1, IsSelect = false, order_id = ("3737033423685556736".ParseToLong() + Randomx.GetId(0,100)).ParseToString(), shop_name = "媛卡曦工厂优选" });
|
||||
GlobalConfig.lstOrder.Add(new oms_wei_order_info() { id = 1, IsSelect = false, order_id = Randomx.GetId(1000, 10000).ParseToString(), shop_name = "媛卡曦工厂优选" });
|
||||
}
|
||||
GlobalConfig.lstOrder.SortDesc(o => o.order_id.ParseToLong());
|
||||
//GlobalConfig.lstOrder.SortDesc(o => o.order_id.ParseToLong());
|
||||
}
|
||||
|
||||
public void AutoGetOrder()
|
||||
@@ -135,6 +135,11 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
{
|
||||
break;
|
||||
}
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
imgLoading.Visibility = Visibility.Visible;
|
||||
btnSearch.IsEnabled = false;
|
||||
}));
|
||||
|
||||
page++;
|
||||
var url = BaseClass.Build29WxObjString("order/get_erp_order_list");
|
||||
@@ -416,7 +421,9 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
if (string.IsNullOrEmpty(orderIds))
|
||||
GetShopWaybillExceptionOrder();
|
||||
|
||||
hasReadOrder = true;
|
||||
if (string.IsNullOrEmpty(orderIds))
|
||||
hasReadOrder = true;
|
||||
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
imgLoading.Visibility = Visibility.Collapsed;
|
||||
|
||||
@@ -140,9 +140,9 @@
|
||||
<uc:UcWaterMarkTextBox1 WaterMark="进价" Text="{Binding purchase_price_str}" Grid.Column="1" Grid.Row="3" Margin="36,0,4,0" VerticalAlignment="Top"
|
||||
Background="Transparent" IsReadOnly="True" BorderThickness="0" TextWrapping="Wrap" Visibility="{Binding purchase_price_visibility}"/>
|
||||
<TextBox Text="运费:" Grid.Column="1" Grid.Row="4" Margin="0,0,4,0" VerticalAlignment="Top" Background="Transparent" IsReadOnly="True" BorderThickness="0"
|
||||
Visibility="{Binding freight_visibility}"/>
|
||||
Visibility="{Binding FreightVisibility}"/>
|
||||
<uc:UcWaterMarkTextBox1 WaterMark="运费" Text="{Binding freight_str}" Grid.Column="1" Grid.Row="4" Margin="36,0,4,0" VerticalAlignment="Top"
|
||||
Background="Transparent" IsReadOnly="True" BorderThickness="0" TextWrapping="Wrap" Visibility="{Binding freight_visibility}"/>
|
||||
Background="Transparent" IsReadOnly="True" BorderThickness="0" TextWrapping="Wrap" Visibility="{Binding FreightVisibility}"/>
|
||||
<TextBox Text="平台服务费:" Grid.Column="1" Grid.Row="5" Margin="0,0,4,0" VerticalAlignment="Top" Background="Transparent" IsReadOnly="True" BorderThickness="0"/>
|
||||
<uc:UcWaterMarkTextBox1 WaterMark="平台服务费" Text="{Binding predict_commission_fee_str}" Grid.Row="5" Margin="72,0,4,0" VerticalAlignment="Center"
|
||||
Background="Transparent" IsReadOnly="True" BorderThickness="0" TextWrapping="Wrap"/>
|
||||
|
||||
@@ -550,6 +550,9 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
return;
|
||||
}
|
||||
|
||||
//BaseMsgWindow.ShowAnimateMessage("触发成功!" + DateTime.Now.ParseToString(), "Msg", 5);
|
||||
//return;
|
||||
|
||||
// 打开拍单窗口
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
@@ -612,7 +615,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
// 异步加载图片防止卡顿
|
||||
// 缩略图在有的电脑上无法显示
|
||||
//BitmapImage bImg = ImageUrlToBitmapImageConverter.LoadImageFromUrl(order_item.thumb_img + "?imageView2/1/w/100/format/webp|imageMogr2/auto-orient=");
|
||||
BitmapImage bImg = ImageUrlToBitmapImageConverter.LoadImageFromUrl(order_item.thumb_img);
|
||||
BitmapImage bImg = AllBase.ImageBuild.LoadBitmipImageFromUrl(order_item.thumb_img);
|
||||
Thread.Sleep(Randomx.GetId(1000));
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
@@ -1153,6 +1156,9 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
return;
|
||||
}
|
||||
|
||||
//BaseMsgWindow.ShowAnimateMessage("触发成功!" + DateTime.Now.ParseToString(), "Msg", 5);
|
||||
//return;
|
||||
|
||||
// 打开拍单窗口
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace _29WxOrderWpf.Ctrls.ShopCtrls
|
||||
|
||||
private void shopListCtrl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.lbxShop.ItemsSource = GlobalConfig.ShopLoginList;
|
||||
this.lbxShop.ItemsSource = new ObservableCollection<ShopLoginInfo>(GlobalConfig.ShopLoginList);
|
||||
|
||||
Task.Run(() => {
|
||||
while(MainWindow.Instance.hasReadShop == false)
|
||||
@@ -168,7 +168,7 @@ namespace _29WxOrderWpf.Ctrls.ShopCtrls
|
||||
txtShopName.Text = "";
|
||||
cmbNotes.Text = "";
|
||||
cmbGroup.Text = "";
|
||||
this.lbxShop.ItemsSource = GlobalConfig.ShopLoginList;
|
||||
this.lbxShop.ItemsSource = new ObservableCollection<ShopLoginInfo>(GlobalConfig.ShopLoginList);
|
||||
}
|
||||
|
||||
private void btnRefreshShop_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
Reference in new issue
Block a user