semiProductJobBom.vue 15 KB

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