Bläddra i källkod

更改链接,添加缓存

yangg 1 år sedan
förälder
incheckning
c93eb91c9f

+ 1 - 1
src/api/api.ts

@@ -10,7 +10,7 @@ export class UserService {       // 模块一
      * @return {HttpResponse} result
      */
     static async login1(uuid) {   // 获取验证码
-        return  `http://192.168.8.103:9999/captchas/${uuid}/LOGIN?rmd=${new Date().getTime()}`
+        return  `https://apidoc.raycos.net/captchas/${uuid}/LOGIN?rmd=${new Date().getTime()}`
     }
     static async login(params) {   // 登录
         params.password = Md5.hashStr(params.password)

+ 1 - 1
src/utils/axios.ts

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

+ 24 - 10
src/views/InoutStorage/inStorage.vue

@@ -33,14 +33,15 @@
                 <el-table-column prop="orderNum" :style="{ color: 'red' }" label="待入库数量" />
             </el-table>
         </el-form>
-        <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" ref="inputRef" inputmode="none" @keyup.enter="toSearch()" />
                 </el-form-item>
                 <el-form-item label="序列号">
-                    <el-input v-model="snCodeForm.sn_code" ref="snInputRef" inputmode="none" @keyup.enter="toSnCode()" />
+                    <el-input v-model="snCodeForm.sn_code" ref="snInputRef" inputmode="none"
+                        @keyup.enter="toSnCode()" />
                 </el-form-item>
             </el-form>
             <!-- <template #footer>
@@ -179,7 +180,10 @@ const toSnCode = async () => {
         );
 
         if (!exists) {
-            goodsExchangeAddForm.product_list[index.value].sn_code_list.push(res.data);
+            await infoApi.skuRedis({ send_order_id: id.value, item_id: goodsExchangeAddForm.product_list[index.value].id, sku: res.data }).then((respons: any) => {
+                /* shippingForm.value.order_item_vos[index.value].sn_code_list.push(res.data); */
+                goodsExchangeAddForm.product_list[index.value].sn_code_list.push(res.data);
+            })
         }
         goodsExchangeAddForm.product_list[index.value].num = goodsExchangeAddForm.product_list[index.value].sn_code_list.length;
         snCodeForm.bar_code = "";
@@ -235,7 +239,7 @@ const getOrderNumber = async (formEl: FormInstance | undefined) => {
                 el.product_id = el.product_vo.id;
                 el.id = "";
             });
-            entryOutAPI.addWarehouseEntry(id.value,goodsExchangeAddForm).then(res => {
+            entryOutAPI.addWarehouseEntry(id.value, goodsExchangeAddForm).then(res => {
                 ElMessage.success("入库成功!");
                 router.replace({
                     name: 'InoutStorage',
@@ -261,7 +265,7 @@ const save = async (formEl: FormInstance | undefined) => {
                 el.product_id = el.product_vo.id;
                 el.id = "";
             });
-            entryOutAPI.addWarehouseEntry(id.value,goodsExchangeAddForm).then(res => {
+            entryOutAPI.addWarehouseEntry(id.value, goodsExchangeAddForm).then(res => {
                 ElMessage.success("保存成功!");
                 router.replace({
                     name: 'InoutStorage',
@@ -278,10 +282,20 @@ const ship = () => {
 const init = async () => {
     try {
         const res: any = await entryOutAPI.warehouseEntry(id.value);
-        res.data.product_list.map(el => {
-            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.product_list.map(el => {
+                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 = []
+                }
+            })
         })
         goodsExchangeAddForm.warehouse_id = res.data.warehouse_id;
         goodsExchangeAddForm.type = res.data.type;

+ 23 - 10
src/views/InoutStorage/outStorage.vue

@@ -27,11 +27,11 @@
             </el-form-item>
             <el-button type="primary" size="large" @click="scanCode">扫码出库</el-button>
             <el-table :data="goodsExchangeAddForm.product_list" style="width: 100%;font-size: 12px;">
-                <el-table-column prop="goods_vo.name" label="商品名称"  />
+                <el-table-column prop="goods_vo.name" label="商品名称" />
                 <el-table-column prop="product_vo.sku" label="SKU" />
                 <el-table-column prop="out_num" label="出库数量" />
                 <el-table-column prop="orderNum" :style="{ color: 'red' }" label="待出库数量" />
-                <el-table-column  label="操作">
+                <el-table-column label="操作">
                     <template #default="scope">
                         <el-button size="mini" type="danger" @click="
                             goodsExchangeAddForm.product_list.splice(scope.$index, 1)
@@ -40,14 +40,15 @@
                 </el-table-column>
             </el-table>
         </el-form>
-        <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" ref="inputRef" inputmode="none" @keyup.enter="toSearch()" />
                 </el-form-item>
                 <el-form-item label="序列号">
-                    <el-input v-model="snCodeForm.sn_code" ref="snInputRef" inputmode="none" @keyup.enter="toSnCode()" />
+                    <el-input v-model="snCodeForm.sn_code" ref="snInputRef" inputmode="none"
+                        @keyup.enter="toSnCode()" />
                 </el-form-item>
             </el-form>
             <!-- <template #footer>
@@ -187,7 +188,9 @@ const toSnCode = async () => {
         );
 
         if (!exists) {
-            goodsExchangeAddForm.product_list[index.value].sn_code_list.push(res.data);
+            await infoApi.skuRedis({ send_order_id: id.value, item_id: goodsExchangeAddForm.product_list[index.value].id, sku: res.data }).then((respons: any) => {
+                goodsExchangeAddForm.product_list[index.value].sn_code_list.push(res.data);
+            })
         }
         goodsExchangeAddForm.product_list[index.value].out_num = goodsExchangeAddForm.product_list[index.value].sn_code_list.length;
         snCodeForm.bar_code = "";
@@ -286,10 +289,20 @@ const ship = () => {
 const init = async () => {
     try {
         const res: any = await entryOutAPI.warehouseOut(id.value);
-        res.data.product_list.map(el => {
-            el.orderNum = el.out_num
-            el.out_num = 0
-            el.sn_code_list = []
+        await infoApi.skuRedis({ send_order_id: id.value, type: 'enter' }).then((response: any) => {
+            res.data.product_list.map(el => {
+                el.orderNum = el.out_num
+                el.out_num = 0
+                Object.keys(response.data).map(item => {
+                    if (el.id == item) {
+                        el.sn_code_list = response.data[item]
+                        el.out_num = el.sn_code_list.length
+                    }
+                })
+                if (!el.sn_code_list) {
+                    el.sn_code_list = []
+                }
+            })
         })
         goodsExchangeAddForm.warehouse_id = res.data.warehouse_id;
         goodsExchangeAddForm.type = res.data.type;

+ 20 - 9
src/views/Inventory/addInventory.vue

@@ -36,14 +36,15 @@
                 </el-table-column>
             </el-table>
         </el-form>
-        <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" ref="inputRef" inputmode="none" @keyup.enter="toSearch()" />
                 </el-form-item>
                 <el-form-item label="序列号">
-                    <el-input v-model="snCodeForm.sn_code" ref="snInputRef" inputmode="none" @keyup.enter="toSnCode()" />
+                    <el-input v-model="snCodeForm.sn_code" ref="snInputRef" inputmode="none"
+                        @keyup.enter="toSnCode()" />
                 </el-form-item>
             </el-form>
             <!-- <template #footer>
@@ -166,7 +167,7 @@ const toSearch = async () => {
             /* this.scanDialogVisible = false; */
         }
     } catch (error) {
-        goodsInventoryAddForm.product_list[index.value].inventory_num +=1
+        goodsInventoryAddForm.product_list[index.value].inventory_num += 1
         console.error('Error fetching product:', error);
     }
 };
@@ -185,7 +186,9 @@ const toSnCode = async () => {
         );
 
         if (!exists) {
-            goodsInventoryAddForm.product_list[index.value].sn_code_list.push(res.data);
+            await infoApi.skuRedis({ send_order_id: id.value, item_id: goodsInventoryAddForm.product_list[index.value].id, sku: res.data }).then((respons: any) => {
+                goodsInventoryAddForm.product_list[index.value].sn_code_list.push(res.data);
+            })
         }
         goodsInventoryAddForm.product_list[index.value].inventory_num = goodsInventoryAddForm.product_list[index.value].sn_code_list.length;
         snCodeForm.bar_code = "";
@@ -271,11 +274,19 @@ const ship = () => {
 const init = async () => {
     try {
         const res: any = await inventoryAPI.inventory(id.value);
-        res.data.product_list.map(el => {
-            if (!el.sn_code_list) {
-                el.sn_code_list = []
-            }
+        await infoApi.skuRedis({ send_order_id: id.value, type: 'enter' }).then((response: any) => {
+            res.data.product_list.map(el => {
+                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 = []
+                }
 
+            })
         })
         goodsInventoryAddForm.warehouse_id = res.data.warehouse_id;
         goodsInventoryAddForm.inventory_person_id = res.data.inventory_person_id;

+ 1 - 3
src/views/apps/shippingPage.vue

@@ -290,11 +290,10 @@ const toSnCode = async () => {
 
         if (!exists) {
             /* 请求保存 */
-            infoApi.skuRedis({ send_order_id: id.value, item_id: shippingForm.value.order_item_vos[index.value].id, sku: res.data }).then((res: any) => {
+            await infoApi.skuRedis({ send_order_id: id.value, item_id: shippingForm.value.order_item_vos[index.value].id, sku: res.data }).then((respons: 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;
         const indexs = shippingForm.value.order_item_vos.findIndex(el => (
             el.goods_id === res.goods_id &&
@@ -475,7 +474,6 @@ const init = async () => {
                     }
                 })
             })
-            console.log(params);
             barcodeValue.value = res.data.order_vo.sn;
             //物品价格
             if (res.data.total_volume !== undefined) {