details.vue 31 KB

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