index.vue 40 KB

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