同步物流单功能

This commit is contained in:
wule committed 2026-09-24 10:29:44 +08:00
1 parent 78ef8eedf3
commit ce8fb3f311
21 files changed
+952 -198

No files matched your search

@@ -260,17 +260,15 @@
Unchecked="chkAutoReadBuyerOrder_CheckedChanged" />
<CheckBox
x:Name="chkHideGreenFlag"
Grid.Column="12"
x:Name="chkSyncDirectOrderWaybill"
Margin="2,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
d:IsChecked="True"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkHideGreenFlag_Click"
Content="隐藏标记订单"
Content="同步物流单"
FontSize="12"
IsChecked="{Binding orderFilterConfig.chkHideGreenFlagIsChecked}" />
Click="chkSyncDirectOrderWaybill_Click"
IsChecked="False" />
</WrapPanel>
<wpf:SpacingStackPanel Grid.Column="13" HorizontalSpacing="5">
@@ -303,6 +301,26 @@
Grid.Row="1"
Margin="8,0,0,2">
<WrapPanel x:Name="wpFilter" VerticalAlignment="Top">
<CheckBox
x:Name="chkHideGreenFlag"
Grid.Column="12"
Margin="2,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
d:IsChecked="True"
BorderBrush="{StaticResource mainColorBrush}"
Click="chkHideGreenFlag_Click"
Content="隐藏标记订单"
FontSize="12"
IsChecked="{Binding orderFilterConfig.chkHideGreenFlagIsChecked}" />
<Polyline
Grid.Column="5"
Width="10"
Margin="2,0"
VerticalAlignment="Center"
Points="5,0 5,4 5,0"
Stroke="{StaticResource mainColorBrush}"
StrokeThickness="2" />
<CheckBox
x:Name="chkOnlyWarehouseOrder"
Margin="0,2,3,2"
@@ -329,14 +347,7 @@
FontSize="12"
IsChecked="{Binding orderFilterConfig.chkNoMultiOrderIsChecked}"
Unchecked="chkSubFilterSonditions_Checked" />
<Polyline
Grid.Column="5"
Width="10"
Margin="2,0"
VerticalAlignment="Center"
Points="5,0 5,4 5,0"
Stroke="{StaticResource mainColorBrush}"
StrokeThickness="2" />
<CheckBox
x:Name="chkTransitOrder"
Margin="0,2,3,2"
@@ -104,6 +104,8 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
orderFilterConfig.lstFilterRemarkText = new ConcurrentList<string>();
orderFilterConfig.txtFilterShopNameText = "";
chkSyncDirectOrderWaybill.IsChecked = GlobalConfig.BuyConfig.IsSyncDirectBuyOrderWaybill;
dateStart.SelectedDate = DateTime.Now.Date.AddDays(-7);
dateEnd.SelectedDate = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
@@ -304,6 +306,10 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 读取暂时记录的买手售后单,后面想办法放到中转订单库里去
var pddBuyerAfterSales = GetPddBuyerAfterSales(order_ids);
// 同步单
var buyerIds = string.Join(",", pddBuyerOrders.Select(o => o.order_sn));
var syncLogistics = GetSyncLogistics(buyerIds);
// 读取关联拍单商品
var buyMapList = GetBuyProdMap(orderItems);
@@ -371,6 +377,13 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 装载订单售后详情
order.refundItems = new ObservableCollection<oms_wei_refund_info>(refunds.Where(of => of.order_id == order.order_id));
// 装载同步单
order.SyncLogisticsList = [.. syncLogistics.Where(os => order.orderItems.Any(oi => oi.DirectPddBuyerOrders.Any(od => od.order_sn == os.order_id))),];
if (order.SyncLogisticsList.Count > 0)
{
}
if (order.order_id.Contains("3738794693820307200"))
{
@@ -698,6 +711,34 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
return new List<order_pdd_buyer_after_sale>();
}
public static List<yh_sync_logistics> GetSyncLogistics(string buyer_order_ids)
{
var url6 = BaseClass.Build29WxObjString("order/wx_get_sync_waybill");
var data6 = UserLogin.GetSignaturex();
data6 += "&order_id=" + buyer_order_ids;
List<yh_sync_logistics> pddBuyerAfterSales = new List<yh_sync_logistics>();
if (!string.IsNullOrEmpty(buyer_order_ids))
{
var html6 = GetHtml.PostUtf8(url6, data6);
if (string.IsNullOrEmpty(html6) || !html6.Contains("\"code\":200"))
html6 = GetHtml.PostUtf8(url6, data6);
if (string.IsNullOrEmpty(html6) || !html6.Contains("\"code\":200"))
{
BaseMsgWindow.ShowAnimateMessage("订单读取失败(买手售后) " + BaseRegex.GetStringJson(ref html6, "msg"), "Error", 6);
return new List<yh_sync_logistics>();
}
try
{
pddBuyerAfterSales = JsonHelper.DeserializeJsonToList<yh_sync_logistics>(JObject.Parse(html6)["data"].ParseToString()).OrderByDescending(p => p.id).ToList();
return pddBuyerAfterSales;
}
catch
{
}
}
return new List<yh_sync_logistics>();
}
public static List<oms_wei_ewaybill_path> GetEWaybillPath(string order_ids)
{
List<oms_wei_ewaybill_path> oms_wei_ewaybill_path_list = null;
@@ -965,7 +1006,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
}
if (orderItem.TransitRefundStatusStr.ParseToString().Contains("需手动申请售后") &&
orderItem.ItemTransitOrderWithVoid?.has_reject == 3 && orderItem.ItemTransitOrderWithVoid?.platform != "XDYYWC") // 义乌仓不支持拒收,等于3也是失败
orderItem.ItemTransitOrderWithVoid?.has_reject == 3 /*&& orderItem.ItemTransitOrderWithVoid?.platform != "XDYYWC"*/) // 义乌仓不支持拒收,等于3也是失败
{
// 拒收后24小时才去总店填拒收退货
if (orderItem.ItemTransitOrderWithVoid?.rejected_time > DateTime.Now.AddHours(-24))
@@ -988,7 +1029,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
}
/// <summary>
/// 中转仓拦截去总店填写退货物流信息
/// 中转仓拦截去总店填写退货物流信息(申请拦截退回总店以后回填退货物流)
/// </summary>
public void AutoUpdateTransitPackageToPddShop()
{
@@ -1004,21 +1045,12 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// orderItem.ItemTransitOrderAfterSale = new oms_wei_external_procurement_after_sale_info()
// {
// downstream_waybill = "315090716621027",
// };
//}
if (orderItem.order_id == "3738534855500515072")
{
}
// 260801-439070256640980260801-439070256640980
// 260801-439070256640980 260801-439070256640980
// string url = "https://mobile.yangkeduo.com/complaint.html?mode=128&after_sales_id=22059412840967&order_sn=260801-439070256640980"
if (orderItem.TransitRefundStatusStr.Contains("待用户发货") && !(orderItem.ItemTransitOrderAfterSale?.downstream_waybill).IsNullOrEmpty())
{
if (orderItem.order_id == "3738382691615546112")
{
}
string orderSn = orderItem.ItemTransitOrderWithVoid.out_order_no;
if (orderSn.IsNullOrEmpty())
continue;
@@ -2178,7 +2210,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
}
/// <summary>
/// 中转仓拦截退货包裹申请买手退货退款并获取总店地址,暂时不使用此功能防止需交涉或者可拦截的订单被自动申请退货退款
/// 中转仓拦截退货包裹申请买手退货退款并获取总店地址,暂时不使用此功能防止需交涉或者可拒收的订单被自动申请退货退款
/// </summary>
/// <returns></returns>
public async Task DoReturnPackageBuyerRefendSlient()
@@ -2921,6 +2953,21 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
{
FilterOrders();
}
private void chkSyncDirectOrderWaybill_Click(object sender, RoutedEventArgs e)
{
if (chkSyncDirectOrderWaybill.IsChecked == true)
{
if (BaseMsgWindow.ShowConfirm("外部单号无法直填,电子面单同步上家物流信息发货。").DialogResult != true)
{
chkSyncDirectOrderWaybill.IsChecked = false;
return;
}
}
GlobalConfig.BuyConfig.IsSyncDirectBuyOrderWaybill = chkSyncDirectOrderWaybill.IsChecked.ParseToBool();
StartUp.SaveBuyConfig();
}
}
public class OrderFilterConfig : PropertyNotifyObject
@@ -973,6 +973,62 @@
Style="{StaticResource LinkButton}" />
</WrapPanel>
</wpf:TitleContent>
<wpf:TitleContent Title="同步物流:" Visibility="{Binding ItemOrder.SyncWaybillId, Converter={StaticResource HasTextVisibility}}">
<WrapPanel Orientation="Horizontal">
<!--<uc:UcWaterMarkTextBox1
Margin="-2,2"
Padding="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Foreground="{Binding ItemOrder.OutExpressNoBrush}"
IsReadOnly="True"
Text="{Binding ItemOrder.out_express_company}"
TextWrapping="Wrap"
WaterMark="外采物流" />-->
<!--<uc:UcWaterMarkTextBox1
Margin="-2,2"
Padding="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Foreground="{Binding ItemOrder.OutExpressNoBrush}"
IsReadOnly="True"
Text="-"
TextWrapping="Wrap"
WaterMark="-" />-->
<uc:UcWaterMarkTextBox1
Margin="-2,2,4,2"
Padding="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding ItemOrder.SyncWaybillId}"
TextWrapping="Wrap"
WaterMark="同步物流" />
<uc:UcWaterMarkTextBox1
Margin="-2,2,4,2"
Padding="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding ItemOrder.SyncWaybillPickNo}"
TextWrapping="Wrap"
WaterMark="取件码" />
<!--<Button
x:Name="btnGetSyncWaybillDetail"
Margin="4,0,0,0"
Padding="0,0,0,0"
d:Content="查看"
Click="btnGetSyncWaybillDetail_Click"
Content="{Binding LatestDirectEWaybill.StatusStr}"
Style="{StaticResource LinkButton}" />-->
</WrapPanel>
</wpf:TitleContent>
<!-- 买家退货 -->
<wpf:TitleContent Title="买家退货:" Visibility="{Binding ReturnWaybillIdStr, Converter={StaticResource HasTextVisibility}}">
@@ -1111,7 +1167,7 @@
x:Name="btnPddRefundTransitWarehouseRejectOrder"
d:Visibility="Visible"
Click="btnPddRefundTransitWarehouseRejectOrder_Click"
Content="测试退货"
Content="测试拒收"
Style="{StaticResource LinkButton}"
Visibility="Collapsed" />
</WrapPanel>
@@ -1141,6 +1197,8 @@
x:Name="txtInterceptReturnInfoStr"
Margin="0,1,0,1"
VerticalAlignment="Top"
d:Text="拦截失败原因"
d:Visibility="Visible"
Background="Transparent"
BorderThickness="1"
IsReadOnly="True"
@@ -1242,34 +1300,45 @@
</wpf:SpacingStackPanel>
<!-- 操作 -->
<wpf:SpacingStackPanel
Grid.Column="8"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Vertical"
HorizontalSpacing="1"
ItemHorizontalAlignment="Right"
ItemVerticalAlignment="Center"
Orientation="Horizontal"
VerticalSpacing="6">
<wpf:TitleContent>
<Button
x:Name="btnMapSkus"
Height="22"
MinWidth="38"
Margin="4,0,0,0"
HorizontalAlignment="Center"
Click="btnMapSkus_Click"
Content="选择SKU"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding MapSkusBtnVisibility}" />
</wpf:TitleContent>
<!-- 操作按钮行(原 Row 1) -->
<wpf:TitleContent>
<WrapPanel HorizontalAlignment="Center" Orientation="Vertical">
<wpf:SpacingStackPanel
Grid.Column="8"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Vertical"
VerticalSpacing="6">
<wpf:TitleContent>
<Button
x:Name="btnMapSkus"
Height="22"
MinWidth="38"
Margin="0,0,0,0"
HorizontalAlignment="Center"
Click="btnMapSkus_Click"
Content="选择SKU"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding MapSkusBtnVisibility}" />
</wpf:TitleContent>
<wpf:TitleContent>
<Button
x:Name="btnBuyOrder"
Height="22"
MinWidth="38"
Margin="4,0,0,0"
Margin="0,0,0,0"
HorizontalAlignment="Center"
d:Background="{StaticResource pageColorLightBrush}"
d:BorderBrush="{StaticResource pageColorBrush}"
@@ -1285,73 +1354,125 @@
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding ItemOrder.IsWaitBuy, Converter={StaticResource visibleToVisibilityConverter}}" />
</wpf:TitleContent>
<wpf:TitleContent>
<Button
x:Name="btnVoidTransitOrder"
Height="22"
MinWidth="38"
Margin="4,0,0,0"
Margin="0,0,0,0"
HorizontalAlignment="Center"
d:Visibility="Visible"
Click="btnVoidTransitOrder_Click"
Content="作废重拍"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="Collapsed" />
</wpf:TitleContent>
<wpf:TitleContent>
<Button
x:Name="btnAbnormalOrderRebuy"
Height="22"
MinWidth="38"
Margin="4,0,0,0"
Margin="0,0,0,0"
HorizontalAlignment="Center"
d:Visibility="Visible"
Click="btnAbnormalOrderRebuy_Click"
Content="异常重拍"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="Collapsed" />
</WrapPanel>
</wpf:TitleContent>
</wpf:TitleContent>
<!-- 直发拍单 -->
<wpf:TitleContent>
<Button
x:Name="btnDirectBuyOrder"
Height="22"
MinWidth="38"
Margin="4,0,0,0"
HorizontalAlignment="Center"
Click="btnDirectBuyOrder_Click"
Content="直发拍单"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding BtnDirectBuyOrderVisibility}" />
</wpf:TitleContent>
<!-- 礼品发货 -->
<wpf:TitleContent>
<Button
x:Name="btnShipGift"
Height="22"
MinWidth="38"
Margin="4,0,0,0"
HorizontalAlignment="Center"
d:Visibility="Visible"
Click="btn_ShipGiftCommand"
Content="礼品发货"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding ItemOrder.IsWaitSend, Converter={StaticResource VisibleToVisibilityConverter}}" />
</wpf:TitleContent>
<wpf:TitleContent>
<!-- 直发拍单 -->
<wpf:TitleContent>
<Button
x:Name="btnDirectBuyOrder"
Height="22"
MinWidth="38"
Margin="0,0,0,0"
HorizontalAlignment="Center"
Click="btnDirectBuyOrder_Click"
Content="直发拍单"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding BtnDirectBuyOrderVisibility}" />
</wpf:TitleContent>
<!-- 礼品发货 -->
<wpf:TitleContent>
<Button
x:Name="btnShipGift"
Height="22"
MinWidth="38"
Margin="0,0,0,0"
HorizontalAlignment="Center"
d:Visibility="Visible"
Click="btn_ShipGiftCommand"
Content="礼品发货"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding ItemOrder.IsWaitSend, Converter={StaticResource VisibleToVisibilityConverter}}" />
</wpf:TitleContent>
</wpf:SpacingStackPanel>
<wpf:SpacingStackPanel
Grid.Column="8"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Vertical"
VerticalSpacing="4">
<Button
x:Name="btnChangeWaybill"
Height="22"
MinWidth="38"
Margin="4,0,0,0"
Margin="0,0,0,0"
HorizontalAlignment="Center"
d:Visibility="Visible"
Click="btnChangeWaybill_Click"
Content="修改物流"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding ItemOrder.IsShowChangeWaybillBtn, Converter={StaticResource VisibleToVisibilityConverter}}" />
</wpf:TitleContent>
<Button
x:Name="btnAddEditTransitWarehouseReject_New"
MinWidth="38"
MinHeight="22"
Margin="0,0,0,0"
Padding="0"
HorizontalAlignment="Center"
d:Visibility="Visible"
Click="btnAddEditTransitWarehouseReject_Click"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding RejectOrReturnPackageBtnVisibility}">
<TextBlock>
云仓拒收<LineBreak />
退回总店</TextBlock>
</Button>
<Button
x:Name="btnAddEditTransitWarehouseAfterSale_n1"
MinWidth="38"
MinHeight="22"
Margin="0,0,0,0"
Padding="0"
Click="btnAddEditTransitWarehouseAfterSale_Click"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding RejectOrReturnPackageBtnVisibility}">
<TextBlock>
拒收失败<LineBreak />
转寄总店</TextBlock>
</Button>
<Button
x:Name="btnAddEditTransitWarehouseAfterSale_n2"
MinWidth="38"
MinHeight="22"
Margin="0,0,0,0"
Padding="0"
Click="btnAddEditTransitWarehouseAfterSale_Click"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding RejectOrReturnPackageBtnVisibility}">
<TextBlock>
出库拦截<LineBreak />
退回仓库</TextBlock>
</Button>
</wpf:SpacingStackPanel>
</wpf:SpacingStackPanel>
</Grid>
</Grid>
@@ -361,7 +361,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
return;
}
await Task.Run(() =>
await Task.Run(async () =>
{
// 拍单前查询订单是否退款
var orderId = orderItem.order_id;
@@ -502,53 +502,50 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// Api检测是否加入代发
if (orderItem.BuyGoodsBtnTxt == "云仓拍单" && !isAbnormalOrder)
{
var apiSearchDropship = new WxApiBLL().WxApiDropshipSearch(orderItem.Shop, orderItem.order_id, 100);
if (!apiSearchDropship.Contains("\"errcode\":0"))
string supplierId = "", supplierName="";
try
{
BaseMsgWindow.ShowError("查询代发失败!" + BaseRegex.GetStringJson(ref apiSearchDropship, "msg"));
return;
}
if (apiSearchDropship.Contains("\"ds_order_id_list\":[]"))
{
var apiAddDropship = new WxApiBLL().WxApiDropshipAssign(orderItem.Shop, orderItem.order_id, orderItem.product_id, orderItem.sku_id, orderItem.sku_cnt.ParseToInt());
if (!apiAddDropship.Contains("\"errcode\":0"))
var apiSearchDropship = new WxApiBLL().WxApiDropshipSearch(orderItem.Shop, orderItem.order_id, 100);
if (!apiSearchDropship.Contains("\"errcode\":0"))
throw new Exception("查询代发失败!" + BaseRegex.GetStringJson(ref apiSearchDropship, "msg"));
var dsOrderId = JsonHelper.JObjectParse(apiSearchDropship)["ds_order_id_list"].FirstOrDefault().ParseToString();
if (!string.IsNullOrEmpty(dsOrderId))
{
BaseMsgWindow.ShowError("设置代发失败!请确商品已加入29供货商代发!" + BaseRegex.GetStringJson(ref apiAddDropship, "msg"));
return;
var apiSearchDropshipDetail = new WxApiBLL().WxApiDropshipSearchDetail(orderItem.Shop, dsOrderId);
if (!apiSearchDropshipDetail.Contains("\"errcode\":0"))
throw new Exception("查询代发失败!" + BaseRegex.GetStringJson(ref apiSearchDropshipDetail, "msg"));
supplierId = BaseRegex.GetStringJson(ref apiSearchDropshipDetail, "supplier_appid");
supplierName = BaseRegex.GetStringJson(ref apiSearchDropshipDetail, "supplier_name");
if (!string.IsNullOrEmpty(supplierId) && !supplierId.Contains("wxfc630d60a1af6c6f") && !supplierName.Contains("29供货商"))
{
var apiCancelDropship = await new WxApiBLL().WxApiDropshipCancel(orderItem.Shop, orderItem.ItemOrder, dsOrderId);
if (!apiCancelDropship.Contains("\"errcode\":0"))
throw new Exception("取消其他代发失败!请确认商品未加入其他代发!" + BaseRegex.GetStringJsonByRegs(ref apiCancelDropship, apiCancelDropship, "errmsg"));
dsOrderId = "";
supplierId = "";
supplierName = "";
}
}
if (!supplierId.Contains("wxfc630d60a1af6c6f") && !supplierName.Contains("29供货商"))
{
// 设置29供货商代发
var apiAddDropship = new WxApiBLL().WxApiDropshipAssign(orderItem.Shop, orderItem.order_id, orderItem.product_id, orderItem.sku_id, orderItem.sku_cnt.ParseToInt());
if (!apiAddDropship.Contains("\"errcode\":0"))
{
throw new Exception("设置代发失败!请确商品已加入29供货商代发!" + BaseRegex.GetStringJson(ref apiAddDropship, "msg"));
}
}
}
}
catch(Exception ex)
{
BaseMsgWindow.ShowError(ex.Message);
return;
}
// 模拟检测是否加入代发
//if (orderItem.Shop?.LoginStatus == "登录成功" && orderItem.BuyGoodsBtnTxt == "云仓拍单" && !isAbnormalOrder)
//{
// var is29SupplierRst = WxOrderSupplierBLL.GetWxSupplierOrderList(orderItem.Shop, orderItem.order_id);
// if (!is29SupplierRst.Contains("\"code\":0"))
// is29SupplierRst = WxOrderSupplierBLL.GetWxSupplierOrderList(orderItem.Shop, orderItem.order_id);
// if (!is29SupplierRst.Contains("\"code\":0"))
// {
// ShopBLL.CheckShopLogin(orderItem.Shop);
// if (orderItem.Shop?.LoginStatus != "登录成功")
// {
// Dispatcher.Invoke(new Action(() =>
// {
// BaseMsgWindow.ShowAnimateMessage("店铺掉线", "Error", 5);
// btnBuyOrder.Cursor = Cursors.Hand;
// }));
// return;
// }
// }
// if (!is29SupplierRst.Contains("\"supplierName\":\"29供货商\"")) // "supplierName":"29供货商"
// {
// Dispatcher.Invoke(new Action(() =>
// {
// BaseMsgWindow.ShowError("店铺后台未查询到该代发单,请确认店铺在线且商品加入代发");
// btnBuyOrder.Cursor = Cursors.Hand;
// }));
// return;
// }
// orderItem.Shop.Is29Supplier = true;
//}
}
// 掉线提示重登
if (orderItem.Shop?.LoginStatus != "登录成功")
@@ -1032,28 +1029,42 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
private void btnAddEditTransitWarehouseReject_Click(object sender, RoutedEventArgs e)
{
if (sender == btnAddEditTransitWarehouseReject)
return;
string msg = $@"
        云仓拒收退回总店
说  明:店铺产生售后,拒收成功,货物会原物流退回总店。
拒收条件:(总店物流没到云仓/未签收前)。顺丰/京东无法
     拒收,直接总店申请仅退款让总店拦截。
收  费:免费";
if (BaseMsgWindow.ShowConfirm(msg, "云仓拒收退回总店", null, MsgWindowLevel.LARGE, 300).DialogResult != true)
return;
if (this.DataContext is oms_wei_order_item_info orderItem)
{
orderItem.ItemTransitOrders = OrderListCtrl.GetTransitWarehouseList(orderItem.order_id);
orderItem.PddBuyerOrders = OrderListCtrl.GetPddBuyerOrders(orderItem.order_id).Where(o => o.wx_send_type == 0).ToList();
OrderListCtrl.InitOrderItemObservableProp(orderItem);
if (orderItem.ItemTransitOrder?.warehouse_status == 3)
{
BaseMsgWindow.ShowError("商品已拒收或拦截!");
return;
}
if (orderItem.ItemTransitOrder?.warehouse_status == 2)
{
BaseMsgWindow.ShowError("商品已出库,请选择退回中转仓!");
return;
}
if (string.IsNullOrEmpty(orderItem.PddBuyerOrder?.order_sn))
{
BaseMsgWindow.ShowError("商品未出单,请直接去拼多多买手申请退款");
return;
}
//if (orderItem.ItemTransitOrder?.warehouse_status == 3)
//{
// BaseMsgWindow.ShowError("商品已拒收或拦截!");
// return;
//}
//if (orderItem.ItemTransitOrder?.warehouse_status == 2)
//{
// BaseMsgWindow.ShowError("商品已出库,请选择退回中转仓!");
// return;
//}
//if (string.IsNullOrEmpty(orderItem.PddBuyerOrder?.order_sn))
//{
// BaseMsgWindow.ShowError("商品未出单,请直接去拼多多买手申请退款");
// return;
//}
if (orderItem.ItemTransitOrder?.has_reject == 1 || orderItem.ItemTransitOrder?.has_reject == 3)
{
BaseMsgWindow.ShowAnimateMessage("已申请拒收", "Msg", 3);
@@ -1093,13 +1104,61 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
}
private void btnAddEditTransitWarehouseAfterSale_Click(object sender, RoutedEventArgs e)
{
//if (this.DataContext is oms_wei_order_item_info orderItem)
//{
// if (BaseMsgWindow.ShowConfirm("拦截退回总店将产生费用,是否继续?").DialogResult != true)
// {
// return;
// }
// if (orderItem.ItemTransitOrder?.warehouse_status != 3 && orderItem.ItemTransitOrder?.warehouse_status != 2 && orderItem.ItemTransitOrder?.warehouse_status != 1 && orderItem.AddEditTransitWarehouseAfterSaleStr == "添加")
// {
// if (BaseMsgWindow.ShowConfirm("商品未到仓,建议选择中转仓拒收!是否仍然尝试拦截退回总店?").DialogResult != true)
// return;
// }
// TransitAfterSaleWindow transitAfterSaleWindow = new TransitAfterSaleWindow(orderItem);
// transitAfterSaleWindow.ShowDialog();
//}
if (this.DataContext is oms_wei_order_item_info orderItem)
{
if (orderItem.ItemTransitOrder?.warehouse_status != 3 && orderItem.ItemTransitOrder?.warehouse_status != 2 && orderItem.ItemTransitOrder?.warehouse_status != 1 && orderItem.AddEditTransitWarehouseAfterSaleStr == "添加")
{
BaseMsgWindow.ShowError("商品未出库,请选择中转仓拒收!");
// 不是中转仓,直接返回
if (sender == btnAddEditTransitWarehouseAfterSale)
return;
string warehouse_status = "";
if (orderItem.ItemTransitOrder?.warehouse_status == 3 || orderItem.ItemTransitOrder?.warehouse_status == 1)
warehouse_status = "已到仓";
if (orderItem.ItemTransitOrder?.warehouse_status == 2)
warehouse_status = "已出仓";
else
warehouse_status = "未到仓";
if (sender == btnAddEditTransitWarehouseAfterSale_n1)
{
string msg = $@"
      拒收失败转寄总店({warehouse_status})
说  明:店铺产生售后,拒收失败(物流信息签收3天
     内无退回记录),货物需转寄退回总店。
收  费:(与退货仓退货价格一样)";
if (BaseMsgWindow.ShowConfirm(msg, "拒收失败转寄总店", null, MsgWindowLevel.LARGE, 300).DialogResult != true)
return;
}
else
{
string msg = $@"
      出库拦截退回仓库({warehouse_status})
说  明:拦截成功后货物返回云仓,云仓转寄到总店。
拦截条件:(云仓出库物流在运输过程)派送/入柜/拦截
     几率很低,签收需联系用户拒收。
收  费:(与退货仓退货价格一样)";
if (BaseMsgWindow.ShowConfirm(msg, "出库拦截退回仓库", null, MsgWindowLevel.LARGE, 300).DialogResult != true)
return;
}
TransitAfterSaleWindow transitAfterSaleWindow = new TransitAfterSaleWindow(orderItem);
transitAfterSaleWindow.ShowDialog();
}
@@ -1222,24 +1281,83 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
if (CheckIsRefund(orderItem))
return;
// 查询订单是否在代发货中,如果代发需要取消代发
var apiSearchDropship = new WxApiBLL().WxApiDropshipSearch(orderItem.Shop, orderItem.order_id, 100);
if (!apiSearchDropship.Contains("\"errcode\":0"))
if (GlobalConfig.BuyConfig.IsSyncDirectBuyOrderWaybill == true)
{
BaseMsgWindow.ShowError("代发查询失败," + BaseRegex.GetStringJsonByRegs(ref apiSearchDropship, apiSearchDropship, "errmsg"));
return;
}
if (apiSearchDropship.Contains("ds_order_id_list") && !apiSearchDropship.Contains("\"ds_order_id_list\":[]"))
{
var dsOrderId = JsonHelper.JObjectParse(apiSearchDropship)["ds_order_id_list"].FirstOrDefault().ParseToString();
var apiCancelDropship = await new WxApiBLL().WxApiDropshipCancel(orderItem.Shop, orderItem.ItemOrder, dsOrderId);
// 设置同步物流单代发
//var rst = new WxApiBLL().GetShopSupplier(orderItem.Shop);
//if (!rst.Contains("wx7809625286c28f2f") && !rst.Contains("百川日用"))
//{
// rst = new WxApiBLL().SetShopSupplier(orderItem.Shop, "wx7809625286c28f2f", "4431685489938137094");
// if (!rst.Contains("\"errcode\":0"))
// {
// BaseMsgWindow.ShowAnimateMessage("绑定同步单发货失败", "Error", 5);
// return;
// }
//}
if (!apiCancelDropship.Contains("\"errcode\":0"))
string supplierId = "", supplierName = "";
try
{
BaseMsgWindow.ShowError("取消代发失败!请确商品未加入代发!" + BaseRegex.GetStringJsonByRegs(ref apiSearchDropship, apiSearchDropship, "errmsg"));
// 查询直拍单是否绑定了同步单代发(放到同步单发货前处理)
var apiSearchDropship = new WxApiBLL().WxApiDropshipSearch(orderItem.Shop, orderItem.order_id, 100);
if (!apiSearchDropship.Contains("\"errcode\":0"))
throw new Exception("查询代发失败!" + BaseRegex.GetStringJson(ref apiSearchDropship, "msg"));
var dsOrderId = JsonHelper.JObjectParse(apiSearchDropship)["ds_order_id_list"].FirstOrDefault().ParseToString();
if (!string.IsNullOrEmpty(dsOrderId))
{
var apiSearchDropshipDetail = new WxApiBLL().WxApiDropshipSearchDetail(orderItem.Shop, dsOrderId);
if (!apiSearchDropshipDetail.Contains("\"errcode\":0"))
throw new Exception("查询代发失详情败!" + BaseRegex.GetStringJson(ref apiSearchDropshipDetail, "msg"));
supplierId = BaseRegex.GetStringJson(ref apiSearchDropshipDetail, "supplier_appid");
supplierName = BaseRegex.GetStringJson(ref apiSearchDropshipDetail, "supplier_name");
if (!string.IsNullOrEmpty(supplierId) && !supplierId.Contains("wx7809625286c28f2f") && !supplierName.Contains("百川日用"))
{
var apiCancelDropship = await new WxApiBLL().WxApiDropshipCancel(orderItem.Shop, orderItem.ItemOrder, dsOrderId);
if (!apiCancelDropship.Contains("\"errcode\":0"))
throw new Exception("取消其他代发失败!请确认商品未加入其他代发!" + BaseRegex.GetStringJsonByRegs(ref apiCancelDropship, apiCancelDropship, "errmsg"));
dsOrderId = "";
supplierId = "";
supplierName = "";
}
}
if (!supplierId.Contains("wx7809625286c28f2f") && !supplierName.Contains("百川日用"))
{
// 设置同步单供货商代发
var apiAddDropship = new WxApiBLL().WxApiDropshipAssign(orderItem.Shop, orderItem.order_id, orderItem.product_id, orderItem.sku_id, orderItem.sku_cnt.ParseToInt(), "wx7809625286c28f2f");
if (!apiAddDropship.Contains("\"errcode\":0"))
throw new Exception("设置同步单代发失败!请确商品已加入同步单代发!" + BaseRegex.GetStringJson(ref apiAddDropship, "msg"));
}
}
catch (Exception ex)
{
BaseMsgWindow.ShowError(ex.Message);
return;
}
}
else
{
// 查询订单是否在代发货中,如果代发需要取消代发
var apiSearchDropship = new WxApiBLL().WxApiDropshipSearch(orderItem.Shop, orderItem.order_id, 100);
if (!apiSearchDropship.Contains("\"errcode\":0"))
{
BaseMsgWindow.ShowError("代发查询失败," + BaseRegex.GetStringJsonByRegs(ref apiSearchDropship, apiSearchDropship, "errmsg"));
return;
}
if (apiSearchDropship.Contains("ds_order_id_list") && !apiSearchDropship.Contains("\"ds_order_id_list\":[]"))
{
var dsOrderId = JsonHelper.JObjectParse(apiSearchDropship)["ds_order_id_list"].FirstOrDefault().ParseToString();
var apiCancelDropship = await new WxApiBLL().WxApiDropshipCancel(orderItem.Shop, orderItem.ItemOrder, dsOrderId);
if (!apiCancelDropship.Contains("\"errcode\":0"))
{
BaseMsgWindow.ShowError("取消代发失败!请确认商品未加入代发!" + BaseRegex.GetStringJsonByRegs(ref apiSearchDropship, apiSearchDropship, "errmsg"));
return;
}
}
}
// 检测买手号是否掉线
@@ -1625,6 +1743,11 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
{
}
private void btnGetSyncWaybillDetail_Click(object sender, RoutedEventArgs e)
{
}
}
}