details.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="领料"
  8. background-color="#F7F9FA"
  9. color="#404446"
  10. @clickLeft="back"
  11. ></uni-nav-bar>
  12. <u-button
  13. type="success"
  14. size="small"
  15. class="u-reset-button-ii"
  16. v-if="clientEnvironmentId == 21"
  17. @click="undatePicking()"
  18. text="刷新库存"
  19. ></u-button>
  20. <view class="list_box">
  21. <u-list @scrolltolower="scrolltolower">
  22. <view v-for="(item, index) in List" :key="index" class="card_box">
  23. <view class="title_box rx-bc">
  24. <view class="left rx-sc">
  25. <view class="round">{{ index + 1 }}</view>
  26. <view class="code">工单编号:{{ item.code }}</view>
  27. </view>
  28. <view class="right_box rx-ec" v-if="clientEnvironmentId !== 9">
  29. <u-button
  30. type="success"
  31. size="small"
  32. class="u-reset-button"
  33. v-if="isOutsource == 0"
  34. @click="addPicking(item.workOrderId, item)"
  35. text="添加物料"
  36. ></u-button>
  37. </view>
  38. </view>
  39. <view style="display: flex; justify-items: start">
  40. <view
  41. class="select"
  42. @click="selectAll(item.bomList)"
  43. style="width: 64px"
  44. >全选/取消</view
  45. >
  46. <!-- <view
  47. class="select"
  48. @click="warehouseShowFn(item.id)"
  49. style="width: 85px; margin-left: 10px"
  50. >
  51. 一键选择仓库</view
  52. > -->
  53. </view>
  54. <view
  55. class="material rx-ss"
  56. v-for="(mate, idx) in item.pickList"
  57. :key="idx"
  58. >
  59. <view class="left rx-ss" @click="mate.checked = !mate.checked">
  60. <view
  61. class="zdy_check rx-cc"
  62. :class="{ check_active: mate.checked }"
  63. >
  64. <u-icon
  65. size="28"
  66. v-if="mate.checked"
  67. name="checkbox-mark"
  68. ></u-icon>
  69. </view>
  70. </view>
  71. <view class="content_table">
  72. <view class="item">
  73. <view class="lable rx-cc">物料编码</view>
  74. <view class="content ellipsis">
  75. {{ mate.categoryCode }}
  76. </view>
  77. </view>
  78. <view class="item">
  79. <view class="lable rx-cc">名称</view>
  80. <view class="content ellipsis">{{ mate.categoryName }}</view>
  81. </view>
  82. <view class="item rx-sc">
  83. <view class="rx ww55">
  84. <view class="lable rx-cc">型号</view>
  85. <view class="content ellipsis">{{ mate.modelType }}</view>
  86. </view>
  87. <view class="rx ww45">
  88. <view class="lable rx-cc ww80">规格</view>
  89. <view class="content ellipsis">{{ mate.specification }}</view>
  90. </view>
  91. </view>
  92. <view class="item rx-sc">
  93. <view class="rx ww55">
  94. <view class="lable rx-cc">类型</view>
  95. <view class="content">{{
  96. typeName[Number(mate.rootCategoryLevelId)]
  97. }}</view>
  98. </view>
  99. <view class="rx ww45">
  100. <view class="lable rx-cc ww80">数量</view>
  101. <view class="content content_num">
  102. <input
  103. class="uni-input"
  104. v-model="mate.demandQuantity"
  105. type="digit"
  106. :disabled="clientEnvironmentId == 9"
  107. @input="changeInput(mate, idx, index)"
  108. />
  109. <view class="unit">{{ mate.unit }}</view>
  110. </view>
  111. </view>
  112. </view>
  113. <view class="item">
  114. <view class="lable rx-cc">计量库存数量</view>
  115. <view class="content pd4">
  116. <view v-for="it of mate.warehouseList">
  117. <view
  118. v-if="it.availableCountBase != '0'"
  119. class="content"
  120. @click="chooseInventoryData(mate, it, idx)"
  121. style="cursor: pointer"
  122. >{{ it.name ? it.name : it.warehouse_name }}库存数:<span
  123. style="color: green"
  124. >{{ it.availableCountBase }}</span
  125. >{{ mate.measuringUnit }}</view
  126. >
  127. </view>
  128. <!-- <view class="content"
  129. >{{ mate.availableCountBase }} {{ mate.unit }}</view
  130. > -->
  131. </view>
  132. </view>
  133. <view class="item">
  134. <view class="lable rx-cc">领料仓库</view>
  135. <view class="content pd4">
  136. <zxz-uni-data-select
  137. :localdata="mate.warehouseList"
  138. v-model="mate.warehouseIdList"
  139. dataValue="warehouse_id"
  140. format="{warehouse_name}"
  141. dataKey="warehouse_name"
  142. :clear="false"
  143. multiple
  144. ></zxz-uni-data-select>
  145. </view>
  146. </view>
  147. <view class="item" v-if="clientEnvironmentId == 21">
  148. <view class="lable rx-cc">库存可用量</view>
  149. <view class="content">{{ mate.waitOutInWeight }}</view>
  150. </view>
  151. </view>
  152. </view>
  153. <view>
  154. <instanceBom
  155. :list="item.instanceList2"
  156. :warehouseList="warehouseList"
  157. ></instanceBom>
  158. <modelBom
  159. :workOrderId="item.workOrderId"
  160. :modelList="item.modelList"
  161. :warehouseList="warehouseList"
  162. :modelList2="item.modelList2"
  163. :code="item.code"
  164. @hendDel="hendDel"
  165. >
  166. </modelBom>
  167. <boatBom
  168. :palletList="item.palletList"
  169. :palletList2="item.palletList2"
  170. :code="item.code"
  171. :warehouseList="warehouseList"
  172. :resObj="item"
  173. @hendDel="hendDel"
  174. >
  175. </boatBom>
  176. <packingBom
  177. :list="item.packingList2"
  178. :warehouseList="warehouseList"
  179. ></packingBom>
  180. <semiProductBom
  181. :warehouseList="warehouseList"
  182. :list="[
  183. ...item.semiProductList2,
  184. ...item.productList2,
  185. ...item.junkProductList2,
  186. ]"
  187. >
  188. </semiProductBom>
  189. <view style="height: 80rpx"></view>
  190. <view class="flex_btn" v-if="isPick" @click="openDetails"
  191. >已有领料单</view
  192. >
  193. </view>
  194. </view>
  195. <view class="out_box" v-if="isOutsource == 1">
  196. <view class="out_text" @click="getListOutsource()"
  197. >重新获取委外领料单</view
  198. >
  199. </view>
  200. </u-list>
  201. </view>
  202. <u-popup
  203. :show="warehouseShow"
  204. mode="center"
  205. v-if="warehouseShow"
  206. :closeOnClickOverlay="false"
  207. >
  208. <view class="popup_list">
  209. <view class="lable rx-cc">领料仓库</view>
  210. <view class="content pd4">
  211. <zxz-uni-data-select
  212. :localdata="warehouseList"
  213. v-model="warehouseId"
  214. dataValue="id"
  215. format="{name}"
  216. dataKey="name"
  217. filterable
  218. :clear="false"
  219. ></zxz-uni-data-select>
  220. </view>
  221. </view>
  222. <view class="operate_box rx-bc">
  223. <u-button
  224. size="small"
  225. class="u-reset-button"
  226. @click="warehouseShow = fasle"
  227. >
  228. 取消
  229. </u-button>
  230. <u-button
  231. type="success"
  232. size="small"
  233. class="u-reset-button"
  234. @click="handOK"
  235. >
  236. 确认
  237. </u-button>
  238. </view>
  239. </u-popup>
  240. <view class="bottom-wrapper">
  241. <view class="btn_box" @click="save">{{ submitText }}</view>
  242. </view>
  243. <outsourceOrder
  244. ref="outsourceRef"
  245. @outsourceEmit="outsourceFn"
  246. ></outsourceOrder>
  247. </view>
  248. </template>
  249. <script>
  250. import instanceBom from "./components/instanceBom.vue";
  251. import modelBom from "./components/modelBom.vue";
  252. import boatBom from "./components/boatBom.vue";
  253. import packingBom from "./components/packingBom";
  254. import semiProductBom from "./components/semiProductBom";
  255. import outsourceOrder from "./components/outsourceOrder";
  256. import { typeName } from "./components/common.js";
  257. import {
  258. znPdaPage,
  259. workorderList,
  260. listOutsourceInWarehouse,
  261. listOutsource,
  262. currentStockQuery,
  263. getInventoryTotal,
  264. } from "@/api/pda/workOrder.js";
  265. import { VirtualPagination } from "@/utils/pages.js";
  266. import {
  267. batchSave,
  268. pickDetails,
  269. findVoucherList,
  270. batchPcSave,
  271. getCode,
  272. } from "@/api/pda/picking.js";
  273. import { getWarehouseList } from "@/api/warehouseManagement";
  274. import { forIn } from "lodash";
  275. export default {
  276. components: {
  277. instanceBom,
  278. modelBom,
  279. boatBom,
  280. packingBom,
  281. semiProductBom,
  282. outsourceOrder,
  283. },
  284. data() {
  285. return {
  286. isType: true,
  287. warehouseShow: false,
  288. warehouseId: "",
  289. warehouseList: [],
  290. idsList: [],
  291. List: [],
  292. currentId: "",
  293. pagination: {},
  294. classificationList: [], //分类数据
  295. newListOne: [],
  296. taskId: null,
  297. isPick: false,
  298. isOutsource: 0,
  299. clientEnvironmentId:
  300. uni.getStorageSync("userInfo") &&
  301. uni.getStorageSync("userInfo").clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  302. submitText: "提交",
  303. pickName: "",
  304. pickCode: "",
  305. typeName,
  306. };
  307. },
  308. onLoad(options) {
  309. console.log(options, "1111111111");
  310. let queryArray = decodeURIComponent(options.arr);
  311. getWarehouseList().then((res) => {
  312. this.warehouseList = res.data;
  313. });
  314. this.idsList = JSON.parse(queryArray);
  315. this.isOutsource = Number(options.isOutsource) || 0;
  316. this.taskId = options.taskId;
  317. console.log(this.clientEnvironmentId, "this.clientEnvironmentId");
  318. if (this.clientEnvironmentId == 21) {
  319. this.getZnList();
  320. } else {
  321. this.getList();
  322. }
  323. if (this.idsList.length == 1) {
  324. this.getPick();
  325. }
  326. if (this.isOutsource == 1) {
  327. this.getListOutsource();
  328. }
  329. },
  330. onShow() {
  331. uni.$off("setSelectList");
  332. uni.$on("setSelectList", (selectList, id) => {
  333. selectList.forEach((item) => {
  334. item.warehouseList = item.warehouseList
  335. ? item.warehouseList
  336. : item.warehouseLists;
  337. });
  338. // list.forEach((it) => {
  339. // if (it.warehouseList.length != 0) {
  340. // if (!it.warehouseIdList) {
  341. // it.warehouseIdList = [];
  342. // it.warehouseIdList.push(it.warehouseList[0].warehouse_id);
  343. // }
  344. // }
  345. // });
  346. this.List.forEach((e) => {
  347. if (e.id == id) {
  348. e.pickList = [...e.pickList, ...selectList];
  349. this.$forceUpdate();
  350. }
  351. });
  352. // this.List.forEach((m) => {
  353. // if (m.workOrderId == id) {
  354. // let instanceList2 = []; // 投料
  355. // let modelList2 = []; // 模具
  356. // let palletList2 = [];
  357. // let packingList2 = []; // 包装
  358. // let semiProductList2 = []; //半成品
  359. // let productList2 = []; // 产品
  360. // let junkProductList2 = []; //废品
  361. // selectList.forEach((f) => {
  362. // if (![5, 8, 13, 23, 9, 28].includes(f.rootCategoryLevelId)) {
  363. // f.automatic = 1;
  364. // instanceList2 = instanceList2.concat(f);
  365. // } else if (f.rootCategoryLevelId == 5) {
  366. // // 模具
  367. // f.automatic = 1;
  368. // modelList2 = modelList2.concat(f);
  369. // } else if (f.rootCategoryLevelId == 8) {
  370. // // 舟皿
  371. // f.automatic = 1;
  372. // palletList2 = palletList2.concat(f);
  373. // } else if (f.rootCategoryLevelId == 13) {
  374. // f.automatic = 1;
  375. // packingList2 = packingList2.concat(f);
  376. // } else if (f.rootCategoryLevelId == 23) {
  377. // f.automatic = 1;
  378. // semiProductList2 = semiProductList2.concat(f);
  379. // } else if (f.rootCategoryLevelId == 9) {
  380. // f.automatic = 1;
  381. // productList2 = productList2.concat(f);
  382. // } else if (f.rootCategoryLevelId == 28) {
  383. // f.automatic = 1;
  384. // junkProductList2 = junkProductList2.concat(f);
  385. // }
  386. // });
  387. // this.$set(m, "instanceList2", instanceList2);
  388. // this.$set(m, "modelList2", modelList2);
  389. // this.$set(m, "palletList2", palletList2);
  390. // this.$set(m, "packingList2", packingList2);
  391. // this.$set(m, "semiProductList2", semiProductList2);
  392. // this.$set(m, "productList2", productList2);
  393. // this.$set(m, "junkProductList2", junkProductList2);
  394. // }
  395. // });
  396. });
  397. },
  398. methods: {
  399. selectAll(list) {
  400. if (Array.isArray(list) && list.length) {
  401. // let a = list.some(v=>v.checked = true)
  402. // ture 就是取消 false 就是选中
  403. if (this.isType) {
  404. list.map((d) => {
  405. d.checked = false;
  406. });
  407. this.isType = false;
  408. } else {
  409. list.map((d) => {
  410. d.checked = true;
  411. });
  412. this.isType = true;
  413. }
  414. }
  415. console.log(list, "list");
  416. },
  417. //刷新库存
  418. async undatePicking() {
  419. uni.showLoading({
  420. title: "加载中...",
  421. });
  422. const res = await currentStockQuery(this.idsList[0]);
  423. uni.hideLoading();
  424. this.getZnList();
  425. },
  426. warehouseShowFn(tiemId) {
  427. this.warehouseShow = true;
  428. this.currentId = tiemId;
  429. },
  430. handOK() {
  431. let index = this.List.findIndex((item) => item.id == this.currentId);
  432. // this.$set(this.List[index], 'warehouseId', this.warehouseId)
  433. console.log(this.List[index], "this.List[index]");
  434. for (let key in this.List[index]) {
  435. if (
  436. [
  437. "instanceList2",
  438. "modelList2",
  439. "palletList2",
  440. "packingList2",
  441. "semiProductList2",
  442. "productList2",
  443. "junkProductList2",
  444. "bomList",
  445. "pickList",
  446. ].includes(key)
  447. ) {
  448. this.List[index][key].forEach((item, i) => {
  449. this.$set(
  450. this.List[index][key][i],
  451. "warehouseId",
  452. this.warehouseId
  453. );
  454. });
  455. }
  456. }
  457. this.warehouseShow = false;
  458. this.currentId = "";
  459. },
  460. scrolltolower() {
  461. let arr = this.pagination ? this.pagination.nextPage() : [];
  462. if (arr.length) {
  463. this.List[0].bomList = [...this.List[0].bomList, ...arr];
  464. }
  465. },
  466. save() {
  467. // let _arr = [];
  468. // console.log(this.newList, "m");
  469. // if (this.clientEnvironmentId !== 21) {
  470. // _arr = this.List.map((m) => {
  471. // console.log(m, "m");
  472. // if (m.bomList.length > 0) {
  473. // let bomList = m.bomList.filter((f) => f.checked);
  474. // m["bomDetailDTOSList"] = [
  475. // ...bomList,
  476. // ...m.modelList,
  477. // ...m.palletList,
  478. // ];
  479. // }
  480. // m.instanceList = [
  481. // ...m.instanceList2,
  482. // ...m.modelList2,
  483. // ...m.palletList2,
  484. // ...m.packingList2,
  485. // ...m.semiProductList2,
  486. // ...m.productList2,
  487. // ...m.junkProductList2,
  488. // ];
  489. // m.isOutsource = this.isOutsource;
  490. // return {
  491. // ...m,
  492. // };
  493. // });
  494. // }
  495. // if (this.clientEnvironmentId == 21) {
  496. // this.submitText = "领料中";
  497. // findVoucherList({
  498. // workOrderId: this.idsList[0],
  499. // }).then((res) => {
  500. // // uni.navigateTo({
  501. // // url: `/pages/pda/picking/index/index?pickStatus=1`,
  502. // // });
  503. // uni.showToast({
  504. // title: "领料成功",
  505. // mask: true,
  506. // duration: 1500,
  507. // });
  508. // uni.navigateBack({
  509. // delta: 1,
  510. // });
  511. // });
  512. // } else {
  513. // batchSave(_arr).then((res) => {
  514. // uni.navigateTo({
  515. // url: `/pages/pda/picking/index/index?pickStatus=1`,
  516. // });
  517. // });
  518. // }
  519. if (this.List.length > 0) {
  520. let bol;
  521. let _i;
  522. bol = this.List.every((e, i) => {
  523. _i = i;
  524. return (
  525. Object.prototype.hasOwnProperty.call(e, "pickList") &&
  526. e.pickList.length > 0
  527. );
  528. });
  529. if (!bol) {
  530. this.$message.warning(
  531. `生成工单${this.workList[_i].code}领料不能为空`
  532. );
  533. return false;
  534. }
  535. }
  536. if (this.List.length > 0) {
  537. let name;
  538. let bol2;
  539. let _i;
  540. this.List.forEach((e, i) => {
  541. _i = i;
  542. console.log(e.pickList);
  543. bol2 = e.pickList.every((y) => {
  544. name = y.name;
  545. return (
  546. Object.prototype.hasOwnProperty.call(y, "demandQuantity") &&
  547. Number(y.demandQuantity) > 0
  548. );
  549. });
  550. });
  551. if (!bol2) {
  552. this.$message.warning(
  553. `${this.workList[_i].code}的${name}数量不能为空`
  554. );
  555. return false;
  556. }
  557. }
  558. let _arr = [];
  559. _arr = this.List.map((m) => {
  560. m.instanceList = [];
  561. m.bomDetailDTOSList = [];
  562. m.pickList.forEach((e) => {
  563. if (
  564. Object.prototype.hasOwnProperty.call(e, "isBom") &&
  565. e.isBom == 1
  566. ) {
  567. m.bomDetailDTOSList.push(e);
  568. } else {
  569. m.instanceList.push(e);
  570. }
  571. });
  572. m.workOrderId = m.id;
  573. return {
  574. ...m,
  575. };
  576. });
  577. // this.loadingBtn = true;
  578. // _arr.forEach((item) => {
  579. // item.pickList.forEach((it) => {
  580. // const warehousePick = [];
  581. // if (it.warehouseIdList.length != 0) {
  582. // it.warehouseIdList.forEach((i) => {
  583. // const data = it.warehouseList.find((ii) => ii.id == i);
  584. // if (data) {
  585. // warehousePick.push({
  586. // availableCountBase: data.availableCountBase,
  587. // demandQuantity: data.demandQuantity,
  588. // warehouseId: data.id
  589. // });
  590. // }
  591. // });
  592. // }
  593. // it.warehousePick = warehousePick;
  594. // });
  595. // });
  596. // console.log(_arr, "_arr");
  597. // return;
  598. // if (this.clientEnvironmentId == 21) {
  599. // let param = {
  600. // workOrderId: this.workListIds[0],
  601. // pickingCode: this.pickCode
  602. // };
  603. // znfindVoucherList(param).then((res) => {
  604. // this.loadingBtn = false;
  605. // this.$message.success('领料成功');
  606. // });
  607. // }
  608. let param = {
  609. allPickList: _arr,
  610. pickName: this.pickName,
  611. pickCode: this.pickCode,
  612. };
  613. batchPcSave(param)
  614. .then((res) => {
  615. uni.navigateTo({
  616. url: `/pages/pda/picking/index/index?pickStatus=1`,
  617. });
  618. // this.loadingBtn = false;
  619. // this.$message.success("领料成功");
  620. // this.$emit("close", true);
  621. })
  622. .catch((err) => {
  623. // this.loadingBtn = false;
  624. });
  625. // batchPcSave
  626. },
  627. // 中赢保存
  628. getZnList() {
  629. znPdaPage({
  630. // ids: ,
  631. workId: this.idsList[0],
  632. }).then((res) => {
  633. if (res?.length) {
  634. let List = res.map((m) => {
  635. m.workOrderId = m.id;
  636. let modelList = [];
  637. let palletList = [];
  638. // let bomList = []
  639. // m.bomDetailDTOS.forEach((f, i) => {
  640. // if (f.rootCategoryLevelId == 5) {
  641. // f.automatic = 2
  642. // modelList = modelList.concat(f)
  643. // }
  644. // if (f.rootCategoryLevelId == 8) {
  645. // f.automatic = 2
  646. // palletList = palletList.concat(f)
  647. // }
  648. // if (f.rootCategoryLevelId != 5 && f.rootCategoryLevelId != 8) {
  649. // f.automatic = 2
  650. // bomList = bomList.concat(f)
  651. // }
  652. // })
  653. m["modelList"] = modelList;
  654. m["palletList"] = palletList;
  655. // m['bomList'] = bomList
  656. m["modelList2"] = [];
  657. m["instanceList2"] = [];
  658. m["palletList2"] = [];
  659. m["packingList2"] = [];
  660. m["semiProductList2"] = [];
  661. m["productList2"] = [];
  662. m["junkProductList2"] = [];
  663. delete m.id;
  664. return {
  665. ...m,
  666. };
  667. });
  668. this.newListOne = JSON.parse(JSON.stringify(List));
  669. this.pagination = new VirtualPagination(List[0].bomList, 10);
  670. List[0].bomList = this.pagination.getCurrentPageData();
  671. this.List = List;
  672. }
  673. });
  674. },
  675. deepCopy(obj, hash = new WeakMap()) {
  676. if (obj === null) return null;
  677. if (obj instanceof Date) return new Date(obj);
  678. if (obj instanceof RegExp) return new RegExp(obj);
  679. if (typeof obj !== "object" && typeof obj !== "function") return obj;
  680. if (hash.has(obj)) return hash.get(obj);
  681. const result = Array.isArray(obj) ? [] : {};
  682. hash.set(obj, result);
  683. return Object.keys(obj).reduce((acc, key) => {
  684. acc[key] = this.deepCopy(obj[key], hash);
  685. return acc;
  686. }, result);
  687. },
  688. changeInput(item, idx, index) {
  689. if (Number(item.demandQuantity) >= Number(item.availableCountBase)) {
  690. this.$set(
  691. this.List[index].pickList[idx],
  692. "demandQuantity",
  693. Number(item.availableCountBase)
  694. );
  695. const idsList = [];
  696. item.warehouseList.forEach((it) => {
  697. idsList.push(it.warehouse_id);
  698. });
  699. this.$set(this.List[index].pickList[idx], "warehouseIdList", idsList);
  700. this.$forceUpdate();
  701. } else if (!Number(item.demandQuantity)) {
  702. this.$set(this.List[index].pickList[idx], "warehouseIdList", []);
  703. this.$forceUpdate();
  704. } else {
  705. const idsList = [];
  706. let totalNum = 0;
  707. for (let i = 0; i < item.warehouseList.length; i++) {
  708. totalNum += Number(item.warehouseList[i].availableCountBase);
  709. if (Number(item.demandQuantity) > totalNum) {
  710. idsList.push(item.warehouseList[i].warehouse_id);
  711. } else {
  712. idsList.push(item.warehouseList[i].warehouse_id);
  713. break;
  714. }
  715. }
  716. this.$set(this.List[index].pickList[idx], "warehouseIdList", idsList);
  717. this.$forceUpdate();
  718. }
  719. },
  720. getList() {
  721. workorderList({
  722. ids: this.idsList,
  723. taskId: this.taskId,
  724. }).then((res) => {
  725. console.log("领料列表", res);
  726. this.List = res.map((m) => {
  727. m.workOrderId = m.id;
  728. let modelList = [];
  729. let palletList = [];
  730. let bomList = [];
  731. m.bomDetailDTOS.forEach((f, i) => {
  732. if (f.rootCategoryLevelId == 5) {
  733. f.automatic = 2;
  734. modelList = modelList.concat(f);
  735. }
  736. if (f.rootCategoryLevelId == 8) {
  737. f.automatic = 2;
  738. palletList = palletList.concat(f);
  739. }
  740. if (f.rootCategoryLevelId != 5 && f.rootCategoryLevelId != 8) {
  741. f.automatic = 2;
  742. bomList = bomList.concat(f);
  743. }
  744. });
  745. m["modelList"] = modelList;
  746. m["palletList"] = palletList;
  747. m["pickList"] = bomList;
  748. m["modelList2"] = [];
  749. m["instanceList2"] = [];
  750. m["palletList2"] = [];
  751. m["packingList2"] = [];
  752. m["semiProductList2"] = [];
  753. m["productList2"] = [];
  754. m["junkProductList2"] = [];
  755. m.pickList.forEach((it) => {
  756. it.warehouseIdList = [];
  757. it.warehouseIdList.push(it.warehouseId);
  758. it.warehouseList.forEach((i) => {
  759. i.warehouse_name = i.name;
  760. i.warehouse_id = i.id;
  761. });
  762. });
  763. console.log(m, "mmmm");
  764. // delete m.id;
  765. return {
  766. ...m,
  767. };
  768. });
  769. this.pickName = res[0].productName + "领料";
  770. this.getOrderCode();
  771. // this.getInventoryTotalFn();
  772. });
  773. },
  774. //计量库存数量
  775. getInventoryTotalFn() {
  776. let ids = [];
  777. this.List.map((item) => {
  778. item.bomList.map((pitem) => {
  779. ids.push(pitem.categoryCode);
  780. });
  781. });
  782. if (ids.length == 0) {
  783. return;
  784. }
  785. getInventoryTotal(ids).then((res) => {
  786. res.map((ritem) => {
  787. this.List.map((item) => {
  788. item.bomList.map((pitem) => {
  789. if (pitem.categoryCode == ritem.code) {
  790. pitem.availableCountBase = ritem.availableCountBase;
  791. }
  792. });
  793. });
  794. });
  795. });
  796. },
  797. async getOrderCode() {
  798. this.pickCode = await getCode("pick_order_code");
  799. },
  800. hendDel(type, code, list) {
  801. if (type == "modelBom") {
  802. console.log(list.length);
  803. if (list.length == 0) {
  804. }
  805. this.List.forEach((f) => {
  806. if (f.code == code) {
  807. if (list.length == 0) {
  808. f.modelList2 = [];
  809. f.modelList = [];
  810. return false;
  811. }
  812. f.modelList2 = list.filter((t) => t.automatic == 1);
  813. f.modelList = list.filter((t) => t.automatic == 2);
  814. }
  815. });
  816. }
  817. if (type == "boatBom") {
  818. this.List.forEach((f) => {
  819. if (f.code == code) {
  820. if (list.length == 0) {
  821. f.palletList2 = [];
  822. f.palletList = [];
  823. return false;
  824. }
  825. f.palletList2 = list.filter((t) => t.automatic == 1);
  826. f.palletList = list.filter((t) => t.automatic == 2);
  827. }
  828. });
  829. }
  830. this.$forceUpdate();
  831. },
  832. getListOutsource(list) {
  833. let param = {
  834. workOrderId: this.idsList,
  835. taskId: this.taskId,
  836. };
  837. listOutsource(param).then((res) => {
  838. if (res) {
  839. this.$refs.outsourceRef.open(res);
  840. } else {
  841. uni.showToast({
  842. title: "暂无委外申请单",
  843. icon: "none",
  844. });
  845. }
  846. });
  847. },
  848. outsourceFn(list) {
  849. this.outsourceInWarehouseFn(list);
  850. },
  851. addPicking(id, item) {
  852. const storageKey = Date.now() + "";
  853. let arr = [
  854. ...item.instanceList2,
  855. ...item.modelList2,
  856. ...item.palletList2,
  857. ...item.packingList2,
  858. ...item.semiProductList2,
  859. ...item.productList2,
  860. ...item.junkProductList2,
  861. ];
  862. uni.setStorageSync(storageKey, arr);
  863. uni.navigateTo({
  864. url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=pick&taskId=${this.taskId}`,
  865. });
  866. },
  867. getPick() {
  868. pickDetails(this.idsList).then((res) => {
  869. if (res && res.length > 0) {
  870. this.isPick = true;
  871. }
  872. });
  873. },
  874. outsourceInWarehouseFn(list) {
  875. let param = {
  876. outsourceOrder: list || [],
  877. workOrderId: this.idsList[0],
  878. taskId: this.taskId,
  879. };
  880. listOutsourceInWarehouse(param).then((res) => {
  881. res.list.map((m) => {
  882. m.isOut = 1;
  883. return {
  884. ...m,
  885. };
  886. });
  887. let _arr = [...this.List[0].instanceList2, ...res.list];
  888. this.$set(this.List[0], "instanceList2", _arr);
  889. this.$forceUpdate();
  890. });
  891. },
  892. openDetails() {
  893. let url = `/pages/pda/picking/bill/index?id=${this.idsList[0]}`;
  894. uni.navigateTo({
  895. url,
  896. });
  897. },
  898. },
  899. beforeDestroy() {
  900. uni.hideLoading();
  901. },
  902. };
  903. </script>
  904. <style lang="scss" scoped>
  905. .select {
  906. display: flex;
  907. align-items: center;
  908. justify-content: center;
  909. padding: 5rpx 0;
  910. width: 150rpx;
  911. background-color: #157a2c;
  912. color: #fff;
  913. font-size: 24rpx;
  914. border-radius: 5rpx;
  915. }
  916. .u-reset-button-ii {
  917. position: relative;
  918. right: -251rpx;
  919. width: 200rpx;
  920. }
  921. .content-box {
  922. height: 100vh;
  923. overflow: hidden;
  924. display: flex;
  925. flex-direction: column;
  926. }
  927. .list_box {
  928. flex: 1;
  929. overflow: hidden;
  930. padding: 4rpx 0;
  931. .u-list {
  932. height: 100% !important;
  933. }
  934. .card_box {
  935. padding: 16rpx 24rpx;
  936. }
  937. .title_box {
  938. .round {
  939. width: 32rpx;
  940. height: 32rpx;
  941. line-height: 32rpx;
  942. border-radius: 50%;
  943. background: $theme-color;
  944. color: #fff;
  945. text-align: center;
  946. font-size: 20rpx;
  947. }
  948. .code {
  949. margin-left: 16rpx;
  950. font-family: PingFang SC;
  951. font-size: 28rpx;
  952. font-style: normal;
  953. font-weight: 400;
  954. color: $theme-color;
  955. }
  956. }
  957. .material {
  958. margin-top: 10rpx;
  959. .left {
  960. width: 40rpx;
  961. }
  962. .zdy_check {
  963. width: 30rpx;
  964. height: 30rpx;
  965. border: 2rpx solid #c8c9cc;
  966. border-radius: 4rpx;
  967. }
  968. .check_active {
  969. background: $theme-color;
  970. border: 2rpx solid $theme-color;
  971. /deep/ .u-icon__icon {
  972. color: #fff !important;
  973. }
  974. }
  975. .content_table {
  976. width: 652rpx;
  977. border: 2rpx solid $border-color;
  978. .item {
  979. display: flex;
  980. border-bottom: 2rpx solid $border-color;
  981. .lable {
  982. width: 132rpx;
  983. text-align: center;
  984. background-color: #f7f9fa;
  985. font-size: 26rpx;
  986. border-right: 2rpx solid $border-color;
  987. flex-shrink: 0;
  988. }
  989. .ww80 {
  990. width: 80rpx;
  991. }
  992. .content {
  993. width: 518rpx;
  994. min-height: 64rpx;
  995. font-size: 28rpx;
  996. line-height: 28rpx;
  997. font-style: normal;
  998. font-weight: 400;
  999. padding: 18rpx 8rpx;
  1000. box-sizing: border-box;
  1001. word-wrap: break-word;
  1002. flex-grow: 1 !important;
  1003. }
  1004. .content_num {
  1005. display: flex;
  1006. align-items: center;
  1007. padding: 0 4rpx;
  1008. /deep/ .uni-input-input {
  1009. border: 2rpx solid #f0f8f2;
  1010. background: #f0f8f2;
  1011. color: $theme-color;
  1012. }
  1013. .unit {
  1014. width: 90rpx;
  1015. text-align: center;
  1016. font-size: 24rpx;
  1017. color: #404446;
  1018. }
  1019. }
  1020. .pd4 {
  1021. padding: 4rpx 8rpx;
  1022. }
  1023. &:last-child {
  1024. border-bottom: none;
  1025. }
  1026. }
  1027. .ww55 {
  1028. width: 55%;
  1029. }
  1030. .ww45 {
  1031. width: 45%;
  1032. }
  1033. }
  1034. }
  1035. }
  1036. .ellipsis {
  1037. white-space: nowrap; /* 强制不换行 */
  1038. overflow: hidden; /* 超出部分隐藏 */
  1039. text-overflow: ellipsis; /* 显示省略号 */
  1040. }
  1041. .bottom-wrapper {
  1042. .btn_box {
  1043. width: 750rpx;
  1044. height: 88rpx;
  1045. line-height: 88rpx;
  1046. background: $theme-color;
  1047. text-align: center;
  1048. font-size: 36rpx;
  1049. font-style: normal;
  1050. font-weight: 400;
  1051. color: #fff;
  1052. }
  1053. }
  1054. .flex_btn {
  1055. position: fixed;
  1056. right: 0;
  1057. bottom: 160rpx;
  1058. width: 140rpx;
  1059. height: 66rpx;
  1060. line-height: 66rpx;
  1061. border-radius: 22rpx 0 0 22rpx;
  1062. background: $theme-color;
  1063. text-align: center;
  1064. font-size: 22rpx;
  1065. font-style: normal;
  1066. font-weight: 400;
  1067. color: #fff;
  1068. }
  1069. .out_box {
  1070. margin: 20rpx;
  1071. display: flex;
  1072. justify-content: center;
  1073. color: $theme-color;
  1074. font-size: 28rpx;
  1075. }
  1076. .popup_list {
  1077. width: 400rpx;
  1078. height: 400rpx;
  1079. }
  1080. </style>