yangg 1 жил өмнө
parent
commit
44aaeffce3

+ 5 - 2
src/api/api.ts

@@ -10,7 +10,7 @@ export class UserService {       // 模块一
      * @return {HttpResponse} result
      */
     static async login1(uuid) {   // 获取验证码
-        return  `https://apidoc.raycos.net/captchas/${uuid}/LOGIN?rmd=${new Date().getTime()}`
+        return  `http://192.168.8.103:9999/captchas/${uuid}/LOGIN?rmd=${new Date().getTime()}`
     }
     static async login(params) {   // 登录
         params.password = Md5.hashStr(params.password)
@@ -89,7 +89,10 @@ export class infoApi {     // 字典,仓库,客户
     static async getPdaMenu() {//客户列表
         return request(`/admin/systems/menus/getPdaMenu`, '', 'get')
     }
-   
+    //保存序列号/admin/erp/scancode/skuRedis
+    static async skuRedis(params) {
+        return request(`/admin/erp/scancode/skuRedis`,params, 'post')
+    }
 }
 export class dictionaryAPI {
     static async getPage(params) {//字典

+ 1 - 1
src/utils/axios.ts

@@ -9,7 +9,7 @@ axios.defaults.timeout = 60000;
 
 // 请求地址,这里是动态赋值的的环境变量,下一篇会细讲,这里跳过
 // @ts-ignore
-axios.defaults.baseURL = 'https://apidoc.raycos.net'//import.meta.env.VITE_API_URL; http://192.168.8.103:9999  https://apidoc.raycos.net
+axios.defaults.baseURL = 'http://192.168.8.103:9999'//import.meta.env.VITE_API_URL; http://192.168.8.103:9999  https://apidoc.raycos.net
 
 // 请求拦截器
 axios.interceptors.request.use(function (config) {

+ 41 - 15
src/views/apps/shippingPage.vue

@@ -72,19 +72,23 @@
                     <el-table-column prop="goods_vo.name" label="商品名称" />
                     <el-table-column prop="product_vo.sku" label="SKU" />
                     <el-table-column prop="orderNum" label="订单数量" />
-                    <el-table-column prop="num"  :style="{ color: 'red' }" label="出库数量" />
+                    <el-table-column prop="num" :style="{ color: 'red' }" label="出库数量" />
                 </el-table>
             </el-tab-pane>
 
         </el-tabs>
-        <el-dialog v-model="dialogVisible" :modal=false title="扫码出库" :close-on-click-modal="false" top="80px" width="90%" style="height: 200px"
-            :before-close="handleClose">
+        <el-dialog v-model="dialogVisible" :modal=false title="扫码出库" :close-on-click-modal="false" top="80px"
+            width="90%" style="height: 200px" :before-close="handleClose">
             <el-form :model="snCodeForm" label-width="auto" style="max-width: 600px">
                 <el-form-item label="SKU">
-                    <el-input v-model="snCodeForm.bar_code" inputmode="none" ref="inputRef" @keyup.enter="toSearch()" />
+                    <el-input v-model="snCodeForm.bar_code" :inputmode="inputmode" ref="inputRef"
+                        @keyup.enter="toSearch()">
+                        <template #append> <el-button @click="getInfo">搜索</el-button> </template>
+                    </el-input>
                 </el-form-item>
                 <el-form-item label="序列号">
-                    <el-input v-model="snCodeForm.sn_code" inputmode="none" ref="snInputRef" @keyup.enter="toSnCode()" />
+                    <el-input v-model="snCodeForm.sn_code" inputmode="none" ref="snInputRef"
+                        @keyup.enter="toSnCode()" />
                 </el-form-item>
             </el-form>
             <!-- <template #footer>
@@ -126,6 +130,7 @@ const defaultTime = new Date(2000, 1, 1, 12, 0, 0)
 let dialogVisible = ref(false)
 const tableData = ref([])
 let barcodeValue = ref('')
+let inputmode = ref('none')
 const router = useRouter();
 const route = useRoute()
 const activeTab = ref('product-info');
@@ -202,7 +207,7 @@ const params: any = ref({
     warehouse_id: '',
     goods_num: '',
 })
-let isReadOnly:any=ref(false)
+let isReadOnly: any = ref(false)
 let sku = ref('');
 watch(activeTab, (newValue, oldValue) => {
     console.log(`Tab changed from ${oldValue} to ${newValue}`);
@@ -214,6 +219,10 @@ const toggleReadOnly = () => {
 const enableVirtualKeyboard = (event) => {
     event.target.readOnly = false;
 };
+const getInfo = () => {
+    inputmode.value = 'text'
+    inputRef.value.focus();
+}
 /* 扫sku */
 const toSearch = async () => {
     activeTab.value = 'product-info'
@@ -237,7 +246,6 @@ const toSearch = async () => {
                 el.product_id === res.data.product_id &&
                 el.product_vo.sku === res.data.product_vo.sku
             ));
-            console.log(existingProduct);
             if (!existingProduct) {
                 //ElMessageBox.error('订单内没有该商品,请重新录入');
                 nextTick(() => {
@@ -258,10 +266,12 @@ const toSearch = async () => {
             });
         } else {
             shippingForm.value.order_item_vos[index.value].num += 1
+            snCodeForm.bar_code = ''
             //dialogVisible.value = false;
         }
     } catch (error) {
         console.error('Error fetching product:', error);
+        snCodeForm.bar_code = ''
     }
 };
 //扫描序列号
@@ -279,7 +289,10 @@ const toSnCode = async () => {
         );
 
         if (!exists) {
-            shippingForm.value.order_item_vos[index.value].sn_code_list.push(res.data);
+            /* 请求保存 */
+            infoApi.skuRedis({ send_order_id: id.value, item_id: shippingForm.value.order_item_vos[index.value].id, sku: res.data }).then((res: any) => {
+                shippingForm.value.order_item_vos[index.value].sn_code_list.push(res.data);
+            })
         }
 
         shippingForm.value.order_item_vos[index.value].num = shippingForm.value.order_item_vos[index.value].sn_code_list.length;
@@ -442,14 +455,27 @@ const init = async () => {
     try {
         const res: any = await orderApi.getSendOrderDetail(id.value);
         if (res && res.data && res.data.order_vo && res.data.order_vo.sn) {
-            res.data.order_item_vos.map(el => {
-                params.value.total_weight = Number(
-                    el.product_vo.weight * el.num
-                );
-                el.orderNum = el.num
-                el.num = 0
-                el.sn_code_list = []
+            await infoApi.skuRedis({ send_order_id: id.value, type: 'enter' }).then((response: any) => {
+                res.data.order_item_vos.map((el: any) => {
+                    params.value.total_weight = Number(
+                        el.product_vo.weight * el.num
+                    );
+                    el.orderNum = el.num
+                    el.num = 0
+                    Object.keys(response.data).map(item => {
+                        if (el.id == item) {
+                            el.sn_code_list = response.data[item]
+                            el.num = el.sn_code_list.length
+                        }
+                    })
+                    if (!el.sn_code_list) {
+                        el.sn_code_list = []
+                    } else {
+                        /* el.num = el.sn_code_list.length */
+                    }
+                })
             })
+            console.log(params);
             barcodeValue.value = res.data.order_vo.sn;
             //物品价格
             if (res.data.total_volume !== undefined) {