/**
 * 成品服务
 * 冯海夫
 * 20201008
 */
var ServiceProduct = {
    // 待发货成品
    getWatingSendList: function () {
        return getService.methodGet("/fbsDispatchList/fbsDispatchList/getWatingSendList");
        // const productList = [];
        // productList.push({
        //     warehouseName: "A仓库",
        //     materialCode: "10001",
        //     materialName: "物料A",
        //     specs: "3*4",
        //     sendSum: "10",
        //     planSendDate: "09月18日"
        // });
        // productList.push({
        //     warehouseName: "A仓库",
        //     materialCode: "10002",
        //     materialName: "物料B",
        //     specs: "3*4",
        //     sendSum: "20",
        //     planSendDate: "09月18日"
        // });
        // productList.push({
        //     warehouseName: "A仓库",
        //     materialCode: "10003",
        //     materialName: "物料C",
        //     specs: "3*4",
        //     sendSum: "30",
        //     planSendDate: "09月18日"
        // });
        // productList.push({
        //     warehouseName: "B仓库",
        //     materialCode: "10004",
        //     materialName: "物料D",
        //     specs: "3*4",
        //     sendSum: "40",
        //     planSendDate: "09月18日"
        // });
        // productList.push({
        //     warehouseName: "B仓库",
        //     materialCode: "10005",
        //     materialName: "物料E",
        //     specs: "3*4",
        //     sendSum: "50",
        //     planSendDate: "09月18日"
        // });
        // productList.push({
        //     warehouseName: "B仓库",
        //     materialCode: "10006",
        //     materialName: "物料F",
        //     specs: "3*4",
        //     sendSum: "60",
        //     planSendDate: "09月18日"
        // });
        // return productList;
    },
    // 已入库数量
    getSendSum: function () {
        return getService.methodPost("/fbsDispatchList/fbsDispatchList/getSendSum");

        // return 9;
    },
    // 月成品出货统计,根据成品维度
    getMonthSend: function () {
        // return getService.methodGet("/fbsRdrecord32/fbsRdrecords32/getMonthSend");
        var map=getService.methodGet("/fbsDispatchLists/fbsDispatchLists/getProjectDelivery")
        if(map){
            var remainingQuantity=5-(Object.keys(map).length%5);
            if(remainingQuantity!=5){
                for(var i=0;i<remainingQuantity;i++){
                    var bu="补"+i
                    console.log(bu)
                    map[bu]="";
                }
            }
        }
        return map;

        // return {
        //     "成品A": 20,
        //     "成品B": 100,
        //     "成品C": 80,
        //     "成品D": 150,
        //     "成品E": 200,
        // };
    },
    // 月项目发货统计,根据项目维度
    getMonthSendByProject: function () {
        // return {
        //     "项目A": 20,
        //     "项目B": 100,
        //     "项目C": 80,
        //     "项目D": 150,
        //     "项目E": 200,
        // };
        var getMonthSendByProject=MethodGetService.methodGet("/fbsDispatchLists/fbsDispatchLists/getMonthSendByProject");
        return getMonthSendByProject;

    },
    // 成品库存,物料维度
    getStockList: function () {
        var map=getService.methodGet("/fbsInventory/fbsInventory/getAllStockList")
        if(map){
            var remainingQuantity=5-(Object.keys(map).length%5);
            if(remainingQuantity!=5){
                for(var i=0;i<remainingQuantity;i++){
                    var bu="补"+i
                    console.log(bu)
                    map[bu]="";
                }
            }
        }
        return map;

        // return {
        //     "成品A": 800,
        //     "成品B": 900,
        //     "成品C": 1000,
        //     "成品D": 700,
        //     "成品E": 600,
        //     "成品F": 1100,
        //     "成品G": 500
        // };

    },
    // 根据产品分类获取质量异常数量
    getQualityExceptionByCategory: function () {
        return MethodGetService.methodGet("/fbsWorkshopDispatchList/fbsWorkshopDispatchList/getAbnormalHoursMonthReport");
        // return {
        //     "分类A": 800,
        //     "分类B": 900,
        //     "分类C": 1000,
        //     "分类D": 700,
        //     "分类E": 600,
        //     "分类F": 1100,
        //     "分类G": 500
        // };
    },
    // 某月产品良数量
    getMonthGood: function () {
        // const list = [];
        // list.push({
        //     label: "产品A",
        //     sum1: 48,
        //     sum2: 50
        // });
        // list.push({
        //     label: "产品B",
        //     sum1: 80,
        //     sum2: 90
        // });
        // list.push({
        //     label: "产品C",
        //     sum1: 47,
        //     sum2: 50
        // });
        // list.push({
        //     label: "产品D",
        //     sum1: 40,
        //     sum2: 50
        // });
        // list.push({
        //     label: "产品E",
        //     sum1: 42,
        //     sum2: 50
        // });
        // list.push({
        //     label: "产品F",
        //     sum1: 44,
        //     sum2: 50
        // });
        // list.push({
        //     label: "产品G",
        //     sum1: 45,
        //     sum2: 50
        // });
        // return list;

        var list=MethodGetService.methodGet("/fbsAbnormalWorkingHours/fbsAbnormalWorkingHours/getRejectsNumber")
        if(list){
            var remainingQuantity=3-(list.length%3);
            if(remainingQuantity!=3){
                for(var i=0;i<remainingQuantity;i++){
                    var bu="补"+i
                    list.push({label: bu,sum1:0,sum2:0})
                }
            }
        }
        return list;
    },
    // 月制程异常,根据分类
    getMonthExceptionByCategory: function () {
        // return {
        //     "分类A": 600,
        //     "分类B": 500,
        //     "分类C": 300,
        //     "分类D": 200,
        //     "分类E": 100,
        //     "分类F": 200,
        //     "分类G": 400
        // };
        // return MethodGetService.methodGet("/fbsAbnormalWorkingHours/fbsAbnormalWorkingHours/getQualityType");
        // var map=MethodGetService.methodGet("/fbsAbnormalWorkingHours/fbsAbnormalWorkingHoursDescribe/getMonthExceptionByCategory")
        var list=MethodGetService.methodGet("/fbsAbnormalWorkingHours/fbsAbnormalWorkingHoursDescribe/getMonthExceptionByCategoryTwo")
        if(list){
            var remainingQuantity=3-(list.length%3);
            if(remainingQuantity!=3){
                for(var i=0;i<remainingQuantity;i++){
                    var bu="补"+i
                    list.push({label: bu,sum1:0,sum2:0})
                }
            }
        }
        return list;
    },
    // 周成品入库数量,根据分类
    getWeekInByCategory: function () {
        // return {
        //     "分类A": 500,
        //     "分类B": 600,
        //     "分类C": 800,
        //     "分类D": 700,
        //     "分类E": 600,
        //     "分类F": 400,
        //     "分类G": 500
        // };
        var map =MethodGetService.methodGet("/fbsMomOrder/fbsMomOrderdetail/getQualifiedInQtyWeek");
        if(map){
            var remainingQuantity=3-(Object.keys(map).length%3);
            if(remainingQuantity!=3){
                for(var i=0;i<remainingQuantity;i++){
                    var bu="补"+i
                    console.log(bu)
                    map[bu]="";
                }
            }
        }
        return map;
    },
    // 生产效率
    getProduceRate: function () {
        // const rate = 95;
        rate=MethodGetService.methodGet("/fbsWorkshopDispatchList/fbsWorkshopDispatchList/getProductionEfficiency");
        return {
            name: "当月生产效率",
            value: rate
        };

    },
    // 日生产效率
    getDayProduceRate: function () {
        // const rate = 90;
        rate=MethodGetService.methodGet("/fbsWorkshopDispatchList/fbsWorkshopDispatchList/getProductionEfficiency?type=1");
        return {
            name: "生产效率",
            value: rate
        };

    },
    // 某日产品良数量
    getDayGood: function () {
        // const list = [];
        // list.push({
        //     label: "产品A",
        //     sum1: 48,
        //     sum2: 50
        // });
        // list.push({
        //     label: "产品B",
        //     sum1: 80,
        //     sum2: 90
        // });
        // list.push({
        //     label: "产品C",
        //     sum1: 47,
        //     sum2: 50
        // });
        // list.push({
        //     label: "产品D",
        //     sum1: 40,
        //     sum2: 50
        // });
        // list.push({
        //     label: "产品E",
        //     sum1: 42,
        //     sum2: 50
        // });
        // list.push({
        //     label: "产品F",
        //     sum1: 44,
        //     sum2: 50
        // });
        // list.push({
        //     label: "产品G",
        //     sum1: 45,
        //     sum2: 50
        // });
        // return list;
        var list=MethodGetService.methodGet("/fbsAbnormalWorkingHours/fbsAbnormalWorkingHours/getRejectsNumber?type=1")
        if(list){
            var remainingQuantity=3-(list.length%3);
            if(remainingQuantity!=3){
                for(var i=0;i<remainingQuantity;i++){
                    var bu="补"+i
                    list.push({label: bu,sum1:0,sum2:0})
                }
            }
        }
        return list;
    },
    // 日质量异常,根据分类
    getDayExceptionByCategory: function () {
        // return {
        //     "分类A": 600,
        //     "分类B": 500,
        //     "分类C": 300,
        //     "分类D": 200,
        //     "分类E": 100,
        //     "分类F": 200,
        //     "分类G": 400
        // };
        return MethodGetService.methodGet("/fbsWorkshopDispatchList/fbsWorkshopDispatchList/getAbnormalHoursMonthReport?type=1");
    },
    


}