index.vue 27 KB

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