details.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990
  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);
  299. for (let i = 0; i < this.List.length; i++) {
  300. if (
  301. !this.List[i].executorTime &&
  302. this.List[i].executorTime == undefined
  303. ) {
  304. uni.showToast({
  305. title: `请先选择投料时间`,
  306. icon: "none",
  307. });
  308. return;
  309. }
  310. }
  311. this.List.forEach((f) => {
  312. this.$isJobExls(2, f);
  313. });
  314. this.List.forEach((f) => {
  315. f.instanceList.forEach((e) => {
  316. if (Object.prototype.hasOwnProperty.call(e, "type")) {
  317. e.extInfo["type"] = e.type;
  318. }
  319. e.extInfo["isConsumable"] = e.isConsumable;
  320. });
  321. });
  322. const isCache = await this.checkCache(type);
  323. if (!isCache) {
  324. return false;
  325. }
  326. if (
  327. this.clientEnvironmentId == 3 &&
  328. this.List[0].currentTaskDiagram.type == 1
  329. ) {
  330. if (
  331. this.List[0] &&
  332. this.List[0].executorTime &&
  333. this.List[0].executorTime != undefined
  334. ) {
  335. // 正则表达式1:匹配 yyyy-MM-dd 格式
  336. let dateRegex = /^\d{4}-\d{2}-\d{2}$/;
  337. if (dateRegex.test(this.List[0].executorTime.trimRight())) {
  338. this.List[0].executorTime = this.List[0].executorTime + " 00:00:00";
  339. }
  340. } else {
  341. uni.showToast({
  342. title: `请先选择时间投料时间`,
  343. icon: "none",
  344. });
  345. return false;
  346. }
  347. }
  348. if (this.clientEnvironmentId !== 9 && this.feedNeedEquipment == 1) {
  349. const isDevice = await this.checkdDevice();
  350. if (!isDevice) {
  351. return;
  352. }
  353. }
  354. // item.equipmentList
  355. // 索尔环境下,需要填写炉次号
  356. if (this.clientEnvironmentId === 2) {
  357. if (this.List[0].equipmentList.length) {
  358. if (!this.equipmentListList("heatNumber")) {
  359. return uni.showToast({
  360. title: `请填写炉次号`,
  361. icon: "none",
  362. });
  363. }
  364. }
  365. }
  366. batchSave(this.List).then((res) => {
  367. // 江南环境
  368. if (this.clientEnvironmentId == 9) {
  369. uni.redirectTo({
  370. url: `/pages/pda/workOrder/extrusionMolding/index?id=${this.idsList}`,
  371. });
  372. } else {
  373. uni.redirectTo({
  374. url: `/pages/pda/feeding/index/index?feedStatus=1`,
  375. });
  376. }
  377. });
  378. },
  379. equipmentListList(propertyName) {
  380. return this.List.every((f) => {
  381. if (f.equipmentList && f.equipmentList.length > 0) {
  382. return f.equipmentList.every((obj) => {
  383. // 检查属性存在且不为空(null, undefined, 空字符串等)
  384. return (
  385. obj.extInfo.hasOwnProperty(propertyName) &&
  386. obj.extInfo[propertyName] !== null &&
  387. obj.extInfo[propertyName] !== undefined &&
  388. obj.extInfo[propertyName] !== ""
  389. );
  390. });
  391. }
  392. });
  393. },
  394. checkCache(type) {
  395. uni.hideLoading();
  396. return new Promise((resolve) => {
  397. if (type == 1) {
  398. feedSaveCache(this.List).then((rr) => {
  399. uni.showToast({
  400. title: `已经缓存`,
  401. icon: "none",
  402. });
  403. });
  404. resolve(false);
  405. } else if (type == 2) {
  406. resolve(true);
  407. }
  408. });
  409. },
  410. getList() {
  411. workorderList({
  412. ids: this.idsList,
  413. taskId: this.taskId,
  414. })
  415. .then((res) => {
  416. this.List = res.map((m) => {
  417. m.workOrderId = m.id;
  418. m.instanceList = []; // 物料
  419. // m.equipmentList = [] // 设备
  420. m.modelList = []; // 模具
  421. m.aridRegionList = []; // 干燥区
  422. m.packingList = []; // 包装
  423. m.palletList = []; // 舟皿
  424. m.revolvingDiskList = []; // 周转盘
  425. m.semiProductList = []; //半成品
  426. if (m.pickOutInList.length > 0) {
  427. m.pickOutInList.forEach((f) => {
  428. if (f.rootCategoryLevelId == 1) {
  429. m.instanceList.push(f);
  430. } else if (f.rootCategoryLevelId == 4) {
  431. m.modelList.push(f);
  432. } else if (f.rootCategoryLevelId == 5) {
  433. m.modelList.push(f);
  434. } else if (f.rootCategoryLevelId == 11) {
  435. m.aridRegionList.push(f);
  436. } else if (f.rootCategoryLevelId == 13) {
  437. m.packingList.push(f);
  438. } else if (f.rootCategoryLevelId == 8) {
  439. m.palletList.push(f);
  440. } else if (f.rootCategoryLevelId == 26) {
  441. m.revolvingDiskList.push(f);
  442. } else if (
  443. [23, 2, 9, 28].includes(Number(f.rootCategoryLevelId))
  444. ) {
  445. m.semiProductList.push(f);
  446. }
  447. });
  448. }
  449. // 处理字段
  450. m.quality == "" ? (m.quality = {}) : "";
  451. if (!Object.prototype.hasOwnProperty.call(m, "product")) {
  452. m.product = "{}";
  453. }
  454. delete m.id;
  455. if (this.taskId) {
  456. m.taskId = this.taskId;
  457. m.taskName = this.taskName;
  458. }
  459. return {
  460. ...m,
  461. };
  462. });
  463. this.cloneList = JSON.parse(JSON.stringify(this.List));
  464. this.feedNeedEquipment =
  465. this.List[0].currentTaskDiagram.feedNeedEquipment;
  466. })
  467. .finally(() => {
  468. this.getCacheFn();
  469. });
  470. },
  471. handleScan(id, type) {
  472. uni.scanCode({
  473. success: (res) => {
  474. this.scanData(res.result, type, id);
  475. },
  476. });
  477. },
  478. scanData(result, type, id) {
  479. if (type == "wordOrder") {
  480. let isFals = this.List.some((m) => m.code == result);
  481. if (isFals) {
  482. uni.showToast({
  483. title: "工单已存在",
  484. icon: "none",
  485. });
  486. return false;
  487. }
  488. getByCode(result).then((res) => {
  489. let _arr = this.List;
  490. _arr.forEach((e, index) => {
  491. if (e.workOrderId == id && res) {
  492. _arr[index] = res;
  493. }
  494. });
  495. this.List = _arr;
  496. this.$forceUpdate();
  497. });
  498. }
  499. },
  500. scanIt(id) {
  501. uni.scanCode({
  502. success: (res) => {
  503. this.scanItData(res.result, id);
  504. },
  505. });
  506. },
  507. scanItData(result, id) {
  508. scanLedger(result).then((res) => {
  509. let _arr = [];
  510. if (res.length == 1 && res[0].rootCategoryLevelId == 4) {
  511. // 设备
  512. _arr = this.List;
  513. _arr.forEach((e, index) => {
  514. if (e.workOrderId == id) {
  515. _arr[index].equipmentList = _arr[index].equipmentList.concat(res);
  516. }
  517. });
  518. this.List = _arr;
  519. this.$forceUpdate();
  520. } else if (res.length >= 1 && res[0].rootCategoryLevelId == 5) {
  521. // 模具
  522. _arr = this.List;
  523. _arr.forEach((e, index) => {
  524. if (e.workOrderId == id) {
  525. _arr[index].modelList = res;
  526. }
  527. });
  528. this.List = _arr;
  529. this.$forceUpdate();
  530. } else if (
  531. res.length >= 1 &&
  532. [1].includes(Number(res[0].rootCategoryLevelId))
  533. ) {
  534. // 物料
  535. _arr = this.List;
  536. _arr.forEach((e, index) => {
  537. if (e.workOrderId == id) {
  538. _arr[index].instanceList = _arr[index].instanceList.concat(res);
  539. }
  540. });
  541. this.List = _arr;
  542. this.$forceUpdate();
  543. } else if (
  544. res.length >= 1 &&
  545. [23, 2, 9, 28].includes(Number(res[0].rootCategoryLevelId))
  546. ) {
  547. _arr = this.List;
  548. _arr.forEach((e, index) => {
  549. if (e.workOrderId == id) {
  550. _arr[index].semiProductList =
  551. _arr[index].semiProductList.concat(res);
  552. }
  553. });
  554. this.List = _arr;
  555. this.$forceUpdate();
  556. } else if (res.length >= 1 && res[0].rootCategoryLevelId == 11) {
  557. // 干燥区
  558. _arr = this.List;
  559. _arr.forEach((e, index) => {
  560. if (e.workOrderId == id) {
  561. let isFals = _arr[index].aridRegionList.some(
  562. (m) => m.code == res[0].aridRegionList[0].code
  563. );
  564. if (isFals) {
  565. uni.showToast({
  566. title: "干燥区已存在",
  567. icon: "none",
  568. });
  569. return false;
  570. }
  571. let _obj = res[0].aridRegionList[0];
  572. if (_obj.status == 0) {
  573. _obj["name"] = res[0].name;
  574. _obj["region"] = res[0].extInfo.region;
  575. _arr[index].aridRegionList = _arr[index].aridRegionList.concat(
  576. res[0].aridRegionList
  577. );
  578. } else {
  579. uni.showToast({
  580. title: "干燥区已占用",
  581. icon: "none",
  582. });
  583. }
  584. }
  585. });
  586. this.List = _arr;
  587. this.$forceUpdate();
  588. } else if (res.length >= 1 && res[0].rootCategoryLevelId == 7) {
  589. // 周转车
  590. _arr = this.List;
  591. _arr.forEach((e, index) => {
  592. if (e.workOrderId == id) {
  593. let isFals = _arr[index].turnover.some(
  594. (m) => m.code == res[0].code
  595. );
  596. if (isFals) {
  597. uni.showToast({
  598. title: "周转车已存在",
  599. icon: "none",
  600. });
  601. return false;
  602. }
  603. _arr.forEach((e, index) => {
  604. if (e.workOrderId == id) {
  605. _arr[index].turnover = _arr[index].turnover.concat(res);
  606. }
  607. });
  608. this.List = _arr;
  609. this.$forceUpdate();
  610. }
  611. });
  612. }
  613. });
  614. },
  615. // 全部扫一扫
  616. handlScanCode() {
  617. uni.scanCode({
  618. success: (res) => {
  619. this.scanItAllData(res.result);
  620. },
  621. });
  622. },
  623. scanItAllData(result) {
  624. scanLedger(result).then((res) => {
  625. let _arr = [];
  626. if (res.length == 1 && res[0].rootCategoryLevelId == 4) {
  627. // 设备
  628. _arr = this.List;
  629. _arr.forEach((e, index) => {
  630. res["extInfo"].fixCode = res.fixCode;
  631. e.equipmentList = e.equipmentList.concat(res);
  632. });
  633. this.List = _arr;
  634. this.$forceUpdate();
  635. } else if (res.length >= 1 && res[0].rootCategoryLevelId == 5) {
  636. // 模具
  637. _arr = this.List;
  638. _arr.forEach((e, index) => {
  639. e.modelList = res;
  640. });
  641. this.List = _arr;
  642. this.$forceUpdate();
  643. } else if (
  644. res.length >= 1 &&
  645. [1].includes(Number(res[0].rootCategoryLevelId))
  646. ) {
  647. _arr = this.List;
  648. _arr.forEach((e, index) => {
  649. e.instanceList = e.instanceList.concat(res);
  650. });
  651. this.List = _arr;
  652. this.$forceUpdate();
  653. } else if (
  654. res.length >= 1 &&
  655. [23, 2, 9, 28].includes(Number(res[0].rootCategoryLevelId))
  656. ) {
  657. _arr = this.List;
  658. _arr.forEach((e, index) => {
  659. e.semiProductList = e.semiProductList.concat(res);
  660. });
  661. this.List = _arr;
  662. this.$forceUpdate();
  663. } else if (res.length >= 1 && res[0].rootCategoryLevelId == 7) {
  664. // 周转车
  665. _arr = this.List;
  666. if (_arr.length == 1) {
  667. _arr.forEach((e, index) => {
  668. e.turnover = e.turnover.concat(res);
  669. });
  670. this.List = _arr;
  671. this.$forceUpdate();
  672. } else if (_arr.length > 1) {
  673. uni.showToast({
  674. title: "多个工单通过下面单个扫一扫添加",
  675. icon: "none",
  676. });
  677. }
  678. }
  679. });
  680. },
  681. getCacheFn() {
  682. let parma = {
  683. workOrderIds: this.idsList,
  684. taskId: this.taskId,
  685. type: 2,
  686. };
  687. feedGetCache(parma).then((res) => {
  688. if (res.length == 0) {
  689. return false;
  690. }
  691. let objList = res[0].extInfo.objList;
  692. this.List.forEach((f) => {
  693. objList.forEach((o) => {
  694. if (f.workOrderId == o.workOrderId && f.taskId == o.taskId) {
  695. // f['instanceList'] = o.instanceList || [] // 实例
  696. f["equipmentList"] = o.equipmentList || []; // 设备
  697. f["modelList"] = o.modelList || []; // 模具
  698. f["aridRegionList"] = o.aridRegionList || []; // 干燥区
  699. f["packingList"] = o.packingList || []; // 包装
  700. f["palletList"] = o.palletList || []; //舟皿
  701. f["instanceList"] = o.instanceList || []; // 物料
  702. f["revolvingDiskList"] = o.revolvingDiskList || []; // 周转盘
  703. f["semiProductList"] = o.semiProductList || []; // 半成品
  704. f["turnover"] = o.turnover || []; // 周转车
  705. this.$forceUpdate();
  706. }
  707. });
  708. });
  709. });
  710. },
  711. removeCacheFn() {
  712. uni.showModal({
  713. title: "缓存",
  714. content: "是否清空缓存!",
  715. confirmText: "确认", //这块是确定按钮的文字
  716. success: (rr) => {
  717. if (rr.confirm) {
  718. let parma = {
  719. workOrderIds: this.idsList,
  720. taskId: this.taskId,
  721. type: 2,
  722. };
  723. removeCache(parma).then((res) => {
  724. this.getList();
  725. });
  726. }
  727. },
  728. });
  729. },
  730. handAdd(id) {
  731. const storageKey = Date.now() + "";
  732. uni.setStorageSync(storageKey, this.List || []);
  733. uni.navigateTo({
  734. url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=feed&taskId=${this.taskId}`,
  735. });
  736. },
  737. openDetails(id) {
  738. const storageKey = Date.now() + "";
  739. uni.setStorageSync(storageKey, this.List || []);
  740. let url = `/pages/pda/feeding/single?id=${id}&taskId=${this.taskId}&storageKey=${storageKey}`;
  741. uni.navigateTo({
  742. url,
  743. });
  744. },
  745. checkdDevice() {
  746. return new Promise((resolve) => {
  747. console.log(this.List);
  748. let isFalse = this.List.every((item) => {
  749. return item.equipmentList && item.equipmentList.length > 0;
  750. });
  751. if (isFalse) {
  752. resolve(true);
  753. } else {
  754. uni.showToast({
  755. title: "请添加设备",
  756. icon: "none", // 可选值:'success', 'loading', 'none'
  757. duration: 3000, // 持续时间,单位ms
  758. });
  759. resolve(false);
  760. // uni.showModal({
  761. // title: '提示',
  762. // content: '没有选择设备,是否继续?',
  763. // confirmText: '确认', //这块是确定按钮的文字
  764. // success: function (res) {
  765. // if (res.confirm) {
  766. // resolve(true)
  767. // } else {
  768. // resolve(false)
  769. // }
  770. // }
  771. // })
  772. }
  773. });
  774. },
  775. },
  776. beforeDestroy() {
  777. uni.hideLoading();
  778. },
  779. };
  780. </script>
  781. <style lang="scss" scoped>
  782. .content-box {
  783. height: 100vh;
  784. overflow: hidden;
  785. display: flex;
  786. flex-direction: column;
  787. }
  788. .list_box {
  789. flex: 1;
  790. overflow: hidden;
  791. padding: 4rpx 0;
  792. .u-list {
  793. height: 100% !important;
  794. }
  795. .card_box {
  796. padding: 16rpx;
  797. }
  798. }
  799. .bottom-wrapper {
  800. width: 100%;
  801. display: flex;
  802. align-items: center;
  803. justify-content: space-around;
  804. .btn_box {
  805. width: 50%;
  806. height: 88rpx;
  807. line-height: 88rpx;
  808. background: $theme-color;
  809. text-align: center;
  810. font-size: 36rpx;
  811. font-style: normal;
  812. font-weight: 400;
  813. color: #fff;
  814. &:first-child {
  815. border-right: 2rpx solid #fff;
  816. }
  817. }
  818. }
  819. .operate_box {
  820. position: fixed;
  821. right: 0;
  822. top: 400rpx;
  823. /deep/ .u-button {
  824. margin-top: 20rpx;
  825. width: 150rpx;
  826. border-radius: 22rpx 0 0 22rpx;
  827. opacity: 0.6;
  828. font-size: 22rpx;
  829. }
  830. }
  831. .operate_box2 {
  832. display: flex;
  833. /deep/ .u-button {
  834. margin-top: 20rpx;
  835. width: 150rpx;
  836. }
  837. }
  838. .flex_btn {
  839. position: fixed;
  840. right: 0;
  841. bottom: 160rpx;
  842. width: 40rpx;
  843. height: 50rpx;
  844. line-height: 66rpx;
  845. border-radius: 22rpx 0 0 22rpx;
  846. background: $theme-color;
  847. text-align: center;
  848. font-size: 22rpx;
  849. font-style: normal;
  850. font-weight: 400;
  851. color: #fff;
  852. opacity: 0.6;
  853. .jiantou {
  854. width: 30rpx;
  855. height: 30rpx;
  856. }
  857. }
  858. .flex_btn2 {
  859. position: fixed;
  860. right: 0;
  861. bottom: 160rpx;
  862. width: 126rpx;
  863. min-height: 140rpx;
  864. line-height: 62rpx;
  865. border-radius: 22rpx 0 0 22rpx;
  866. background: $theme-color;
  867. text-align: center;
  868. font-size: 22rpx;
  869. font-style: normal;
  870. font-weight: 400;
  871. color: #fff;
  872. opacity: 0.7;
  873. .close_box {
  874. height: 50rpx;
  875. line-height: 50rpx;
  876. width: 126rpx;
  877. text-align: left;
  878. .close {
  879. width: 40rpx;
  880. height: 40rpx;
  881. padding: 6rpx 10rpx;
  882. }
  883. }
  884. }
  885. </style>