Bladeren bron

容器-绑定/解绑-初始化

zhaohuanhuan 7 maanden geleden
bovenliggende
commit
2c8635d6ae
5 gewijzigde bestanden met toevoegingen van 315 en 16 verwijderingen
  1. 30 0
      src/api/container/index.ts
  2. 21 16
      src/hooks/basic/menu.js
  3. 6 0
      src/router/index.ts
  4. 35 0
      src/types/container.ts
  5. 223 0
      src/views/equipment/container/bindUnbind/index.vue

+ 30 - 0
src/api/container/index.ts

@@ -0,0 +1,30 @@
+// @ts-ignore
+import request from '@/utils/request'
+// @ts-ignore
+import { bindContainerLocationType, unbindContainerLocationType } from '@/types/container'
+
+/**
+ * 容器绑定库位
+ * @param data
+ */
+export function bindContainerLocation(data:bindContainerLocationType) {
+  return request({
+    url: '/api/wms/container/location/relation/bindContainerLocation',
+    method: 'post',
+    data:JSON.stringify(data),
+  })
+}
+
+
+/**
+ * 解绑容器库位
+ * @param data
+ */
+export function unbindContainerLocation(data:unbindContainerLocationType) {
+  return request({
+    url: '/api/wms/container/location/relation/unbindContainerLocation',
+    method: 'post',
+    data:JSON.stringify(data),
+  })
+}
+

+ 21 - 16
src/hooks/basic/menu.js

@@ -1,7 +1,7 @@
 import {
   reactive,
   ref
-} from "vue"
+} from 'vue'
 
 export default function() {
 
@@ -9,39 +9,39 @@ export default function() {
     {
       title: '工作台',
       id: 0,
-      icon: "home-o",
+      icon: 'home-o',
       menu:[{
         title:'入库',
         children: [
           {
             title: '收货',
             icon: 'newspaper-o',
-            path: "take-delivery"
+            path: 'take-delivery'
           },
           {
             title: '盲扫',
             icon: 'newspaper-o',
-            path: "blind-receiving"
+            path: 'blind-receiving'
           },
           {
             title: '宝时快上',
             icon: 'newspaper-o',
-            path: "putaway"
+            path: 'putaway'
           },
           {
             title: '海康快上',
             icon: 'newspaper-o',
-            path: "hik-putaway-allocation"
+            path: 'hik-putaway-allocation'
           },
           {
             title: '海康上架',
             icon: 'newspaper-o',
-            path: "hik-putaway"
+            path: 'hik-putaway'
           },
           {
             title: '海康入库',
             icon: 'newspaper-o',
-            path: "hik-box-return"
+            path: 'hik-box-return'
           },
         ]
       },
@@ -56,22 +56,22 @@ export default function() {
             {
               title: '拣货(巷道)',
               icon: 'newspaper-o',
-              path: "picking-aisle"
+              path: 'picking-aisle'
             },
             {
               title: '活动单复核',
               icon: 'newspaper-o',
-              path: "check-activity"
+              path: 'check-activity'
             },
             {
               title: 'B2B复核',
               icon: 'newspaper-o',
-              path: "check-large"
+              path: 'check-large'
             },
             {
               title: '复核还库',
               icon: 'newspaper-o',
-              path: "check-move-stock"
+              path: 'check-move-stock'
             },
           ]
         },
@@ -81,7 +81,7 @@ export default function() {
             {
               title: '移库任务',
               icon: 'newspaper-o',
-              path: "move-list"
+              path: 'move-list'
             },
           ]
         },
@@ -91,17 +91,22 @@ export default function() {
             {
               title: '加工单',
               icon: 'newspaper-o',
-              path: "processing"
+              path: 'processing'
             },
             {
               title: '计件面板',
               icon: 'newspaper-o',
-              path: "piece-dashboard"
+              path: 'piece-dashboard'
             },
             {
               title: '退货登记',
               icon: 'newspaper-o',
-              path: "returned-register"
+              path: 'returned-register'
+            },
+            {
+              title: '容器-绑/解绑',
+              icon: 'newspaper-o',
+              path: 'container-bindUnbind'
             },
           ]
         }

+ 6 - 0
src/router/index.ts

@@ -127,6 +127,12 @@ const routes: RouteRecordRaw[] = [
     meta:{title:'宝时快上'},
     component: () => import('@/views/inbound/putaway/task/index.vue')
   },
+  {
+    path: '/container-bindUnbind',
+    name: 'containerBindUnbind',
+    meta:{title:'宝时快上'},
+    component: () => import('@/views/equipment/container/bindUnbind/index.vue')
+  },
 ];
 
 // 创建路由实例

+ 35 - 0
src/types/container.ts

@@ -0,0 +1,35 @@
+/**
+ * 容器绑定库位
+ */
+export interface bindContainerLocationType {
+  /**
+   * 仓库ID
+   */
+  warehouseId: string;
+  /**
+   * 容器库位
+   */
+  dataList: ContainerLocationDataDTO[];
+  [property: string]: any;
+}
+
+export interface ContainerLocationDataDTO {
+  /**
+   * 容器号
+   */
+  containerCode: string;
+  /**
+   * 库位号
+   */
+  locationId: string;
+  [property: string]: any;
+}
+
+/**
+ * 解绑容器库位
+ */
+export interface unbindContainerLocationType {
+  containerCode: string;
+  warehouseId: string;
+  [property: string]: any;
+}

+ 223 - 0
src/views/equipment/container/bindUnbind/index.vue

@@ -0,0 +1,223 @@
+
+<template>
+  <div class="box-return">
+    <van-nav-bar
+      title="容器-绑定/解绑" left-arrow fixed placeholder @click-left="goBack" @click-right="onConfirm()">
+      <template #left>
+        <van-icon name="arrow-left" size="25" />
+        <div style="color: #fff">返回</div>
+      </template>
+      <template #right>
+        <div style="color: #fff">确认</div>
+      </template>
+    </van-nav-bar>
+    <div class="box-return-content">
+      <div class="content-tips">
+        <div style="flex: 1"><van-notice-bar left-icon="volume-o">{{ tips }}</van-notice-bar></div>
+      </div>
+      <van-tabs v-model:active="active"   type="card" @change="activeChange">
+        <van-tab title="绑定" name="1"></van-tab>
+        <van-tab title="解绑" name="2"  ></van-tab>
+      </van-tabs>
+        <div class="content-code">
+          <div class="barcode-input" v-if="active==1">
+            <van-search
+              ref="boxRef"
+              v-model.lazy="locationNo"
+              placeholder="请扫描库位号"
+              @search="_handlerScan(locationNo)"
+              label="库位号:"
+              left-icon=""
+              :class="[scanType===1?'search-input-barcode':'','van-hairline--bottom']"
+              @focus="scanType=1"
+              autocomplete="off"
+            >
+            </van-search>
+          </div>
+          <div class="barcode-input">
+            <van-search
+              v-model.lazy="containerNo"
+              placeholder="请扫描容器号"
+              @search="_handlerScan(containerNo)"
+              label="容器号:"
+              left-icon=""
+              :class="[scanType===2?'search-input-barcode':'','van-hairline--bottom']"
+              @focus="scanType=2"
+              autocomplete="off"
+            >
+            </van-search>
+          </div>
+        </div>
+    </div>
+  </div>
+</template>
+<script setup lang="ts">
+import { onMounted, onUnmounted, ref } from 'vue'
+import { getHeader, goBack, scanError, scanSuccess } from '@/utils/android'
+import { closeListener, openListener, scanInit } from '@/utils/keydownListener'
+import { barcodeToUpperCase } from '@/utils/dataType'
+import { showConfirmDialog, showNotify } from 'vant'
+import { useStore } from '@/store/modules/user'
+import { closeLoading, showLoading } from '@/utils/loading'
+import { bindContainerLocation, unbindContainerLocation } from '@/api/container'
+const tips=ref('请扫描库位号')
+const scanType = ref(1)
+const locationNo=ref('')
+const containerNo=ref('')
+try {
+  getHeader()
+} catch (error) {
+}
+// 页面初始化
+onMounted(() => {
+  openListener()
+  scanInit(_handlerScan)
+})
+const store = useStore()
+const warehouse = store.warehouse
+const active=ref('1')
+const activeChange=(value)=>{
+  scanType.value=Number(value)
+  locationNo.value=''
+  tips.value=active.value=='1'?'请扫描库位号':'请扫描容器号'
+}
+// 扫描条码监听
+const _handlerScan = (code) => {
+  if(!code) return
+  if (scanType.value == 1) {
+    // const regex = /^HK\d{6}$/;
+    // if(regex.test(barcodeToUpperCase(code))){
+      locationNo.value = barcodeToUpperCase(code)
+      scanType.value=2
+      tips.value='请扫描库位号'
+    // }else {
+    //   tips.value=`${code}:料箱条码不匹配`
+    //   scanError()
+    //   showNotify({ type: 'danger', duration: 3000, message:`${code}:料箱条码不匹配` })
+    //   locationNo.value=''
+    // }
+  }else if(scanType.value == 2){
+    if(code){
+      containerNo.value = barcodeToUpperCase(code)
+      onConfirm()
+    }
+  }
+}
+const onConfirm=()=>{
+  if(!locationNo.value && active.value!=2){
+    tips.value='请先扫描库位号'
+    scanType.value=1
+    showNotify({ type: 'danger', duration: 3000, message:'请先扫描库位号' })
+    scanError()
+    return
+  }
+  if(!containerNo.value){
+    tips.value='请先扫描容器号'
+    scanType.value=2
+    showNotify({ type: 'danger', duration: 3000, message:'请先扫描容器号' })
+    scanError()
+    return
+  }
+  const message=active.value==1?'您正在进行绑定是否继续':'您正在进行解绑是否继续'
+  showConfirmDialog({
+    title: '温馨提示',
+    message
+  }).then(() => {
+    if(active.value==1){
+      _bindContainerLocation()
+    }else {
+      _unbindContainerLocation()
+    }
+  }).catch(() => {})
+}
+const _bindContainerLocation=()=>{
+  const data={
+    warehouseId:warehouse,
+    dataList:[
+      {
+        containerCode:containerNo.value,
+        locationId:locationNo.value,
+      }
+    ]
+  }
+  showLoading()
+  bindContainerLocation(data).then(res=>{
+    if(res.data){
+      tips.value='请继续扫描库位号'
+      scanType.value=1
+      locationNo.value=''
+      containerNo.value=''
+      showNotify({ type: 'success', duration: 3000, message:'容器绑定成功,请继续扫描库位号' })
+      scanSuccess()
+    }
+  }).catch(err=>{
+    tips.value=err.message
+    containerNo.value=''
+    scanError()
+  }).finally(()=>{
+    closeLoading()
+  })
+}
+const _unbindContainerLocation=()=>{
+  const params={
+    warehouseId:warehouse,
+    containerCode:containerNo.value,
+  }
+  showLoading()
+  unbindContainerLocation(params).then(res=>{
+    if(res.data){
+      tips.value='请继续扫描容器'
+      scanType.value=1
+      containerNo.value=''
+      showNotify({ type: 'success', duration: 3000, message:'容器解绑成功,请继续扫描容器号' })
+      scanSuccess()
+    }
+  }).catch(err=>{
+    tips.value=err.message
+    containerNo.value=''
+    scanError()
+  }).finally(()=>{
+    closeLoading()
+  })
+}
+onUnmounted(() => {
+  closeListener()
+})
+// window.onRefresh = loadData
+</script>
+<style scoped lang="sass">
+.box-return
+  .box-return-content
+    .content-code
+      text-align: left
+      background: #FFFFFF
+
+      .barcode-input
+        ::v-deep(.van-search)
+          padding: 0
+          height: 60px
+
+
+        ::v-deep(.van-search__field)
+          border-bottom: 2px solid #ffffff
+
+        ::v-deep(.van-search__content)
+          background: #fff
+          align-items: center
+
+        ::v-deep(.van-field__control)
+          font-size: 15px
+          font-weight: bold
+
+
+        ::v-deep(.van-search__label)
+          font-size: 15px
+          font-weight: bold
+
+        .search-input-barcode
+          ::v-deep(.van-search__field)
+            border-bottom: 2px solid #0077ff
+            z-index: 2
+            line-height: 58px
+            height: 60px
+</style>