details.vue 31 KB

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