index.vue 25 KB

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