details.vue 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211
  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. uni.showToast({
  534. title: `生成工单${this.List[_i].code}领料不能为空`,
  535. icon: "none",
  536. });
  537. return false;
  538. }
  539. }
  540. if (this.List.length > 0) {
  541. let name;
  542. let bol2;
  543. let _i;
  544. this.List.forEach((e, i) => {
  545. _i = i;
  546. console.log(e.pickList);
  547. bol2 = e.pickList.every((y) => {
  548. name = y.name;
  549. return (
  550. Object.prototype.hasOwnProperty.call(y, "demandQuantity") &&
  551. Number(y.demandQuantity) > 0
  552. );
  553. });
  554. });
  555. if (!bol2) {
  556. // this.$message.warning(
  557. // `${this.workList[_i].code}的${name}数量不能为空`
  558. // );
  559. uni.showToast({
  560. title: `${this.List[_i].code}的${name}数量不能为空`,
  561. icon: "none",
  562. });
  563. return false;
  564. }
  565. }
  566. let _arr = [];
  567. _arr = this.List.map((m) => {
  568. m.instanceList = [];
  569. m.bomDetailDTOSList = [];
  570. m.pickList.forEach((e) => {
  571. if (
  572. Object.prototype.hasOwnProperty.call(e, "isBom") &&
  573. e.isBom == 1
  574. ) {
  575. m.bomDetailDTOSList.push(e);
  576. } else {
  577. m.instanceList.push(e);
  578. }
  579. });
  580. m.workOrderId = m.id;
  581. return {
  582. ...m,
  583. };
  584. });
  585. // this.loadingBtn = true;
  586. // _arr.forEach((item) => {
  587. // item.pickList.forEach((it) => {
  588. // const warehousePick = [];
  589. // if (it.warehouseIdList.length != 0) {
  590. // it.warehouseIdList.forEach((i) => {
  591. // const data = it.warehouseList.find((ii) => ii.id == i);
  592. // if (data) {
  593. // warehousePick.push({
  594. // availableCountBase: data.availableCountBase,
  595. // demandQuantity: data.demandQuantity,
  596. // warehouseId: data.id
  597. // });
  598. // }
  599. // });
  600. // }
  601. // it.warehousePick = warehousePick;
  602. // });
  603. // });
  604. // console.log(_arr, "_arr");
  605. // return;
  606. // if (this.clientEnvironmentId == 21) {
  607. // let param = {
  608. // workOrderId: this.workListIds[0],
  609. // pickingCode: this.pickCode
  610. // };
  611. // znfindVoucherList(param).then((res) => {
  612. // this.loadingBtn = false;
  613. // this.$message.success('领料成功');
  614. // });
  615. // }
  616. let param = {
  617. allPickList: _arr,
  618. pickName: this.pickName,
  619. pickCode: this.pickCode,
  620. };
  621. batchPcSave(param)
  622. .then((res) => {
  623. uni.navigateTo({
  624. url: `/pages/pda/picking/index/index?pickStatus=1`,
  625. });
  626. // this.loadingBtn = false;
  627. // this.$message.success("领料成功");
  628. // this.$emit("close", true);
  629. })
  630. .catch((err) => {
  631. // this.loadingBtn = false;
  632. });
  633. // batchPcSave
  634. },
  635. // 中赢保存
  636. getZnList() {
  637. znPdaPage({
  638. // ids: ,
  639. workId: this.idsList[0],
  640. }).then((res) => {
  641. if (res?.length) {
  642. let List = res.map((m) => {
  643. m.workOrderId = m.id;
  644. let modelList = [];
  645. let palletList = [];
  646. // let bomList = []
  647. // m.bomDetailDTOS.forEach((f, i) => {
  648. // if (f.rootCategoryLevelId == 5) {
  649. // f.automatic = 2
  650. // modelList = modelList.concat(f)
  651. // }
  652. // if (f.rootCategoryLevelId == 8) {
  653. // f.automatic = 2
  654. // palletList = palletList.concat(f)
  655. // }
  656. // if (f.rootCategoryLevelId != 5 && f.rootCategoryLevelId != 8) {
  657. // f.automatic = 2
  658. // bomList = bomList.concat(f)
  659. // }
  660. // })
  661. m["modelList"] = modelList;
  662. m["palletList"] = palletList;
  663. // m['bomList'] = bomList
  664. m["modelList2"] = [];
  665. m["instanceList2"] = [];
  666. m["palletList2"] = [];
  667. m["packingList2"] = [];
  668. m["semiProductList2"] = [];
  669. m["productList2"] = [];
  670. m["junkProductList2"] = [];
  671. delete m.id;
  672. return {
  673. ...m,
  674. };
  675. });
  676. this.newListOne = JSON.parse(JSON.stringify(List));
  677. this.pagination = new VirtualPagination(List[0].bomList, 10);
  678. List[0].bomList = this.pagination.getCurrentPageData();
  679. this.List = List;
  680. }
  681. });
  682. },
  683. deepCopy(obj, hash = new WeakMap()) {
  684. if (obj === null) return null;
  685. if (obj instanceof Date) return new Date(obj);
  686. if (obj instanceof RegExp) return new RegExp(obj);
  687. if (typeof obj !== "object" && typeof obj !== "function") return obj;
  688. if (hash.has(obj)) return hash.get(obj);
  689. const result = Array.isArray(obj) ? [] : {};
  690. hash.set(obj, result);
  691. return Object.keys(obj).reduce((acc, key) => {
  692. acc[key] = this.deepCopy(obj[key], hash);
  693. return acc;
  694. }, result);
  695. },
  696. changeInput(item, idx, index) {
  697. if (Number(item.demandQuantity) >= Number(item.availableCountBase)) {
  698. this.$set(
  699. this.List[index].pickList[idx],
  700. "demandQuantity",
  701. Number(item.availableCountBase)
  702. );
  703. const idsList = [];
  704. item.warehouseList.forEach((it) => {
  705. idsList.push(it.warehouse_id);
  706. });
  707. this.$set(this.List[index].pickList[idx], "warehouseIdList", idsList);
  708. this.$forceUpdate();
  709. } else if (!Number(item.demandQuantity)) {
  710. this.$set(this.List[index].pickList[idx], "warehouseIdList", []);
  711. this.$forceUpdate();
  712. } else {
  713. const idsList = [];
  714. let totalNum = 0;
  715. for (let i = 0; i < item.warehouseList.length; i++) {
  716. totalNum += Number(item.warehouseList[i].availableCountBase);
  717. if (Number(item.demandQuantity) > totalNum) {
  718. idsList.push(item.warehouseList[i].warehouse_id);
  719. } else {
  720. idsList.push(item.warehouseList[i].warehouse_id);
  721. break;
  722. }
  723. }
  724. this.$set(this.List[index].pickList[idx], "warehouseIdList", idsList);
  725. this.$forceUpdate();
  726. }
  727. },
  728. getList() {
  729. workorderList({
  730. ids: this.idsList,
  731. taskId: this.taskId,
  732. }).then((res) => {
  733. console.log("领料列表", res);
  734. this.List = res.map((m) => {
  735. m.workOrderId = m.id;
  736. let modelList = [];
  737. let palletList = [];
  738. let bomList = [];
  739. m.bomDetailDTOS.forEach((f, i) => {
  740. if (f.rootCategoryLevelId == 5) {
  741. f.automatic = 2;
  742. modelList = modelList.concat(f);
  743. }
  744. if (f.rootCategoryLevelId == 8) {
  745. f.automatic = 2;
  746. palletList = palletList.concat(f);
  747. }
  748. if (f.rootCategoryLevelId != 5 && f.rootCategoryLevelId != 8) {
  749. f.automatic = 2;
  750. bomList = bomList.concat(f);
  751. }
  752. });
  753. m["modelList"] = modelList;
  754. m["palletList"] = palletList;
  755. m["pickList"] = bomList;
  756. m["modelList2"] = [];
  757. m["instanceList2"] = [];
  758. m["palletList2"] = [];
  759. m["packingList2"] = [];
  760. m["semiProductList2"] = [];
  761. m["productList2"] = [];
  762. m["junkProductList2"] = [];
  763. m.pickList.forEach((it) => {
  764. it.warehouseIdList = [];
  765. it.warehouseIdList.push(it.warehouseId);
  766. it.warehouseList.forEach((i) => {
  767. i.warehouse_name = i.name;
  768. i.warehouse_id = i.id;
  769. });
  770. });
  771. console.log(m, "mmmm");
  772. // delete m.id;
  773. return {
  774. ...m,
  775. };
  776. });
  777. this.pickName = res[0].productName + "领料";
  778. this.getOrderCode();
  779. // this.getInventoryTotalFn();
  780. });
  781. },
  782. //计量库存数量
  783. getInventoryTotalFn() {
  784. let ids = [];
  785. this.List.map((item) => {
  786. item.bomList.map((pitem) => {
  787. ids.push(pitem.categoryCode);
  788. });
  789. });
  790. if (ids.length == 0) {
  791. return;
  792. }
  793. getInventoryTotal(ids).then((res) => {
  794. res.map((ritem) => {
  795. this.List.map((item) => {
  796. item.bomList.map((pitem) => {
  797. if (pitem.categoryCode == ritem.code) {
  798. pitem.availableCountBase = ritem.availableCountBase;
  799. }
  800. });
  801. });
  802. });
  803. });
  804. },
  805. async getOrderCode() {
  806. this.pickCode = await getCode("pick_order_code");
  807. },
  808. hendDel(type, code, list) {
  809. if (type == "modelBom") {
  810. console.log(list.length);
  811. if (list.length == 0) {
  812. }
  813. this.List.forEach((f) => {
  814. if (f.code == code) {
  815. if (list.length == 0) {
  816. f.modelList2 = [];
  817. f.modelList = [];
  818. return false;
  819. }
  820. f.modelList2 = list.filter((t) => t.automatic == 1);
  821. f.modelList = list.filter((t) => t.automatic == 2);
  822. }
  823. });
  824. }
  825. if (type == "boatBom") {
  826. this.List.forEach((f) => {
  827. if (f.code == code) {
  828. if (list.length == 0) {
  829. f.palletList2 = [];
  830. f.palletList = [];
  831. return false;
  832. }
  833. f.palletList2 = list.filter((t) => t.automatic == 1);
  834. f.palletList = list.filter((t) => t.automatic == 2);
  835. }
  836. });
  837. }
  838. this.$forceUpdate();
  839. },
  840. getListOutsource(list) {
  841. let param = {
  842. workOrderId: this.idsList,
  843. taskId: this.taskId,
  844. };
  845. listOutsource(param).then((res) => {
  846. if (res) {
  847. this.$refs.outsourceRef.open(res);
  848. } else {
  849. uni.showToast({
  850. title: "暂无委外申请单",
  851. icon: "none",
  852. });
  853. }
  854. });
  855. },
  856. outsourceFn(list) {
  857. this.outsourceInWarehouseFn(list);
  858. },
  859. addPicking(id, item) {
  860. const storageKey = Date.now() + "";
  861. let arr = [
  862. ...item.instanceList2,
  863. ...item.modelList2,
  864. ...item.palletList2,
  865. ...item.packingList2,
  866. ...item.semiProductList2,
  867. ...item.productList2,
  868. ...item.junkProductList2,
  869. ];
  870. uni.setStorageSync(storageKey, arr);
  871. uni.navigateTo({
  872. url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=pick&taskId=${this.taskId}`,
  873. });
  874. },
  875. getPick() {
  876. pickDetails(this.idsList).then((res) => {
  877. if (res && res.length > 0) {
  878. this.isPick = true;
  879. }
  880. });
  881. },
  882. outsourceInWarehouseFn(list) {
  883. let param = {
  884. outsourceOrder: list || [],
  885. workOrderId: this.idsList[0],
  886. taskId: this.taskId,
  887. };
  888. listOutsourceInWarehouse(param).then((res) => {
  889. res.list.map((m) => {
  890. m.isOut = 1;
  891. return {
  892. ...m,
  893. };
  894. });
  895. let _arr = [...this.List[0].instanceList2, ...res.list];
  896. this.$set(this.List[0], "instanceList2", _arr);
  897. this.$forceUpdate();
  898. });
  899. },
  900. openDetails() {
  901. let url = `/pages/pda/picking/bill/index?id=${this.idsList[0]}`;
  902. uni.navigateTo({
  903. url,
  904. });
  905. },
  906. },
  907. beforeDestroy() {
  908. uni.hideLoading();
  909. },
  910. };
  911. </script>
  912. <style lang="scss" scoped>
  913. .select {
  914. display: flex;
  915. align-items: center;
  916. justify-content: center;
  917. padding: 5rpx 0;
  918. width: 150rpx;
  919. background-color: #157a2c;
  920. color: #fff;
  921. font-size: 24rpx;
  922. border-radius: 5rpx;
  923. }
  924. .u-reset-button-ii {
  925. position: relative;
  926. right: -251rpx;
  927. width: 200rpx;
  928. }
  929. .content-box {
  930. height: 100vh;
  931. overflow: hidden;
  932. display: flex;
  933. flex-direction: column;
  934. }
  935. .list_box {
  936. flex: 1;
  937. overflow: hidden;
  938. padding: 4rpx 0;
  939. .u-list {
  940. height: 100% !important;
  941. }
  942. .card_box {
  943. padding: 16rpx 24rpx;
  944. }
  945. .title_box {
  946. .round {
  947. width: 32rpx;
  948. height: 32rpx;
  949. line-height: 32rpx;
  950. border-radius: 50%;
  951. background: $theme-color;
  952. color: #fff;
  953. text-align: center;
  954. font-size: 20rpx;
  955. }
  956. .code {
  957. margin-left: 16rpx;
  958. font-family: PingFang SC;
  959. font-size: 28rpx;
  960. font-style: normal;
  961. font-weight: 400;
  962. color: $theme-color;
  963. }
  964. }
  965. .material {
  966. margin-top: 10rpx;
  967. .left {
  968. width: 40rpx;
  969. }
  970. .zdy_check {
  971. width: 30rpx;
  972. height: 30rpx;
  973. border: 2rpx solid #c8c9cc;
  974. border-radius: 4rpx;
  975. }
  976. .check_active {
  977. background: $theme-color;
  978. border: 2rpx solid $theme-color;
  979. /deep/ .u-icon__icon {
  980. color: #fff !important;
  981. }
  982. }
  983. .content_table {
  984. width: 652rpx;
  985. border: 2rpx solid $border-color;
  986. .item {
  987. display: flex;
  988. border-bottom: 2rpx solid $border-color;
  989. .lable {
  990. width: 132rpx;
  991. text-align: center;
  992. background-color: #f7f9fa;
  993. font-size: 26rpx;
  994. border-right: 2rpx solid $border-color;
  995. flex-shrink: 0;
  996. }
  997. .ww80 {
  998. width: 80rpx;
  999. }
  1000. .content {
  1001. width: 518rpx;
  1002. min-height: 64rpx;
  1003. font-size: 28rpx;
  1004. line-height: 28rpx;
  1005. font-style: normal;
  1006. font-weight: 400;
  1007. padding: 18rpx 8rpx;
  1008. box-sizing: border-box;
  1009. word-wrap: break-word;
  1010. flex-grow: 1 !important;
  1011. }
  1012. .content_num {
  1013. display: flex;
  1014. align-items: center;
  1015. padding: 0 4rpx;
  1016. /deep/ .uni-input-input {
  1017. border: 2rpx solid #f0f8f2;
  1018. background: #f0f8f2;
  1019. color: $theme-color;
  1020. }
  1021. .unit {
  1022. width: 90rpx;
  1023. text-align: center;
  1024. font-size: 24rpx;
  1025. color: #404446;
  1026. }
  1027. }
  1028. .pd4 {
  1029. padding: 4rpx 8rpx;
  1030. }
  1031. &:last-child {
  1032. border-bottom: none;
  1033. }
  1034. }
  1035. .ww55 {
  1036. width: 55%;
  1037. }
  1038. .ww45 {
  1039. width: 45%;
  1040. }
  1041. }
  1042. }
  1043. }
  1044. .ellipsis {
  1045. white-space: nowrap; /* 强制不换行 */
  1046. overflow: hidden; /* 超出部分隐藏 */
  1047. text-overflow: ellipsis; /* 显示省略号 */
  1048. }
  1049. .bottom-wrapper {
  1050. .btn_box {
  1051. width: 750rpx;
  1052. height: 88rpx;
  1053. line-height: 88rpx;
  1054. background: $theme-color;
  1055. text-align: center;
  1056. font-size: 36rpx;
  1057. font-style: normal;
  1058. font-weight: 400;
  1059. color: #fff;
  1060. }
  1061. }
  1062. .flex_btn {
  1063. position: fixed;
  1064. right: 0;
  1065. bottom: 160rpx;
  1066. width: 140rpx;
  1067. height: 66rpx;
  1068. line-height: 66rpx;
  1069. border-radius: 22rpx 0 0 22rpx;
  1070. background: $theme-color;
  1071. text-align: center;
  1072. font-size: 22rpx;
  1073. font-style: normal;
  1074. font-weight: 400;
  1075. color: #fff;
  1076. }
  1077. .out_box {
  1078. margin: 20rpx;
  1079. display: flex;
  1080. justify-content: center;
  1081. color: $theme-color;
  1082. font-size: 28rpx;
  1083. }
  1084. .popup_list {
  1085. width: 400rpx;
  1086. height: 400rpx;
  1087. }
  1088. </style>