details.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. :title="title"
  8. background-color="#F7F9FA"
  9. color="#000"
  10. @clickLeft="back"
  11. right-icon="scan"
  12. @clickRight="handlScanCode"
  13. ></uni-nav-bar>
  14. <!-- 投料 -->
  15. <view class="list_box">
  16. <u-list @scrolltolower="scrolltolower">
  17. <view v-for="(item, index) in List" :key="index" class="card_box">
  18. <!-- 工单信息 -->
  19. <workOrderBom
  20. :item="item"
  21. pType="feed"
  22. :isDetails="true"
  23. :taskType="item.currentTaskDiagram.type"
  24. @handleScan="handleScan"
  25. ></workOrderBom>
  26. <paramBom
  27. v-if="item.paramDetailList.length != 0"
  28. :list="item.paramDetailList"
  29. ></paramBom>
  30. <!-- //设备信息 -->
  31. <deviceBom
  32. v-if="item.equipmentList.length != 0"
  33. :workOrderId="item.workOrderId"
  34. :wordItem="item"
  35. :list="item.equipmentList"
  36. :turnover="item.turnover"
  37. @scanIt="scanIt"
  38. :type="type"
  39. ></deviceBom>
  40. <!-- //在制品 -->
  41. <view
  42. v-if="
  43. item.product && item.product.length != 0 && item.singleReport == 0
  44. "
  45. >
  46. <workInProgressList
  47. :itemData="item"
  48. :equipmentList="item.equipmentList"
  49. ></workInProgressList>
  50. </view>
  51. <!-- <productsBom v-if="item.product != null && item.product != '{}'" :itemObj="item"
  52. :productsObj="item.product">
  53. </productsBom> -->
  54. <!-- feedNeedMould -->
  55. <modelBom
  56. v-if="item.modelList.length != 0"
  57. :workOrderId="item.workOrderId"
  58. :list="item.modelList"
  59. @scanIt="scanIt"
  60. :pattern="'feed'"
  61. >
  62. </modelBom>
  63. <instanceBom
  64. v-if="item.instanceList.length != 0"
  65. :workOrderId="item.workOrderId"
  66. :list="item.instanceList"
  67. :equipmentList="item.equipmentList"
  68. :currentTaskDiagram="item.currentTaskDiagram"
  69. :workInfo="item"
  70. >
  71. </instanceBom>
  72. <!-- 物料明细 -->
  73. <semiProductBom
  74. v-if="item.semiProductList.length != 0"
  75. :workOrderId="item.workOrderId"
  76. :list="item.semiProductList"
  77. :equipmentList="item.equipmentList"
  78. :currentTaskDiagram="item.currentTaskDiagram"
  79. :workInfo="item"
  80. ></semiProductBom>
  81. <!-- 11 周转车 -->
  82. <turnoverBom
  83. v-if="item.turnover.length != 0"
  84. :list="item.turnover"
  85. :wordItem="item"
  86. pattern="feed"
  87. @handleScan="handleScan"
  88. @handleDel="handleDel"
  89. :productsObj="item.product"
  90. ></turnoverBom>
  91. <aridRegion
  92. v-if="item.aridRegionList.length != 0"
  93. :list="item.aridRegionList"
  94. @handleScan="handleScan"
  95. ></aridRegion>
  96. <palletBom
  97. v-if="item.palletList.length != 0"
  98. :palletList="item.palletList"
  99. ></palletBom>
  100. <revolvingDiskBom
  101. v-if="item.revolvingDiskList.length != 0"
  102. :revolvingDiskList="item.revolvingDiskList"
  103. ></revolvingDiskBom>
  104. <!-- 包装投料 -->
  105. <packingBom
  106. v-if="item.packingList.length != 0"
  107. :list="item.packingList"
  108. ></packingBom>
  109. <view :class="[operateBtn ? 'flex_btn' : 'flex_btn2']">
  110. <image
  111. v-if="operateBtn"
  112. class="jiantou"
  113. src="../../../static/rightJt.png"
  114. @click="operateBtn = false"
  115. >
  116. </image>
  117. <view class="close_box" @click="operateBtn = true">
  118. <image
  119. v-if="!operateBtn"
  120. class="close"
  121. src="../../../static/close.png"
  122. ></image>
  123. </view>
  124. <view v-if="!operateBtn" @click="openDetails(item.workOrderId)"
  125. >出库单</view
  126. >
  127. <view v-if="!operateBtn" @click="removeCacheFn()">清空缓存</view>
  128. </view>
  129. <view :class="[idsList.length == 1 ? 'operate_box' : 'operate_box2']">
  130. <u-button
  131. size="small"
  132. class="u-reset-button"
  133. type="success"
  134. @click="handAdd(item.workOrderId)"
  135. >手动添加</u-button
  136. >
  137. <u-button
  138. size="small"
  139. class="u-reset-button"
  140. type="success"
  141. @click="scanIt(item.workOrderId)"
  142. >扫一扫</u-button
  143. >
  144. </view>
  145. </view>
  146. </u-list>
  147. </view>
  148. <view class="bottom-wrapper">
  149. <view class="btn_box" @click="save(1)">缓存</view>
  150. <view class="btn_box" @click="save(2)">一键投料</view>
  151. </view>
  152. </view>
  153. </template>
  154. <script>
  155. import workOrderBom from "./components/workOrderBom.vue"; //gd
  156. import deviceBom from "./components/deviceBom.vue"; //设备信息
  157. import modelBom from "./components/modelBom.vue"; //模具信息
  158. import instanceBom from "./components/instanceBom.vue";
  159. import semiProductBom from "./components/semiProductBom"; //半成品信息
  160. import aridRegion from "./components/aridRegion"; //干燥区
  161. import paramBom from "./components/paramBom.vue"; //
  162. import turnoverBom from "./components/turnoverBom.vue"; //周转车信息
  163. import packingBom from "./components/packingBom.vue"; //包装信息
  164. import productsBom from "./components/productsBom.vue"; //在制品信息
  165. import palletBom from "./components/palletBom"; //舟皿
  166. import revolvingDiskBom from "./components/revolvingDiskBom";
  167. import workInProgressList from "./components/workInProgressList.vue";
  168. import {
  169. workorderList,
  170. getByCode,
  171. scanLedger,
  172. feedSaveCache,
  173. feedGetCache,
  174. removeCache,
  175. } from "@/api/pda/workOrder.js";
  176. import { batchSave } from "@/api/pda/feeding.js";
  177. export default {
  178. components: {
  179. workOrderBom,
  180. deviceBom,
  181. modelBom,
  182. instanceBom,
  183. semiProductBom,
  184. aridRegion,
  185. paramBom,
  186. turnoverBom,
  187. packingBom,
  188. productsBom,
  189. palletBom,
  190. revolvingDiskBom,
  191. workInProgressList,
  192. },
  193. data() {
  194. return {
  195. title: "",
  196. idsList: [],
  197. List: [],
  198. taskId: null,
  199. type: "",
  200. clientEnvironmentId: null,
  201. operateBtn: true,
  202. cloneListNum: "",
  203. feedNeedEquipment: null, ////投料是否要添加生产设备1是0否
  204. taskType: "",
  205. };
  206. },
  207. onLoad(options) {
  208. console.log(options, "options");
  209. this.title = options.taskName ? options.taskName + "-投料" : "投料";
  210. let queryArray = decodeURIComponent(options.arr);
  211. this.idsList = JSON.parse(queryArray);
  212. this.taskId = options.taskId;
  213. this.taskName = options.taskName;
  214. this.type = options.type;
  215. // this.feedNeedEquipment = options.feedNeedEquipment;
  216. console.log(this.idsList, "onLoad");
  217. this.getList();
  218. this.clientEnvironmentId =
  219. uni.getStorageSync("userInfo") &&
  220. uni.getStorageSync("userInfo").clientEnvironmentId;
  221. },
  222. onShow() {
  223. uni.$off("setSelectList");
  224. uni.$on("setSelectList", (selectList, id) => {
  225. this.List.forEach((m) => {
  226. if (selectList.length) {
  227. let num = 0;
  228. selectList.map((v) => {
  229. if (v.extInfo.positionList && v.extInfo.positionList.length) {
  230. v.extInfo.positionList.map((d) => {
  231. if (m.code == d.workOrderCode) {
  232. console.log(d);
  233. num += d.quantity;
  234. }
  235. });
  236. }
  237. });
  238. if (m.product && num != 0) {
  239. this.cloneListNum = num;
  240. m.product.feedQuantity = num;
  241. }
  242. }
  243. if (m.workOrderId == id) {
  244. let modelList = []; // 模具
  245. let instanceList = []; // 投料
  246. let aridRegionList = []; // 干燥区
  247. let equipmentList = []; // 生产设备
  248. let palletList = []; // 舟皿
  249. let revolvingDiskList = []; // 周转盘
  250. let semiProductList = []; // 半成品
  251. let turnover = []; //周转车
  252. selectList.forEach((f) => {
  253. if (f.rootCategoryLevelId == 4) {
  254. equipmentList = equipmentList.concat(f);
  255. equipmentList.map((d) => {
  256. if (d.equipmentLabelJson.length) {
  257. d.equipmentLabelJson.map((v) => {
  258. if (v.SJSB) {
  259. d.isSJSB = v.SJSB;
  260. }
  261. });
  262. }
  263. });
  264. }
  265. if (f.rootCategoryLevelId == 5) {
  266. modelList = modelList.concat(f);
  267. } else if (f.rootCategoryLevelId == 1) {
  268. instanceList = instanceList.concat(f);
  269. } else if (f.rootCategoryLevelId == 11) {
  270. aridRegionList = aridRegionList.concat(f);
  271. } else if (f.rootCategoryLevelId == 7) {
  272. turnover = turnover.concat(f);
  273. } else if (f.rootCategoryLevelId == 8) {
  274. palletList = palletList.concat(f);
  275. } else if (f.rootCategoryLevelId == 26) {
  276. revolvingDiskList = revolvingDiskList.concat(f);
  277. } else if ([23, 2, 9, 28].includes(Number(f.rootCategoryLevelId))) {
  278. semiProductList = semiProductList.concat(f);
  279. }
  280. });
  281. this.$set(m, "modelList", modelList);
  282. this.$set(m, "instanceList", instanceList);
  283. this.$set(m, "aridRegionList", aridRegionList);
  284. this.$set(m, "equipmentList", equipmentList);
  285. this.$set(m, "turnover", turnover);
  286. this.$set(m, "palletList", palletList);
  287. this.$set(m, "revolvingDiskList", revolvingDiskList);
  288. this.$set(m, "semiProductList", semiProductList);
  289. }
  290. });
  291. });
  292. },
  293. methods: {
  294. scrolltolower() {},
  295. clonenember(e) {
  296. return JSON.parse(JSON.stringify(e));
  297. },
  298. async save(type) {
  299. console.log(this.List, "1231");
  300. if (this.clientEnvironmentId == 3) {
  301. for (let it of this.List) {
  302. if (
  303. it.currentTaskDiagram.isFirstTask == 1 &&
  304. it.instanceList.length == 0 &&
  305. it.semiProductList.length == 0
  306. ) {
  307. uni.showToast({
  308. title: `请先去领料`,
  309. icon: "none",
  310. });
  311. return false;
  312. }
  313. }
  314. // this.List.forEach((it) => {
  315. // console.log(
  316. // it.currentTaskDiagram.isFirstTask,
  317. // it.instanceList.length,
  318. // "ititit"
  319. // );
  320. // if (
  321. // it.currentTaskDiagram.isFirstTask == 1 &&
  322. // it.instanceList.length == 0
  323. // ) {
  324. // uni.showToast({
  325. // title: `请先领料`,
  326. // icon: "none",
  327. // });
  328. // console.log("1234");
  329. // return false;
  330. // }
  331. // });
  332. }
  333. for (let i = 0; i < this.List.length; i++) {
  334. if (
  335. !this.List[i].executorTime &&
  336. this.List[i].executorTime == undefined
  337. ) {
  338. uni.showToast({
  339. title: `请先选择投料时间`,
  340. icon: "none",
  341. });
  342. return;
  343. }
  344. }
  345. this.List.forEach((f) => {
  346. this.$isJobExls(2, f);
  347. });
  348. this.List.forEach((f) => {
  349. f.instanceList.forEach((e) => {
  350. if (Object.prototype.hasOwnProperty.call(e, "type")) {
  351. e.extInfo["type"] = e.type;
  352. }
  353. e.extInfo["isConsumable"] = e.isConsumable;
  354. });
  355. });
  356. const isCache = await this.checkCache(type);
  357. if (!isCache) {
  358. return false;
  359. }
  360. if (
  361. this.clientEnvironmentId == 3 &&
  362. this.List[0].currentTaskDiagram.type == 1
  363. ) {
  364. if (
  365. this.List[0] &&
  366. this.List[0].executorTime &&
  367. this.List[0].executorTime != undefined
  368. ) {
  369. // 正则表达式1:匹配 yyyy-MM-dd 格式
  370. let dateRegex = /^\d{4}-\d{2}-\d{2}$/;
  371. if (dateRegex.test(this.List[0].executorTime.trimRight())) {
  372. this.List[0].executorTime = this.List[0].executorTime + " 00:00:00";
  373. }
  374. } else {
  375. uni.showToast({
  376. title: `请先选择时间投料时间`,
  377. icon: "none",
  378. });
  379. return false;
  380. }
  381. }
  382. if (this.clientEnvironmentId !== 9 && this.feedNeedEquipment == 1) {
  383. const isDevice = await this.checkdDevice();
  384. if (!isDevice) {
  385. return;
  386. }
  387. }
  388. // item.equipmentList
  389. // 索尔环境下,需要填写炉次号
  390. if (this.clientEnvironmentId === 2) {
  391. if (this.List[0].equipmentList.length) {
  392. if (!this.equipmentListList("heatNumber")) {
  393. return uni.showToast({
  394. title: `请填写炉次号`,
  395. icon: "none",
  396. });
  397. }
  398. }
  399. }
  400. batchSave(this.List).then((res) => {
  401. // 江南环境
  402. if (this.clientEnvironmentId == 9) {
  403. uni.redirectTo({
  404. url: `/pages/pda/workOrder/extrusionMolding/index?id=${this.idsList}`,
  405. });
  406. } else {
  407. uni.redirectTo({
  408. url: `/pages/pda/feeding/index/index?feedStatus=1`,
  409. });
  410. }
  411. });
  412. },
  413. equipmentListList(propertyName) {
  414. return this.List.every((f) => {
  415. if (f.equipmentList && f.equipmentList.length > 0) {
  416. return f.equipmentList.every((obj) => {
  417. // 检查属性存在且不为空(null, undefined, 空字符串等)
  418. return (
  419. obj.extInfo.hasOwnProperty(propertyName) &&
  420. obj.extInfo[propertyName] !== null &&
  421. obj.extInfo[propertyName] !== undefined &&
  422. obj.extInfo[propertyName] !== ""
  423. );
  424. });
  425. }
  426. });
  427. },
  428. checkCache(type) {
  429. uni.hideLoading();
  430. return new Promise((resolve) => {
  431. if (type == 1) {
  432. feedSaveCache(this.List).then((rr) => {
  433. uni.showToast({
  434. title: `已经缓存`,
  435. icon: "none",
  436. });
  437. });
  438. resolve(false);
  439. } else if (type == 2) {
  440. resolve(true);
  441. }
  442. });
  443. },
  444. getList() {
  445. workorderList({
  446. ids: this.idsList,
  447. taskId: this.taskId,
  448. })
  449. .then((res) => {
  450. this.List = res.map((m) => {
  451. m.workOrderId = m.id;
  452. m.instanceList = []; // 物料
  453. // m.equipmentList = [] // 设备
  454. m.modelList = []; // 模具
  455. m.aridRegionList = []; // 干燥区
  456. m.packingList = []; // 包装
  457. m.palletList = []; // 舟皿
  458. m.revolvingDiskList = []; // 周转盘
  459. m.semiProductList = []; //半成品
  460. if (m.pickOutInList.length > 0) {
  461. m.pickOutInList.forEach((f) => {
  462. if (f.rootCategoryLevelId == 1) {
  463. m.instanceList.push(f);
  464. } else if (f.rootCategoryLevelId == 4) {
  465. m.modelList.push(f);
  466. } else if (f.rootCategoryLevelId == 5) {
  467. m.modelList.push(f);
  468. } else if (f.rootCategoryLevelId == 11) {
  469. m.aridRegionList.push(f);
  470. } else if (f.rootCategoryLevelId == 13) {
  471. m.packingList.push(f);
  472. } else if (f.rootCategoryLevelId == 8) {
  473. m.palletList.push(f);
  474. } else if (f.rootCategoryLevelId == 26) {
  475. m.revolvingDiskList.push(f);
  476. } else if (
  477. [23, 2, 9, 28].includes(Number(f.rootCategoryLevelId))
  478. ) {
  479. m.semiProductList.push(f);
  480. }
  481. });
  482. }
  483. // 处理字段
  484. m.quality == "" ? (m.quality = {}) : "";
  485. if (!Object.prototype.hasOwnProperty.call(m, "product")) {
  486. m.product = "{}";
  487. }
  488. delete m.id;
  489. if (this.taskId) {
  490. m.taskId = this.taskId;
  491. m.taskName = this.taskName;
  492. }
  493. return {
  494. ...m,
  495. };
  496. });
  497. this.cloneList = JSON.parse(JSON.stringify(this.List));
  498. this.feedNeedEquipment =
  499. this.List[0].currentTaskDiagram.feedNeedEquipment;
  500. })
  501. .finally(() => {
  502. this.getCacheFn();
  503. });
  504. },
  505. handleScan(id, type) {
  506. uni.scanCode({
  507. success: (res) => {
  508. this.scanData(res.result, type, id);
  509. },
  510. });
  511. },
  512. scanData(result, type, id) {
  513. if (type == "wordOrder") {
  514. let isFals = this.List.some((m) => m.code == result);
  515. if (isFals) {
  516. uni.showToast({
  517. title: "工单已存在",
  518. icon: "none",
  519. });
  520. return false;
  521. }
  522. getByCode(result).then((res) => {
  523. let _arr = this.List;
  524. _arr.forEach((e, index) => {
  525. if (e.workOrderId == id && res) {
  526. _arr[index] = res;
  527. }
  528. });
  529. this.List = _arr;
  530. this.$forceUpdate();
  531. });
  532. }
  533. },
  534. scanIt(id) {
  535. uni.scanCode({
  536. success: (res) => {
  537. this.scanItData(res.result, id);
  538. },
  539. });
  540. },
  541. scanItData(result, id) {
  542. scanLedger(result).then((res) => {
  543. let _arr = [];
  544. if (res.length == 1 && res[0].rootCategoryLevelId == 4) {
  545. // 设备
  546. _arr = this.List;
  547. _arr.forEach((e, index) => {
  548. if (e.workOrderId == id) {
  549. _arr[index].equipmentList = _arr[index].equipmentList.concat(res);
  550. }
  551. });
  552. this.List = _arr;
  553. this.$forceUpdate();
  554. } else if (res.length >= 1 && res[0].rootCategoryLevelId == 5) {
  555. // 模具
  556. _arr = this.List;
  557. _arr.forEach((e, index) => {
  558. if (e.workOrderId == id) {
  559. _arr[index].modelList = res;
  560. }
  561. });
  562. this.List = _arr;
  563. this.$forceUpdate();
  564. } else if (
  565. res.length >= 1 &&
  566. [1].includes(Number(res[0].rootCategoryLevelId))
  567. ) {
  568. // 物料
  569. _arr = this.List;
  570. _arr.forEach((e, index) => {
  571. if (e.workOrderId == id) {
  572. _arr[index].instanceList = _arr[index].instanceList.concat(res);
  573. }
  574. });
  575. this.List = _arr;
  576. this.$forceUpdate();
  577. } else if (
  578. res.length >= 1 &&
  579. [23, 2, 9, 28].includes(Number(res[0].rootCategoryLevelId))
  580. ) {
  581. _arr = this.List;
  582. _arr.forEach((e, index) => {
  583. if (e.workOrderId == id) {
  584. _arr[index].semiProductList =
  585. _arr[index].semiProductList.concat(res);
  586. }
  587. });
  588. this.List = _arr;
  589. this.$forceUpdate();
  590. } else if (res.length >= 1 && res[0].rootCategoryLevelId == 11) {
  591. // 干燥区
  592. _arr = this.List;
  593. _arr.forEach((e, index) => {
  594. if (e.workOrderId == id) {
  595. let isFals = _arr[index].aridRegionList.some(
  596. (m) => m.code == res[0].aridRegionList[0].code
  597. );
  598. if (isFals) {
  599. uni.showToast({
  600. title: "干燥区已存在",
  601. icon: "none",
  602. });
  603. return false;
  604. }
  605. let _obj = res[0].aridRegionList[0];
  606. if (_obj.status == 0) {
  607. _obj["name"] = res[0].name;
  608. _obj["region"] = res[0].extInfo.region;
  609. _arr[index].aridRegionList = _arr[index].aridRegionList.concat(
  610. res[0].aridRegionList
  611. );
  612. } else {
  613. uni.showToast({
  614. title: "干燥区已占用",
  615. icon: "none",
  616. });
  617. }
  618. }
  619. });
  620. this.List = _arr;
  621. this.$forceUpdate();
  622. } else if (res.length >= 1 && res[0].rootCategoryLevelId == 7) {
  623. // 周转车
  624. _arr = this.List;
  625. _arr.forEach((e, index) => {
  626. if (e.workOrderId == id) {
  627. let isFals = _arr[index].turnover.some(
  628. (m) => m.code == res[0].code
  629. );
  630. if (isFals) {
  631. uni.showToast({
  632. title: "周转车已存在",
  633. icon: "none",
  634. });
  635. return false;
  636. }
  637. _arr.forEach((e, index) => {
  638. if (e.workOrderId == id) {
  639. _arr[index].turnover = _arr[index].turnover.concat(res);
  640. }
  641. });
  642. this.List = _arr;
  643. this.$forceUpdate();
  644. }
  645. });
  646. }
  647. });
  648. },
  649. // 全部扫一扫
  650. handlScanCode() {
  651. uni.scanCode({
  652. success: (res) => {
  653. this.scanItAllData(res.result);
  654. },
  655. });
  656. },
  657. scanItAllData(result) {
  658. scanLedger(result).then((res) => {
  659. let _arr = [];
  660. if (res.length == 1 && res[0].rootCategoryLevelId == 4) {
  661. // 设备
  662. _arr = this.List;
  663. _arr.forEach((e, index) => {
  664. res["extInfo"].fixCode = res.fixCode;
  665. e.equipmentList = e.equipmentList.concat(res);
  666. });
  667. this.List = _arr;
  668. this.$forceUpdate();
  669. } else if (res.length >= 1 && res[0].rootCategoryLevelId == 5) {
  670. // 模具
  671. _arr = this.List;
  672. _arr.forEach((e, index) => {
  673. e.modelList = res;
  674. });
  675. this.List = _arr;
  676. this.$forceUpdate();
  677. } else if (
  678. res.length >= 1 &&
  679. [1].includes(Number(res[0].rootCategoryLevelId))
  680. ) {
  681. _arr = this.List;
  682. _arr.forEach((e, index) => {
  683. e.instanceList = e.instanceList.concat(res);
  684. });
  685. this.List = _arr;
  686. this.$forceUpdate();
  687. } else if (
  688. res.length >= 1 &&
  689. [23, 2, 9, 28].includes(Number(res[0].rootCategoryLevelId))
  690. ) {
  691. _arr = this.List;
  692. _arr.forEach((e, index) => {
  693. e.semiProductList = e.semiProductList.concat(res);
  694. });
  695. this.List = _arr;
  696. this.$forceUpdate();
  697. } else if (res.length >= 1 && res[0].rootCategoryLevelId == 7) {
  698. // 周转车
  699. _arr = this.List;
  700. if (_arr.length == 1) {
  701. _arr.forEach((e, index) => {
  702. e.turnover = e.turnover.concat(res);
  703. });
  704. this.List = _arr;
  705. this.$forceUpdate();
  706. } else if (_arr.length > 1) {
  707. uni.showToast({
  708. title: "多个工单通过下面单个扫一扫添加",
  709. icon: "none",
  710. });
  711. }
  712. }
  713. });
  714. },
  715. getCacheFn() {
  716. let parma = {
  717. workOrderIds: this.idsList,
  718. taskId: this.taskId,
  719. type: 2,
  720. };
  721. feedGetCache(parma).then((res) => {
  722. if (res.length == 0) {
  723. return false;
  724. }
  725. let objList = res[0].extInfo.objList;
  726. this.List.forEach((f) => {
  727. objList.forEach((o) => {
  728. if (f.workOrderId == o.workOrderId && f.taskId == o.taskId) {
  729. // f['instanceList'] = o.instanceList || [] // 实例
  730. f["equipmentList"] = o.equipmentList || []; // 设备
  731. f["modelList"] = o.modelList || []; // 模具
  732. f["aridRegionList"] = o.aridRegionList || []; // 干燥区
  733. f["packingList"] = o.packingList || []; // 包装
  734. f["palletList"] = o.palletList || []; //舟皿
  735. f["instanceList"] = o.instanceList || []; // 物料
  736. f["revolvingDiskList"] = o.revolvingDiskList || []; // 周转盘
  737. f["semiProductList"] = o.semiProductList || []; // 半成品
  738. f["turnover"] = o.turnover || []; // 周转车
  739. this.$forceUpdate();
  740. }
  741. });
  742. });
  743. });
  744. },
  745. removeCacheFn() {
  746. uni.showModal({
  747. title: "缓存",
  748. content: "是否清空缓存!",
  749. confirmText: "确认", //这块是确定按钮的文字
  750. success: (rr) => {
  751. if (rr.confirm) {
  752. let parma = {
  753. workOrderIds: this.idsList,
  754. taskId: this.taskId,
  755. type: 2,
  756. };
  757. removeCache(parma).then((res) => {
  758. this.getList();
  759. });
  760. }
  761. },
  762. });
  763. },
  764. handAdd(id) {
  765. const storageKey = Date.now() + "";
  766. uni.setStorageSync(storageKey, this.List || []);
  767. uni.navigateTo({
  768. url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=feed&taskId=${this.taskId}`,
  769. });
  770. },
  771. openDetails(id) {
  772. const storageKey = Date.now() + "";
  773. uni.setStorageSync(storageKey, this.List || []);
  774. let url = `/pages/pda/feeding/single?id=${id}&taskId=${this.taskId}&storageKey=${storageKey}`;
  775. uni.navigateTo({
  776. url,
  777. });
  778. },
  779. checkdDevice() {
  780. return new Promise((resolve) => {
  781. console.log(this.List);
  782. let isFalse = this.List.every((item) => {
  783. return item.equipmentList && item.equipmentList.length > 0;
  784. });
  785. if (isFalse) {
  786. resolve(true);
  787. } else {
  788. uni.showToast({
  789. title: "请添加设备",
  790. icon: "none", // 可选值:'success', 'loading', 'none'
  791. duration: 3000, // 持续时间,单位ms
  792. });
  793. resolve(false);
  794. // uni.showModal({
  795. // title: '提示',
  796. // content: '没有选择设备,是否继续?',
  797. // confirmText: '确认', //这块是确定按钮的文字
  798. // success: function (res) {
  799. // if (res.confirm) {
  800. // resolve(true)
  801. // } else {
  802. // resolve(false)
  803. // }
  804. // }
  805. // })
  806. }
  807. });
  808. },
  809. },
  810. beforeDestroy() {
  811. uni.hideLoading();
  812. },
  813. };
  814. </script>
  815. <style lang="scss" scoped>
  816. .content-box {
  817. height: 100vh;
  818. overflow: hidden;
  819. display: flex;
  820. flex-direction: column;
  821. }
  822. .list_box {
  823. flex: 1;
  824. overflow: hidden;
  825. padding: 4rpx 0;
  826. .u-list {
  827. height: 100% !important;
  828. }
  829. .card_box {
  830. padding: 16rpx;
  831. }
  832. }
  833. .bottom-wrapper {
  834. width: 100%;
  835. display: flex;
  836. align-items: center;
  837. justify-content: space-around;
  838. .btn_box {
  839. width: 50%;
  840. height: 88rpx;
  841. line-height: 88rpx;
  842. background: $theme-color;
  843. text-align: center;
  844. font-size: 36rpx;
  845. font-style: normal;
  846. font-weight: 400;
  847. color: #fff;
  848. &:first-child {
  849. border-right: 2rpx solid #fff;
  850. }
  851. }
  852. }
  853. .operate_box {
  854. position: fixed;
  855. right: 0;
  856. top: 400rpx;
  857. /deep/ .u-button {
  858. margin-top: 20rpx;
  859. width: 150rpx;
  860. border-radius: 22rpx 0 0 22rpx;
  861. opacity: 0.6;
  862. font-size: 22rpx;
  863. }
  864. }
  865. .operate_box2 {
  866. display: flex;
  867. /deep/ .u-button {
  868. margin-top: 20rpx;
  869. width: 150rpx;
  870. }
  871. }
  872. .flex_btn {
  873. position: fixed;
  874. right: 0;
  875. bottom: 160rpx;
  876. width: 40rpx;
  877. height: 50rpx;
  878. line-height: 66rpx;
  879. border-radius: 22rpx 0 0 22rpx;
  880. background: $theme-color;
  881. text-align: center;
  882. font-size: 22rpx;
  883. font-style: normal;
  884. font-weight: 400;
  885. color: #fff;
  886. opacity: 0.6;
  887. .jiantou {
  888. width: 30rpx;
  889. height: 30rpx;
  890. }
  891. }
  892. .flex_btn2 {
  893. position: fixed;
  894. right: 0;
  895. bottom: 160rpx;
  896. width: 126rpx;
  897. min-height: 140rpx;
  898. line-height: 62rpx;
  899. border-radius: 22rpx 0 0 22rpx;
  900. background: $theme-color;
  901. text-align: center;
  902. font-size: 22rpx;
  903. font-style: normal;
  904. font-weight: 400;
  905. color: #fff;
  906. opacity: 0.7;
  907. .close_box {
  908. height: 50rpx;
  909. line-height: 50rpx;
  910. width: 126rpx;
  911. text-align: left;
  912. .close {
  913. width: 40rpx;
  914. height: 40rpx;
  915. padding: 6rpx 10rpx;
  916. }
  917. }
  918. }
  919. </style>