details.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265
  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. <text v-if="it.lockQuantity || it.lockQuantity == 0">
  129. 锁库数:<text class="stock-lock-num">{{ it.lockQuantity }}</text>{{ mate.measuringUnit }}
  130. </text>
  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-native {
  869. display: inline-flex;
  870. align-items: center;
  871. justify-content: center;
  872. min-width: 180rpx;
  873. height: 64rpx;
  874. padding: 0 28rpx;
  875. background-color: $theme-color;
  876. color: #fff;
  877. font-size: 26rpx;
  878. border-radius: 32rpx;
  879. white-space: nowrap;
  880. }
  881. }
  882. /* ========== 操作栏 ========== */
  883. .action-bar {
  884. display: flex;
  885. align-items: center;
  886. padding: 16rpx 0;
  887. }
  888. .select-all-btn {
  889. display: inline-flex;
  890. align-items: center;
  891. justify-content: center;
  892. padding: 8rpx 24rpx;
  893. background-color: $theme-color;
  894. color: #fff;
  895. font-size: 24rpx;
  896. border-radius: 32rpx;
  897. line-height: 1.4;
  898. }
  899. /* ========== 物料项 ========== */
  900. .material-item {
  901. display: flex;
  902. align-items: flex-start;
  903. margin-top: 16rpx;
  904. padding-top: 16rpx;
  905. border-top: 1rpx dashed $border-color;
  906. &:first-of-type {
  907. border-top: none;
  908. padding-top: 0;
  909. }
  910. }
  911. /* 复选框列 */
  912. .check-col {
  913. width: 56rpx;
  914. padding-top: 12rpx;
  915. flex-shrink: 0;
  916. }
  917. .checkbox {
  918. width: 36rpx;
  919. height: 36rpx;
  920. display: flex;
  921. align-items: center;
  922. justify-content: center;
  923. border: 2rpx solid #c8c9cc;
  924. border-radius: 6rpx;
  925. transition: all 0.2s;
  926. &--active {
  927. background: $theme-color;
  928. border-color: $theme-color;
  929. /deep/ .u-icon__icon {
  930. color: #fff !important;
  931. }
  932. }
  933. }
  934. /* ========== 物料详情表格 ========== */
  935. .material-detail {
  936. flex: 1;
  937. min-width: 0;
  938. border: 1rpx solid $border-color;
  939. border-radius: 8rpx;
  940. }
  941. .detail-row {
  942. display: flex;
  943. border-bottom: 1rpx solid $border-color;
  944. &:last-child {
  945. border-bottom: none;
  946. }
  947. &--split {
  948. .split-cell {
  949. display: flex;
  950. flex: 1;
  951. min-width: 0;
  952. &--left {
  953. border-right: 1rpx solid $border-color;
  954. }
  955. }
  956. }
  957. }
  958. .detail-label {
  959. width: 140rpx;
  960. display: flex;
  961. align-items: center;
  962. justify-content: center;
  963. background-color: #f7f9fa;
  964. font-size: 24rpx;
  965. color: $uni-text-regular-color;
  966. border-right: 1rpx solid $border-color;
  967. flex-shrink: 0;
  968. padding: 12rpx 8rpx;
  969. text-align: center;
  970. word-break: keep-all;
  971. &--sm {
  972. width: 100rpx;
  973. }
  974. }
  975. .detail-value {
  976. flex: 1;
  977. min-width: 0;
  978. min-height: 64rpx;
  979. font-size: 26rpx;
  980. line-height: 1.5;
  981. color: $uni-text-color;
  982. padding: 12rpx 16rpx;
  983. box-sizing: border-box;
  984. display: flex;
  985. align-items: center;
  986. word-break: break-all;
  987. &--input {
  988. display: flex;
  989. align-items: center;
  990. padding: 6rpx 8rpx;
  991. }
  992. &--stock {
  993. flex-direction: column;
  994. align-items: flex-start;
  995. padding: 8rpx 16rpx;
  996. }
  997. &--select {
  998. padding: 4rpx 8rpx;
  999. }
  1000. }
  1001. .delete-btn {
  1002. width: 60rpx;
  1003. display: flex;
  1004. align-items: center;
  1005. justify-content: center;
  1006. flex-shrink: 0;
  1007. border-left: 1rpx solid #e3e5e5;
  1008. background-color: #fff5f5;
  1009. cursor: pointer;
  1010. &:active {
  1011. background-color: #fee;
  1012. }
  1013. }
  1014. .text-ellipsis {
  1015. overflow: hidden;
  1016. text-overflow: ellipsis;
  1017. white-space: nowrap;
  1018. display: block;
  1019. }
  1020. /* 数量输入 */
  1021. .qty-input {
  1022. flex: 1;
  1023. height: 52rpx;
  1024. border: 2rpx solid #e8f5e9;
  1025. background: #f0f8f2;
  1026. border-radius: 8rpx;
  1027. padding: 0 12rpx;
  1028. font-size: 26rpx;
  1029. color: $theme-color;
  1030. text-align: center;
  1031. }
  1032. .qty-unit {
  1033. width: 80rpx;
  1034. text-align: center;
  1035. font-size: 24rpx;
  1036. color: $uni-text-color-grey;
  1037. flex-shrink: 0;
  1038. }
  1039. /* 库存信息 */
  1040. .stock-item {
  1041. font-size: 24rpx;
  1042. color: $uni-text-color;
  1043. padding: 4rpx 0;
  1044. line-height: 1.6;
  1045. }
  1046. .stock-num {
  1047. color: $theme-color;
  1048. font-weight: 600;
  1049. }
  1050. .stock-lock-num {
  1051. color: #F56C6C;
  1052. font-weight: 600;
  1053. }
  1054. /* ========== 子组件区域 ========== */
  1055. .sub-components {
  1056. margin-top: 20rpx;
  1057. }
  1058. /* ========== 已有领料单按钮 ========== */
  1059. .exist-pick-btn {
  1060. position: fixed;
  1061. right: 0;
  1062. bottom: 180rpx;
  1063. padding: 14rpx 24rpx;
  1064. border-radius: 32rpx 0 0 32rpx;
  1065. background: $theme-color;
  1066. color: #fff;
  1067. font-size: 24rpx;
  1068. box-shadow: 0 4rpx 12rpx rgba(21, 122, 44, 0.3);
  1069. z-index: 10;
  1070. }
  1071. /* ========== 委外领料 ========== */
  1072. .outsource-bar {
  1073. padding: 30rpx 0;
  1074. display: flex;
  1075. justify-content: center;
  1076. }
  1077. .outsource-link {
  1078. color: $theme-color;
  1079. font-size: 28rpx;
  1080. text-decoration: underline;
  1081. }
  1082. /* ========== 弹窗 ========== */
  1083. .popup-content {
  1084. width: 600rpx;
  1085. padding: 40rpx 32rpx 32rpx;
  1086. background: #fff;
  1087. border-radius: 16rpx;
  1088. }
  1089. .popup-title {
  1090. font-size: 32rpx;
  1091. font-weight: 600;
  1092. color: $uni-text-color;
  1093. text-align: center;
  1094. margin-bottom: 32rpx;
  1095. }
  1096. .popup-body {
  1097. margin-bottom: 40rpx;
  1098. }
  1099. .popup-footer {
  1100. display: flex;
  1101. justify-content: space-between;
  1102. gap: 24rpx;
  1103. .popup-btn {
  1104. flex: 1;
  1105. border-radius: 32rpx;
  1106. }
  1107. }
  1108. /* ========== 底部提交栏 ========== */
  1109. .footer-bar {
  1110. flex-shrink: 0;
  1111. .submit-btn {
  1112. width: 100%;
  1113. height: 100rpx;
  1114. line-height: 100rpx;
  1115. background: $theme-color;
  1116. text-align: center;
  1117. font-size: 34rpx;
  1118. font-weight: 500;
  1119. color: #fff;
  1120. letter-spacing: 4rpx;
  1121. &:active {
  1122. opacity: 0.85;
  1123. }
  1124. }
  1125. }
  1126. </style>