index.vue 24 KB

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