优化项目结构
This commit is contained in:
parent
e937988771
commit
b6c8db84a8
|
|
@ -28,7 +28,7 @@ export const LoginScreen: React.FC = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
const handleLogin = useCallback(() => {
|
const handleLogin = useCallback(() => {
|
||||||
if (!isFocused) return;
|
if (!isFocused) {return;}
|
||||||
|
|
||||||
InteractionManager.runAfterInteractions(() => {
|
InteractionManager.runAfterInteractions(() => {
|
||||||
if (isFocused) {
|
if (isFocused) {
|
||||||
|
|
@ -41,9 +41,9 @@ export const LoginScreen: React.FC = () => {
|
||||||
<Screen style={styles.screen}>
|
<Screen style={styles.screen}>
|
||||||
{/* 背景区域 */}
|
{/* 背景区域 */}
|
||||||
<View style={styles.backgroundContainer}>
|
<View style={styles.backgroundContainer}>
|
||||||
<WaveBackground
|
<WaveBackground
|
||||||
height={height * 0.6}
|
height={height * 0.6}
|
||||||
gradientColors={theme.colors.gradients.primary}
|
gradientColors={theme.colors.gradients.primary}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
|
@ -51,7 +51,7 @@ export const LoginScreen: React.FC = () => {
|
||||||
<View style={styles.contentContainer}>
|
<View style={styles.contentContainer}>
|
||||||
{/* 标题区域 */}
|
{/* 标题区域 */}
|
||||||
<View style={styles.titleContainer}>
|
<View style={styles.titleContainer}>
|
||||||
<Text style={styles.title}>景旺冷冻仓</Text>
|
<Text style={styles.title}>仓库模板</Text>
|
||||||
<Text style={styles.subtitle}>智能仓储管理系统</Text>
|
<Text style={styles.subtitle}>智能仓储管理系统</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
|
@ -60,8 +60,8 @@ export const LoginScreen: React.FC = () => {
|
||||||
{/* Logo */}
|
{/* Logo */}
|
||||||
<View style={styles.logoWrapper}>
|
<View style={styles.logoWrapper}>
|
||||||
<View style={[styles.logoCircle, theme.shadow.medium]}>
|
<View style={[styles.logoCircle, theme.shadow.medium]}>
|
||||||
<Text style={[styles.logoText, {color: theme.colors.primary}]}>
|
<Text style={[styles.logoText, {color: theme.colors.aqua}]}>
|
||||||
JW
|
BK
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
@ -83,7 +83,7 @@ export const LoginScreen: React.FC = () => {
|
||||||
{/* 底部版权信息 */}
|
{/* 底部版权信息 */}
|
||||||
<View style={styles.footer}>
|
<View style={styles.footer}>
|
||||||
<Text style={[styles.footerText, {color: theme.colors.textLight}]}>
|
<Text style={[styles.footerText, {color: theme.colors.textLight}]}>
|
||||||
© 2024 景旺电子
|
© 2025 菲达宝开
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
@ -183,4 +183,4 @@ const styles = StyleSheet.create({
|
||||||
footerText: {
|
footerText: {
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, {useState, useEffect} from 'react';
|
||||||
import {
|
import {
|
||||||
View,
|
View,
|
||||||
Text,
|
Text,
|
||||||
|
|
@ -8,16 +8,16 @@ import {
|
||||||
ScrollView,
|
ScrollView,
|
||||||
Dimensions,
|
Dimensions,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import {useNavigation} from '@react-navigation/native';
|
||||||
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
import {NativeStackNavigationProp} from '@react-navigation/native-stack';
|
||||||
import { RootStackParamList } from '../../navigation/types';
|
import {RootStackParamList} from '../../navigation/types';
|
||||||
import { PieChart } from 'react-native-chart-kit';
|
import {PieChart} from 'react-native-chart-kit';
|
||||||
import Icon from 'react-native-vector-icons/MaterialIcons';
|
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 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<
|
type HomeScreenNavigationProp = NativeStackNavigationProp<
|
||||||
RootStackParamList,
|
RootStackParamList,
|
||||||
|
|
@ -48,8 +48,8 @@ export const HomeScreen: React.FC = () => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const menuItems: MenuItem[] = [
|
const menuItems: MenuItem[] = [
|
||||||
{ title: '空载具入库', icon: 'local-shipping', route: 'StockInEmpty' },
|
{title: '空载具入库', icon: 'local-shipping', route: 'StockInEmpty'},
|
||||||
{ title: '手动码盘入库', icon: 'inventory', route: 'StockInManual' },
|
{title: '手动码盘入库', icon: 'inventory', route: 'StockInManual'},
|
||||||
];
|
];
|
||||||
|
|
||||||
const stockData = [
|
const stockData = [
|
||||||
|
|
@ -77,23 +77,30 @@ export const HomeScreen: React.FC = () => {
|
||||||
|
|
||||||
if (!fontLoaded) {
|
if (!fontLoaded) {
|
||||||
return (
|
return (
|
||||||
<View style={[styles.loadingContainer, { backgroundColor: theme.colors.backgroundGray }]}>
|
<View
|
||||||
<Text style={{ color: theme.colors.text }}>加载图标中...</Text>
|
style={[
|
||||||
|
styles.loadingContainer,
|
||||||
|
{backgroundColor: theme.colors.backgroundGray},
|
||||||
|
]}>
|
||||||
|
<Text style={{color: theme.colors.text}}>加载图标中...</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView style={[styles.container, { backgroundColor: theme.colors.backgroundGray }]}>
|
<SafeAreaView
|
||||||
|
style={[
|
||||||
|
styles.container,
|
||||||
|
{backgroundColor: theme.colors.backgroundGray},
|
||||||
|
]}>
|
||||||
{/* 头部区域 */}
|
{/* 头部区域 */}
|
||||||
<View style={styles.headerSection}>
|
<View style={styles.headerSection}>
|
||||||
{/* 渐变背景 */}
|
{/* 渐变背景 */}
|
||||||
<LinearGradient
|
<LinearGradient
|
||||||
colors={theme.colors.gradients.primary}
|
colors={theme.colors.gradients.primary}
|
||||||
style={StyleSheet.absoluteFill}
|
style={StyleSheet.absoluteFill}
|
||||||
start={{ x: 0, y: 0 }}
|
start={{x: 0, y: 0}}
|
||||||
end={{ x: 1, y: 1 }}
|
end={{x: 1, y: 1}}>
|
||||||
>
|
|
||||||
{/* 半透明波浪效果 */}
|
{/* 半透明波浪效果 */}
|
||||||
<View style={styles.waveOverlay}>
|
<View style={styles.waveOverlay}>
|
||||||
<Svg height="100%" width={width} style={styles.waveSvg}>
|
<Svg height="100%" width={width} style={styles.waveSvg}>
|
||||||
|
|
@ -131,17 +138,25 @@ export const HomeScreen: React.FC = () => {
|
||||||
style={styles.menuButton}>
|
style={styles.menuButton}>
|
||||||
<Icon name="menu" size={24} color={theme.colors.background} />
|
<Icon name="menu" size={24} color={theme.colors.background} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<Text style={[styles.headerTitle, { color: theme.colors.background }]}>
|
<Text style={[styles.headerTitle, {color: theme.colors.background}]}>
|
||||||
景旺WMS移动终端(冷冻)
|
WMS移动终端(模板)
|
||||||
</Text>
|
</Text>
|
||||||
<TouchableOpacity style={styles.iconButton}>
|
<TouchableOpacity style={styles.iconButton}>
|
||||||
<Icon name="notifications" size={24} color={theme.colors.background} />
|
<Icon
|
||||||
|
name="notifications"
|
||||||
|
size={24}
|
||||||
|
color={theme.colors.background}
|
||||||
|
/>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* 主体内容 */}
|
{/* 主体内容 */}
|
||||||
<View style={[styles.mainContent, { backgroundColor: theme.colors.backgroundGray }]}>
|
<View
|
||||||
|
style={[
|
||||||
|
styles.mainContent,
|
||||||
|
{backgroundColor: theme.colors.backgroundGray},
|
||||||
|
]}>
|
||||||
<ScrollView contentContainerStyle={styles.scrollContent}>
|
<ScrollView contentContainerStyle={styles.scrollContent}>
|
||||||
{/* 快捷操作区 */}
|
{/* 快捷操作区 */}
|
||||||
<View style={styles.quickActions}>
|
<View style={styles.quickActions}>
|
||||||
|
|
@ -157,9 +172,17 @@ export const HomeScreen: React.FC = () => {
|
||||||
end={{x: 1, y: 0}}
|
end={{x: 1, y: 0}}
|
||||||
/>
|
/>
|
||||||
<View style={styles.iconContainer}>
|
<View style={styles.iconContainer}>
|
||||||
<Icon name={item.icon} size={32} color={theme.colors.background} />
|
<Icon
|
||||||
|
name={item.icon}
|
||||||
|
size={32}
|
||||||
|
color={theme.colors.background}
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
<Text style={[styles.actionTitle, {color: theme.colors.background}]}>
|
<Text
|
||||||
|
style={[
|
||||||
|
styles.actionTitle,
|
||||||
|
{color: theme.colors.background},
|
||||||
|
]}>
|
||||||
{item.title}
|
{item.title}
|
||||||
</Text>
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|
@ -190,21 +213,30 @@ export const HomeScreen: React.FC = () => {
|
||||||
{/* 侧边菜单 */}
|
{/* 侧边菜单 */}
|
||||||
{isDrawerOpen && (
|
{isDrawerOpen && (
|
||||||
<>
|
<>
|
||||||
<View style={[styles.drawer, { backgroundColor: theme.colors.background }]}>
|
<View
|
||||||
|
style={[styles.drawer, {backgroundColor: theme.colors.background}]}>
|
||||||
<LinearGradient
|
<LinearGradient
|
||||||
colors={theme.colors.gradients.primary}
|
colors={theme.colors.gradients.primary}
|
||||||
style={styles.drawerHeader}>
|
style={styles.drawerHeader}>
|
||||||
<Text style={[styles.drawerTitle, { color: theme.colors.background }]}>
|
<Text
|
||||||
景旺电子
|
style={[styles.drawerTitle, {color: theme.colors.background}]}>
|
||||||
|
仓库模板
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={[styles.drawerSubtitle, { color: theme.colors.background }]}>
|
<Text
|
||||||
|
style={[
|
||||||
|
styles.drawerSubtitle,
|
||||||
|
{color: theme.colors.background},
|
||||||
|
]}>
|
||||||
欢迎使用WMS移动终端
|
欢迎使用WMS移动终端
|
||||||
</Text>
|
</Text>
|
||||||
</LinearGradient>
|
</LinearGradient>
|
||||||
{menuItems.map((item, index) => (
|
{menuItems.map((item, index) => (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
key={index}
|
key={index}
|
||||||
style={[styles.drawerItem, { borderBottomColor: theme.colors.border }]}
|
style={[
|
||||||
|
styles.drawerItem,
|
||||||
|
{borderBottomColor: theme.colors.border},
|
||||||
|
]}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setIsDrawerOpen(false);
|
setIsDrawerOpen(false);
|
||||||
navigation.navigate(item.route);
|
navigation.navigate(item.route);
|
||||||
|
|
@ -212,7 +244,8 @@ export const HomeScreen: React.FC = () => {
|
||||||
<View style={styles.drawerIconContainer}>
|
<View style={styles.drawerIconContainer}>
|
||||||
<Icon name={item.icon} size={28} color={theme.colors.aqua} />
|
<Icon name={item.icon} size={28} color={theme.colors.aqua} />
|
||||||
</View>
|
</View>
|
||||||
<Text style={[styles.drawerItemText, { color: theme.colors.text }]}>
|
<Text
|
||||||
|
style={[styles.drawerItemText, {color: theme.colors.text}]}>
|
||||||
{item.title}
|
{item.title}
|
||||||
</Text>
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ export const StockInEmpty: React.FC = () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const response = await axios.post<StockInEmptyResponse>(
|
const response = await axios.post<StockInEmptyResponse>(
|
||||||
'/api/vehicle/empty-in',
|
'/api/vehicle/empty-in',
|
||||||
{vehicleNo: vehicleNo.trim()}
|
{vehicleNo: vehicleNo.trim()},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
|
|
@ -64,9 +64,7 @@ export const StockInEmpty: React.FC = () => {
|
||||||
const responseData = response.data;
|
const responseData = response.data;
|
||||||
|
|
||||||
if (responseData.code === 200) {
|
if (responseData.code === 200) {
|
||||||
Alert.alert('成功', '', [
|
Alert.alert('成功', '', [{text: '我知道了', style: 'default'}]);
|
||||||
{text: '我知道了', style: 'default'},
|
|
||||||
]);
|
|
||||||
setVehicleNo('');
|
setVehicleNo('');
|
||||||
} else {
|
} else {
|
||||||
Alert.alert('警告', `服务器返回失败:${responseData.message}`, [
|
Alert.alert('警告', `服务器返回失败:${responseData.message}`, [
|
||||||
|
|
@ -74,16 +72,21 @@ export const StockInEmpty: React.FC = () => {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Alert.alert('请求发生错误', `请求服务器发生错误:${error instanceof Error ? error.message : String(error)}`, [
|
Alert.alert(
|
||||||
{text: '我知道了', style: 'cancel'},
|
'请求发生错误',
|
||||||
]);
|
`请求服务器发生错误:${
|
||||||
|
error instanceof Error ? error.message : String(error)
|
||||||
|
}`,
|
||||||
|
[{text: '我知道了', style: 'cancel'}],
|
||||||
|
);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView style={[styles.container, {backgroundColor: theme.colors.background}]}>
|
<SafeAreaView
|
||||||
|
style={[styles.container, {backgroundColor: theme.colors.background}]}>
|
||||||
{/* 头部导航栏 */}
|
{/* 头部导航栏 */}
|
||||||
<LinearGradient
|
<LinearGradient
|
||||||
colors={theme.colors.gradients.primary}
|
colors={theme.colors.gradients.primary}
|
||||||
|
|
@ -95,7 +98,9 @@ export const StockInEmpty: React.FC = () => {
|
||||||
style={styles.backButton}>
|
style={styles.backButton}>
|
||||||
<Icon name="arrow-back" size={24} color={theme.colors.background} />
|
<Icon name="arrow-back" size={24} color={theme.colors.background} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<Text style={[styles.headerTitle, {color: theme.colors.background}]}>空载具入库</Text>
|
<Text style={[styles.headerTitle, {color: theme.colors.background}]}>
|
||||||
|
空载具入库
|
||||||
|
</Text>
|
||||||
<View style={styles.headerRight} />
|
<View style={styles.headerRight} />
|
||||||
</LinearGradient>
|
</LinearGradient>
|
||||||
|
|
||||||
|
|
@ -115,9 +120,17 @@ export const StockInEmpty: React.FC = () => {
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* 主体内容 */}
|
{/* 主体内容 */}
|
||||||
<View style={[styles.content, { backgroundColor: theme.colors.backgroundGray }]}>
|
<View
|
||||||
|
style={[
|
||||||
|
styles.content,
|
||||||
|
{backgroundColor: theme.colors.backgroundGray},
|
||||||
|
]}>
|
||||||
{/* 说明文字 */}
|
{/* 说明文字 */}
|
||||||
<View style={[styles.infoSection, {backgroundColor: `${theme.colors.aqua}15`}]}>
|
<View
|
||||||
|
style={[
|
||||||
|
styles.infoSection,
|
||||||
|
{backgroundColor: `${theme.colors.aqua}15`},
|
||||||
|
]}>
|
||||||
<Icon name="info-outline" size={24} color={theme.colors.aqua} />
|
<Icon name="info-outline" size={24} color={theme.colors.aqua} />
|
||||||
<Text style={[styles.infoText, {color: theme.colors.text}]}>
|
<Text style={[styles.infoText, {color: theme.colors.text}]}>
|
||||||
请扫描或输入载具号进行空载具入库操作
|
请扫描或输入载具号进行空载具入库操作
|
||||||
|
|
@ -129,11 +142,20 @@ export const StockInEmpty: React.FC = () => {
|
||||||
<Text style={[styles.inputLabel, {color: theme.colors.text}]}>
|
<Text style={[styles.inputLabel, {color: theme.colors.text}]}>
|
||||||
载具号 <Text style={styles.required}>*</Text>
|
载具号 <Text style={styles.required}>*</Text>
|
||||||
</Text>
|
</Text>
|
||||||
<View style={[styles.inputWrapper, {
|
<View
|
||||||
borderColor: theme.colors.border,
|
style={[
|
||||||
backgroundColor: `${theme.colors.background}CC`,
|
styles.inputWrapper,
|
||||||
}]}>
|
{
|
||||||
<Icon name="qr-code-scanner" size={24} color={theme.colors.aqua} style={styles.inputIcon} />
|
borderColor: theme.colors.border,
|
||||||
|
backgroundColor: `${theme.colors.background}CC`,
|
||||||
|
},
|
||||||
|
]}>
|
||||||
|
<Icon
|
||||||
|
name="qr-code-scanner"
|
||||||
|
size={24}
|
||||||
|
color={theme.colors.aqua}
|
||||||
|
style={styles.inputIcon}
|
||||||
|
/>
|
||||||
<TextInput
|
<TextInput
|
||||||
style={[styles.input, {color: theme.colors.text}]}
|
style={[styles.input, {color: theme.colors.text}]}
|
||||||
value={vehicleNo}
|
value={vehicleNo}
|
||||||
|
|
@ -166,8 +188,17 @@ export const StockInEmpty: React.FC = () => {
|
||||||
<ActivityIndicator color={theme.colors.background} />
|
<ActivityIndicator color={theme.colors.background} />
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Icon name="save" size={24} color={theme.colors.background} style={styles.submitIcon} />
|
<Icon
|
||||||
<Text style={[styles.submitButtonText, {color: theme.colors.background}]}>
|
name="save"
|
||||||
|
size={24}
|
||||||
|
color={theme.colors.background}
|
||||||
|
style={styles.submitIcon}
|
||||||
|
/>
|
||||||
|
<Text
|
||||||
|
style={[
|
||||||
|
styles.submitButtonText,
|
||||||
|
{color: theme.colors.background},
|
||||||
|
]}>
|
||||||
确认入库
|
确认入库
|
||||||
</Text>
|
</Text>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,9 @@ export const StockInManual: React.FC = () => {
|
||||||
|
|
||||||
const resolveVehicle = useCallback(() => {
|
const resolveVehicle = useCallback(() => {
|
||||||
const code = vehicleCode.trim();
|
const code = vehicleCode.trim();
|
||||||
if (code.length === 0 || code === lastProcessedVehicleCode) {return;}
|
if (code.length === 0 || code === lastProcessedVehicleCode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (code.length === 15) {
|
if (code.length === 15) {
|
||||||
setLastProcessedVehicleCode(code);
|
setLastProcessedVehicleCode(code);
|
||||||
|
|
@ -128,20 +130,16 @@ export const StockInManual: React.FC = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const modifyNumber = (_id: string) => {
|
const modifyNumber = (_id: string) => {
|
||||||
Alert.alert(
|
Alert.alert('修改数量', '请输入新的数量', [
|
||||||
'修改数量',
|
{text: '取消', style: 'cancel'},
|
||||||
'请输入新的数量',
|
{
|
||||||
[
|
text: '确定',
|
||||||
{text: '取消', style: 'cancel'},
|
onPress: () => {
|
||||||
{
|
// TODO: 需要实现一个自定义的输入对话框
|
||||||
text: '确定',
|
Alert.alert('提示', '此功能暂不可用,请稍后再试');
|
||||||
onPress: () => {
|
|
||||||
// TODO: 需要实现一个自定义的输入对话框
|
|
||||||
Alert.alert('提示', '此功能暂不可用,请稍后再试');
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
},
|
||||||
);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
const showDetails = (item: PackageDataItem) => {
|
const showDetails = (item: PackageDataItem) => {
|
||||||
|
|
@ -173,9 +171,9 @@ export const StockInManual: React.FC = () => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const areaIDIndex = 1; // 默认有卤
|
const areaIDIndex = 1; // 默认有卤
|
||||||
const factoryIndex = 2; // 默认二厂
|
const factoryIndex = 2; // 默认二厂
|
||||||
const statusIndex = 1; // 默认合格
|
const statusIndex = 1; // 默认合格
|
||||||
|
|
||||||
const confirm = await new Promise(resolve =>
|
const confirm = await new Promise(resolve =>
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
|
|
@ -218,16 +216,21 @@ export const StockInManual: React.FC = () => {
|
||||||
Alert.alert('警告', `服务器返回失败:${data.message}`);
|
Alert.alert('警告', `服务器返回失败:${data.message}`);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Alert.alert('请求发生错误', `请求服务器发生错误:${error instanceof Error ? error.message : String(error)}`, [
|
Alert.alert(
|
||||||
{text: '我知道了', style: 'cancel'},
|
'请求发生错误',
|
||||||
]);
|
`请求服务器发生错误:${
|
||||||
|
error instanceof Error ? error.message : String(error)
|
||||||
|
}`,
|
||||||
|
[{text: '我知道了', style: 'cancel'}],
|
||||||
|
);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[styles.container, {backgroundColor: theme.colors.background}]}>
|
<View
|
||||||
|
style={[styles.container, {backgroundColor: theme.colors.background}]}>
|
||||||
{/* 头部导航栏 */}
|
{/* 头部导航栏 */}
|
||||||
<LinearGradient
|
<LinearGradient
|
||||||
colors={theme.colors.gradients.primary}
|
colors={theme.colors.gradients.primary}
|
||||||
|
|
@ -260,10 +263,18 @@ export const StockInManual: React.FC = () => {
|
||||||
</Svg>
|
</Svg>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={[styles.mainContent, { backgroundColor: theme.colors.backgroundGray }]}>
|
<View
|
||||||
|
style={[
|
||||||
|
styles.mainContent,
|
||||||
|
{backgroundColor: theme.colors.backgroundGray},
|
||||||
|
]}>
|
||||||
<ScrollView contentContainerStyle={styles.scrollContent}>
|
<ScrollView contentContainerStyle={styles.scrollContent}>
|
||||||
{/* 信息提示区 */}
|
{/* 信息提示区 */}
|
||||||
<View style={[styles.infoSection, {backgroundColor: `${theme.colors.aqua}15`}]}>
|
<View
|
||||||
|
style={[
|
||||||
|
styles.infoSection,
|
||||||
|
{backgroundColor: `${theme.colors.aqua}15`},
|
||||||
|
]}>
|
||||||
<Icon name="info-outline" size={24} color={theme.colors.aqua} />
|
<Icon name="info-outline" size={24} color={theme.colors.aqua} />
|
||||||
<Text style={[styles.infoText, {color: theme.colors.text}]}>
|
<Text style={[styles.infoText, {color: theme.colors.text}]}>
|
||||||
请先扫描载具号,然后添加物料信息进行码盘入库
|
请先扫描载具号,然后添加物料信息进行码盘入库
|
||||||
|
|
@ -272,12 +283,23 @@ export const StockInManual: React.FC = () => {
|
||||||
|
|
||||||
{/* 载具号输入区 */}
|
{/* 载具号输入区 */}
|
||||||
<View style={styles.inputContainer}>
|
<View style={styles.inputContainer}>
|
||||||
<Text style={[styles.label, {color: theme.colors.text}]}>载具号</Text>
|
<Text style={[styles.label, {color: theme.colors.text}]}>
|
||||||
<View style={[styles.inputWrapper, {
|
载具号
|
||||||
borderColor: theme.colors.border,
|
</Text>
|
||||||
backgroundColor: `${theme.colors.background}CC`,
|
<View
|
||||||
}]}>
|
style={[
|
||||||
<Icon name="qr-code-scanner" size={24} color={theme.colors.aqua} style={styles.inputIcon} />
|
styles.inputWrapper,
|
||||||
|
{
|
||||||
|
borderColor: theme.colors.border,
|
||||||
|
backgroundColor: `${theme.colors.background}CC`,
|
||||||
|
},
|
||||||
|
]}>
|
||||||
|
<Icon
|
||||||
|
name="qr-code-scanner"
|
||||||
|
size={24}
|
||||||
|
color={theme.colors.aqua}
|
||||||
|
style={styles.inputIcon}
|
||||||
|
/>
|
||||||
<TextInput
|
<TextInput
|
||||||
ref={vehicleInputRef}
|
ref={vehicleInputRef}
|
||||||
style={[styles.input, {color: theme.colors.text}]}
|
style={[styles.input, {color: theme.colors.text}]}
|
||||||
|
|
@ -290,7 +312,11 @@ export const StockInManual: React.FC = () => {
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={() => setVehicleCode('')}
|
onPress={() => setVehicleCode('')}
|
||||||
style={styles.clearButton}>
|
style={styles.clearButton}>
|
||||||
<Icon name="cancel" size={20} color={theme.colors.textLight} />
|
<Icon
|
||||||
|
name="cancel"
|
||||||
|
size={20}
|
||||||
|
color={theme.colors.textLight}
|
||||||
|
/>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|
@ -298,12 +324,23 @@ export const StockInManual: React.FC = () => {
|
||||||
|
|
||||||
{/* 条码输入区 */}
|
{/* 条码输入区 */}
|
||||||
<View style={styles.inputContainer}>
|
<View style={styles.inputContainer}>
|
||||||
<Text style={[styles.label, {color: theme.colors.text}]}>物料条码</Text>
|
<Text style={[styles.label, {color: theme.colors.text}]}>
|
||||||
<View style={[styles.inputWrapper, {
|
物料条码
|
||||||
borderColor: theme.colors.border,
|
</Text>
|
||||||
backgroundColor: `${theme.colors.background}CC`,
|
<View
|
||||||
}]}>
|
style={[
|
||||||
<Icon name="qr-code-2" size={24} color={theme.colors.aqua} style={styles.inputIcon} />
|
styles.inputWrapper,
|
||||||
|
{
|
||||||
|
borderColor: theme.colors.border,
|
||||||
|
backgroundColor: `${theme.colors.background}CC`,
|
||||||
|
},
|
||||||
|
]}>
|
||||||
|
<Icon
|
||||||
|
name="qr-code-2"
|
||||||
|
size={24}
|
||||||
|
color={theme.colors.aqua}
|
||||||
|
style={styles.inputIcon}
|
||||||
|
/>
|
||||||
<TextInput
|
<TextInput
|
||||||
ref={goodsInputRef}
|
ref={goodsInputRef}
|
||||||
style={[styles.input, {color: theme.colors.text}]}
|
style={[styles.input, {color: theme.colors.text}]}
|
||||||
|
|
@ -316,7 +353,11 @@ export const StockInManual: React.FC = () => {
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={() => setGoodsCode('')}
|
onPress={() => setGoodsCode('')}
|
||||||
style={styles.clearButton}>
|
style={styles.clearButton}>
|
||||||
<Icon name="cancel" size={20} color={theme.colors.textLight} />
|
<Icon
|
||||||
|
name="cancel"
|
||||||
|
size={20}
|
||||||
|
color={theme.colors.textLight}
|
||||||
|
/>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|
@ -332,8 +373,14 @@ export const StockInManual: React.FC = () => {
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={styles.buttonContent}
|
style={styles.buttonContent}
|
||||||
onPress={resolveCode}>
|
onPress={resolveCode}>
|
||||||
<Icon name="add-circle-outline" size={24} color={theme.colors.background} style={styles.buttonIcon} />
|
<Icon
|
||||||
<Text style={[styles.buttonText, {color: theme.colors.background}]}>
|
name="add-circle-outline"
|
||||||
|
size={24}
|
||||||
|
color={theme.colors.background}
|
||||||
|
style={styles.buttonIcon}
|
||||||
|
/>
|
||||||
|
<Text
|
||||||
|
style={[styles.buttonText, {color: theme.colors.background}]}>
|
||||||
添加物料
|
添加物料
|
||||||
</Text>
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|
@ -347,8 +394,14 @@ export const StockInManual: React.FC = () => {
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={styles.buttonContent}
|
style={styles.buttonContent}
|
||||||
onPress={wheelComplete}>
|
onPress={wheelComplete}>
|
||||||
<Icon name="check-circle-outline" size={24} color={theme.colors.background} style={styles.buttonIcon} />
|
<Icon
|
||||||
<Text style={[styles.buttonText, {color: theme.colors.background}]}>
|
name="check-circle-outline"
|
||||||
|
size={24}
|
||||||
|
color={theme.colors.background}
|
||||||
|
style={styles.buttonIcon}
|
||||||
|
/>
|
||||||
|
<Text
|
||||||
|
style={[styles.buttonText, {color: theme.colors.background}]}>
|
||||||
码盘完成
|
码盘完成
|
||||||
</Text>
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|
@ -364,31 +417,59 @@ export const StockInManual: React.FC = () => {
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{packageData.map((item) => (
|
{packageData.map(item => (
|
||||||
<View
|
<View key={item.id} style={[styles.card]}>
|
||||||
key={item.id}
|
<View
|
||||||
style={[styles.card]}>
|
style={[
|
||||||
<View style={[StyleSheet.absoluteFill, {borderRadius: 12, backgroundColor: theme.colors.background}]} />
|
StyleSheet.absoluteFill,
|
||||||
|
{
|
||||||
|
borderRadius: 12,
|
||||||
|
backgroundColor: theme.colors.background,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
{/* 卡片头部 */}
|
{/* 卡片头部 */}
|
||||||
<View style={styles.cardHeader}>
|
<View style={styles.cardHeader}>
|
||||||
<View style={styles.cardHeaderLeft}>
|
<View style={styles.cardHeaderLeft}>
|
||||||
<Text style={[styles.cardHeaderText, {color: theme.colors.text}]}>
|
<Text
|
||||||
|
style={[
|
||||||
|
styles.cardHeaderText,
|
||||||
|
{color: theme.colors.text},
|
||||||
|
]}>
|
||||||
序号:{item.id}
|
序号:{item.id}
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={[styles.cardHeaderText, {color: theme.colors.text}]}>
|
<Text
|
||||||
|
style={[
|
||||||
|
styles.cardHeaderText,
|
||||||
|
{color: theme.colors.text},
|
||||||
|
]}>
|
||||||
采购单号:{item.segment1}
|
采购单号:{item.segment1}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.cardActions}>
|
<View style={styles.cardActions}>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={[styles.cardActionButton, {backgroundColor: `${theme.colors.aqua}15`}]}
|
style={[
|
||||||
|
styles.cardActionButton,
|
||||||
|
{backgroundColor: `${theme.colors.aqua}15`},
|
||||||
|
]}
|
||||||
onPress={() => showDetails(item)}>
|
onPress={() => showDetails(item)}>
|
||||||
<Icon name="info-outline" size={20} color={theme.colors.aqua} />
|
<Icon
|
||||||
|
name="info-outline"
|
||||||
|
size={20}
|
||||||
|
color={theme.colors.aqua}
|
||||||
|
/>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={[styles.cardActionButton, {backgroundColor: `${theme.colors.error}15`}]}
|
style={[
|
||||||
|
styles.cardActionButton,
|
||||||
|
{backgroundColor: `${theme.colors.error}15`},
|
||||||
|
]}
|
||||||
onPress={() => deleteItem(item.id)}>
|
onPress={() => deleteItem(item.id)}>
|
||||||
<Icon name="delete-outline" size={20} color={theme.colors.error} />
|
<Icon
|
||||||
|
name="delete-outline"
|
||||||
|
size={20}
|
||||||
|
color={theme.colors.error}
|
||||||
|
/>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
@ -397,37 +478,83 @@ export const StockInManual: React.FC = () => {
|
||||||
<View style={styles.cardContent}>
|
<View style={styles.cardContent}>
|
||||||
<View style={styles.cardRow}>
|
<View style={styles.cardRow}>
|
||||||
<View style={styles.cardField}>
|
<View style={styles.cardField}>
|
||||||
<Text style={[styles.cardLabel, {color: theme.colors.textLight}]}>物料号</Text>
|
<Text
|
||||||
<Text style={[styles.cardValue, {color: theme.colors.text}]}>{item.itemId}</Text>
|
style={[
|
||||||
|
styles.cardLabel,
|
||||||
|
{color: theme.colors.textLight},
|
||||||
|
]}>
|
||||||
|
物料号
|
||||||
|
</Text>
|
||||||
|
<Text
|
||||||
|
style={[styles.cardValue, {color: theme.colors.text}]}>
|
||||||
|
{item.itemId}
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.cardField}>
|
<View style={styles.cardField}>
|
||||||
<Text style={[styles.cardLabel, {color: theme.colors.textLight}]}>批次号</Text>
|
<Text
|
||||||
<Text style={[styles.cardValue, {color: theme.colors.text}]}>{item.batch}</Text>
|
style={[
|
||||||
|
styles.cardLabel,
|
||||||
|
{color: theme.colors.textLight},
|
||||||
|
]}>
|
||||||
|
批次号
|
||||||
|
</Text>
|
||||||
|
<Text
|
||||||
|
style={[styles.cardValue, {color: theme.colors.text}]}>
|
||||||
|
{item.batch}
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={styles.cardRow}>
|
<View style={styles.cardRow}>
|
||||||
<View style={styles.cardField}>
|
<View style={styles.cardField}>
|
||||||
<Text style={[styles.cardLabel, {color: theme.colors.textLight}]}>数量</Text>
|
<Text
|
||||||
|
style={[
|
||||||
|
styles.cardLabel,
|
||||||
|
{color: theme.colors.textLight},
|
||||||
|
]}>
|
||||||
|
数量
|
||||||
|
</Text>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={styles.editableValue}
|
style={styles.editableValue}
|
||||||
onPress={() => modifyNumber(item.id)}>
|
onPress={() => modifyNumber(item.id)}>
|
||||||
<Text style={[styles.cardValue, {color: theme.colors.text}]}>
|
<Text
|
||||||
|
style={[
|
||||||
|
styles.cardValue,
|
||||||
|
{color: theme.colors.text},
|
||||||
|
]}>
|
||||||
{item.quantity}
|
{item.quantity}
|
||||||
</Text>
|
</Text>
|
||||||
<Icon name="edit" size={16} color={theme.colors.text} />
|
<Icon name="edit" size={16} color={theme.colors.text} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.cardField}>
|
<View style={styles.cardField}>
|
||||||
<Text style={[styles.cardLabel, {color: theme.colors.textLight}]}>重量</Text>
|
<Text
|
||||||
<Text style={[styles.cardValue, {color: theme.colors.text}]}>{item.weight}</Text>
|
style={[
|
||||||
|
styles.cardLabel,
|
||||||
|
{color: theme.colors.textLight},
|
||||||
|
]}>
|
||||||
|
重量
|
||||||
|
</Text>
|
||||||
|
<Text
|
||||||
|
style={[styles.cardValue, {color: theme.colors.text}]}>
|
||||||
|
{item.weight}
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={styles.cardRow}>
|
<View style={styles.cardRow}>
|
||||||
<View style={styles.cardField}>
|
<View style={styles.cardField}>
|
||||||
<Text style={[styles.cardLabel, {color: theme.colors.textLight}]}>生产日期</Text>
|
<Text
|
||||||
<Text style={[styles.cardValue, {color: theme.colors.text}]}>{item.productData}</Text>
|
style={[
|
||||||
|
styles.cardLabel,
|
||||||
|
{color: theme.colors.textLight},
|
||||||
|
]}>
|
||||||
|
生产日期
|
||||||
|
</Text>
|
||||||
|
<Text
|
||||||
|
style={[styles.cardValue, {color: theme.colors.text}]}>
|
||||||
|
{item.productData}
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
@ -438,8 +565,16 @@ export const StockInManual: React.FC = () => {
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{loading && (
|
{loading && (
|
||||||
<View style={[styles.loadingOverlay, {backgroundColor: 'rgba(0, 0, 0, 0.7)'}]}>
|
<View
|
||||||
<View style={[styles.loadingCard, {backgroundColor: theme.colors.background}]}>
|
style={[
|
||||||
|
styles.loadingOverlay,
|
||||||
|
{backgroundColor: 'rgba(0, 0, 0, 0.7)'},
|
||||||
|
]}>
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
styles.loadingCard,
|
||||||
|
{backgroundColor: theme.colors.background},
|
||||||
|
]}>
|
||||||
<ActivityIndicator size="large" color={theme.colors.aqua} />
|
<ActivityIndicator size="large" color={theme.colors.aqua} />
|
||||||
<Text style={[styles.loadingText, {color: theme.colors.text}]}>
|
<Text style={[styles.loadingText, {color: theme.colors.text}]}>
|
||||||
正在请求入库...
|
正在请求入库...
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user