//
//  M_Workbench.swift
//  VattiCSS
//
//  Created by WZR on 2023/8/24.
//

import Foundation

class M_Workbench: NSObject {
    //----------服务人员工作台数据
    ///服务人员工单台sendpay
    var workerOrderSendpay = "" {
        didSet{
            workerOrderSendpayArr = workerOrderSendpay.enumerated().compactMap({String($0.element)})
        }
    }
    var workerOrderSendpayArr:[String] = []
    ///服务人员配件台sendpay
    var workerPartsSendpay = "" {
        didSet{
            workerPartsSendpayArr = workerPartsSendpay.enumerated().compactMap({String($0.element)})
        }
    }
    var workerPartsSendpayArr:[String] = []
    ///服务人员结算台sendpay
    var workerSettleSendpay = "" {
        didSet{
            workerSettleSendpayArr = workerSettleSendpay.enumerated().compactMap({String($0.element)})
        }
    }
    var workerSettleSendpayArr:[String] = []

    ///待预约数量
    var unBookQty = 0
    ///待上门数量
    var unOnDoorQty = 0
    ///待完工数量
    var unFinishQty = 0
    ///待确认(完工)数量
    var unComfirmEngineerFinishQty = 0
    ///待备件数量
    var waitPartsQty = 0
    ///送修中数量
    var inDeliveryFixQty = 0
    ///退换中数量
    var inChangeQty = 0
    ///待申诉数量
    var unComplainOrderQty = 0

    ///申请待发货数量
    var waitDeliveryPartsQty = 0
    ///已发货待签收数量
    var unSignPartsQty = 0
    ///旧件待核销数量
    var unReturnPartsQty = 0
    ///待申诉考核单数量
    var unComplainCheckBillQty = 0
    ///等待审核(结算单)数量
    var waitCheckSettleQty = 0
    ///待开发票数量
    var unMakeInvoiceQty = 0
    ///到款确认数量
    var unPaymentReceivedQty = 0

    //----------企业用户工作台数据
    ///企业用户工程任务sendpay
    var adminTaskSendpay = "" {
        didSet{
            adminTaskSendpayArr = adminTaskSendpay.enumerated().compactMap({String($0.element)})
        }
    }
    var adminTaskSendpayArr:[String] = []
    ///企业用户工单管理sendpay
    var adminOrderSendpay = "" {
        didSet{
            adminOrderSendpayArr = adminOrderSendpay.enumerated().compactMap({String($0.element)})
        }
    }
    var adminOrderSendpayArr:[String] = []
    ///企业用户配件管理sendpay
    var adminPartsSendpay = "" {
        didSet{
            adminPartsSendpayArr = adminPartsSendpay.enumerated().compactMap({String($0.element)})
        }
    }
    var adminPartsSendpayArr:[String] = []
    ///企业用户结算管理sendpay
    var adminSettleSendpay = "" {
        didSet{
            adminSettleSendpayArr = adminSettleSendpay.enumerated().compactMap({String($0.element)})
        }
    }
    var adminSettleSendpayArr:[String] = []

    ///今日任务
    var todayTastQty = 0
    ///执行中任务
    var exeTastQty = 0

    ///待派工
    var unTakeSiteQty = 0
    ///待确认完工数量
    var unComfirmSiteFinishQty = 0
    ///待申诉审核数量
    var unComplainCheckOrderQty = 0

    ///待审核数量
    var unCheckPartsQty = 0
    ///待发货数量
    var unDeliveryPartsQty = 0
    ///核销待审核数量
    var unReturnPartsCheckQty = 0

    ///考核待审核数量
    var unCheckBillQty = 0
    ///结算待审核数量
    var unCheckSettleQty = 0

    
    init(_ data:[String:Any] = [:]) {
//        let sendPayArr = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]
        //---------服务人员工作台数据
        workerOrderSendpay = data.stringValue(forKey: "workerOrderSendpay")
        workerPartsSendpay = data.stringValue(forKey: "workerPartsSendpay")
        workerSettleSendpay = data.stringValue(forKey: "workerSettleSendpay")
        workerOrderSendpayArr = workerOrderSendpay.enumerated().compactMap({String($0.element)})
        workerPartsSendpayArr = workerPartsSendpay.enumerated().compactMap({String($0.element)})
        workerSettleSendpayArr = workerSettleSendpay.enumerated().compactMap({String($0.element)})
        
        unBookQty = data.intValue(forKey: "unBookQty")
        unOnDoorQty = data.intValue(forKey: "unOnDoorQty")
        unFinishQty = data.intValue(forKey: "unFinishQty")
        unComfirmEngineerFinishQty = data.intValue(forKey: "unComfirmEngineerFinishQty")
        waitPartsQty = data.intValue(forKey: "waitPartsQty")
        inDeliveryFixQty = data.intValue(forKey: "inDeliveryFixQty")
        inChangeQty = data.intValue(forKey: "inChangeQty")
        unComplainOrderQty = data.intValue(forKey: "unComplainOrderQty")

        waitDeliveryPartsQty = data.intValue(forKey: "waitDeliveryPartsQty")
        unSignPartsQty = data.intValue(forKey: "unSignPartsQty")
        unReturnPartsQty = data.intValue(forKey: "unReturnPartsQty")
        unComplainCheckBillQty = data.intValue(forKey: "unComplainCheckBillQty")
        waitCheckSettleQty = data.intValue(forKey: "waitCheckSettleQty")
        unMakeInvoiceQty = data.intValue(forKey: "unMakeInvoiceQty")
        unPaymentReceivedQty = data.intValue(forKey: "unPaymentReceivedQty")

        //----------企业用户工作台数据
        adminTaskSendpay = data.stringValue(forKey: "adminTaskSendpay")
        adminOrderSendpay = data.stringValue(forKey: "adminOrderSendpay")
        adminPartsSendpay = data.stringValue(forKey: "adminPartsSendpay")
        adminSettleSendpay = data.stringValue(forKey: "adminSettleSendpay")
        adminTaskSendpayArr = adminTaskSendpay.enumerated().compactMap({String($0.element)})
        adminOrderSendpayArr = adminOrderSendpay.enumerated().compactMap({String($0.element)})
        adminPartsSendpayArr = adminPartsSendpay.enumerated().compactMap({String($0.element)})
        adminSettleSendpayArr = adminSettleSendpay.enumerated().compactMap({String($0.element)})

        todayTastQty = data.intValue(forKey: "todayTastQty")
        exeTastQty = data.intValue(forKey: "exeTastQty")

        unTakeSiteQty = data.intValue(forKey: "unTakeSiteQty")
        unComfirmSiteFinishQty = data.intValue(forKey: "unComfirmSiteFinishQty")
        unComplainCheckOrderQty = data.intValue(forKey: "unComplainCheckOrderQty")

        unCheckPartsQty = data.intValue(forKey: "unCheckPartsQty")
        unDeliveryPartsQty = data.intValue(forKey: "unDeliveryPartsQty")
        unReturnPartsCheckQty = data.intValue(forKey: "unReturnPartsCheckQty")

        unCheckBillQty = data.intValue(forKey: "unCheckBillQty")
        unCheckSettleQty = data.intValue(forKey: "unCheckSettleQty")
    }
}
