index.vue 25 KB

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