index.vue 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498
  1. <template>
  2. <!-- 报工页面 -->
  3. <view class="content-box">
  4. <uni-nav-bar
  5. fixed="true"
  6. statusBar="true"
  7. left-icon="back"
  8. :title="title"
  9. background-color="#F7F9FA"
  10. color="#000"
  11. @clickLeft="back"
  12. right-icon="scan"
  13. @clickRight="HandlScanCode"
  14. >
  15. </uni-nav-bar>
  16. <view class="list_box">
  17. <u-list @scrolltolower="scrolltolower">
  18. <view class="card_box">
  19. <!-- 工单信息 objData 报告信息-->
  20. <workOrderBom
  21. :item="objData"
  22. v-if="objData"
  23. pType="job"
  24. :taskType="taskType"
  25. @handleScan="handleScan"
  26. >
  27. </workOrderBom>
  28. <paramBom
  29. v-if="paramDetailList.length != 0"
  30. :list="paramDetailList"
  31. ></paramBom>
  32. <!-- 设备信息 -->
  33. <deviceBom
  34. v-if="objData.equipmentList.length != 0"
  35. :list="objData.equipmentList"
  36. :ishuoWei="false"
  37. :wordItem="objData"
  38. :isDetails="true"
  39. >
  40. </deviceBom>
  41. <modelBom
  42. v-if="objData.modelList.length != 0"
  43. :list="objData.modelList"
  44. pattern="job"
  45. ref="modelRef"
  46. >
  47. </modelBom>
  48. <!-- 1报工信息 -->
  49. <!-- <view v-if="clientEnvironmentId == 3">
  50. <view v-if="objData.singleReport !== 1">
  51. <jobBom
  52. v-if="isLoad"
  53. :item="objData"
  54. ref="jobReftg"
  55. :notFormed="objData.notFormedList"
  56. @penalize="penalize"
  57. @modeNum="modeNum"
  58. ></jobBom>
  59. </view>
  60. </view> -->
  61. <!-- <view>3333</view> -->
  62. <!-- <view v-if=""></view> -->
  63. <!-- 单独报工报工信息 -->
  64. <!-- single -->
  65. <singleJobBom
  66. v-if="objData.singleReport == 1"
  67. :item="objData"
  68. ref="jobRef"
  69. :notFormed="objData.notFormedList"
  70. @penalize="penalize"
  71. @modeNum="modeNum"
  72. ></singleJobBom>
  73. <!-- 批量报工 -->
  74. <batchJobBom
  75. v-else-if="
  76. objData.currentTaskDiagram &&
  77. objData.currentTaskDiagram.type &&
  78. objData.singleReport == 0
  79. "
  80. :item="objData"
  81. ref="jobReftg"
  82. :notFormed="objData.notFormedList"
  83. :currentTask="objData.currentTaskDiagram"
  84. @penalize="penalize"
  85. @modeNum="modeNum"
  86. ></batchJobBom>
  87. <palletBom
  88. v-if="objData.palletList.length != 0"
  89. :palletList="objData.palletList"
  90. ></palletBom>
  91. <revolvingDiskBom
  92. v-if="isLoad && objData.revolvingDiskList.length > 0"
  93. pattern="job"
  94. :revolvingDiskList="objData.revolvingDiskList"
  95. ></revolvingDiskBom>
  96. <!-- <oneJobBom
  97. v-if='objData.instanceList && objData.instanceList.length != 0 && taskType != 4 && taskType != 6'
  98. :item='objData' :list='objData.instanceList'>
  99. </oneJobBom> -->
  100. <!-- -->
  101. <!-- 报工信息 列表 -->
  102. <view
  103. v-if="clientEnvironmentId == 3 || this.objData.singleReport !== 1"
  104. >
  105. <semiProductJobBom
  106. v-if="
  107. objData.semiProductList &&
  108. objData.semiProductList.length != 0 &&
  109. taskType != 4 &&
  110. taskType != 6 &&
  111. objData.singleReport == 1
  112. "
  113. :item="objData"
  114. :list="objData.semiProductList"
  115. :equipmentList="objData.equipmentList"
  116. @weightEmit="weightEmit"
  117. >
  118. </semiProductJobBom>
  119. </view>
  120. <!-- <view v-if="this.objData.singleReport">
  121. </view> -->
  122. <semiProductJobBomPL
  123. v-if="
  124. objData.semiProductList &&
  125. objData.semiProductList.length != 0 &&
  126. taskType != 4 &&
  127. taskType != 6 &&
  128. objData.singleReport == 0
  129. "
  130. :item="objData"
  131. :list="objData.semiProductList"
  132. :equipmentList="objData.equipmentList"
  133. @countNumPl="countNumPl"
  134. >
  135. </semiProductJobBomPL>
  136. <oneJobQualityBom
  137. v-if="
  138. objData.semiProductList &&
  139. objData.semiProductList.length != 0 &&
  140. taskType == 6 &&
  141. clientEnvironmentId == 3 &&
  142. objData.singleReport == 1
  143. "
  144. :item="objData"
  145. :list="objData.semiProductList"
  146. @weightEmit="weightEmit"
  147. ></oneJobQualityBom>
  148. <oneJobQualityBomPL
  149. v-if="
  150. objData.semiProductList &&
  151. objData.semiProductList.length != 0 &&
  152. taskType == 6 &&
  153. clientEnvironmentId == 3 &&
  154. objData.singleReport == 0
  155. "
  156. :item="objData"
  157. :list="objData.semiProductList"
  158. ></oneJobQualityBomPL>
  159. <!-- 副产品 -->
  160. <byProductBom
  161. v-if="objData.productRecycleList.length != 0"
  162. :list="objData.productRecycleList"
  163. @penalize="penalize"
  164. >
  165. </byProductBom>
  166. <!-- 周转车 -->
  167. <turnoverBom
  168. v-if="objData.turnover.length != 0"
  169. :list="objData.turnover"
  170. :itemValue="objData"
  171. :wordItem="objData"
  172. pattern="job"
  173. @handleScan="handleScan"
  174. @formedNumFn="formedNumFn"
  175. >
  176. </turnoverBom>
  177. <!-- // 区域扫码 -->
  178. <aridRegion
  179. v-if="objData.aridRegionList.length != 0"
  180. :list="objData.aridRegionList"
  181. :remainingTime="remainingTime"
  182. @handleScan="handleScan"
  183. :isType="true"
  184. ></aridRegion>
  185. <!-- //包装扫码 -->
  186. <!-- <view v-if="clientEnvironmentId != 2 && objData.singleReport !== 1">
  187. <packingBom
  188. :taskId="taskId"
  189. :workOrderId="id"
  190. :objData="objData"
  191. ref="packRef"
  192. v-if="taskType == 4 && clientEnvironmentId != 3 && objData"
  193. :categoryId="categoryId"
  194. >
  195. </packingBom>
  196. </view> -->
  197. <!-- 通用包装 -->
  198. <view v-if="clientEnvironmentId != 2 && clientEnvironmentId != 3">
  199. <packingBom
  200. :taskId="taskId"
  201. :workOrderId="id"
  202. :objData="objData"
  203. ref="packRef"
  204. v-if="taskType == 4 && clientEnvironmentId != 3 && objData"
  205. :categoryId="categoryId"
  206. >
  207. </packingBom>
  208. </view>
  209. <!-- 碳谷 包装扫码 -->
  210. <packingTgBom
  211. v-if="
  212. objData.pickOutInList &&
  213. objData.pickOutInList.length != 0 &&
  214. taskType == 4 &&
  215. clientEnvironmentId == 3
  216. "
  217. :list="objData.pickOutInList"
  218. :objData="objData"
  219. :item="objData"
  220. ></packingTgBom>
  221. <view class="operate_box rx-sc">
  222. <u-button
  223. size="small"
  224. class="u-reset-button"
  225. type="success"
  226. @click="handAdd"
  227. >手动添加</u-button
  228. >
  229. </view>
  230. <view style="height: 100rpx"></view>
  231. </view>
  232. </u-list>
  233. </view>
  234. <view :class="[operateBtn ? 'flex_btn' : 'flex_btn2']">
  235. <image
  236. v-if="operateBtn"
  237. class="jiantou"
  238. src="../../../../static/rightJt.png"
  239. @click="operateBtn = false"
  240. >
  241. </image>
  242. <view class="close_box" @click="operateBtn = true">
  243. <image
  244. v-if="!operateBtn"
  245. class="close"
  246. src="../../../../static/close.png"
  247. ></image>
  248. </view>
  249. <view v-if="!operateBtn" @click="removeCacheFn()">清空缓存</view>
  250. <view v-if="!operateBtn" @click="switchOrder = true">切换工单</view>
  251. </view>
  252. <view class="bottom-wrapper">
  253. <view class="btn_box" @click="save(1)">缓存</view>
  254. <view class="btn_box" @click="save(2)">一键报工</view>
  255. </view>
  256. <SearchPopup mode="bottom" v-if="searchShow">
  257. <template v-slot:list>
  258. <view class="search_list">
  259. <u-form
  260. labelPosition="left"
  261. :model="formData"
  262. labelWidth="180"
  263. labelAlign="left"
  264. class="baseForm"
  265. >
  266. <u-form-item
  267. label="仓库:"
  268. class="required-form"
  269. borderBottom
  270. prop="warehouseId"
  271. >
  272. <zxz-uni-data-select
  273. :localdata="warehouseList"
  274. v-model="formData.warehouseId"
  275. dataValue="id"
  276. dataKey="name"
  277. filterable
  278. format="{name}"
  279. ></zxz-uni-data-select>
  280. </u-form-item>
  281. </u-form>
  282. </view>
  283. </template>
  284. <template v-slot:operate>
  285. <view class="operate_box rx-bc">
  286. <u-button size="small" class="u-reset-button" @click="searchCancel">
  287. 取消
  288. </u-button>
  289. <u-button
  290. type="success"
  291. size="small"
  292. class="u-reset-button"
  293. @click="popupOk"
  294. >
  295. 确定
  296. </u-button>
  297. </view>
  298. </template>
  299. </SearchPopup>
  300. <SearchPopup mode="center" v-if="switchOrder">
  301. <template v-slot:list>
  302. <view class="search_list2">
  303. <u-form
  304. labelPosition="left"
  305. :model="formData"
  306. labelWidth="180"
  307. labelAlign="left"
  308. class="baseForm"
  309. >
  310. <u-form-item
  311. label="工单:"
  312. class="required-form"
  313. borderBottom
  314. prop="warehouseId"
  315. >
  316. <zxz-uni-data-select
  317. :localdata="warehouseList"
  318. v-model="formData.warehouseId"
  319. dataValue="id"
  320. dataKey="name"
  321. filterable
  322. format="{name}"
  323. ></zxz-uni-data-select>
  324. </u-form-item>
  325. </u-form>
  326. </view>
  327. </template>
  328. <template v-slot:operate>
  329. <view class="operate_box rx-bc">
  330. <u-button
  331. size="small"
  332. class="u-reset-button"
  333. @click="switchOrder = false"
  334. >
  335. 取消
  336. </u-button>
  337. <u-button type="success" size="small" class="u-reset-button">
  338. 确定
  339. </u-button>
  340. </view>
  341. </template>
  342. </SearchPopup>
  343. </view>
  344. </template>
  345. <script>
  346. import {
  347. getByIdReport,
  348. outSourceGetByIdReport,
  349. getByCodeReport,
  350. jobSave,
  351. } from "@/api/pda/jobBooking.js";
  352. import {
  353. scanLedger,
  354. getWarehouseList,
  355. saveCache,
  356. getCache,
  357. removeCache,
  358. } from "@/api/pda/workOrder.js";
  359. import workOrderBom from "../../feeding/components/workOrderBom.vue";
  360. import deviceBom from "../../feeding/components/deviceBom.vue";
  361. import modelBom from "../../feeding/components/modelBom.vue";
  362. import jobBom from "../components/jobBom.vue";
  363. import singleJobBom from "../components/singleJobBom.vue";
  364. import palletBom from "../components/palletBom.vue";
  365. import oneJobBom from "../components/oneJobBom.vue";
  366. import semiProductJobBom from "../components/semiProductJobBom.vue";
  367. import semiProductJobBomPL from "../components/semiProductJobBomPL.vue";
  368. import byProductBom from "../components/byProductBom";
  369. import turnoverBom from "../components/turnoverBom.vue";
  370. import aridRegion from "../../feeding/components/aridRegion.vue";
  371. import paramBom from "../../feeding/components/paramBom.vue";
  372. import packingBom from "../components/packingBom.vue";
  373. import packingTgBom from "../components/packingTgBom";
  374. import revolvingDiskBom from "../../feeding/components/revolvingDiskBom.vue";
  375. import SearchPopup from "../../components/searchPopup.vue";
  376. import oneJobQualityBom from "../components/oneJobQualityBom.vue";
  377. import oneJobQualityBomPL from "../components/oneJobQualityBomPL.vue";
  378. import batchJobBom from "../components/batchJobBom.vue";
  379. import workInProgressList from "../components/workInProgressList.vue";
  380. export default {
  381. components: {
  382. workOrderBom,
  383. deviceBom,
  384. modelBom,
  385. jobBom,
  386. singleJobBom,
  387. palletBom,
  388. oneJobBom,
  389. semiProductJobBom,
  390. semiProductJobBomPL,
  391. byProductBom,
  392. turnoverBom,
  393. aridRegion,
  394. paramBom,
  395. packingBom,
  396. packingTgBom,
  397. revolvingDiskBom,
  398. SearchPopup,
  399. oneJobQualityBom,
  400. oneJobQualityBomPL,
  401. batchJobBom,
  402. workInProgressList,
  403. },
  404. data() {
  405. return {
  406. title: "",
  407. taskType: 1,
  408. isLoad: true,
  409. categoryId: "",
  410. objData: {
  411. formedNumLast: 0,
  412. product: [],
  413. equipmentList: [],
  414. modelList: [],
  415. turnover: [],
  416. productRecycleList: [],
  417. aridRegionList: [],
  418. palletList: [],
  419. workReportInfo: {},
  420. notFormedList: [], // 报工-不合格
  421. },
  422. searchShow: false,
  423. switchOrder: false,
  424. warehouseList: [],
  425. formData: {
  426. warehouseId: "",
  427. },
  428. penalizeIndex: null,
  429. paramDetailList: [],
  430. remainingTime: 0,
  431. id: null,
  432. taskId: null,
  433. clientEnvironmentId:
  434. uni.getStorageSync("userInfo") &&
  435. uni.getStorageSync("userInfo").clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  436. operateBtn: true,
  437. isOutsource: 0,
  438. };
  439. },
  440. onLoad(options) {
  441. this.info = options.info;
  442. this.title = options.taskName ? options.taskName + "-报工" : "报工";
  443. this.taskType = options.taskType;
  444. this.id = options.id;
  445. this.taskId = options.taskId;
  446. this.isOutsource = options.isOutsource;
  447. this.categoryId = options.categoryId;
  448. this.singleReport = options.singleReport; // 单个报工 1是单 2多
  449. this.getList();
  450. },
  451. onShow() {
  452. uni.$off("setSelectList");
  453. uni.$on("setSelectList", (selectList, id) => {
  454. let turnover = [];
  455. let equipmentList = []; // 生产设备
  456. let isEquipment = this.objData.equipmentList.length > 0 ? true : false; // 判断是否有设置
  457. selectList.forEach((f) => {
  458. if (f.rootCategoryLevelId == 4) {
  459. // 生产设备
  460. if (isEquipment) {
  461. equipmentList = this.objData.equipmentList;
  462. } else {
  463. equipmentList = equipmentList.concat(f);
  464. }
  465. }
  466. if (f.rootCategoryLevelId == 7) {
  467. // 周转车
  468. turnover = turnover.concat(f);
  469. }
  470. });
  471. this.$set(this.objData, "equipmentList", equipmentList);
  472. this.$set(this.objData, "turnover", turnover);
  473. this.$forceUpdate();
  474. });
  475. },
  476. methods: {
  477. weightEmit(formedWeight, notFormedWeight) {
  478. this.$refs.jobReftg.fWeightInput(formedWeight, notFormedWeight);
  479. this.$nextTick(() => {
  480. this.$set(this.objData.workReportInfo, "formedWeight", formedWeight);
  481. this.$set(
  482. this.objData.workReportInfo,
  483. "notFormedWeight",
  484. notFormedWeight
  485. );
  486. });
  487. this.$forceUpdate();
  488. },
  489. // 相机扫码
  490. HandlScanCode() {
  491. uni.scanCode({
  492. success: (res) => {
  493. this.scanItAllData(res.result);
  494. },
  495. });
  496. },
  497. scanItAllData(result) {
  498. scanLedger(result).then((res) => {
  499. if (res[0].rootCategoryLevelId == 4) {
  500. // 设备
  501. let isFals = this.objData.equipmentList.some((m) => m.code == result);
  502. if (isFals) {
  503. uni.showToast({
  504. title: "设备已存在",
  505. icon: "none",
  506. });
  507. return false;
  508. }
  509. this.objData.equipmentList.push(res[0]);
  510. this.$forceUpdate();
  511. }
  512. if (res.length >= 1 && res[0].rootCategoryLevelId == 5) {
  513. // 磨具
  514. if (this.objData.modelList.length == 0) {
  515. this.objData.modelList = res;
  516. this.$forceUpdate();
  517. } else {
  518. if (this.objData.modelList[0].instanceId != res[0].instanceId) {
  519. uni.showToast({
  520. title: "模具不匹配",
  521. icon: "none",
  522. });
  523. } else {
  524. uni.showToast({
  525. title: "设备匹配成功",
  526. icon: "none",
  527. });
  528. }
  529. }
  530. } else if (res.length == 1 && res[0].rootCategoryLevelId == 7) {
  531. // 周转车
  532. let isFals = this.objData.turnover.some((m) => m.code == result);
  533. if (isFals) {
  534. uni.showToast({
  535. title: "周转车已存在",
  536. icon: "none",
  537. });
  538. return false;
  539. }
  540. this.objData.turnover.push(res[0]);
  541. this.$forceUpdate();
  542. }
  543. });
  544. },
  545. handleScan(id, type) {
  546. uni.scanCode({
  547. success: (res) => {
  548. this.scanData(res.result, type, id);
  549. },
  550. });
  551. },
  552. scanData(result, type, id) {
  553. if (type == "wordOrder") {
  554. getByCodeReport(result, this.taskId).then((res) => {
  555. this.objData = res;
  556. if (!this.objData.hasOwnProperty("turnover")) {
  557. this.objData["turnover"] = [];
  558. }
  559. if (!this.objData.hasOwnProperty("aridRegionList")) {
  560. this.objData["aridRegionList"] = [];
  561. }
  562. });
  563. } else if (type == "turnover") {
  564. let isFals = this.objData.turnover.some((m) => m.code == result);
  565. if (isFals) {
  566. uni.showToast({
  567. title: "周转车已存在",
  568. icon: "none",
  569. });
  570. return false;
  571. }
  572. getByCodeReport(result, this.taskId).then((res) => {
  573. this.objData.turnover[id] = res;
  574. });
  575. }
  576. },
  577. formedNumFn(num) {
  578. console.log(999, num);
  579. this.$refs.jobRef.setFormedNum(num);
  580. },
  581. getList() {
  582. this.isLoad = false;
  583. let URL = this.isOutsource == 0 ? getByIdReport : outSourceGetByIdReport;
  584. console.log(URL, "URLURLURL");
  585. URL(this.id, this.taskId)
  586. .then((res) => {
  587. // currentTaskDiagram 有是否可以报工
  588. this.objData = res;
  589. console.log(22, res);
  590. if (!this.objData.hasOwnProperty("turnover")) {
  591. this.objData["turnover"] = [];
  592. }
  593. if (!this.objData.hasOwnProperty("aridRegionList")) {
  594. this.objData["aridRegionList"] = [];
  595. }
  596. if (!this.objData.hasOwnProperty("instanceList")) {
  597. this.objData["instanceList"] = [];
  598. }
  599. if (!this.objData.hasOwnProperty("palletList")) {
  600. this.objData["palletList"] = [];
  601. }
  602. if (!this.objData.hasOwnProperty("revolvingDiskList")) {
  603. this.objData["revolvingDiskList"] = [];
  604. }
  605. // this.taskType = res.currentTaskDiagram.type
  606. if (this.objData.palletList.length > 0) {
  607. this.objData.palletList = this.objData.palletList.map((m) => {
  608. return {
  609. hideKc: true, // 不显示库存
  610. quantity: m.feedQuantity,
  611. ...m,
  612. };
  613. });
  614. } else {
  615. // this.objData.palletList = [{
  616. // categoryLevelId: '',
  617. // categoryLevelName: '',
  618. // categoryId: '',
  619. // rootCategoryLevelId: '',
  620. // code: '',
  621. // name: '',
  622. // specification: '',
  623. // brandNum: '',
  624. // modelType: '',
  625. // quantity: '',
  626. // unit: '',
  627. // }]
  628. }
  629. if (
  630. (this.taskType == 6 || this.isOutsource == 1) &&
  631. this.clientEnvironmentId == 3
  632. ) {
  633. this.objData.semiProductList = this.objData.pickOutInList;
  634. }
  635. // if (this.taskId == 6 || this.isOutsource == 1) {
  636. // this.objData.product = this.objData.pickOutInList;
  637. // }
  638. if (
  639. (this.taskType == 6 || this.taskType == 4) &&
  640. this.objData.singleReport == 1 &&
  641. this.clientEnvironmentId != 3 &&
  642. this.clientEnvironmentId != 2
  643. ) {
  644. if (
  645. this.objData.pickOutInList &&
  646. this.objData.pickOutInList.length != 0
  647. ) {
  648. this.objData.semiProductList = this.objData.pickOutInList;
  649. this.objData.pickOutInList = [];
  650. }
  651. }
  652. if (
  653. (this.taskType == 6 || this.taskType == 4) &&
  654. this.objData.singleReport == 0 &&
  655. this.clientEnvironmentId != 3 &&
  656. this.clientEnvironmentId != 2
  657. ) {
  658. if (
  659. this.objData.pickOutInList &&
  660. this.objData.pickOutInList.length != 0
  661. ) {
  662. this.objData.product = this.objData.pickOutInList;
  663. this.objData.pickOutInList = [];
  664. }
  665. }
  666. if (
  667. this.objData.singleReport == 1 &&
  668. this.objData.currentTaskDiagram.type != 2 &&
  669. this.objData.currentTaskDiagram.type != 3 &&
  670. this.objData.currentTaskDiagram.type != 6
  671. ) {
  672. this.objData.semiProductList.map((item) => {
  673. item.extInfo.taskId = "";
  674. item.extInfo.taskName = "";
  675. });
  676. }
  677. if (
  678. this.objData.singleReport == 0 &&
  679. this.objData.currentTaskDiagram.type != 2 &&
  680. this.objData.currentTaskDiagram.type != 3 &&
  681. this.objData.currentTaskDiagram.type != 6
  682. ) {
  683. this.objData.product.map((item) => {
  684. item.extInfo.taskId = "";
  685. item.extInfo.taskName = "";
  686. });
  687. }
  688. if (
  689. this.clientEnvironmentId == 3 &&
  690. this.objData.singleReport == 0 &&
  691. this.taskType != 6
  692. ) {
  693. this.objData.semiProductList.map((a) => {
  694. a.extInfo.batchReportInfo = [
  695. {
  696. allFeedQuantity: "",
  697. allReportWeight: "",
  698. taskId: "",
  699. taskName: "",
  700. },
  701. ];
  702. a.extInfo.notBatchReportInfo = [
  703. {
  704. allFeedQuantity: "",
  705. allReportWeight: "",
  706. notType: "",
  707. taskId: "",
  708. taskName: "",
  709. notReason: "",
  710. },
  711. ];
  712. return {
  713. a,
  714. };
  715. });
  716. this.objData.semiProductList = this.objData.semiProductList;
  717. }
  718. this.objData.workReportInfo = {
  719. formingNum: null,
  720. formingWeight: null,
  721. formedNum: null,
  722. formedWeight: null,
  723. taskId: this.taskId,
  724. executorTime: "",
  725. };
  726. this.objData.notFormedList = [
  727. {
  728. notFormedNum: null,
  729. notFormedWeight: null,
  730. weightUnit: res.weightUnit,
  731. unit: res.unit,
  732. warehouseId: null, // 处置 仓库id
  733. },
  734. ];
  735. if (this.objData.semiProductList.length > 0) {
  736. // 预制体报工
  737. this.objData.workReportInfo.formedNum =
  738. this.objData.semiProductList.length;
  739. let numCot = 0;
  740. if (this.objData.semiProductList.length > 0) {
  741. this.objData.semiProductList.map((fitem) => {
  742. numCot = numCot + fitem.feedQuantity || 1;
  743. });
  744. this.objData.workReportInfo.formedNum = numCot;
  745. }
  746. } else if (this.objData.product.length > 0) {
  747. console.log(this.objData.product, "this.objData.product");
  748. const number = this.objData.product.reduce((acc, pro) => {
  749. return pro.feedQuantity ? acc + Number(pro.feedQuantity) : acc;
  750. }, 0);
  751. this.objData.workReportInfo.formedNum = number;
  752. }
  753. this.objData.workReportInfo.formingNum = res.formingNum;
  754. this.objData.workReportInfo.formingWeight = res.formingWeight;
  755. this.objData.workReportInfo.unit = res.unit;
  756. this.objData.workReportInfo.weightUnit = res.weightUnit;
  757. this.objData.workReportInfo.workOrderId = res.workOrderId;
  758. this.paramDetailList = res.paramDetailList;
  759. console.log(this.objData, "this.paramDetailList");
  760. // this.paramDetailList = res.paramDetailList.map((m) => {
  761. // if (m.extInfo.textType == 5) {
  762. // this.remainingTime = m.extInfo.remainingTime;
  763. // }
  764. // return {
  765. // ...m.extInfo,
  766. // };
  767. // });
  768. })
  769. .finally(() => {
  770. this.isLoad = true;
  771. if (this.taskType == 1) {
  772. this.getCacheFn();
  773. }
  774. });
  775. },
  776. scrolltolower() {},
  777. handAdd() {
  778. const storageKey = Date.now() + "";
  779. uni.setStorageSync(storageKey, this.objData || {});
  780. uni.navigateTo({
  781. url: `/pages/pda/workOrder/search/index?storageKey=${storageKey}&isType=job&taskId=${this.taskId}`,
  782. });
  783. },
  784. penalize(index) {
  785. if (index || index == 0) {
  786. console.log(index, "----");
  787. this.penalizeIndex = index;
  788. this.formData.warehouseId =
  789. this.objData.productRecycleList[this.penalizeIndex].warehouseId || "";
  790. } else {
  791. this.penalizeIndex = null;
  792. this.formData.warehouseId =
  793. this.objData.notFormedList[0].warehouseId || "";
  794. console.log(this.formData.warehouseId, "+++++");
  795. }
  796. this.$forceUpdate();
  797. if (this.warehouseList.length == 0) {
  798. getWarehouseList().then((res) => {
  799. this.warehouseList = res;
  800. this.searchShow = true;
  801. });
  802. } else {
  803. this.searchShow = true;
  804. }
  805. },
  806. inputChange(e) {
  807. console.log(e);
  808. },
  809. searchCancel() {
  810. this.searchShow = false;
  811. },
  812. popupOk() {
  813. if (this.penalizeIndex == null) {
  814. this.$set(
  815. this.objData.notFormedList[0],
  816. "warehouseId",
  817. this.formData.warehouseId || null
  818. );
  819. } else {
  820. this.objData.productRecycleList[this.penalizeIndex].warehouseId =
  821. this.formData.warehouseId;
  822. }
  823. this.$forceUpdate();
  824. this.searchShow = false;
  825. },
  826. modeNum(num) {
  827. console.log(num, "------------", this.objData.modelList.length);
  828. if (this.objData.modelList.length == 0) {
  829. return false;
  830. }
  831. console.log(num);
  832. this.$refs.modelRef.setNum(num);
  833. },
  834. async save(type) {
  835. // 验证判断条件
  836. this.$isJobExls(1, this.objData);
  837. // console.log(this.objData, "this.objData");
  838. // return;
  839. // for (let i = 0; i < this.List.length; i++) {
  840. // if (
  841. // !this.List[i].executorTime &&
  842. // this.List[i].executorTime == undefined
  843. // ) {
  844. // uni.showToast({
  845. // title: `请先选择报工时间`,
  846. // icon: "none",
  847. // });
  848. // return;
  849. // }
  850. // }
  851. if (!(this.clientEnvironmentId == 3 || this.objData.singleReport !== 1)) {
  852. if (this.objData.semiProductList.length) {
  853. let arr = this.objData.semiProductList.filter(
  854. (v) => v.selected == true
  855. );
  856. this.objData.semiProductList = arr;
  857. if (!arr.length) {
  858. return uni.showToast({
  859. title: "请选择报工数量",
  860. icon: "none",
  861. });
  862. }
  863. // else{
  864. // let engraveList = arr.filter(v=> v.extInfo.engrave ==null);
  865. // if(engraveList.length){
  866. // return uni.showToast({
  867. // title: '请输入刻码',
  868. // icon: 'none'
  869. // })
  870. // }
  871. // }
  872. }
  873. }
  874. uni.showLoading({
  875. title: "加载中",
  876. });
  877. if (
  878. !this.objData.workReportInfo["formedNum"] &&
  879. this.objData.workReportInfo["formedNum"] != 0
  880. ) {
  881. uni.showToast({
  882. title: "请输入合格品数量",
  883. icon: "none",
  884. });
  885. return false;
  886. }
  887. // 预制体
  888. if (this.clientEnvironmentId == 3 || this.objData.singleReport !== 1) {
  889. if (
  890. this.objData.semiProductList.length > 0 &&
  891. this.taskType != 4 &&
  892. this.objData.singleReport == 1 &&
  893. type == 2
  894. ) {
  895. let bol;
  896. let _i;
  897. bol = this.objData.semiProductList.every((e, i) => {
  898. _i = i + 1;
  899. if (this.taskType == 6) {
  900. return e.extInfo.hasOwnProperty("taskId") && e.extInfo.taskId;
  901. } else {
  902. // if (e.extInfo.isQualified == 1 || e.extInfo.notType == 5) {
  903. // return e.extInfo.hasOwnProperty('taskId') && e.extInfo.taskId && e.extInfo
  904. // .reportWeight
  905. // } else {
  906. // return e.extInfo.hasOwnProperty('notType') && e.extInfo.notType
  907. // }
  908. return (
  909. e.extInfo.hasOwnProperty("taskId") &&
  910. e.extInfo.taskId &&
  911. e.extInfo.reportWeight
  912. );
  913. }
  914. });
  915. if (!bol) {
  916. uni.showToast({
  917. title: `请完善第${_i}处置方式`,
  918. icon: "none",
  919. });
  920. return false;
  921. }
  922. }
  923. }
  924. if (
  925. this.objData.productRecycleList.length > 0 &&
  926. this.clientEnvironmentId != 2
  927. ) {
  928. const isRecycle = await this.checkRecycle();
  929. if (!isRecycle) {
  930. return false;
  931. }
  932. }
  933. if (
  934. this.taskType == 4 &&
  935. this.clientEnvironmentId != 3 &&
  936. this.clientEnvironmentId != 2
  937. ) {
  938. const isPack = await this.checkPack();
  939. if (!isPack) {
  940. return false;
  941. }
  942. }
  943. //
  944. // console.log(this.objData.currentTaskDiagram.isFirstTask,'22222');
  945. // if (this.objData.currentTaskDiagram.isFirstTask == 0) { // isFirstTask 1是 判断是否首工序
  946. // const isFirstTask = await this.checkFirstTask()
  947. // if (!isFirstTask) {
  948. // return false
  949. // }
  950. // }
  951. if (this.taskType == 1) {
  952. const isCache = await this.checkCache(type);
  953. if (!isCache) {
  954. return false;
  955. }
  956. }
  957. if (
  958. this.clientEnvironmentId == 3 &&
  959. type == 2 &&
  960. this.taskType == 6 &&
  961. this.objData.singleReport == 0
  962. ) {
  963. this.objData.semiProductList = [];
  964. }
  965. if (this.clientEnvironmentId == 3 && this.taskType == 1) {
  966. if (
  967. this.objData &&
  968. this.objData.executorTime &&
  969. this.objData.executorTime != undefined
  970. ) {
  971. // 正则表达式1:匹配 yyyy-MM-dd 格式
  972. const dateRegex = /^\d{4}-\d{2}-\d{2}$/;
  973. if (dateRegex.test(this.objData.executorTime.trimRight())) {
  974. this.objData.workReportInfo["executorTime"] =
  975. this.objData.executorTime + " 00:00:00";
  976. } else {
  977. this.objData.workReportInfo["executorTime"] =
  978. this.objData.executorTime;
  979. }
  980. } else {
  981. uni.showToast({
  982. title: `请先选择实际报工时间`,
  983. icon: "none",
  984. });
  985. return false;
  986. }
  987. }
  988. if (this.objData.semiProductList.length > 0) {
  989. this.objData.semiProductList.map((ditem) => {
  990. let wdid = ditem.deviceId ? ditem.deviceId.split("/") : "";
  991. ditem.deviceId = wdid ? wdid[0] : "";
  992. if (ditem.extInfo.batchReportInfo) {
  993. ditem.extInfo.batchReportInfo.map((baItem) => {
  994. let idvalue = baItem.deviceId ? baItem.deviceId.split("/") : "";
  995. baItem.deviceId = idvalue ? idvalue[0] : "";
  996. });
  997. }
  998. if (ditem.extInfo.notBatchReportInfo) {
  999. ditem.extInfo.notBatchReportInfo.map((noItem) => {
  1000. let idvalue = noItem.deviceId ? noItem.deviceId.split("/") : "";
  1001. noItem.deviceId = idvalue ? idvalue[0] : "";
  1002. });
  1003. }
  1004. });
  1005. }
  1006. console.log(this.objData, "this.objData");
  1007. console.log(this.objData.equipmentList);
  1008. if (
  1009. this.objData.product.length != 0 &&
  1010. this.objData.equipmentList.length != 0
  1011. ) {
  1012. this.objData.product.forEach((item) => {
  1013. if (item.deviceId) {
  1014. this.objData.equipmentList.forEach((el) => {
  1015. if (item.deviceId == el.instanceId) {
  1016. item.deviceName = el.name;
  1017. }
  1018. });
  1019. }
  1020. });
  1021. }
  1022. jobSave(this.objData)
  1023. .then((res) => {
  1024. uni.hideLoading();
  1025. if (this.taskType == 4) {
  1026. uni.showModal({
  1027. title: "提示",
  1028. content: "打包完成是否去入库!",
  1029. confirmText: "确认", //这块是确定按钮的文字
  1030. success: (rr) => {
  1031. if (rr.confirm) {
  1032. uni.redirectTo({
  1033. url: `/pages/pda/warehousing/index?workOrderId=${this.id}&taskId=-1&workReportId=${res}&delta=-2`,
  1034. });
  1035. } else {
  1036. uni.navigateBack();
  1037. }
  1038. },
  1039. });
  1040. } else {
  1041. uni.navigateBack();
  1042. }
  1043. })
  1044. .finally(() => {
  1045. setTimeout(function () {
  1046. uni.hideLoading();
  1047. }, 3000);
  1048. });
  1049. },
  1050. checkRecycle() {
  1051. uni.hideLoading();
  1052. return new Promise((resolve) => {
  1053. uni.showModal({
  1054. title: "提示",
  1055. content: "是否跳过副产品回收处置!",
  1056. confirmText: "确认", //这块是确定按钮的文字
  1057. success: function (res) {
  1058. if (res.confirm) {
  1059. resolve(true);
  1060. } else {
  1061. resolve(false);
  1062. }
  1063. },
  1064. });
  1065. });
  1066. },
  1067. checkPack() {
  1068. uni.hideLoading();
  1069. return new Promise((resolve) => {
  1070. let packInfo = this.$refs.packRef.getData();
  1071. this.objData.packInfo = packInfo;
  1072. this.objData.taskType = this.taskType;
  1073. const formedNumLast = this.objData.product.reduce((acc, pro) => {
  1074. return pro.extInfo.sourceQuantity
  1075. ? acc + Number(pro.extInfo.sourceQuantity)
  1076. : acc;
  1077. }, 0);
  1078. if (
  1079. formedNumLast !=
  1080. Number(this.objData.workReportInfo["formedNum"]) +
  1081. Number(this.objData.notFormedList[0].notFormedNum)
  1082. ) {
  1083. uni.hideLoading();
  1084. uni.showModal({
  1085. title: "提示",
  1086. content: "合格品数量加不合格品数量不等于包装总数!",
  1087. confirmText: "确认", //这块是确定按钮的文字
  1088. success: function (res) {
  1089. if (res.confirm) {
  1090. resolve(true);
  1091. } else {
  1092. resolve(false);
  1093. }
  1094. },
  1095. });
  1096. } else {
  1097. resolve(true);
  1098. }
  1099. });
  1100. },
  1101. checkFirstTask() {
  1102. uni.hideLoading();
  1103. return new Promise((resolve) => {
  1104. if (
  1105. this.objData.formedNumLast !=
  1106. Number(this.objData.workReportInfo["formedNum"]) +
  1107. Number(this.objData.notFormedList[0].notFormedNum)
  1108. ) {
  1109. uni.showModal({
  1110. title: "提示",
  1111. content: "合格品数量加不合格品数量不等于上道工序数量!",
  1112. confirmText: "确认", //这块是确定按钮的文字
  1113. success: function (res) {
  1114. if (res.confirm) {
  1115. resolve(true);
  1116. } else {
  1117. resolve(false);
  1118. }
  1119. },
  1120. });
  1121. } else {
  1122. resolve(true);
  1123. }
  1124. });
  1125. },
  1126. checkCache(type) {
  1127. uni.hideLoading();
  1128. return new Promise((resolve) => {
  1129. if (type == 1) {
  1130. saveCache(this.objData).then((rr) => {
  1131. uni.showToast({
  1132. title: `已经缓存`,
  1133. icon: "none",
  1134. });
  1135. });
  1136. resolve(false);
  1137. } else if (type == 2) {
  1138. resolve(true);
  1139. }
  1140. });
  1141. },
  1142. removeCacheFn() {
  1143. uni.showModal({
  1144. title: "缓存",
  1145. content: "是否清空缓存!",
  1146. confirmText: "确认", //这块是确定按钮的文字
  1147. success: (rr) => {
  1148. if (rr.confirm) {
  1149. let parma = {
  1150. workOrderIds: [this.id],
  1151. taskId: this.taskId,
  1152. type: 1,
  1153. };
  1154. removeCache(parma).then((res) => {
  1155. this.getList();
  1156. });
  1157. }
  1158. },
  1159. });
  1160. },
  1161. getCacheFn() {
  1162. let parma = {
  1163. workOrderId: this.id,
  1164. taskId: this.taskId,
  1165. type: 1,
  1166. };
  1167. getCache(parma).then((res) => {
  1168. if (
  1169. !res ||
  1170. res.length < 0 ||
  1171. Object.getOwnPropertyNames(res).length === 0
  1172. ) {
  1173. return false;
  1174. }
  1175. this.objData["product"] = res.extInfo.product;
  1176. this.objData["workReportInfo"] = res.extInfo.workReportInfo;
  1177. this.objData["notFormedList"] = res.extInfo.notFormedList;
  1178. this.objData["turnover"] = res.extInfo.turnover;
  1179. this.objData["productRecycleList"] = res.extInfo.productRecycleList;
  1180. this.objData["semiProductList"] = res.extInfo.semiProductList;
  1181. this.objData["modelList"] = res.extInfo.modelList;
  1182. });
  1183. },
  1184. //批量报工合格不合格重量统计
  1185. countNumPl(list, index) {
  1186. console.log("11111122222333", list);
  1187. //合格总数
  1188. let formedNumCount = 0;
  1189. //合格总重量
  1190. let formedWeightCount = 0;
  1191. //不合格总数
  1192. let notFormedNumCount = 0;
  1193. //不合格总重量
  1194. let notFormedWeightCount = 0;
  1195. list.map((item) => {
  1196. //合格总数
  1197. item.extInfo.batchReportInfo.forEach((m) => {
  1198. formedNumCount = formedNumCount + Number(m.allFeedQuantity || 0);
  1199. });
  1200. //合格总重量
  1201. item.extInfo.batchReportInfo.forEach((w) => {
  1202. formedWeightCount =
  1203. formedWeightCount + Number(w.allReportWeight || 0);
  1204. });
  1205. //不合格总数
  1206. item.extInfo.notBatchReportInfo.forEach((nf) => {
  1207. notFormedNumCount =
  1208. notFormedNumCount + Number(nf.allFeedQuantity || 0);
  1209. });
  1210. //不合格总重量
  1211. item.extInfo.notBatchReportInfo.forEach((nw) => {
  1212. notFormedWeightCount =
  1213. notFormedWeightCount + Number(nw.allReportWeight || 0);
  1214. });
  1215. });
  1216. this.$set(this.objData.workReportInfo, "formedNum", formedNumCount); //合格总数
  1217. this.$set(this.objData.workReportInfo, "formedWeight", formedWeightCount); //合格总重量
  1218. this.$set(this.objData.workReportInfo, "notFormedNum", notFormedNumCount); //不合格总数
  1219. this.$set(
  1220. this.objData.workReportInfo,
  1221. "notFormedWeight",
  1222. notFormedWeightCount
  1223. ); //不合格总重量
  1224. this.$refs.jobReftg.formedTotal(
  1225. formedNumCount,
  1226. formedWeightCount,
  1227. notFormedNumCount,
  1228. notFormedWeightCount
  1229. );
  1230. this.$forceUpdate();
  1231. },
  1232. },
  1233. beforeDestroy() {
  1234. uni.hideLoading();
  1235. },
  1236. };
  1237. </script>
  1238. <style lang="scss" scoped>
  1239. .content-box {
  1240. height: 100vh;
  1241. overflow: hidden;
  1242. display: flex;
  1243. flex-direction: column;
  1244. }
  1245. .list_box {
  1246. flex: 1;
  1247. overflow: hidden;
  1248. padding: 4rpx 0;
  1249. .u-list {
  1250. height: 100% !important;
  1251. }
  1252. .card_box {
  1253. padding: 16rpx 20rpx;
  1254. }
  1255. }
  1256. .bottom-wrapper {
  1257. width: 100%;
  1258. display: flex;
  1259. align-items: center;
  1260. justify-content: space-around;
  1261. .btn_box {
  1262. width: 50%;
  1263. height: 88rpx;
  1264. line-height: 88rpx;
  1265. background: $theme-color;
  1266. text-align: center;
  1267. font-size: 36rpx;
  1268. font-style: normal;
  1269. font-weight: 400;
  1270. color: #fff;
  1271. &:first-child {
  1272. border-right: 2rpx solid #fff;
  1273. }
  1274. }
  1275. }
  1276. .operate_box {
  1277. padding: 10rpx 160rpx;
  1278. /deep/ .u-button {
  1279. width: 160rpx;
  1280. }
  1281. }
  1282. .search_list {
  1283. min-height: 500rpx;
  1284. padding: 0 32rpx;
  1285. }
  1286. .search_list2 {
  1287. min-height: 120rpx;
  1288. padding: 0 32rpx;
  1289. }
  1290. .flex_btn {
  1291. position: fixed;
  1292. right: 0;
  1293. bottom: 160rpx;
  1294. width: 40rpx;
  1295. height: 50rpx;
  1296. line-height: 66rpx;
  1297. border-radius: 22rpx 0 0 22rpx;
  1298. background: $theme-color;
  1299. text-align: center;
  1300. font-size: 22rpx;
  1301. font-style: normal;
  1302. font-weight: 400;
  1303. color: #fff;
  1304. opacity: 0.6;
  1305. .jiantou {
  1306. width: 30rpx;
  1307. height: 30rpx;
  1308. }
  1309. }
  1310. .flex_btn2 {
  1311. position: fixed;
  1312. right: 0;
  1313. bottom: 160rpx;
  1314. width: 126rpx;
  1315. min-height: 140rpx;
  1316. line-height: 62rpx;
  1317. border-radius: 22rpx 0 0 22rpx;
  1318. background: $theme-color;
  1319. text-align: center;
  1320. font-size: 22rpx;
  1321. font-style: normal;
  1322. font-weight: 400;
  1323. color: #fff;
  1324. opacity: 0.7;
  1325. .close_box {
  1326. height: 50rpx;
  1327. line-height: 50rpx;
  1328. width: 126rpx;
  1329. text-align: left;
  1330. .close {
  1331. width: 40rpx;
  1332. height: 40rpx;
  1333. padding: 6rpx 10rpx;
  1334. }
  1335. }
  1336. }
  1337. </style>