index.vue 40 KB

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