addInwardBillet.vue 19 KB

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