index.vue 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021
  1. <template>
  2. <!-- 入库报工 报工列表 -->
  3. <div>
  4. <div class="top_fixed">
  5. <el-button type="primary" size="mini" @click="save">一键报工</el-button>
  6. </div>
  7. <div class="warehousing_box">
  8. <div v-for="(item, index) in List" :key="index" class="card_box">
  9. <div class="title_box rx-bc">
  10. <div class="name">工单信息</div>
  11. </div>
  12. <workOrderBom :item="item" v-if="item"></workOrderBom>
  13. <!-- 报工时间 -->
  14. <div>
  15. <div class="title_box rx-bc">
  16. <div class="name">报工时间</div>
  17. </div>
  18. <el-date-picker
  19. v-model="item.workReportInfo.executorTime"
  20. type="datetime"
  21. value-format="yyyy-MM-dd HH:mm:ss"
  22. placeholder="选择日期"
  23. >
  24. </el-date-picker>
  25. </div>
  26. <div>
  27. <jobDdBom
  28. :item="item"
  29. ref="jobRef"
  30. :notFormed="item.notFormedList"
  31. :warehouseList="warehouseList"
  32. ></jobDdBom>
  33. </div>
  34. <div
  35. v-if="
  36. clientEnvironmentId == 3 &&
  37. item.toWarehouseList &&
  38. item.toWarehouseList.length > 0
  39. "
  40. >
  41. <div class="item">
  42. <div>
  43. <div class="text">仓库</div>
  44. <div class="select-type">
  45. <el-select
  46. v-model="warehouseId"
  47. filterable
  48. clearable
  49. placeholder="请选择仓库"
  50. size="mini"
  51. class="content_num"
  52. >
  53. <el-option
  54. v-for="item in warehouseList"
  55. :key="item.id"
  56. :value="item.id"
  57. :label="item.name"
  58. ></el-option>
  59. </el-select>
  60. </div>
  61. </div>
  62. <div>
  63. <div class="text">入库规格</div>
  64. <div class="select-type">
  65. <el-select
  66. v-model="inWarehouseSpecType"
  67. filterable
  68. clearable
  69. placeholder="请选择入库规格"
  70. size="mini"
  71. class="content_num select-warehousing"
  72. disabled
  73. >
  74. <el-option
  75. v-for="item in WarehouseSpecTypeList"
  76. :key="item.value"
  77. :label="item.text"
  78. :value="item.value"
  79. ></el-option>
  80. </el-select>
  81. </div>
  82. </div>
  83. </div>
  84. <!-- <div style="margin-top: 6px">
  85. <el-select
  86. v-model="item.warehouseId"
  87. filterable
  88. clearable
  89. placeholder="请选择仓库"
  90. size="mini"
  91. class="content_num"
  92. >
  93. <el-option
  94. v-for="item in warehouseList"
  95. :key="item.id"
  96. :value="item.id"
  97. :label="item.name"
  98. ></el-option>
  99. </el-select>
  100. </div> -->
  101. <div v-for="(it, idx) in item.toWarehouseList" :key="idx">
  102. <packingTgBom
  103. :list="it.extInfo.pickOutInList"
  104. :isWarehousing="true"
  105. :item="it"
  106. ></packingTgBom>
  107. </div>
  108. </div>
  109. <div
  110. v-else-if="
  111. clientEnvironmentId == 3 &&
  112. !item.toWarehouseList &&
  113. item.singleReport == 1
  114. "
  115. >
  116. <div class="item">
  117. <div>
  118. <div class="text">仓库</div>
  119. <div class="select-type">
  120. <el-select
  121. v-model="warehouseId"
  122. filterable
  123. clearable
  124. placeholder="请选择仓库"
  125. size="mini"
  126. class="content_num"
  127. >
  128. <el-option
  129. v-for="item in warehouseList"
  130. :key="item.id"
  131. :value="item.id"
  132. :label="item.name"
  133. ></el-option>
  134. </el-select>
  135. </div>
  136. </div>
  137. <div>
  138. <div class="text">入库规格</div>
  139. <div class="select-type">
  140. <el-select
  141. v-model="inWarehouseSpecType"
  142. filterable
  143. clearable
  144. placeholder="请选择入库规格"
  145. size="mini"
  146. class="content_num select-warehousing"
  147. disabled
  148. >
  149. <el-option
  150. v-for="item in WarehouseSpecTypeList"
  151. :key="item.value"
  152. :label="item.text"
  153. :value="item.value"
  154. ></el-option>
  155. </el-select>
  156. </div>
  157. </div>
  158. </div>
  159. <batchSemiProductJobBom
  160. :list="item.semiProductList"
  161. :item="item"
  162. :singleReport="item.singleReport"
  163. :storeType="storeType"
  164. :equipmentList="item.equipmentList"
  165. :isChoose="isChoose"
  166. :isEngrave="isEngrave"
  167. :isDisposal="isDisposal"
  168. >
  169. </batchSemiProductJobBom>
  170. </div>
  171. <!-- 单独报工 -->
  172. <div
  173. v-else-if="
  174. item.currentTaskDiagram.type == 5 &&
  175. item.singleReport == 1 &&
  176. clientEnvironmentId != 3 &&
  177. clientEnvironmentId != 2 &&
  178. item.semiProductList
  179. "
  180. >
  181. <!-- <div v-if="item.toWarehouseList && item.toWarehouseList.length > 0"> -->
  182. <div class="item">
  183. <div>
  184. <div class="text">仓库</div>
  185. <div class="select-type">
  186. <el-select
  187. v-model="warehouseId"
  188. filterable
  189. clearable
  190. placeholder="请选择仓库"
  191. size="mini"
  192. class="content_num"
  193. >
  194. <el-option
  195. v-for="item in warehouseList"
  196. :key="item.id"
  197. :value="item.id"
  198. :label="item.name"
  199. ></el-option>
  200. </el-select>
  201. </div>
  202. </div>
  203. <div>
  204. <div class="text">入库规格</div>
  205. <div class="select-type">
  206. <el-select
  207. v-model="inWarehouseSpecType"
  208. filterable
  209. clearable
  210. placeholder="请选择入库规格"
  211. size="mini"
  212. class="content_num select-warehousing"
  213. disabled
  214. >
  215. <el-option
  216. v-for="item in WarehouseSpecTypeList"
  217. :key="item.value"
  218. :label="item.text"
  219. :value="item.value"
  220. ></el-option>
  221. </el-select>
  222. </div>
  223. </div>
  224. </div>
  225. <!-- <div v-for="(it, idx) in item.toWarehouseList" :key="idx"> -->
  226. <!-- <packingTgBom
  227. :list="it.extInfo.pickOutInList"
  228. :singleReport="item.singleReport"
  229. :item="item"
  230. :equipmentList="item.equipmentList"
  231. :isWarehousing="true"
  232. ></packingTgBom> -->
  233. <!-- </div> -->
  234. <batchSemiProductJobBom
  235. :list="item.semiProductList"
  236. :item="item"
  237. :singleReport="item.singleReport"
  238. :storeType="storeType"
  239. :equipmentList="item.equipmentList"
  240. :isChoose="isChoose"
  241. :isEngrave="isEngrave"
  242. :isDisposal="isDisposal"
  243. >
  244. </batchSemiProductJobBom>
  245. <!-- </div> -->
  246. </div>
  247. <!-- {{ item.currentTaskDiagram.type }} {{ item.singleReport }}
  248. {{ clientEnvironmentId != 2 && item && item.currentTaskDiagram.type == 5 && clientEnvironmentId != 3 && item.singleReport == 1 }} -->
  249. <!-- <div
  250. v-if="
  251. clientEnvironmentId != 2 &&
  252. item &&
  253. item.currentTaskDiagram.type == 5 &&
  254. clientEnvironmentId != 3 &&
  255. item.singleReport !== 1
  256. "
  257. >
  258. <div style="margin-top: 6px">
  259. <el-select
  260. v-model="item.warehouseId"
  261. filterable
  262. clearable
  263. placeholder="请选择仓库"
  264. size="mini"
  265. class="content_num"
  266. >
  267. <el-option
  268. v-for="item in warehouseList"
  269. :key="item.id"
  270. :value="item.id"
  271. :label="item.name"
  272. ></el-option>
  273. </el-select>
  274. </div> -->
  275. <div
  276. v-if="
  277. clientEnvironmentId != 2 &&
  278. item.product &&
  279. item.currentTaskDiagram.type == 5 &&
  280. clientEnvironmentId != 3 &&
  281. item.singleReport !== 1
  282. "
  283. >
  284. <div class="item">
  285. <div>
  286. <div class="text">仓库</div>
  287. <div class="select-type">
  288. <el-select
  289. v-model="warehouseId"
  290. filterable
  291. clearable
  292. placeholder="请选择仓库"
  293. size="mini"
  294. class="content_num"
  295. >
  296. <el-option
  297. v-for="item in warehouseList"
  298. :key="item.id"
  299. :value="item.id"
  300. :label="item.name"
  301. ></el-option>
  302. </el-select>
  303. </div>
  304. </div>
  305. <div>
  306. <div class="text">入库规格</div>
  307. <div class="select-type">
  308. <el-select
  309. v-model="inWarehouseSpecType"
  310. filterable
  311. clearable
  312. placeholder="请选择入库规格"
  313. size="mini"
  314. class="content_num select-warehousing"
  315. disabled
  316. >
  317. <el-option
  318. v-for="item in WarehouseSpecTypeList"
  319. :key="item.value"
  320. :label="item.text"
  321. :value="item.value"
  322. ></el-option>
  323. </el-select>
  324. </div>
  325. </div>
  326. </div>
  327. <!-- <div style="margin-top: 6px">
  328. <el-select
  329. v-model="warehouseId"
  330. filterable
  331. clearable
  332. placeholder="请选择仓库"
  333. size="mini"
  334. class="content_num"
  335. >
  336. <el-option
  337. v-for="item in warehouseList"
  338. :key="item.id"
  339. :value="item.id"
  340. :label="item.name"
  341. ></el-option>
  342. </el-select>
  343. </div> -->
  344. <!-- 批量报工 -->
  345. <!-- <div
  346. class="list_box"
  347. v-for="(d, index) in item.toWarehouseList"
  348. :key="index"
  349. > -->
  350. <!-- <div class="time" style="margin-bottom: 10rpx"
  351. >打包时间: {{ d.createTime }}</div
  352. > -->
  353. <!-- <packagingGroupingTwx
  354. ref="packagingGroupingRef"
  355. :objData="d.extInfo"
  356. :workOrderId="item.workOrderId"
  357. :taskId="item.currentTaskDiagram.taskId"
  358. >
  359. </packagingGroupingTwx> -->
  360. <!-- :list="objData.product" :item="objData" :isDetails="true"
  361. :singleReport="objData.singleReport"
  362. :equipmentList="objData.equipmentList" -->
  363. <batchSemiProductJobBom
  364. :list="item.product"
  365. :item="item"
  366. :singleReport="item.singleReport"
  367. :storeType="storeType"
  368. :equipmentList="item.equipmentList"
  369. :isChoose="isChoose"
  370. :isEngrave="isEngrave"
  371. :isDisposal="isDisposal"
  372. >
  373. </batchSemiProductJobBom>
  374. <!-- </div> -->
  375. </div>
  376. <div v-if="clientEnvironmentId == 2">
  377. <div class="item">
  378. <div>
  379. <div class="text">仓库</div>
  380. <div class="select-type">
  381. <el-select
  382. v-model="warehouseId"
  383. filterable
  384. clearable
  385. placeholder="请选择仓库"
  386. size="mini"
  387. class="content_num"
  388. >
  389. <el-option
  390. v-for="item in warehouseList"
  391. :key="item.id"
  392. :value="item.id"
  393. :label="item.name"
  394. ></el-option>
  395. </el-select>
  396. </div>
  397. </div>
  398. <div>
  399. <div class="text">入库规格</div>
  400. <div class="select-type">
  401. <el-select
  402. v-model="inWarehouseSpecType"
  403. filterable
  404. clearable
  405. placeholder="请选择入库规格"
  406. size="mini"
  407. class="content_num select-warehousing"
  408. disabled
  409. >
  410. <el-option
  411. v-for="item in WarehouseSpecTypeList"
  412. :key="item.value"
  413. :label="item.text"
  414. :value="item.value"
  415. ></el-option>
  416. </el-select>
  417. </div>
  418. </div>
  419. </div>
  420. </div>
  421. <!-- item.currentTaskDiagram.type == 4 ? item.pickOutInList : item.semiProductList -->
  422. <!-- <div v-else>
  423. <el-empty :image-size="30" description="暂无数据"></el-empty>
  424. </div> -->
  425. </div>
  426. </div>
  427. </div>
  428. </template>
  429. <script>
  430. import workOrderBom from '../feeding/components/workOrderBom.vue';
  431. import packingTgBom from '../jobBooking/components/packingTgBom.vue';
  432. import semiProductJobBomQT from '../jobBooking/components/semiProductJobBomQT.vue';
  433. import packagingGroupingTwx from '../jobBooking/components/packagingGroupingTwx.vue';
  434. import batchSemiProductJobBom from '../jobBooking/components/batchSemiProductJobBom.vue';
  435. import { getWarehouseList } from '@/api/produce/index.js';
  436. import { listByIdsReport } from '@/api/produce/job';
  437. import {
  438. listPcToWarehouseTG,
  439. listPCToWarehouse
  440. } from '@/api/produce/workOrder';
  441. import { jobSave } from '@/api/produce/workOrder';
  442. // import jobDdBom from './components/jobDdBom.vue';
  443. import jobDdBom from './components/newJobDdBom.vue';
  444. import { parameterGetByCode } from '@/api/system/dictionary-data';
  445. export default {
  446. components: {
  447. workOrderBom,
  448. semiProductJobBomQT,
  449. packagingGroupingTwx,
  450. packingTgBom,
  451. jobDdBom,
  452. batchSemiProductJobBom
  453. },
  454. props: {
  455. workListIds: {
  456. type: Array,
  457. default() {
  458. return [];
  459. }
  460. }
  461. },
  462. data() {
  463. return {
  464. isLoad: false,
  465. List: [],
  466. idsList: [],
  467. warehouseList: [],
  468. inWarehouseSpecType: '2',
  469. WarehouseSpecTypeList: [
  470. {
  471. text: '按计量入库',
  472. value: '1'
  473. },
  474. {
  475. text: '最小包装入库',
  476. value: '2'
  477. },
  478. {
  479. text: '内包装入库',
  480. value: '3'
  481. },
  482. {
  483. text: '外包装入库',
  484. value: '4'
  485. }
  486. ],
  487. storeType: 'store',
  488. warehouseId: null,
  489. inWarehouseType: null,
  490. isChoose: false,
  491. isEngrave: false,
  492. isDisposal: false
  493. };
  494. },
  495. computed: {
  496. taskObj() {
  497. return this.$store.state.user.taskObj;
  498. },
  499. clientEnvironmentId() {
  500. return this.$store.state.user.info.clientEnvironmentId;
  501. }
  502. },
  503. watch: {
  504. workListIds: {
  505. handler(val) {
  506. this.getList(val);
  507. },
  508. deep: true,
  509. immediate: true
  510. }
  511. },
  512. created() {
  513. this.getWarehouseListFn();
  514. this.getChooseEngrave();
  515. },
  516. methods: {
  517. getList(ids) {
  518. this.idsList = ids || [];
  519. let param = {
  520. ids: ids,
  521. taskId: this.taskObj.id,
  522. type: 0
  523. };
  524. this.isLoad = false;
  525. console.log(param, 'idsidsidsids');
  526. listByIdsReport(param)
  527. .then((res) => {
  528. if (res[0].workOrderType == 1) {
  529. this.inWarehouseType = 1;
  530. } else if (res[0].workOrderType == 2) {
  531. this.inWarehouseType = 8; // "1入库类型1生产入库2半成品入库"
  532. }
  533. this.List = res.map((obj) => {
  534. obj.workReportInfo = {
  535. formingNum: null,
  536. formingWeight: null,
  537. formedNum: null,
  538. formedWeight: null,
  539. taskId: '',
  540. executorTime: null
  541. };
  542. obj.notFormedList = [
  543. {
  544. notFormedNum: null,
  545. notFormedWeight: null,
  546. weightUnit: res.weightUnit,
  547. unit: res.unit,
  548. warehouseId: null // 处置 仓库id
  549. }
  550. ];
  551. if (obj.semiProductList.length != 0) {
  552. // 预制体报工
  553. obj.workReportInfo.formedNum = obj.semiProductList.length;
  554. let numCot = 0;
  555. let notFormedNum = 0;
  556. if (obj.semiProductList.length > 0) {
  557. obj.semiProductList.map((fitem) => {
  558. if (
  559. !fitem.extInfo.isQualified ||
  560. fitem.extInfo.isQualified == 1
  561. ) {
  562. numCot = numCot + fitem.feedQuantity || 1;
  563. } else {
  564. notFormedNum = notFormedNum + fitem.feedQuantity;
  565. }
  566. });
  567. obj.workReportInfo.formedNum = numCot;
  568. obj.workReportInfo.notFormedNum = notFormedNum;
  569. }
  570. } else if (obj.product.length != 0) {
  571. const formedNum = obj.product.reduce((acc, pro) => {
  572. return pro.feedQuantity &&
  573. (!pro.extInfo.isQualified || pro.extInfo.isQualified == 1)
  574. ? acc + Number(pro.feedQuantity)
  575. : acc;
  576. }, 0);
  577. const notFormedNum = obj.product.reduce((acc, pro) => {
  578. return pro.feedQuantity && pro.extInfo.isQualified == 2
  579. ? acc + Number(pro.feedQuantity)
  580. : acc;
  581. }, 0);
  582. obj.workReportInfo.formedNum = formedNum;
  583. obj.workReportInfo.notFormedNum = notFormedNum;
  584. }
  585. return {
  586. ...obj
  587. };
  588. });
  589. this.List.forEach((item) => {
  590. if (item.semiProductList && item.semiProductList.length != 0) {
  591. item.semiProductList.forEach((it) => {
  592. it.extInfo.taskId = '';
  593. it.extInfo.taskName = '';
  594. });
  595. } else if (item.product && item.product.length != 0) {
  596. item.product.forEach((it) => {
  597. it.extInfo.taskId = '';
  598. it.extInfo.taskName = '';
  599. });
  600. }
  601. });
  602. console.log(this.List, 'listList');
  603. })
  604. .finally(() => {
  605. this.isLoad = true;
  606. if (this.clientEnvironmentId == 3) {
  607. this.getTgWarehouse();
  608. } else {
  609. this.getQtWarehouse();
  610. }
  611. });
  612. },
  613. async getChooseEngrave() {
  614. await parameterGetByCode({
  615. code: 'choose_engrave'
  616. }).then((res) => {
  617. this.isChoose = res.value == '1' ? true : false;
  618. });
  619. await parameterGetByCode({
  620. code: 'batch_update_engrave'
  621. }).then((res) => {
  622. this.isEngrave = res.value == '1' ? true : false;
  623. });
  624. await parameterGetByCode({
  625. code: 'batch_disposal'
  626. }).then((res) => {
  627. this.isDisposal = res.value == '1' ? true : false;
  628. });
  629. },
  630. getTgWarehouse() {
  631. const param = {
  632. workOrderIds: this.idsList,
  633. taskId: this.taskObj.id
  634. };
  635. listPcToWarehouseTG(param).then((res) => {
  636. // 创建一个映射,以便快速查找
  637. const workOrderMap = new Map(res.map((it) => [it.workOrderId, it]));
  638. // 更新List中的每个项目
  639. // this.List.forEach((item,index) => {
  640. // if (workOrderMap.has(item.workOrderId)) {
  641. // // 直接从映射中获取数据,避免嵌套循环
  642. // this.$set(item, 'toWarehouseList', [
  643. // JSON.parse(JSON.stringify(workOrderMap.get(item.workOrderId)))
  644. // ]);
  645. // } else {
  646. // this.$set(item, 'toWarehouseList', []);
  647. // }
  648. // });
  649. this.List.forEach((item, index) => {
  650. let arr = [];
  651. res.map((titem) => {
  652. if (item.workOrderId == titem.workOrderId) {
  653. arr.push(titem);
  654. }
  655. this.$set(item, 'toWarehouseList', arr);
  656. });
  657. });
  658. });
  659. },
  660. getQtWarehouse() {
  661. const param = {
  662. workOrderIds: this.idsList,
  663. taskId: this.taskObj.id
  664. };
  665. console.log(123456);
  666. listPCToWarehouse(param).then((res) => {
  667. // 创建一个映射,以便快速查找
  668. const workOrderMap = new Map(res.map((it) => [it.workOrderId, it]));
  669. console.log(workOrderMap, '99');
  670. // 更新List中的每个项目
  671. // this.List.map((item) => {
  672. // if (workOrderMap.has(item.workOrderId)) {
  673. // console.log(1);
  674. // // 直接从映射中获取数据,避免嵌套循环
  675. // this.$set(item, 'toWarehouseList', [
  676. // JSON.parse(JSON.stringify(workOrderMap.get(item.workOrderId)))
  677. // ]);
  678. // } else {
  679. // this.$set(item, 'toWarehouseList', []);
  680. // }
  681. // });
  682. this.List.forEach((item, index) => {
  683. let arr = [];
  684. res.map((titem) => {
  685. if (item.workOrderId == titem.workOrderId) {
  686. arr.push(titem);
  687. }
  688. this.$set(item, 'toWarehouseList', arr);
  689. });
  690. });
  691. console.log(this.List, '6666666666');
  692. });
  693. },
  694. getWarehouseListFn() {
  695. getWarehouseList().then((res) => {
  696. this.warehouseList = res.data;
  697. });
  698. },
  699. save() {
  700. for (let i = 0; i < this.List.length; i++) {
  701. if (!this.List[i].workReportInfo.executorTime) {
  702. this.$message.warning('报工时间不能为空');
  703. return;
  704. }
  705. }
  706. if (this.clientEnvironmentId == 21) {
  707. if (!this.warehouseId) {
  708. return this.$message.warning('请选择仓库');
  709. }
  710. this.List.forEach((item) => {
  711. item.warehouseId = this.warehouseId;
  712. });
  713. jobSave(this.List).then((res) => {
  714. console.log(res);
  715. this.$message.success('入库成功');
  716. this.getList(this.idsList);
  717. this.$emit('warehouseSuccess', 'warehouseSuccess');
  718. });
  719. } else if (this.clientEnvironmentId == 2) {
  720. if (!this.warehouseId) {
  721. return this.$message.warning('请选择仓库');
  722. }
  723. const listData = this.List.map((item) => {
  724. let categoryId = '',
  725. rootCategoryLevelId = '';
  726. if (item.product.length) {
  727. categoryId = item.categoryId;
  728. rootCategoryLevelId = item.rootCategoryLevelId;
  729. }
  730. let storageInfo = {
  731. inWarehouseSpecType:
  732. this.clientEnvironmentId !== 3 || this.clientEnvironmentId !== 2
  733. ? Number(this.inWarehouseSpecType)
  734. : '',
  735. warehouseId: this.warehouseId,
  736. inWarehouseType: this.inWarehouseType,
  737. toWarehouseList: this.clientEnvironmentId == 3 ? this.tgList : []
  738. };
  739. if (this.clientEnvironmentId == 2) {
  740. let num = '';
  741. if (item.workReportInfo && item.workReportInfo?.formedNum) {
  742. num = item.workReportInfo.formedNum;
  743. }
  744. storageInfo.packingReportList = [
  745. {
  746. code: item.productCode,
  747. categoryId: categoryId,
  748. workOrderId: item.workOrderId,
  749. rootCategoryLevelId: rootCategoryLevelId,
  750. totalQuantity: num,
  751. quantity: num,
  752. unit: item.unit,
  753. packingNum: 1,
  754. taskId: -1
  755. }
  756. ];
  757. item.storageInfo = storageInfo;
  758. }
  759. return {
  760. ...item
  761. };
  762. });
  763. console.log(listData, 'listData');
  764. jobSave(listData).then((res) => {
  765. console.log(res);
  766. this.$message.success('入库成功');
  767. this.getList(this.idsList);
  768. this.$emit('warehouseSuccess', 'warehouseSuccess');
  769. });
  770. } else if (this.clientEnvironmentId == 3) {
  771. let _arr = [];
  772. console.log(this.List, 'this.List');
  773. _arr = this.List.filter((item) => {
  774. if (item.toWarehouseList && item.toWarehouseList.length > 0) {
  775. return item.toWarehouseList.length > 0;
  776. } else {
  777. return true;
  778. }
  779. });
  780. _arr.forEach((item) => {
  781. item.warehouseId = this.warehouseId;
  782. });
  783. console.log(_arr, '_arr121221');
  784. let bol = true;
  785. bol = _arr.every((e, i) => {
  786. return e.warehouseId;
  787. });
  788. if (!bol) {
  789. this.$message.warning(`仓库不能为空`);
  790. return false;
  791. }
  792. let _arr2 = JSON.parse(JSON.stringify(_arr));
  793. _arr2.map((m) => {
  794. m.storageInfo = {
  795. warehouseId: m.warehouseId,
  796. toWarehouseList: m.toWarehouseList,
  797. inWarehouseSpecType: this.inWarehouseSpecType
  798. };
  799. delete m.warehouseId;
  800. delete m.toWarehouseList;
  801. return {
  802. ...m
  803. };
  804. });
  805. jobSave(_arr2).then((res) => {
  806. console.log(res);
  807. this.$message.success('入库成功');
  808. this.getList(this.idsList);
  809. this.$emit('warehouseSuccess', 'warehouseSuccess');
  810. });
  811. } else {
  812. let _arr = [];
  813. console.log(this.List, 'this.List');
  814. this.List.forEach((item) => {
  815. item.warehouseId = this.warehouseId;
  816. });
  817. console.log(_arr, '_arr121221');
  818. let bol = true;
  819. bol = this.List.every((e, i) => {
  820. return e.warehouseId;
  821. });
  822. if (!bol) {
  823. this.$message.warning(`仓库不能为空`);
  824. return false;
  825. }
  826. let _arr2 = JSON.parse(JSON.stringify(this.List));
  827. _arr2.map((m) => {
  828. m.storageInfo = {
  829. warehouseId: m.warehouseId,
  830. toWarehouseList: m.toWarehouseList,
  831. inWarehouseSpecType: this.inWarehouseSpecType
  832. };
  833. delete m.warehouseId;
  834. delete m.toWarehouseList;
  835. return {
  836. ...m
  837. };
  838. });
  839. jobSave(_arr2).then((res) => {
  840. console.log(res);
  841. this.$message.success('入库成功');
  842. this.getList(this.idsList);
  843. this.$emit('warehouseSuccess', 'warehouseSuccess');
  844. });
  845. }
  846. }
  847. }
  848. };
  849. </script>
  850. <style scoped lang="scss">
  851. .top_fixed {
  852. width: 100%;
  853. height: 40px;
  854. background: #fff;
  855. display: flex;
  856. align-items: center;
  857. justify-content: flex-end;
  858. }
  859. .title_box {
  860. .name {
  861. font-size: 14px;
  862. font-style: normal;
  863. font-weight: 400;
  864. color: #157a2c;
  865. padding-left: 5px;
  866. position: relative;
  867. &:before {
  868. position: absolute;
  869. content: '';
  870. left: 0px;
  871. top: 0px;
  872. bottom: 0px;
  873. width: 2px;
  874. height: 14px;
  875. background: #157a2c;
  876. margin: auto;
  877. }
  878. }
  879. }
  880. .warehousing_box {
  881. margin-top: 6px;
  882. width: 100%;
  883. height: calc(100vh - 70px - 50px - 80px - 60px);
  884. overflow-y: scroll;
  885. overflow-x: hidden;
  886. }
  887. .card_box {
  888. background: #fff;
  889. padding: 8px;
  890. border-radius: 2px;
  891. }
  892. .content_num {
  893. --input-background-color: #f0f8f2;
  894. }
  895. .item {
  896. display: flex;
  897. flex-direction: row;
  898. border: 1px solid #e3e5e5;
  899. border-top: 0 solid #e3e5e5;
  900. align-items: center;
  901. div {
  902. display: flex;
  903. flex-direction: row;
  904. align-items: center;
  905. height: 100%;
  906. .text {
  907. font-size: 12px;
  908. width: 100px;
  909. height: 32px;
  910. display: flex;
  911. justify-content: center;
  912. align-items: center;
  913. background-color: #f7f9fa;
  914. }
  915. .select-type {
  916. width: 205px;
  917. padding: 2px;
  918. box-sizing: border-box;
  919. }
  920. }
  921. }
  922. </style>