details.vue 27 KB

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