/** * 生产任务 * 冯海夫 * 20201008 */ document.write(""); var ServiceProduceTask = { // 计划完成情况 getCompleteInfo: function () { // return { // "已完成": 150, // "未完成": 250 // }; return MethodGetService.methodGet("/fbsMomOrder/fbsMomOrderdetail/getFbsMomOrderdetailSum"); }, // 日计划完成情况 getDayCompleteInfo: function () { // return { // "已完成": 150, // "未完成": 250 // }; var map=MethodGetService.methodGet("/fbsWorkshopDispatchList/fbsWorkshopDispatchList/getAchievementRate"); if(!map||Object.keys(map).length<=0){ map={ "未完成":100 } } return map; }, // 月度生产计划 getMonthList: function () { // const taskList = []; // taskList.push({ // projectName: "项目1", // orderSheetCode: "G10001", // materialCode: "10001", // materialName: "物料A", // specs: "3*4", // planSum: 30, // workHour: 60, // completeSum: 15 // }); // taskList.push({ // projectName: "项目1", // orderSheetCode: "G10002", // materialCode: "10002", // materialName: "物料B", // specs: "3*4", // planSum: 20, // workHour: 50, // completeSum: 18 // }); // taskList.push({ // projectName: "项目1", // orderSheetCode: "G10003", // materialCode: "10003", // materialName: "物料C", // specs: "3*4", // planSum: 90, // workHour: 10, // completeSum: 60 // }); // taskList.push({ // projectName: "项目1", // orderSheetCode: "G10001", // materialCode: "10001", // materialName: "物料A", // specs: "3*4", // planSum: 30, // workHour: 60, // completeSum: 15 // }); // taskList.push({ // projectName: "项目1", // orderSheetCode: "G10002", // materialCode: "10002", // materialName: "物料B", // specs: "3*4", // planSum: 20, // workHour: 50, // completeSum: 18 // }); // taskList.push({ // projectName: "项目1", // orderSheetCode: "G10003", // materialCode: "10003", // materialName: "物料C", // specs: "3*4", // planSum: 90, // workHour: 10, // completeSum: 60 // }); // taskList.push({ // projectName: "项目1", // orderSheetCode: "G10001", // materialCode: "10001", // materialName: "物料A", // specs: "3*4", // planSum: 30, // workHour: 60, // completeSum: 15 // }); // taskList.push({ // projectName: "项目1", // orderSheetCode: "G10002", // materialCode: "10002", // materialName: "物料B", // specs: "3*4", // planSum: 20, // workHour: 50, // completeSum: 18 // }); var taskList=MethodGetService.methodGet("/fbsMomOrder/fbsMomOrderdetail/getMonthList"); taskList.forEach(element=>{ element.projectName= "项目1", element.orderSheetCode= element.mocode, element.materialCode=element.cinvcode, element.materialName=element.cinvname, element.specs=element.cinvstd, element.planSum=element.qty, element.workHour= (element.cinvDefine13*element.qty).toFixed(2), element.completeSum=element.qualifiedinqty, element.manHoursInvested=element.manHoursInvested }) $.each(taskList, function (index, item) { item.incompleteSum = item.planSum - item.completeSum; if (item.incompleteSum < 0) item.incompleteSum = 0; item.completePercent = (item.completeSum / item.planSum * 100).toFixed(0); item.incompletePercent = (100 - item.completePercent) + "%"; item.completePercent = item.completePercent + "%"; }); return taskList; }, // 日生产计划 getDayList: function () { // const taskList = []; // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10001", // materialCode: "10001", // materialName: "物料A", // specs: "3*4", // planSum: 30, // workHour: 60, // completeSum: 15 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10002", // materialCode: "10002", // materialName: "物料B", // specs: "3*4", // planSum: 20, // workHour: 50, // completeSum: 18 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10003", // materialCode: "10003", // materialName: "物料C", // specs: "3*4", // planSum: 90, // workHour: 10, // completeSum: 60 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10001", // materialCode: "10001", // materialName: "物料A", // specs: "3*4", // planSum: 30, // workHour: 60, // completeSum: 15 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10002", // materialCode: "10002", // materialName: "物料B", // specs: "3*4", // planSum: 20, // workHour: 50, // completeSum: 18 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10003", // materialCode: "10003", // materialName: "物料C", // specs: "3*4", // planSum: 90, // workHour: 10, // completeSum: 60 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10001", // materialCode: "10001", // materialName: "物料A", // specs: "3*4", // planSum: 30, // workHour: 60, // completeSum: 15 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10002", // materialCode: "10002", // materialName: "物料B", // specs: "3*4", // planSum: 20, // workHour: 50, // completeSum: 18 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10001", // materialCode: "10001", // materialName: "物料A", // specs: "3*4", // planSum: 30, // workHour: 60, // completeSum: 15 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10002", // materialCode: "10002", // materialName: "物料B", // specs: "3*4", // planSum: 20, // workHour: 50, // completeSum: 18 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10003", // materialCode: "10003", // materialName: "物料C", // specs: "3*4", // planSum: 90, // workHour: 10, // completeSum: 60 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10001", // materialCode: "10001", // materialName: "物料A", // specs: "3*4", // planSum: 30, // workHour: 60, // completeSum: 15 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10002", // materialCode: "10002", // materialName: "物料B", // specs: "3*4", // planSum: 20, // workHour: 50, // completeSum: 18 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10003", // materialCode: "10003", // materialName: "物料C", // specs: "3*4", // planSum: 90, // workHour: 10, // completeSum: 60 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10001", // materialCode: "10001", // materialName: "物料A", // specs: "3*4", // planSum: 30, // workHour: 60, // completeSum: 15 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10002", // materialCode: "10002", // materialName: "物料B", // specs: "3*4", // planSum: 20, // workHour: 50, // completeSum: 18 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10001", // materialCode: "10001", // materialName: "物料A", // specs: "3*4", // planSum: 30, // workHour: 60, // completeSum: 15 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10002", // materialCode: "10002", // materialName: "物料B", // specs: "3*4", // planSum: 20, // workHour: 50, // completeSum: 18 // }); // taskList.push({ // projectCode:"项目001", // orderSheetCode: "G10003", // materialCode: "10003", // materialName: "物料C", // specs: "3*4", // planSum: 90, // workHour: 10, // completeSum: 60 // }); // var taskList=MethodGetService.methodGet("/fbsMomOrder/fbsMomOrderdetail/getDayList"); var taskList=MethodGetService.methodGet("/fbsWorkshopDispatchList/fbsWorkshopDispatchList/getListNotStarted"); taskList.forEach(element=>{ element.orderSheetCode= element.productionOrderNumberName element.materialCode=element.productId element.materialName=element.product // element.specs=element.cinvstd, element.planSum=element.numberOfTasks element.workHour= element.standardWorkingHours // element.completeSum=element.qualifiedinqty if(element.state==='0'){ element.stateName="派工"; element.color="yellow"; } if(element.state==='1'){ element.stateName="上岗"; element.color="green"; } if(element.state==='2'){ element.stateName="暂停"; element.color="red"; } if(element.state==='3'&&element.latestCompletedQuantity!==element.numberOfTasks){ element.stateName="进行中"; element.color="green"; } }) $.each(taskList, function (index, item) { item.incompleteSum = item.planSum - item.completeSum; if (item.incompleteSum < 0) item.incompleteSum = 0; item.completePercent = (item.completeSum / item.planSum * 100).toFixed(0); item.incompletePercent = (100 - item.completePercent) + "%"; item.completePercent = item.completePercent + "%"; //当天的 //达成率处理 if(!item.achievementRate){ item.achievementRate=0 } //生产率处理 if(!item.productionEfficiency||Number(item.latestCompletedQuantity)===0){ item.productionEfficiency=0.00 } }); return taskList; }, //项目进度完工百分比 getProjectScheduleCompletion:function(){ // var projectScheduleCompletionList=MethodGetService.methodGet("/fbsWorkshopDispatchList/fbsWorkshopDispatchList/getProjectScheduleCompletion"); var projectScheduleCompletionList=MethodGetService.methodGet("/fbsMomOrder/fbsMomOrderdetail/getMonthListGroupDefine12"); projectScheduleCompletionList.forEach(item => { // if(!item.numberOfTasks){ // item.numberOfTasks=0; // } // if(!item.latestCompletedQuantity){ // item.latestCompletedQuantity=0; // } // item.incompleteSum = item.numberOfTasks - item.latestCompletedQuantity; // if (item.incompleteSum < 0) // item.incompleteSum = 0; // item.completePercent = (item.latestCompletedQuantity / item.numberOfTasks * 100).toFixed(0); // item.incompletePercent = (100 - item.completePercent) + "%"; // item.completePercent = item.completePercent + "%"; }); projectScheduleCompletionList.forEach(element=>{ element.projectName= "项目1", element.orderSheetCode= element.mocode, element.materialCode=element.cinvcode, element.materialName=element.cinvname, element.specs=element.cinvstd, element.planSum=element.qty, element.workHour= element.cinvDefine13, element.completeSum=element.qualifiedinqty, element.manHoursInvested=element.manHoursInvested }) $.each(projectScheduleCompletionList, function (index, item) { item.incompleteSum = item.planSum - item.completeSum; if (item.incompleteSum < 0) item.incompleteSum = 0; item.completePercent = (item.completeSum / item.planSum * 100).toFixed(0); item.incompletePercent = (100 - item.completePercent) + "%"; item.completePercent = item.completePercent + "%"; }); return projectScheduleCompletionList; }, // 获取到现在为止在进行订单或者项目 getDoingListByOrder: function () { // const taskList = []; // taskList.push({ // materialName: "节能灯", // specs: "HID 200W with Osram", // planSum: 30, // completeSum: 15, // projectName:"", // orderCode:"O0001", // planCompleteDate:"2020-10-1" // }); // taskList.push({ // materialName: "节能灯", // specs: "HID 100W with Osram", // planSum: 40, // completeSum: 10, // projectName:"希望小学工程", // orderCode:"", // planCompleteDate:"2020-10-20" // }); // taskList.push({ // materialName: "节能灯", // specs: "HID 500W", // planSum: 50, // completeSum: 40, // projectName:"", // orderCode:"O0002", // planCompleteDate:"2020-10-20" // }); // taskList.push({ // materialName: "节能灯", // specs: "HID 13W", // planSum: 50, // completeSum: 30, // projectName:"市政工程", // orderCode:"", // planCompleteDate:"2020-10-20" // }); // taskList.push({ // materialName: "节能灯", // specs: "HID 100W with Osram", // planSum: 40, // completeSum: 20, // projectName:"", // orderCode:"O0003", // planCompleteDate:"2020-10-20" // }); // taskList.push({ // materialName: "节能灯", // specs: "HID 100W with Osram", // planSum: 40, // completeSum: 10, // projectName:"希望小学工程", // orderCode:"", // planCompleteDate:"2020-10-20" // }); Date.prototype.Format = function (fmt) { //author: meizz var o = { "M+": this.getMonth() + 1, //月份 "d+": this.getDate(), //日 "h+": this.getHours(), //小时 "m+": this.getMinutes(), //分 "s+": this.getSeconds(), //秒 "q+": Math.floor((this.getMonth() + 3) / 3), //季度 "S": this.getMilliseconds() //毫秒 }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); return fmt; } let taskList=MethodGetService.methodGet("/fbsWorkshopDispatchList/fbsWorkshopDispatchList/getDoingListByOrder"); taskList.forEach(element => { element.materialName=element.product; element.productId=element.productId; if(element.cinvstd){ element.specs=element.cinvstd; }else{ element.specs=""; } element.planSum=element.numberOfTasks; if(element.latestCompletedQuantity){ element.completeSum=element.latestCompletedQuantity; }else{ element.completeSum=0; } element.projectName=element.productionOrderNumberName; element.orderCode=element.productionOrderNumberName; if(element.plannedStartTime&&element.plannedEndTime){ var s = new Date(element.plannedStartTime);//计划开工时间 var e = new Date(element.plannedEndTime);//计划完成时间 element.planCompleteDate=s.Format("MM-dd")+"至"+e.Format("MM-dd"); }else{ element.planCompleteDate=""; } }); console.log(JSON.parse(JSON.stringify(taskList)) ); $.each(taskList, function (index, item) { item.incompleteSum = item.planSum - item.completeSum; if (item.incompleteSum < 0) item.incompleteSum = 0; item.completePercent = (item.completeSum / item.planSum * 100).toFixed(0); item.incompletePercent = (100 - item.completePercent) + "%"; item.completePercent = item.completePercent + "%"; const dateNow = DateOperation.formatDate(new Date(), "YYYY-mm-dd"); if(item.plannedEndTime){ item.bgcss = DateOperation.subtraction(item.plannedEndTime, dateNow, "s")>0?"task-block-timeout":"task-block-normal"; }else{ item.bgcss="task-block-normal"; } item.displayName = item.projectName == "" ? item.orderCode : item.projectName; // item.technologicalList=[{aa:"工单",bb:"1"},{aa:"工单",bb:"1"},{aa:"工单",bb:"2"}] }); return taskList; }, // 日生产计划 getEsopTaskList: function () { return getService.methodGet("/fbsMomOrder/fbsMomOrder/getEsopTaskList"); // const taskList = []; // taskList.push({ // orderSheetCode: "G10001", // materialCode: "10001", // materialName: "物料A", // specs: "3*4", // ProjectName: "项目A", // files:[ // {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/1.pdf"} // ] // }); // taskList.push({ // orderSheetCode: "G10002", // materialCode: "10002", // materialName: "物料B", // specs: "3*4", // ProjectName: "项目B", // files:[ // {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/2.pdf"} // ] // }); // taskList.push({ // orderSheetCode: "G10001", // materialCode: "10001", // materialName: "物料A", // specs: "3*4", // ProjectName: "项目A", // files:[ // {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/1.pdf"} // ] // }); // taskList.push({ // orderSheetCode: "G10002", // materialCode: "10002", // materialName: "物料B", // specs: "3*4", // ProjectName: "项目B", // files:[ // {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/2.pdf"} // ] // }); // taskList.push({ // orderSheetCode: "G10001", // materialCode: "10001", // materialName: "物料A", // specs: "3*4", // ProjectName: "项目A", // files:[ // {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/1.pdf"} // ] // }); // taskList.push({ // orderSheetCode: "G10002", // materialCode: "10002", // materialName: "物料B", // specs: "3*4", // ProjectName: "项目B", // files:[ // {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/2.pdf"} // ] // }); // taskList.push({ // orderSheetCode: "G10001", // materialCode: "10001", // materialName: "物料A", // specs: "3*4", // ProjectName: "项目A", // files:[ // {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/1.pdf"} // ] // }); // taskList.push({ // orderSheetCode: "G10002", // materialCode: "10002", // materialName: "物料B", // specs: "3*4", // ProjectName: "项目B", // files:[ // {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/2.pdf"} // ] // }); // taskList.push({ // orderSheetCode: "G10001", // materialCode: "10001", // materialName: "物料A", // specs: "3*4", // ProjectName: "项目A", // files:[ // {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/1.pdf"} // ] // }); // taskList.push({ // orderSheetCode: "G10002", // materialCode: "10002", // materialName: "物料B", // specs: "3*4", // ProjectName: "项目B", // files:[ // {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/2.pdf"} // ] // }); // taskList.push({ // orderSheetCode: "G10001", // materialCode: "10001", // materialName: "物料A", // specs: "3*4", // ProjectName: "项目A", // files:[ // {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/1.pdf"} // ] // }); // taskList.push({ // orderSheetCode: "G10002", // materialCode: "10002", // materialName: "物料B", // specs: "3*4", // ProjectName: "项目B", // files:[ // {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/2.pdf"} // ] // }); // return taskList; }, //文件列表 getEsopFileList:function(code,moCode){ return getService.methodGet("/workingStatistics/fbsWorkingStatistics/getEsopFileList?code="+code+"&moCode="+moCode); }, //视频自动播放 getVedioFileList:function(){ return getService.methodGet("/workingStatistics/fbsWorkingStatistics/getVedioFileList"); } }