semiProductJobBom.vue 15 KB

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