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. formedNumLast: 0,
  191. product:[],
  192. equipmentList: [],
  193. modelList: [],
  194. turnover: [],
  195. productRecycleList: [],
  196. aridRegionList: [],
  197. palletList: [],
  198. workReportInfo: {
  199. },
  200. notFormedList: [], // 报工-不合格
  201. },
  202. searchShow: false,
  203. switchOrder: false,
  204. warehouseList: [],
  205. formData: {
  206. warehouseId: ''
  207. },
  208. penalizeIndex: null,
  209. paramDetailList: [],
  210. remainingTime: 0,
  211. id: null,
  212. taskId: null,
  213. clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo")
  214. .clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  215. operateBtn: true,
  216. isOutsource: 0,
  217. }
  218. },
  219. onLoad(options) {
  220. this.title = options.taskName ? options.taskName + '-报工' : '报工'
  221. this.taskType = options.taskType
  222. this.id = options.id
  223. this.taskId = options.taskId
  224. this.isOutsource = options.isOutsource
  225. this.categoryId = options.categoryId
  226. this.getList()
  227. },
  228. onShow() {
  229. uni.$off("setSelectList");
  230. uni.$on("setSelectList", (selectList, id) => {
  231. let turnover = []
  232. let equipmentList = [] // 生产设备
  233. let isEquipment = this.objData.equipmentList.length > 0 ? true : false // 判断是否有设置
  234. selectList.forEach(f => {
  235. if (f.rootCategoryLevelId == 4) { // 生产设备
  236. if (isEquipment) {
  237. equipmentList = this.objData.equipmentList
  238. } else {
  239. equipmentList = equipmentList.concat(f)
  240. }
  241. }
  242. if (f.rootCategoryLevelId == 7) { // 周转车
  243. turnover = turnover.concat(f)
  244. }
  245. })
  246. this.$set(this.objData, 'equipmentList', equipmentList)
  247. this.$set(this.objData, 'turnover', turnover)
  248. this.$forceUpdate()
  249. });
  250. },
  251. methods: {
  252. // 相机扫码
  253. HandlScanCode() {
  254. uni.scanCode({
  255. success: (res) => {
  256. this.scanItAllData(res.result)
  257. }
  258. })
  259. },
  260. scanItAllData(result) {
  261. scanLedger(result).then(res => {
  262. if (res[0].rootCategoryLevelId == 4) { // 设备
  263. let isFals = this.objData.equipmentList.some(m => m.code == result)
  264. if (isFals) {
  265. uni.showToast({
  266. title: '设备已存在',
  267. icon: 'none'
  268. })
  269. return false
  270. }
  271. this.objData.equipmentList.push(res[0])
  272. this.$forceUpdate()
  273. }
  274. if (res.length >= 1 && res[0].rootCategoryLevelId == 5) { // 磨具
  275. if (this.objData.modelList.length == 0) {
  276. this.objData.modelList = res
  277. this.$forceUpdate()
  278. } else {
  279. if (this.objData.modelList[0].instanceId != res[0].instanceId) {
  280. uni.showToast({
  281. title: '模具不匹配',
  282. icon: 'none'
  283. })
  284. } else {
  285. uni.showToast({
  286. title: '设备匹配成功',
  287. icon: 'none'
  288. })
  289. }
  290. }
  291. } else if (res.length == 1 && res[0].rootCategoryLevelId == 7) { // 周转车
  292. let isFals = this.objData.turnover.some(m => m.code == result)
  293. if (isFals) {
  294. uni.showToast({
  295. title: '周转车已存在',
  296. icon: 'none'
  297. })
  298. return false
  299. }
  300. this.objData.turnover.push(res[0])
  301. this.$forceUpdate()
  302. }
  303. })
  304. },
  305. handleScan(id, type) {
  306. uni.scanCode({
  307. success: (res) => {
  308. this.scanData(res.result, type, id)
  309. }
  310. })
  311. },
  312. scanData(result, type, id) {
  313. if (type == 'wordOrder') {
  314. getByCodeReport(result, this.taskId).then(res => {
  315. this.objData = res
  316. if (!this.objData.hasOwnProperty('turnover')) {
  317. this.objData['turnover'] = []
  318. }
  319. if (!this.objData.hasOwnProperty('aridRegionList')) {
  320. this.objData['aridRegionList'] = []
  321. }
  322. })
  323. } else if (type == 'turnover') {
  324. let isFals = this.objData.turnover.some(m => m.code == result)
  325. if (isFals) {
  326. uni.showToast({
  327. title: '周转车已存在',
  328. icon: 'none'
  329. })
  330. return false
  331. }
  332. getByCodeReport(result, this.taskId).then(res => {
  333. this.objData.turnover[id] = res
  334. })
  335. }
  336. },
  337. formedNumFn(num) {
  338. console.log(999, num)
  339. this.$refs.jobRef.setFormedNum(num)
  340. },
  341. getList() {
  342. this.isLoad = false
  343. let URL = this.isOutsource == 0 ? getByIdReport : outSourceGetByIdReport
  344. console.log(URL,'URLURLURL');
  345. URL(this.id, this.taskId).then(res => {
  346. // currentTaskDiagram 有是否可以报工
  347. this.objData = res;
  348. console.log(22, res)
  349. if (!this.objData.hasOwnProperty('turnover')) {
  350. this.objData['turnover'] = []
  351. }
  352. if (!this.objData.hasOwnProperty('aridRegionList')) {
  353. this.objData['aridRegionList'] = []
  354. }
  355. if (!this.objData.hasOwnProperty('instanceList')) {
  356. this.objData['instanceList'] = []
  357. }
  358. if (!this.objData.hasOwnProperty('palletList')) {
  359. this.objData['palletList'] = []
  360. }
  361. if (!this.objData.hasOwnProperty('revolvingDiskList')) {
  362. this.objData['revolvingDiskList'] = []
  363. }
  364. // this.taskType = res.currentTaskDiagram.type
  365. if (this.objData.palletList.length > 0) {
  366. this.objData.palletList = this.objData.palletList.map(m => {
  367. return {
  368. hideKc: true, // 不显示库存
  369. quantity: m.feedQuantity,
  370. ...m
  371. }
  372. })
  373. } else {
  374. // this.objData.palletList = [{
  375. // categoryLevelId: '',
  376. // categoryLevelName: '',
  377. // categoryId: '',
  378. // rootCategoryLevelId: '',
  379. // code: '',
  380. // name: '',
  381. // specification: '',
  382. // brandNum: '',
  383. // modelType: '',
  384. // quantity: '',
  385. // unit: '',
  386. // }]
  387. }
  388. if ((this.taskType == 6 || this.isOutsource == 1) && this.clientEnvironmentId == 3) {
  389. this.objData.semiProductList = this.objData.pickOutInList
  390. }
  391. if (this.clientEnvironmentId == 3 && this.objData.singleReport == 0 && this.taskType != 6) {
  392. this.objData.semiProductList.map(a => {
  393. a.extInfo.batchReportInfo = [{
  394. allFeedQuantity: '',
  395. allReportWeight: '',
  396. taskId: '',
  397. taskName: ''
  398. }]
  399. a.extInfo.notBatchReportInfo = [{
  400. allFeedQuantity: '',
  401. allReportWeight: '',
  402. notType: '',
  403. taskId: '',
  404. taskName: '',
  405. notReason: ''
  406. }]
  407. return {
  408. a
  409. }
  410. })
  411. this.objData.semiProductList = this.objData.semiProductList
  412. }
  413. this.objData.workReportInfo = {
  414. formingNum: null,
  415. formingWeight: null,
  416. formedNum: null,
  417. formedWeight: null,
  418. taskId: this.taskId,
  419. executorTime: ''
  420. }
  421. this.objData.notFormedList = [{
  422. notFormedNum: null,
  423. notFormedWeight: null,
  424. weightUnit: res.weightUnit,
  425. unit: res.unit,
  426. warehouseId: null, // 处置 仓库id
  427. }]
  428. if (this.objData.semiProductList.length > 0) { // 预制体报工
  429. this.objData.workReportInfo.formedNum = this.objData.semiProductList.length
  430. }
  431. this.objData.workReportInfo.formingNum = res.formingNum
  432. this.objData.workReportInfo.formingWeight = res.formingWeight
  433. this.objData.workReportInfo.unit = res.unit
  434. this.objData.workReportInfo.weightUnit = res.weightUnit
  435. this.objData.workReportInfo.workOrderId = res.workOrderId
  436. this.paramDetailList = []
  437. this.paramDetailList = res.paramDetailList.map(m => {
  438. if (m.extInfo.textType == 5) {
  439. this.remainingTime = m.extInfo.remainingTime
  440. }
  441. return {
  442. ...m.extInfo
  443. }
  444. })
  445. }).finally(() => {
  446. this.isLoad = true
  447. if (this.taskType == 1) {
  448. this.getCacheFn()
  449. }
  450. })
  451. },
  452. scrolltolower() { },
  453. handAdd() {
  454. const storageKey = Date.now() + "";
  455. uni.setStorageSync(storageKey, this.objData || {});
  456. uni.navigateTo({
  457. url: `/pages/pda/workOrder/search/index?storageKey=${storageKey}&isType=job&taskId=${this.taskId}`
  458. })
  459. },
  460. penalize(index) {
  461. if (index || index == 0) {
  462. console.log(index, '----');
  463. this.penalizeIndex = index
  464. this.formData.warehouseId = this.objData.productRecycleList[this.penalizeIndex].warehouseId || ''
  465. } else {
  466. this.penalizeIndex = null
  467. this.formData.warehouseId = this.objData.notFormedList[0].warehouseId || ''
  468. console.log(this.formData.warehouseId, '+++++');
  469. }
  470. this.$forceUpdate()
  471. if (this.warehouseList.length == 0) {
  472. getWarehouseList().then(res => {
  473. this.warehouseList = res
  474. this.searchShow = true
  475. })
  476. } else {
  477. this.searchShow = true
  478. }
  479. },
  480. inputChange(e) {
  481. console.log(e)
  482. },
  483. searchCancel() {
  484. this.searchShow = false
  485. },
  486. popupOk() {
  487. if (this.penalizeIndex == null) {
  488. this.$set(this.objData.notFormedList[0], 'warehouseId', this.formData.warehouseId || null)
  489. } else {
  490. this.objData.productRecycleList[this.penalizeIndex].warehouseId = this.formData.warehouseId
  491. }
  492. this.$forceUpdate()
  493. this.searchShow = false
  494. },
  495. modeNum(num) {
  496. console.log(num, '------------', this.objData.modelList.length);
  497. if (this.objData.modelList.length == 0) {
  498. return false
  499. }
  500. console.log(num);
  501. this.$refs.modelRef.setNum(num)
  502. },
  503. async save(type) {
  504. // 验证判断条件
  505. this.$isJobExls(1,this.objData);
  506. uni.showLoading({
  507. title: '加载中'
  508. });
  509. if (!this.objData.workReportInfo['formedNum'] && this.objData.workReportInfo['formedNum'] != 0) {
  510. uni.showToast({
  511. title: '请输入合格品数量',
  512. icon: 'none'
  513. })
  514. return false
  515. }
  516. // 预制体
  517. if (this.objData.semiProductList.length > 0 && this.taskType != 4 && this.objData.singleReport == 1 &&
  518. type == 2) {
  519. let bol
  520. let _i
  521. bol = this.objData.semiProductList.every((e, i) => {
  522. _i = i + 1
  523. if (this.taskType == 6) {
  524. return e.extInfo.hasOwnProperty('taskId') && e.extInfo.taskId
  525. } else {
  526. // if (e.extInfo.isQualified == 1 || e.extInfo.notType == 5) {
  527. // return e.extInfo.hasOwnProperty('taskId') && e.extInfo.taskId && e.extInfo
  528. // .reportWeight
  529. // } else {
  530. // return e.extInfo.hasOwnProperty('notType') && e.extInfo.notType
  531. // }
  532. return e.extInfo.hasOwnProperty('taskId') && e.extInfo.taskId && e.extInfo
  533. .reportWeight
  534. }
  535. })
  536. if (!bol) {
  537. uni.showToast({
  538. title: `请完善第${_i}处置方式`,
  539. icon: 'none'
  540. })
  541. return false
  542. }
  543. }
  544. if (this.objData.productRecycleList.length > 0 && this.clientEnvironmentId != 2) {
  545. const isRecycle = await this.checkRecycle()
  546. if (!isRecycle) {
  547. return false
  548. }
  549. }
  550. if (this.taskType == 4 && this.clientEnvironmentId != 3 && this.clientEnvironmentId != 2 ) {
  551. const isPack = await this.checkPack()
  552. if (!isPack) {
  553. return false
  554. }
  555. }
  556. if (this.objData.currentTaskDiagram.isFirstTask == 0) { // isFirstTask 1是 判断是否首工序
  557. const isFirstTask = await this.checkFirstTask()
  558. if (!isFirstTask) {
  559. return false
  560. }
  561. }
  562. if (this.taskType == 1) {
  563. const isCache = await this.checkCache(type)
  564. if (!isCache) {
  565. return false
  566. }
  567. }
  568. if (this.clientEnvironmentId == 3 && type == 2 && this.taskType == 6 && this.objData.singleReport ==
  569. 0) {
  570. this.objData.semiProductList = []
  571. }
  572. if (this.clientEnvironmentId == 3 && this.taskType == 1) {
  573. if (this.objData && this.objData.executorTime && this.objData.executorTime != undefined) {
  574. // 正则表达式1:匹配 yyyy-MM-dd 格式
  575. const dateRegex = /^\d{4}-\d{2}-\d{2}$/;
  576. if (dateRegex.test(this.objData.executorTime.trimRight())) {
  577. this.objData.workReportInfo['executorTime'] = this.objData.executorTime + ' 00:00:00'
  578. } else {
  579. this.objData.workReportInfo['executorTime'] = this.objData.executorTime
  580. }
  581. } else {
  582. uni.showToast({
  583. title: `请先选择实际报工时间`,
  584. icon: 'none'
  585. })
  586. return false
  587. }
  588. }
  589. jobSave(this.objData).then(res => {
  590. uni.hideLoading();
  591. if (this.taskType == 4) {
  592. uni.showModal({
  593. title: '提示',
  594. content: '打包完成是否去入库!',
  595. confirmText: '确认', //这块是确定按钮的文字
  596. success: rr => {
  597. if (rr.confirm) {
  598. uni.redirectTo({
  599. url: `/pages/pda/warehousing/index?workOrderId=${this.id}&taskId=-1&workReportId=${res}&delta=-2`
  600. })
  601. } else {
  602. uni.navigateBack()
  603. }
  604. }
  605. })
  606. } else {
  607. uni.navigateBack()
  608. }
  609. }).finally(() => {
  610. setTimeout(function () {
  611. uni.hideLoading();
  612. }, 3000);
  613. })
  614. },
  615. checkRecycle() {
  616. uni.hideLoading();
  617. return new Promise((resolve) => {
  618. uni.showModal({
  619. title: '提示',
  620. content: '是否跳过副产品回收处置!',
  621. confirmText: '确认', //这块是确定按钮的文字
  622. success: function (res) {
  623. if (res.confirm) {
  624. resolve(true)
  625. } else {
  626. resolve(false)
  627. }
  628. }
  629. })
  630. })
  631. },
  632. checkPack() {
  633. uni.hideLoading();
  634. return new Promise((resolve) => {
  635. let packInfo = this.$refs.packRef.getData()
  636. this.objData.packInfo = packInfo
  637. this.objData.taskType = this.taskType
  638. if (packInfo.formedNumLast != Number(this.objData.workReportInfo['formedNum']) + Number(this
  639. .objData
  640. .notFormedList[0].notFormedNum)) {
  641. uni.hideLoading();
  642. uni.showModal({
  643. title: '提示',
  644. content: '合格品数量加不合格品数量不等于包装总数!',
  645. confirmText: '确认', //这块是确定按钮的文字
  646. success: function (res) {
  647. if (res.confirm) {
  648. resolve(true)
  649. } else {
  650. resolve(false)
  651. }
  652. }
  653. })
  654. } else {
  655. resolve(true)
  656. }
  657. })
  658. },
  659. checkFirstTask() {
  660. uni.hideLoading();
  661. return new Promise((resolve) => {
  662. if (this.objData.formedNumLast != Number(this.objData.workReportInfo['formedNum']) + Number(
  663. this.objData.notFormedList[0].notFormedNum)) {
  664. uni.showModal({
  665. title: '提示',
  666. content: '合格品数量加不合格品数量不等于上道工序数量!',
  667. confirmText: '确认', //这块是确定按钮的文字
  668. success: function (res) {
  669. if (res.confirm) {
  670. resolve(true)
  671. } else {
  672. resolve(false)
  673. }
  674. }
  675. })
  676. } else {
  677. resolve(true)
  678. }
  679. })
  680. },
  681. checkCache(type) {
  682. uni.hideLoading();
  683. return new Promise((resolve) => {
  684. if (type == 1) {
  685. saveCache(this.objData).then(rr => {
  686. uni.showToast({
  687. title: `已经缓存`,
  688. icon: 'none'
  689. })
  690. })
  691. resolve(false)
  692. } else if (type == 2) {
  693. resolve(true)
  694. }
  695. })
  696. },
  697. removeCacheFn() {
  698. uni.showModal({
  699. title: '缓存',
  700. content: '是否清空缓存!',
  701. confirmText: '确认', //这块是确定按钮的文字
  702. success: rr => {
  703. if (rr.confirm) {
  704. let parma = {
  705. workOrderIds: [this.id],
  706. taskId: this.taskId,
  707. type: 1
  708. }
  709. removeCache(parma).then(res => {
  710. this.getList()
  711. })
  712. }
  713. }
  714. })
  715. },
  716. getCacheFn() {
  717. let parma = {
  718. workOrderId: this.id,
  719. taskId: this.taskId,
  720. type: 1
  721. }
  722. getCache(parma).then(res => {
  723. if (!res || res.length < 0 || Object.getOwnPropertyNames(res).length === 0) {
  724. return false;
  725. }
  726. this.objData['product'] = res.extInfo.product
  727. this.objData['workReportInfo'] = res.extInfo.workReportInfo
  728. this.objData['notFormedList'] = res.extInfo.notFormedList
  729. this.objData['turnover'] = res.extInfo.turnover
  730. this.objData['productRecycleList'] = res.extInfo.productRecycleList
  731. this.objData['semiProductList'] = res.extInfo.semiProductList
  732. this.objData['modelList'] = res.extInfo.modelList
  733. })
  734. },
  735. },
  736. beforeDestroy() {
  737. uni.hideLoading();
  738. },
  739. }
  740. </script>
  741. <style lang="scss" scoped>
  742. .content-box {
  743. height: 100vh;
  744. overflow: hidden;
  745. display: flex;
  746. flex-direction: column;
  747. }
  748. .list_box {
  749. flex: 1;
  750. overflow: hidden;
  751. padding: 4rpx 0;
  752. .u-list {
  753. height: 100% !important;
  754. }
  755. .card_box {
  756. padding: 16rpx 20rpx;
  757. }
  758. }
  759. .bottom-wrapper {
  760. width: 100%;
  761. display: flex;
  762. align-items: center;
  763. justify-content: space-around;
  764. .btn_box {
  765. width: 50%;
  766. height: 88rpx;
  767. line-height: 88rpx;
  768. background: $theme-color;
  769. text-align: center;
  770. font-size: 36rpx;
  771. font-style: normal;
  772. font-weight: 400;
  773. color: #fff;
  774. &:first-child {
  775. border-right: 2rpx solid #fff;
  776. }
  777. }
  778. }
  779. .operate_box {
  780. padding: 10rpx 160rpx;
  781. /deep/ .u-button {
  782. width: 160rpx;
  783. }
  784. }
  785. .search_list {
  786. min-height: 500rpx;
  787. padding: 0 32rpx;
  788. }
  789. .search_list2 {
  790. min-height: 120rpx;
  791. padding: 0 32rpx;
  792. }
  793. .flex_btn {
  794. position: fixed;
  795. right: 0;
  796. bottom: 160rpx;
  797. width: 40rpx;
  798. height: 50rpx;
  799. line-height: 66rpx;
  800. border-radius: 22rpx 0 0 22rpx;
  801. background: $theme-color;
  802. text-align: center;
  803. font-size: 22rpx;
  804. font-style: normal;
  805. font-weight: 400;
  806. color: #fff;
  807. opacity: 0.6;
  808. .jiantou {
  809. width: 30rpx;
  810. height: 30rpx;
  811. }
  812. }
  813. .flex_btn2 {
  814. position: fixed;
  815. right: 0;
  816. bottom: 160rpx;
  817. width: 126rpx;
  818. min-height: 140rpx;
  819. line-height: 62rpx;
  820. border-radius: 22rpx 0 0 22rpx;
  821. background: $theme-color;
  822. text-align: center;
  823. font-size: 22rpx;
  824. font-style: normal;
  825. font-weight: 400;
  826. color: #fff;
  827. opacity: 0.7;
  828. .close_box {
  829. height: 50rpx;
  830. line-height: 50rpx;
  831. width: 126rpx;
  832. text-align: left;
  833. .close {
  834. width: 40rpx;
  835. height: 40rpx;
  836. padding: 6rpx 10rpx;
  837. }
  838. }
  839. }
  840. </style>