958 lines
33 KiB
C#
958 lines
33 KiB
C#
using AllBase.Helper;
|
||
using AllBase.Model.MvvmBaseClasses;
|
||
using NaiBa.Util;
|
||
using NaiBa.Util.Extension;
|
||
using NPOI.OpenXmlFormats.Dml.Diagram;
|
||
using NPOI.OpenXmlFormats.Spreadsheet;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Collections.ObjectModel;
|
||
using System.ComponentModel;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Text.RegularExpressions;
|
||
using System.Threading.Tasks;
|
||
using System.Windows;
|
||
using System.Windows.Media;
|
||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
|
||
using Color = System.Windows.Media.Color;
|
||
|
||
namespace AllBase.Model.DBModel
|
||
{
|
||
public class oms_wei_order_info : PropertyNotifyObject
|
||
{
|
||
/// <summary>
|
||
/// 订单对应店铺
|
||
/// </summary>
|
||
public ShopLoginInfo Shop
|
||
{
|
||
get { return this.GetValue(x => x.Shop); }
|
||
set { this.SetValue(x => x.Shop, value); }
|
||
}
|
||
public string OrderDiffItemCountStr
|
||
{
|
||
get { return this.GetValue(x => x.OrderDiffItemCountStr); }
|
||
set { this.SetValue(x => x.OrderDiffItemCountStr, value); }
|
||
}
|
||
|
||
public string OrderBuyType
|
||
{
|
||
get { return this.GetValue(x => x.OrderBuyType); }
|
||
set { this.SetValue(x => x.OrderBuyType, value); OrderBuyTypeVisibility = string.IsNullOrWhiteSpace(value) ? Visibility.Collapsed : Visibility.Visible; }
|
||
}
|
||
public Visibility OrderBuyTypeVisibility
|
||
{
|
||
get { return this.GetValue(x => x.OrderBuyTypeVisibility); }
|
||
set { this.SetValue(x => x.OrderBuyTypeVisibility, value); }
|
||
}
|
||
public SolidColorBrush OrderBuyTypeColor
|
||
{
|
||
get { return this.GetValue(x => x.OrderBuyTypeColor); }
|
||
set { this.SetValue(x => x.OrderBuyTypeColor, value); }
|
||
}
|
||
|
||
public ObservableCollection<oms_wei_order_item_info> orderItems { get; set; } = new ObservableCollection<oms_wei_order_item_info>();
|
||
public oms_wei_order_item_info orderItem
|
||
{
|
||
get { return this.GetValue(x => x.orderItem); }
|
||
set { this.SetValue(x => x.orderItem, value); }
|
||
}
|
||
public oms_wei_order_item_info orderItem2
|
||
{
|
||
get { return this.GetValue(x => x.orderItem2); }
|
||
set { this.SetValue(x => x.orderItem2, value); }
|
||
}
|
||
public oms_wei_order_item_info orderItem3
|
||
{
|
||
get { return this.GetValue(x => x.orderItem3); }
|
||
set { this.SetValue(x => x.orderItem3, value); }
|
||
}
|
||
public oms_wei_order_item_info orderItem4
|
||
{
|
||
get { return this.GetValue(x => x.orderItem4); }
|
||
set { this.SetValue(x => x.orderItem4, value); }
|
||
}
|
||
public oms_wei_order_item_info orderItem5
|
||
{
|
||
get { return this.GetValue(x => x.orderItem5); }
|
||
set { this.SetValue(x => x.orderItem5, value); }
|
||
}
|
||
|
||
public ObservableCollection<oms_wei_refund_info> refundItems { get; set; } = new ObservableCollection<oms_wei_refund_info>();
|
||
|
||
public ConcurrentList<oms_wei_ewaybill_path> latestEWaybills { get; set; } = new ConcurrentList<oms_wei_ewaybill_path>();
|
||
|
||
/// <summary>
|
||
/// 待采购
|
||
/// </summary>
|
||
public bool IsWaitBuy
|
||
{
|
||
get { return this.GetValue(x => x.IsWaitBuy); }
|
||
set { this.SetValue(x => x.IsWaitBuy, value); }
|
||
}
|
||
/// <summary>
|
||
/// 待发货
|
||
/// </summary>
|
||
public bool IsWaitSend
|
||
{
|
||
get { return this.GetValue(x => x.IsWaitSend); }
|
||
set { this.SetValue(x => x.IsWaitSend, value); }
|
||
}
|
||
/// <summary>
|
||
/// 待收货
|
||
/// </summary>
|
||
public bool IsWaitReceive
|
||
{
|
||
get { return this.GetValue(x => x.IsWaitReceive); }
|
||
set { this.SetValue(x => x.IsWaitReceive, value); }
|
||
}
|
||
/// <summary>
|
||
/// 售后订单(不含售后关闭) -- 改为售后完成单 260726
|
||
/// </summary>
|
||
public bool IsRefund
|
||
{
|
||
get { return this.GetValue(x => x.IsRefund); }
|
||
set { this.SetValue(x => x.IsRefund, value); }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 紧急订单
|
||
/// </summary>
|
||
public bool IsEmergency
|
||
{
|
||
get { return this.GetValue(x => x.IsEmergency); }
|
||
set { this.SetValue(x => x.IsEmergency, value); }
|
||
}
|
||
|
||
public bool IsEmergencyDistribReturnOrder
|
||
{
|
||
get { return this.GetValue(x => x.IsEmergencyDistribReturnOrder); }
|
||
set { this.SetValue(x => x.IsEmergencyDistribReturnOrder, value); }
|
||
}
|
||
public bool IsEmergencyManualReturnOrder
|
||
{
|
||
get { return this.GetValue(x => x.IsEmergencyManualReturnOrder); }
|
||
set { this.SetValue(x => x.IsEmergencyManualReturnOrder, value); }
|
||
}
|
||
|
||
public bool IsDistribReturnOrder
|
||
{
|
||
get { return this.GetValue(x => x.IsDistribReturnOrder); }
|
||
set { this.SetValue(x => x.IsDistribReturnOrder, value); }
|
||
}
|
||
/// <summary>
|
||
/// 异常单(买手异常退货)异常需重拍
|
||
/// </summary>
|
||
public bool IsAbnormal
|
||
{
|
||
get { return this.GetValue(x => x.IsAbnormal); }
|
||
set { this.SetValue(x => x.IsAbnormal, value); }
|
||
}
|
||
|
||
public bool IsShowChangeWaybillBtn
|
||
{
|
||
get { return this.GetValue(x => x.IsShowChangeWaybillBtn); }
|
||
set { this.SetValue(x => x.IsShowChangeWaybillBtn, value); }
|
||
}
|
||
public bool IsShowTransitExtraPackagesBtn
|
||
{
|
||
get { return this.GetValue(x => x.IsShowTransitExtraPackagesBtn); }
|
||
set { this.SetValue(x => x.IsShowTransitExtraPackagesBtn, value); }
|
||
}
|
||
|
||
public string orderStatusStr
|
||
{
|
||
get { return this.GetValue(x => x.orderStatusStr); }
|
||
set { this.SetValue(x => x.orderStatusStr, value); }
|
||
}
|
||
public void SetOrderStatusStr()
|
||
{
|
||
//状态10 待付款;20 待发货;21 部分发货;30 待收货;100 完成;200 全部商品售后之后,订单取消;250 未付款用户主动取消或超时未付款订单自动取消;
|
||
if (status == 10)
|
||
orderStatusStr = "待付款";
|
||
else if (status == 20)
|
||
orderStatusStr = "待发货";
|
||
else if (status == 21)
|
||
orderStatusStr = "部分发货";
|
||
else if (status == 30)
|
||
orderStatusStr = "待收货";
|
||
else if (status == 100)
|
||
orderStatusStr = "完成";
|
||
else if (status == 200)
|
||
orderStatusStr = "已取消";
|
||
else if (status == 250)
|
||
orderStatusStr = "未付款已取消";
|
||
else
|
||
orderStatusStr = "未知状态";
|
||
}
|
||
|
||
public string RefundTypeStr
|
||
{
|
||
get { return this.GetValue(x => x.RefundTypeStr); }
|
||
set { this.SetValue(x => x.RefundTypeStr, value); }
|
||
}
|
||
|
||
|
||
public DateTime RefundDatetime
|
||
{
|
||
get { return this.GetValue(x => x.RefundDatetime); }
|
||
set { this.SetValue(x => x.RefundDatetime, value); }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 订单生成时间
|
||
/// </summary>
|
||
public DateTime CreateDateTime
|
||
{
|
||
get { return this.GetValue(x => x.CreateDateTime); }
|
||
private set { this.SetValue(x => x.CreateDateTime, value); }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 订单更新时间
|
||
/// </summary>
|
||
public DateTime UpdateDateTime
|
||
{
|
||
get { return this.GetValue(x => x.UpdateDateTime); }
|
||
private set { this.SetValue(x => x.UpdateDateTime, value); }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 订单发货完成时间
|
||
/// </summary>
|
||
public string ShipDoneTimeStr
|
||
{
|
||
get { return this.GetValue(x => x.ShipDoneTimeStr); }
|
||
set { this.SetValue(x => x.ShipDoneTimeStr, value); }
|
||
}
|
||
/// <summary>
|
||
/// 订单发货完成时间可见
|
||
/// </summary>
|
||
public Visibility ShipDoneTimeVisibility
|
||
{
|
||
get { return this.GetValue(x => x.ShipDoneTimeVisibility); }
|
||
set { this.SetValue(x => x.ShipDoneTimeVisibility, value); }
|
||
}
|
||
void SetShipDoneTimeStr()
|
||
{
|
||
ShipDoneTimeStr = BaseClass.StampToDateTime(this.ship_done_time.ParseToInt()).ToString("yy-MM-dd HH:mm:ss");
|
||
ShipDoneTimeVisibility = this.ship_done_time.ParseToInt() > 0 ? Visibility.Visible : Visibility.Collapsed;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 订单总状态文本
|
||
/// </summary>
|
||
public string DeliveryDeadlineStatusStr
|
||
{
|
||
get { return this.GetValue(x => x.DeliveryDeadlineStatusStr); }
|
||
set { this.SetValue(x => x.DeliveryDeadlineStatusStr, value); }
|
||
}
|
||
void SetDeliveryDeadlineStatusStr()
|
||
{
|
||
if (this.refundItems.Any(r => "商家受理中,待买家退货,待商家收货,平台退款中,待用户确认,待用户处理商家协商,待用户处理商家代发起的售后申请,物流拦截中".Contains(r.RefundStatusStr)))
|
||
DeliveryDeadlineStatusStr = "退款中";
|
||
else if (this.refundItems.Any(r => r.RefundStatusStr == "退款完成" || r.RefundStatusStr == "退货退款完成"))
|
||
DeliveryDeadlineStatusStr = "退款完成";
|
||
// 用户取消申请
|
||
else if ((GlobalConfig.OrderTabHeaderStr.StartsWith("售后完成单") || GlobalConfig.OrderTabHeaderStr.StartsWith("需处理售后单") || GlobalConfig.OrderTabHeaderStr.StartsWith("退货仓自动售后单")) &&
|
||
this.refundItems.Any(r => !r.RefundStatusStr.IsNullOrEmpty()))
|
||
DeliveryDeadlineStatusStr = this.refundItems.FirstOrDefault(r => !r.RefundStatusStr.IsNullOrEmpty()).RefundStatusStr;
|
||
else if (this.status == 20 || this.status == 21)
|
||
{
|
||
DeliveryDeadlineStatusStr = "剩余";
|
||
}
|
||
else
|
||
DeliveryDeadlineStatusStr = "剩余";
|
||
}
|
||
|
||
/// <summary>
|
||
/// 延迟发货时间(微信小店:商品发货时效,超时此时间未发货即为发货超时)文本
|
||
/// </summary>
|
||
public string DeliveryDeadlineStr
|
||
{
|
||
get { return this.GetValue(x => x.DeliveryDeadlineStr); }
|
||
set { this.SetValue(x => x.DeliveryDeadlineStr, value); }
|
||
}
|
||
public void SetDeliveryDeadlineStr()
|
||
{
|
||
if (this.status == 20 || this.status == 21)
|
||
{
|
||
var deadlineTime = BaseClass.StampToDateTime(delivery_deadline.ParseToInt());
|
||
var nowTime = DateTime.Now;
|
||
if (deadlineTime < nowTime)
|
||
DeliveryDeadlineStr = "已超时";
|
||
else
|
||
{
|
||
var timeSpan = BaseClass.StampToDateTime(delivery_deadline.ParseToInt()) - nowTime;
|
||
var durationStr = Math.Floor(timeSpan.TotalHours).ParseToInt() + "时" + timeSpan.Minutes + "分" + timeSpan.Seconds + "秒";
|
||
DeliveryDeadlineStr = durationStr;
|
||
}
|
||
}
|
||
else if (/*this.out_shipped == 1 */this.ship_done_time.ParseToInt() > 0)
|
||
DeliveryDeadlineStr = "已发货";
|
||
else
|
||
DeliveryDeadlineStr = "未发货";
|
||
}
|
||
|
||
public SolidColorBrush StatusBoxForeColor
|
||
{
|
||
get { return this.GetValue(x => x.StatusBoxForeColor); }
|
||
set { this.SetValue(x => x.StatusBoxForeColor, value); }
|
||
}
|
||
public SolidColorBrush StatusBoxBackColor
|
||
{
|
||
get { return this.GetValue(x => x.StatusBoxBackColor); }
|
||
set { this.SetValue(x => x.StatusBoxBackColor, value); }
|
||
}
|
||
public SolidColorBrush StatusBoxBorderColor
|
||
{
|
||
get { return this.GetValue(x => x.StatusBoxBorderColor); }
|
||
set { this.SetValue(x => x.StatusBoxBorderColor, value); }
|
||
}
|
||
public void SetStatusBoxColor()
|
||
{
|
||
if (DeliveryDeadlineStatusStr == "退款中" || DeliveryDeadlineStr == "已超时")
|
||
StatusBoxForeColor = GlobalConfig.RedTextBrush; // #fa4733 250, 71, 51
|
||
else if (DeliveryDeadlineStatusStr == "退款完成" || DeliveryDeadlineStr == "已发货")
|
||
StatusBoxForeColor = GlobalConfig.GreenTextBrush; // #67c23a 103, 194, 58
|
||
else
|
||
StatusBoxForeColor = GlobalConfig.CyanBrush; // #0397b5 3, 151, 181
|
||
|
||
if (DeliveryDeadlineStatusStr == "退款中" || DeliveryDeadlineStr == "已超时")
|
||
StatusBoxBackColor = GlobalConfig.RedTextBrush26; // #fa4733 0.2 26, 250, 71, 51
|
||
else if (DeliveryDeadlineStatusStr == "退款完成" || DeliveryDeadlineStr == "已发货")
|
||
StatusBoxBackColor = GlobalConfig.GreenTextBrush26; // #67c23a 0.2 26, 103, 194, 58
|
||
else
|
||
StatusBoxBackColor = GlobalConfig.CyanBrush26; // #0397b5 0.2 26, 3, 151, 181
|
||
|
||
if (DeliveryDeadlineStatusStr == "退款中" || DeliveryDeadlineStr == "已超时")
|
||
StatusBoxBorderColor = GlobalConfig.RedTextBrush50; // #fa4733 0.2 50, 250, 71, 51
|
||
else if (DeliveryDeadlineStatusStr == "退款完成" || DeliveryDeadlineStr == "已发货")
|
||
StatusBoxBorderColor = GlobalConfig.GreenTextBrush50; // #67c23a 0.2 50, 103, 194, 58
|
||
else
|
||
StatusBoxBorderColor = GlobalConfig.CyanBrush50; // #0397b5 0.2 50, 3, 151, 181
|
||
}
|
||
|
||
public string AddressStr
|
||
{
|
||
//get { return user_name + " " + tel_number + " " + province_name + " " + city_name + " " + county_name + " " + detail_info; }
|
||
//set { }
|
||
get { return this.GetValue(x => x.AddressStr); }
|
||
set { this.SetValue(x => x.AddressStr, value); }
|
||
}
|
||
|
||
public string OutExpressNoStr
|
||
{
|
||
get { return this.GetValue(x => x.OutExpressNoStr); }
|
||
set { this.SetValue(x => x.OutExpressNoStr, value); }
|
||
}
|
||
public SolidColorBrush OutExpressNoBrush
|
||
{
|
||
get { return this.GetValue(x => x.OutExpressNoBrush); }
|
||
set { this.SetValue(x => x.OutExpressNoBrush, value); }
|
||
}
|
||
void SetOutExpressNo()
|
||
{
|
||
if (this.out_shipped == 2 && !string.IsNullOrEmpty(this.out_express_no))
|
||
OutExpressNoStr = this.out_express_no + " ×";
|
||
else
|
||
OutExpressNoStr = this.out_express_no;
|
||
|
||
OutExpressNoBrush = OutExpressNoStr.EndsWith(" ×") ? GlobalConfig.RedTextBrush : GlobalConfig.BlackBrush;
|
||
}
|
||
|
||
public string GiftOrderStatusStr
|
||
{
|
||
get { return this.GetValue(x => x.GiftOrderStatusStr); }
|
||
set { this.SetValue(x => x.GiftOrderStatusStr, value); }
|
||
}
|
||
|
||
public bool GiftSuccessed
|
||
{
|
||
get { return this.GetValue(x => x.GiftSuccessed); }
|
||
set { this.SetValue(x => x.GiftSuccessed, value); }
|
||
}
|
||
public string GiftErrorMsg
|
||
{
|
||
get { return this.GetValue(x => x.GiftErrorMsg); }
|
||
set { this.SetValue(x => x.GiftErrorMsg, value); }
|
||
}
|
||
|
||
public ConcurrentList<yh_sync_logistics> SyncLogisticsList
|
||
{
|
||
get { return this.GetValue(x => x.SyncLogisticsList); }
|
||
set
|
||
{
|
||
this.SetValue(x => x.SyncLogisticsList, value);
|
||
RealSyncWaybillId = SyncLogisticsList.FirstOrDefault()?.tracking_number;
|
||
SyncWaybillIdInfo = SyncLogisticsList.FirstOrDefault()?.tracking_number;
|
||
SyncWaybillPickNo = SyncLogisticsList.FirstOrDefault()?.pickup_code;
|
||
}
|
||
}
|
||
public string RealSyncWaybillId
|
||
{
|
||
get { return this.GetValue(x => x.RealSyncWaybillId); }
|
||
set { this.SetValue(x => x.RealSyncWaybillId, value); }
|
||
}
|
||
public string SyncWaybillIdInfo
|
||
{
|
||
get { return this.GetValue(x => x.SyncWaybillIdInfo); }
|
||
set { this.SetValue(x => x.SyncWaybillIdInfo, value); }
|
||
}
|
||
public string SyncWaybillPickNo
|
||
{
|
||
get { return this.GetValue(x => x.SyncWaybillPickNo); }
|
||
set { this.SetValue(x => x.SyncWaybillPickNo, value); }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 是否被选中
|
||
/// </summary>
|
||
public bool IsSelect
|
||
{
|
||
get { return this.GetValue(x => x.IsSelect); }
|
||
set { this.SetValue(x => x.IsSelect, value); }
|
||
}
|
||
public Visibility OutAccountStrVisibility
|
||
{
|
||
get { return this.GetValue(x => x.OutAccountStrVisibility); }
|
||
set { this.SetValue(x => x.OutAccountStrVisibility, value); }
|
||
}
|
||
//public bool is_visible { get; set; } = true;
|
||
|
||
|
||
public long id { get; set; }
|
||
public long shop_id { get; set; }
|
||
public string shop_name { get; set; }
|
||
/// <summary>
|
||
/// 商户ID
|
||
/// </summary>
|
||
public string merchant_id { get; set; }
|
||
public string order_id { get; set; }
|
||
/// <summary>
|
||
/// 买家身份标识
|
||
/// </summary>
|
||
public string openid { get; set; }
|
||
public int create_time
|
||
{
|
||
get { return this.GetValue(x => x.create_time); }
|
||
set { this.SetValue(x => x.create_time, value); this.CreateDateTime = BaseClass.StampToDateTime(create_time.ParseToInt()); }
|
||
}
|
||
|
||
public int update_time
|
||
{
|
||
get { return this.GetValue(x => x.update_time); }
|
||
set { this.SetValue(x => x.update_time, value); this.UpdateDateTime = BaseClass.StampToDateTime(update_time.ParseToInt()); }
|
||
}
|
||
public string unionid { get; set; }
|
||
/// <summary>
|
||
/// 状态10 待付款;20 待发货;21 部分发货;30 待收货;100 完成;200 全部商品售后之后,订单取消;250 未付款用户主动取消或超时未付款订单自动取消;
|
||
/// </summary>
|
||
public int? status
|
||
{
|
||
get { return this.GetValue(x => x.status); }
|
||
set { this.SetValue(x => x.status, value); SetOrderStatusStr(); }
|
||
}
|
||
/// <summary>
|
||
/// 售后信息json
|
||
/// </summary>
|
||
public string aftersale_detail { get; set; }
|
||
/// <summary>
|
||
/// 支付信息
|
||
/// </summary>
|
||
public string pay_info { get; set; }
|
||
/// <summary>
|
||
/// 额外信息
|
||
/// </summary>
|
||
public string ext_info { get; set; }
|
||
/// <summary>
|
||
/// 商品总价
|
||
/// </summary>
|
||
public int? product_price { get; set; }
|
||
/// <summary>
|
||
/// 订单金额,单位为分,order_price=original_order_price-discounted_price-deduction_price-change_down_price
|
||
/// </summary>
|
||
public int? order_price { get; set; }
|
||
/// <summary>
|
||
/// 采购价,单位为分
|
||
/// </summary>
|
||
public int? purchase_price { get; set; }
|
||
/// <summary>
|
||
/// 采购时间
|
||
/// </summary>
|
||
public int? purchase_time { get; set; }
|
||
/// <summary>
|
||
/// 运费,单位为分
|
||
/// </summary>
|
||
public int? freight { get; set; }
|
||
/// <summary>
|
||
/// 平台服务费(微信小店:预计技术服务费),单位为分
|
||
/// </summary>
|
||
public int? predict_commission_fee { get; set; }
|
||
/// <summary>
|
||
/// 达人佣金(微信小店:分账金额),单位为分
|
||
/// </summary>
|
||
public int? commission_amount { get; set; }
|
||
/// <summary>
|
||
/// 优惠券优惠金额,单位为分
|
||
/// </summary>
|
||
public int? discounted_price { get; set; }
|
||
/// <summary>
|
||
/// 利润(实付金额-采购价-平台服务费-达人佣金,达人佣金、采购价为空值则为0)
|
||
/// </summary>
|
||
public int? profit { get; set; }
|
||
/// <summary>
|
||
/// 采购状态,默认值为:0未采购,推送仓库时修改为1采购
|
||
/// </summary>
|
||
public int? purchase_status { get; set; }
|
||
/// <summary>
|
||
/// 延迟发货时间(微信小店:商品发货时效,超时此时间未发货即为发货超时)
|
||
/// </summary>
|
||
public int? delivery_deadline
|
||
{
|
||
get { return this.GetValue(x => x.delivery_deadline); }
|
||
set { this.SetValue(x => x.delivery_deadline, value); }
|
||
}
|
||
/// <summary>
|
||
/// 发货时间
|
||
/// </summary>
|
||
public int? delivery_time { get; set; }
|
||
/// <summary>
|
||
/// 收货人姓名
|
||
/// </summary>
|
||
public string user_name { get; set; }
|
||
/// <summary>
|
||
/// 邮编
|
||
/// </summary>
|
||
public string postal_code { get; set; }
|
||
public string province_name { get; set; }
|
||
public string city_name { get; set; }
|
||
/// <summary>
|
||
/// 区
|
||
/// </summary>
|
||
public string county_name { get; set; }
|
||
/// <summary>
|
||
/// 详细地址
|
||
/// </summary>
|
||
public string detail_info
|
||
{
|
||
get { return this.GetValue(x => x.detail_info); }
|
||
set { this.SetValue(x => x.detail_info, value); }
|
||
}
|
||
public string tel_number
|
||
{
|
||
get { return this.GetValue(x => x.tel_number); }
|
||
set { this.SetValue(x => x.tel_number, value); }
|
||
}
|
||
/// <summary>
|
||
/// 门牌号码
|
||
/// </summary>
|
||
public string house_number
|
||
{
|
||
get { return this.GetValue(x => x.house_number); }
|
||
set
|
||
{
|
||
this.SetValue(x => x.house_number, value);
|
||
|
||
this.AddressStr = user_name + " " + tel_number + " " + province_name + " " + city_name + " " + county_name + " " + detail_info;
|
||
if (GlobalConfig.DicDecryptOrderAddress.ContainsKey(this.order_id))
|
||
{
|
||
var addressOrder = GlobalConfig.DicDecryptOrderAddress[this.order_id];
|
||
|
||
this.user_name = addressOrder.user_name;
|
||
this.tel_number = addressOrder.tel_number;
|
||
this.tel_number_ext_info = addressOrder.tel_number_ext_info;
|
||
this.province_name = addressOrder.province_name;
|
||
this.city_name = addressOrder.city_name;
|
||
this.county_name = addressOrder.county_name;
|
||
this.detail_info = addressOrder.detail_info;
|
||
this.AddressStr = addressOrder.AddressStr;
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 虚拟发货订单联系方式(deliver_method=1时返回)
|
||
/// </summary>
|
||
public string virtual_order_tel_number { get; set; }
|
||
/// <summary>
|
||
/// 额外的联系方式信息(虚拟号码相关)
|
||
/// </summary>
|
||
public string tel_number_ext_info { get; set; }
|
||
/// <summary>
|
||
/// 0:不使用虚拟号码,1:使用虚拟号码
|
||
/// </summary>
|
||
public int? use_tel_number { get; set; }
|
||
/// <summary>
|
||
/// 标识当前店铺下一个唯一的用户收货地址
|
||
/// </summary>
|
||
public string hash_code { get; set; }
|
||
/// <summary>
|
||
/// 发货物流信息JSON
|
||
/// </summary>
|
||
public string delivery_product_info { get; set; }
|
||
/// <summary>
|
||
/// 发货完成时间,秒级时间戳
|
||
/// </summary>
|
||
public int? ship_done_time { get; set; }
|
||
/// <summary>
|
||
/// 电子面单代发时的订单密文
|
||
/// </summary>
|
||
public string ewaybill_order_code { get; set; }
|
||
/// <summary>
|
||
/// 结算信息json
|
||
/// </summary>
|
||
public string settle_info { get; set; }
|
||
/// <summary>
|
||
/// 订单审核状态(0待审核1已审核)
|
||
/// </summary>
|
||
public int? audit_status { get; set; }
|
||
/// <summary>
|
||
/// 订单审核时间
|
||
/// </summary>
|
||
public DateTime audit_time { get; set; }
|
||
/// <summary>
|
||
/// erp发货快递公司
|
||
/// </summary>
|
||
public string erp_send_company { get; set; }
|
||
/// <summary>
|
||
/// erp发货快递单号
|
||
/// </summary>
|
||
public string erp_send_code { get; set; }
|
||
/// <summary>
|
||
/// erp发货状态
|
||
/// </summary>
|
||
public int? erp_send_status { get; set; }
|
||
/// <summary>
|
||
/// erp发货时间
|
||
/// </summary>
|
||
public DateTime erp_send_time { get; set; }
|
||
/// <summary>
|
||
/// 旗帜颜色备注,1:灰旗,2:红旗,3:橙旗,4:绿旗,5:天蓝旗,6:紫旗
|
||
/// </summary>
|
||
public int? colour_flag
|
||
{
|
||
get { return this.GetValue(x => x.colour_flag); }
|
||
set { this.SetValue(x => x.colour_flag, value); }
|
||
}
|
||
public SolidColorBrush ColourFlagBrush
|
||
{
|
||
get { return this.GetValue(x => x.ColourFlagBrush); }
|
||
set { this.SetValue(x => x.ColourFlagBrush, value); }
|
||
}
|
||
/// <summary>
|
||
/// 旗帜备注时间
|
||
/// </summary>
|
||
public DateTime colour_flag_update_time { get; set; }
|
||
/// <summary>
|
||
/// 供应商备注异常单
|
||
/// </summary>
|
||
public string supplier_remark_exception { get; set; }
|
||
/// <summary>
|
||
/// 礼物单状态,默认值0:不存在礼物单,1:礼物单已发货,2:礼物单信息已更正 3 礼物单发货失败 4 礼物单已购买但微信发货失败 5 礼物单发货中
|
||
/// </summary>
|
||
public int? gift_order_status
|
||
{
|
||
get { return this.GetValue(x => x.gift_order_status); }
|
||
set
|
||
{
|
||
this.SetValue(x => x.gift_order_status, value);
|
||
if (value == 1 || value == 2)
|
||
GiftOrderStatusStr = "礼品单已购买";
|
||
else if (value == 3)
|
||
GiftOrderStatusStr = "礼品单购买失败";
|
||
else if (value == 4)
|
||
GiftOrderStatusStr = "礼物单已购买但微信发货失败";
|
||
else if (value == 5)
|
||
GiftOrderStatusStr = "礼物单发货中";
|
||
else
|
||
GiftOrderStatusStr = "礼品单状态错误";
|
||
return;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 店铺备注:取微信ext_info.merchant_notes
|
||
/// </summary>
|
||
public string shop_remark { get; set; }
|
||
/// <summary>
|
||
/// 软件备注
|
||
/// </summary>
|
||
public string soft_remark { get; set; }
|
||
/// <summary>
|
||
/// 外采金额(单位:分,整数存储)
|
||
/// </summary>
|
||
public int? out_amount { get; set; }
|
||
/// <summary>
|
||
/// 外采账户
|
||
/// </summary>
|
||
public string out_account
|
||
{
|
||
get { return this.GetValue(x => x.out_account); }
|
||
set { this.SetValue(x => x.out_account, value); OutAccountStrVisibility = string.IsNullOrWhiteSpace(value) ? Visibility.Collapsed : Visibility.Visible; }
|
||
}
|
||
/// <summary>
|
||
/// 外采订单号
|
||
/// </summary>
|
||
public string out_order_no { get; set; }
|
||
/// <summary>
|
||
/// 外采快递公司
|
||
/// </summary>
|
||
public string out_express_company { get; set; }
|
||
/// <summary>
|
||
/// 外采快递单号
|
||
/// </summary>
|
||
public string out_express_no { get; set; }
|
||
/// <summary>
|
||
/// 外采是否发货(0 未发货,1 已发货)
|
||
/// </summary>
|
||
public int? out_shipped { get; set; }
|
||
/// <summary>
|
||
/// 判断是否优化过发货0 未优化, 1已优化
|
||
/// </summary>
|
||
public int? is_shipment_optimized { get; set; }
|
||
/// <summary>
|
||
/// 判断是否优随机使用快递单号0 未使用, 1已使用
|
||
/// </summary>
|
||
public int? is_express_no_used { get; set; }
|
||
/// <summary>
|
||
/// 外采订单售后状态
|
||
/// </summary>
|
||
public string out_after_sale_status { get; set; }
|
||
/// <summary>
|
||
/// 是否支持运费险:0-不支持,1-支持
|
||
/// </summary>
|
||
public int? has_freight_insurance { get; set; }
|
||
/// <summary>
|
||
/// 运费险金额(单位:元)
|
||
/// </summary>
|
||
public decimal? freight_insurance_amount { get; set; }
|
||
/// <summary>
|
||
/// 是否外采礼物单:0-否,1-是(外采订单)
|
||
/// </summary>
|
||
public int? external_gift { get; set; }
|
||
/// <summary>
|
||
/// 中转仓的状态 0未使用,1已创建,2创建失败(购买失败),3已创建未有上游快递单号,4已创建有上游快递单号
|
||
/// </summary>
|
||
public decimal? transfer_warehouse_status { get; set; }
|
||
/// <summary>
|
||
/// 店铺运费
|
||
/// </summary>
|
||
public int? postage_price { get; set; }
|
||
|
||
public void SetOrderTextProperty()
|
||
{
|
||
Shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ErpShopId == shop_id.ParseToString());
|
||
|
||
if (this.orderItems.Any(oi => oi.OrderItemExt?.buy_type == "直发") && this.orderItems.Any(oi => oi.ItemTransitOrderWithVoid != null))
|
||
{
|
||
OrderBuyType = "云改直";
|
||
OrderBuyTypeColor = GlobalConfig.PurpleBrush190;
|
||
}
|
||
else if (this.orderItems.Any(oi => oi.OrderItemExt?.buy_type == "直发"))
|
||
{
|
||
OrderBuyType = "直发";
|
||
OrderBuyTypeColor = GlobalConfig.RedTextBrush205;
|
||
}
|
||
else if (this.orderItems.Any(oi => oi.ItemTransitOrderWithVoid != null))
|
||
{
|
||
OrderBuyType = "云仓";
|
||
OrderBuyTypeColor = GlobalConfig.GreenTextBrush;
|
||
}
|
||
else
|
||
OrderBuyType = "";
|
||
|
||
if (this.orderItems.Any(oi => oi.ItemRefund?.type == "REFUND"))
|
||
this.RefundTypeStr = "仅退款";
|
||
else if (this.orderItems.Any(oi => oi.ItemRefund?.type == "RETURN"))
|
||
this.RefundTypeStr = "退货退款";
|
||
else if (this.orderItems.Any(oi => oi.ItemRefund?.type == "REFUND") && this.orderItems.Any(oi => oi.ItemRefund?.type == "RETURN"))
|
||
this.RefundTypeStr = "仅退款/退货退款";
|
||
|
||
IsWaitBuy = GetIsWaitBuy();
|
||
IsWaitSend = GetIsWaitSend();
|
||
IsWaitReceive = GetIsWaitReceive();
|
||
IsRefund = GetIsRefund();
|
||
IsEmergency = GetIsEmergency();
|
||
IsDistribReturnOrder = GetIsDistribReturnOrder();
|
||
IsEmergencyDistribReturnOrder = IsEmergency && IsDistribReturnOrder;
|
||
IsEmergencyManualReturnOrder = IsEmergency && !IsDistribReturnOrder;
|
||
IsAbnormal = GetIsAbnormal();
|
||
|
||
if (IsWaitBuy/* || IsWaitSend*/)
|
||
IsShowChangeWaybillBtn = false;
|
||
else
|
||
IsShowChangeWaybillBtn = true;
|
||
|
||
if (IsWaitBuy || this.orderItems.All(oi => oi.ItemTransitOrderWithVoid == null))
|
||
IsShowTransitExtraPackagesBtn = false;
|
||
else
|
||
IsShowTransitExtraPackagesBtn = true;
|
||
|
||
SetDeliveryDeadlineStatusStr();
|
||
SetDeliveryDeadlineStr();
|
||
SetStatusBoxColor();
|
||
SetOutExpressNo();
|
||
SetShipDoneTimeStr();
|
||
SetColorBrush();
|
||
|
||
orderItem = orderItems.FirstOrDefault() != null ? orderItems.FirstOrDefault() : new oms_wei_order_item_info() { OrderItemVisibility = Visibility.Collapsed };
|
||
orderItem2 = orderItems.Count > 1 ? orderItems[1] : new oms_wei_order_item_info() { OrderItemVisibility = Visibility.Collapsed };
|
||
orderItem3 = orderItems.Count > 2 ? orderItems[2] : new oms_wei_order_item_info() { OrderItemVisibility = Visibility.Collapsed };
|
||
orderItem4 = orderItems.Count > 3 ? orderItems[3] : new oms_wei_order_item_info() { OrderItemVisibility = Visibility.Collapsed };
|
||
orderItem5 = orderItems.Count > 4 ? orderItems[4] : new oms_wei_order_item_info() { OrderItemVisibility = Visibility.Collapsed };
|
||
OrderDiffItemCountStr = orderItems.Count > 1 ? "该订单共有 " + orderItems.Count + " 个不同的商品规格" : "";
|
||
}
|
||
|
||
public void SetColorBrush()
|
||
{
|
||
if (this.colour_flag.ParseToInt() == 2)
|
||
ColourFlagBrush = (SolidColorBrush)Application.Current.Resources["FlagRedBrush"];
|
||
else if (colour_flag.ParseToInt() == 3)
|
||
ColourFlagBrush = (SolidColorBrush)Application.Current.Resources["FlagOrangeBrush"];
|
||
else if (colour_flag.ParseToInt() == 4)
|
||
ColourFlagBrush = (SolidColorBrush)Application.Current.Resources["FlagGreenBrush"];
|
||
else if (colour_flag.ParseToInt() == 5)
|
||
ColourFlagBrush = (SolidColorBrush)Application.Current.Resources["FlagBlueBrush"];
|
||
else if (colour_flag.ParseToInt() == 6)
|
||
ColourFlagBrush = (SolidColorBrush)Application.Current.Resources["FlagPurpleBrush"];
|
||
else
|
||
ColourFlagBrush = (SolidColorBrush)Application.Current.Resources["FlagGrayBrush"];
|
||
}
|
||
|
||
public bool GetIsWaitBuy()
|
||
{
|
||
if (order_id == "3738686976228742912")
|
||
{
|
||
|
||
}
|
||
if (status != 20 && status != 21)
|
||
return false;
|
||
if (refundItems?.Any(r => r.IsRefund) == true)
|
||
return false;
|
||
// 子表有售后信息(可能更新不及时)
|
||
if (orderItems?.Any(oi => oi.refund_status > 1) == true)
|
||
return false;
|
||
// 中转仓有拍单信息
|
||
if (orderItems.All(oi => oi.ItemTransitOrder != null))
|
||
return false;
|
||
// 采购状态为已采购
|
||
if (purchase_status != 0)
|
||
return false;
|
||
// 礼物单已发货
|
||
if (gift_order_status == 1 || gift_order_status == 2)
|
||
return false;
|
||
// 直发订单未退款
|
||
// out_after_sale_status 新拍订单也不会变,内存里直接根据退款单修改掉
|
||
if (!string.IsNullOrEmpty(out_order_no) && out_after_sale_status != "退款成功")
|
||
return false;
|
||
return true;
|
||
}
|
||
|
||
private bool GetIsWaitSend()
|
||
{
|
||
if (order_id == "3738622310043515392")
|
||
{
|
||
|
||
}
|
||
|
||
if (status != 20 && status != 21)
|
||
return false;
|
||
if (refundItems?.Any(r => r.IsRefund) == true)
|
||
return false;
|
||
if (orderItems?.Any(oi => oi.refund_status > 1) == true)
|
||
return false;
|
||
// 礼物单已发货
|
||
if (gift_order_status == 1 || gift_order_status == 2)
|
||
return false;
|
||
// 店铺未发货,外采已采购
|
||
// out_after_sale_status 新拍订单也不会变,内存里直接根据退款单修改掉
|
||
if (!orderItems.All(oi => oi.ItemTransitOrder != null) && purchase_status != 1 &&
|
||
(string.IsNullOrEmpty(out_order_no) || out_after_sale_status == "退款成功"))
|
||
return false;
|
||
return true;
|
||
}
|
||
|
||
private bool GetIsWaitReceive()
|
||
{
|
||
if (refundItems?.Any(r => r.IsRefund) == true)
|
||
return false;
|
||
if (orderItems?.Any(oi => oi.refund_status > 1) == true)
|
||
return false;
|
||
if (!(status == 30 || status == 100 || gift_order_status == 1 || gift_order_status == 2))
|
||
return false;
|
||
return true;
|
||
}
|
||
|
||
public bool GetIsAbnormal()
|
||
{
|
||
// 三退或者两退,为退款完成单
|
||
//if (orderItems.All(oi => (oi.refund_status == 4 || oi.refund_status == 11) && (oi.ItemTransitOrder != null || string.IsNullOrWhiteSpace(out_order_no)) &&
|
||
// (oi.ItemTransitOrder == null || oi.ItemTransitOrder?.refund_status == "买手退款成功") && (string.IsNullOrWhiteSpace(out_order_no) || out_after_sale_status == "退款成功")))
|
||
// return false;
|
||
|
||
// 订单完成而非退货,肯定不是异常单
|
||
if (status == 100)
|
||
return false;
|
||
|
||
// 如果有售后,直接作为售后单处理
|
||
if (orderItems.All(oi => oi.refund_status > 1))
|
||
return false;
|
||
// 直发或者云改直已购买且未退货,从异常单移除
|
||
if (orderItems.All(oi => oi.DirectPddBuyerOrder != null && oi.DirectPddBuyerAfterSale == null) /*&& (out_shipped != 2 || string.IsNullOrEmpty(this.out_express_no))*/)
|
||
return false;
|
||
if (gift_order_status == 1 || gift_order_status == 2)
|
||
return false;
|
||
if (orderItems.Any(oi => !(oi.OrderItemExt?.abnormal_text).IsNullOrEmpty()))
|
||
return true;
|
||
|
||
// 订单无售后或者售后关闭,有未作废的仓库单且仓库单买手信息为退款成功
|
||
if (orderItems.Any(oi => oi.refund_status <= 1 && oi.ItemTransitOrder != null && oi.ItemTransitOrder.refund_status == "买手退款成功"))
|
||
return true;
|
||
|
||
// 取号异常或无法调用发货也放在异常单(异常需重拍)
|
||
// 订单不满足鸿浩仓库发货条件,无法调用鸿浩仓库接口发货
|
||
else if (orderItems.Any(oi => ((oi.ItemTransitOrderWithVoid?.raw_message).ParseToString().Contains("取号异常") ||
|
||
(oi.ItemTransitOrderWithVoid?.raw_message).ParseToString().Contains("无法调用")) &&
|
||
oi.ItemTransitOrderWithVoid?.transfer_warehouse_status != 1))
|
||
return true;
|
||
return false;
|
||
}
|
||
|
||
public bool GetIsRefund()
|
||
{
|
||
// return refundItems?.Count > 0 && refundItems.Any(r => r.status != "USER_CANCELD");
|
||
if (!orderItems.Any(oi => oi.refund_status > 1))
|
||
return false;
|
||
if (GetIsEmergency())
|
||
return false;
|
||
return true;
|
||
}
|
||
|
||
public bool GetIsEmergency()
|
||
{
|
||
// 微信订单退货中
|
||
if (orderItems.Any(oi => oi.refund_status == 2 || oi.refund_status == 3))
|
||
{
|
||
return true;
|
||
}
|
||
// 微信订单退款中或退款成功,但是买手订单未完成退款
|
||
if (orderItems.Any(oi => oi.refund_status > 1 && oi.ItemTransitOrders.Count > 0 && oi.ItemTransitOrders.Any(t => !t.refund_status.Contains("退款成功"))))
|
||
{
|
||
return true;
|
||
}
|
||
if (orderItems.Any(oi => oi.refund_status > 1) && !out_order_no.IsNullOrEmpty() && this.out_after_sale_status != "退款成功")
|
||
{
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
public bool GetIsDistribReturnOrder()
|
||
{
|
||
//return this.orderItems.All(oi => !string.IsNullOrEmpty(oi.ItemRefund?.return_waybill_id)) && this.orderItems.All(oi => oi.ItemRefund?.return_detail == GlobalConfig.TransitReturnOrderReturnAddress);
|
||
//return this.orderItems.All(oi => oi.ItemRefund?.return_detail == GlobalConfig.TransitReturnOrderReturnAddress);
|
||
return this.orderItems.All(oi => oi.ItemRefund?.return_detail?.ToUpper().Contains(GlobalConfig.TransitReturnOrderReturnAddressLite) == true);
|
||
}
|
||
}
|
||
}
|