淘宝买手拍单 订单补发包裹。

This commit is contained in:
wule committed 2026-10-05 18:23:15 +08:00
1 parent d18460c83f
commit c11dda0341
13 files changed
+753 -188

No files matched your search

@@ -95,7 +95,8 @@
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}" />
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopGoodsNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="店铺规格:"
@@ -106,7 +107,8 @@
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}" />
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopSpecNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="店铺商品ID:"
@@ -117,7 +119,8 @@
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}" />
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopGoodsIdVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="店铺SKUID:"
@@ -128,7 +131,8 @@
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}" />
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopSkuIdVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="平台商品编码:"
@@ -139,7 +143,8 @@
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}" />
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtSpuCodeVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="平台SKU编码:"
@@ -150,7 +155,8 @@
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}" />
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtSkuCodeVal}" />
</wpf:TitleContent>
<Grid>
<Grid.ColumnDefinitions>
@@ -170,7 +176,8 @@
FontSize="15"
FontWeight="bold"
Foreground="Red"
Style="{StaticResource BaseRoundCornerTextBoxStyle}" />
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopOrderItemCntVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="  总价:"
@@ -185,138 +192,171 @@
FontSize="15"
FontWeight="bold"
Foreground="Red"
Style="{StaticResource BaseRoundCornerTextBoxStyle}" />
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtShopOrderItemPriceVal}" />
</wpf:TitleContent>
</Grid>
<TextBlock
Margin="0,4,0,0"
FontSize="14"
FontWeight="Bold">
买手拍单信息:
</TextBlock>
<wpf:TitleContent
Title="商品标题:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyGoodsName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyGoodsNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="规格名称:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuySkuName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuySkuNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="拍单商品ID:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyGoodsId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyGoodsIdVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="拍单SKUID:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuySkuId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuySkuIdVal}" />
</wpf:TitleContent>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.04*" />
<ColumnDefinition Width="0.96*" />
</Grid.ColumnDefinitions>
<wpf:SpacingStackPanel
Grid.Row="0"
Margin="0"
Orientation="Vertical"
VerticalSpacing="4"
Visibility="{Binding BuyInfoVisivility}">
<TextBlock
Margin="0,4,0,0"
FontSize="14"
FontWeight="Bold">
买手拍单信息:
</TextBlock>
<wpf:TitleContent
Title="拍单数量:"
Grid.Column="0"
Title="商品标题:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyCnt"
Height="22"
x:Name="txtBuyGoodsName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
FontSize="15"
FontWeight="bold"
Foreground="Red"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyCntVal}" />
Text="{Binding txtBuyGoodsNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="拍单总价:"
Grid.Column="1"
Margin="10,0,0,0"
TitleHorizontalAlignment="Right">
Title="规格名称:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyPrice"
Height="22"
x:Name="txtBuySkuName"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
FontSize="15"
FontWeight="bold"
Foreground="Red"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyPriceVal}" />
Text="{Binding txtBuySkuNameVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="拍单商品ID:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyGoodsId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyGoodsIdVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="拍单SKUID:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuySkuId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuySkuIdVal}" />
</wpf:TitleContent>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.04*" />
<ColumnDefinition Width="0.96*" />
</Grid.ColumnDefinitions>
<wpf:TitleContent
Title="拍单数量:"
Grid.Column="0"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyCnt"
Height="22"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
FontSize="15"
FontWeight="bold"
Foreground="Red"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyCntVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="拍单总价:"
Grid.Column="1"
Margin="10,0,0,0"
TitleHorizontalAlignment="Right">
<TextBox
x:Name="txtBuyPrice"
Height="22"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
FontSize="15"
FontWeight="bold"
Foreground="Red"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyPriceVal}" />
</wpf:TitleContent>
</Grid>
<wpf:TitleContent
Title="拍单订单号:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyOrderId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyOrderIdVal}" />
</wpf:TitleContent>
</Grid>
<wpf:TitleContent
Title="拍单订单号:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyOrderId"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyOrderIdVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="溯源码:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtSourceCode"
Height="20"
Background="#DDDDDD"
BorderBrush="#999999"
IsEnabled="False"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtSourceCodeVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="溯源码:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtSourceCode"
Height="20"
Background="#DDDDDD"
BorderBrush="#999999"
IsEnabled="False"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtSourceCodeVal}" />
</wpf:TitleContent>
<wpf:TitleContent
Title="拍单订单号:"
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<TextBox
x:Name="txtBuyTransitWarehouse"
Height="20"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"
Text="{Binding txtBuyTransitWarehouseVal}" />
</wpf:TitleContent>
<Grid>
<Button
x:Name="btnReMap"
Grid.Column="1"
Height="20"
MinWidth="48"
Margin="0"
Padding="4,0"
HorizontalAlignment="Left"
Command="{Binding ReMapCommand}"
Content="重新关联商品"
FontSize="12"
Style="{StaticResource BaseButtonLightStyle}" />
</Grid>
</wpf:SpacingStackPanel>
</wpf:SpacingStackPanel>
<wpf:SpacingStackPanel
Grid.Row="2"
Margin="4"
Orientation="Vertical"
VerticalSpacing="4">
VerticalSpacing="4"
Visibility="{Binding MapInfoVisivility}">
<TextBlock
Margin="0,4,0,0"
FontSize="14"
@@ -407,11 +447,31 @@
x:Name="cmbTransitWarehouse"
Height="22"
SelectedIndex="0"
SelectedValue="{Binding cmbTransitWarehouseVal}"
SelectionChanged="cmbTransitWarehouse_SelectionChanged"
Style="{StaticResource RoundedComboBox}">
<ComboBoxItem Content="仓库地址" />
<!--<ComboBoxItem Content="仓库地址" />-->
</ComboBox>
</wpf:TitleContent>
<wpf:TitleContent
Title=""
TitleHorizontalAlignment="Right"
TitleWidth="{Binding ElementName=tcShopGoodsName, Path=TitleWidth}">
<Button
x:Name="btnManualUpdateTransitWarehouse"
Grid.Column="1"
Height="20"
MinWidth="48"
Margin="0"
Padding="4,0"
HorizontalAlignment="Right"
Command="{Binding UpdateTransitWarehouseCommand}"
Content="确认商品关联"
FontSize="12"
Style="{StaticResource BasePageButtonStyle}" />
</wpf:TitleContent>
</wpf:SpacingStackPanel>
</Grid>
</Grid>
@@ -31,6 +31,11 @@ public partial class TaobaoBuyOrderCtrl : UserControl
{
InitializeComponent();
foreach (var warehouse in TransitWarehouseData.TransitWarehouseList)
{
this.cmbTransitWarehouse.Items.Add(warehouse.TransName + " " + warehouse.TransDetailAddress);
}
ViewModel = new TaobaoBuyOrderViewModel(buyerInfo, orderItemInfo);
ViewModel.BrowserCreated += ViewModel_BrowserCreated;
ViewModel.RequestClose += ViewModel_RequestClose;
@@ -1,3 +1,4 @@
using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.CefHelper;
using _29WxOrderWpf.Commands;
using _29WxOrderWpf.ViewModels;
@@ -14,6 +15,7 @@ using Newtonsoft.Json.Linq;
using Org.BouncyCastle.Asn1.Ocsp;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Security.Policy;
using System.Text;
@@ -25,6 +27,7 @@ using TemuKJD.ToolForms;
using Work;
using Work._29Tools.BLL;
using Work._29Tools.CefTools;
using Work.BaseForms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
using static WPFCommon.Interop.InteropValues;
@@ -56,11 +59,38 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
private oms_wei_order_item_info orderItem = null;
WXBuyMapSkusInfo buymapSkuInfo = null;
WXBuyMapInfo buyMapInfo = null;
pddFrontGoods3Lite pddFrontGoodsLite = null;
/// <summary>
/// 直发direct 中转transit
/// </summary>
public string BuyType { get; set; } = "transit";
public TransitWarehouseParam transitWarehouse { get; set; }
/// <summary>
/// 异常重拍的原中转仓订单信息
/// </summary>
public oms_wei_external_procurement_log_info AbnormalTransitWarehouseOrderInfo { get; set; } = null;
private string currentUrl = "";
private volatile bool _isWindowLoaded = false;
#region 界面绑定属性
public bool Enabled
{
get { return this.GetValue(x => x.Enabled); }
set { this.SetValue(x => x.Enabled, value); }
}
public Visibility BuyInfoVisivility
{
get { return this.GetValue(x => x.BuyInfoVisivility); }
set { this.SetValue(x => x.BuyInfoVisivility, value); }
}
public Visibility MapInfoVisivility
{
get { return this.GetValue(x => x.MapInfoVisivility); }
set { this.SetValue(x => x.MapInfoVisivility, value); }
}
/// <summary>用户名</summary>
public string UserName
{
@@ -82,6 +112,48 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
set { this.SetValue(x => x.Address, value); }
}
public string txtShopGoodsNameVal
{
get { return this.GetValue(x => x.txtShopGoodsNameVal); }
set { this.SetValue(x => x.txtShopGoodsNameVal, value); }
}
public string txtShopSpecNameVal
{
get { return this.GetValue(x => x.txtShopSpecNameVal); }
set { this.SetValue(x => x.txtShopSpecNameVal, value); }
}
public string txtShopGoodsIdVal
{
get { return this.GetValue(x => x.txtShopGoodsIdVal); }
set { this.SetValue(x => x.txtShopGoodsIdVal, value); }
}
public string txtShopSkuIdVal
{
get { return this.GetValue(x => x.txtShopSkuIdVal); }
set { this.SetValue(x => x.txtShopSkuIdVal, value); }
}
public string txtSpuCodeVal
{
get { return this.GetValue(x => x.txtSpuCodeVal); }
set { this.SetValue(x => x.txtSpuCodeVal, value); }
}
public string txtSkuCodeVal
{
get { return this.GetValue(x => x.txtSkuCodeVal); }
set { this.SetValue(x => x.txtSkuCodeVal, value); }
}
public string txtShopOrderItemCntVal
{
get { return this.GetValue(x => x.txtShopOrderItemCntVal); }
set { this.SetValue(x => x.txtShopOrderItemCntVal, value); }
}
public string txtShopOrderItemPriceVal
{
get { return this.GetValue(x => x.txtShopOrderItemPriceVal); }
set { this.SetValue(x => x.txtShopOrderItemPriceVal, value); }
}
/// <summary>拍单商品Id</summary>
public string txtBuyGoodsIdVal
{
@@ -118,6 +190,24 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
get { return this.GetValue(x => x.txtBuyPriceVal); }
set { this.SetValue(x => x.txtBuyPriceVal, value); }
}
public string txtBuyOrderIdVal
{
get { return this.GetValue(x => x.txtBuyOrderIdVal); }
set { this.SetValue(x => x.txtBuyOrderIdVal, value); }
}
public string txtSourceCodeVal
{
get { return this.GetValue(x => x.txtSourceCodeVal); }
set { this.SetValue(x => x.txtSourceCodeVal, value); }
}
/// <summary>
/// 中专仓地址
/// </summary>
public string txtBuyTransitWarehouseVal
{
get { return this.GetValue(x => x.txtBuyTransitWarehouseVal); }
set { this.SetValue(x => x.txtBuyTransitWarehouseVal, value); }
}
/// <summary>关联商品名称</summary>
public string txtMapGoodsNameVal
@@ -164,6 +254,8 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
public ICommand CopyUserNameCommand { get; }
public ICommand CopyPasswordCommand { get; }
public ICommand UpdateTransitWarehouseCommand { get; }
#endregion
public TaobaoBuyOrderViewModel(BuyerLoginInfo buyerInfo, oms_wei_order_item_info orderItemInfo)
@@ -180,6 +272,28 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
StopCommand = new DelegateCommand(StopButton);
CopyUserNameCommand = new DelegateCommand(CopyUserName);
CopyPasswordCommand = new DelegateCommand(CopyPassword);
UpdateTransitWarehouseCommand = new DelegateCommand(UpdateTransitWarehouse);
this.txtShopSkuIdVal = orderItem.sku_id;
this.txtShopGoodsIdVal = orderItem.product_id;
this.txtSpuCodeVal = orderItem.out_product_id.IsNullOrEmpty() ? orderItem.product_id : orderItem.out_product_id;
this.txtSkuCodeVal = orderItem.out_sku_id.IsNullOrEmpty() ? orderItem.sku_attr_str : orderItem.out_sku_id;
this.txtShopGoodsNameVal = orderItem.title;
this.txtShopSpecNameVal = orderItem.sku_attr_str;
this.txtShopOrderItemCntVal = orderItem.sku_cnt.ParseToString();
this.txtShopOrderItemPriceVal = (orderItem.real_price * 0.01m + orderItem.ItemOrder?.postage_price * 0.01m / orderItem.ItemOrder?.orderItems?.Count).ParseToString();
this.buyMapInfo = orderItem.TbBuyMap;
if (buyMapInfo != null)
{
BuyInfoVisivility = Visibility.Visible;
MapInfoVisivility = Visibility.Collapsed;
}
else
{
BuyInfoVisivility = Visibility.Collapsed;
MapInfoVisivility = Visibility.Visible;
}
}
/// <summary>
@@ -191,7 +305,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
if (CloseAfterSecond > 0)
{
Task.Run(() =>
_ = Task.Run(() =>
{
Thread.Sleep(1000 * CloseAfterSecond);
if (_isWindowLoaded)
@@ -204,7 +318,50 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
}
});
}
await AutoLogin();
if (buyMapInfo != null)
{
this.txtMapGoodsNameVal = buyMapInfo.map_goods_name;
this.txtMapSkuNameVal = buyMapInfo.map_spec_name;
this.txtMapGoodsIdVal = buyMapInfo.map_goods_id;
this.txtMapSkuIdVal = buyMapInfo.map_sku_id;
this.txtSendProvinceVal = buyMapInfo.map_send_address;
this.transitWarehouse = TransitWarehouseData.TransitWarehouseList.FirstOrDefault(t => t.TransId == buyMapInfo.transit_warehouse_id);
// 异常单重新拍单
if (AbnormalTransitWarehouseOrderInfo != null)
{
transitWarehouse = TransitWarehouseData.TransitWarehouseList.FirstOrDefault(t => t.TransId == AbnormalTransitWarehouseOrderInfo.platform);
}
if (transitWarehouse != null && this.BuyType == "transit")
{
cmbTransitWarehouseVal = transitWarehouse?.TransName + " " + transitWarehouse?.TransDetailAddress;
txtBuyTransitWarehouseVal = transitWarehouse?.TransDetailAddress;
}
else
{
txtBuyTransitWarehouseVal = orderItem.ItemOrder.AddressStr;
}
}
var transit = TransitWarehouseData.TransitWarehouseList.FirstOrDefault(t => t.TransDetailAddress == txtBuyTransitWarehouseVal);
if (AbnormalTransitWarehouseOrderInfo != null)
{
txtSourceCodeVal = AbnormalTransitWarehouseOrderInfo.random_code;
}
else if (buyMapInfo != null && transit != null)
{
var sourceCodeRst = GetSourceCode(transit);
if (sourceCodeRst.Contains("失败"))
{
CefWebBrowser.Visibility = Visibility.Collapsed;
BaseMsgWindow.ShowError(sourceCodeRst);
return;
}
}
await AutoSearchGoods();
}
/// <summary>
@@ -218,7 +375,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
/// <summary>
/// 自动登录店铺后台
/// </summary>
private async Task AutoLogin()
private async Task AutoSearchGoods()
{
if (buyer == null)
return;
@@ -490,7 +647,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
this.buymapSkuInfo = new WXBuyMapSkusInfo()
{
source_platform = "tb",
platform = "tb",
map_goods_id = BaseRegex.GetStringJson(ref loaderData, "itemId"),
map_goods_name = BaseRegex.GetStringJson(ref goodsItemStr, "title"),
map_url = "929536442189",
@@ -534,8 +691,6 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
var oneGoodsPrice = sku.oldGroupPrice.ParseToInt();
var buyCnt = orderItem.sku_cnt;
var buyPrice = oneGoodsPrice * buyCnt;
var orderSn = "";
// 自动填写关联信息界面
this.txtMapGoodsIdVal = goodsId.ParseToString();
@@ -586,6 +741,214 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
if (this.currentUrl != buyerLoginUrl)
this.CefWebBrowser?.Load(buyerLoginUrl);
}
private string GetSourceCode(TransitWarehouseParam transit)
{
JObject body = new JObject();
body["province"] = transit.province_name;
body["city"] = transit.city_name;
body["warehouseCode"] = transit.TransId;
body["matchType"] = 1;
var url = "https://po.e57.cn/prod-api/api/oms-api/external_procurement/getRandomTraceCode";
var dataStr = JsonHelper.SerializeObject(body);
var sourceCodeRst = HttpResponseWXBLL.e57PostResponse(url, dataStr, "");
var randomCode = BaseRegex.GetStringXml(ref sourceCodeRst, "randomCode");
if (!string.IsNullOrEmpty(randomCode))
{
txtSourceCodeVal = randomCode;
return randomCode;
}
else
{
return "获取失败,请关闭拍单窗口重试 " + BaseRegex.GetStringXml(ref sourceCodeRst, "msg", sourceCodeRst);
}
}
private async void UpdateTransitWarehouse()
{
var sendProvince = txtSendProvinceVal;
if (transitWarehouse == null && !cmbTransitWarehouseVal.IsNullOrEmpty())
{
transitWarehouse = TransitWarehouseData.TransitWarehouseList.FirstOrDefault(t => t.TransName + " " + t.TransDetailAddress == cmbTransitWarehouseVal.ParseToString());
}
if (transitWarehouse == null)
{
BaseMsgWindow.ShowError("仓库不能为空");
return;
}
this.pddFrontGoodsLite = JsonHelper.DeserializeJsonToObject<pddFrontGoods3Lite>(buymapSkuInfo?.map_skus);
// 通过map反查商品,淘宝暂时不需要
//if ((this.pddFrontGoodsLite?.goodsId).IsNullOrZero() || (this.pddFrontGoodsLite?.mallId).IsNullOrZero())
//{
// await Task.Run(() =>
// {
// var jsStr = "document.getElementById('orderGoodsBlock').getElementsByTagName('div')[0].click();";
// var host = CefWebBrowser.GetBrowser().GetHost();
// var client = CefWebBrowser.GetDevToolsClient();
// var ts1 = client.Runtime.EvaluateAsync(jsStr, null, true, null, null, true, null, true);
// ts1.Wait(500);
// for (int i = 0; i < 80; i++)
// {
// if (!(this.pddFrontGoodsLite?.mallId).IsNullOrZero())
// break;
// Thread.Sleep(100);
// }
// });
//}
this.Enabled = false;
if (!this.CefWebBrowser.Address.StartsWith("https://mobile.yangkeduo.com/order.html?order_sn=") && (this.pddFrontGoodsLite?.goodsId).ParseToString() == txtMapGoodsIdVal.Trim())
{
}
string url;
string upSpuCode = txtSpuCodeVal.Trim();
string upSkuCode = txtSkuCodeVal.Trim();
// 保存sku及商品关联信息
var data = UserLogin.GetSignaturex()
+ "&spu_code=" + GetHtml.UrlEncodeUtf8(upSpuCode)
+ "&sku_code=" + GetHtml.UrlEncodeUtf8(upSkuCode)
+ "&main_user_name=" + BaseClass.MainUserName
+ "&map_goods_name=" + txtMapGoodsNameVal.Trim()
+ "&map_spec_name=" + txtMapSkuNameVal.Trim()
+ "&map_goods_id=" + txtMapGoodsIdVal.Trim()
+ "&map_sku_id=" + txtMapSkuIdVal.Trim()
+ "&map_send_address=" + sendProvince
+ "&transit_warehouse_id=" + transitWarehouse?.TransId;
// 关联平台为淘宝
data += "&platform=tb";
if (!(this.pddFrontGoodsLite?.mallId).IsNullOrZero() && this.pddFrontGoodsLite.goodsId.ParseToString() == txtMapGoodsIdVal.Trim())
{
// 保存商品关联信息
data += "&map_skus=" + GetHtml.UrlEncodeUtf8(JsonHelper.SerializeObject(pddFrontGoodsLite));
url = BaseClass.Build29WxObjString("order/wx_add_mdy_buy_prod_map_skus");
var skusRst = await GetHtml.PostUtf8Async(url, data);
if (!skusRst.Contains("\"code\":200"))
skusRst = await GetHtml.PostUtf8Async(url, data);
// 存完立即读取
//wx_get_buy_pord_map_skus
var dataTest = UserLogin.GetSignaturex() + "&spu_codes=" + GetHtml.UrlEncodeUtf8(upSpuCode);
dataTest += "&main_user_name=" + BaseClass.MainUserName;
url = BaseClass.Build29WxObjString("order/wx_get_buy_pord_map_skus");
var resultSkusMap = await GetHtml.PostUtf8Async(url, dataTest);
if (string.IsNullOrEmpty(resultSkusMap) || !resultSkusMap.Contains("\"code\":200"))
{
resultSkusMap = await GetHtml.PostUtf8Async(url, dataTest);
}
if (string.IsNullOrEmpty(resultSkusMap) || !resultSkusMap.Contains("\"code\":200"))
{
}
else
{
List<WXBuyMapSkusInfo> buyMapSkuList = new List<WXBuyMapSkusInfo>();
try
{
buyMapSkuList = JsonHelper.DeserializeJsonToList<WXBuyMapSkusInfo>(JObject.Parse(resultSkusMap)["data"].ParseToString());
GlobalConfig.BuyMapSkusList.RemoveAll(b => buyMapSkuList.Any(map => b.spu_code == map.spu_code));
GlobalConfig.BuyMapSkusList.AddRange(buyMapSkuList);
foreach (var order in GlobalConfig.lstOrder)
{
if (order.IsWaitBuy)
{
foreach (var item in order.orderItems)
{
if (item.out_product_id == upSpuCode || item.product_id == upSpuCode)
{
item.PddBuyMapSkus = buyMapSkuList.Where(s => s.platform == "pdd").ToList();
item.TbBuyMapSkus = buyMapSkuList.Where(s => s.platform == "tb").ToList();
//if (filterOrderAction != null)
//{
// item.SetOrderItemTextProperty();
// filterOrderAction(order, false);
//}
}
}
}
}
}
catch
{
}
}
}
url = BaseClass.Build29WxObjString("order/wx_add_mdy_buy_prod_map");
var result = await GetHtml.PostUtf8Async(url, data);
if (!result.Contains("\"code\":200"))
result = await GetHtml.PostUtf8Async(url, data);
if (!result.Contains("\"code\":200"))
{
this.Enabled = true;
BaseMsgWindow.ShowError("保存失败" + BaseRegex.GetStringJson(ref result, "msg") + ",请稍后重试");
}
else
{
var urlMap = BaseClass.Build29WxObjString("order/wx_get_buy_prod_map");
var dataMap = UserLogin.GetSignaturex()
+ "&spu_codes=" + upSpuCode;
//dataMap += "&sku_codes=" + upSkuCode;
dataMap += "&main_user_name=" + BaseClass.MainUserName;
var resultMap = await GetHtml.PostUtf8Async(urlMap, dataMap);
if (string.IsNullOrEmpty(resultMap) || !resultMap.Contains("\"code\":200"))
resultMap = await GetHtml.PostUtf8Async(urlMap, dataMap);
if (string.IsNullOrEmpty(resultMap) || !resultMap.Contains("\"code\":200"))
{
}
else
{
List<WXBuyMapInfo> buyMapList = new List<WXBuyMapInfo>();
try
{
buyMapList = JsonHelper.DeserializeJsonToList<WXBuyMapInfo>(JObject.Parse(resultMap)["data"].ParseToString());
GlobalConfig.BuyMapList.RemoveAll(b => buyMapList.Any(map => b.spu_code == map.spu_code && b.sku_code == map.sku_code));
GlobalConfig.BuyMapList.AddRange(buyMapList);
}
catch
{
}
var tbBuyMap = buyMapList.FirstOrDefault(b => b.spu_code == upSpuCode && b.sku_code == upSkuCode && b.platform == "tb");
if (tbBuyMap != null)
{
foreach (var order in GlobalConfig.lstOrder)
{
if (order.IsWaitBuy)
{
foreach (var item in order.orderItems)
{
if ((item.out_product_id == tbBuyMap.spu_code && item.out_sku_id == tbBuyMap.sku_code) ||
(item.out_product_id == tbBuyMap.spu_code && item.sku_attr_str == tbBuyMap.sku_code) ||
(item.product_id == tbBuyMap.spu_code && item.out_sku_id == tbBuyMap.sku_code) ||
(item.product_id == tbBuyMap.spu_code && item.sku_attr_str == tbBuyMap.sku_code))
{
item.TbBuyMap = tbBuyMap;
item.SetOrderItemTextProperty();
MainWindow.Instance.orderListCtrl.FilterOneOrder(order, false);
}
}
}
}
}
}
BaseMsgWindow.ShowInfo("保存成功!");
if (_isWindowLoaded)
{
Application.Current?.Dispatcher.Invoke(new Action(() =>
{
if (_isWindowLoaded)
RequestClose?.Invoke();
}));
}
}
}
}
public class TaoBaoSku2Info
@@ -349,15 +349,32 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 关联拍单关系 // 危险物品禁止拍单,仅关联安全商品
//if (!GlobalConfig.lstDangerItemWord.Any(d => (item.title).ParseToString().Contains(d)))
{
item.PddBuyMap = buyMapList.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.out_product_id);
var pddBuyMapLst = buyMapList.Where(m => m.platform == "pdd").ToList();
item.PddBuyMap = pddBuyMapLst.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.out_product_id);
if (item.PddBuyMap == null)
item.PddBuyMap = buyMapList.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.out_product_id);
item.PddBuyMap = pddBuyMapLst.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.out_product_id);
if (item.PddBuyMap == null)
item.PddBuyMap = buyMapList.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.product_id);
item.PddBuyMap = pddBuyMapLst.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.product_id);
if (item.PddBuyMap == null)
item.PddBuyMap = buyMapList.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.product_id);
item.PddBuyMap = pddBuyMapLst.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.product_id);
}
item.PddBuyMapSkus = buyMapSkusList.Where(s => s.spu_code == item.out_product_id || s.spu_code == item.product_id).OrderByDescending(s => s.mdy_time).ToList();
item.PddBuyMapSkus = buyMapSkusList.Where(s => s.spu_code == item.out_product_id || s.spu_code == item.product_id).OrderByDescending(s => s.mdy_time)
.Where(s => s.platform == "pdd").ToList();
{
var tbBuyMapLst = buyMapList.Where(m => m.platform == "tb").ToList();
item.TbBuyMap = tbBuyMapLst.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.out_product_id);
if (item.TbBuyMap == null)
item.TbBuyMap = tbBuyMapLst.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.out_product_id);
if (item.TbBuyMap == null)
item.TbBuyMap = tbBuyMapLst.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.product_id);
if (item.TbBuyMap == null)
item.TbBuyMap = tbBuyMapLst.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.product_id);
}
item.TbBuyMapSkus = buyMapSkusList.Where(s => s.spu_code == item.out_product_id || s.spu_code == item.product_id).OrderByDescending(s => s.mdy_time)
.Where(s => s.platform == "tb").ToList();
// 中转仓订单
if (item.ItemOrder.orderItems.Count > 1)
@@ -846,6 +863,10 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
var buyMapList = JsonHelper.DeserializeJsonToList<WXBuyMapInfo>(JObject.Parse(resultMap)["data"].ParseToString());
buyMapList = buyMapList.Where(b => !GlobalConfig.BuyMapList.Any(m => m.sku_code == b.sku_code && m.spu_code == b.spu_code)).ToList();
GlobalConfig.BuyMapList.AddRange(buyMapList);
if (buyMapList.Count > 0)
{
}
}
catch
{
@@ -1484,7 +1484,8 @@
HorizontalAlignment="Center"
d:Visibility="Visible"
Click="btnChangeWaybill_Click"
Content="修改物流"
Content="补发/修改物流"
FontSize="11"
Style="{StaticResource BasePageButtonLightStyle}"
Visibility="{Binding ItemOrder.IsShowChangeWaybillBtn, Converter={StaticResource VisibleToVisibilityConverter}}" />
<Button
@@ -524,7 +524,11 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
public static void TbBuyOrder(oms_wei_order_item_info orderItem, bool isAbnormalOrder, bool isAutoBuy)
{
TaobaoBuyOrderCtrl taobaoBuyView = new TaobaoBuyOrderCtrl(GlobalConfig.CurrentTaobaoBuyer, orderItem);
taobaoBuyView.ViewModel.InitUrl = "https://s.taobao.com/search?";
//https://item.taobao.com/item.htm?id=756295486950&skuId=5216824841295
if (orderItem.TbBuyMap != null)
taobaoBuyView.ViewModel.InitUrl = "https://item.taobao.com/item.htm?id=" + orderItem.TbBuyMap.map_goods_id + "&skuId=" + orderItem.TbBuyMap.map_sku_id;
else
taobaoBuyView.ViewModel.InitUrl = "https://s.taobao.com/search?";
new DialogWindow()
{
Title = "淘宝买手登录",
@@ -1781,7 +1785,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
{
if (DataContext is oms_wei_order_item_info orderItem && orderItem.ItemOrder != null)
{
ChangeWaybillView changeWaybillView = new ChangeWaybillView(orderItem.ItemOrder);
ChangeWaybillView changeWaybillView = new ChangeWaybillView(orderItem);
new DialogWindow()
{
Title = "修改订单物流",