user-check-scan-old.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <!-- 每日盘点扫描 -->
  2. <template>
  3. <view class="container-wrap">
  4. <uni-nav-bar :title="isReading ? '扫描中' : '扫描结果'" :status-bar="true" background-color="#3F92F9" color="#FFF">
  5. <view slot="left">
  6. <u-icon name="account-fill" color="#FFF" size="35"></u-icon>
  7. <span style="padding: 0 5rpx;color: #FFFFFF;">{{ userInfo.name }}</span>
  8. </view>
  9. <view slot="right" @tap="$utils.back()">
  10. <span style="color: #FFFFFF;">返回</span>
  11. </view>
  12. </uni-nav-bar>
  13. <view class="container">
  14. <!-- 扫描到RFID标签时,打开质检结果 -->
  15. <view v-if="!isReading" class="info">
  16. <view class="row flex-start">
  17. <view class="col">
  18. <view class="label">
  19. 物料类型:
  20. </view>
  21. <view class="value">
  22. {{ data.materialType }}
  23. </view>
  24. </view>
  25. <view class="col">
  26. <view class="label">
  27. 标签编码:
  28. </view>
  29. <view class="value">
  30. {{ data.materialCode }}
  31. </view>
  32. </view>
  33. </view>
  34. <view class="row flex-start">
  35. <view class="col">
  36. <view class="label">
  37. 物料名称:
  38. </view>
  39. <view class="value">
  40. {{ data.materialName }}
  41. </view>
  42. </view>
  43. </view>
  44. <view class="row flex-start">
  45. <view class="col">
  46. <view class="label">
  47. 所在仓库:
  48. </view>
  49. <view class="value">
  50. {{ data.saveHouse }}
  51. </view>
  52. </view>
  53. <view class="col">
  54. <view class="label">
  55. 放置区域:
  56. </view>
  57. <view class="value">
  58. {{ data.stockArea }}
  59. </view>
  60. </view>
  61. </view>
  62. <view class="row flex-start">
  63. <view class="col">
  64. <view class="label">
  65. 库存件数:
  66. </view>
  67. <view class="value">
  68. {{ data.tagNum }}
  69. </view>
  70. </view>
  71. <view class="col">
  72. <view class="label">
  73. 库存数量:
  74. </view>
  75. <view class="value">
  76. {{ data.quantity }}
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <!-- 扫描rfid -->
  82. <view class="reading">
  83. <u-image height="200rpx" mode="aspectFit" src="../../../static/images/rfid.png"></u-image>
  84. <view class="title" v-if="isReading">扫描中...</view>
  85. <view class="title" v-if="!isReading">批量扫描中...</view>
  86. </view>
  87. <!-- 扫描列表 -->
  88. <view class="info bottom-list" style="background-color: #FFFFFF;" v-if="scanResult.rfidItems">
  89. <view class="row" v-for="(item, index) in scanResult.rfidItems" :key="index">
  90. <view class="col" style="flex: 3;overflow: hidden;">
  91. <view class="label" style="width: 120rpx;">标签值:</view>
  92. <view class="value">{{ item.rfidCode }}</view>
  93. </view>
  94. <view class="col" style="flex: 1;">
  95. <view class="label">物料数量:</view>
  96. <view class="value">{{ item.quantity }}</view>
  97. </view>
  98. </view>
  99. </view>
  100. <view class="info bottom-total">
  101. <view class="row">
  102. <view class="col">
  103. <view class="label">盘点件数:</view>
  104. <view class="value">{{ scanResult.tagNum }}</view>
  105. </view>
  106. <view class="col">
  107. <view class="label">盘点数量:</view>
  108. <view class="value">{{ scanResult.quantity }}</view>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. <view class="btn">
  114. <my-fixed-button :customClick="true" @click="show = true" text="结束扫描"></my-fixed-button>
  115. <!-- 选择物流 -->
  116. <my-dialog :showDialog="show" :btnStyle="btnStyle" :title="data.materialName" @cancelClick="cancel"
  117. @cfmClick="over">
  118. <view slot="content" style="width: 100%;padding: 0 40rpx;">
  119. <u-form label-width="130rpx">
  120. <u-form-item class="remark-label" label="库存数量:" :border-bottom="false">
  121. <view class="row" style="justify-content: space-between;width: 100%;">
  122. <view>{{ data.quantity }}</view>
  123. <view style="font-size: 38rpx;">扫描数量:{{ data.checkQuantity }}</view>
  124. </view>
  125. </u-form-item>
  126. <u-form-item class="remark-label" label="盘点数量:" :border-bottom="false">
  127. <view class="row">
  128. <u-input v-model="handQty" :border="true" @focus="qtyFocus" @blur="qtyBlur"/>
  129. <view
  130. style="width: 120rpx;padding: 0 10rpx;color: #007AFF;"
  131. :style="{ color: (data.quantity == handQty ? '#007AFF' : '#FA3534') }"
  132. >
  133. {{ data.quantity == handQty ? '一致' : '不一致' }}
  134. </view>
  135. </view>
  136. </u-form-item>
  137. <u-form-item class="remark-label" label="库存卷数:" :border-bottom="false">
  138. <view class="row" style="justify-content: space-between;width: 100%;">
  139. <view>{{ data.tagNum }}</view>
  140. <view style="font-size: 38rpx;">扫描件数:{{ data.checkTagNum }}</view>
  141. </view>
  142. </u-form-item>
  143. <u-form-item class="remark-label" label="盘点卷数:" :border-bottom="false">
  144. <view class="row">
  145. <u-input v-model="handTagQty" :border="true" @focus="tagFocus" @blur="tagBlur" />
  146. <view
  147. style="width: 120rpx;padding: 0 10rpx;color: #007AFF;"
  148. :style="{ color: (data.tagNum == handTagQty ? '#007AFF' : '#FA3534') }"
  149. >
  150. {{ data.tagNum == handTagQty ? '一致' : '不一致' }}
  151. </view>
  152. </view>
  153. </u-form-item>
  154. </u-form>
  155. </view>
  156. </my-dialog>
  157. </view>
  158. </view>
  159. </template>
  160. <script>
  161. const uhf = uni.requireNativePlugin('js-uhf');
  162. export default {
  163. data() {
  164. return {
  165. handQty: '',
  166. handTagQty: '',
  167. btnStyle: {
  168. },
  169. show: false,
  170. scanResult: {},
  171. timer: null,
  172. rfidCodeList: [],
  173. quantity: 0,
  174. isReading: false,
  175. data: {},
  176. rfidCode: ''
  177. };
  178. },
  179. methods: {
  180. qtyFocus () {
  181. this.handQty = ''
  182. },
  183. qtyBlur() {
  184. !this.handQty && (this.handQty = this.data.quantity)
  185. },
  186. tagFocus () {
  187. this.handTagQty = ''
  188. },
  189. tagBlur() {
  190. !this.handTagQty && (this.handTagQty = this.data.tagNum)
  191. },
  192. cancel () {
  193. this.handQty = ''
  194. this.handTagQty = ''
  195. this.show = false
  196. },
  197. showModal () {
  198. this.show = true
  199. },
  200. over() {
  201. if(!this.handTagQty) {
  202. return this.$msg.showToast('请输入卷数!')
  203. }
  204. this.$http.CompleteEveryDayBatchCheck({
  205. materialCode: this.data.materialCode,
  206. stockHouseId: this.data.stockHouseId,
  207. rfidItems: this.rfidCodeList,
  208. handTagQty: this.handTagQty,
  209. handQty: this.handQty
  210. }).then(res => {
  211. console.log(res)
  212. if(res.code === 0) {
  213. this.cancel()
  214. this.$utils.back()
  215. uni.$emit('getlist')
  216. }
  217. })
  218. },
  219. back() {
  220. this.$utils.back()
  221. },
  222. bind() {
  223. this.$http.RfidCompleteCheck({
  224. rfidCode: this.rfidCode,
  225. quantity: this.quantity,
  226. type: 2
  227. }).then(res => {
  228. if(res.code === 0) {
  229. this.$msg.showToast(res.msg || '操作成功!')
  230. uni.$emit('getlist')
  231. this.isReading = true
  232. this.scanRfid()
  233. } else {
  234. this.isReading = true
  235. this.scanRfid()
  236. }
  237. })
  238. },
  239. /* 退货申请 */
  240. returnOrder() {
  241. this.$utils.open('/pages/store-out-manage/return-apply/return-apply')
  242. },
  243. /* rfid获取绑定物料信息 */
  244. getList() {
  245. this.$http.ScanRfidCodeStockTag({
  246. rfidCode: this.rfidCode,
  247. checkRfidType: 1
  248. }).then(res => {
  249. console.log(res)
  250. if(res.code === 0) {
  251. this.isReading = false
  252. this.data = res.result
  253. // this.quantity = this.data.quantity
  254. this.handQty = this.data.quantity
  255. this.handTagQty = this.data.tagNum
  256. } else {
  257. this.isReading = true
  258. setTimeout(() => {
  259. this.scanRfid()
  260. }, 1000)
  261. }
  262. })
  263. },
  264. handleList (list) {
  265. list.forEach(item => {
  266. if (this.rfidCodeList.indexOf(item.epc) == -1) {
  267. this.rfidCodeList.push(item.epc)
  268. }
  269. })
  270. },
  271. scanRfid () {
  272. uhf.starts({}, res => {
  273. // console.log(res)
  274. if(res.data[0]) {
  275. if(this.rfidCodeList.length === 0) {
  276. this.rfidCodeList.push(res.data[0].epc)
  277. } else {
  278. this.handleList(res.data)
  279. }
  280. }
  281. })
  282. this.timer = setInterval(() => {
  283. this.$http.GetEveryDayCheckRfid({
  284. materialCode: this.data.materialCode,
  285. stockHouseId: this.data.stockHouseId,
  286. rfidItems: this.rfidCodeList,
  287. isUnShowLoading: true
  288. }).then(res => {
  289. // console.log(res)
  290. if(res.code === 0) {
  291. this.scanResult = res.result
  292. }
  293. })
  294. }, 1000)
  295. }
  296. },
  297. onLoad(option) {
  298. this.data = JSON.parse(option.data)
  299. this.handQty = this.data.quantity
  300. this.handTagQty = this.data.tagNum
  301. this.scanRfid()
  302. },
  303. onUnload() {
  304. this.$pda.uhfStops()
  305. clearInterval(this.timer)
  306. }
  307. }
  308. </script>
  309. <style lang="scss" scoped>
  310. .container-wrap {
  311. overflow: hidden;
  312. .container {
  313. padding: 0 10rpx;
  314. height: calc(100vh - var(--status-bar-height) - 44px);
  315. overflow: hidden;
  316. display: flex;
  317. flex-direction: column;
  318. padding-bottom: 80rpx;
  319. .title {
  320. font-size: 36rpx;
  321. font-weight: bold;
  322. text-align: center;
  323. }
  324. .reading {
  325. padding: 40rpx 0;
  326. }
  327. .info {
  328. padding: 20rpx 60rpx;
  329. border-radius: 10rpx ;
  330. .row {
  331. align-items: flex-start;
  332. .label {
  333. font-size: 28rpx;
  334. width: 140rpx;
  335. }
  336. .value {
  337. font-size: 28rpx;
  338. flex: 1;
  339. overflow: hidden;
  340. word-wrap: break-word;
  341. }
  342. }
  343. }
  344. .bottom-list {
  345. flex: 1;
  346. overflow: auto;
  347. }
  348. .btn {
  349. height: 180rpx;
  350. .row {
  351. padding: 0;
  352. padding-bottom: 10rpx;
  353. width: 100%;
  354. &:last-child {
  355. padding-bottom: 0;
  356. }
  357. }
  358. }
  359. }
  360. }
  361. </style>