index.vue 25 KB

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