index.vue 29 KB

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