index.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. import request from '@/utils/request';
  2. /**
  3. * 列表
  4. */
  5. export async function getList(data) {
  6. const res = await request.post('/aps/productionplan/page', data);
  7. if (res.data.code == 0) {
  8. return res.data.data;
  9. }
  10. return Promise.reject(new Error(res.data.message));
  11. }
  12. /**
  13. * 保存
  14. */
  15. export async function save(data) {
  16. const res = await request.post('/aps/productionplan/save', data);
  17. if (res.data.code == 0) {
  18. return res.data.data;
  19. }
  20. return Promise.reject(new Error(res.data.message));
  21. }
  22. /**
  23. * 基本信息
  24. */
  25. export async function getById(id) {
  26. console.log(id);
  27. const res = await request.get(`/aps/productionplan/getById/` + id);
  28. if (res.data.code == 0) {
  29. return res.data.data;
  30. }
  31. return Promise.reject(new Error(res.data.message));
  32. }
  33. /**
  34. * 发布信息返显
  35. */
  36. export async function getReleaseInfoById(id) {
  37. const res = await request.get(`/aps/productionplan/getReleaseInfoById/${id}`);
  38. if (res.data.code == 0) {
  39. return res.data.data;
  40. }
  41. return Promise.reject(new Error(res.data.message));
  42. }
  43. /**
  44. * 详情
  45. */
  46. export async function getProductPlanDetail(id) {
  47. const res = await request.get(
  48. `/aps/productionplan/getProductPlanDetail/${id}`
  49. );
  50. if (res.data.code == 0) {
  51. return res.data.data;
  52. }
  53. return Promise.reject(new Error(res.data.message));
  54. }
  55. /**
  56. * 根据计划id获取物料信息
  57. */
  58. export async function getMaterialinfo(planId) {
  59. const res = await request.get(`/aps/materialinfo/listByPlanId`, {
  60. params: { planId }
  61. });
  62. if (res.data.code == 0) {
  63. return res.data.data;
  64. }
  65. return Promise.reject(new Error(res.data.message));
  66. }
  67. /**
  68. * 删除
  69. */
  70. export async function del(id) {
  71. const res = await request.delete(`/aps/productionplan/delete/${id}`);
  72. if (res.data.code == 0) {
  73. return res.data.data;
  74. }
  75. return Promise.reject(new Error(res.data.message));
  76. }
  77. /**
  78. * 删除
  79. */
  80. export async function factoryDelete(id) {
  81. const res = await request.delete(`/aps/productionplan/delete/${id}`);
  82. if (res.data.code == 0) {
  83. return res.data.data;
  84. }
  85. return Promise.reject(new Error(res.data.message));
  86. }
  87. // 拆分
  88. export async function splitWork(params) {
  89. const res = await request.post(`/aps/productionplan/splitBatch`, params);
  90. if (res.data.code == 0) {
  91. return res.data.data;
  92. }
  93. return Promise.reject(new Error(res.data.message));
  94. }
  95. // 计划合批
  96. export async function mergeBatch(params) {
  97. const res = await request.post(`/aps/productionplan/mergeBatch`, params);
  98. if (res.data.code == 0) {
  99. return res.data.data;
  100. }
  101. return Promise.reject(new Error(res.data.message));
  102. }
  103. // 修改优先级
  104. export async function updatePriority(data) {
  105. const res = await request.post(`/aps/productionplan/updatePriority`, data);
  106. if (res.data.code == 0) {
  107. return res.data.data;
  108. }
  109. return Promise.reject(new Error(res.data.message));
  110. }
  111. /**
  112. * 生产详情列表
  113. */
  114. export async function queryTaskDetail(data) {
  115. const res = await request.get(
  116. '/aps/quality_details_work_order/queryPlanId/' + data
  117. );
  118. if (res.data.code == 0) {
  119. return res.data.data;
  120. }
  121. return Promise.reject(new Error(res.data.message));
  122. }
  123. // 计划分解(获取产品BOM)
  124. // export async function getBom(params) {
  125. // const res = await request.get(`/main/bomCategory/getBom`, { params });
  126. // if (res.data.code == 0) {
  127. // return res.data.data;
  128. // }
  129. // return Promise.reject(new Error(res.data.message));
  130. // }
  131. export async function getBom(params) {
  132. const res = await request.get(`/main/bomCategory/getBomByPlanSplit`, {
  133. params
  134. });
  135. if (res.data.code == 0) {
  136. return res.data.data;
  137. }
  138. return Promise.reject(new Error(res.data.message));
  139. }
  140. // 计划分解 (保存)
  141. export async function batchSave(data) {
  142. const res = await request.post(`/aps/productionplan/batchSave`, data);
  143. if (res.data.code == 0) {
  144. return res.data.data;
  145. }
  146. return Promise.reject(new Error(res.data.message));
  147. }
  148. // 计划分解 (保存并发布)
  149. export async function issueProductionPlan(data) {
  150. const res = await request.post(
  151. `/aps/productionplan/issueProductionPlan`,
  152. data
  153. );
  154. if (res.data.code == 0) {
  155. return res.data.data;
  156. }
  157. return Promise.reject(new Error(res.data.message));
  158. }
  159. // 齐套性检查
  160. export async function homogeneityInspect(data) {
  161. const res = await request.post(
  162. `/aps/productionplan/homogeneityInspect`,
  163. data
  164. );
  165. if (res.data.code == 0) {
  166. return res.data.data;
  167. }
  168. return Promise.reject(new Error(res.data.message));
  169. }
  170. export async function getStockList(params) {
  171. const res = await request.get('/wms/outindetailtwo/page', { params });
  172. if (res.data.code == 0) {
  173. return res.data.data;
  174. }
  175. return Promise.reject(new Error(res.data.message));
  176. }
  177. export async function getCurrentList(data) {
  178. const res = await request.post('/eom/purchaseorder/getZtDetail', data);
  179. if (res.data.code == 0) {
  180. return res.data.data;
  181. }
  182. return Promise.reject(new Error(res.data.message));
  183. }
  184. // 齐套性检查
  185. export async function homogeneityInspectMerge(data) {
  186. const res = await request.post(
  187. `/aps/productionplan/homogeneityInspectMerge`,
  188. data
  189. );
  190. if (res.data.code == 0) {
  191. return res.data.data;
  192. }
  193. return Promise.reject(new Error(res.data.message));
  194. }
  195. // PBOM树
  196. export async function getBomRoot(data) {
  197. const res = await request.post(`/aps/productionplan/getBomRoot`, data);
  198. if (res.data.code == 0) {
  199. return res.data.data;
  200. }
  201. return Promise.reject(new Error(res.data.message));
  202. }
  203. // PBOM 齐套性检查
  204. export async function pbomHomogeneityInspect(data) {
  205. const res = await request.post(
  206. `/aps/productionplan/pbomHomogeneityInspect`,
  207. data
  208. );
  209. if (res.data.code == 0) {
  210. return res.data.data;
  211. }
  212. return Promise.reject(new Error(res.data.message));
  213. }
  214. export async function orderPbomHomogeneityInspect(data) {
  215. const res = await request.post(
  216. `/aps/productionplan/orderPbomHomogeneityInspect`,
  217. data
  218. );
  219. if (res.data.code == 0) {
  220. return res.data.data;
  221. }
  222. return Promise.reject(new Error(res.data.message));
  223. }
  224. export async function getPlanStatistics(params) {
  225. const res = await request.get('/aps/productionplan/getPlanStatistics', {
  226. params
  227. });
  228. if (res.data.code == 0) {
  229. return res.data.data;
  230. }
  231. return Promise.reject(new Error(res.data.message));
  232. }
  233. export async function getOrderBomRoot(data) {
  234. const res = await request.post(`/aps/productionplan/getOrderBomRoot`, data);
  235. if (res.data.code == 0) {
  236. return res.data.data;
  237. }
  238. return Promise.reject(new Error(res.data.message));
  239. }
  240. // 根据产品查询BOM分类
  241. export async function findBomCategoryByCategoryIdV2(bomId, produceType) {
  242. const res = await request.get(
  243. `/aps/productionplan/findBomCategoryByCategoryId/v2/${bomId}?produceType=${produceType}`
  244. );
  245. if (res.data.code == 0) {
  246. return res.data.data;
  247. }
  248. return Promise.reject(new Error(res.data.message));
  249. }
  250. // 根据产品查询BOM分类
  251. export async function bomVersionList(params) {
  252. const res = await request.get(`/main/bomCategory/versionList`, { params });
  253. if (res.data.code == 0) {
  254. return res.data.data;
  255. }
  256. return Promise.reject(new Error(res.data.message));
  257. }
  258. // 根据产品查询bom类型
  259. export async function listBomType(params) {
  260. const res = await request.get(`/main/bomCategory/listBomType`, { params });
  261. if (res.data.code == 0) {
  262. return res.data.data;
  263. }
  264. return Promise.reject(new Error(res.data.message));
  265. }
  266. // 根据产品查询BOM分类
  267. export async function findBomCategoryByCategoryId(
  268. categoryId,
  269. produceType = ''
  270. ) {
  271. const res = await request.get(
  272. `/aps/productionplan/findBomCategoryByCategoryId/${categoryId}?produceType=${produceType}`
  273. );
  274. if (res.data.code == 0) {
  275. return res.data.data;
  276. }
  277. return Promise.reject(new Error(res.data.message));
  278. }
  279. // 根据计划id查询物料信息
  280. export async function findMaterialInfoByPlanId(params) {
  281. const res = await request.get(
  282. '/aps/productionplan/findMaterialInfoByPlanId',
  283. {
  284. params
  285. }
  286. );
  287. if (res.data.code == 0) {
  288. return res.data.data;
  289. }
  290. return Promise.reject(new Error(res.data.message));
  291. }
  292. export async function workOrderFindMaterialInfoByPlanId(params) {
  293. const res = await request.get('/aps/workorder/findMaterialInfoByPlanId', {
  294. params
  295. });
  296. if (res.data.code == 0) {
  297. return res.data.data;
  298. }
  299. return Promise.reject(new Error(res.data.message));
  300. }
  301. // 根据产品查询BOM分类
  302. export async function findBomSalesorderCategoryIdV2(bomId, produceType) {
  303. const res = await request.get(
  304. `/aps/salesorder/findBomCategoryByCategoryId/v2/${bomId}?produceType=${produceType}`
  305. );
  306. if (res.data.code == 0) {
  307. return res.data.data;
  308. }
  309. return Promise.reject(new Error(res.data.message));
  310. }
  311. // 根据产品查询BOM分类
  312. export async function findBomSalesorderCategoryId(categoryId, produceType) {
  313. const res = await request.get(
  314. `/aps/salesorder/findBomCategoryByCategoryId/${categoryId}?produceType=${produceType}`
  315. );
  316. if (res.data.code == 0) {
  317. return res.data.data;
  318. }
  319. return Promise.reject(new Error(res.data.message));
  320. }
  321. // 根据计划id查询物料信息
  322. export async function findMaterialInfoSalesorder(params) {
  323. const res = await request.get(
  324. '/aps/salesorder/findMaterialInfoBySalesOrderId',
  325. {
  326. params
  327. }
  328. );
  329. if (res.data.code == 0) {
  330. return res.data.data;
  331. }
  332. return Promise.reject(new Error(res.data.message));
  333. }
  334. // 根据产品ID查询物料信息
  335. export async function findMaterialInfoByCategory(params) {
  336. const res = await request.get(
  337. '/aps/salesorder/findMaterialInfoByCategoryId',
  338. {
  339. params
  340. }
  341. );
  342. if (res.data.code == 0) {
  343. return res.data.data;
  344. }
  345. return Promise.reject(new Error(res.data.message));
  346. }
  347. // 根据产品ID查询物料信息
  348. export async function getProductKitting(params) {
  349. const res = await request.get('/aps/productionplan/getProductKitting', {
  350. params
  351. });
  352. if (res.data.code == 0) {
  353. return res.data.data;
  354. }
  355. return Promise.reject(new Error(res.data.message));
  356. }
  357. // 根据生产计划ID查询江南产品齐套数据
  358. export async function getJNProductKitting(params) {
  359. const res = await request.get('/aps/productionplan/getJNProductKitting', {
  360. params
  361. });
  362. if (res.data.code == 0) {
  363. return res.data.data;
  364. }
  365. return Promise.reject(new Error(res.data.message));
  366. }
  367. //发布计划是否需要审核
  368. export async function planIsReview(data) {
  369. const res = await request.post(
  370. `/aps/productionplan/releaseSaveByApproval`,
  371. data
  372. );
  373. if (res.data.code == 0) {
  374. return res.data.data;
  375. }
  376. return Promise.reject(new Error(res.data.message));
  377. }
  378. //生产前准备
  379. export async function completenessCheck(data) {
  380. const res = await request.post(`/aps/productionplan/preRelease`, data);
  381. if (res.data.code == 0) {
  382. return res.data.data;
  383. }
  384. return Promise.reject(new Error(res.data.message));
  385. }
  386. //任务派单
  387. export async function taskReleaseWork(data) {
  388. const res = await request.post(`/aps/assign/saveEventAssign`, data);
  389. if (res.data.code == 0) {
  390. return res.data.data;
  391. }
  392. return Promise.reject(new Error(res.data.message));
  393. }
  394. //提醒材料员领料
  395. export async function remindMaterialPicking(planCode) {
  396. const res = await request.post(
  397. `/sys/notifysend/materialRequisitionReminderNotice`,
  398. null,
  399. {
  400. params: { planCode }
  401. }
  402. );
  403. if (res.data.code == 0) {
  404. return res.data.data;
  405. }
  406. return Promise.reject(new Error(res.data.message));
  407. }
  408. //任务齐套性检查
  409. export async function updatePreRelease(data) {
  410. const res = await request.post(`/aps/productionplan/updatePreRelease`, data);
  411. if (res.data.code == 0) {
  412. return res.data.data;
  413. }
  414. return Promise.reject(new Error(res.data.message));
  415. }
  416. //任务齐套性检查 订单
  417. export async function updatePreReleaseOrder(data) {
  418. const res = await request.post(`/aps/workorder/updatePreRelease`, data);
  419. if (res.data.code == 0) {
  420. return res.data.data;
  421. }
  422. return Promise.reject(new Error(res.data.message));
  423. }
  424. // 根据bomId和工艺路线id获取nc代码
  425. export async function listBomTaskFile(bomCategoryId, routingId) {
  426. const res = await request.get(
  427. `/main/categoryparam/listBomTaskFile/${bomCategoryId}/${routingId}`
  428. );
  429. if (res.data.code == 0) {
  430. return res.data.data;
  431. }
  432. return Promise.reject(new Error(res.data.message));
  433. }
  434. export async function newFilePageAPI(data) {
  435. const res = await request.post('/fm/file/queryIds', data);
  436. if (res.data.code == 0) {
  437. return res.data.data;
  438. }
  439. return Promise.reject(new Error(res.data.message));
  440. }
  441. // 根据bomId和工艺路线id获取nc代码
  442. export async function listBomRoutingFile(bomCategoryId, routingId) {
  443. const res = await request.get(
  444. `/main/categoryparam/listBomRoutingFile/${bomCategoryId}/${routingId}`
  445. );
  446. if (res.data.code == 0) {
  447. return res.data.data;
  448. }
  449. return Promise.reject(new Error(res.data.message));
  450. }
  451. // 根据计划id查询辅材信息
  452. export async function findAssistMaterialInfoByPlanId(params) {
  453. const res = await request.get(
  454. '/aps/productionplan/findAssistMaterialInfoByPlanId',
  455. {
  456. params
  457. }
  458. );
  459. if (res.data.code == 0) {
  460. return res.data.data;
  461. }
  462. return Promise.reject(new Error(res.data.message));
  463. }
  464. // 根据计划id查询制造资源
  465. export async function findFrockMaterialInfoByPlanId(params) {
  466. const res = await request.get(
  467. '/aps/productionplan/findFrockMaterialInfoByPlanId',
  468. {
  469. params
  470. }
  471. );
  472. if (res.data.code == 0) {
  473. return res.data.data;
  474. }
  475. return Promise.reject(new Error(res.data.message));
  476. }
  477. /**
  478. * 生产计划排程
  479. */
  480. export async function scheduling(data) {
  481. const res = await request.post('/aps/scheduling/scheduling', data);
  482. if (res.data.code == 0) {
  483. return res.data.data;
  484. }
  485. return Promise.reject(new Error(res.data.message));
  486. }
  487. /**
  488. * 生产计划排程
  489. */
  490. export async function teamSchedulingGanttChart(data) {
  491. const res = await request.post(
  492. '/aps/scheduling/teamSchedulingGanttChart',
  493. data
  494. );
  495. if (res.data.code == 0) {
  496. return res.data.data;
  497. }
  498. return Promise.reject(new Error(res.data.message));
  499. }
  500. /**
  501. * 班组排程工位/设备/人员甘特图
  502. */
  503. export async function workstationSchedulingGanttChart(data) {
  504. const res = await request.post(
  505. '/aps/scheduling/workstationSchedulingGanttChart',
  506. data
  507. );
  508. if (res.data.code == 0) {
  509. return res.data.data;
  510. }
  511. return Promise.reject(new Error(res.data.message));
  512. }
  513. /**
  514. * 生产计划工厂排程
  515. */
  516. export async function factorySchedulingGanttChart(data) {
  517. const res = await request.post(
  518. '/aps/scheduling/planSchedulingGanttChart',
  519. data
  520. );
  521. if (res.data.code == 0) {
  522. return res.data.data;
  523. }
  524. return Promise.reject(new Error(res.data.message));
  525. }
  526. /**
  527. * 根据计划id查询多个生产计划
  528. */
  529. export async function getPlansByIds(ids) {
  530. const res = await request.post('/aps/productionplan/listByIds', ids);
  531. if (res.data.code == 0) {
  532. return res.data.data;
  533. }
  534. return Promise.reject(new Error(res.data.message));
  535. }
  536. /**
  537. * 检查终止计划
  538. */
  539. export async function checkTerminatePlan(data) {
  540. const res = await request.post('/aps/productionplan/checkKillPlan', data);
  541. if (res.data.code == 0) {
  542. return res.data.data;
  543. }
  544. return Promise.reject(new Error(res.data.message));
  545. }
  546. /**
  547. * 终止计划
  548. */
  549. export async function terminatePlan(data) {
  550. const res = await request.post('/aps/productionplan/killPlan', data);
  551. if (res.data.code == 0) {
  552. return res.data.data;
  553. }
  554. return Promise.reject(new Error(res.data.message));
  555. }