details.vue 28 KB

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