From b6c8db84a8e59f9e257019bbe549503341135270 Mon Sep 17 00:00:00 2001 From: btobab Date: Wed, 9 Jul 2025 16:21:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A1=B9=E7=9B=AE=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/screens/auth/LoginScreen.tsx | 18 +- src/screens/home/HomeScreen.tsx | 89 ++++++--- src/screens/stockIn/StockInEmpty.tsx | 67 +++++-- src/screens/stockIn/StockInManual.tsx | 263 +++++++++++++++++++------- 4 files changed, 318 insertions(+), 119 deletions(-) diff --git a/src/screens/auth/LoginScreen.tsx b/src/screens/auth/LoginScreen.tsx index 835a7e2..b448396 100644 --- a/src/screens/auth/LoginScreen.tsx +++ b/src/screens/auth/LoginScreen.tsx @@ -28,7 +28,7 @@ export const LoginScreen: React.FC = () => { const theme = useTheme(); const handleLogin = useCallback(() => { - if (!isFocused) return; + if (!isFocused) {return;} InteractionManager.runAfterInteractions(() => { if (isFocused) { @@ -41,9 +41,9 @@ export const LoginScreen: React.FC = () => { {/* 背景区域 */} - @@ -51,7 +51,7 @@ export const LoginScreen: React.FC = () => { {/* 标题区域 */} - 景旺冷冻仓 + 仓库模板 智能仓储管理系统 @@ -60,8 +60,8 @@ export const LoginScreen: React.FC = () => { {/* Logo */} - - JW + + BK @@ -83,7 +83,7 @@ export const LoginScreen: React.FC = () => { {/* 底部版权信息 */} - © 2024 景旺电子 + © 2025 菲达宝开 @@ -183,4 +183,4 @@ const styles = StyleSheet.create({ footerText: { fontSize: 12, }, -}); \ No newline at end of file +}); diff --git a/src/screens/home/HomeScreen.tsx b/src/screens/home/HomeScreen.tsx index 3798400..68bac5c 100644 --- a/src/screens/home/HomeScreen.tsx +++ b/src/screens/home/HomeScreen.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react'; +import React, {useState, useEffect} from 'react'; import { View, Text, @@ -8,16 +8,16 @@ import { ScrollView, Dimensions, } from 'react-native'; -import { useNavigation } from '@react-navigation/native'; -import { NativeStackNavigationProp } from '@react-navigation/native-stack'; -import { RootStackParamList } from '../../navigation/types'; -import { PieChart } from 'react-native-chart-kit'; +import {useNavigation} from '@react-navigation/native'; +import {NativeStackNavigationProp} from '@react-navigation/native-stack'; +import {RootStackParamList} from '../../navigation/types'; +import {PieChart} from 'react-native-chart-kit'; import Icon from 'react-native-vector-icons/MaterialIcons'; -import { useTheme } from '../../contexts/ThemeContext'; +import {useTheme} from '../../contexts/ThemeContext'; import LinearGradient from 'react-native-linear-gradient'; -import Svg, { Path } from 'react-native-svg'; +import Svg, {Path} from 'react-native-svg'; -const { width } = Dimensions.get('window'); +const {width} = Dimensions.get('window'); type HomeScreenNavigationProp = NativeStackNavigationProp< RootStackParamList, @@ -48,8 +48,8 @@ export const HomeScreen: React.FC = () => { }, []); const menuItems: MenuItem[] = [ - { title: '空载具入库', icon: 'local-shipping', route: 'StockInEmpty' }, - { title: '手动码盘入库', icon: 'inventory', route: 'StockInManual' }, + {title: '空载具入库', icon: 'local-shipping', route: 'StockInEmpty'}, + {title: '手动码盘入库', icon: 'inventory', route: 'StockInManual'}, ]; const stockData = [ @@ -77,23 +77,30 @@ export const HomeScreen: React.FC = () => { if (!fontLoaded) { return ( - - 加载图标中... + + 加载图标中... ); } return ( - + {/* 头部区域 */} {/* 渐变背景 */} + start={{x: 0, y: 0}} + end={{x: 1, y: 1}}> {/* 半透明波浪效果 */} @@ -131,17 +138,25 @@ export const HomeScreen: React.FC = () => { style={styles.menuButton}> - - 景旺WMS移动终端(冷冻) + + WMS移动终端(模板) - + {/* 主体内容 */} - + {/* 快捷操作区 */} @@ -157,9 +172,17 @@ export const HomeScreen: React.FC = () => { end={{x: 1, y: 0}} /> - + - + {item.title} @@ -190,21 +213,30 @@ export const HomeScreen: React.FC = () => { {/* 侧边菜单 */} {isDrawerOpen && ( <> - + - - 景旺电子 + + 仓库模板 - + 欢迎使用WMS移动终端 {menuItems.map((item, index) => ( { setIsDrawerOpen(false); navigation.navigate(item.route); @@ -212,7 +244,8 @@ export const HomeScreen: React.FC = () => { - + {item.title} diff --git a/src/screens/stockIn/StockInEmpty.tsx b/src/screens/stockIn/StockInEmpty.tsx index 8782546..dc227de 100644 --- a/src/screens/stockIn/StockInEmpty.tsx +++ b/src/screens/stockIn/StockInEmpty.tsx @@ -51,7 +51,7 @@ export const StockInEmpty: React.FC = () => { setLoading(true); const response = await axios.post( '/api/vehicle/empty-in', - {vehicleNo: vehicleNo.trim()} + {vehicleNo: vehicleNo.trim()}, ); if (response.status !== 200) { @@ -64,9 +64,7 @@ export const StockInEmpty: React.FC = () => { const responseData = response.data; if (responseData.code === 200) { - Alert.alert('成功', '', [ - {text: '我知道了', style: 'default'}, - ]); + Alert.alert('成功', '', [{text: '我知道了', style: 'default'}]); setVehicleNo(''); } else { Alert.alert('警告', `服务器返回失败:${responseData.message}`, [ @@ -74,16 +72,21 @@ export const StockInEmpty: React.FC = () => { ]); } } catch (error) { - Alert.alert('请求发生错误', `请求服务器发生错误:${error instanceof Error ? error.message : String(error)}`, [ - {text: '我知道了', style: 'cancel'}, - ]); + Alert.alert( + '请求发生错误', + `请求服务器发生错误:${ + error instanceof Error ? error.message : String(error) + }`, + [{text: '我知道了', style: 'cancel'}], + ); } finally { setLoading(false); } }; return ( - + {/* 头部导航栏 */} { style={styles.backButton}> - 空载具入库 + + 空载具入库 + @@ -115,9 +120,17 @@ export const StockInEmpty: React.FC = () => { {/* 主体内容 */} - + {/* 说明文字 */} - + 请扫描或输入载具号进行空载具入库操作 @@ -129,11 +142,20 @@ export const StockInEmpty: React.FC = () => { 载具号 * - - + + { ) : ( <> - - + + 确认入库 diff --git a/src/screens/stockIn/StockInManual.tsx b/src/screens/stockIn/StockInManual.tsx index 33a1ae3..1810170 100644 --- a/src/screens/stockIn/StockInManual.tsx +++ b/src/screens/stockIn/StockInManual.tsx @@ -49,7 +49,9 @@ export const StockInManual: React.FC = () => { const resolveVehicle = useCallback(() => { const code = vehicleCode.trim(); - if (code.length === 0 || code === lastProcessedVehicleCode) {return;} + if (code.length === 0 || code === lastProcessedVehicleCode) { + return; + } if (code.length === 15) { setLastProcessedVehicleCode(code); @@ -128,20 +130,16 @@ export const StockInManual: React.FC = () => { }; const modifyNumber = (_id: string) => { - Alert.alert( - '修改数量', - '请输入新的数量', - [ - {text: '取消', style: 'cancel'}, - { - text: '确定', - onPress: () => { - // TODO: 需要实现一个自定义的输入对话框 - Alert.alert('提示', '此功能暂不可用,请稍后再试'); - }, + Alert.alert('修改数量', '请输入新的数量', [ + {text: '取消', style: 'cancel'}, + { + text: '确定', + onPress: () => { + // TODO: 需要实现一个自定义的输入对话框 + Alert.alert('提示', '此功能暂不可用,请稍后再试'); }, - ], - ); + }, + ]); }; const showDetails = (item: PackageDataItem) => { @@ -173,9 +171,9 @@ export const StockInManual: React.FC = () => { return; } - const areaIDIndex = 1; // 默认有卤 - const factoryIndex = 2; // 默认二厂 - const statusIndex = 1; // 默认合格 + const areaIDIndex = 1; // 默认有卤 + const factoryIndex = 2; // 默认二厂 + const statusIndex = 1; // 默认合格 const confirm = await new Promise(resolve => Alert.alert( @@ -218,16 +216,21 @@ export const StockInManual: React.FC = () => { Alert.alert('警告', `服务器返回失败:${data.message}`); } } catch (error) { - Alert.alert('请求发生错误', `请求服务器发生错误:${error instanceof Error ? error.message : String(error)}`, [ - {text: '我知道了', style: 'cancel'}, - ]); + Alert.alert( + '请求发生错误', + `请求服务器发生错误:${ + error instanceof Error ? error.message : String(error) + }`, + [{text: '我知道了', style: 'cancel'}], + ); } finally { setLoading(false); } }; return ( - + {/* 头部导航栏 */} { - + {/* 信息提示区 */} - + 请先扫描载具号,然后添加物料信息进行码盘入库 @@ -272,12 +283,23 @@ export const StockInManual: React.FC = () => { {/* 载具号输入区 */} - 载具号 - - + + 载具号 + + + { setVehicleCode('')} style={styles.clearButton}> - + )} @@ -298,12 +324,23 @@ export const StockInManual: React.FC = () => { {/* 条码输入区 */} - 物料条码 - - + + 物料条码 + + + { setGoodsCode('')} style={styles.clearButton}> - + )} @@ -332,8 +373,14 @@ export const StockInManual: React.FC = () => { - - + + 添加物料 @@ -347,8 +394,14 @@ export const StockInManual: React.FC = () => { - - + + 码盘完成 @@ -364,31 +417,59 @@ export const StockInManual: React.FC = () => { - {packageData.map((item) => ( - - + {packageData.map(item => ( + + {/* 卡片头部 */} - + 序号:{item.id} - + 采购单号:{item.segment1} showDetails(item)}> - + deleteItem(item.id)}> - + @@ -397,37 +478,83 @@ export const StockInManual: React.FC = () => { - 物料号 - {item.itemId} + + 物料号 + + + {item.itemId} + - 批次号 - {item.batch} + + 批次号 + + + {item.batch} + - 数量 + + 数量 + modifyNumber(item.id)}> - + {item.quantity} - 重量 - {item.weight} + + 重量 + + + {item.weight} + - 生产日期 - {item.productData} + + 生产日期 + + + {item.productData} + @@ -438,8 +565,16 @@ export const StockInManual: React.FC = () => { {loading && ( - - + + 正在请求入库...