index.vue 25 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165
  1. <template>
  2. <!-- 报工页面 -->
  3. <view class="content-box">
  4. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" :title="title" background-color="#F7F9FA"
  5. color="#000" @clickLeft="back" right-icon="scan" @clickRight="HandlScanCode">
  6. </uni-nav-bar>
  7. <view class="list_box">
  8. <u-list @scrolltolower="scrolltolower">
  9. <view class="card_box">
  10. <!-- 工单信息 objData 报告信息-->
  11. <workOrderBom :item='objData' pType="job" v-if='objData' :taskType="taskType"
  12. @handleScan='handleScan'></workOrderBom>
  13. <paramBom v-if='paramDetailList.length != 0' :list='paramDetailList'></paramBom>
  14. <!-- 设备信息 -->
  15. <deviceBom v-if='objData.equipmentList.length != 0' :list='objData.equipmentList' :ishuoWei="false"
  16. :wordItem='objData' :isDetails='true'>
  17. </deviceBom>
  18. <modelBom v-if='objData.modelList.length != 0' :list='objData.modelList' pattern='job'
  19. ref='modelRef'>
  20. </modelBom>
  21. <!-- 报工信息 -->
  22. <jobBom v-if='isLoad' :item='objData' ref='jobRef' :notFormed='objData.notFormedList'
  23. @penalize='penalize' @modeNum='modeNum'></jobBom>
  24. <palletBom v-if="objData.palletList.length != 0" :palletList='objData.palletList'></palletBom>
  25. <revolvingDiskBom v-if="isLoad && objData.revolvingDiskList.length > 0" pattern='job'
  26. :revolvingDiskList="objData.revolvingDiskList"></revolvingDiskBom>
  27. <!-- <oneJobBom
  28. v-if='objData.instanceList && objData.instanceList.length != 0 && taskType != 4 && taskType != 6'
  29. :item='objData' :list='objData.instanceList'>
  30. </oneJobBom> -->
  31. <semiProductJobBom
  32. v-if='objData.semiProductList && objData.semiProductList.length != 0 && taskType != 4 && taskType != 6 && objData.singleReport == 1'
  33. :item='objData' :list='objData.semiProductList' :equipmentList="objData.equipmentList">
  34. </semiProductJobBom>
  35. <semiProductJobBomPL
  36. v-if='objData.semiProductList && objData.semiProductList.length != 0 && taskType != 4 && taskType != 6 && objData.singleReport == 0'
  37. :item='objData' :list='objData.semiProductList' :equipmentList="objData.equipmentList">
  38. </semiProductJobBomPL>
  39. <oneJobQualityBom
  40. v-if='objData.semiProductList && objData.semiProductList.length != 0 && taskType == 6 && clientEnvironmentId == 3 && objData.singleReport == 1'
  41. :item='objData' :list='objData.semiProductList'></oneJobQualityBom>
  42. <oneJobQualityBomPL
  43. v-if='objData.semiProductList && objData.semiProductList.length != 0 && taskType == 6 && clientEnvironmentId == 3 && objData.singleReport == 0'
  44. :item='objData' :list='objData.semiProductList'></oneJobQualityBomPL>
  45. <!-- 副产品 -->
  46. <byProductBom v-if='objData.productRecycleList.length != 0' :list='objData.productRecycleList'
  47. @penalize='penalize'>
  48. </byProductBom>
  49. <!-- 周转车 -->
  50. <turnoverBom v-if='objData.turnover.length != 0' :list='objData.turnover' :itemValue='objData'
  51. :wordItem='objData' pattern='job' @handleScan='handleScan' @formedNumFn='formedNumFn'>
  52. </turnoverBom>
  53. <!-- // 区域扫码 -->
  54. <aridRegion v-if='objData.aridRegionList.length != 0' :list='objData.aridRegionList'
  55. :remainingTime='remainingTime' @handleScan='handleScan' :isType='true'></aridRegion>
  56. <!-- //包装扫码 -->
  57. <view v-if="clientEnvironmentId != 2">
  58. <packingBom :taskId='taskId' :workOrderId='id' :objData='objData' ref="packRef"
  59. v-if='taskType == 4 && clientEnvironmentId != 3 && objData' :categoryId="categoryId"></packingBom>
  60. </view>
  61. <packingTgBom
  62. v-if='objData.pickOutInList && objData.pickOutInList.length != 0 && taskType == 4 && clientEnvironmentId == 3'
  63. :list='objData.pickOutInList' :item='objData' ></packingTgBom>
  64. <view class="operate_box rx-sc">
  65. <u-button size="small" class="u-reset-button" type="success" @click="handAdd">手动添加</u-button>
  66. </view>
  67. <view style="height: 100rpx;"></view>
  68. </view>
  69. </u-list>
  70. </view>
  71. <view :class="[operateBtn ? 'flex_btn' : 'flex_btn2']">
  72. <image v-if="operateBtn" class="jiantou" src="../../../../static/rightJt.png" @click="operateBtn = false">
  73. </image>
  74. <view class="close_box" @click="operateBtn = true">
  75. <image v-if="!operateBtn" class="close" src="../../../../static/close.png"></image>
  76. </view>
  77. <view v-if="!operateBtn" @click="removeCacheFn()">清空缓存</view>
  78. <view v-if="!operateBtn" @click="switchOrder = true">切换工单</view>
  79. </view>
  80. <view class="bottom-wrapper">
  81. <view class="btn_box" @click="save(1)">缓存</view>
  82. <view class="btn_box" @click="save(2)">一键报工</view>
  83. </view>
  84. <SearchPopup mode="bottom" v-if='searchShow'>
  85. <template v-slot:list>
  86. <view class="search_list">
  87. <u-form labelPosition="left" :model="formData" labelWidth="180" labelAlign="left" class="baseForm">
  88. <u-form-item label="仓库:" class="required-form" borderBottom prop="warehouseId">
  89. <zxz-uni-data-select :localdata="warehouseList" v-model="formData.warehouseId"
  90. dataValue='id' dataKey="name" filterable format='{name}'></zxz-uni-data-select>
  91. </u-form-item>
  92. </u-form>
  93. </view>
  94. </template>
  95. <template v-slot:operate>
  96. <view class="operate_box rx-bc">
  97. <u-button size="small" class="u-reset-button" @click="searchCancel">
  98. 取消
  99. </u-button>
  100. <u-button type="success" size="small" class="u-reset-button" @click="popupOk">
  101. 确定
  102. </u-button>
  103. </view>
  104. </template>
  105. </SearchPopup>
  106. <SearchPopup mode="center" v-if='switchOrder'>
  107. <template v-slot:list>
  108. <view class="search_list2">
  109. <u-form labelPosition="left" :model="formData" labelWidth="180" labelAlign="left" class="baseForm">
  110. <u-form-item label="工单:" class="required-form" borderBottom prop="warehouseId">
  111. <zxz-uni-data-select :localdata="warehouseList" v-model="formData.warehouseId"
  112. dataValue='id' dataKey="name" filterable format='{name}'></zxz-uni-data-select>
  113. </u-form-item>
  114. </u-form>
  115. </view>
  116. </template>
  117. <template v-slot:operate>
  118. <view class="operate_box rx-bc">
  119. <u-button size="small" class="u-reset-button" @click="switchOrder = false">
  120. 取消
  121. </u-button>
  122. <u-button type="success" size="small" class="u-reset-button">
  123. 确定
  124. </u-button>
  125. </view>
  126. </template>
  127. </SearchPopup>
  128. </view>
  129. </template>
  130. <script>
  131. import {
  132. getByIdReport,
  133. outSourceGetByIdReport,
  134. getByCodeReport,
  135. jobSave
  136. } from '@/api/pda/jobBooking.js'
  137. import {
  138. scanLedger,
  139. getWarehouseList,
  140. saveCache,
  141. getCache,
  142. removeCache
  143. } from '@/api/pda/workOrder.js'
  144. import workOrderBom from '../../feeding/components/workOrderBom.vue'
  145. import deviceBom from '../../feeding/components/deviceBom.vue'
  146. import modelBom from '../../feeding/components/modelBom.vue'
  147. import jobBom from '../components/jobBom.vue'
  148. import palletBom from '../components/palletBom.vue'
  149. import oneJobBom from '../components/oneJobBom.vue'
  150. import semiProductJobBom from '../components/semiProductJobBom.vue'
  151. import semiProductJobBomPL from '../components/semiProductJobBomPL.vue'
  152. import byProductBom from '../components/byProductBom'
  153. import turnoverBom from '../components/turnoverBom.vue'
  154. import aridRegion from '../../feeding/components/aridRegion.vue'
  155. import paramBom from '../../feeding/components/paramBom.vue'
  156. import packingBom from '../components/packingBom.vue'
  157. import packingTgBom from '../components/packingTgBom'
  158. import revolvingDiskBom from '../../feeding/components/revolvingDiskBom.vue'
  159. import SearchPopup from '../../components/searchPopup.vue'
  160. import oneJobQualityBom from '../components/oneJobQualityBom.vue'
  161. import oneJobQualityBomPL from '../components/oneJobQualityBomPL.vue'
  162. export default {
  163. components: {
  164. workOrderBom,
  165. deviceBom,
  166. modelBom,
  167. jobBom,
  168. palletBom,
  169. oneJobBom,
  170. semiProductJobBom,
  171. semiProductJobBomPL,
  172. byProductBom,
  173. turnoverBom,
  174. aridRegion,
  175. paramBom,
  176. packingBom,
  177. packingTgBom,
  178. revolvingDiskBom,
  179. SearchPopup,
  180. oneJobQualityBom,
  181. oneJobQualityBomPL
  182. },
  183. data() {
  184. return {
  185. title: '',
  186. taskType: 1,
  187. isLoad: true,
  188. categoryId:'',
  189. objData: {
  190. equipmentList: [],
  191. modelList: [],
  192. turnover: [],
  193. productRecycleList: [],
  194. aridRegionList: [],
  195. palletList: [],
  196. workReportInfo: {
  197. },
  198. notFormedList: [], // 报工-不合格
  199. },
  200. searchShow: false,
  201. switchOrder: false,
  202. warehouseList: [],
  203. formData: {
  204. warehouseId: ''
  205. },
  206. penalizeIndex: null,
  207. paramDetailList: [],
  208. remainingTime: 0,
  209. id: null,
  210. taskId: null,
  211. clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo")
  212. .clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  213. operateBtn: true,
  214. isOutsource: 0,
  215. }
  216. },
  217. onLoad(options) {
  218. console.log('1111111110',options);
  219. this.title = options.taskName ? options.taskName + '-报工' : '报工'
  220. this.taskType = options.taskType
  221. this.id = options.id
  222. this.taskId = options.taskId
  223. this.isOutsource = options.isOutsource
  224. this.categoryId = options.categoryId
  225. this.getList()
  226. },
  227. onShow() {
  228. uni.$off("setSelectList");
  229. uni.$on("setSelectList", (selectList, id) => {
  230. let turnover = []
  231. let equipmentList = [] // 生产设备
  232. let isEquipment = this.objData.equipmentList.length > 0 ? true : false // 判断是否有设置
  233. selectList.forEach(f => {
  234. if (f.rootCategoryLevelId == 4) { // 生产设备
  235. if (isEquipment) {
  236. equipmentList = this.objData.equipmentList
  237. } else {
  238. equipmentList = equipmentList.concat(f)
  239. }
  240. }
  241. if (f.rootCategoryLevelId == 7) { // 周转车
  242. turnover = turnover.concat(f)
  243. }
  244. })
  245. this.$set(this.objData, 'equipmentList', equipmentList)
  246. this.$set(this.objData, 'turnover', turnover)
  247. this.$forceUpdate()
  248. });
  249. },
  250. methods: {
  251. // 相机扫码
  252. HandlScanCode() {
  253. uni.scanCode({
  254. success: (res) => {
  255. this.scanItAllData(res.result)
  256. }
  257. })
  258. },
  259. scanItAllData(result) {
  260. scanLedger(result).then(res => {
  261. if (res[0].rootCategoryLevelId == 4) { // 设备
  262. let isFals = this.objData.equipmentList.some(m => m.code == result)
  263. if (isFals) {
  264. uni.showToast({
  265. title: '设备已存在',
  266. icon: 'none'
  267. })
  268. return false
  269. }
  270. this.objData.equipmentList.push(res[0])
  271. this.$forceUpdate()
  272. }
  273. if (res.length >= 1 && res[0].rootCategoryLevelId == 5) { // 磨具
  274. if (this.objData.modelList.length == 0) {
  275. this.objData.modelList = res
  276. this.$forceUpdate()
  277. } else {
  278. if (this.objData.modelList[0].instanceId != res[0].instanceId) {
  279. uni.showToast({
  280. title: '模具不匹配',
  281. icon: 'none'
  282. })
  283. } else {
  284. uni.showToast({
  285. title: '设备匹配成功',
  286. icon: 'none'
  287. })
  288. }
  289. }
  290. } else if (res.length == 1 && res[0].rootCategoryLevelId == 7) { // 周转车
  291. let isFals = this.objData.turnover.some(m => m.code == result)
  292. if (isFals) {
  293. uni.showToast({
  294. title: '周转车已存在',
  295. icon: 'none'
  296. })
  297. return false
  298. }
  299. this.objData.turnover.push(res[0])
  300. this.$forceUpdate()
  301. }
  302. })
  303. },
  304. handleScan(id, type) {
  305. uni.scanCode({
  306. success: (res) => {
  307. this.scanData(res.result, type, id)
  308. }
  309. })
  310. },
  311. scanData(result, type, id) {
  312. if (type == 'wordOrder') {
  313. getByCodeReport(result, this.taskId).then(res => {
  314. this.objData = res
  315. if (!this.objData.hasOwnProperty('turnover')) {
  316. this.objData['turnover'] = []
  317. }
  318. if (!this.objData.hasOwnProperty('aridRegionList')) {
  319. this.objData['aridRegionList'] = []
  320. }
  321. })
  322. } else if (type == 'turnover') {
  323. let isFals = this.objData.turnover.some(m => m.code == result)
  324. if (isFals) {
  325. uni.showToast({
  326. title: '周转车已存在',
  327. icon: 'none'
  328. })
  329. return false
  330. }
  331. getByCodeReport(result, this.taskId).then(res => {
  332. this.objData.turnover[id] = res
  333. })
  334. }
  335. },
  336. formedNumFn(num) {
  337. console.log(999, num)
  338. this.$refs.jobRef.setFormedNum(num)
  339. },
  340. getList() {
  341. this.isLoad = false
  342. let URL = this.isOutsource == 0 ? getByIdReport : outSourceGetByIdReport
  343. console.log(URL,'URLURLURL');
  344. URL(this.id, this.taskId).then(res => {
  345. // currentTaskDiagram 有是否可以报工
  346. this.objData = res;
  347. console.log(22, res)
  348. if (!this.objData.hasOwnProperty('turnover')) {
  349. this.objData['turnover'] = []
  350. }
  351. if (!this.objData.hasOwnProperty('aridRegionList')) {
  352. this.objData['aridRegionList'] = []
  353. }
  354. if (!this.objData.hasOwnProperty('instanceList')) {
  355. this.objData['instanceList'] = []
  356. }
  357. if (!this.objData.hasOwnProperty('palletList')) {
  358. this.objData['palletList'] = []
  359. }
  360. if (!this.objData.hasOwnProperty('revolvingDiskList')) {
  361. this.objData['revolvingDiskList'] = []
  362. }
  363. // this.taskType = res.currentTaskDiagram.type
  364. if (this.objData.palletList.length > 0) {
  365. this.objData.palletList = this.objData.palletList.map(m => {
  366. return {
  367. hideKc: true, // 不显示库存
  368. quantity: m.feedQuantity,
  369. ...m
  370. }
  371. })
  372. } else {
  373. // this.objData.palletList = [{
  374. // categoryLevelId: '',
  375. // categoryLevelName: '',
  376. // categoryId: '',
  377. // rootCategoryLevelId: '',
  378. // code: '',
  379. // name: '',
  380. // specification: '',
  381. // brandNum: '',
  382. // modelType: '',
  383. // quantity: '',
  384. // unit: '',
  385. // }]
  386. }
  387. if ((this.taskType == 6 || this.isOutsource == 1) && this.clientEnvironmentId == 3) {
  388. this.objData.semiProductList = this.objData.pickOutInList
  389. }
  390. if (this.clientEnvironmentId == 3 && this.objData.singleReport == 0 && this.taskType != 6) {
  391. this.objData.semiProductList.map(a => {
  392. a.extInfo.batchReportInfo = [{
  393. allFeedQuantity: '',
  394. allReportWeight: '',
  395. taskId: '',
  396. taskName: ''
  397. }]
  398. a.extInfo.notBatchReportInfo = [{
  399. allFeedQuantity: '',
  400. allReportWeight: '',
  401. notType: '',
  402. taskId: '',
  403. taskName: '',
  404. notReason: ''
  405. }]
  406. return {
  407. a
  408. }
  409. })
  410. this.objData.semiProductList = this.objData.semiProductList
  411. }
  412. this.objData.workReportInfo = {
  413. formingNum: null,
  414. formingWeight: null,
  415. formedNum: null,
  416. formedWeight: null,
  417. taskId: this.taskId,
  418. executorTime: ''
  419. }
  420. this.objData.notFormedList = [{
  421. notFormedNum: null,
  422. notFormedWeight: null,
  423. weightUnit: res.weightUnit,
  424. unit: res.unit,
  425. warehouseId: null, // 处置 仓库id
  426. }]
  427. if (this.objData.semiProductList.length > 0) { // 预制体报工
  428. this.objData.workReportInfo.formedNum = this.objData.semiProductList.length
  429. }
  430. this.objData.workReportInfo.formingNum = res.formingNum
  431. this.objData.workReportInfo.formingWeight = res.formingWeight
  432. this.objData.workReportInfo.unit = res.unit
  433. this.objData.workReportInfo.weightUnit = res.weightUnit
  434. this.objData.workReportInfo.workOrderId = res.workOrderId
  435. this.paramDetailList = []
  436. this.paramDetailList = res.paramDetailList.map(m => {
  437. if (m.extInfo.textType == 5) {
  438. this.remainingTime = m.extInfo.remainingTime
  439. }
  440. return {
  441. ...m.extInfo
  442. }
  443. })
  444. }).finally(() => {
  445. this.isLoad = true
  446. if (this.taskType == 1) {
  447. this.getCacheFn()
  448. }
  449. })
  450. },
  451. scrolltolower() { },
  452. handAdd() {
  453. const storageKey = Date.now() + "";
  454. uni.setStorageSync(storageKey, this.objData || {});
  455. uni.navigateTo({
  456. url: `/pages/pda/workOrder/search/index?storageKey=${storageKey}&isType=job&taskId=${this.taskId}`
  457. })
  458. },
  459. penalize(index) {
  460. if (index || index == 0) {
  461. console.log(index, '----');
  462. this.penalizeIndex = index
  463. this.formData.warehouseId = this.objData.productRecycleList[this.penalizeIndex].warehouseId || ''
  464. } else {
  465. this.penalizeIndex = null
  466. this.formData.warehouseId = this.objData.notFormedList[0].warehouseId || ''
  467. console.log(this.formData.warehouseId, '+++++');
  468. }
  469. this.$forceUpdate()
  470. if (this.warehouseList.length == 0) {
  471. getWarehouseList().then(res => {
  472. this.warehouseList = res
  473. this.searchShow = true
  474. })
  475. } else {
  476. this.searchShow = true
  477. }
  478. },
  479. inputChange(e) {
  480. console.log(e)
  481. },
  482. searchCancel() {
  483. this.searchShow = false
  484. },
  485. popupOk() {
  486. if (this.penalizeIndex == null) {
  487. this.$set(this.objData.notFormedList[0], 'warehouseId', this.formData.warehouseId || null)
  488. } else {
  489. this.objData.productRecycleList[this.penalizeIndex].warehouseId = this.formData.warehouseId
  490. }
  491. this.$forceUpdate()
  492. this.searchShow = false
  493. },
  494. modeNum(num) {
  495. console.log(num, '------------', this.objData.modelList.length);
  496. if (this.objData.modelList.length == 0) {
  497. return false
  498. }
  499. console.log(num);
  500. this.$refs.modelRef.setNum(num)
  501. },
  502. async save(type) {
  503. // 验证判断条件
  504. this.$isJobExls(1,this.objData);
  505. uni.showLoading({
  506. title: '加载中'
  507. });
  508. if (!this.objData.workReportInfo['formedNum'] && this.objData.workReportInfo['formedNum'] != 0) {
  509. uni.showToast({
  510. title: '请输入合格品数量',
  511. icon: 'none'
  512. })
  513. return false
  514. }
  515. // 预制体
  516. if (this.objData.semiProductList.length > 0 && this.taskType != 4 && this.objData.singleReport == 1 &&
  517. type == 2) {
  518. let bol
  519. let _i
  520. bol = this.objData.semiProductList.every((e, i) => {
  521. _i = i + 1
  522. if (this.taskType == 6) {
  523. return e.extInfo.hasOwnProperty('taskId') && e.extInfo.taskId
  524. } else {
  525. // if (e.extInfo.isQualified == 1 || e.extInfo.notType == 5) {
  526. // return e.extInfo.hasOwnProperty('taskId') && e.extInfo.taskId && e.extInfo
  527. // .reportWeight
  528. // } else {
  529. // return e.extInfo.hasOwnProperty('notType') && e.extInfo.notType
  530. // }
  531. return e.extInfo.hasOwnProperty('taskId') && e.extInfo.taskId && e.extInfo
  532. .reportWeight
  533. }
  534. })
  535. if (!bol) {
  536. uni.showToast({
  537. title: `请完善第${_i}处置方式`,
  538. icon: 'none'
  539. })
  540. return false
  541. }
  542. }
  543. if (this.objData.productRecycleList.length > 0 && this.clientEnvironmentId != 2) {
  544. const isRecycle = await this.checkRecycle()
  545. if (!isRecycle) {
  546. return false
  547. }
  548. }
  549. if (this.taskType == 4 && this.clientEnvironmentId != 3 && this.clientEnvironmentId != 2 ) {
  550. const isPack = await this.checkPack()
  551. if (!isPack) {
  552. return false
  553. }
  554. }
  555. if (this.objData.currentTaskDiagram.isFirstTask == 0) { // isFirstTask 1是 判断是否首工序
  556. const isFirstTask = await this.checkFirstTask()
  557. if (!isFirstTask) {
  558. return false
  559. }
  560. }
  561. if (this.taskType == 1) {
  562. const isCache = await this.checkCache(type)
  563. if (!isCache) {
  564. return false
  565. }
  566. }
  567. if (this.clientEnvironmentId == 3 && type == 2 && this.taskType == 6 && this.objData.singleReport ==
  568. 0) {
  569. this.objData.semiProductList = []
  570. }
  571. if (this.clientEnvironmentId == 3 && this.taskType == 1) {
  572. if (this.objData && this.objData.executorTime && this.objData.executorTime != undefined) {
  573. // 正则表达式1:匹配 yyyy-MM-dd 格式
  574. const dateRegex = /^\d{4}-\d{2}-\d{2}$/;
  575. if (dateRegex.test(this.objData.executorTime.trimRight())) {
  576. this.objData.workReportInfo['executorTime'] = this.objData.executorTime + ' 00:00:00'
  577. } else {
  578. this.objData.workReportInfo['executorTime'] = this.objData.executorTime
  579. }
  580. } else {
  581. uni.showToast({
  582. title: `请先选择实际报工时间`,
  583. icon: 'none'
  584. })
  585. return false
  586. }
  587. }
  588. jobSave(this.objData).then(res => {
  589. uni.hideLoading();
  590. if (this.taskType == 4) {
  591. uni.showModal({
  592. title: '提示',
  593. content: '打包完成是否去入库!',
  594. confirmText: '确认', //这块是确定按钮的文字
  595. success: rr => {
  596. if (rr.confirm) {
  597. uni.redirectTo({
  598. url: `/pages/pda/warehousing/index?workOrderId=${this.id}&taskId=-1&workReportId=${res}&delta=-2`
  599. })
  600. } else {
  601. uni.navigateBack()
  602. }
  603. }
  604. })
  605. } else {
  606. uni.navigateBack()
  607. }
  608. }).finally(() => {
  609. setTimeout(function () {
  610. uni.hideLoading();
  611. }, 3000);
  612. })
  613. },
  614. checkRecycle() {
  615. uni.hideLoading();
  616. return new Promise((resolve) => {
  617. uni.showModal({
  618. title: '提示',
  619. content: '是否跳过副产品回收处置!',
  620. confirmText: '确认', //这块是确定按钮的文字
  621. success: function (res) {
  622. if (res.confirm) {
  623. resolve(true)
  624. } else {
  625. resolve(false)
  626. }
  627. }
  628. })
  629. })
  630. },
  631. checkPack() {
  632. uni.hideLoading();
  633. return new Promise((resolve) => {
  634. let packInfo = this.$refs.packRef.getData()
  635. this.objData.packInfo = packInfo
  636. this.objData.taskType = this.taskType
  637. if (packInfo.formedNumLast != Number(this.objData.workReportInfo['formedNum']) + Number(this
  638. .objData
  639. .notFormedList[0].notFormedNum)) {
  640. uni.hideLoading();
  641. uni.showModal({
  642. title: '提示',
  643. content: '合格品数量加不合格品数量不等于包装总数!',
  644. confirmText: '确认', //这块是确定按钮的文字
  645. success: function (res) {
  646. if (res.confirm) {
  647. resolve(true)
  648. } else {
  649. resolve(false)
  650. }
  651. }
  652. })
  653. } else {
  654. resolve(true)
  655. }
  656. })
  657. },
  658. checkFirstTask() {
  659. uni.hideLoading();
  660. return new Promise((resolve) => {
  661. if (this.objData.formedNumLast != Number(this.objData.workReportInfo['formedNum']) + Number(
  662. this.objData.notFormedList[0].notFormedNum)) {
  663. uni.showModal({
  664. title: '提示',
  665. content: '合格品数量加不合格品数量不等于上道工序数量!',
  666. confirmText: '确认', //这块是确定按钮的文字
  667. success: function (res) {
  668. if (res.confirm) {
  669. resolve(true)
  670. } else {
  671. resolve(false)
  672. }
  673. }
  674. })
  675. } else {
  676. resolve(true)
  677. }
  678. })
  679. },
  680. checkCache(type) {
  681. uni.hideLoading();
  682. return new Promise((resolve) => {
  683. if (type == 1) {
  684. saveCache(this.objData).then(rr => {
  685. uni.showToast({
  686. title: `已经缓存`,
  687. icon: 'none'
  688. })
  689. })
  690. resolve(false)
  691. } else if (type == 2) {
  692. resolve(true)
  693. }
  694. })
  695. },
  696. removeCacheFn() {
  697. uni.showModal({
  698. title: '缓存',
  699. content: '是否清空缓存!',
  700. confirmText: '确认', //这块是确定按钮的文字
  701. success: rr => {
  702. if (rr.confirm) {
  703. let parma = {
  704. workOrderIds: [this.id],
  705. taskId: this.taskId,
  706. type: 1
  707. }
  708. removeCache(parma).then(res => {
  709. this.getList()
  710. })
  711. }
  712. }
  713. })
  714. },
  715. getCacheFn() {
  716. let parma = {
  717. workOrderId: this.id,
  718. taskId: this.taskId,
  719. type: 1
  720. }
  721. getCache(parma).then(res => {
  722. if (!res || res.length < 0 || Object.getOwnPropertyNames(res).length === 0) {
  723. return false;
  724. }
  725. this.objData['product'] = res.extInfo.product
  726. this.objData['workReportInfo'] = res.extInfo.workReportInfo
  727. this.objData['notFormedList'] = res.extInfo.notFormedList
  728. this.objData['turnover'] = res.extInfo.turnover
  729. this.objData['productRecycleList'] = res.extInfo.productRecycleList
  730. this.objData['semiProductList'] = res.extInfo.semiProductList
  731. this.objData['modelList'] = res.extInfo.modelList
  732. })
  733. },
  734. },
  735. beforeDestroy() {
  736. uni.hideLoading();
  737. },
  738. }
  739. </script>
  740. <style lang="scss" scoped>
  741. .content-box {
  742. height: 100vh;
  743. overflow: hidden;
  744. display: flex;
  745. flex-direction: column;
  746. }
  747. .list_box {
  748. flex: 1;
  749. overflow: hidden;
  750. padding: 4rpx 0;
  751. .u-list {
  752. height: 100% !important;
  753. }
  754. .card_box {
  755. padding: 16rpx 20rpx;
  756. }
  757. }
  758. .bottom-wrapper {
  759. width: 100%;
  760. display: flex;
  761. align-items: center;
  762. justify-content: space-around;
  763. .btn_box {
  764. width: 50%;
  765. height: 88rpx;
  766. line-height: 88rpx;
  767. background: $theme-color;
  768. text-align: center;
  769. font-size: 36rpx;
  770. font-style: normal;
  771. font-weight: 400;
  772. color: #fff;
  773. &:first-child {
  774. border-right: 2rpx solid #fff;
  775. }
  776. }
  777. }
  778. .operate_box {
  779. padding: 10rpx 160rpx;
  780. /deep/ .u-button {
  781. width: 160rpx;
  782. }
  783. }
  784. .search_list {
  785. min-height: 500rpx;
  786. padding: 0 32rpx;
  787. }
  788. .search_list2 {
  789. min-height: 120rpx;
  790. padding: 0 32rpx;
  791. }
  792. .flex_btn {
  793. position: fixed;
  794. right: 0;
  795. bottom: 160rpx;
  796. width: 40rpx;
  797. height: 50rpx;
  798. line-height: 66rpx;
  799. border-radius: 22rpx 0 0 22rpx;
  800. background: $theme-color;
  801. text-align: center;
  802. font-size: 22rpx;
  803. font-style: normal;
  804. font-weight: 400;
  805. color: #fff;
  806. opacity: 0.6;
  807. .jiantou {
  808. width: 30rpx;
  809. height: 30rpx;
  810. }
  811. }
  812. .flex_btn2 {
  813. position: fixed;
  814. right: 0;
  815. bottom: 160rpx;
  816. width: 126rpx;
  817. min-height: 140rpx;
  818. line-height: 62rpx;
  819. border-radius: 22rpx 0 0 22rpx;
  820. background: $theme-color;
  821. text-align: center;
  822. font-size: 22rpx;
  823. font-style: normal;
  824. font-weight: 400;
  825. color: #fff;
  826. opacity: 0.7;
  827. .close_box {
  828. height: 50rpx;
  829. line-height: 50rpx;
  830. width: 126rpx;
  831. text-align: left;
  832. .close {
  833. width: 40rpx;
  834. height: 40rpx;
  835. padding: 6rpx 10rpx;
  836. }
  837. }
  838. }
  839. </style>