addInwardBillet.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  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 class="query">
  186. <el-divider></el-divider>
  187. <el-form :inline="true">
  188. <el-form-item>
  189. <label class="el-form-item__label" style="width: auto;"
  190. >发坯日期:</label
  191. >
  192. <el-date-picker
  193. v-model="startTime"
  194. type="date"
  195. placeholder="开始日期"
  196. style="width:150px"
  197. >
  198. </el-date-picker>
  199. <span>至</span>
  200. <el-date-picker
  201. v-model="endTime"
  202. type="date"
  203. placeholder="结束日期"
  204. style="width:150px"
  205. >
  206. </el-date-picker>
  207. </el-form-item>
  208. <el-form-item label="班别" style="margin-left:10px">
  209. <el-select
  210. class="inline-select"
  211. v-model="clazz"
  212. style="width:150px"
  213. clearable
  214. >
  215. <el-option
  216. v-for="item in options"
  217. :key="item.value"
  218. :label="item.value"
  219. :value="item.value"
  220. >
  221. </el-option>
  222. </el-select>
  223. </el-form-item>
  224. <el-form-item label="班次" style="margin-left:10px">
  225. <el-select
  226. class="inline-select"
  227. v-model="shift"
  228. style="width:150px"
  229. clearable
  230. >
  231. <el-option
  232. v-for="item in optionShift"
  233. :key="item.value"
  234. :label="item.value"
  235. :value="item.value"
  236. >
  237. </el-option>
  238. </el-select>
  239. </el-form-item>
  240. <el-form-item label="卸货点">
  241. <el-select
  242. class="inline-select"
  243. v-model="queryPoint"
  244. style="width:150px"
  245. >
  246. <el-option
  247. v-for="item in optionWarehouse"
  248. :key="item.value"
  249. :label="item.value"
  250. :value="item.value"
  251. >
  252. </el-option>
  253. </el-select>
  254. </el-form-item>
  255. <el-form-item label="炉号" style="margin-left:10px">
  256. <el-input
  257. v-model="queryHeatNo"
  258. style="width:250px"
  259. clearable
  260. ></el-input>
  261. </el-form-item>
  262. <el-form-item
  263. ><el-button type="primary" class="btn" @click="onclick">
  264. <i class="el-icon-search"></i> </el-button
  265. ></el-form-item>
  266. </el-form>
  267. </div>
  268. <div class="table">
  269. <mergeRowTable v-bind.sync="first" ref="table" :isShowGroup="false">
  270. <el-table-column label="操作" width="80px" fixed="right">
  271. <template slot-scope="scope">
  272. <el-button
  273. type="text"
  274. @click="deleteOrder(scope)"
  275. size="mini"
  276. v-if="scope.row.orderStatus != '已收货'"
  277. >
  278. 删除
  279. </el-button>
  280. </template>
  281. </el-table-column>
  282. </mergeRowTable>
  283. </div>
  284. </div>
  285. </template>
  286. <script>
  287. import PageTitle from '@/components/Page/Title'
  288. import { sjTime } from '@/utils/sharedJsFile'
  289. import { getCookie } from '@/utils/util.js'
  290. import { isNumber } from '@/utils/sharedJsFile'
  291. export default {
  292. components: { PageTitle },
  293. data() {
  294. return {
  295. queryPoint: null,
  296. queryHeatNo: null,
  297. startTime: null,
  298. endTime: null,
  299. checkWeight: null,
  300. checkCount: null,
  301. checkHeatNo: null,
  302. requireUnitId: null,
  303. requireUnitName: null,
  304. heatNo: null,
  305. requirementType: '计重',
  306. clazz: null,
  307. type: null,
  308. model: null,
  309. capacityId: null,
  310. capacityNumber: null,
  311. loadPoint: null,
  312. unloadPoint: null,
  313. count: null,
  314. shift: null,
  315. optionShift: [
  316. {
  317. value: '早'
  318. },
  319. {
  320. value: '中'
  321. },
  322. {
  323. value: '夜'
  324. }
  325. ],
  326. optionWarehouse: [
  327. {
  328. value: '轧钢厂-一棒车间'
  329. },
  330. {
  331. value: '轧钢厂-高线车间'
  332. }
  333. ],
  334. options: [
  335. {
  336. value: '甲'
  337. },
  338. {
  339. value: '乙'
  340. },
  341. {
  342. value: '丙'
  343. },
  344. {
  345. value: '丁'
  346. }
  347. ],
  348. options1: [
  349. {
  350. value: 'Q215'
  351. },
  352. {
  353. value: 'HPB300'
  354. },
  355. {
  356. value: 'HRB400E'
  357. },
  358. {
  359. value: 'HRB400'
  360. },
  361. {
  362. value: 'HRB500'
  363. },
  364. {
  365. value: 'HRB500E'
  366. },
  367. {
  368. value: 'HRB600'
  369. }
  370. ],
  371. options2: [
  372. {
  373. value: 'Φ16'
  374. },
  375. {
  376. value: 'Φ6.5'
  377. },
  378. {
  379. value: 'Φ6'
  380. },
  381. {
  382. value: 'Φ8'
  383. },
  384. {
  385. value: 'Φ10'
  386. },
  387. {
  388. value: 'Φ12'
  389. },
  390. {
  391. value: 'Φ14'
  392. },
  393. {
  394. value: 'Φ36'
  395. },
  396. {
  397. value: 'Φ40'
  398. }
  399. ],
  400. optionsCapacity: [],
  401. optionsLoad: [],
  402. optionsUnload: [],
  403. capacityIds: [],
  404. first: {
  405. // first请求数据的地址
  406. requestUrl: '',
  407. requestQuery: {}
  408. },
  409. isMeter: '需要过磅'
  410. }
  411. },
  412. mounted() {
  413. this.getRequireUnit()
  414. this.getLoadPoint()
  415. this.getUnloadPoint()
  416. this.getCapacity()
  417. },
  418. watch: {
  419. heatNo() {
  420. this.checkHeatNo = this.heatNo
  421. },
  422. checkHeatNo() {
  423. this.heatNo = this.checkHeatNo
  424. },
  425. count() {
  426. this.computeWeight()
  427. },
  428. singleWeight() {
  429. this.computeWeight()
  430. },
  431. checkCount() {
  432. if (
  433. !(this.checkCount < 7 && this.checkCount > 3) &&
  434. isNumber(this.checkCount)
  435. ) {
  436. this.$message.error('抽取支数不能大于7支小于4支')
  437. this.checkCount = null
  438. }
  439. }
  440. },
  441. created() {
  442. if (
  443. getCookie('orgCode') == 'dagangadmin' ||
  444. getCookie('orgCode') == 'zidonghuabu'
  445. ) {
  446. this.first.requestUrl = '/api/v1/ams/getBilletRequirementList?apiId=518'
  447. } else {
  448. this.first.requestUrl =
  449. '/api/v1/ams/getBilletRequirementList?apiId=518&orgCode=' +
  450. getCookie('orgCode')
  451. }
  452. },
  453. methods: {
  454. onclick() {
  455. let startTime = null
  456. let endTime = null
  457. let obj = {}
  458. if (this.startTime && this.endTime) {
  459. startTime = sjTime(this.startTime)
  460. endTime = sjTime(this.endTime)
  461. }
  462. if (this.clazz) {
  463. obj.clazz = `%${this.clazz}%`
  464. }
  465. if (this.shift) {
  466. obj.shift = `%${this.shift}%`
  467. }
  468. if (this.queryHeatNo) {
  469. obj.queryHeatNo = `%${this.queryHeatNo}%`
  470. }
  471. if (this.queryPoint) {
  472. obj.queryPoint = `%${this.queryPoint}%`
  473. }
  474. this.first.requestQuery = obj
  475. this.first.requestUrl =
  476. '/api/v1/ams/getBilletRequirementList?apiId=518&startTime=' +
  477. startTime +
  478. '&endTime=' +
  479. endTime +
  480. '&i=' +
  481. new Date()
  482. },
  483. getRequestUrl() {
  484. if (
  485. getCookie('orgCode') == 'dagangadmin' ||
  486. getCookie('orgCode') == 'zidonghuabu'
  487. ) {
  488. this.first.requestUrl =
  489. '/api/v1/ams/getBilletRequirementList?apiId=518&i=' + new Date()
  490. } else {
  491. this.first.requestUrl =
  492. '/api/v1/ams/getBilletRequirementList?apiId=518&orgCode=' +
  493. getCookie('orgCode') +
  494. '&i=' +
  495. new Date()
  496. }
  497. },
  498. deleteOrder(scope) {
  499. let map = {
  500. orderId: scope.row.orderId,
  501. userId: getCookie('userId')
  502. }
  503. this.$confirm('是否删除?', '提示', {
  504. confirmButtonText: '确定',
  505. cancelButtonText: '取消',
  506. type: 'warning'
  507. })
  508. .then(() => {
  509. this.axios.post('/api/v1/oms/closeOmstruckOrder', map).then(res => {
  510. if (res.data.code == 200) {
  511. this.$message({
  512. type: 'success',
  513. message: '删除成功!'
  514. })
  515. this.getRequestUrl()
  516. } else {
  517. this.$message({
  518. message: '删除失败',
  519. type: 'warning'
  520. })
  521. }
  522. })
  523. })
  524. .catch(() => {
  525. this.$message({
  526. type: 'info',
  527. message: '已取消删除'
  528. })
  529. })
  530. },
  531. checkBillet() {
  532. if (this.checkWeight && this.checkCount && this.checkHeatNo) {
  533. if (this.checkWeight > 25 || this.checkWeight < 8) {
  534. this.$message.error('抽取重量不能大于25t或者小于8t')
  535. this.checkWeight = null
  536. return
  537. } else {
  538. let map = {
  539. checkWeight: this.checkWeight,
  540. checkCount: this.checkCount,
  541. checkHeatNo: this.checkHeatNo,
  542. orgCode: getCookie('orgCode')
  543. }
  544. this.axios.post('/api/v1/ams/checkBillet', map).then(res => {
  545. if (res.data.code == 200) {
  546. this.$message.success('抽取成功')
  547. this.getRequestUrl()
  548. this.checkWeight = null
  549. this.checkCount = null
  550. this.checkHeatNo = null
  551. } else if (res.data.code == '201') {
  552. this.$message.error('该炉号已抽取,不能重复抽取')
  553. this.checkWeight = null
  554. this.checkCount = null
  555. this.checkHeatNo = null
  556. } else {
  557. this.$message.error('抽取失败,请联系管理员')
  558. }
  559. })
  560. }
  561. }
  562. },
  563. resetCapacity() {
  564. this.getCapacity()
  565. },
  566. deleteRow(index) {
  567. this.selectionList.splice(index, 1)
  568. },
  569. //获取炼钢厂连铸车间
  570. getRequireUnit() {
  571. this.axios
  572. .post('/api/v1/uc/getRequireUnitName?index=炼钢厂连铸车间')
  573. .then(res => {
  574. if (res.data.code == '200') {
  575. this.requireUnitId = res.data.data[0].shipperId
  576. this.requireUnitName = res.data.data[0].shipperName
  577. }
  578. })
  579. },
  580. //查询装货点
  581. getLoadPoint() {
  582. this.axios
  583. .post('/api/v1/uc/getUnloadingMesByLike?apiId=374&index=连铸车间')
  584. .then(res => {
  585. if (res.data.code == '200') {
  586. this.optionsLoad = res.data.data.list
  587. this.loadPoint = parseInt(this.optionsLoad[0].warehouseId)
  588. }
  589. })
  590. },
  591. //查询卸货点
  592. getUnloadPoint() {
  593. this.axios
  594. .post('/api/v1/uc/getUnloadingMesByLike?apiId=374', {
  595. warehouseName: ['一棒车间', '高线车间']
  596. })
  597. .then(res => {
  598. if (res.data.code == '200') {
  599. this.optionsUnload = res.data.data.list
  600. }
  601. })
  602. },
  603. //查询车牌号
  604. getCapacity() {
  605. this.axios
  606. .post(
  607. '/api/v1/uc/getAllCapacityByCarrierLike?apiId=429&con=钢坯&carrierSsoId=1024042523359842304'
  608. )
  609. .then(res => {
  610. if (res.data.code == '200') {
  611. //过滤
  612. let arr = []
  613. // this.selectionList = res.data.data.list
  614. res.data.data.list.forEach(e => {
  615. let map = {}
  616. map.capacityNumber = e.capacityNumber
  617. map.capacityId = e.capacityId
  618. arr.push(map)
  619. })
  620. this.optionsCapacity = Array.from(arr)
  621. console.log(this.optionsCapacity)
  622. // console.log(Array.from(this.optionsCapacity))
  623. // console.log(res.data.data.list)
  624. }
  625. })
  626. },
  627. // 新增
  628. makeSure() {
  629. let capacityList = []
  630. let e = {
  631. capacityId: this.capacityId
  632. }
  633. capacityList.push(e)
  634. let map = {
  635. requirementShipperId: this.requireUnitId,
  636. heatNo: this.heatNo,
  637. requirementType: '计重',
  638. clazz: this.clazz,
  639. shift: this.shift,
  640. type: this.type,
  641. model: this.model,
  642. requirementPlatformId: this.loadPoint,
  643. requirementUnloadUnitId: this.unloadPoint,
  644. capacityList: capacityList,
  645. count: this.count,
  646. orgCode: getCookie('userId'),
  647. isMeter: this.isMeter
  648. }
  649. console.log('map:', map)
  650. if (
  651. !map.requirementShipperId ||
  652. !map.heatNo ||
  653. !map.requirementType ||
  654. !map.clazz ||
  655. !map.type ||
  656. !map.model ||
  657. !map.requirementPlatformId ||
  658. !map.requirementUnloadUnitId ||
  659. !map.count ||
  660. map.capacityList.length <= 0
  661. ) {
  662. this.$message.warning('每项都为必填!')
  663. return
  664. }
  665. if (!isNumber(map.count)) {
  666. this.$message.error('支数不为整数!')
  667. return
  668. } else if (map.count > 25) {
  669. this.$message.error('支数必须小于等于25支')
  670. return
  671. }
  672. //提交
  673. this.axios.post('/api/v1/ams/addBilletRequirement', map).then(res => {
  674. if (res.data.code == '200') {
  675. this.$message({
  676. type: 'success',
  677. message: '派发成功!',
  678. duration: 1000,
  679. offset: '250'
  680. })
  681. this.getRequestUrl()
  682. }
  683. })
  684. }
  685. }
  686. }
  687. </script>
  688. <style lang="scss" scoped>
  689. .inwardRequirement {
  690. .requireUnit {
  691. display: flex;
  692. justify-content: start;
  693. align-items: flex-start;
  694. margin-top: 20px;
  695. .text {
  696. display: inline-block;
  697. width: 170px;
  698. text-align: right;
  699. .input {
  700. width: 250px;
  701. margin-right: 90px;
  702. }
  703. }
  704. .top1 {
  705. margin-right: 100px;
  706. }
  707. .top4 {
  708. display: flex;
  709. justify-content: center;
  710. align-items: center;
  711. margin-top: 20px;
  712. margin-bottom: 10px;
  713. }
  714. .checkBox {
  715. height: 250px;
  716. width: 300px;
  717. background-color: aqua;
  718. border-radius: 20px;
  719. margin-bottom: 20px;
  720. .checkTitle {
  721. border: 1px solid #ffff;
  722. font-size: 20px;
  723. height: 40px;
  724. font-weight: 600;
  725. line-height: 40px;
  726. display: flex;
  727. justify-content: center;
  728. align-items: center;
  729. margin-bottom: 5px;
  730. }
  731. .checkArea {
  732. // display: flex;
  733. // justify-content: center;
  734. // align-items: center;
  735. .checkButton {
  736. display: flex;
  737. justify-content: center;
  738. align-items: flex-start;
  739. }
  740. }
  741. }
  742. .button-box {
  743. margin-top: 20px;
  744. display: flex;
  745. flex-direction: column;
  746. align-items: center;
  747. justify-content: center;
  748. .el-button {
  749. margin-top: 20px;
  750. }
  751. }
  752. }
  753. .query {
  754. margin-left: 10px;
  755. }
  756. .table {
  757. margin-left: 10px;
  758. }
  759. }
  760. </style>
  761. <style>
  762. .el-drawer__body {
  763. overflow: auto;
  764. }
  765. .el-drawer__container ::-webkit-scrollbar {
  766. display: none;
  767. }
  768. </style>