semiProductJobBom.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860
  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.deviceName || 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}}
  154. </view>
  155. <view class="item ww20" v-if=" paramList.length > 1 && idx == paramList.length - 1">
  156. ≥ {{it.CVIWeight }}
  157. </view>
  158. <view class="item ww10 rx-cc" @click="getDelete(idx)">
  159. <uni-icons custom-prefix="iconfont" type="icon-shanchu" size="20" color="#fa3534"></uni-icons>
  160. </view>
  161. </view>
  162. </view>
  163. <view class="formula_box">计算公式: 物料重量/坯体密度*密度系数 </view>
  164. <view class="rx-cc">
  165. <u-button size="small" class="u-reset-button" style="width: 300rpx;margin: 20rpx;"
  166. type="success" @click="paramSave">工序列表保存</u-button>
  167. </view>
  168. <view class="reportWeight rx-sc">
  169. 物料重量: {{weight}} ;
  170. 报工重量: {{reportWeight}}
  171. </view>
  172. </view>
  173. <view class="operate_box rx-sc">
  174. <u-button size="small" class="u-reset-button" @click="cancel">取消</u-button>
  175. <u-button size="small" class="u-reset-button" type="success" @click="save">确定</u-button>
  176. </view>
  177. </view>
  178. </u-popup>
  179. </view>
  180. </template>
  181. <script>
  182. import {
  183. getTaskInstanceList
  184. } from '@/api/pda/workOrder.js'
  185. import {
  186. saveParam,
  187. getComputeParam
  188. } from '@/api/pda/tangu.js'
  189. export default {
  190. props: {
  191. item: {
  192. type: Object,
  193. default: () => {}
  194. },
  195. list: {
  196. type: Array,
  197. default: () => []
  198. },
  199. isDetails: {
  200. type: Boolean,
  201. default: false
  202. }
  203. },
  204. watch: {
  205. },
  206. data() {
  207. return {
  208. taskTypeName: null,
  209. isFirstTask: null,
  210. stepsList: [],
  211. show: false,
  212. rowIt: [],
  213. paramList: [],
  214. paramObj: {},
  215. weight: 0,
  216. reportWeight: 0,
  217. resultObj: {},
  218. resultIdx: 0,
  219. }
  220. },
  221. created() {
  222. this.taskTypeName = this.item.currentTaskDiagram.taskTypeName
  223. this.isFirstTask = this.item.currentTaskDiagram.isFirstTask
  224. this.getSteps()
  225. this.getCompute()
  226. },
  227. methods: {
  228. getSteps() {
  229. getTaskInstanceList(this.item.workOrderId).then(res => {
  230. this.stepsList = res
  231. })
  232. },
  233. getCompute() {
  234. getComputeParam(this.item.workOrderId, this.item.currentTaskDiagram.taskId).then(res => {
  235. this.paramList = []
  236. this.paramList = res && res.paramList || []
  237. this.paramObj = res || {}
  238. })
  239. },
  240. handAddParam() {
  241. // billet: null,
  242. // density: null,
  243. // result: null,
  244. // PIPDensity: null,
  245. // volume: null,
  246. // coefficient: null
  247. if (this.isFirstTask == 1) {
  248. this.paramList.push({
  249. taskId: null,
  250. taskName: null,
  251. })
  252. }
  253. },
  254. getDelete(idx) {
  255. this.paramList.splice(idx, 1)
  256. },
  257. changeInp(item, index) {
  258. if (Number(item.billet) && Number(item.density)) {
  259. this.paramList[index].CVIWeight = (Number(this.weight) / item.billet * item.density).toFixed(2)
  260. }
  261. },
  262. paramSave() {
  263. if (this.isFirstTask == 1 && this.paramList.length > 0) {
  264. let bol
  265. let _i
  266. bol = this.paramList.every((e, i) => {
  267. _i = i + 1
  268. return e.taskId && e.billet && e.density
  269. })
  270. if (!bol) {
  271. uni.showToast({
  272. title: `请完善第${_i}计算数据`,
  273. icon: 'none'
  274. })
  275. return false
  276. }
  277. if (this.paramList.length < 1) {
  278. uni.showToast({
  279. title: `请输入二个以上计算数据`,
  280. icon: 'none'
  281. })
  282. return false
  283. }
  284. }
  285. let param = {}
  286. if (!Object.prototype.hasOwnProperty.call(this.paramObj, 'id')) {
  287. param = {
  288. paramList: this.paramList,
  289. workOrderId: this.item.workOrderId,
  290. taskId: this.item.currentTaskDiagram.taskId
  291. }
  292. } else {
  293. this.paramObj.paramList = this.paramList
  294. param = this.paramObj
  295. }
  296. saveParam(param).then(res => {
  297. uni.showToast({
  298. icon: 'none',
  299. title: '操作成功'
  300. })
  301. this.getCompute()
  302. })
  303. },
  304. openNumerate(row, idx) {
  305. if (!row.extInfo.reportWeight) {
  306. uni.showToast({
  307. icon: 'none',
  308. title: '请先输入报工重量'
  309. })
  310. return false
  311. }
  312. this.weight = row.extInfo.weight
  313. this.reportWeight = row.extInfo.reportWeight
  314. this.resultIdx = idx
  315. this.show = true
  316. },
  317. cancel() {
  318. this.show = false
  319. this.reportWeight = 0
  320. this.weight = 0
  321. },
  322. taskChange(e) {
  323. console.log(e)
  324. },
  325. save() {
  326. if (this.isFirstTask == 1) {
  327. this.resultObj = {}
  328. if (Number(this.reportWeight) < this.paramList[0].CVIWeight) {
  329. this.resultObj = this.stepsList[0]
  330. this.setDataSave()
  331. return false
  332. }
  333. if (Number(this.reportWeight) >= this.paramList[this.paramList.length - 1].CVIWeight) {
  334. this.resultObj = this.paramList[this.paramList.length - 1]
  335. this.setDataSave()
  336. return false
  337. }
  338. let _arr = JSON.parse(JSON.stringify(this.paramList))
  339. _arr = _arr.reverse()
  340. for (let i = 1; i < _arr.length; i++) {
  341. if (Number(this.reportWeight) > Number(_arr[i].CVIWeight)) {
  342. this.resultObj = _arr[i]
  343. break;
  344. }
  345. }
  346. this.setDataSave()
  347. }
  348. },
  349. setDataSave() {
  350. this.$set(this.list[this.resultIdx].extInfo, 'taskId', this.resultObj.taskId)
  351. this.$set(this.list[this.resultIdx].extInfo, 'density', this.resultObj.density)
  352. this.$set(this.list[this.resultIdx].extInfo, 'billet', this.resultObj.billet)
  353. this.$set(this.list[this.resultIdx].extInfo, 'taskName', this.resultObj.taskName)
  354. this.cancel()
  355. },
  356. }
  357. }
  358. </script>
  359. <style lang="scss" scoped>
  360. .title_box {
  361. margin-top: 20rpx;
  362. .name {
  363. font-size: 28rpx;
  364. font-style: normal;
  365. font-weight: 400;
  366. color: $theme-color;
  367. padding-left: 20rpx;
  368. position: relative;
  369. &:before {
  370. position: absolute;
  371. content: '';
  372. left: 0rpx;
  373. top: 0rpx;
  374. bottom: 0rpx;
  375. width: 4rpx;
  376. height: 28rpx;
  377. background: $theme-color;
  378. margin: auto;
  379. }
  380. }
  381. .btn_box {
  382. .btn {
  383. padding: 0 18rpx;
  384. height: 50rpx;
  385. line-height: 50rpx;
  386. background: $theme-color;
  387. font-size: 26rpx;
  388. font-style: normal;
  389. font-weight: 400;
  390. font-size: 24rpx;
  391. color: #fff;
  392. border-radius: 4rpx;
  393. margin-left: 24rpx;
  394. }
  395. }
  396. }
  397. .material {
  398. margin-top: 10rpx;
  399. .content_table {
  400. width: 100%;
  401. border: 2rpx solid $border-color;
  402. .item {
  403. display: flex;
  404. border-bottom: 2rpx solid $border-color;
  405. .lable {
  406. width: 132rpx;
  407. text-align: center;
  408. background-color: #F7F9FA;
  409. font-size: 26rpx;
  410. border-right: 2rpx solid $border-color;
  411. flex-shrink: 0;
  412. }
  413. .lable150 {
  414. width: 156rpx !important;
  415. font-size: 24rpx;
  416. }
  417. .lable190 {
  418. width: 190rpx !important;
  419. font-size: 24rpx;
  420. }
  421. .ww80 {
  422. width: 80rpx;
  423. }
  424. .content {
  425. width: 518rpx;
  426. min-height: 64rpx;
  427. font-size: 28rpx;
  428. line-height: 28rpx;
  429. font-style: normal;
  430. font-weight: 400;
  431. padding: 18rpx 8rpx;
  432. box-sizing: border-box;
  433. word-wrap: break-word;
  434. flex-grow: 1 !important;
  435. .unit {
  436. padding: 0 4rpx;
  437. font-size: 24rpx;
  438. color: #404446;
  439. }
  440. .penalize {
  441. width: 160rpx;
  442. line-height: 60rpx;
  443. background: $theme-color;
  444. font-size: 24rpx;
  445. text-align: center;
  446. color: #fff;
  447. }
  448. }
  449. .content_H {
  450. min-height: 92rpx;
  451. }
  452. .pd4 {
  453. padding: 4rpx 8rpx;
  454. }
  455. &:last-child {
  456. border-bottom: none;
  457. }
  458. }
  459. .ww55 {
  460. width: 55%;
  461. }
  462. .ww50 {
  463. width: 50%;
  464. }
  465. .ww45 {
  466. width: 45%;
  467. }
  468. }
  469. }
  470. .content_table2 {
  471. width: 100%;
  472. .row {
  473. width: 100%;
  474. .item {
  475. color: #404446;
  476. font-size: 28rpx;
  477. padding-left: 12rpx;
  478. }
  479. .color157 {
  480. color: $theme-color;
  481. }
  482. .ww30 {
  483. width: 30%;
  484. }
  485. .ww20 {
  486. width: 20%;
  487. }
  488. .ww15 {
  489. width: 15%;
  490. }
  491. .ww25 {
  492. width: 25%;
  493. }
  494. .ww50 {
  495. width: 50%;
  496. }
  497. .ww10 {
  498. width: 10%;
  499. }
  500. }
  501. .head {
  502. height: 64rpx;
  503. background: #F7F9FA;
  504. border-top: 2rpx solid #E3E5E5;
  505. border-left: 2rpx solid #E3E5E5;
  506. .item {
  507. height: 64rpx;
  508. line-height: 64rpx;
  509. border-right: 2rpx solid #E3E5E5;
  510. box-sizing: border-box;
  511. font-size: 22rpx;
  512. }
  513. }
  514. .tr {
  515. border-top: 2rpx solid #E3E5E5;
  516. border-left: 2rpx solid #E3E5E5;
  517. .item {
  518. font-size: 24rpx;
  519. min-height: 74rpx;
  520. display: flex;
  521. align-items: center;
  522. border-right: 2rpx solid #E3E5E5;
  523. box-sizing: border-box;
  524. white-space: normal;
  525. word-break: break-all;
  526. }
  527. &:last-child {
  528. border-bottom: 2rpx solid #E3E5E5;
  529. }
  530. .numerate {
  531. font-size: 22rpx;
  532. color: $theme-color;
  533. }
  534. }
  535. }
  536. .content_num {
  537. display: flex;
  538. align-items: center;
  539. padding: 0 4rpx;
  540. /deep/ .uni-input-input {
  541. border: 2rpx solid #F0F8F2;
  542. background: #F0F8F2;
  543. color: $theme-color;
  544. }
  545. }
  546. .round {
  547. width: 32rpx;
  548. height: 32rpx;
  549. line-height: 32rpx;
  550. text-align: center;
  551. border-radius: 50%;
  552. background: $theme-color;
  553. font-size: 24rpx;
  554. font-style: normal;
  555. font-weight: 400;
  556. color: #fff;
  557. margin-right: 18rpx;
  558. }
  559. .popup_box {
  560. width: 94vw;
  561. padding: 16rpx 12rpx;
  562. box-sizing: border-box;
  563. }
  564. .operate_box {
  565. margin-top: 32rpx;
  566. padding: 10rpx 100rpx;
  567. /deep/ .u-button {
  568. width: 160rpx;
  569. }
  570. }
  571. .formula_box {
  572. font-size: 24rpx;
  573. font-style: normal;
  574. font-weight: 400;
  575. margin-top: 12rpx;
  576. }
  577. .reportWeight {
  578. font-size: 24rpx;
  579. font-style: normal;
  580. font-weight: 400;
  581. margin-top: 30rpx;
  582. text {
  583. color: $theme-color;
  584. }
  585. }
  586. </style>