index.vue 25 KB

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