details.vue 27 KB

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