workhour.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /**
  2. * 工时服务
  3. * 冯海夫
  4. * 20201008
  5. */
  6. var ServiceWorkhour={
  7. // 根据物料统计
  8. getByMaterial:function(){
  9. var byMaterial=MethodGetService.methodGet("/workingStatistics/fbsWorkingStatistics/getByMaterial");
  10. if(!byMaterial){
  11. byMaterial={
  12. "生产":0
  13. }
  14. }
  15. return byMaterial;
  16. // return MethodGetService.methodGet("/fbsWorkshopDispatchList/fbsWorkshopDispatchList/getProductHoursMonthReport");
  17. // return {
  18. // "物料A 20*30":250,
  19. // "物料B 20*35":250,
  20. // "物料C 20*35":200,
  21. // "物料D 20*35":400,
  22. // };
  23. },
  24. // 当天根据物料统计
  25. getDayByMaterial:function(){
  26. // return {
  27. // "物料A":150,
  28. // "物料B":250,
  29. // "物料C":200,
  30. // "物料D":400,
  31. // };
  32. var map=MethodGetService.methodGet("/workingStatistics/fbsWorkingStatistics/getByMaterial?type=1");
  33. if(!map||Object.keys(map).length<=0){
  34. map={
  35. "生产":0
  36. }
  37. }
  38. return map;
  39. // return MethodGetService.methodGet("/fbsWorkshopDispatchList/fbsWorkshopDispatchList/getByMaterial?type=1");
  40. },
  41. // 获取物料的标准工时和实际工时
  42. getStandAndRealByMaterial:function(){
  43. var list = [];
  44. // list.push({productName:"产品A",standHour:15,realHour:20});
  45. // list.push({productName:"产品B",standHour:14,realHour:10});
  46. // list.push({productName:"产品C",standHour:18,realHour:17});
  47. // list.push({productName:"产品D",standHour:16,realHour:19});
  48. // list.push({productName:"产品E",standHour:13,realHour:12});
  49. // list.push({productName:"产品F",standHour:12,realHour:12});
  50. // list.push({productName:"产品G",standHour:17,realHour:20});
  51. list=MethodGetService.methodGet("/fbsWorkshopDispatchList/fbsWorkshopDispatchList/getWorkingHoursContrast");
  52. $.each(list, function(index,item){
  53. item.label = item.product;
  54. item.label1 = "标准工时";
  55. item.sum1 = item.standardWorkingHours;
  56. item.label2 = "实际工时";
  57. item.sum2 = item.manHoursCompleted;
  58. });
  59. return list;
  60. },
  61. // 获取当日物料的标准工时和实际工时
  62. getDayStandAndRealByMaterial:function(){
  63. // const list = [];
  64. // list.push({productName:"产品A",standHour:15,realHour:20});
  65. // list.push({productName:"产品B",standHour:14,realHour:10});
  66. // list.push({productName:"产品C",standHour:18,realHour:17});
  67. // list.push({productName:"产品D",standHour:16,realHour:19});
  68. // list.push({productName:"产品E",standHour:13,realHour:12});
  69. // list.push({productName:"产品F",standHour:12,realHour:12});
  70. // list.push({productName:"产品G",standHour:17,realHour:20});
  71. // $.each(list, function(index,item){
  72. // item.label = item.productName;
  73. // item.label1 = "标准工时";
  74. // item.sum1 = item.standHour;
  75. // item.label2 = "实际工时";
  76. // item.sum2 = item.realHour;
  77. // });
  78. var list=[];
  79. list=MethodGetService.methodGet("/fbsWorkshopDispatchList/fbsWorkshopDispatchList/getWorkingHoursContrast");
  80. $.each(list, function(index,item){
  81. item.label = item.product;
  82. item.label1 = "标准工时";
  83. item.sum1 = item.standardWorkingHours;
  84. item.label2 = "实际工时";
  85. item.sum2 = item.manHoursCompleted;
  86. });
  87. if(list&&list.length>0){
  88. var remainingQuantity=3-(list.length%3);
  89. if(remainingQuantity!=3){
  90. for(var i=0;i<remainingQuantity;i++){
  91. var bu="补"+i
  92. list.push({label:"",label1:"标准工时",sum1:0,label2:"实际工时",sum2:0})
  93. }
  94. }
  95. }else{
  96. list.push({label:"",label1:"标准工时",sum1:0,label2:"实际工时",sum2:0});
  97. list.push({label:"",label1:"标准工时",sum1:0,label2:"实际工时",sum2:0});
  98. list.push({label:"",label1:"标准工时",sum1:0,label2:"实际工时",sum2:0});
  99. }
  100. return list;
  101. }
  102. }