store-out.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  1. <template>
  2. <div class="container">
  3. <my-nav
  4. @listener-out="outHandle"
  5. @listener-helper="helperHandle"
  6. ></my-nav>
  7. <div class="content">
  8. <div class="reading" v-if="reading">
  9. 出库扫描中<br />
  10. 请下架所需要的物料<br />
  11. 并将物料推出感应门
  12. </div>
  13. <div v-else style="height: 100%">
  14. <div
  15. style="
  16. display: flex;
  17. justify-content: space-between;
  18. align-items: center;
  19. "
  20. >
  21. <div style="width: 108px"></div>
  22. <div class="title">出库扫描</div>
  23. <div style="padding: 0 10px">
  24. <Button type="primary" @click="scanShow = true"
  25. >辅助扫描</Button
  26. >
  27. </div>
  28. </div>
  29. <div class="main">
  30. <div class="list-wrap">
  31. <div class="list" style="margin-right: 20px">
  32. <div class="sub-title">领料信息</div>
  33. <div
  34. style="
  35. height: calc(100% - 46px);
  36. overflow: auto;
  37. "
  38. >
  39. <div
  40. class="row"
  41. v-for="(item, index) in data"
  42. :key="index"
  43. >
  44. <div
  45. class="col"
  46. style="width: 50px; align-items: center"
  47. >
  48. <Icon
  49. type="ios-checkmark-circle"
  50. color="red"
  51. size="18"
  52. v-if="item.checked"
  53. />
  54. </div>
  55. <div class="col" style="flex: 1">
  56. <div>{{ item.materialName }}</div>
  57. <div>
  58. 物料长度:{{ item.quantity }}米
  59. </div>
  60. </div>
  61. </div>
  62. <!-- <div
  63. class="row"
  64. v-for="(item) in newData"
  65. :key="item.id"
  66. >
  67. <div
  68. class="col"
  69. style="width: 50px; align-items: center"
  70. >
  71. <Icon
  72. type="ios-checkmark-circle"
  73. color="red"
  74. size="18"
  75. v-if="item.checked"
  76. />
  77. </div>
  78. <div class="col" style="flex: 1">
  79. <div>{{ item.materialName }}</div>
  80. <div>
  81. 物料长度:{{ item.quantity }}米
  82. </div>
  83. </div>
  84. </div> -->
  85. </div>
  86. </div>
  87. <div class="list">
  88. <div class="sub-title">本次出库</div>
  89. <div
  90. style="
  91. height: calc(100% - 46px);
  92. overflow: auto;
  93. "
  94. >
  95. <div
  96. class="row"
  97. v-for="(
  98. item, index
  99. ) in scanData.rfidTagItems"
  100. :key="index"
  101. >
  102. <div
  103. class="col"
  104. style="width: 50px; align-items: center"
  105. ></div>
  106. <div
  107. class="col"
  108. style="flex: 1; overflow: hidden"
  109. >
  110. 标签值:{{
  111. '**************' +
  112. item.rfidCode.substr(-6, 6)
  113. }}
  114. </div>
  115. <div
  116. class="col"
  117. style="flex: 1; overflow: hidden"
  118. :style="{
  119. color:
  120. item.scanRfidStatus === 1
  121. ? 'orange'
  122. : item.scanRfidStatus === 2
  123. ? 'red'
  124. : '#fff',
  125. }"
  126. >
  127. <div>{{ item.materialName }}</div>
  128. <div>
  129. 物料长度:{{ item.quantity || 0 }}米
  130. </div>
  131. </div>
  132. <div class="col" style="width: 50px">
  133. <Icon
  134. type="ios-trash"
  135. size="20"
  136. color="red"
  137. @click="del(item, index)"
  138. style="cursor: pointer"
  139. />
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. <div class="list-wrap bottom">
  146. <div class="list">
  147. <div class="sub-title">
  148. 本次统计
  149. <a
  150. class="remark"
  151. href="#"
  152. @click="remarkShow = true"
  153. >填写备注</a
  154. >
  155. </div>
  156. <div
  157. style="
  158. height: calc(100% - 46px);
  159. overflow: auto;
  160. "
  161. >
  162. <div
  163. class="row"
  164. v-for="(
  165. item, index
  166. ) in scanData.materialItems"
  167. :key="index"
  168. >
  169. <div
  170. class="col"
  171. style="flex: 3"
  172. :style="{
  173. color:
  174. item.scanRfidStatus === 1
  175. ? 'orange'
  176. : item.scanRfidStatus === 2
  177. ? 'red'
  178. : '#fff',
  179. }"
  180. >
  181. <div>{{ item.materialName }}</div>
  182. </div>
  183. <div
  184. class="col"
  185. style="flex: 2"
  186. :style="{
  187. color:
  188. item.scanRfidStatus === 1
  189. ? 'orange'
  190. : item.scanRfidStatus === 2
  191. ? 'red'
  192. : '#fff',
  193. }"
  194. >
  195. <div>
  196. 出库件数:{{ item.tagCount || 1 }}
  197. </div>
  198. </div>
  199. <div
  200. class="col"
  201. style="flex: 2"
  202. :style="{
  203. color:
  204. item.scanRfidStatus === 1
  205. ? 'orange'
  206. : item.scanRfidStatus === 2
  207. ? 'red'
  208. : '#fff',
  209. }"
  210. >
  211. <div>
  212. 出库数量:{{ item.totalQuantity }}米
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. </div>
  219. </div>
  220. <div class="footer">
  221. <Button
  222. type="error"
  223. size="large"
  224. style="margin-right: 20px"
  225. @click="pass(0)"
  226. >重新扫描</Button
  227. >
  228. <Button type="success" size="large" @click.native="copyData()"
  229. >仓管校验</Button
  230. >
  231. </div>
  232. </div>
  233. </div>
  234. <Modal
  235. v-model="modal"
  236. :mask-closable="false"
  237. :closable="false"
  238. :fullscreen="true"
  239. :footer-hide="true"
  240. >
  241. <Progress
  242. :percent="percent"
  243. :stroke-color="['#108ee9', '#87d068']"
  244. :hide-info="true"
  245. style="width: 400px"
  246. />
  247. </Modal>
  248. <Modal
  249. v-model="remarkShow"
  250. :closable="false"
  251. :footer-hide="true"
  252. class-name="vertical-center-modal"
  253. @on-cancel="cancel"
  254. >
  255. <div class="remark-content">
  256. <div class="title">填写备注</div>
  257. <Input v-model="remark" type="textarea" :rows="10" />
  258. <div class="btn">
  259. <Button @click="cfm" type="success" style="width: 120px"
  260. >确定</Button
  261. >
  262. </div>
  263. </div>
  264. </Modal>
  265. <!-- 辅助扫描 -->
  266. <Modal
  267. v-model="scanShow"
  268. class-name="vertical-center-modal"
  269. @on-cancel="cancel"
  270. >
  271. <div class="scan-title" slot="header">辅助扫描</div>
  272. <div class="scan-btn" slot="footer">
  273. <Button
  274. type="primary"
  275. style="width: 80px"
  276. @click="scanShow = false"
  277. >关闭</Button
  278. >
  279. </div>
  280. <div class="scan-content" v-if="otherData.length > 0">
  281. <div
  282. class="item"
  283. v-for="(item, index) in otherData"
  284. :key="index"
  285. >
  286. <div class="left">
  287. <div class="row">RFID标签:{{ item.rfidCode }}</div>
  288. <div class="row">物料编码:{{ item.materialCode }}</div>
  289. <div class="row">物料名称:{{ item.materialName }}</div>
  290. <div class="row">最近操作:{{ item.lastOpera }}</div>
  291. </div>
  292. <div class="right">
  293. <Button
  294. type="primary"
  295. ghost
  296. @click="add(item)"
  297. v-if="item.lastOpera.indexOf('入库') !== -1"
  298. >出库</Button
  299. >
  300. </div>
  301. </div>
  302. </div>
  303. <div v-else style="padding: 10px 0; color: #ffffff">暂无数据</div>
  304. </Modal>
  305. <!-- 仓管人脸校验 -->
  306. <Modal
  307. v-model="show"
  308. width="80%"
  309. class-name="vertical-center-modal"
  310. :footer-hide="true"
  311. >
  312. <check-modal @face-check="faceCheck"></check-modal>
  313. </Modal>
  314. </div>
  315. </template>
  316. <script>
  317. import MyNav from '@/components/my-nav'
  318. import * as signalR from '@microsoft/signalr'
  319. import withUrl from '@/config/withUrl'
  320. import { MessagePackHubProtocol } from '@microsoft/signalr-protocol-msgpack'
  321. import axios from 'axios'
  322. import {
  323. PlcStorageOut,
  324. ReScan,
  325. GetApplyTakeStockOut,
  326. GetScanRfidStocInOut,
  327. DelScanRfid,
  328. } from '@/api/integrated'
  329. import { logOut } from '@/libs/util'
  330. import CheckModal from './check-modal'
  331. export default {
  332. name: 'store-in',
  333. data() {
  334. return {
  335. scanShow: false,
  336. show: false,
  337. modal: false,
  338. percent: 0,
  339. addTimer: null,
  340. overTimer: null,
  341. data: [], // 左侧数据列表
  342. scanData: {}, // 扫描数据
  343. otherData: [], // 扫描辅助数据
  344. tempDelData: [], // 临时删除列表
  345. connection: null,
  346. reading: false,
  347. remarkShow: false,
  348. remark: '',
  349. rfidTagItemsCopy:[],
  350. newData:[],
  351. }
  352. },
  353. components: {
  354. MyNav,
  355. CheckModal,
  356. },
  357. methods: {
  358. copyData(){
  359. this.show = true
  360. this.rfidTagItemsCopy = JSON.parse(JSON.stringify(this.scanData.rfidTagItems))
  361. },
  362. add(item) {
  363. item.totalQuantity = item.qty
  364. item.quantity = item.qty
  365. // 辅助扫描的添加一个isTemp 标识以供删除区分
  366. if (
  367. this.scanData.rfidTagItems.find(
  368. (scan) => scan.materialCode === item.materialCode
  369. )
  370. ) {
  371. this.$Message.error('物料已添加')
  372. } else {
  373. this.scanData.rfidTagItems.push({ ...item, isTemp: true })
  374. this.scanData.materialItems.push({ ...item, isTemp: true })
  375. this.$Message.info('添加成功')
  376. }
  377. },
  378. cancel() {
  379. this.remark = ''
  380. },
  381. cfm() {
  382. this.remarkShow = false
  383. },
  384. faceCheck(val) {
  385. const v = this
  386. PlcStorageOut({
  387. inOutStorageNo: '',
  388. storageDoor: sessionStorage.getItem('door'),
  389. plcStationCode: sessionStorage.getItem('plcCode'),
  390. rfidList: this.rfidTagItemsCopy.map(
  391. (item) => item.rfidCode
  392. ),
  393. remark: this.remark,
  394. }).then((res) => {
  395. if (res.code === 0) {
  396. this.$Message.info('出库成功!')
  397. const actual = []
  398. for (let i = 0; i < v.scanData.rfidTagItems.length; i++) {
  399. const element = v.scanData.rfidTagItems[i];
  400. actual.push({
  401. materialCode:element.materialCode,
  402. materialRfid:element.rfidCode,
  403. quantity:element.quantity
  404. })
  405. }
  406. axios.post('/cloudApi/stockDetail/submitRestrictedPicking',{
  407. appointInfo:v.newData,
  408. actual:actual,
  409. jobNo:window.localStorage.getItem('jobNo')
  410. }).then(res=>{
  411. })
  412. logOut()
  413. }
  414. })
  415. },
  416. /* 临时删除 */
  417. del(item, index) {
  418. if (item.isTemp) {
  419. this.scanData.rfidTagItems.splice(index, 1)
  420. this.scanData.materialItems.splice(index, 1)
  421. /* 添加一个临时删除数据 用于再次扫描数据时过滤已临时删除的数据 */
  422. this.tempDelData.push(item)
  423. } else {
  424. DelScanRfid({
  425. rfid: item.rfidCode,
  426. plcStationCode: sessionStorage.getItem('plcCode'),
  427. }).then((res) => {
  428. if (res.code === 0) {
  429. this.$Message.info('删除成功!')
  430. this.tempDelData.push(item)
  431. this.getList()
  432. }
  433. })
  434. }
  435. },
  436. /* 辅助扫描通知 */
  437. helperHandle(data) {
  438. this.otherData = data
  439. },
  440. /* 出库通知 */
  441. outHandle() {
  442. this.getList()
  443. clearTimeout(this.overTimer)
  444. this.overTimer = setTimeout(() => {
  445. clearInterval(this.addTimer)
  446. this.percent = 100
  447. setTimeout(() => {
  448. this.modal = false
  449. }, 500)
  450. }, 3000)
  451. },
  452. /* 是否通过 0否 1是 */
  453. pass(type) {
  454. if (type === 0) {
  455. this.$Message.info('请重新扫描出库!')
  456. this.scanData.rfidTagItems = []
  457. this.scanData.materialItems = []
  458. ReScan({
  459. reScanType: 1,
  460. storageType: sessionStorage.getItem('plcCode'),
  461. storageDoor: sessionStorage.getItem('door'),
  462. })
  463. } else if (type === 1) {
  464. // 出库
  465. console.log('pass口子')
  466. PlcStorageOut({
  467. inOutStorageNo: '',
  468. storageDoor: sessionStorage.getItem('door'),
  469. plcStationCode: sessionStorage.getItem('plcCode'),
  470. rfidList: this.scanData.rfidTagItems.map(
  471. (item) => item.rfidCode
  472. ),
  473. remark: this.remark,
  474. }).then((res) => {
  475. if (res.code === 0) {
  476. this.$Message.info('出库成功!')
  477. logOut()
  478. }
  479. })
  480. }
  481. },
  482. getList() {
  483. GetScanRfidStocInOut({
  484. storagePlcCode: sessionStorage.getItem('plcCode'),
  485. stockInOutScanType: 1,
  486. }).then((scanRes) => {
  487. if (scanRes.code === 0) {
  488. this.reading = false
  489. this.scanData = { ...scanRes.result }
  490. /* 临时删除的数据不可再添加到出入库列表中 */
  491. this.tempDelData.forEach((temp) => {
  492. for (const index in this.scanData.rfidTagItems) {
  493. if (
  494. temp.rfidCode ===
  495. this.scanData.rfidTagItems[index].rfidCode
  496. ) {
  497. this.scanData.rfidTagItems.splice(index, 1)
  498. }
  499. }
  500. for (const index in this.scanData.materialItems) {
  501. if (
  502. temp.rfidCode ===
  503. this.scanData.materialItems[index].rfidCode
  504. ) {
  505. this.scanData.materialItems.splice(index, 1)
  506. }
  507. }
  508. })
  509. /* 勾选左侧列表通过扫描到的数据 */
  510. this.data.forEach((item) => {
  511. this.scanData.rfidTagItems.forEach((scan) => {
  512. if (item.materialCode === scan.materialCode) {
  513. item.checked = true
  514. }
  515. })
  516. })
  517. }
  518. })
  519. },
  520. /* 左侧列表 */
  521. getApplyTakeStockOut() {
  522. GetApplyTakeStockOut().then((res) => {
  523. if (res.code === 0) {
  524. this.data = res.result
  525. }
  526. })
  527. },
  528. },
  529. mounted() {
  530. this.otherData = JSON.parse(this.$route.query.otherData)
  531. this.newData = JSON.parse(this.$route.query.newData)
  532. console.log(JSON.parse(this.$route.query.newData))
  533. this.tempDelData = []
  534. this.getApplyTakeStockOut()
  535. this.getList()
  536. this.time = this.$dayjs().format('YYYY年MM月DD日 HH:mm')
  537. this.timer = setInterval(() => {
  538. this.time = this.$dayjs().format('YYYY年MM月DD日 HH:mm')
  539. }, 1000)
  540. this.addTimer = setInterval(() => {
  541. this.percent += 1
  542. if (this.percent === 100) {
  543. clearInterval(this.addTimer)
  544. clearTimeout(this.overTimer)
  545. this.modal = false
  546. }
  547. }, 100)
  548. this.overTimer = setTimeout(() => {
  549. clearInterval(this.addTimer)
  550. this.percent = 100
  551. setTimeout(() => {
  552. this.modal = false
  553. }, 500)
  554. }, 3000)
  555. },
  556. destroyed() {
  557. clearInterval(this.timer)
  558. },
  559. }
  560. </script>
  561. <style lang="scss" scoped>
  562. .container {
  563. width: 100vw;
  564. height: 100vh;
  565. overflow: auto;
  566. //background: rgba(2, 125, 180, 1);
  567. background-image: linear-gradient(
  568. 270deg,
  569. #2c3034 0%,
  570. #50575e 49%,
  571. #2c3034 100%
  572. );
  573. .content {
  574. margin: 10px;
  575. height: calc(100% - 121.6px);
  576. overflow: hidden;
  577. box-sizing: border-box;
  578. //background: rgba(1, 84, 120, 1);
  579. border-radius: 10px;
  580. .reading {
  581. height: 100%;
  582. display: flex;
  583. align-items: center;
  584. justify-content: center;
  585. font-size: 36px;
  586. font-weight: bold;
  587. color: #00ffff;
  588. }
  589. .title {
  590. padding-bottom: 10px;
  591. text-align: center;
  592. font-size: 36px;
  593. font-weight: bold;
  594. color: #2dc57c;
  595. }
  596. .main {
  597. height: calc(100% - 113.6px);
  598. display: flex;
  599. flex-direction: column;
  600. .list-wrap {
  601. flex: 2;
  602. overflow: hidden;
  603. padding: 0 10px;
  604. width: 100%;
  605. display: flex;
  606. justify-content: space-between;
  607. align-items: center;
  608. .list {
  609. position: relative;
  610. //padding: 0 10px;
  611. flex: 1;
  612. height: 100%;
  613. overflow: hidden;
  614. //background: rgba(2, 125, 180, 0.486274509803922);
  615. background: #2c3034;
  616. border-radius: 4px;
  617. border: solid 1px #3879e7;
  618. .sub-title {
  619. position: relative;
  620. padding: 5px 0;
  621. font-size: 24px;
  622. color: #0077ff;
  623. font-weight: bold;
  624. .remark {
  625. position: absolute;
  626. right: 10px;
  627. top: 50%;
  628. transform: translateY(-50%);
  629. font-size: 16px;
  630. font-weight: normal;
  631. color: #0077ff;
  632. }
  633. }
  634. .row {
  635. padding: 5px 0;
  636. display: flex;
  637. justify-content: space-between;
  638. align-items: center;
  639. //background: rgba(2, 167, 240, 1);
  640. border-top: 1px solid #2655ad;
  641. //border-radius: 5px;
  642. &:last-child {
  643. border-bottom: 1px solid #2655ad;
  644. }
  645. .col {
  646. padding: 0 5px;
  647. display: flex;
  648. flex-direction: column;
  649. align-items: flex-start;
  650. justify-content: center;
  651. text-align: left;
  652. color: #ffffff;
  653. }
  654. }
  655. .total {
  656. padding: 5px 10px;
  657. //position: absolute;
  658. left: 0;
  659. bottom: 0;
  660. text-align: left;
  661. font-size: 20px;
  662. font-weight: bold;
  663. color: #f59a23;
  664. .top {
  665. font-size: 24px;
  666. }
  667. .label {
  668. margin-left: 40px;
  669. display: inline-block;
  670. width: 100px;
  671. }
  672. }
  673. }
  674. }
  675. .bottom {
  676. margin-top: 20px;
  677. flex: 1;
  678. .row {
  679. border: none !important;
  680. }
  681. .col {
  682. padding: 0 20px !important;
  683. }
  684. }
  685. }
  686. .footer {
  687. padding: 10px 0;
  688. padding-bottom: 0;
  689. /deep/ .ivu-btn-large {
  690. border-radius: 20px;
  691. font-weight: bold;
  692. width: 150px;
  693. }
  694. }
  695. }
  696. }
  697. /deep/.ivu-modal-content {
  698. background: #2c3034;
  699. }
  700. /deep/.ivu-modal-body {
  701. display: flex;
  702. align-items: center;
  703. justify-content: center;
  704. padding: 0;
  705. }
  706. /deep/.remark-content {
  707. padding: 16px;
  708. width: 100%;
  709. .title {
  710. font-size: 24px;
  711. font-weight: bold;
  712. text-align: center;
  713. color: #ffffff;
  714. padding-bottom: 10px;
  715. }
  716. .btn {
  717. text-align: center;
  718. padding-top: 10px;
  719. }
  720. }
  721. /deep/ .ivu-modal-header {
  722. border-bottom: none;
  723. }
  724. /deep/ .ivu-modal-footer {
  725. border-top: none;
  726. }
  727. .scan-title {
  728. font-size: 18px;
  729. font-weight: bold;
  730. color: #ffffff;
  731. }
  732. .scan-btn {
  733. text-align: center;
  734. }
  735. .scan-content {
  736. padding: 10px 16px;
  737. width: 100%;
  738. max-height: 40vh;
  739. overflow: auto;
  740. background-color: #3d3d3d;
  741. color: #ffffff;
  742. .item {
  743. margin-bottom: 5px;
  744. border-bottom: 1px solid #ffffff;
  745. display: flex;
  746. justify-content: space-between;
  747. align-items: center;
  748. &:last-child {
  749. margin-bottom: 0;
  750. border-bottom: none;
  751. }
  752. .left {
  753. flex: 1;
  754. overflow: hidden;
  755. }
  756. .right {
  757. width: 60px;
  758. /deep/ .ivu-btn-primary {
  759. background-color: rgb(204, 228, 255);
  760. }
  761. }
  762. .row {
  763. margin-bottom: 5px;
  764. word-break: break-all;
  765. }
  766. }
  767. }
  768. </style>