index.vue 26 KB

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