details.vue 31 KB

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