addInwardBillet.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. // 新增内转钢坯需求
  2. <template>
  3. <div class="inwardRequirement">
  4. <!-- 用车单位 -->
  5. <div class="requireUnit">
  6. <el-form class="demo-form-inline" label-width="80px" :inline="true">
  7. <div class="top1">
  8. <el-form-item label="用车单位" v-show="false">
  9. <el-input class="inline-input" v-model="requireUnitName" disabled>
  10. </el-input>
  11. </el-form-item>
  12. <el-form-item label="需求类型" v-show="false">
  13. <el-input class="inline-input" v-model="requirementType" disabled>
  14. </el-input>
  15. </el-form-item>
  16. <el-form-item label="炉号">
  17. <el-input
  18. class="inline-input"
  19. v-model.number="heatNo"
  20. style="width:150px"
  21. >
  22. </el-input>
  23. </el-form-item>
  24. <el-form-item label="选择钢种">
  25. <el-select
  26. class="inline-select"
  27. v-model="type"
  28. filterable
  29. style="width:150px"
  30. >
  31. <el-option
  32. v-for="(item, index) in options1"
  33. :key="index"
  34. :label="item.value"
  35. :value="item.value"
  36. >
  37. </el-option>
  38. </el-select>
  39. </el-form-item>
  40. <el-form-item label="选择规格">
  41. <el-select
  42. class="inline-select"
  43. v-model="model"
  44. filterable
  45. style="width:150px"
  46. >
  47. <el-option
  48. v-for="(item, index) in options2"
  49. :key="index"
  50. :label="item.value"
  51. :value="item.value"
  52. >
  53. </el-option>
  54. </el-select>
  55. </el-form-item>
  56. <el-form-item label="选择班别">
  57. <el-select
  58. class="inline-select"
  59. v-model="clazz"
  60. style="width:150px"
  61. >
  62. <el-option
  63. v-for="item in options"
  64. :key="item.value"
  65. :label="item.value"
  66. :value="item.value"
  67. >
  68. </el-option>
  69. </el-select>
  70. </el-form-item>
  71. </div>
  72. <div class="top3">
  73. <el-form-item label="选择车辆">
  74. <el-select
  75. class="inline-select"
  76. v-model="capacityId"
  77. style="width:150px"
  78. >
  79. <el-option
  80. v-for="item in optionsCapacity"
  81. :label="item.capacityNumber"
  82. :value="item.capacityId"
  83. :key="item.capacityId"
  84. >
  85. </el-option>
  86. </el-select>
  87. </el-form-item>
  88. <el-form-item label="当车支数">
  89. <el-input class="inline-input" v-model="count" style="width:150px">
  90. </el-input>
  91. </el-form-item>
  92. <el-form-item label="选择装货点" v-show="false">
  93. <el-select
  94. class="inline-select"
  95. v-model="loadPoint"
  96. style="width:150px"
  97. >
  98. <el-option
  99. v-for="item in optionsLoad"
  100. :key="item.warehouseId"
  101. :label="item.warehouseName"
  102. :value="item.warehouseId"
  103. >
  104. </el-option>
  105. </el-select>
  106. </el-form-item>
  107. <el-form-item label="选择卸货点">
  108. <el-select
  109. class="inline-select"
  110. v-model="unloadPoint"
  111. style="width:150px"
  112. >
  113. <el-option
  114. v-for="item in optionsUnload"
  115. :key="item.warehouseId"
  116. :label="item.warehouseName"
  117. :value="item.warehouseId"
  118. >
  119. </el-option>
  120. </el-select>
  121. </el-form-item>
  122. <el-form-item label="选择班次">
  123. <el-select
  124. class="inline-select"
  125. v-model="shift"
  126. style="width:150px"
  127. >
  128. <el-option
  129. v-for="item in optionShift"
  130. :key="item.value"
  131. :label="item.value"
  132. :value="item.value"
  133. >
  134. </el-option>
  135. </el-select>
  136. </el-form-item>
  137. </div>
  138. <div class="button-box">
  139. <el-switch
  140. v-model="isMeter"
  141. active-text="需要过磅"
  142. inactive-text="不需要过磅"
  143. >
  144. </el-switch>
  145. <el-button type="primary" @click="makeSure">保存</el-button>
  146. </div>
  147. </el-form>
  148. <div class="checkBox">
  149. <div class="checkTitle">
  150. <span>抽取区</span>
  151. </div>
  152. <div class="checkArea">
  153. <el-form class="demo-form-inline" label-width="80px" :inline="true">
  154. <el-form-item label="炉号">
  155. <el-input
  156. class="inline-input"
  157. v-model.number="checkHeatNo"
  158. style="width:150px"
  159. >
  160. </el-input>
  161. </el-form-item>
  162. <el-form-item label="抽取支数">
  163. <el-input
  164. class="inline-input"
  165. v-model.number.lazy="checkCount"
  166. style="width:150px"
  167. >
  168. </el-input>
  169. </el-form-item>
  170. <el-form-item label="抽取重量">
  171. <el-input
  172. class="inline-input"
  173. v-model.lazy="checkWeight"
  174. style="width:150px"
  175. >
  176. </el-input>
  177. </el-form-item>
  178. </el-form>
  179. <div class="checkButton">
  180. <el-button type="primary" @click="checkBillet">抽取</el-button>
  181. </div>
  182. </div>
  183. </div>
  184. </div>
  185. <div>
  186. <mergeRowTable v-bind.sync="first" ref="table" :isShowGroup="false">
  187. <el-table-column label="操作" width="80px" fixed="right">
  188. <template slot-scope="scope">
  189. <el-button type="text" @click="deleteOrder(scope)" size="mini">
  190. 删除
  191. </el-button>
  192. </template>
  193. </el-table-column>
  194. </mergeRowTable>
  195. </div>
  196. </div>
  197. </template>
  198. <script>
  199. import PageTitle from '@/components/Page/Title'
  200. import { sjTime } from '@/utils/sharedJsFile'
  201. import { getCookie } from '@/utils/util.js'
  202. import { isNumber } from '../../../ADMINISTRATORS/app'
  203. export default {
  204. components: { PageTitle },
  205. data() {
  206. return {
  207. checkWeight: null,
  208. checkCount: null,
  209. checkHeatNo: null,
  210. requireUnitId: null,
  211. requireUnitName: null,
  212. heatNo: null,
  213. requirementType: '计重',
  214. clazz: null,
  215. type: null,
  216. model: null,
  217. capacityId: null,
  218. capacityNumber: null,
  219. loadPoint: null,
  220. unloadPoint: null,
  221. count: null,
  222. shift: null,
  223. optionShift: [
  224. {
  225. value: '早'
  226. },
  227. {
  228. value: '中'
  229. },
  230. {
  231. value: '夜'
  232. }
  233. ],
  234. options: [
  235. {
  236. value: '甲'
  237. },
  238. {
  239. value: '乙'
  240. },
  241. {
  242. value: '丙'
  243. },
  244. {
  245. value: '丁'
  246. }
  247. ],
  248. options1: [
  249. {
  250. value: 'Q215'
  251. },
  252. {
  253. value: 'HPB300'
  254. },
  255. {
  256. value: 'HRB400E'
  257. },
  258. {
  259. value: 'HRB400'
  260. },
  261. {
  262. value: 'HRB500'
  263. },
  264. {
  265. value: 'HRB500E'
  266. },
  267. {
  268. value: 'HRB600'
  269. }
  270. ],
  271. options2: [
  272. {
  273. value: 'Φ16'
  274. },
  275. {
  276. value: 'Φ6.5'
  277. },
  278. {
  279. value: 'Φ6'
  280. },
  281. {
  282. value: 'Φ8'
  283. },
  284. {
  285. value: 'Φ10'
  286. },
  287. {
  288. value: 'Φ12'
  289. },
  290. {
  291. value: 'Φ14'
  292. },
  293. {
  294. value: 'Φ36'
  295. },
  296. {
  297. value: 'Φ40'
  298. }
  299. ],
  300. optionsCapacity: [],
  301. optionsLoad: [],
  302. optionsUnload: [],
  303. capacityIds: [],
  304. first: {
  305. // first请求数据的地址
  306. requestUrl: ''
  307. },
  308. isMeter: '需要过磅'
  309. }
  310. },
  311. mounted() {
  312. this.getRequireUnit()
  313. this.getLoadPoint()
  314. this.getUnloadPoint()
  315. this.getCapacity()
  316. },
  317. watch: {
  318. heatNo() {
  319. this.checkHeatNo = this.heatNo
  320. },
  321. checkHeatNo() {
  322. this.heatNo = this.checkHeatNo
  323. },
  324. count() {
  325. this.computeWeight()
  326. },
  327. singleWeight() {
  328. this.computeWeight()
  329. },
  330. checkCount() {
  331. if (
  332. !(this.checkCount < 7 && this.checkCount > 3) &&
  333. isNumber(this.checkCount)
  334. ) {
  335. this.$message.error('抽取支数不能大于7支小于4支')
  336. this.checkCount = null
  337. }
  338. }
  339. },
  340. created() {
  341. if (
  342. getCookie('orgCode') == 'dagangadmin' ||
  343. getCookie('orgCode') == 'zidonghuabu'
  344. ) {
  345. this.first.requestUrl = '/api/v1/ams/getBilletRequirementList?apiId=518'
  346. } else {
  347. this.first.requestUrl =
  348. '/api/v1/ams/getBilletRequirementList?apiId=518&orgCode=' +
  349. getCookie('orgCode')
  350. }
  351. },
  352. methods: {
  353. getRequestUrl() {
  354. if (
  355. getCookie('orgCode') == 'dagangadmin' ||
  356. getCookie('orgCode') == 'zidonghuabu'
  357. ) {
  358. this.first.requestUrl =
  359. '/api/v1/ams/getBilletRequirementList?apiId=518&i=' + new Date()
  360. } else {
  361. this.first.requestUrl =
  362. '/api/v1/ams/getBilletRequirementList?apiId=518&orgCode=' +
  363. getCookie('orgCode') +
  364. '&i=' +
  365. new Date()
  366. }
  367. },
  368. deleteOrder(scope) {
  369. let map = {
  370. orderId: scope.row.orderId,
  371. userId: getCookie('userId')
  372. }
  373. this.$confirm('是否删除?', '提示', {
  374. confirmButtonText: '确定',
  375. cancelButtonText: '取消',
  376. type: 'warning'
  377. })
  378. .then(() => {
  379. this.axios.post('/api/v1/oms/closeOmstruckOrder', map).then(res => {
  380. if (res.data.code == 200) {
  381. this.$message({
  382. type: 'success',
  383. message: '删除成功!'
  384. })
  385. this.getRequestUrl()
  386. } else {
  387. this.$message({
  388. message: '删除失败',
  389. type: 'warning'
  390. })
  391. }
  392. })
  393. })
  394. .catch(() => {
  395. this.$message({
  396. type: 'info',
  397. message: '已取消删除'
  398. })
  399. })
  400. },
  401. checkBillet() {
  402. if (this.checkWeight && this.checkCount && this.checkHeatNo) {
  403. if (this.checkWeight > 25 || this.checkWeight < 8) {
  404. this.$message.error('抽取重量不能大于25t或者小于8t')
  405. this.checkWeight = null
  406. return
  407. } else {
  408. let map = {
  409. checkWeight: this.checkWeight,
  410. checkCount: this.checkCount,
  411. checkHeatNo: this.checkHeatNo,
  412. orgCode: getCookie('orgCode')
  413. }
  414. this.axios.post('/api/v1/ams/checkBillet', map).then(res => {
  415. if (res.data.code == 200) {
  416. this.$message.success('抽取成功')
  417. this.getRequestUrl()
  418. this.checkWeight = null
  419. this.checkCount = null
  420. this.checkHeatNo = null
  421. } else if (res.data.code == '201') {
  422. this.$message.error('该炉号已抽取,不能重复抽取')
  423. this.checkWeight = null
  424. this.checkCount = null
  425. this.checkHeatNo = null
  426. } else {
  427. this.$message.error('抽取失败,请联系管理员')
  428. }
  429. })
  430. }
  431. }
  432. },
  433. resetCapacity() {
  434. this.getCapacity()
  435. },
  436. deleteRow(index) {
  437. this.selectionList.splice(index, 1)
  438. },
  439. //获取炼钢厂连铸车间
  440. getRequireUnit() {
  441. this.axios
  442. .post('/api/v1/uc/getRequireUnitName?index=炼钢厂连铸车间')
  443. .then(res => {
  444. if (res.data.code == '200') {
  445. this.requireUnitId = res.data.data[0].shipperId
  446. this.requireUnitName = res.data.data[0].shipperName
  447. }
  448. })
  449. },
  450. //查询装货点
  451. getLoadPoint() {
  452. this.axios
  453. .post('/api/v1/uc/getUnloadingMesByLike?apiId=374&index=连铸车间')
  454. .then(res => {
  455. if (res.data.code == '200') {
  456. this.optionsLoad = res.data.data.list
  457. this.loadPoint = parseInt(this.optionsLoad[0].warehouseId)
  458. }
  459. })
  460. },
  461. //查询卸货点
  462. getUnloadPoint() {
  463. this.axios
  464. .post('/api/v1/uc/getUnloadingMesByLike?apiId=374', {
  465. warehouseName: ['一棒车间', '高线车间']
  466. })
  467. .then(res => {
  468. if (res.data.code == '200') {
  469. this.optionsUnload = res.data.data.list
  470. }
  471. })
  472. },
  473. //查询车牌号
  474. getCapacity() {
  475. this.axios
  476. .post(
  477. '/api/v1/uc/getAllCapacityByCarrierLike?apiId=429&con=钢坯&carrierSsoId=1024042523359842304'
  478. )
  479. .then(res => {
  480. if (res.data.code == '200') {
  481. //过滤
  482. let arr = []
  483. // this.selectionList = res.data.data.list
  484. res.data.data.list.forEach(e => {
  485. let map = {}
  486. map.capacityNumber = e.capacityNumber
  487. map.capacityId = e.capacityId
  488. arr.push(map)
  489. })
  490. this.optionsCapacity = Array.from(arr)
  491. console.log(this.optionsCapacity)
  492. // console.log(Array.from(this.optionsCapacity))
  493. // console.log(res.data.data.list)
  494. }
  495. })
  496. },
  497. // 新增
  498. makeSure() {
  499. let capacityList = []
  500. let e = {
  501. capacityId: this.capacityId
  502. }
  503. capacityList.push(e)
  504. let map = {
  505. requirementShipperId: this.requireUnitId,
  506. heatNo: this.heatNo,
  507. requirementType: '计重',
  508. clazz: this.clazz,
  509. shift: this.shift,
  510. type: this.type,
  511. model: this.model,
  512. requirementPlatformId: this.loadPoint,
  513. requirementUnloadUnitId: this.unloadPoint,
  514. capacityList: capacityList,
  515. count: this.count,
  516. orgCode: getCookie('orgCode'),
  517. isMeter: this.isMeter
  518. }
  519. console.log('map:', map)
  520. if (
  521. !map.requirementShipperId ||
  522. !map.heatNo ||
  523. !map.requirementType ||
  524. !map.clazz ||
  525. !map.type ||
  526. !map.model ||
  527. !map.requirementPlatformId ||
  528. !map.requirementUnloadUnitId ||
  529. !map.count ||
  530. map.capacityList.length <= 0
  531. ) {
  532. this.$message.warning('每项都为必填!')
  533. return
  534. }
  535. if (!isNumber(map.count)) {
  536. this.$message.error('支数不为整数!')
  537. return
  538. } else if (map.count > 25) {
  539. this.$message.error('支数必须小于等于25支')
  540. return
  541. }
  542. //提交
  543. this.axios.post('/api/v1/ams/addBilletRequirement', map).then(res => {
  544. if (res.data.code == '200') {
  545. this.$message({
  546. type: 'success',
  547. message: '派发成功!',
  548. duration: 1000,
  549. offset: '250'
  550. })
  551. this.getRequestUrl()
  552. }
  553. })
  554. }
  555. }
  556. }
  557. </script>
  558. <style lang="scss" scoped>
  559. .inwardRequirement {
  560. .requireUnit {
  561. display: flex;
  562. justify-content: start;
  563. align-items: flex-start;
  564. margin-top: 20px;
  565. .text {
  566. display: inline-block;
  567. width: 170px;
  568. text-align: right;
  569. .input {
  570. width: 250px;
  571. margin-right: 90px;
  572. }
  573. }
  574. .top1 {
  575. margin-right: 100px;
  576. }
  577. .top4 {
  578. display: flex;
  579. justify-content: center;
  580. align-items: center;
  581. margin-top: 20px;
  582. margin-bottom: 10px;
  583. }
  584. .checkBox {
  585. height: 250px;
  586. width: 300px;
  587. background-color: aqua;
  588. border-radius: 20px;
  589. margin-bottom: 20px;
  590. .checkTitle {
  591. border: 1px solid #ffff;
  592. font-size: 20px;
  593. height: 40px;
  594. font-weight: 600;
  595. line-height: 40px;
  596. display: flex;
  597. justify-content: center;
  598. align-items: center;
  599. margin-bottom: 5px;
  600. }
  601. .checkArea {
  602. // display: flex;
  603. // justify-content: center;
  604. // align-items: center;
  605. .checkButton {
  606. display: flex;
  607. justify-content: center;
  608. align-items: flex-start;
  609. }
  610. }
  611. }
  612. .button-box {
  613. margin-top: 20px;
  614. display: flex;
  615. flex-direction: column;
  616. align-items: center;
  617. justify-content: center;
  618. .el-button {
  619. margin-top: 20px;
  620. }
  621. }
  622. }
  623. }
  624. </style>
  625. <style>
  626. .el-drawer__body {
  627. overflow: auto;
  628. }
  629. .el-drawer__container ::-webkit-scrollbar {
  630. display: none;
  631. }
  632. </style>