index.vue 25 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163
  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>