semiProductJobBom.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  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" style="font-size: 20rpx;">{{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 class="item ww10 rx-cc" @click="getDelete(idx)">
  158. <uni-icons custom-prefix="iconfont" type="icon-shanchu" size="20"
  159. 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.paramList[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. for (let i = 1; i < this.paramList.length; i++) {
  339. if ( Number(this.paramList[i-1].CVIWeight) < Number(this.reportWeight) && Number(this.reportWeight) < Number(this.paramList[i].CVIWeight)) {
  340. this.resultObj = this.paramList[i]
  341. break;
  342. }
  343. }
  344. this.setDataSave()
  345. }
  346. },
  347. setDataSave() {
  348. this.$set(this.list[this.resultIdx].extInfo, 'taskId', this.resultObj.taskId)
  349. this.$set(this.list[this.resultIdx].extInfo, 'density', this.resultObj.density)
  350. this.$set(this.list[this.resultIdx].extInfo, 'billet', this.resultObj.billet)
  351. this.$set(this.list[this.resultIdx].extInfo, 'taskName', this.resultObj.taskName)
  352. this.cancel()
  353. },
  354. }
  355. }
  356. </script>
  357. <style lang="scss" scoped>
  358. .title_box {
  359. margin-top: 20rpx;
  360. .name {
  361. font-size: 28rpx;
  362. font-style: normal;
  363. font-weight: 400;
  364. color: $theme-color;
  365. padding-left: 20rpx;
  366. position: relative;
  367. &:before {
  368. position: absolute;
  369. content: '';
  370. left: 0rpx;
  371. top: 0rpx;
  372. bottom: 0rpx;
  373. width: 4rpx;
  374. height: 28rpx;
  375. background: $theme-color;
  376. margin: auto;
  377. }
  378. }
  379. .btn_box {
  380. .btn {
  381. padding: 0 18rpx;
  382. height: 50rpx;
  383. line-height: 50rpx;
  384. background: $theme-color;
  385. font-size: 26rpx;
  386. font-style: normal;
  387. font-weight: 400;
  388. font-size: 24rpx;
  389. color: #fff;
  390. border-radius: 4rpx;
  391. margin-left: 24rpx;
  392. }
  393. }
  394. }
  395. .material {
  396. margin-top: 10rpx;
  397. .content_table {
  398. width: 100%;
  399. border: 2rpx solid $border-color;
  400. .item {
  401. display: flex;
  402. border-bottom: 2rpx solid $border-color;
  403. .lable {
  404. width: 132rpx;
  405. text-align: center;
  406. background-color: #F7F9FA;
  407. font-size: 26rpx;
  408. border-right: 2rpx solid $border-color;
  409. flex-shrink: 0;
  410. }
  411. .lable150 {
  412. width: 156rpx !important;
  413. font-size: 24rpx;
  414. }
  415. .lable190 {
  416. width: 190rpx !important;
  417. font-size: 24rpx;
  418. }
  419. .ww80 {
  420. width: 80rpx;
  421. }
  422. .content {
  423. width: 518rpx;
  424. min-height: 64rpx;
  425. font-size: 28rpx;
  426. line-height: 28rpx;
  427. font-style: normal;
  428. font-weight: 400;
  429. padding: 18rpx 8rpx;
  430. box-sizing: border-box;
  431. word-wrap: break-word;
  432. flex-grow: 1 !important;
  433. .unit {
  434. padding: 0 4rpx;
  435. font-size: 24rpx;
  436. color: #404446;
  437. }
  438. .penalize {
  439. width: 160rpx;
  440. line-height: 60rpx;
  441. background: $theme-color;
  442. font-size: 24rpx;
  443. text-align: center;
  444. color: #fff;
  445. }
  446. }
  447. .content_H {
  448. min-height: 92rpx;
  449. }
  450. .pd4 {
  451. padding: 4rpx 8rpx;
  452. }
  453. &:last-child {
  454. border-bottom: none;
  455. }
  456. }
  457. .ww55 {
  458. width: 55%;
  459. }
  460. .ww50 {
  461. width: 50%;
  462. }
  463. .ww45 {
  464. width: 45%;
  465. }
  466. }
  467. }
  468. .content_table2 {
  469. width: 100%;
  470. .row {
  471. width: 100%;
  472. .item {
  473. color: #404446;
  474. font-size: 28rpx;
  475. padding-left: 12rpx;
  476. }
  477. .color157 {
  478. color: $theme-color;
  479. }
  480. .ww30 {
  481. width: 30%;
  482. }
  483. .ww20 {
  484. width: 20%;
  485. }
  486. .ww15 {
  487. width: 15%;
  488. }
  489. .ww25 {
  490. width: 25%;
  491. }
  492. .ww50 {
  493. width: 50%;
  494. }
  495. .ww10 {
  496. width: 10%;
  497. }
  498. }
  499. .head {
  500. height: 64rpx;
  501. background: #F7F9FA;
  502. border-top: 2rpx solid #E3E5E5;
  503. border-left: 2rpx solid #E3E5E5;
  504. .item {
  505. height: 64rpx;
  506. line-height: 64rpx;
  507. border-right: 2rpx solid #E3E5E5;
  508. box-sizing: border-box;
  509. font-size: 22rpx;
  510. }
  511. }
  512. .tr {
  513. border-top: 2rpx solid #E3E5E5;
  514. border-left: 2rpx solid #E3E5E5;
  515. .item {
  516. font-size: 24rpx;
  517. min-height: 74rpx;
  518. display: flex;
  519. align-items: center;
  520. border-right: 2rpx solid #E3E5E5;
  521. box-sizing: border-box;
  522. white-space: normal;
  523. word-break: break-all;
  524. }
  525. &:last-child {
  526. border-bottom: 2rpx solid #E3E5E5;
  527. }
  528. .numerate {
  529. font-size: 22rpx;
  530. color: $theme-color;
  531. }
  532. }
  533. }
  534. .content_num {
  535. display: flex;
  536. align-items: center;
  537. padding: 0 4rpx;
  538. /deep/ .uni-input-input {
  539. border: 2rpx solid #F0F8F2;
  540. background: #F0F8F2;
  541. color: $theme-color;
  542. }
  543. }
  544. .round {
  545. width: 32rpx;
  546. height: 32rpx;
  547. line-height: 32rpx;
  548. text-align: center;
  549. border-radius: 50%;
  550. background: $theme-color;
  551. font-size: 24rpx;
  552. font-style: normal;
  553. font-weight: 400;
  554. color: #fff;
  555. margin-right: 18rpx;
  556. }
  557. .popup_box {
  558. width: 94vw;
  559. padding: 16rpx 12rpx;
  560. box-sizing: border-box;
  561. }
  562. .operate_box {
  563. margin-top: 32rpx;
  564. padding: 10rpx 100rpx;
  565. /deep/ .u-button {
  566. width: 160rpx;
  567. }
  568. }
  569. .formula_box {
  570. font-size: 24rpx;
  571. font-style: normal;
  572. font-weight: 400;
  573. margin-top: 12rpx;
  574. }
  575. .reportWeight {
  576. font-size: 24rpx;
  577. font-style: normal;
  578. font-weight: 400;
  579. margin-top: 30rpx;
  580. text {
  581. color: $theme-color;
  582. }
  583. }
  584. </style>