Browse Source

立库-增加入库解绑

zhaohuanhuan 2 tháng trước cách đây
mục cha
commit
f3dc1f1e2b
2 tập tin đã thay đổi với 111 bổ sung24 xóa
  1. 34 0
      src/api/haikang/index.ts
  2. 77 24
      src/views/haikang/boxReturn/boxReturn/index.vue

+ 34 - 0
src/api/haikang/index.ts

@@ -117,6 +117,40 @@ export function finishTask(data:any) {
     data
   })
 }
+/**
+ * 立库-托盘入库
+ * @param data
+ */
+export function createAsrsPalletInbound(params:any) {
+  return request({
+    url: '/api/wms/asrs/picking/putAway-pallet',
+    method: 'post',
+    params
+  })
+}
+/**
+ * 立库-货架入库
+ * @param data
+ */
+export function createAsrsShelfInbound(params:any) {
+  return request({
+    url: '/api/wms/asrs/picking/putAway-shelf',
+    method: 'post',
+    params
+  })
+}
+
+/**
+ * 立库-站点解绑
+ * @param data
+ */
+export function asrsBoxAndStationUnbindTask(params:any) {
+  return request({
+    url: '/api/wms/asrs/picking/release',
+    method: 'post',
+    params
+  })
+}
 
 
 

+ 77 - 24
src/views/haikang/boxReturn/boxReturn/index.vue

@@ -2,7 +2,7 @@
 <template>
   <div class="box-return">
     <van-nav-bar
-      title="海康-入库/解绑" left-arrow fixed placeholder @click-left="goBack" @click-right="onConfirm()">
+        :title="mode?'立库V4-入库/解绑':'海康-入库/解绑'" left-arrow fixed placeholder @click-left="goBack" @click-right="onConfirm()">
       <template #left>
         <van-icon name="arrow-left" size="25" />
         <div style="color: #fff">返回</div>
@@ -15,12 +15,12 @@
       <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">
+      <van-tabs v-model:active="active" @change="onActive"   type="card">
         <van-tab title="料箱入库" name="1"></van-tab>
         <van-tab title="解绑站点" name="2"  ></van-tab>
       </van-tabs>
         <div class="content-code">
-          <div class="barcode-input">
+          <div class="barcode-input" v-if="active!=2 || mode!=='asrs' ">
             <van-search
               ref="boxRef"
               v-model.lazy="scanBox"
@@ -57,9 +57,15 @@ 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 { boxAndStationUnbindTask, createHikBoxInboundTask } from '@/api/haikang'
+import {
+  asrsBoxAndStationUnbindTask,
+  boxAndStationUnbindTask, createAsrsPalletInbound,
+  createAsrsShelfInbound,
+  createHikBoxInboundTask
+} from '@/api/haikang'
 import { useStore } from '@/store/modules/user'
 import { closeLoading, showLoading } from '@/utils/loading'
+import {useRoute} from "vue-router";
 const tips=ref('请扫描料箱')
 const scanType = ref(1)
 const scanBox=ref('')
@@ -76,19 +82,26 @@ onMounted(() => {
 const store = useStore()
 const warehouse = store.warehouse
 const active=ref('1')
+const route = useRoute()
+const mode=ref(route.query.type)
 // 扫描条码监听
 const _handlerScan = (code) => {
   if(!code) return
   if (scanType.value == 1) {
-    const regex = /^HK\d{6}$/;
-    if(regex.test(barcodeToUpperCase(code))){
-      scanBox.value = barcodeToUpperCase(code)
+    let searchKey = barcodeToUpperCase(code);
+    const gridMatch = searchKey.match(/^([A-Z]+\d+)(?:-[AB]\d*)?$/);
+    if (gridMatch) {
+      searchKey = gridMatch[1]
+    }
+    const regex = /^(HK\d{6}|(HJ|TP)\d{5})$/;
+    if(regex.test(searchKey)){
+      scanBox.value = searchKey
       scanType.value=2
       tips.value='请扫描工作站台'
     }else {
-      tips.value=`${code}:料箱条码不匹配`
+      tips.value=`${searchKey}:料箱条码不匹配`
       scanError()
-      showNotify({ type: 'danger', duration: 3000, message:`${code}:料箱条码不匹配` })
+      showNotify({ type: 'danger', duration: 3000, message:`${searchKey}:料箱条码不匹配` })
       scanBox.value=''
     }
   }else if(scanType.value == 2){
@@ -98,6 +111,13 @@ const _handlerScan = (code) => {
     }
   }
 }
+const onActive=(type)=>{
+  if(type==2 && mode.value=='asrs'){
+    scanType.value=2
+  }else{
+    scanType.value=1
+  }
+}
 const onConfirm=()=>{
   if(!scanBox.value && active.value!=2){
     tips.value='请先扫描料箱编号'
@@ -116,25 +136,39 @@ const onConfirm=()=>{
   const message=active.value==1?'您正在进行入库操作是否继续':'您正在进行解绑操作是否继续'
   showConfirmDialog({
     title: '温馨提示',
-    message,
-    keyboardEnabled:false
+    message
   }).then(() => {
     if(active.value==1){
       _createHikBoxInboundTask()
     }else {
+      if(mode.value=='asrs'){
+        _asrsBoxAndStationUnbindTask()
+        return
+      }
       _boxAndStationUnbindTask()
     }
   }).catch(() => {})
 }
+
 const _createHikBoxInboundTask=()=>{
-  const data={
-    warehouse,
-    boxCode:scanBox.value,
-    stationCode:scanStation.value,
-    deviceType:'HIK_INBOUND_STATION'
+  // 提取公共数据
+  let baseData = {warehouse, stationCode: scanStation.value}
+  let url, data;
+  if (scanBox.value.startsWith('HJ')) {
+    data = {
+      ...baseData,
+      shelfCode: scanBox.value
+    };
+    url = createAsrsShelfInbound;
+  } else if (scanBox.value.startsWith('TP')) {
+    data = {
+      ...baseData,
+      palletCode: scanBox.value
+    };
+    url = createAsrsPalletInbound;
   }
   showLoading()
-  createHikBoxInboundTask(data).then(res=>{
+  url(data).then(res=>{
     tips.value='请继续扫描料箱编号'
     scanType.value=1
     scanBox.value=''
@@ -149,20 +183,39 @@ const _createHikBoxInboundTask=()=>{
     closeLoading()
   })
 }
+
+//海康解绑
 const _boxAndStationUnbindTask=()=>{
-  const data={
-    warehouse,
-    boxCode:scanBox.value || undefined,
-    stationCode:scanStation.value,
-  }
+  const data={warehouse, boxCode:scanBox.value || undefined, stationCode:scanStation.value}
   showLoading()
   boxAndStationUnbindTask(data).then(res=>{
     if(res.data){
-      tips.value='请继续扫描料箱编号'
+      tips.value='解绑成功,请继续扫描料箱编号'
       scanType.value=1
       scanBox.value=''
       scanStation.value=''
-      showNotify({ type: 'success', duration: 3000, message:'料箱解绑成功,请继续扫描需要入库料箱' })
+      showNotify({ type: 'success', duration: 3000, message:'解绑成功,请继续扫描料箱编号' })
+      scanSuccess()
+    }
+  }).catch(err=>{
+    tips.value=err.message
+    scanStation.value=''
+    scanError()
+  }).finally(()=>{
+    closeLoading()
+  })
+}
+//立库解绑
+const _asrsBoxAndStationUnbindTask=()=>{
+  const data={warehouse, stationCode:scanStation.value}
+  showLoading()
+  asrsBoxAndStationUnbindTask(data).then(res=>{
+    if(res.data){
+      tips.value='解绑成功,请继续扫描站点'
+      scanType.value=2
+      scanBox.value=''
+      scanStation.value=''
+      showNotify({ type: 'success', duration: 3000, message:'解绑成功,请继续扫描站点' })
       scanSuccess()
     }
   }).catch(err=>{