using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XYY.Common.Standard;
using XYY.Core.Standard.ExcelHelper.MSExcelHelper;

namespace XYY.Model.Standard.Order
{
    public class deliverySignCollectResult{
        public PageResult<deliverySignCollect> pageResult { get; set; }
        public TotalCollect totalCollect { get; set; }
    }
    public class TotalCollect {
        public int TotalCount { get; set; }
        public int OrderCount { get; set; }
        public int DeliveryCount { get; set; }
        public int SignCount { get; set; }
        public double SignRatio { get { return OrderCount == 0 ? 0 : ((SignCount / (double)DeliveryCount)); } }
        public int SignCount1 { get; set; }
        public double SignCount1Ratio { get { return OrderCount == 0 ? 0 : ((SignCount1 / (double)DeliveryCount)); } }
        public int SignCount2 { get; set; }
        public double SignCount2Ratio { get { return OrderCount == 0 ? 0 : ((SignCount2 / (double)DeliveryCount)); } }
        public int SignCount3 { get; set; }
        public double SignCount3Ratio { get { return OrderCount == 0 ? 0 : ((SignCount3 / (double)DeliveryCount)); } }
        public int SignCount4 { get; set; }
        public double SignCount4Ratio { get { return OrderCount == 0 ? 0 : ((SignCount4 / (double)DeliveryCount)); } }
        public int SignCount5 { get; set; }
        public double SignCount5Ratio { get { return OrderCount == 0 ? 0 : ((SignCount5 / (double)DeliveryCount)); } }
    }
    public class deliverySignCollect
    {
        public deliverySignCollect() {
            
        }
        public string TimeRange { get; set; }
        public int CreateOrderChannelId { get; set; }
        public string PublicName { get; set; }
        public int OrderCount { get; set; }
        public int DeliveryCount { get; set; }
        public int SignCount { get; set; }
        public double SignRatio { get { return OrderCount==0?0:((SignCount / (double)DeliveryCount)); } }
        public int SignCount1 { get; set; }
        public double SignCount1Ratio { get { return OrderCount == 0 ? 0 : ((SignCount1 / (double)DeliveryCount)); } }
        public int SignCount2 { get; set; }
        public double SignCount2Ratio { get { return OrderCount == 0 ? 0 : ((SignCount2 / (double)DeliveryCount)); } }
        public int SignCount3 { get; set; }
        public double SignCount3Ratio { get { return OrderCount == 0 ? 0 : ((SignCount3 / (double)DeliveryCount)); } }
        public int SignCount4 { get; set; }
        public double SignCount4Ratio { get { return OrderCount == 0 ? 0 : ((SignCount4 / (double)DeliveryCount)); } }
        public int SignCount5 { get; set; }
        public double SignCount5Ratio { get { return OrderCount == 0 ? 0 : ((SignCount5 / (double)DeliveryCount)); } }

    }
    public class deliverySignDetail 
    {
        public string TrackingNumber { get; set; }
        public string CustomerOrderNo { get; set; }
        public string SystemNo { get; set; }
        public DateTime OrderTime { get; set; }
        public string OrderTimeStr { get { return OrderTime.ToString("yyyy-MM-dd HH:mm:ss"); } }
        public DateTime? ReceiveTime { get; set; }
        public string ReceiveTimeStr { get { return ReceiveTime?.ToString("yyyy-MM-dd HH:mm:ss"); } }
        public string PublicName { get; set; }
        public DateTime? SignTime { get; set; }
        public string SignTimeStr { get { return SignTime?.ToString("yyyy-MM-dd HH:mm:ss"); } }
        public int? SignDay { get; set; }
        public string TraceStatus { get; set; }
        public string LastMessage { get; set; }
        public DateTime? TargetTime { get; set; }
        public string TargetTimeStr { get { return TargetTime?.ToString("yyyy-MM-dd HH:mm:ss"); } }
        public DateTime? LastGetTime { get; set; }
        public string LastGetTimeStr { get { return LastGetTime?.ToString("yyyy-MM-dd HH:mm:ss"); } }
        public DateTime? OnlineTime { get; set; }
        public string OnlineTimeStr { get { return OnlineTime?.ToString("yyyy-MM-dd HH:mm:ss"); } }
        public int KeppTime { get { return (DateTime.Now - (TargetTime ?? OrderTime)).Days; } }
    }
    public class OutDeliverySignDetailInfo : MSExcelClassMapping<deliverySignDetail>
    {
        public OutDeliverySignDetailInfo()
        {
            Map(x => x.TrackingNumber).Name("运单号");
            Map(x => x.CustomerOrderNo).Name("客单号");
            Map(x => x.SystemNo).Name("内部单号");
            Map(x => x.OrderTimeStr).Name("下单时间");
            Map(x => x.ReceiveTimeStr).Name("收货时间");
            Map(x => x.PublicName).Name("产品名称");
            Map(x => x.SignTimeStr).Name("签收时间");
            Map(x => x.SignDay).Name("签收天数");
            Map(x => x.TraceStatus).Name("当前状态");
            Map(x => x.LastMessage).Name("当前轨迹内容");
            Map(x => x.TargetTimeStr).Name("当前轨迹更新时间");
            Map(x => x.LastGetTimeStr).Name("最后抓取时间");
            Map(x => x.KeppTime).Name("当前状态持续天数");
        }
    }
    public class OutDeliverySignDetailInfoOnlineTime : MSExcelClassMapping<deliverySignDetail>
    {
        public OutDeliverySignDetailInfoOnlineTime()
        {
            Map(x => x.TrackingNumber).Name("运单号");
            Map(x => x.CustomerOrderNo).Name("客单号");
            Map(x => x.SystemNo).Name("内部单号");
            Map(x => x.OrderTimeStr).Name("下单时间");
            Map(x => x.ReceiveTimeStr).Name("收货时间");
            Map(x => x.PublicName).Name("产品名称");
            Map(x => x.SignTimeStr).Name("签收时间");
            Map(x => x.SignDay).Name("签收天数");
            Map(x => x.TraceStatus).Name("当前状态");
            Map(x => x.LastMessage).Name("当前轨迹内容");
            Map(x => x.TargetTimeStr).Name("当前轨迹更新时间");
            Map(x => x.OnlineTimeStr).Name("上网时间");
            Map(x => x.LastGetTimeStr).Name("最后抓取时间");
            Map(x => x.KeppTime).Name("当前状态持续天数");
        }
    }
}
