index.vue 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356
  1. <template>
  2. <div>
  3. <div class="top_fixed">
  4. <div
  5. style="display: flex; align-items: center; margin-right: 10px"
  6. v-if="List.length > 1"
  7. >
  8. <div class="rx-bc">
  9. <div class="name">批量报工时间:</div>
  10. </div>
  11. <el-date-picker
  12. v-model="executorTime"
  13. type="datetime"
  14. value-format="yyyy-MM-dd HH:mm:ss"
  15. placeholder="选择日期"
  16. @change="handleCreate"
  17. >
  18. </el-date-picker>
  19. </div>
  20. <el-button
  21. type="primary"
  22. size="mini"
  23. :loading="loadingBtn"
  24. @click="save(2, 'all')"
  25. >一键报工</el-button
  26. >
  27. <el-button type="primary" size="mini" @click="removeCacheFn('all')"
  28. >清空缓存</el-button
  29. >
  30. <el-button
  31. v-if="taskObj.type == 1"
  32. type="primary"
  33. size="mini"
  34. @click="save(1, 'all')"
  35. >缓存</el-button
  36. >
  37. </div>
  38. <div class="job_box">
  39. <div
  40. v-for="(item, index) in List"
  41. :key="index"
  42. class="card_box"
  43. v-if="isLoad"
  44. >
  45. <div class="title_box rx-bc" v-if="!taskObj.isOrderListData">
  46. <div class="name">工单信息 </div>
  47. <div class="rx-bc">
  48. <el-button
  49. type="text"
  50. size="mini"
  51. @click="openPicking(item.workOrderId, item)"
  52. >手动添加</el-button
  53. >
  54. <el-button
  55. type="text"
  56. size="mini"
  57. @click="removeCacheFn(item.workOrderId)"
  58. >清空缓存</el-button
  59. >
  60. <el-button
  61. v-if="taskObj.type == 1"
  62. type="text"
  63. size="mini"
  64. @click="save(1, index)"
  65. >缓存</el-button
  66. >
  67. </div>
  68. </div>
  69. <!-- // 工单信息 -->
  70. <workOrderBom
  71. :item="item"
  72. v-if="!taskObj.isOrderListData"
  73. ></workOrderBom>
  74. <!-- 报工时间 -->
  75. <div>
  76. <div class="title_box rx-bc">
  77. <div class="name">报工时间</div>
  78. </div>
  79. <el-date-picker
  80. v-model="item.workReportInfo.executorTime"
  81. type="datetime"
  82. value-format="yyyy-MM-dd HH:mm:ss"
  83. placeholder="选择日期"
  84. >
  85. </el-date-picker>
  86. </div>
  87. <paramBom
  88. v-if="item.paramDetailList.length != 0"
  89. :list="item.paramDetailList"
  90. ></paramBom>
  91. <!-- //报工信息 -->
  92. <div v-if="item.singleReport == 0">
  93. <jobBom
  94. :item="item"
  95. ref="jobBomRef"
  96. :notFormed="item.notFormedList"
  97. :warehouseList="warehouseList"
  98. ></jobBom>
  99. </div>
  100. <div v-if="item.singleReport == 1">
  101. <jobDdBom
  102. :item="item"
  103. ref="jobRef"
  104. :notFormed="item.notFormedList"
  105. :warehouseList="warehouseList"
  106. ></jobDdBom>
  107. </div>
  108. <!-- :item="item" :notFormed="item.notFormedList" :warehouseList="warehouseList" @modeNum='modeNum'-->
  109. <deviceBom
  110. v-if="item.equipmentList.length != 0"
  111. :list="item.equipmentList"
  112. ></deviceBom>
  113. <modelBom
  114. v-if="item.modelList.length != 0"
  115. :list="item.modelList"
  116. pattern="job"
  117. ref="modelRef"
  118. :item="item"
  119. ></modelBom>
  120. <palletBom
  121. v-if="item.palletList.length != 0"
  122. :list="item.palletList"
  123. ></palletBom>
  124. <revolvingDiskBom
  125. v-if="item.revolvingDiskList.length > 0"
  126. pattern="job"
  127. :list="objData.revolvingDiskList"
  128. >
  129. </revolvingDiskBom>
  130. <!-- 单件 报告信息 -->
  131. <semiProductJobBom
  132. :singleReport="item.singleReport"
  133. v-if="
  134. item.semiProductList &&
  135. item.semiProductList.length != 0 &&
  136. item.singleReport == 1
  137. "
  138. :item="item"
  139. :list="item.semiProductList"
  140. :equipmentList="item.equipmentList"
  141. :isChoose="isChoose"
  142. @chooseData="chooseData"
  143. :isEngrave="isEngrave"
  144. :isDisposal="isDisposal"
  145. ></semiProductJobBom>
  146. <!-- 通用批量报工 -->
  147. <batchSemiProductJobBom
  148. :singleReport="item.singleReport"
  149. v-if="
  150. item.product &&
  151. item.product.length != 0 &&
  152. item.singleReport == 0 &&
  153. clientEnvironmentId != 3 &&
  154. clientEnvironmentId != 2
  155. "
  156. :item="item"
  157. :list="item.product"
  158. :equipmentList="item.equipmentList"
  159. :isChoose="isChoose"
  160. :isEngrave="isEngrave"
  161. :isDisposal="isDisposal"
  162. @chooseData="chooseData"
  163. ></batchSemiProductJobBom>
  164. <!-- <checkbox :tableData="item.semiProductList" ></checkbox> -->
  165. <!-- :itemData="item" @tableDataFn="tableDataFn" -->
  166. <!-- 碳谷批量报工 -->
  167. <semiProductJobBomPL
  168. :singleReport="item.singleReport"
  169. v-if="
  170. item.semiProductList &&
  171. item.semiProductList.length != 0 &&
  172. taskObj.type != 4 &&
  173. taskObj.type != 6 &&
  174. item.singleReport == 0 &&
  175. clientEnvironmentId == 3
  176. "
  177. :item="item"
  178. :list="item.semiProductList"
  179. :equipmentList="item.equipmentList"
  180. @countNumPl="countNumPl"
  181. :isChoose="isChoose"
  182. :isEngrave="isEngrave"
  183. :isDisposal="isDisposal"
  184. :index="index"
  185. ></semiProductJobBomPL>
  186. <!-- <semiProductJobBom v-if="
  187. item.pickOutInList &&
  188. item.pickOutInList.length != 0 &&
  189. taskObj.type == 6 &&
  190. item.singleReport == 1
  191. " :item="item" :list="item.pickOutInList">
  192. </semiProductJobBom> -->
  193. <!-- 物料清单 -->
  194. <!-- <semiProductBom
  195. v-if="
  196. item.semiProductList.length != 0 &&
  197. item.singleReport == 0 &&
  198. clientEnvironmentId != 3
  199. "
  200. :list="item.semiProductList"
  201. :equipmentList="item.equipmentList"
  202. :workInfo="item"
  203. ></semiProductBom> -->
  204. <!-- 产品信息 -->
  205. <oneJobQualityBomPL
  206. v-if="
  207. item.semiProductList &&
  208. item.semiProductList.length != 0 &&
  209. taskObj.type == 6 &&
  210. item.singleReport == 0 &&
  211. clientEnvironmentId == 3
  212. "
  213. :item="item"
  214. :list="item.semiProductList"
  215. >
  216. </oneJobQualityBomPL>
  217. <byProductBom
  218. v-if="item.productRecycleList.length != 0"
  219. :list="item.productRecycleList"
  220. >
  221. </byProductBom>
  222. <turnoverBom
  223. v-if="item.turnover.length != 0"
  224. :list="item.turnover"
  225. :wordItem="item"
  226. pattern="job"
  227. >
  228. </turnoverBom>
  229. <aridRegion
  230. v-if="item.aridRegionList.length != 0"
  231. :list="item.aridRegionList"
  232. :isType="true"
  233. ></aridRegion>
  234. <!-- 这里是包装分组 -->
  235. <!-- <div
  236. v-if="
  237. item.currentTaskDiagram.type == 4 &&
  238. item.semiProductList.length != 0
  239. "
  240. >
  241. <semiProductJobBom
  242. :singleReport="item.singleReport"
  243. :item="item"
  244. :list="
  245. item.currentTaskDiagram.type == 4
  246. ? item.pickOutInList
  247. : item.semiProductList
  248. "
  249. :equipmentList="item.equipmentList"
  250. ></semiProductJobBom>
  251. </div>
  252. <div
  253. v-if="
  254. item.currentTaskDiagram.type == 4 && item.pickOutInList.length != 0
  255. "
  256. >
  257. <semiProductJobBom
  258. :singleReport="item.singleReport"
  259. :item="item"
  260. :list="
  261. item.currentTaskDiagram.type == 4
  262. ? item.pickOutInList
  263. : item.semiProductList
  264. "
  265. :equipmentList="item.equipmentList"
  266. ></semiProductJobBom>
  267. </div> -->
  268. <div
  269. v-if="
  270. clientEnvironmentId != 2 &&
  271. item &&
  272. item.currentTaskDiagram.type == 4 &&
  273. clientEnvironmentId != 3
  274. "
  275. >
  276. <!-- <packagingGrouping
  277. ref="packagingGroupingRef"
  278. :objData="item"
  279. :workOrderId="item.workOrderId"
  280. :taskId="item.currentTaskDiagram.taskId"
  281. >
  282. </packagingGrouping> -->
  283. <batchPackagingGrouping
  284. ref="packagingGroupingRef"
  285. :objData="item"
  286. :workOrderId="item.workOrderId"
  287. :taskId="item.currentTaskDiagram.taskId"
  288. >
  289. </batchPackagingGrouping>
  290. </div>
  291. <!-- <packingBom :taskId='taskObj.id' :workOrderId="item.workOrderId" :objData="item" ref="packRef"
  292. v-if='taskObj.type == 4 && clientEnvironmentId != 3 && item'></packingBom> -->
  293. <!-- <semiProductJobBom
  294. :singleReport="item.singleReport"
  295. v-if="
  296. item.semiProductList &&
  297. item.semiProductList.length != 0 &&
  298. item.singleReport == 1
  299. "
  300. :item="item"
  301. :list="item.semiProductList"
  302. :equipmentList="item.equipmentList"
  303. :isChoose="isChoose"
  304. @chooseData="chooseData"
  305. :isEngrave="isEngrave"
  306. :isDisposal="isDisposal"
  307. ></semiProductJobBom> -->
  308. <!-- <packingTgBom
  309. v-if="
  310. item.pickOutInList &&
  311. item.pickOutInList.length != 0 &&
  312. taskObj.type == 4 &&
  313. clientEnvironmentId == 3
  314. "
  315. :list="item.pickOutInList"
  316. :item="item"
  317. ></packingTgBom> -->
  318. <semiProductJobBom
  319. v-if="
  320. item.pickOutInList &&
  321. item.pickOutInList.length != 0 &&
  322. taskObj.type == 4 &&
  323. clientEnvironmentId == 3
  324. "
  325. :singleReport="item.singleReport"
  326. :list="item.semiProductList"
  327. :equipmentList="item.equipmentList"
  328. :item="item"
  329. @chooseData="chooseData"
  330. :isEngrave="isEngrave"
  331. :isDisposal="isDisposal"
  332. ></semiProductJobBom>
  333. </div>
  334. </div>
  335. <pickingList
  336. isType="job"
  337. ref="pickingListRef"
  338. @allSelection="allSelection"
  339. ></pickingList>
  340. </div>
  341. </template>
  342. <script>
  343. import { listByIdsReport } from '@/api/produce/job';
  344. import { getWarehouseList } from '@/api/produce/index';
  345. import {
  346. jobSave,
  347. saveCache,
  348. getCache,
  349. removeCache
  350. } from '@/api/produce/workOrder';
  351. import pickingList from '../picking/pickingList.vue';
  352. import packagingGrouping from './components/packagingGrouping.vue';
  353. import workOrderBom from '../feeding/components/workOrderBom.vue';
  354. import paramBom from '../feeding/components/paramBom.vue';
  355. import jobBom from './components/jobBom.vue';
  356. import deviceBom from '../feeding/components/deviceBom.vue';
  357. import modelBom from '../feeding/components/modelBom.vue';
  358. import palletBom from './components/palletBom.vue';
  359. import revolvingDiskBom from '../feeding/components/revolvingDiskBom.vue';
  360. import oneJobQualityBom from './components/oneJobQualityBom.vue';
  361. import oneJobQualityBomPL from './components/oneJobQualityBomPL.vue';
  362. import jobDdBom from './components/jobDdBom.vue';
  363. import semiProductJobBom from './components/semiProductJobBom.vue';
  364. // import semiProductJobBom from './components/newSemiProductJobBom.vue';
  365. import semiProductJobBomPL from './components/semiProductJobBomPL.vue';
  366. import semiProductJobBomQT from './components/semiProductJobBomQT.vue';
  367. import batchSemiProductJobBom from './components/batchSemiProductJobBom.vue';
  368. import batchPackagingGrouping from './components/batchPackagingGrouping.vue';
  369. import semiProductBom from '../feeding/components/semiProductBom';
  370. // import byProductBom from './components/byProductBom.vue';
  371. import byProductBom from './components/newByProductBom.vue';
  372. import turnoverBom from './components/turnoverBom.vue';
  373. import aridRegion from '../feeding/components/aridRegion.vue';
  374. import packingBom from './components/packingBom.vue';
  375. import packingTgBom from './components/packingTgBom';
  376. import { timestampToDateTime } from '@/utils/index.js';
  377. import { parameterGetByCode } from '@/api/system/dictionary-data';
  378. export default {
  379. components: {
  380. pickingList,
  381. packagingGrouping,
  382. workOrderBom,
  383. paramBom,
  384. jobBom,
  385. deviceBom,
  386. modelBom,
  387. palletBom,
  388. revolvingDiskBom,
  389. oneJobQualityBom,
  390. oneJobQualityBomPL,
  391. semiProductJobBomQT,
  392. semiProductJobBom,
  393. semiProductJobBomPL,
  394. byProductBom,
  395. turnoverBom,
  396. aridRegion,
  397. packingBom,
  398. jobDdBom,
  399. packingTgBom,
  400. semiProductBom,
  401. batchSemiProductJobBom,
  402. batchPackagingGrouping
  403. },
  404. props: {
  405. workListIds: {
  406. type: Array,
  407. default() {
  408. return [];
  409. }
  410. },
  411. reportNeedFeed: {},
  412. workPlanType: {
  413. type: String,
  414. default: ''
  415. }
  416. },
  417. data() {
  418. return {
  419. List: [],
  420. idsList: [],
  421. isLoad: false,
  422. executorTime: '',
  423. warehouseList: [],
  424. loading: null,
  425. loadingBtn: false,
  426. chooseListData: [],
  427. isChoose: false,
  428. isEngrave: false,
  429. isDisposal: false
  430. };
  431. },
  432. computed: {
  433. taskObj() {
  434. return this.$store.state.user.taskObj;
  435. },
  436. clientEnvironmentId() {
  437. return this.$store.state.user.info.clientEnvironmentId;
  438. }
  439. },
  440. watch: {
  441. workListIds: {
  442. handler(val) {
  443. this.getList(val);
  444. },
  445. deep: true,
  446. immediate: true
  447. },
  448. workPlanType: {
  449. handler(val) {
  450. if (val == 1) {
  451. this.getList(this.idsList);
  452. }
  453. }
  454. }
  455. },
  456. created() {
  457. this.getWarehouseListFn();
  458. this.getChooseEngrave();
  459. },
  460. methods: {
  461. checkPack() {
  462. this.$refs.packagingGroupingRef[0].getData();
  463. },
  464. handleCreate(e) {
  465. if (e) {
  466. const list = JSON.parse(JSON.stringify(this.List));
  467. console.log(list);
  468. list.map((item) => {
  469. item.workReportInfo.executorTime = e;
  470. });
  471. this.$set(this, 'List', list);
  472. }
  473. },
  474. async getChooseEngrave() {
  475. await parameterGetByCode({
  476. code: 'choose_engrave'
  477. }).then((res) => {
  478. this.isChoose = res.value == '1' ? true : false;
  479. });
  480. await parameterGetByCode({
  481. code: 'batch_update_engrave'
  482. }).then((res) => {
  483. this.isEngrave = res.value == '1' ? true : false;
  484. });
  485. await parameterGetByCode({
  486. code: 'batch_disposal'
  487. }).then((res) => {
  488. this.isDisposal = res.value == '1' ? true : false;
  489. });
  490. },
  491. getList(ids) {
  492. this.idsList = ids || [];
  493. if (this.taskObj.id != -2) {
  494. let param = {
  495. ids: ids,
  496. taskId: this.taskObj.id,
  497. type: 0
  498. };
  499. this.isLoad = false;
  500. listByIdsReport(param)
  501. .then((res) => {
  502. this.List = res.map((obj) => {
  503. if (!Object.prototype.hasOwnProperty.call(obj, 'turnover')) {
  504. obj['turnover'] = [];
  505. }
  506. if (
  507. !Object.prototype.hasOwnProperty.call(obj, 'aridRegionList')
  508. ) {
  509. obj['aridRegionList'] = [];
  510. }
  511. if (
  512. !Object.prototype.hasOwnProperty.call(obj, 'instanceList')
  513. ) {
  514. obj['instanceList'] = [];
  515. }
  516. if (!Object.prototype.hasOwnProperty.call(obj, 'palletList')) {
  517. obj['palletList'] = [];
  518. }
  519. if (
  520. !Object.prototype.hasOwnProperty.call(
  521. obj,
  522. 'revolvingDiskList'
  523. )
  524. ) {
  525. obj['revolvingDiskList'] = [];
  526. }
  527. if (obj.palletList.length > 0) {
  528. obj.palletList = obj.palletList.map((m) => {
  529. return {
  530. hideKc: true, // 不显示库存
  531. quantity: m.feedQuantity,
  532. ...m
  533. };
  534. });
  535. }
  536. // console.log(this.taskObj.type, 'this.taskObj.type');
  537. if (
  538. (this.taskObj.type == 6 && obj.singleReport == 1) ||
  539. (this.clientEnvironmentId == 3 &&
  540. obj.singleReport == 0 &&
  541. this.taskObj.type == 6)
  542. ) {
  543. obj.semiProductList = obj.pickOutInList;
  544. obj.pickOutInList = [];
  545. console.log('赋值了');
  546. } else if (this.taskObj.type == 6 && obj.singleReport == 0) {
  547. obj.product = obj.pickOutInList;
  548. obj.pickOutInList = [];
  549. } else if (
  550. this.taskObj.type == 4 &&
  551. obj.singleReport == 0 &&
  552. this.clientEnvironmentId != 3 &&
  553. this.clientEnvironmentId != 2
  554. ) {
  555. if (obj.pickOutInList && obj.pickOutInList.length != 0) {
  556. obj.product = obj.pickOutInList;
  557. obj.pickOutInList = [];
  558. }
  559. } else if (
  560. this.taskObj.type == 4 &&
  561. obj.singleReport == 1 &&
  562. this.clientEnvironmentId != 2
  563. ) {
  564. if (obj.pickOutInList && obj.pickOutInList.length != 0) {
  565. obj.semiProductList = obj.pickOutInList;
  566. obj.pickOutInList = [];
  567. }
  568. }
  569. if (
  570. obj.singleReport == 1 &&
  571. obj.currentTaskDiagram.type != 2 &&
  572. obj.currentTaskDiagram.type != 3 &&
  573. obj.currentTaskDiagram.type != 6
  574. ) {
  575. obj.semiProductList.map((item) => {
  576. item.extInfo.taskId = '';
  577. item.extInfo.taskName = '';
  578. });
  579. }
  580. if (
  581. obj.singleReport == 0 &&
  582. obj.currentTaskDiagram.type != 2 &&
  583. obj.currentTaskDiagram.type != 3 &&
  584. obj.currentTaskDiagram.type != 6
  585. ) {
  586. obj.product.map((item) => {
  587. item.extInfo.taskId = '';
  588. item.extInfo.taskName = '';
  589. });
  590. }
  591. if (
  592. this.clientEnvironmentId == 3 &&
  593. obj.singleReport == 0 &&
  594. this.taskObj.type != 6
  595. ) {
  596. obj.semiProductList.map((a) => {
  597. a.extInfo.batchReportInfo = [
  598. {
  599. allFeedQuantity: '',
  600. allReportWeight: '',
  601. taskId: '',
  602. taskName: ''
  603. }
  604. ];
  605. a.extInfo.notBatchReportInfo = [
  606. {
  607. allFeedQuantity: '',
  608. notType: '',
  609. taskId: '',
  610. taskName: '',
  611. notReason: ''
  612. }
  613. ];
  614. return {
  615. a
  616. };
  617. });
  618. obj.semiProductList = JSON.parse(
  619. JSON.stringify(obj.semiProductList)
  620. );
  621. }
  622. obj.semiProductList = obj.semiProductList.map((item) => {
  623. if (this.taskObj.type != 6) {
  624. if (item['extInfo']?.reportWeight) {
  625. item['extInfo'].reportWeight = '';
  626. }
  627. }
  628. item.confirm = 0;
  629. console.log(item, 'item');
  630. return item;
  631. });
  632. obj.product = obj.product.map((item) => {
  633. if (this.taskObj.type != 6) {
  634. if (item['extInfo']?.reportWeight) {
  635. item['extInfo'].reportWeight = '';
  636. }
  637. }
  638. item.confirm = 0;
  639. console.log(item, 'item');
  640. return item;
  641. });
  642. obj.workReportInfo = {
  643. executorTime: null,
  644. formingNum: null,
  645. formingWeight: null,
  646. formedNum: null,
  647. formedWeight: null,
  648. taskId: this.taskObj.id,
  649. notFormedNum: null,
  650. notFormedWeigh: null
  651. };
  652. obj.notFormedList = [
  653. {
  654. notFormedNum: null,
  655. notFormedWeight: null,
  656. weightUnit: obj.weightUnit,
  657. unit: obj.unit,
  658. warehouseId: null // 处置 仓库id
  659. }
  660. ];
  661. if (obj.semiProductList.length != 0) {
  662. // 预制体报工
  663. obj.workReportInfo.formedNum = obj.semiProductList.length;
  664. let numCot = 0;
  665. let notFormedNum = 0;
  666. if (obj.semiProductList.length > 0) {
  667. obj.semiProductList.map((fitem) => {
  668. if (
  669. !fitem.extInfo.isQualified ||
  670. fitem.extInfo.isQualified == 1
  671. ) {
  672. numCot = numCot + fitem.feedQuantity || 1;
  673. } else {
  674. notFormedNum = notFormedNum + fitem.feedQuantity;
  675. }
  676. });
  677. obj.workReportInfo.formedNum = numCot;
  678. obj.workReportInfo.notFormedNum = notFormedNum;
  679. }
  680. } else if (obj.product.length != 0) {
  681. const formedNum = obj.product.reduce((acc, pro) => {
  682. return pro.feedQuantity &&
  683. (!pro.extInfo.isQualified || pro.extInfo.isQualified == 1)
  684. ? acc + Number(pro.feedQuantity)
  685. : acc;
  686. }, 0);
  687. const notFormedNum = obj.product.reduce((acc, pro) => {
  688. return pro.feedQuantity && pro.extInfo.isQualified == 2
  689. ? acc + Number(pro.feedQuantity)
  690. : acc;
  691. }, 0);
  692. obj.workReportInfo.formedNum = formedNum;
  693. obj.workReportInfo.notFormedNum = notFormedNum;
  694. }
  695. obj.workReportInfo.formingNum = obj.formingNum;
  696. obj.workReportInfo.formingWeight = obj.formingWeight;
  697. obj.workReportInfo.unit = obj.unit;
  698. obj.workReportInfo.weightUnit = obj.weightUnit;
  699. obj.workReportInfo.workOrderId = obj.workOrderId;
  700. obj.workReportInfo.executorTime = obj.executorTime;
  701. obj.paramDetailList.map((m) => {
  702. if (m.extInfo.textType == 5) {
  703. m.remainingTime = m.extInfo.remainingTime;
  704. }
  705. return {
  706. ...m.extInfo
  707. };
  708. });
  709. console.log(obj, 4445555);
  710. if (this.taskObj.type == 4) {
  711. let numVal = 0;
  712. obj.pickOutInList.map((item) => {
  713. numVal = numVal + item.feedQuantity;
  714. });
  715. obj.workReportInfo.formedNum = numVal;
  716. }
  717. return {
  718. ...obj
  719. };
  720. });
  721. })
  722. .finally(() => {
  723. this.isLoad = true;
  724. if (this.taskObj.type == 1) {
  725. this.getCacheFn();
  726. }
  727. });
  728. }
  729. },
  730. openPicking(id, item) {
  731. this.$refs.pickingListRef.open(id, item);
  732. },
  733. allSelection(id, selectList) {
  734. console.log(id, selectList, 'allSelection');
  735. this.List.forEach((m) => {
  736. if (m.workOrderId == id) {
  737. let turnover = [];
  738. let equipmentList = []; // 生产设备
  739. selectList.forEach((f) => {
  740. if (f.rootCategoryLevelId == 4) {
  741. equipmentList = equipmentList.concat(f);
  742. }
  743. if (f.rootCategoryLevelId == 7) {
  744. turnover = turnover.concat(f);
  745. }
  746. });
  747. this.$set(m, 'equipmentList', equipmentList);
  748. this.$set(m, 'turnover', turnover);
  749. this.$forceUpdate();
  750. }
  751. });
  752. },
  753. chooseData(dataList) {
  754. this.chooseListData = this.deepCopy(dataList);
  755. // if (this.chooseListData.length > 0) {
  756. // this.chooseListData.forEach((item) => {
  757. // item.confirm = 1;
  758. // });
  759. // } else {
  760. // this.List.forEach((item) => {
  761. // item.semiProductList.forEach((fitem) => {
  762. // fitem.confirm = 0;
  763. // });
  764. // });
  765. // }
  766. },
  767. deepCopy(obj, hash = new WeakMap()) {
  768. if (obj === null) return null;
  769. if (obj instanceof Date) return new Date(obj);
  770. if (obj instanceof RegExp) return new RegExp(obj);
  771. if (typeof obj !== 'object' && typeof obj !== 'function') return obj;
  772. if (hash.has(obj)) return hash.get(obj); // 处理循环引用
  773. const result = Array.isArray(obj) ? [] : {};
  774. hash.set(obj, result); // 存储原始对象和其副本的映射关系
  775. return Object.keys(obj).reduce((acc, key) => {
  776. acc[key] = this.deepCopy(obj[key], hash);
  777. return acc;
  778. }, result);
  779. },
  780. async save(type) {
  781. const required = await parameterGetByCode({
  782. code: 'mes_report_engrave_required'
  783. }).then((res) => {
  784. return res;
  785. });
  786. console.log(required, 'required');
  787. let confirmList = [];
  788. // const confirmList = this.List[0].semiProductList.filter(
  789. // (item) => item.confirm == 1
  790. // );
  791. this.List.forEach((item) => {
  792. item.semiProductList.forEach((it) => {
  793. if (it.confirm == 1) {
  794. confirmList.push(it);
  795. }
  796. });
  797. });
  798. if (required.value == '1' && this.List[0].singleReport == 1) {
  799. // if (this.chooseListData.length > 0) {
  800. // this.checkChooseData(this.chooseListData, type, 'choose');
  801. // return;
  802. // } else {
  803. // this.checkChooseData(this.List, type, 'all');
  804. // return;
  805. // }
  806. console.log(this.List, 'this.List');
  807. if (confirmList.length > 0) {
  808. for (let i = 0; i < confirmList.length; i++) {
  809. // if (
  810. // !confirmList[i].extInfo.engrave &&
  811. // confirmList[i].confirm == 1
  812. // ) {
  813. // this.$message.warning('请输入刻码!');
  814. // return;
  815. // }
  816. if (confirmList[i].confirm == 1) {
  817. if (!confirmList[i].extInfo.engrave) {
  818. this.$message.warning('请输入刻码!');
  819. return;
  820. }
  821. }
  822. }
  823. } else {
  824. if (this.List.length > 0) {
  825. console.log(this.List);
  826. for (let i = 0; i < this.List[0].semiProductList.length; i++) {
  827. // if (!this.List[0].semiProductList[i].extInfo.engrave) {
  828. // this.$message.warning('请输入刻码!');
  829. // return;
  830. // }
  831. if (this.List[0].semiProductList[i].confirm == 1) {
  832. if (!this.List[0].semiProductList[i].extInfo.engrave) {
  833. this.$message.warning('请输入刻码!');
  834. return;
  835. }
  836. }
  837. }
  838. // this.List.forEach((item) => {
  839. // for (let i = 0; i < item.semiProductList.length; i++) {
  840. // if (!item.semiProductList[i].extInfo.engrave) {
  841. // this.$message.warning('请输入刻码!');
  842. // return;
  843. // }
  844. // }
  845. // });
  846. // for (let i = 0; i < this.List.length; i++) {
  847. // for(let j = 0; i < this.List[i].semiProductList.length; j++) {
  848. // }
  849. // // for (let j = 0; this.List[i].semiProductList.length; j++) {
  850. // // console.log(
  851. // // this.List[i].semiProductList[j],
  852. // // 'this.List[i].semiProductList[j]'
  853. // // );
  854. // // if (!this.List[i].semiProductList[j].extInfo.engrave) {
  855. // // this.$message.warning('请输入刻码!');
  856. // // return;
  857. // // }
  858. // // }
  859. // }
  860. }
  861. }
  862. }
  863. console.log('11111', this.List);
  864. this.loading = this.$loading({
  865. lock: true,
  866. text: '加载中',
  867. background: 'rgba(0, 0, 0, 0.7)'
  868. });
  869. let arr = this.List.filter((L) => L.workReportInfo.executorTime);
  870. if (!arr.length) {
  871. this.loading.close();
  872. return this.$message.warning('请选择执行时间');
  873. }
  874. for (let i = 0; i < this.List.length; i++) {
  875. if (
  876. this.List[i].packInfo &&
  877. Object.keys(this.List[i].packInfo).length === 0
  878. ) {
  879. this.loading.close();
  880. return this.$message.warning('请到主数据配置包装规格');
  881. }
  882. }
  883. // if(this.taskObj.type !=6){
  884. // if(this.reportNeedFeed==1&&!(this.List[0].semiProductList.length>0||this.List[0].pickOutInList.length>0)){
  885. // this.loading.close();
  886. // return this.$message.warning('请先投料再报工');
  887. // }
  888. // }
  889. let bol2;
  890. bol2 = this.List.every((e) => {
  891. return (
  892. // e.workReportInfo['formedNum'] && e.workReportInfo['formedNum'] != 0
  893. e.workReportInfo['formedNum'] != ''
  894. );
  895. });
  896. // if (!bol2) {
  897. // this.$message.warning('请输入合格品数量');
  898. // this.loading.close();
  899. // return false;
  900. // }
  901. // 预制体
  902. let wId;
  903. let bol = true;
  904. let _i;
  905. this.List.forEach((L) => {
  906. if (
  907. L.semiProductList.length > 0 &&
  908. this.taskObj.type != 4 &&
  909. L.singleReport == 1
  910. ) {
  911. bol = L.semiProductList.every((e, i) => {
  912. _i = i + 1;
  913. wId = L.code;
  914. if (this.taskObj.type == 6) {
  915. return (
  916. Object.prototype.hasOwnProperty.call(e.extInfo, 'taskId') &&
  917. e.extInfo.taskId
  918. );
  919. } else {
  920. if (e.extInfo.isQualified == 1 || e.extInfo.notType == 5) {
  921. return (
  922. Object.prototype.hasOwnProperty.call(e.extInfo, 'taskId') &&
  923. e.extInfo.taskId &&
  924. e.extInfo.reportWeight
  925. );
  926. } else {
  927. return (
  928. Object.prototype.hasOwnProperty.call(
  929. e.extInfo,
  930. 'notType'
  931. ) && e.extInfo.notType
  932. );
  933. }
  934. }
  935. });
  936. }
  937. if (L.workReportInfo.batchNo) {
  938. L.workReportInfo.batchNo = L.batchNo + L.workReportInfo.batchNo;
  939. }
  940. });
  941. // if (!bol) {
  942. // this.$message.warning(`请完善工单${wId}第${_i}处置方式`);
  943. // this.loading.close();
  944. // return false;
  945. // }
  946. if (this.clientEnvironmentId != 2) {
  947. for (let i = 0; i < this.List.length; i++) {
  948. for (let j = 0; j < this.List[i].productRecycleList.length; j++) {
  949. if (!this.List[i].productRecycleList[j].warehouseId) {
  950. const isRecycle = await this.checkRecycle();
  951. if (!isRecycle) {
  952. return false;
  953. }
  954. }
  955. }
  956. }
  957. // let succ = this.List.some((L) => {
  958. // return L.productRecycleList.length > 0;
  959. // });
  960. // if (succ) {
  961. // const isRecycle = await this.checkRecycle();
  962. // if (!isRecycle) {
  963. // return false;
  964. // }
  965. // }
  966. }
  967. console.log(this.item, '9999999999');
  968. if (
  969. this.taskObj.type == 4 &&
  970. this.clientEnvironmentId != 3 &&
  971. this.clientEnvironmentId != 2
  972. ) {
  973. this.checkPack();
  974. // if (!isPack) {
  975. // return false
  976. // }
  977. }
  978. console.log('4444444444', this.List);
  979. if (this.taskObj.type == 1) {
  980. const isCache = await this.checkCache(type);
  981. if (!isCache) {
  982. return false;
  983. }
  984. }
  985. if (
  986. this.clientEnvironmentId == 3 &&
  987. type == 2 &&
  988. this.taskObj.type == 6
  989. ) {
  990. this.List.forEach((L) => {
  991. if (L.singleReport == 0) {
  992. L.semiProductList = [];
  993. }
  994. });
  995. console.log('ashsaoghaoghoasg');
  996. }
  997. let isSemiProduct = false;
  998. this.List.map((semi) => {
  999. if (
  1000. semi.semiProductList.length == 0 &&
  1001. semi.singleReport == 1 &&
  1002. semi.currentTaskDiagram.isFirstTask == 1 &&
  1003. this.clientEnvironmentId != 3
  1004. ) {
  1005. isSemiProduct = true;
  1006. this.loading.close();
  1007. setTimeout(() => {
  1008. this.$message.warning({
  1009. message: '请工单编号:' + semi.code + '先创建在制品',
  1010. key: semi.code // 使用当前时间作为key,确保唯一性
  1011. });
  1012. }, 500);
  1013. }
  1014. if (semi.semiProductList.length == 0 && semi.singleReport == 0) {
  1015. semi.semiProductList.map((ditem) => {
  1016. if (ditem.extInfo.batchReportInfo) {
  1017. ditem.extInfo.batchReportInfo.map((baItem) => {
  1018. let idvalue = baItem.deviceId
  1019. ? baItem.deviceId.split('/')
  1020. : '';
  1021. baItem.deviceId = idvalue ? idvalue[0] : '';
  1022. });
  1023. }
  1024. if (ditem.extInfo.notBatchReportInfo) {
  1025. ditem.extInfo.notBatchReportInfo.map((noItem) => {
  1026. let idvalue = noItem.deviceId
  1027. ? noItem.deviceId.split('/')
  1028. : '';
  1029. noItem.deviceId = idvalue ? idvalue[0] : '';
  1030. });
  1031. }
  1032. });
  1033. }
  1034. });
  1035. if (isSemiProduct) {
  1036. this.loading.close();
  1037. return;
  1038. }
  1039. console.log(this.List, 'this.List');
  1040. // this.List[0].product = this.List[0].semiProductList;
  1041. this.loadingBtn = true;
  1042. jobSave(this.List)
  1043. .then((res) => {
  1044. this.loadingBtn = false;
  1045. this.loading.close();
  1046. this.$message.success('报工成功');
  1047. this.getList(this.idsList);
  1048. this.$emit('jobSuccess', 'Success');
  1049. })
  1050. .catch(() => {
  1051. this.loadingBtn = false;
  1052. this.loading.close();
  1053. });
  1054. // .finally(() => {
  1055. // setTimeout(function () {
  1056. // this.loading.close();
  1057. // }, 3000);
  1058. // });
  1059. },
  1060. checkRecycle() {
  1061. // this.loading.close();
  1062. return new Promise((resolve) => {
  1063. this.$confirm('是否跳过副产品回收处置!', '提示', {
  1064. confirmButtonText: '确定',
  1065. cancelButtonText: '取消',
  1066. type: 'warning'
  1067. })
  1068. .then(() => {
  1069. resolve(true);
  1070. })
  1071. .catch(() => {
  1072. resolve(false);
  1073. });
  1074. });
  1075. },
  1076. checkCache(type) {
  1077. return new Promise((resolve) => {
  1078. if (type == 1) {
  1079. saveCache(this.List).then((rr) => {
  1080. this.$message.success('缓存成功');
  1081. this.loading.close();
  1082. });
  1083. resolve(false);
  1084. } else if (type == 2) {
  1085. resolve(true);
  1086. }
  1087. });
  1088. },
  1089. getCacheFn() {
  1090. let parma = {
  1091. workOrderIds: this.idsList,
  1092. taskId: this.taskObj.id,
  1093. type: 1
  1094. };
  1095. getCache(parma).then((res) => {
  1096. this.List.forEach((f, index) => {
  1097. res.forEach((o) => {
  1098. if (f.workOrderId == o.workOrderId) {
  1099. f['product'] = o.extInfo.product;
  1100. f['workReportInfo'] = o.extInfo.workReportInfo;
  1101. f['notFormedList'] = o.extInfo.notFormedList;
  1102. f['turnover'] = o.extInfo.turnover;
  1103. f['productRecycleList'] = o.extInfo.productRecycleList;
  1104. f['semiProductList'] = o.extInfo.semiProductList;
  1105. f['modelList'] = o.extInfo.modelList;
  1106. // this.$set(this.List[index].workReportInfo,'executorTime',timestampToDateTime(o.extInfo.workReportInfo.executorTime))
  1107. this.$forceUpdate();
  1108. }
  1109. });
  1110. });
  1111. });
  1112. },
  1113. removeCacheFn(type) {
  1114. this.$confirm('是否清空缓存', '缓存')
  1115. .then(() => {
  1116. let parma = {
  1117. workOrderIds: type == 'all' ? this.idsList : [type],
  1118. taskId: this.taskObj.id,
  1119. type: 1
  1120. };
  1121. removeCache(parma).then((res) => {
  1122. this.$message.success('已经清空缓存');
  1123. this.getList(this.idsList);
  1124. });
  1125. })
  1126. .catch(() => {});
  1127. },
  1128. getWarehouseListFn() {
  1129. getWarehouseList().then((res) => {
  1130. this.warehouseList = res.data;
  1131. });
  1132. },
  1133. //批量报工合格不合格重量统计
  1134. countNumPl(list, index) {
  1135. console.log('11111122222333', list);
  1136. //合格总数
  1137. let formedNumCount = 0;
  1138. //合格总重量
  1139. let formedWeightCount = 0;
  1140. //不合格总数
  1141. let notFormedNumCount = 0;
  1142. //不合格总重量
  1143. let notFormedWeightCount = 0;
  1144. list.map((item) => {
  1145. //合格总数
  1146. item.extInfo.batchReportInfo.forEach((m) => {
  1147. formedNumCount = formedNumCount + Number(m.allFeedQuantity || 0);
  1148. });
  1149. //合格总重量
  1150. item.extInfo.batchReportInfo.forEach((w) => {
  1151. formedWeightCount =
  1152. formedWeightCount + Number(w.allReportWeight || 0);
  1153. });
  1154. //不合格总数
  1155. item.extInfo.notBatchReportInfo.forEach((nf) => {
  1156. notFormedNumCount =
  1157. notFormedNumCount + Number(nf.allFeedQuantity || 0);
  1158. });
  1159. //不合格总重量
  1160. item.extInfo.notBatchReportInfo.forEach((nw) => {
  1161. notFormedWeightCount =
  1162. notFormedWeightCount + Number(nw.allReportWeight || 0);
  1163. });
  1164. });
  1165. this.$set(this.List[index].workReportInfo, 'formedNum', formedNumCount); //合格总数
  1166. this.$set(
  1167. this.List[index].workReportInfo,
  1168. 'formedWeight',
  1169. formedWeightCount
  1170. ); //合格总重量
  1171. this.$set(
  1172. this.List[index].workReportInfo,
  1173. 'notFormedNum',
  1174. notFormedNumCount
  1175. ); //不合格总数
  1176. this.$set(
  1177. this.List[index].workReportInfo,
  1178. 'notFormedWeight',
  1179. notFormedWeightCount
  1180. ); //不合格总重量
  1181. }
  1182. }
  1183. };
  1184. </script>
  1185. <style scoped lang="scss">
  1186. .top_fixed {
  1187. width: 100%;
  1188. height: 40px;
  1189. background: #fff;
  1190. display: flex;
  1191. align-items: center;
  1192. justify-content: flex-end;
  1193. }
  1194. .title_box {
  1195. padding: 10px 0;
  1196. .name {
  1197. font-size: 14px;
  1198. font-style: normal;
  1199. font-weight: 400;
  1200. color: #157a2c;
  1201. padding-left: 5px;
  1202. position: relative;
  1203. &:before {
  1204. position: absolute;
  1205. content: '';
  1206. left: 0px;
  1207. top: 0px;
  1208. bottom: 0px;
  1209. width: 2px;
  1210. height: 14px;
  1211. background: #157a2c;
  1212. margin: auto;
  1213. }
  1214. }
  1215. }
  1216. .job_box {
  1217. // margin-top: 6px;
  1218. width: 100%;
  1219. height: calc(100vh - 70px - 50px - 80px - 60px);
  1220. overflow-y: scroll;
  1221. overflow-x: hidden;
  1222. }
  1223. .card_box {
  1224. background: #fff;
  1225. padding: 8px;
  1226. border-radius: 2px;
  1227. }
  1228. </style>