produce-task.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. /**
  2. * 生产任务
  3. * 冯海夫
  4. * 20201008
  5. */
  6. document.write("<script type='text/javascript' src='/js/util/dateoperation.js'></script>");
  7. var ServiceProduceTask = {
  8. // 计划完成情况
  9. getCompleteInfo: function () {
  10. // return {
  11. // "已完成": 150,
  12. // "未完成": 250
  13. // };
  14. return MethodGetService.methodGet("/fbsMomOrder/fbsMomOrderdetail/getFbsMomOrderdetailSum");
  15. },
  16. // 日计划完成情况
  17. getDayCompleteInfo: function () {
  18. // return {
  19. // "已完成": 150,
  20. // "未完成": 250
  21. // };
  22. return MethodGetService.methodGet("/fbsWorkshopDispatchList/fbsWorkshopDispatchList/getAchievementRate");
  23. },
  24. // 月度生产计划
  25. getMonthList: function () {
  26. const taskList = [];
  27. taskList.push({
  28. projectName: "项目1",
  29. orderSheetCode: "G10001",
  30. materialCode: "10001",
  31. materialName: "物料A",
  32. specs: "3*4",
  33. planSum: 30,
  34. workHour: 60,
  35. completeSum: 15
  36. });
  37. taskList.push({
  38. projectName: "项目1",
  39. orderSheetCode: "G10002",
  40. materialCode: "10002",
  41. materialName: "物料B",
  42. specs: "3*4",
  43. planSum: 20,
  44. workHour: 50,
  45. completeSum: 18
  46. });
  47. taskList.push({
  48. projectName: "项目1",
  49. orderSheetCode: "G10003",
  50. materialCode: "10003",
  51. materialName: "物料C",
  52. specs: "3*4",
  53. planSum: 90,
  54. workHour: 10,
  55. completeSum: 60
  56. });
  57. taskList.push({
  58. projectName: "项目1",
  59. orderSheetCode: "G10001",
  60. materialCode: "10001",
  61. materialName: "物料A",
  62. specs: "3*4",
  63. planSum: 30,
  64. workHour: 60,
  65. completeSum: 15
  66. });
  67. taskList.push({
  68. projectName: "项目1",
  69. orderSheetCode: "G10002",
  70. materialCode: "10002",
  71. materialName: "物料B",
  72. specs: "3*4",
  73. planSum: 20,
  74. workHour: 50,
  75. completeSum: 18
  76. });
  77. taskList.push({
  78. projectName: "项目1",
  79. orderSheetCode: "G10003",
  80. materialCode: "10003",
  81. materialName: "物料C",
  82. specs: "3*4",
  83. planSum: 90,
  84. workHour: 10,
  85. completeSum: 60
  86. });
  87. taskList.push({
  88. projectName: "项目1",
  89. orderSheetCode: "G10001",
  90. materialCode: "10001",
  91. materialName: "物料A",
  92. specs: "3*4",
  93. planSum: 30,
  94. workHour: 60,
  95. completeSum: 15
  96. });
  97. taskList.push({
  98. projectName: "项目1",
  99. orderSheetCode: "G10002",
  100. materialCode: "10002",
  101. materialName: "物料B",
  102. specs: "3*4",
  103. planSum: 20,
  104. workHour: 50,
  105. completeSum: 18
  106. });
  107. $.each(taskList, function (index, item) {
  108. item.incompleteSum = item.planSum - item.completeSum;
  109. if (item.incompleteSum < 0)
  110. item.incompleteSum = 0;
  111. item.completePercent = (item.completeSum / item.planSum * 100).toFixed(0);
  112. item.incompletePercent = (100 - item.completePercent) + "%";
  113. item.completePercent = item.completePercent + "%";
  114. });
  115. return taskList;
  116. },
  117. // 日生产计划
  118. getDayList: function () {
  119. const taskList = [];
  120. taskList.push({
  121. projectCode:"项目001",
  122. orderSheetCode: "G10001",
  123. materialCode: "10001",
  124. materialName: "物料A",
  125. specs: "3*4",
  126. planSum: 30,
  127. workHour: 60,
  128. completeSum: 15
  129. });
  130. taskList.push({
  131. projectCode:"项目001",
  132. orderSheetCode: "G10002",
  133. materialCode: "10002",
  134. materialName: "物料B",
  135. specs: "3*4",
  136. planSum: 20,
  137. workHour: 50,
  138. completeSum: 18
  139. });
  140. taskList.push({
  141. projectCode:"项目001",
  142. orderSheetCode: "G10003",
  143. materialCode: "10003",
  144. materialName: "物料C",
  145. specs: "3*4",
  146. planSum: 90,
  147. workHour: 10,
  148. completeSum: 60
  149. });
  150. taskList.push({
  151. projectCode:"项目001",
  152. orderSheetCode: "G10001",
  153. materialCode: "10001",
  154. materialName: "物料A",
  155. specs: "3*4",
  156. planSum: 30,
  157. workHour: 60,
  158. completeSum: 15
  159. });
  160. taskList.push({
  161. projectCode:"项目001",
  162. orderSheetCode: "G10002",
  163. materialCode: "10002",
  164. materialName: "物料B",
  165. specs: "3*4",
  166. planSum: 20,
  167. workHour: 50,
  168. completeSum: 18
  169. });
  170. taskList.push({
  171. projectCode:"项目001",
  172. orderSheetCode: "G10003",
  173. materialCode: "10003",
  174. materialName: "物料C",
  175. specs: "3*4",
  176. planSum: 90,
  177. workHour: 10,
  178. completeSum: 60
  179. });
  180. taskList.push({
  181. projectCode:"项目001",
  182. orderSheetCode: "G10001",
  183. materialCode: "10001",
  184. materialName: "物料A",
  185. specs: "3*4",
  186. planSum: 30,
  187. workHour: 60,
  188. completeSum: 15
  189. });
  190. taskList.push({
  191. projectCode:"项目001",
  192. orderSheetCode: "G10002",
  193. materialCode: "10002",
  194. materialName: "物料B",
  195. specs: "3*4",
  196. planSum: 20,
  197. workHour: 50,
  198. completeSum: 18
  199. });
  200. taskList.push({
  201. projectCode:"项目001",
  202. orderSheetCode: "G10001",
  203. materialCode: "10001",
  204. materialName: "物料A",
  205. specs: "3*4",
  206. planSum: 30,
  207. workHour: 60,
  208. completeSum: 15
  209. });
  210. taskList.push({
  211. projectCode:"项目001",
  212. orderSheetCode: "G10002",
  213. materialCode: "10002",
  214. materialName: "物料B",
  215. specs: "3*4",
  216. planSum: 20,
  217. workHour: 50,
  218. completeSum: 18
  219. });
  220. taskList.push({
  221. projectCode:"项目001",
  222. orderSheetCode: "G10003",
  223. materialCode: "10003",
  224. materialName: "物料C",
  225. specs: "3*4",
  226. planSum: 90,
  227. workHour: 10,
  228. completeSum: 60
  229. });
  230. taskList.push({
  231. projectCode:"项目001",
  232. orderSheetCode: "G10001",
  233. materialCode: "10001",
  234. materialName: "物料A",
  235. specs: "3*4",
  236. planSum: 30,
  237. workHour: 60,
  238. completeSum: 15
  239. });
  240. taskList.push({
  241. projectCode:"项目001",
  242. orderSheetCode: "G10002",
  243. materialCode: "10002",
  244. materialName: "物料B",
  245. specs: "3*4",
  246. planSum: 20,
  247. workHour: 50,
  248. completeSum: 18
  249. });
  250. taskList.push({
  251. projectCode:"项目001",
  252. orderSheetCode: "G10003",
  253. materialCode: "10003",
  254. materialName: "物料C",
  255. specs: "3*4",
  256. planSum: 90,
  257. workHour: 10,
  258. completeSum: 60
  259. });
  260. taskList.push({
  261. projectCode:"项目001",
  262. orderSheetCode: "G10001",
  263. materialCode: "10001",
  264. materialName: "物料A",
  265. specs: "3*4",
  266. planSum: 30,
  267. workHour: 60,
  268. completeSum: 15
  269. });
  270. taskList.push({
  271. projectCode:"项目001",
  272. orderSheetCode: "G10002",
  273. materialCode: "10002",
  274. materialName: "物料B",
  275. specs: "3*4",
  276. planSum: 20,
  277. workHour: 50,
  278. completeSum: 18
  279. });
  280. taskList.push({
  281. projectCode:"项目001",
  282. orderSheetCode: "G10001",
  283. materialCode: "10001",
  284. materialName: "物料A",
  285. specs: "3*4",
  286. planSum: 30,
  287. workHour: 60,
  288. completeSum: 15
  289. });
  290. taskList.push({
  291. projectCode:"项目001",
  292. orderSheetCode: "G10002",
  293. materialCode: "10002",
  294. materialName: "物料B",
  295. specs: "3*4",
  296. planSum: 20,
  297. workHour: 50,
  298. completeSum: 18
  299. });
  300. taskList.push({
  301. projectCode:"项目001",
  302. orderSheetCode: "G10003",
  303. materialCode: "10003",
  304. materialName: "物料C",
  305. specs: "3*4",
  306. planSum: 90,
  307. workHour: 10,
  308. completeSum: 60
  309. });
  310. $.each(taskList, function (index, item) {
  311. item.incompleteSum = item.planSum - item.completeSum;
  312. if (item.incompleteSum < 0)
  313. item.incompleteSum = 0;
  314. item.completePercent = (item.completeSum / item.planSum * 100).toFixed(0);
  315. item.incompletePercent = (100 - item.completePercent) + "%";
  316. item.completePercent = item.completePercent + "%";
  317. });
  318. return taskList;
  319. },
  320. // 获取到现在为止在进行订单或者项目
  321. getDoingListByOrder: function () {
  322. // const taskList = [];
  323. // taskList.push({
  324. // materialName: "节能灯",
  325. // specs: "HID 200W with Osram",
  326. // planSum: 30,
  327. // completeSum: 15,
  328. // projectName:"",
  329. // orderCode:"O0001",
  330. // planCompleteDate:"2020-10-1"
  331. // });
  332. // taskList.push({
  333. // materialName: "节能灯",
  334. // specs: "HID 100W with Osram",
  335. // planSum: 40,
  336. // completeSum: 10,
  337. // projectName:"希望小学工程",
  338. // orderCode:"",
  339. // planCompleteDate:"2020-10-20"
  340. // });
  341. // taskList.push({
  342. // materialName: "节能灯",
  343. // specs: "HID 500W",
  344. // planSum: 50,
  345. // completeSum: 40,
  346. // projectName:"",
  347. // orderCode:"O0002",
  348. // planCompleteDate:"2020-10-20"
  349. // });
  350. // taskList.push({
  351. // materialName: "节能灯",
  352. // specs: "HID 13W",
  353. // planSum: 50,
  354. // completeSum: 30,
  355. // projectName:"市政工程",
  356. // orderCode:"",
  357. // planCompleteDate:"2020-10-20"
  358. // });
  359. // taskList.push({
  360. // materialName: "节能灯",
  361. // specs: "HID 100W with Osram",
  362. // planSum: 40,
  363. // completeSum: 20,
  364. // projectName:"",
  365. // orderCode:"O0003",
  366. // planCompleteDate:"2020-10-20"
  367. // });
  368. // taskList.push({
  369. // materialName: "节能灯",
  370. // specs: "HID 100W with Osram",
  371. // planSum: 40,
  372. // completeSum: 10,
  373. // projectName:"希望小学工程",
  374. // orderCode:"",
  375. // planCompleteDate:"2020-10-20"
  376. // });
  377. let taskList=MethodGetService.methodGet("/fbsWorkshopDispatchList/fbsWorkshopDispatchList/getDoingListByOrder");
  378. taskList.forEach(element => {
  379. element.materialName=element.product;
  380. if(element.cinvstd){
  381. element.specs=element.cinvstd;
  382. }else{
  383. element.specs="";
  384. }
  385. element.planSum=element.numberOfTasks;
  386. if(element.qualifiedNumber){
  387. element.completeSum=element.qualifiedNumber;
  388. }else{
  389. element.completeSum=0;
  390. }
  391. element.projectName=element.productionOrderNumberName;
  392. element.orderCode=element.productionOrderNumberName;
  393. if(element.endDate){
  394. element.planCompleteDate=element.endDate;
  395. }else{
  396. element.planCompleteDate="";
  397. }
  398. });
  399. console.log(JSON.parse(JSON.stringify(taskList)) );
  400. $.each(taskList, function (index, item) {
  401. item.incompleteSum = item.planSum - item.completeSum;
  402. if (item.incompleteSum < 0)
  403. item.incompleteSum = 0;
  404. item.completePercent = (item.completeSum / item.planSum * 100).toFixed(0);
  405. item.incompletePercent = (100 - item.completePercent) + "%";
  406. item.completePercent = item.completePercent + "%";
  407. const dateNow = DateOperation.formatDate(new Date(), "YYYY-mm-dd");
  408. if(item.planCompleteDate){
  409. item.bgcss = DateOperation.subtraction(item.planCompleteDate, dateNow, "s")>0?"task-block-timeout":"task-block-normal";
  410. }else{
  411. item.bgcss="task-block-timeout";
  412. }
  413. item.displayName = item.projectName == "" ? item.orderCode : item.projectName;
  414. });
  415. return taskList;
  416. },
  417. // 日生产计划
  418. getEsopTaskList: function () {
  419. const taskList = [];
  420. taskList.push({
  421. orderSheetCode: "G10001",
  422. materialCode: "10001",
  423. materialName: "物料A",
  424. specs: "3*4",
  425. ProjectName: "项目A",
  426. files:[
  427. {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/1.pdf"}
  428. ]
  429. });
  430. taskList.push({
  431. orderSheetCode: "G10002",
  432. materialCode: "10002",
  433. materialName: "物料B",
  434. specs: "3*4",
  435. ProjectName: "项目B",
  436. files:[
  437. {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/2.pdf"}
  438. ]
  439. });
  440. taskList.push({
  441. orderSheetCode: "G10001",
  442. materialCode: "10001",
  443. materialName: "物料A",
  444. specs: "3*4",
  445. ProjectName: "项目A",
  446. files:[
  447. {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/1.pdf"}
  448. ]
  449. });
  450. taskList.push({
  451. orderSheetCode: "G10002",
  452. materialCode: "10002",
  453. materialName: "物料B",
  454. specs: "3*4",
  455. ProjectName: "项目B",
  456. files:[
  457. {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/2.pdf"}
  458. ]
  459. });
  460. taskList.push({
  461. orderSheetCode: "G10001",
  462. materialCode: "10001",
  463. materialName: "物料A",
  464. specs: "3*4",
  465. ProjectName: "项目A",
  466. files:[
  467. {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/1.pdf"}
  468. ]
  469. });
  470. taskList.push({
  471. orderSheetCode: "G10002",
  472. materialCode: "10002",
  473. materialName: "物料B",
  474. specs: "3*4",
  475. ProjectName: "项目B",
  476. files:[
  477. {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/2.pdf"}
  478. ]
  479. });
  480. taskList.push({
  481. orderSheetCode: "G10001",
  482. materialCode: "10001",
  483. materialName: "物料A",
  484. specs: "3*4",
  485. ProjectName: "项目A",
  486. files:[
  487. {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/1.pdf"}
  488. ]
  489. });
  490. taskList.push({
  491. orderSheetCode: "G10002",
  492. materialCode: "10002",
  493. materialName: "物料B",
  494. specs: "3*4",
  495. ProjectName: "项目B",
  496. files:[
  497. {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/2.pdf"}
  498. ]
  499. });
  500. taskList.push({
  501. orderSheetCode: "G10001",
  502. materialCode: "10001",
  503. materialName: "物料A",
  504. specs: "3*4",
  505. ProjectName: "项目A",
  506. files:[
  507. {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/1.pdf"}
  508. ]
  509. });
  510. taskList.push({
  511. orderSheetCode: "G10002",
  512. materialCode: "10002",
  513. materialName: "物料B",
  514. specs: "3*4",
  515. ProjectName: "项目B",
  516. files:[
  517. {name:"物料A操作手册",type:"pdf",path:"/files/opratefile/2.pdf"}
  518. ]
  519. });
  520. return taskList;
  521. },
  522. //文件列表
  523. getEsopFileList:function(){
  524. return getService.methodGet("/workingStatistics/fbsWorkingStatistics/getEsopFileList");
  525. }
  526. }