删除不合适的仓库 优化订单和售后单读取
This commit is contained in:
1 parent
6f7aa58ac1
commit
13b68fa64e
53 files changed
+14843
-820
No files matched your search
@@ -1,6 +1,8 @@
|
||||
using AllBase.Model.MvvmBaseClasses;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model.MvvmBaseClasses;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Org.BouncyCastle.Asn1.Mozilla;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -14,53 +16,121 @@ namespace AllBase.Model.Local
|
||||
{
|
||||
public class oms_wei_order_item_info : PropertyNotifyObject
|
||||
{
|
||||
public oms_wei_order_info item_order { get; set; }
|
||||
public oms_wei_refund_info item_refund
|
||||
public ShopLoginInfo Shop
|
||||
{
|
||||
get
|
||||
{
|
||||
if (item_order?.refunds?.Count == 0)
|
||||
return null;
|
||||
if (item_order?.refunds?.Count == 1)
|
||||
return item_order?.refunds?.FirstOrDefault();
|
||||
return item_order?.refunds?.FirstOrDefault(r => r.sku_id == this.sku_id);
|
||||
}
|
||||
set { }
|
||||
get { return this.GetValue(x => x.Shop); }
|
||||
set { this.SetValue(x => x.Shop, value); }
|
||||
}
|
||||
public oms_wei_order_info ItemOrder
|
||||
{
|
||||
get { return this.GetValue(x => x.ItemOrder); }
|
||||
set { this.SetValue(x => x.ItemOrder, value); }
|
||||
}
|
||||
public oms_wei_refund_info ItemRefund
|
||||
{
|
||||
get { return this.GetValue(x => x.ItemRefund); }
|
||||
set { this.SetValue(x => x.ItemRefund, value); }
|
||||
}
|
||||
public void SetItemRefund(List<oms_wei_refund_info> itemRefunds)
|
||||
{
|
||||
if (itemRefunds?.Count == 1)
|
||||
ItemRefund = ItemOrder?.refundItems?.FirstOrDefault();
|
||||
else
|
||||
ItemRefund = ItemOrder?.refundItems?.FirstOrDefault(r => r.sku_id == this.sku_id);
|
||||
}
|
||||
/// <summary>
|
||||
/// 采购关联
|
||||
/// </summary>
|
||||
public WXBuyMapInfo buy_map
|
||||
public WXBuyMapInfo BuyMap
|
||||
{
|
||||
get { return this.GetValue(x => x.buy_map); }
|
||||
set { this.SetValue(x => x.buy_map, value); }
|
||||
get { return this.GetValue(x => x.BuyMap); }
|
||||
set { this.SetValue(x => x.BuyMap, value); }
|
||||
}
|
||||
|
||||
public List<oms_wei_external_procurement_log> item_transit_orders { get; set; } = new List<oms_wei_external_procurement_log>();
|
||||
public oms_wei_external_procurement_log item_transit_order
|
||||
/// <summary>
|
||||
/// 采购按钮文字
|
||||
/// </summary>
|
||||
public string BuyGoodsBtnTxt
|
||||
{
|
||||
get { return item_transit_orders.FirstOrDefault(); }
|
||||
get { return this.GetValue(x => x.BuyGoodsBtnTxt); }
|
||||
set { this.SetValue(x => x.BuyGoodsBtnTxt, value); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 采购按钮颜色
|
||||
/// </summary>
|
||||
public SolidColorBrush BuyGoodsBtnColor
|
||||
{
|
||||
get { return this.GetValue(x => x.BuyGoodsBtnColor); }
|
||||
set { this.SetValue(x => x.BuyGoodsBtnColor, value); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 采购按钮背景颜色
|
||||
/// </summary>
|
||||
public SolidColorBrush BuyGoodsBtnBackColor
|
||||
{
|
||||
get { return this.GetValue(x => x.BuyGoodsBtnBackColor); }
|
||||
set { this.SetValue(x => x.BuyGoodsBtnBackColor, value); }
|
||||
}
|
||||
public bool IsBuyGoodsBtnEnabled
|
||||
{
|
||||
get { return this.GetValue(x => x.IsBuyGoodsBtnEnabled); }
|
||||
set { this.SetValue(x => x.IsBuyGoodsBtnEnabled, value); }
|
||||
}
|
||||
|
||||
public List<oms_wei_external_procurement_log> ItemTransitOrders { get; set; } = new List<oms_wei_external_procurement_log>();
|
||||
public oms_wei_external_procurement_log ItemTransitOrder
|
||||
{
|
||||
get { return ItemTransitOrders.FirstOrDefault(); }
|
||||
set { }
|
||||
}
|
||||
|
||||
// 仓库采购时间是否达标字段
|
||||
public string OutOrderTimeQualifiedStr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ItemTransitOrder == null)
|
||||
return "";
|
||||
|
||||
if (ItemOrder.createDateTime == null)
|
||||
ItemOrder.createDateTime = BaseClass.StampToDateTime(ItemOrder.create_time);
|
||||
|
||||
string timeStr = "采购时间:" + ItemTransitOrder.created_time.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
if (ItemOrder.createDateTime.Value.Date != ItemTransitOrder.created_time.Date && ItemTransitOrder.created_time > ItemTransitOrder.created_time.Date.AddHours(1.5))
|
||||
return timeStr + " ×";
|
||||
return timeStr + " √";
|
||||
}
|
||||
set { }
|
||||
}
|
||||
/// <summary>
|
||||
/// 仓库采购时间是否达标字段
|
||||
/// </summary>
|
||||
public SolidColorBrush OutOrderTimeQualifiedBrush
|
||||
{
|
||||
get
|
||||
{
|
||||
return OutOrderTimeQualifiedStr.EndsWith("√") ? new SolidColorBrush(Color.FromRgb(103, 194, 58)) : new SolidColorBrush(Color.FromRgb(250, 71, 51));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string OrderItemStatusStr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (item_order?.status == 10)
|
||||
if (ItemOrder?.status == 10)
|
||||
return "待付款";
|
||||
if (item_order?.status == 20)
|
||||
if (ItemOrder?.status == 20)
|
||||
return "待店铺发货";
|
||||
if (item_order?.status == 21)
|
||||
if (ItemOrder?.status == 21)
|
||||
return "店铺部分发货";
|
||||
if (item_order?.status == 30)
|
||||
if (ItemOrder?.status == 30)
|
||||
return "待买家收货";
|
||||
if (item_order?.status == 100)
|
||||
if (ItemOrder?.status == 100)
|
||||
return "订单完成";
|
||||
if (item_order?.status == 200)
|
||||
if (ItemOrder?.status == 200)
|
||||
return "售后完成订单取消";
|
||||
if (item_order?.status == 250)
|
||||
if (ItemOrder?.status == 250)
|
||||
return "未付款已取消";
|
||||
return "未知状态";
|
||||
}
|
||||
@@ -116,12 +186,12 @@ namespace AllBase.Model.Local
|
||||
{
|
||||
get
|
||||
{
|
||||
if (item_refund == null)
|
||||
if (ItemRefund == null)
|
||||
return "";
|
||||
if (item_refund.status != "MERCHANT_REFUND_SUCCESS" && item_refund.status != "MERCHANT_RETURN_SUCCESS")
|
||||
if (ItemRefund.status != "MERCHANT_REFUND_SUCCESS" && ItemRefund.status != "MERCHANT_RETURN_SUCCESS")
|
||||
return "";
|
||||
|
||||
return "商品退款数量:" + item_refund.count + ",订单状态:" + item_order.orderStatusStr;
|
||||
return "商品退款数量:" + ItemRefund.count + ",订单状态:" + ItemOrder.orderStatusStr;
|
||||
}
|
||||
set { }
|
||||
}
|
||||
@@ -131,7 +201,7 @@ namespace AllBase.Model.Local
|
||||
/// </summary>
|
||||
public string refund_time_str
|
||||
{
|
||||
get { return BaseClass.StampToDateTime((item_refund?.create_time).ParseToInt()).ToString("yyyy-MM-dd HH:mm:ss"); }
|
||||
get { return BaseClass.StampToDateTime((ItemRefund?.create_time).ParseToInt()).ToString("yyyy-MM-dd HH:mm:ss"); }
|
||||
set { }
|
||||
}
|
||||
/// <summary>
|
||||
@@ -141,7 +211,7 @@ namespace AllBase.Model.Local
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this.item_refund?.create_time) > 0 ? Visibility.Visible : Visibility.Collapsed;
|
||||
return (this.ItemRefund?.create_time) > 0 ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
set { }
|
||||
}
|
||||
@@ -149,9 +219,8 @@ namespace AllBase.Model.Local
|
||||
/// <summary>
|
||||
/// 订单中所有商品加起来的总售价文本
|
||||
/// </summary>
|
||||
public string real_price_str
|
||||
public string realPriceStr
|
||||
{
|
||||
//get { return "¥" + (order_items.Sum(oi => oi.sale_price * oi.sku_cnt) * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||||
//get { return "¥" + (order_items.Sum(oi => oi.real_price) * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||||
get { return "¥" + (real_price * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||||
set { }
|
||||
@@ -181,7 +250,7 @@ namespace AllBase.Model.Local
|
||||
/// </summary>
|
||||
public Visibility purchase_price_visibility
|
||||
{
|
||||
get { if (item_order.out_amount > 0) return Visibility.Collapsed; return Visibility.Visible; }
|
||||
get { if (ItemOrder.out_amount > 0 || ItemTransitOrder?.out_amount > 0) return Visibility.Collapsed; return Visibility.Visible; }
|
||||
set { }
|
||||
}
|
||||
|
||||
@@ -199,7 +268,7 @@ namespace AllBase.Model.Local
|
||||
/// </summary>
|
||||
public Visibility freight_visibility
|
||||
{
|
||||
get { if (item_order.out_amount > 0) return Visibility.Collapsed; return Visibility.Visible; }
|
||||
get { if (ItemOrder.out_amount > 0 || ItemTransitOrder?.out_amount > 0) return Visibility.Collapsed; return Visibility.Visible; }
|
||||
set { }
|
||||
}
|
||||
|
||||
@@ -228,21 +297,58 @@ namespace AllBase.Model.Local
|
||||
/// </summary>
|
||||
public string out_amount_str
|
||||
{
|
||||
//get { return "¥" + (item_order.out_amount * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||||
get { return "¥" + (commission_amount.ParseToInt() * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||||
//get { return "¥" + (ItemOrder.out_amount * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||||
get
|
||||
{
|
||||
if (ItemTransitOrder?.out_amount > 0)
|
||||
return "¥" + (ItemTransitOrder.out_amount * 0.01m).ParseToDecimal().ToString("0.00");
|
||||
else
|
||||
return "¥" + (commission_amount.ParseToInt() * 0.01m).ParseToDecimal().ToString("0.00");
|
||||
}
|
||||
set { }
|
||||
}
|
||||
|
||||
decimal profitCount = decimal.MinValue;
|
||||
/// <summary>
|
||||
/// 利润文本
|
||||
/// 通过计算的利润
|
||||
/// </summary>
|
||||
public string profit_str
|
||||
public decimal ProfitCount
|
||||
{
|
||||
get
|
||||
{
|
||||
if (profitCount == decimal.MinValue)
|
||||
{
|
||||
//ItemOrder.out_amount ItemTransitOrder.out_amount 只有一个有值
|
||||
var out_amount = ItemTransitOrder?.out_amount ?? ItemOrder.out_amount / ItemOrder.orderItems.Count;
|
||||
profitCount = ((real_price.ParseToInt() + cash_coupon_discounted_price.ParseToInt() - purchase_price.ParseToInt() - freight.ParseToInt() - predict_commission_fee.ParseToInt() -
|
||||
commission_amount.ParseToInt() - out_amount.ParseToInt()) * 0.01m).ParseToDecimal();
|
||||
}
|
||||
return profitCount;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 通过计算的利润文本
|
||||
/// </summary>
|
||||
public string ProfitCountStr
|
||||
{
|
||||
//get { return "¥" + (profit * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||||
//get { return "¥" + ((item_order.profit - item_order.out_amount) * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||||
get { return "¥" + ((real_price.ParseToInt() + cash_coupon_discounted_price.ParseToInt() - purchase_price.ParseToInt() - freight.ParseToInt() -
|
||||
predict_commission_fee.ParseToInt() - commission_amount.ParseToInt() - item_order.out_amount / item_order.order_items.Count) * 0.01m)
|
||||
.ParseToDecimal().ToString("0.00"); }
|
||||
//get { return "¥" + ((ItemOrder.profit - ItemOrder.out_amount) * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||||
get
|
||||
{
|
||||
if (refund_status == 2 || refund_status == 3 || refund_status == 4 || refund_status == 11)
|
||||
return "--";
|
||||
return "¥" + ProfitCount.ToString("0.00");
|
||||
}
|
||||
set { }
|
||||
}
|
||||
public SolidColorBrush ProfitStrColor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (refund_status == 2 || refund_status == 3 || refund_status == 4 || refund_status == 11)
|
||||
return new SolidColorBrush(Color.FromRgb(127, 127, 127));
|
||||
return ProfitCount > 0 ? new SolidColorBrush(Color.FromRgb(103, 194, 58)) : new SolidColorBrush(Color.FromRgb(250, 71, 51));
|
||||
}
|
||||
set { }
|
||||
}
|
||||
|
||||
@@ -403,8 +509,51 @@ namespace AllBase.Model.Local
|
||||
/// </summary>
|
||||
public long? erp_goods_sku_id { get; set; }
|
||||
/// <summary>
|
||||
/// 售后状态 1:无售后或售后关闭,2:售后处理中,3:退款中,4: 退款成功 11 已取消
|
||||
/// 售后状态 1:无售后或售后关闭,2:售后处理中,3:退款中,4:退款成功,11:已取消(售后完成订单取消)
|
||||
/// </summary>
|
||||
public int? refund_status { get; set; }
|
||||
|
||||
public void UpdateOrderItemBuyButton()
|
||||
{
|
||||
var order_item = this;
|
||||
order_item.Shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ErpShopId == order_item.shop_id.ParseToString());
|
||||
if (GlobalConfig.lstDangerItemWord.Any(d => order_item.title.Contains(d)))
|
||||
{
|
||||
order_item.IsBuyGoodsBtnEnabled = false;
|
||||
order_item.BuyGoodsBtnBackColor = new SolidColorBrush(Color.FromArgb(50, 250, 70, 51));
|
||||
order_item.BuyGoodsBtnColor = new SolidColorBrush(Color.FromArgb(255, 250, 70, 51));
|
||||
order_item.BuyGoodsBtnTxt = "危险品不支持中转拍单";
|
||||
}
|
||||
else if (Shop == null || (Shop?.LoginStatus != "登录成功" /*&& Shop?.Is29Supplier == null*/))
|
||||
{
|
||||
order_item.IsBuyGoodsBtnEnabled = false;
|
||||
//order_item.IsBuyGoodsBtnEnabled = true;
|
||||
order_item.BuyGoodsBtnBackColor = new SolidColorBrush(Color.FromArgb(50, 250, 70, 51));
|
||||
order_item.BuyGoodsBtnColor = new SolidColorBrush(Color.FromArgb(255, 250, 70, 51));
|
||||
order_item.BuyGoodsBtnTxt = "请登录店铺";
|
||||
}
|
||||
else if (Shop?.LoginStatus == "登录成功" && Shop?.Is29Supplier == null)
|
||||
{
|
||||
order_item.IsBuyGoodsBtnEnabled = false;
|
||||
order_item.BuyGoodsBtnBackColor = new SolidColorBrush(Color.FromArgb(50, 250, 127, 51));
|
||||
order_item.BuyGoodsBtnColor = new SolidColorBrush(Color.FromArgb(255, 250, 127, 51));
|
||||
order_item.BuyGoodsBtnTxt = "代发状态读取中请稍候";
|
||||
}
|
||||
else if (Shop?.Is29Supplier == false)
|
||||
{
|
||||
//order_item.IsBuyGoodsBtnEnabled = false;
|
||||
order_item.IsBuyGoodsBtnEnabled = true;
|
||||
order_item.BuyGoodsBtnBackColor = new SolidColorBrush(Color.FromArgb(50, 250, 70, 51));
|
||||
order_item.BuyGoodsBtnColor = new SolidColorBrush(Color.FromArgb(255, 250, 70, 51));
|
||||
order_item.BuyGoodsBtnTxt = "去店铺后台绑定代发";
|
||||
}
|
||||
else
|
||||
{
|
||||
order_item.IsBuyGoodsBtnEnabled = true;
|
||||
order_item.BuyGoodsBtnTxt = order_item.BuyMap == null ? "关联拍单" : "拍单";
|
||||
order_item.BuyGoodsBtnBackColor = new SolidColorBrush(Color.FromArgb(50, 152, 99, 143));
|
||||
order_item.BuyGoodsBtnColor = new SolidColorBrush(Color.FromArgb(255, 152, 99, 143));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user