index.vue 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496
  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. const number = this.objData.product.reduce((acc, pro) => {
  748. return pro.feedQuantity ? acc + Number(pro.feedQuantity) : acc;
  749. }, 0);
  750. this.objData.workReportInfo.formedNum = number;
  751. }
  752. this.objData.workReportInfo.formingNum = res.formingNum;
  753. this.objData.workReportInfo.formingWeight = res.formingWeight;
  754. this.objData.workReportInfo.unit = res.unit;
  755. this.objData.workReportInfo.weightUnit = res.weightUnit;
  756. this.objData.workReportInfo.workOrderId = res.workOrderId;
  757. this.paramDetailList = res.paramDetailList;
  758. // this.paramDetailList = res.paramDetailList.map((m) => {
  759. // if (m.extInfo.textType == 5) {
  760. // this.remainingTime = m.extInfo.remainingTime;
  761. // }
  762. // return {
  763. // ...m.extInfo,
  764. // };
  765. // });
  766. })
  767. .finally(() => {
  768. this.isLoad = true;
  769. if (this.taskType == 1) {
  770. this.getCacheFn();
  771. }
  772. });
  773. },
  774. scrolltolower() {},
  775. handAdd() {
  776. const storageKey = Date.now() + "";
  777. uni.setStorageSync(storageKey, this.objData || {});
  778. uni.navigateTo({
  779. url: `/pages/pda/workOrder/search/index?storageKey=${storageKey}&isType=job&taskId=${this.taskId}`,
  780. });
  781. },
  782. penalize(index) {
  783. if (index || index == 0) {
  784. console.log(index, "----");
  785. this.penalizeIndex = index;
  786. this.formData.warehouseId =
  787. this.objData.productRecycleList[this.penalizeIndex].warehouseId || "";
  788. } else {
  789. this.penalizeIndex = null;
  790. this.formData.warehouseId =
  791. this.objData.notFormedList[0].warehouseId || "";
  792. console.log(this.formData.warehouseId, "+++++");
  793. }
  794. this.$forceUpdate();
  795. if (this.warehouseList.length == 0) {
  796. getWarehouseList().then((res) => {
  797. this.warehouseList = res;
  798. this.searchShow = true;
  799. });
  800. } else {
  801. this.searchShow = true;
  802. }
  803. },
  804. inputChange(e) {
  805. console.log(e);
  806. },
  807. searchCancel() {
  808. this.searchShow = false;
  809. },
  810. popupOk() {
  811. if (this.penalizeIndex == null) {
  812. this.$set(
  813. this.objData.notFormedList[0],
  814. "warehouseId",
  815. this.formData.warehouseId || null
  816. );
  817. } else {
  818. this.objData.productRecycleList[this.penalizeIndex].warehouseId =
  819. this.formData.warehouseId;
  820. }
  821. this.$forceUpdate();
  822. this.searchShow = false;
  823. },
  824. modeNum(num) {
  825. console.log(num, "------------", this.objData.modelList.length);
  826. if (this.objData.modelList.length == 0) {
  827. return false;
  828. }
  829. console.log(num);
  830. this.$refs.modelRef.setNum(num);
  831. },
  832. async save(type) {
  833. // 验证判断条件
  834. this.$isJobExls(1, this.objData);
  835. // console.log(this.objData, "this.objData");
  836. // return;
  837. // for (let i = 0; i < this.List.length; i++) {
  838. // if (
  839. // !this.List[i].executorTime &&
  840. // this.List[i].executorTime == undefined
  841. // ) {
  842. // uni.showToast({
  843. // title: `请先选择报工时间`,
  844. // icon: "none",
  845. // });
  846. // return;
  847. // }
  848. // }
  849. if (!(this.clientEnvironmentId == 3 || this.objData.singleReport !== 1)) {
  850. if (this.objData.semiProductList.length) {
  851. let arr = this.objData.semiProductList.filter(
  852. (v) => v.selected == true
  853. );
  854. this.objData.semiProductList = arr;
  855. if (!arr.length) {
  856. return uni.showToast({
  857. title: "请选择报工数量",
  858. icon: "none",
  859. });
  860. }
  861. // else{
  862. // let engraveList = arr.filter(v=> v.extInfo.engrave ==null);
  863. // if(engraveList.length){
  864. // return uni.showToast({
  865. // title: '请输入刻码',
  866. // icon: 'none'
  867. // })
  868. // }
  869. // }
  870. }
  871. }
  872. uni.showLoading({
  873. title: "加载中",
  874. });
  875. if (
  876. !this.objData.workReportInfo["formedNum"] &&
  877. this.objData.workReportInfo["formedNum"] != 0
  878. ) {
  879. uni.showToast({
  880. title: "请输入合格品数量",
  881. icon: "none",
  882. });
  883. return false;
  884. }
  885. // 预制体
  886. if (this.clientEnvironmentId == 3 || this.objData.singleReport !== 1) {
  887. if (
  888. this.objData.semiProductList.length > 0 &&
  889. this.taskType != 4 &&
  890. this.objData.singleReport == 1 &&
  891. type == 2
  892. ) {
  893. let bol;
  894. let _i;
  895. bol = this.objData.semiProductList.every((e, i) => {
  896. _i = i + 1;
  897. if (this.taskType == 6) {
  898. return e.extInfo.hasOwnProperty("taskId") && e.extInfo.taskId;
  899. } else {
  900. // if (e.extInfo.isQualified == 1 || e.extInfo.notType == 5) {
  901. // return e.extInfo.hasOwnProperty('taskId') && e.extInfo.taskId && e.extInfo
  902. // .reportWeight
  903. // } else {
  904. // return e.extInfo.hasOwnProperty('notType') && e.extInfo.notType
  905. // }
  906. return (
  907. e.extInfo.hasOwnProperty("taskId") &&
  908. e.extInfo.taskId &&
  909. e.extInfo.reportWeight
  910. );
  911. }
  912. });
  913. if (!bol) {
  914. uni.showToast({
  915. title: `请完善第${_i}处置方式`,
  916. icon: "none",
  917. });
  918. return false;
  919. }
  920. }
  921. }
  922. if (
  923. this.objData.productRecycleList.length > 0 &&
  924. this.clientEnvironmentId != 2
  925. ) {
  926. const isRecycle = await this.checkRecycle();
  927. if (!isRecycle) {
  928. return false;
  929. }
  930. }
  931. if (
  932. this.taskType == 4 &&
  933. this.clientEnvironmentId != 3 &&
  934. this.clientEnvironmentId != 2
  935. ) {
  936. const isPack = await this.checkPack();
  937. if (!isPack) {
  938. return false;
  939. }
  940. }
  941. //
  942. // console.log(this.objData.currentTaskDiagram.isFirstTask,'22222');
  943. // if (this.objData.currentTaskDiagram.isFirstTask == 0) { // isFirstTask 1是 判断是否首工序
  944. // const isFirstTask = await this.checkFirstTask()
  945. // if (!isFirstTask) {
  946. // return false
  947. // }
  948. // }
  949. if (this.taskType == 1) {
  950. const isCache = await this.checkCache(type);
  951. if (!isCache) {
  952. return false;
  953. }
  954. }
  955. if (
  956. this.clientEnvironmentId == 3 &&
  957. type == 2 &&
  958. this.taskType == 6 &&
  959. this.objData.singleReport == 0
  960. ) {
  961. this.objData.semiProductList = [];
  962. }
  963. if (this.clientEnvironmentId == 3 && this.taskType == 1) {
  964. if (
  965. this.objData &&
  966. this.objData.executorTime &&
  967. this.objData.executorTime != undefined
  968. ) {
  969. // 正则表达式1:匹配 yyyy-MM-dd 格式
  970. const dateRegex = /^\d{4}-\d{2}-\d{2}$/;
  971. if (dateRegex.test(this.objData.executorTime.trimRight())) {
  972. this.objData.workReportInfo["executorTime"] =
  973. this.objData.executorTime + " 00:00:00";
  974. } else {
  975. this.objData.workReportInfo["executorTime"] =
  976. this.objData.executorTime;
  977. }
  978. } else {
  979. uni.showToast({
  980. title: `请先选择实际报工时间`,
  981. icon: "none",
  982. });
  983. return false;
  984. }
  985. }
  986. if (this.objData.semiProductList.length > 0) {
  987. this.objData.semiProductList.map((ditem) => {
  988. let wdid = ditem.deviceId ? ditem.deviceId.split("/") : "";
  989. ditem.deviceId = wdid ? wdid[0] : "";
  990. if (ditem.extInfo.batchReportInfo) {
  991. ditem.extInfo.batchReportInfo.map((baItem) => {
  992. let idvalue = baItem.deviceId ? baItem.deviceId.split("/") : "";
  993. baItem.deviceId = idvalue ? idvalue[0] : "";
  994. });
  995. }
  996. if (ditem.extInfo.notBatchReportInfo) {
  997. ditem.extInfo.notBatchReportInfo.map((noItem) => {
  998. let idvalue = noItem.deviceId ? noItem.deviceId.split("/") : "";
  999. noItem.deviceId = idvalue ? idvalue[0] : "";
  1000. });
  1001. }
  1002. });
  1003. }
  1004. console.log(this.objData, "this.objData");
  1005. console.log(this.objData.equipmentList);
  1006. if (
  1007. this.objData.product.length != 0 &&
  1008. this.objData.equipmentList.length != 0
  1009. ) {
  1010. this.objData.product.forEach((item) => {
  1011. if (item.deviceId) {
  1012. this.objData.equipmentList.forEach((el) => {
  1013. if (item.deviceId == el.instanceId) {
  1014. item.deviceName = el.name;
  1015. }
  1016. });
  1017. }
  1018. });
  1019. }
  1020. jobSave(this.objData)
  1021. .then((res) => {
  1022. uni.hideLoading();
  1023. if (this.taskType == 4) {
  1024. uni.showModal({
  1025. title: "提示",
  1026. content: "打包完成是否去入库!",
  1027. confirmText: "确认", //这块是确定按钮的文字
  1028. success: (rr) => {
  1029. if (rr.confirm) {
  1030. uni.redirectTo({
  1031. url: `/pages/pda/warehousing/index?workOrderId=${this.id}&taskId=-1&workReportId=${res}&delta=-2`,
  1032. });
  1033. } else {
  1034. uni.navigateBack();
  1035. }
  1036. },
  1037. });
  1038. } else {
  1039. uni.navigateBack();
  1040. }
  1041. })
  1042. .finally(() => {
  1043. setTimeout(function () {
  1044. uni.hideLoading();
  1045. }, 3000);
  1046. });
  1047. },
  1048. checkRecycle() {
  1049. uni.hideLoading();
  1050. return new Promise((resolve) => {
  1051. uni.showModal({
  1052. title: "提示",
  1053. content: "是否跳过副产品回收处置!",
  1054. confirmText: "确认", //这块是确定按钮的文字
  1055. success: function (res) {
  1056. if (res.confirm) {
  1057. resolve(true);
  1058. } else {
  1059. resolve(false);
  1060. }
  1061. },
  1062. });
  1063. });
  1064. },
  1065. checkPack() {
  1066. uni.hideLoading();
  1067. return new Promise((resolve) => {
  1068. let packInfo = this.$refs.packRef.getData();
  1069. this.objData.packInfo = packInfo;
  1070. this.objData.taskType = this.taskType;
  1071. const formedNumLast = this.objData.product.reduce((acc, pro) => {
  1072. return pro.extInfo.sourceQuantity
  1073. ? acc + Number(pro.extInfo.sourceQuantity)
  1074. : acc;
  1075. }, 0);
  1076. if (
  1077. formedNumLast !=
  1078. Number(this.objData.workReportInfo["formedNum"]) +
  1079. Number(this.objData.notFormedList[0].notFormedNum)
  1080. ) {
  1081. uni.hideLoading();
  1082. uni.showModal({
  1083. title: "提示",
  1084. content: "合格品数量加不合格品数量不等于包装总数!",
  1085. confirmText: "确认", //这块是确定按钮的文字
  1086. success: function (res) {
  1087. if (res.confirm) {
  1088. resolve(true);
  1089. } else {
  1090. resolve(false);
  1091. }
  1092. },
  1093. });
  1094. } else {
  1095. resolve(true);
  1096. }
  1097. });
  1098. },
  1099. checkFirstTask() {
  1100. uni.hideLoading();
  1101. return new Promise((resolve) => {
  1102. if (
  1103. this.objData.formedNumLast !=
  1104. Number(this.objData.workReportInfo["formedNum"]) +
  1105. Number(this.objData.notFormedList[0].notFormedNum)
  1106. ) {
  1107. uni.showModal({
  1108. title: "提示",
  1109. content: "合格品数量加不合格品数量不等于上道工序数量!",
  1110. confirmText: "确认", //这块是确定按钮的文字
  1111. success: function (res) {
  1112. if (res.confirm) {
  1113. resolve(true);
  1114. } else {
  1115. resolve(false);
  1116. }
  1117. },
  1118. });
  1119. } else {
  1120. resolve(true);
  1121. }
  1122. });
  1123. },
  1124. checkCache(type) {
  1125. uni.hideLoading();
  1126. return new Promise((resolve) => {
  1127. if (type == 1) {
  1128. saveCache(this.objData).then((rr) => {
  1129. uni.showToast({
  1130. title: `已经缓存`,
  1131. icon: "none",
  1132. });
  1133. });
  1134. resolve(false);
  1135. } else if (type == 2) {
  1136. resolve(true);
  1137. }
  1138. });
  1139. },
  1140. removeCacheFn() {
  1141. uni.showModal({
  1142. title: "缓存",
  1143. content: "是否清空缓存!",
  1144. confirmText: "确认", //这块是确定按钮的文字
  1145. success: (rr) => {
  1146. if (rr.confirm) {
  1147. let parma = {
  1148. workOrderIds: [this.id],
  1149. taskId: this.taskId,
  1150. type: 1,
  1151. };
  1152. removeCache(parma).then((res) => {
  1153. this.getList();
  1154. });
  1155. }
  1156. },
  1157. });
  1158. },
  1159. getCacheFn() {
  1160. let parma = {
  1161. workOrderId: this.id,
  1162. taskId: this.taskId,
  1163. type: 1,
  1164. };
  1165. getCache(parma).then((res) => {
  1166. if (
  1167. !res ||
  1168. res.length < 0 ||
  1169. Object.getOwnPropertyNames(res).length === 0
  1170. ) {
  1171. return false;
  1172. }
  1173. this.objData["product"] = res.extInfo.product;
  1174. this.objData["workReportInfo"] = res.extInfo.workReportInfo;
  1175. this.objData["notFormedList"] = res.extInfo.notFormedList;
  1176. this.objData["turnover"] = res.extInfo.turnover;
  1177. this.objData["productRecycleList"] = res.extInfo.productRecycleList;
  1178. this.objData["semiProductList"] = res.extInfo.semiProductList;
  1179. this.objData["modelList"] = res.extInfo.modelList;
  1180. });
  1181. },
  1182. //批量报工合格不合格重量统计
  1183. countNumPl(list, index) {
  1184. console.log("11111122222333", list);
  1185. //合格总数
  1186. let formedNumCount = 0;
  1187. //合格总重量
  1188. let formedWeightCount = 0;
  1189. //不合格总数
  1190. let notFormedNumCount = 0;
  1191. //不合格总重量
  1192. let notFormedWeightCount = 0;
  1193. list.map((item) => {
  1194. //合格总数
  1195. item.extInfo.batchReportInfo.forEach((m) => {
  1196. formedNumCount = formedNumCount + Number(m.allFeedQuantity || 0);
  1197. });
  1198. //合格总重量
  1199. item.extInfo.batchReportInfo.forEach((w) => {
  1200. formedWeightCount =
  1201. formedWeightCount + Number(w.allReportWeight || 0);
  1202. });
  1203. //不合格总数
  1204. item.extInfo.notBatchReportInfo.forEach((nf) => {
  1205. notFormedNumCount =
  1206. notFormedNumCount + Number(nf.allFeedQuantity || 0);
  1207. });
  1208. //不合格总重量
  1209. item.extInfo.notBatchReportInfo.forEach((nw) => {
  1210. notFormedWeightCount =
  1211. notFormedWeightCount + Number(nw.allReportWeight || 0);
  1212. });
  1213. });
  1214. this.$set(this.objData.workReportInfo, "formedNum", formedNumCount); //合格总数
  1215. this.$set(this.objData.workReportInfo, "formedWeight", formedWeightCount); //合格总重量
  1216. this.$set(this.objData.workReportInfo, "notFormedNum", notFormedNumCount); //不合格总数
  1217. this.$set(
  1218. this.objData.workReportInfo,
  1219. "notFormedWeight",
  1220. notFormedWeightCount
  1221. ); //不合格总重量
  1222. this.$refs.jobReftg.formedTotal(
  1223. formedNumCount,
  1224. formedWeightCount,
  1225. notFormedNumCount,
  1226. notFormedWeightCount
  1227. );
  1228. this.$forceUpdate();
  1229. },
  1230. },
  1231. beforeDestroy() {
  1232. uni.hideLoading();
  1233. },
  1234. };
  1235. </script>
  1236. <style lang="scss" scoped>
  1237. .content-box {
  1238. height: 100vh;
  1239. overflow: hidden;
  1240. display: flex;
  1241. flex-direction: column;
  1242. }
  1243. .list_box {
  1244. flex: 1;
  1245. overflow: hidden;
  1246. padding: 4rpx 0;
  1247. .u-list {
  1248. height: 100% !important;
  1249. }
  1250. .card_box {
  1251. padding: 16rpx 20rpx;
  1252. }
  1253. }
  1254. .bottom-wrapper {
  1255. width: 100%;
  1256. display: flex;
  1257. align-items: center;
  1258. justify-content: space-around;
  1259. .btn_box {
  1260. width: 50%;
  1261. height: 88rpx;
  1262. line-height: 88rpx;
  1263. background: $theme-color;
  1264. text-align: center;
  1265. font-size: 36rpx;
  1266. font-style: normal;
  1267. font-weight: 400;
  1268. color: #fff;
  1269. &:first-child {
  1270. border-right: 2rpx solid #fff;
  1271. }
  1272. }
  1273. }
  1274. .operate_box {
  1275. padding: 10rpx 160rpx;
  1276. /deep/ .u-button {
  1277. width: 160rpx;
  1278. }
  1279. }
  1280. .search_list {
  1281. min-height: 500rpx;
  1282. padding: 0 32rpx;
  1283. }
  1284. .search_list2 {
  1285. min-height: 120rpx;
  1286. padding: 0 32rpx;
  1287. }
  1288. .flex_btn {
  1289. position: fixed;
  1290. right: 0;
  1291. bottom: 160rpx;
  1292. width: 40rpx;
  1293. height: 50rpx;
  1294. line-height: 66rpx;
  1295. border-radius: 22rpx 0 0 22rpx;
  1296. background: $theme-color;
  1297. text-align: center;
  1298. font-size: 22rpx;
  1299. font-style: normal;
  1300. font-weight: 400;
  1301. color: #fff;
  1302. opacity: 0.6;
  1303. .jiantou {
  1304. width: 30rpx;
  1305. height: 30rpx;
  1306. }
  1307. }
  1308. .flex_btn2 {
  1309. position: fixed;
  1310. right: 0;
  1311. bottom: 160rpx;
  1312. width: 126rpx;
  1313. min-height: 140rpx;
  1314. line-height: 62rpx;
  1315. border-radius: 22rpx 0 0 22rpx;
  1316. background: $theme-color;
  1317. text-align: center;
  1318. font-size: 22rpx;
  1319. font-style: normal;
  1320. font-weight: 400;
  1321. color: #fff;
  1322. opacity: 0.7;
  1323. .close_box {
  1324. height: 50rpx;
  1325. line-height: 50rpx;
  1326. width: 126rpx;
  1327. text-align: left;
  1328. .close {
  1329. width: 40rpx;
  1330. height: 40rpx;
  1331. padding: 6rpx 10rpx;
  1332. }
  1333. }
  1334. }
  1335. </style>