oneJobQualityBom.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883
  1. <template>
  2. <view>
  3. <view class="title_box rx-bc">
  4. <view class="name">报工信息: ({{list.length || 0}})个</view>
  5. </view>
  6. <view class="material " v-for="(it, idx) in list" :key="idx">
  7. <view class="content_table">
  8. <view class="item rx-sc">
  9. <view class="rx">
  10. <view class="lable lable190 rx-cc ">
  11. <view class="round">{{idx + 1}}</view>物料编码
  12. </view>
  13. <view class="content rx-sc">
  14. <view>{{it.code}}</view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="item rx-sc">
  19. <view class="rx">
  20. <view class="lable lable150 rx-cc ">名称</view>
  21. <view class="content rx-sc">
  22. <view>{{it.name}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="item rx-sc">
  27. <view class="rx">
  28. <view class="lable lable150 rx-cc ">型号</view>
  29. <view class="content rx-sc">
  30. <view>{{it.modelType}}</view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="item rx-sc">
  35. <view class="rx ww50 ">
  36. <view class="lable lable150 rx-cc ">物料代号</view>
  37. <view class="content content_num">
  38. <view v-if='isDetails'>{{it.extInfo.materielCode }}</view>
  39. <input class="uni-input" v-else v-model="it.extInfo.materielCode"></input>
  40. </view>
  41. </view>
  42. <view class="rx ww50">
  43. <view class="lable lable150 rx-cc ">客户代号</view>
  44. <view class="content content_num">
  45. <view v-if='isDetails'>{{it.extInfo.clientCode }}</view>
  46. <input class="uni-input" v-else v-model="it.extInfo.clientCode"></input>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="item rx-sc">
  51. <view class="rx ww50 ">
  52. <view class="lable lable150 rx-cc ">刻码</view>
  53. <view class="content content_num ">
  54. <view v-if='isDetails'>{{it.extInfo.engrave }}</view>
  55. <input class="uni-input" v-else v-model="it.extInfo.engrave"></input>
  56. </view>
  57. </view>
  58. <view class="rx ww50">
  59. <view class="lable lable150 rx-cc ">位置</view>
  60. <view class="content content_num">
  61. <view v-if='isDetails'>{{it.extInfo.position }}</view>
  62. <input class="uni-input" v-else v-model="it.extInfo.position"></input>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="item rx-sc">
  67. <view class="rx ww50">
  68. <view class="lable lable150 rx-cc ">设备</view>
  69. <view class="content ">
  70. <view>{{it.extInfo.deviceName }}</view>
  71. </view>
  72. </view>
  73. <view class="rx ww50">
  74. <view class="lable lable150 rx-cc ">炉次号</view>
  75. <view class="content ">
  76. <view>{{it.extInfo.heatNumber }}</view>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="item rx-sc">
  81. <view class="rx ww50 ">
  82. <view class="lable lable150 rx-cc ">外观</view>
  83. <view class="content content_num ">
  84. <view v-if='isDetails'>{{ it.extInfo.appearance == 1 ? '合格' : it.extInfo.appearance == 2 ? '不合格' : '' }}</view>
  85. <zxz-uni-data-select v-else :localdata="qualityList" v-model="it.extInfo.appearance" dataValue='value'
  86. format='{name}' dataKey="value" filterable
  87. :clear='false'></zxz-uni-data-select>
  88. </view>
  89. </view>
  90. <view class="rx ww50">
  91. <view class="lable lable150 rx-cc ">尺寸</view>
  92. <view class="content content_num">
  93. <view v-if='isDetails'>{{ it.extInfo.dimension == 1 ? '合格' : it.extInfo.dimension == 2 ? '不合格' : '' }}</view>
  94. <zxz-uni-data-select v-else :localdata="qualityList" v-model="it.extInfo.dimension" dataValue='value'
  95. format='{name}' dataKey="value" filterable
  96. :clear='false'></zxz-uni-data-select>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. <view class="content_table2">
  102. <view class="head row rx-sc">
  103. <view class="item ww25">物料重量 {{it.extInfo.weightUnit}}</view>
  104. <view class="item ww25">报工重量{{it.extInfo.weightUnit}}</view>
  105. <view class="item ww25" v-if="isFirstTask == 1">质检结果
  106. </view>
  107. <view class="item ww25" :class="[ isFirstTask == 1 ? 'ww25' : 'ww50' ]">处置
  108. </view>
  109. </view>
  110. <view class="table">
  111. <view class="tr row rx-sc">
  112. <view class="item ww25">{{it.extInfo.weight }}
  113. </view>
  114. <view class="item ww25 content_num">
  115. <view v-if='isDetails'>{{it.extInfo.newWeight }}</view>
  116. <input class="uni-input" v-else v-model="it.extInfo.newWeight"></input>
  117. </view>
  118. <view class="item ww25" @click="openNumerate(it, idx)" v-if="isFirstTask == 1">
  119. <view class="numerate">点击计算</view>
  120. </view>
  121. <view class="item" v-if='isDetails' :class="[ isFirstTask == 1 ? 'ww25' : 'ww50' ]">
  122. {{it.extInfo.taskName}}
  123. </view>
  124. <view class="item " v-else :class="[ isFirstTask == 1 ? 'ww25' : 'ww50' ]">
  125. <zxz-uni-data-select :localdata="stepsList" v-model="it.extInfo.taskId" dataValue='taskId'
  126. format='{taskTypeName}' dataKey="taskId" filterable @change=" e => it.extInfo.taskName = e.taskTypeName"
  127. :clear='false'></zxz-uni-data-select>
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. <u-popup :show="show" mode='center' v-if='show' :closeOnClickOverlay='false'>
  134. <view class="popup_box">
  135. <view class="title_box rx-bc">
  136. <view class="name">工序计算列表</view>
  137. <view class="btn_box rx-ec">
  138. <view class="btn" @click="handAddParam">新增</view>
  139. </view>
  140. </view>
  141. <view class="content_table2">
  142. <view class="head row rx-sc">
  143. <view class="item ww30">工序名称</view>
  144. <view class="item ww20">坯体密度</view>
  145. <view class="item ww20">密度系数</view>
  146. <view class="item ww20">重量</view>
  147. <view class="item ww10">操作</view>
  148. </view>
  149. <view class="table">
  150. <view class="tr row rx-sc" v-for="(it, idx) in paramList" :key='idx'>
  151. <view class="item rx-bc ww30">
  152. <zxz-uni-data-select :localdata="stepsList" v-model="it.taskId" dataValue='taskId'
  153. format='{taskTypeName}' dataKey="taskId" filterable
  154. @change=" e => it.taskName = e.taskTypeName" :clear='false'></zxz-uni-data-select>
  155. </view>
  156. <view class="item ww20 content_num">
  157. <input class="uni-input" v-model="it.billet" type="digit"
  158. @input="changeInp(it, idx)"></input>
  159. </view>
  160. <view class="item ww20 content_num">
  161. <input class="uni-input" v-model="it.density" type="digit"
  162. @input="changeInp(it, idx)"></input>
  163. </view>
  164. <view class="item ww20" v-if=" (idx == 0 || idx != paramList.length - 1)">
  165. < {{it.CVIWeight}} </view>
  166. <view class="item ww20" v-if=" paramList.length > 1 && idx == paramList.length - 1">
  167. ≥ {{it.CVIWeight }}
  168. </view>
  169. </view>
  170. </view>
  171. <view class="formula_box">计算公式: 物料重量/坯体密度*密度系数 </view>
  172. <view class="rx-cc">
  173. <u-button size="small" class="u-reset-button" style="width: 300rpx;margin: 20rpx;"
  174. type="success" @click="paramSave">工序列表保存</u-button>
  175. </view>
  176. <view class="reportWeight rx-sc">
  177. 物料重量: {{weight}} ;
  178. 报工重量: {{reportWeight}}
  179. </view>
  180. </view>
  181. <view class="operate_box rx-sc">
  182. <u-button size="small" class="u-reset-button" @click="cancel">取消</u-button>
  183. <u-button size="small" class="u-reset-button" type="success" @click="save">确定</u-button>
  184. </view>
  185. </view>
  186. </u-popup>
  187. </view>
  188. </template>
  189. <script>
  190. import {
  191. getTaskInstanceList
  192. } from '@/api/pda/workOrder.js'
  193. import {
  194. saveParam,
  195. getComputeParam
  196. } from '@/api/pda/tangu.js'
  197. export default {
  198. props: {
  199. item: {
  200. type: Object,
  201. default: () => {}
  202. },
  203. list: {
  204. type: Array,
  205. default: () => []
  206. },
  207. isDetails: {
  208. type: Boolean,
  209. default: false
  210. }
  211. },
  212. watch: {
  213. },
  214. data() {
  215. return {
  216. taskTypeName: null,
  217. isFirstTask: null,
  218. stepsList: [],
  219. show: false,
  220. rowIt: [],
  221. paramList: [],
  222. paramObj: {},
  223. weight: 0,
  224. reportWeight: 0,
  225. resultObj: {},
  226. resultIdx: 0,
  227. qualityList: [
  228. {
  229. name: '合格',
  230. value: 1
  231. },
  232. {
  233. name: '不合格',
  234. value: 2
  235. }
  236. ]
  237. }
  238. },
  239. created() {
  240. this.taskTypeName = this.item.currentTaskDiagram.taskTypeName
  241. this.isFirstTask = this.item.currentTaskDiagram.isFirstTask
  242. this.getSteps()
  243. this.getCompute()
  244. },
  245. methods: {
  246. getSteps() {
  247. getTaskInstanceList(this.item.workOrderId).then(res => {
  248. this.stepsList = res
  249. })
  250. },
  251. getCompute() {
  252. getComputeParam(this.item.workOrderId, this.item.currentTaskDiagram.taskId).then(res => {
  253. this.paramList = []
  254. this.paramList = res && res.paramList
  255. this.paramObj = res
  256. })
  257. },
  258. handAddParam() {
  259. // billet: null,
  260. // density: null,
  261. // result: null,
  262. // PIPDensity: null,
  263. // volume: null,
  264. // coefficient: null
  265. if (this.isFirstTask == 1) {
  266. this.paramList.push({
  267. taskId: null,
  268. taskName: null,
  269. })
  270. }
  271. },
  272. getDelete(idx) {
  273. this.paramList.splice(idx, 1)
  274. },
  275. changeInp(item, index) {
  276. if (Number(item.billet) && Number(item.density)) {
  277. this.paramList[index].CVIWeight = (Number(this.weight) / item.billet * item.density).toFixed(2)
  278. }
  279. },
  280. paramSave() {
  281. if (this.isFirstTask == 1 && this.paramList.length > 0) {
  282. let bol
  283. let _i
  284. bol = this.paramList.every((e, i) => {
  285. _i = i + 1
  286. return e.taskId && e.billet && e.density
  287. })
  288. if (!bol) {
  289. uni.showToast({
  290. title: `请完善第${_i}计算数据`,
  291. icon: 'none'
  292. })
  293. return false
  294. }
  295. if (this.paramList.length < 1) {
  296. uni.showToast({
  297. title: `请输入二个以上计算数据`,
  298. icon: 'none'
  299. })
  300. return false
  301. }
  302. }
  303. let param = {}
  304. if (!this.paramObj.hasOwnProperty('id')) {
  305. param = {
  306. paramList: this.paramList,
  307. workOrderId: this.item.workOrderId,
  308. taskId: this.item.currentTaskDiagram.taskId
  309. }
  310. } else {
  311. this.paramObj.paramList = this.paramList
  312. param = this.paramObj
  313. }
  314. saveParam(param).then(res => {
  315. uni.showToast({
  316. icon: 'none',
  317. title: '操作成功'
  318. })
  319. this.getCompute()
  320. })
  321. },
  322. openNumerate(row, idx) {
  323. if (!row.extInfo.reportWeight) {
  324. uni.showToast({
  325. icon: 'none',
  326. title: '请先输入报工重量'
  327. })
  328. return false
  329. }
  330. this.weight = row.extInfo.weight
  331. this.reportWeight = row.extInfo.reportWeight
  332. this.resultIdx = idx
  333. this.show = true
  334. },
  335. cancel() {
  336. this.show = false
  337. this.reportWeight = 0
  338. this.weight = 0
  339. },
  340. taskChange(e) {
  341. console.log(e)
  342. },
  343. save() {
  344. if (this.isFirstTask == 1) {
  345. this.resultObj = {}
  346. if (Number(this.reportWeight) < this.paramList[0].CVIWeight) {
  347. this.resultObj = this.paramList[0]
  348. this.setDataSave()
  349. return false
  350. }
  351. if (Number(this.reportWeight) >= this.paramList[this.paramList.length - 1].CVIWeight) {
  352. this.resultObj = this.paramList[this.paramList.length - 1]
  353. this.setDataSave()
  354. return false
  355. }
  356. for (let i = 1; i < this.paramList.length; i++) {
  357. if (Number(this.paramList[i - 1].CVIWeight) < Number(this.reportWeight) <= Number(this.paramList[i]
  358. .CVIWeight)) {
  359. this.resultObj = this.paramList[i]
  360. break;
  361. }
  362. }
  363. this.setDataSave()
  364. }
  365. },
  366. setDataSave() {
  367. this.$set(this.list[this.resultIdx].extInfo, 'taskId', this.resultObj.taskId)
  368. this.$set(this.list[this.resultIdx].extInfo, 'density', this.resultObj.density)
  369. this.$set(this.list[this.resultIdx].extInfo, 'billet', this.resultObj.billet)
  370. this.$set(this.list[this.resultIdx].extInfo, 'taskName', this.resultObj.taskName)
  371. this.cancel()
  372. },
  373. }
  374. }
  375. </script>
  376. <style lang="scss" scoped>
  377. .title_box {
  378. margin-top: 20rpx;
  379. .name {
  380. font-size: 28rpx;
  381. font-style: normal;
  382. font-weight: 400;
  383. color: $theme-color;
  384. padding-left: 20rpx;
  385. position: relative;
  386. &:before {
  387. position: absolute;
  388. content: '';
  389. left: 0rpx;
  390. top: 0rpx;
  391. bottom: 0rpx;
  392. width: 4rpx;
  393. height: 28rpx;
  394. background: $theme-color;
  395. margin: auto;
  396. }
  397. }
  398. .btn_box {
  399. .btn {
  400. padding: 0 18rpx;
  401. height: 50rpx;
  402. line-height: 50rpx;
  403. background: $theme-color;
  404. font-size: 26rpx;
  405. font-style: normal;
  406. font-weight: 400;
  407. font-size: 24rpx;
  408. color: #fff;
  409. border-radius: 4rpx;
  410. margin-left: 24rpx;
  411. }
  412. }
  413. }
  414. .material {
  415. margin-top: 16rpx;
  416. .content_table {
  417. width: 100%;
  418. border: 2rpx solid $border-color;
  419. .item {
  420. display: flex;
  421. border-bottom: 2rpx solid $border-color;
  422. .lable {
  423. width: 132rpx;
  424. text-align: center;
  425. background-color: #F7F9FA;
  426. font-size: 26rpx;
  427. border-right: 2rpx solid $border-color;
  428. flex-shrink: 0;
  429. }
  430. .lable150 {
  431. width: 156rpx !important;
  432. font-size: 24rpx;
  433. }
  434. .lable190 {
  435. width: 190rpx !important;
  436. font-size: 24rpx;
  437. }
  438. .ww80 {
  439. width: 80rpx;
  440. }
  441. .content {
  442. width: 518rpx;
  443. min-height: 64rpx;
  444. font-size: 28rpx;
  445. line-height: 28rpx;
  446. font-style: normal;
  447. font-weight: 400;
  448. padding: 18rpx 8rpx;
  449. box-sizing: border-box;
  450. word-wrap: break-word;
  451. flex-grow: 1 !important;
  452. .unit {
  453. padding: 0 4rpx;
  454. font-size: 24rpx;
  455. color: #404446;
  456. }
  457. .penalize {
  458. width: 160rpx;
  459. line-height: 60rpx;
  460. background: $theme-color;
  461. font-size: 24rpx;
  462. text-align: center;
  463. color: #fff;
  464. }
  465. }
  466. .content_H {
  467. min-height: 92rpx;
  468. }
  469. .pd4 {
  470. padding: 4rpx 8rpx;
  471. }
  472. &:last-child {
  473. border-bottom: none;
  474. }
  475. }
  476. .ww55 {
  477. width: 55%;
  478. }
  479. .ww50 {
  480. width: 50%;
  481. }
  482. .ww45 {
  483. width: 45%;
  484. }
  485. }
  486. }
  487. .content_table2 {
  488. width: 100%;
  489. // margin-top: 16rpx;
  490. .row {
  491. width: 100%;
  492. .item {
  493. color: #404446;
  494. font-size: 28rpx;
  495. padding-left: 12rpx;
  496. }
  497. .color157 {
  498. color: $theme-color;
  499. }
  500. .ww30 {
  501. width: 30%;
  502. }
  503. .ww20 {
  504. width: 20%;
  505. }
  506. .ww15 {
  507. width: 15%;
  508. }
  509. .ww25 {
  510. width: 25%;
  511. }
  512. .ww50 {
  513. width: 50%;
  514. }
  515. .ww10 {
  516. width: 10%;
  517. }
  518. }
  519. .head {
  520. height: 64rpx;
  521. background: #F7F9FA;
  522. border-top: 2rpx solid #E3E5E5;
  523. border-left: 2rpx solid #E3E5E5;
  524. .item {
  525. height: 64rpx;
  526. line-height: 64rpx;
  527. border-right: 2rpx solid #E3E5E5;
  528. box-sizing: border-box;
  529. font-size: 22rpx;
  530. }
  531. }
  532. .tr {
  533. border-top: 2rpx solid #E3E5E5;
  534. border-left: 2rpx solid #E3E5E5;
  535. .item {
  536. font-size: 24rpx;
  537. min-height: 74rpx;
  538. display: flex;
  539. align-items: center;
  540. border-right: 2rpx solid #E3E5E5;
  541. box-sizing: border-box;
  542. white-space: normal;
  543. word-break: break-all;
  544. }
  545. &:last-child {
  546. border-bottom: 2rpx solid #E3E5E5;
  547. }
  548. .numerate {
  549. font-size: 22rpx;
  550. color: $theme-color;
  551. }
  552. }
  553. }
  554. .content_num {
  555. display: flex;
  556. align-items: center;
  557. padding: 0 4rpx;
  558. /deep/ .uni-input-input {
  559. border: 2rpx solid #F0F8F2;
  560. background: #F0F8F2;
  561. color: $theme-color;
  562. }
  563. }
  564. .round {
  565. width: 32rpx;
  566. height: 32rpx;
  567. line-height: 32rpx;
  568. text-align: center;
  569. border-radius: 50%;
  570. background: $theme-color;
  571. font-size: 24rpx;
  572. font-style: normal;
  573. font-weight: 400;
  574. color: #fff;
  575. margin-right: 18rpx;
  576. }
  577. .popup_box {
  578. width: 94vw;
  579. padding: 16rpx 12rpx;
  580. box-sizing: border-box;
  581. }
  582. .operate_box {
  583. margin-top: 32rpx;
  584. padding: 10rpx 100rpx;
  585. /deep/ .u-button {
  586. width: 160rpx;
  587. }
  588. }
  589. .formula_box {
  590. font-size: 24rpx;
  591. font-style: normal;
  592. font-weight: 400;
  593. margin-top: 12rpx;
  594. }
  595. .reportWeight {
  596. font-size: 24rpx;
  597. font-style: normal;
  598. font-weight: 400;
  599. margin-top: 30rpx;
  600. text {
  601. color: $theme-color;
  602. }
  603. }
  604. </style>