优化取件码逻辑
This commit is contained in:
1 parent
259b8027d3
commit
2f1de60845
3 files changed
+129
-22
No files matched your search
@@ -95,6 +95,15 @@
|
||||
Click="btnSearch_Click"
|
||||
Content="刷新订单"
|
||||
Style="{StaticResource BasePageButtonStyle}" />
|
||||
<Button
|
||||
x:Name="btnNextBuyer"
|
||||
Grid.Column="8"
|
||||
Padding="4,0"
|
||||
Height="24"
|
||||
Margin="4,0,0,0"
|
||||
Click="btnNextBuyer_Click"
|
||||
Content="下一个买手"
|
||||
Style="{StaticResource BasePageButtonStyle}" />
|
||||
</WrapPanel>
|
||||
|
||||
<TextBox
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
/// 是否已初始化已读的买手单
|
||||
/// </summary>
|
||||
bool isInitBuyerOrder = false;
|
||||
bool isSkipNext = false;
|
||||
/// <summary>
|
||||
/// 是否已初始化已读的售后单
|
||||
/// </summary>
|
||||
@@ -318,6 +319,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
if (buyer != null)
|
||||
{
|
||||
dicPddPickInfo[buyer] = JsonHelper.DeserializeJsonToObject<PddPickInfo>(noPickupPackageData);
|
||||
SetPickUpNo(dicPddPickInfo[buyer]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -932,10 +934,10 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
SendTransitOrderE57(order);
|
||||
}
|
||||
|
||||
if (order.order_sn == "260923-399088033421688")
|
||||
if (order.order_sn == "260924-431226960203223")
|
||||
{
|
||||
}
|
||||
if (order.ShopOrderIdStr == "3739399763136525568")
|
||||
if (order.ShopOrderIdStr == "3739392779260688128")
|
||||
{
|
||||
}
|
||||
if (order.WxSendTypeStr == "直发")
|
||||
@@ -996,14 +998,19 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
}
|
||||
}
|
||||
|
||||
if (order.order_sn == "260924-431226960203223")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// 填写取件码
|
||||
if (order.WxSendTypeStr == "直发")
|
||||
{
|
||||
if (GlobalConfig.BuyConfig.IsSyncDirectBuyOrderWaybill && !string.IsNullOrEmpty(order.tracking_number))
|
||||
{
|
||||
if (lstSyncLogistics.Any(o => o.order_id == order.order_sn))
|
||||
if (lstSyncLogistics.Any(o => o.order_id == order.order_sn && o.upload_pickup_status == 0))
|
||||
SetPickUpNo(order);
|
||||
if (lstSyncLogistics.Any(o => o.order_id == order.order_sn && (o.upload_pickup_status == 0 || o.pickup_code.IsNullOrEmpty())))
|
||||
SetPickUpNo(order);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1442,7 +1449,20 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
|
||||
foreach (var buyer in GlobalConfig.PDDBuyerLoginList)
|
||||
{
|
||||
if (tokenSource.IsCancellationRequested)
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
Panel.SetZIndex(buyer.wpf_browser, maxZIndex++);
|
||||
if (buyer.IsSelect != true)
|
||||
{
|
||||
foreach (var b in GlobalConfig.PDDBuyerLoginList)
|
||||
{
|
||||
b.IsSelect = false;
|
||||
}
|
||||
buyer.IsSelect = true;
|
||||
}
|
||||
}));
|
||||
|
||||
if (tokenSource.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
PddMobileLoginViewModel.CheckBuyerLogin(new List<BuyerLoginInfo>() { buyer });
|
||||
@@ -1522,6 +1542,9 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
lastCefReadOrderTime = DateTime.Now;
|
||||
while (currentReadBuyer == readBuyer)
|
||||
{
|
||||
if (isSkipNext)
|
||||
break;
|
||||
|
||||
if (tokenSource.IsCancellationRequested)
|
||||
{
|
||||
BindBuyer(buyer, "已取消读取");
|
||||
@@ -1598,6 +1621,9 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
lastCefReadOrderTime = DateTime.Now;
|
||||
while (currentReadBuyer == readBuyer)
|
||||
{
|
||||
if (isSkipNext)
|
||||
break;
|
||||
|
||||
if (tokenSource.IsCancellationRequested)
|
||||
{
|
||||
BindBuyer(buyer, "已取消读取");
|
||||
@@ -1645,8 +1671,13 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
var result = client.Runtime.EvaluateAsync(jsStr, null, true, null, null, true, null, true);
|
||||
result.Wait(5000);
|
||||
}
|
||||
}
|
||||
if (tokenSource.IsCancellationRequested)
|
||||
}
|
||||
if (isSkipNext)
|
||||
{
|
||||
isSkipNext = false;
|
||||
continue;
|
||||
}
|
||||
if (tokenSource.IsCancellationRequested)
|
||||
{
|
||||
BindBuyer(buyer, "已取消读取");
|
||||
break;
|
||||
@@ -1679,8 +1710,11 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
top = 0;
|
||||
lastCefReadOrderTime = DateTime.Now;
|
||||
while (currentReadBuyer == readBuyer)
|
||||
{
|
||||
if (tokenSource.IsCancellationRequested)
|
||||
{
|
||||
if (isSkipNext)
|
||||
break;
|
||||
|
||||
if (tokenSource.IsCancellationRequested)
|
||||
{
|
||||
BindBuyer(buyer, "已取消读取");
|
||||
break;
|
||||
@@ -1719,17 +1753,32 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
var result = client.Runtime.EvaluateAsync(jsStr, null, true, null, null, true, null, true);
|
||||
result.Wait(5000);
|
||||
}
|
||||
}
|
||||
//Invoke(new Action(() =>
|
||||
//{
|
||||
// if (row.Cells["colMessage"].Value.ParseToString().StartsWith("正在读取"))
|
||||
// BindBuyer(buyer, " ");
|
||||
//}));
|
||||
}
|
||||
}
|
||||
if (isSkipNext)
|
||||
{
|
||||
isSkipNext = false;
|
||||
continue;
|
||||
}
|
||||
if (tokenSource.IsCancellationRequested)
|
||||
{
|
||||
BindBuyer(buyer, "已取消读取");
|
||||
break;
|
||||
}
|
||||
//Invoke(new Action(() =>
|
||||
//{
|
||||
// if (row.Cells["colMessage"].Value.ParseToString().StartsWith("正在读取"))
|
||||
// BindBuyer(buyer, " ");
|
||||
//}));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
Thread.Sleep(Randomx.GetId(6000, 8000));
|
||||
{
|
||||
if (isSkipNext)
|
||||
{
|
||||
isSkipNext = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Thread.Sleep(Randomx.GetId(6000, 8000));
|
||||
}
|
||||
isReadBuyerOrder = false;
|
||||
|
||||
@@ -2087,11 +2136,53 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPickUpNo(PddPickInfo pddPickInfo)
|
||||
{
|
||||
List<combine_track_info> orderSnTracks = new List<combine_track_info>();
|
||||
foreach (var combine in pddPickInfo.combine_list)
|
||||
{
|
||||
foreach (var combine_track in combine.combine_track_list)
|
||||
{
|
||||
if (!orderSnTracks.Any(o => o.order_sn == combine_track.order_sn))
|
||||
orderSnTracks.Add(combine_track);
|
||||
}
|
||||
}
|
||||
|
||||
if (orderSnTracks.Count == 0)
|
||||
return;
|
||||
|
||||
//var syncOrderAllList = OrderListCtrl.GetSyncLogistics(string.Join(",", orderSnTracks.Select(o => o.order_sn)));
|
||||
var syncOrderList = OrderListCtrl.GetSyncLogistics(string.Join(",", orderSnTracks.Select(o => o.order_sn)), 1);
|
||||
foreach (var sOrder in syncOrderList)
|
||||
{
|
||||
var orderSnTrack = orderSnTracks.FirstOrDefault(o => o.order_sn == sOrder.order_id);
|
||||
if (orderSnTrack != null)
|
||||
{
|
||||
var pickupCode = orderSnTrack.pick_code.Replace("取件码", "").Replace("取件出示快递单号后五位", "").Trim();
|
||||
if (!string.IsNullOrWhiteSpace(pickupCode))
|
||||
{
|
||||
var url4 = BaseClass.Build29WxObjString("vlc/UploadPickup");
|
||||
var data4 = UserLogin.GetSignPostData(new
|
||||
{
|
||||
orderId = orderSnTrack.order_sn,
|
||||
pickupCode = pickupCode,
|
||||
});
|
||||
var html4 = GetHtml.PostJson(url4, data4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPickUpNo(PddBuyerOrderLiteInfo order)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (lstSyncLogistics.Any(o => o.order_id == order.order_sn && o.upload_pickup_status > 0))
|
||||
var syncOrder = lstSyncLogistics.FirstOrDefault(o => o.order_id == order.order_sn);
|
||||
if (syncOrder == null)
|
||||
return;
|
||||
|
||||
|
||||
if (lstSyncLogistics.Any(o => o.order_id == order.order_sn && (o.upload_pickup_status > 0 && o.pickup_code.IsNullOrEmpty())))
|
||||
return;
|
||||
|
||||
var pickupCode = ""; // "21-22-2110";
|
||||
@@ -2108,7 +2199,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
{
|
||||
if (combine_track.order_sn == order.order_sn)
|
||||
{
|
||||
pickupCode = combine_track.pick_code.Replace("取件码", "").Trim();
|
||||
pickupCode = combine_track.pick_code.Replace("取件码", "").Replace("取件出示快递单号后五位", "").Trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2759,6 +2850,11 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void btnNextBuyer_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
isSkipNext = true;
|
||||
}
|
||||
}
|
||||
|
||||
public class YkdBuyerOrder
|
||||
|
||||
@@ -742,11 +742,13 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
return new List<order_pdd_buyer_after_sale>();
|
||||
}
|
||||
|
||||
public static List<yh_sync_logistics> GetSyncLogistics(string buyer_order_ids)
|
||||
public static List<yh_sync_logistics> GetSyncLogistics(string buyer_order_ids, int? not_upload_pickup_status = null)
|
||||
{
|
||||
var url6 = BaseClass.Build29WxObjString("order/wx_get_sync_waybill");
|
||||
var data6 = UserLogin.GetSignaturex();
|
||||
data6 += "&order_id=" + buyer_order_ids;
|
||||
if (not_upload_pickup_status != null)
|
||||
data6 += "¬_upload_pickup_status=" + not_upload_pickup_status;
|
||||
List<yh_sync_logistics> pddBuyerAfterSales = new List<yh_sync_logistics>();
|
||||
if (!string.IsNullOrEmpty(buyer_order_ids))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user