物料绑定页面

This commit is contained in:
hehaibing-1996
2025-01-16 08:07:24 +08:00
parent d7beec871c
commit 143c37421e
24 changed files with 665 additions and 76 deletions

16
PDA/PDA/config.js Normal file
View File

@ -0,0 +1,16 @@
// config.js
export function saveConfig(key, value) {
// 使用 uni.setStorageSync 保存配置
uni.setStorageSync(key, value);
}
export function getConfig(key, defaultValue) {
// 使用 uni.getStorageSync 获取配置,如果没有则返回默认值
return uni.getStorageSync(key) || defaultValue;
}
export function getServerIPAndPort() {
var serverIP = getConfig('serverIP', '127.0.0.1');
var serverPort = getConfig('serverPort', '8888');
return serverIP + ':' + serverPort;
}

View File

@ -3,7 +3,28 @@
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "智慧物流系统-移动端"
"navigationBarTitleText": "智慧物流系统-登录"
}
},
{
"path" : "pages/config/config",
"style" :
{
"navigationBarTitleText" : "智慧物流系统-用户配置"
}
},
{
"path" : "pages/main/main",
"style" :
{
"navigationBarTitleText" : "智慧物流系统-主页"
}
},
{
"path" : "pages/bind/bind",
"style" :
{
"navigationBarTitleText" : "智慧物流系统-物料绑定"
}
}
],

181
PDA/PDA/pages/bind/bind.vue Normal file
View File

@ -0,0 +1,181 @@
<template>
<view class="bg-image">
<view class="diy-flex-row">
<view style="flex: 3">
<!-- 占位 -->
</view>
<view style="flex: 80;margin: 5rpx;">
<view class="diy-flex-row">
<view class="rightImageContainer" style="flex: 12;padding-top: 20rpx;">
<image style="width: 60rpx;height: 60rpx" src="/static/scan.png" />
</view>
<view class="uni-input-wrapper" style="flex: 60;">
<input id="inputMatCode" class="uni-input" style="font-size: 50rpx; padding: 10rpx;" placeholder="请先扫描工位码"
v-model="matCode"></input>
</view>
<view style="flex: 3;">
</view>
<view style="flex: 30;">
<button>查询</button>
</view>
</view>
</view>
<view style="flex: 3">
<!-- 占位 -->
</view>
</view>
<view class="diy-flex-column" style="margin-top: 20rpx;">
<view class="diy-flex-inforow" style="flex: 1;">
<view style="flex: 5;"></view>
<view style="flex: 35;">工位编码</view>
<view style="flex: 50;">{{locationCode}}</view>
<view style="flex: 40;">
<button class="mini-btn" type="warn" size="mini">呼叫货架</button>
</view>
</view>
<view class="diy-flex-inforow" style="flex: 1;">
<view style="flex: 5;"></view>
<view style="flex: 35;">货架编码</view>
<view style="flex: 90;">{{shelfCode}}</view>
</view>
<view class="diy-flex-inforow" style="flex: 1;">
<view style="flex: 5;"></view>
<view style="flex: 35;">物料编码</view>
<view style="flex: 90;">{{matCode}}</view>
</view>
<view class="diy-flex-inforow" style="flex: 1;">
<view style="flex: 5;"></view>
<view style="flex: 35;">物料名称</view>
<view style="flex: 90;">{{matName}}</view>
</view>
<view class="diy-flex-inforow" style="flex: 1;">
<view style="flex: 5;"></view>
<view style="flex: 35;">物料规格</view>
<view style="flex: 90;">{{matSpec}}</view>
</view>
<view class="diy-flex-inforow" style="flex: 1;">
<view style="flex: 5;"></view>
<view style="flex: 35;">物料数量</view>
<view class="uni-input-wrapper" style="flex: 50;">
<input class="uni-input" style="font-size: 40rpx; " placeholder="请输入物料数量" v-model="matQty"></input>
</view>
<view style="flex: 40;">
<button @click="bind" class="mini-btn" style="margin-left: 10rpx;" type="warn"
size="mini">绑定</button>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
matCode: '',
locationCode: '',
shelfCode: '',
matCode: '',
matName: '',
matSpec: '',
matQty: 100
}
},
methods: {
bind: function() {
console.log('123');
document.getElementById('inputMatCode').scrollIntoView(true);
console.log('111');
},
}
}
</script>
<style>
.uni-input-wrapper {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
flex-wrap: nowrap;
background-color: #FFFFFF;
}
.mini-btn {
margin-right: 10rpx;
}
.bg-image {
background-image: url('/static/background.png');
/* 背景图片路径 */
background-size: cover;
/* 背景图片覆盖整个元素 */
background-position: center;
/* 背景图片居中 */
height: 100%;
/* 视图高度设置为100% */
width: 100%;
/* 视图宽度设置为100% */
position: fixed;
/* 视图定位为固定 */
top: 0;
left: 0;
/* z-index: -1; */
}
.diy-flex-row {
display: flex;
flex-direction: row;
margin-top: 15rpx;
margin-bottom: 15rpx;
font-size: 50rpx;
}
.diy-flex-column {
display: flex;
flex-direction: column;
}
.diy-flex-inforow {
display: flex;
flex-direction: row;
font-size: 40rpx;
font-weight: 500;
margin-top: 8rpx;
margin-bottom: 8rpx;
}
</style>

View File

@ -0,0 +1,73 @@
<template>
<view class="container">
<view>
<label>服务器IP:</label>
<input v-model="serverIP" placeholder="请输入服务器IP" />
</view>
<view>
<label>服务器端口:</label>
<input v-model="serverPort" placeholder="请输入服务器端口" />
</view>
<button @click="saveConfigs">保存配置</button>
</view>
</template>
<script>
import {
saveConfig
} from '@/config.js';
import {
getConfig
} from '@/config.js';
export default {
data() {
return {
serverIP: '',
serverPort: ''
};
},
onLoad:function() {
this.serverIP = getConfig('serverIP', '127.0.0.1');
this.serverPort = getConfig('serverPort', '8888');
},
methods: {
saveConfigs() {
saveConfig('serverIP', this.serverIP);
saveConfig('serverPort', this.serverPort);
uni.showToast({
title: '配置保存成功',
icon: 'success'
});
}
}
};
</script>
<style>
.container {
padding: 20px;
}
label {
display: block;
margin-bottom: 10px;
}
input {
width: 100%;
padding: 10px;
margin-bottom: 20px;
}
button {
padding: 10px 20px;
background-color: #1aad19;
color: white;
border: none;
border-radius: 5px;
}
</style>

View File

@ -1,27 +1,45 @@
<template>
<view class="bg-image">
<image class="logo" src="/static/logo.png"></image>
<navigator url="../config/config" hover-class="navigator-hover">
<image class="logo" src="/static/logo.png"></image>
</navigator>
<view class="text-area">
<text class="title">{{title}}</text>
</view>
<view class="logo">
<view class="uni-flex uni-row">
<view class="uni-flex uni-column" style="flex: 1;">
<view class="uni-flex" style="flex: 1;">户昵称</view>
<text class="uni-flex" style="flex: 1;">123</view>
<view style="margin-top:90rpx;margin-bottom: 90rpx;">
<view class="diy-flex-column">
<view class="diy-flex-row">
<view style="flex: 5;"></view>
<view style="flex: 15;">&nbsp;&nbsp;&nbsp;&nbsp;</view>
<view style="flex: 20;" class="uni-input-wrapper">
<input class="uni-input" style="font-size: 50rpx;" placeholder="请输入用户名"
v-model="userName"></input>
</view>
<view style="flex: 5;"></view>
</view>
<view class="uni-flex uni-column" style="flex: 1;">
<view class="uni-flex" style="flex: 1;">设备型号</view>
<view class="uni-flex" style="flex: 1;">123</view>
<view class="diy-flex-row">
<view style="flex: 5;"></view>
<view style="flex: 15;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</view>
<view style="flex: 20;" class="uni-input-wrapper">
<input class="uni-input" style="font-size: 50rpx;" placeholder="请输入密码" :password="showPassword"
v-model="passWord"></input>
</view>
<view style="flex: 5;"></view>
</view>
</view>
</view>
<view style="margin-top:70rpx;margin-bottom: 20rpx;">
<button @click="login" style="margin-left: 90rpx;margin-right: 90rpx;" type="default"
plain="true">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</button>
</view>
<view style="margin-top:70rpx;margin-bottom: 20rpx;text-align: center;">
<view >{{serverIPAndPort}}</view>
</view>
</view>
</template>
@ -29,31 +47,47 @@
import {
recive
} from '../../src/libs/Broadcast.js';
import {
unregisterReceiver
} from '../../src/libs/Broadcast.js';
import {
getConfig
} from '@/config.js';
import {
getServerIPAndPort
} from '@/config.js';
import {
saveConfig
} from '@/config.js';
export default {
data() {
return {
title: '登录'
title: '登录',
showPassword: true,
userName: '',
passWord: '',
serverIPAndPort: '',
}
},
onShow: function() {
const self = this; // 保存this的引用
recive(function(res) {
console.log("Success:" + res.data);
self.getEquipmentInfo(res.data);
}, function(err) {
console.log("Error:", JSON.stringify(err)); // 正确打印错误信息
});
this.serverIPAndPort = getServerIPAndPort();
},
onLoad: function() {
//加载上一次的用户名
//FOR DEBUG
this.userName = getConfig('userName', 'admin');
this.passWord = getConfig('passWord', 'admin123');
},
onUnload: function() {
unregisterReceiver()
},
methods: {
getEquipmentInfo(encodedString) {
// 去除末尾的逗号和"..."(如果有的话)
encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
console.log("1:" + encodedString);
@ -76,13 +110,100 @@
this.title = originalString;
console.log("4:" + this.title);
},
login() {
var serverIPAndPort = getServerIPAndPort();
console.log('http://' + serverIPAndPort + '/user/userLogin');
uni.request({
url: 'http://' + serverIPAndPort + '/user/userLogin', // 请求的接口地址
method: 'POST', // 设置请求方式为 POST
data: {
"username": this.userName,
"password": this.passWord,
"deviceType": "PDA"
},
header: {
'Content-Type': 'application/json', // 如果需要以JSON格式发送数据
},
success: (res) => {
// 请求成功的回调函数
if (res.statusCode === 200) {
//接口返回数据为200 表示获取成功!
if (res.data.code == 200) {
uni.showToast({
title: '登录成功!',
icon: 'none',
duration: 1500
});
//保存本次登录使用的用户名 密码
saveConfig('userName', this.userName);
saveConfig('passWord', this.passWord);
//重定向 直接就不能返回这个页面了
uni.redirectTo({
url: '/pages/main/main'
});
} else {
uni.showToast({
title: '获取设备基本信息失败:' + res.data.message,
icon: 'none',
duration: 2000
});
}
} else {
this.text = '服务器返回错误状态码' + res.statusCode;
}
},
fail: (err) => {
// 请求失败的回调函数
uni.showToast({
title: '请求失败' + err,
icon: 'none',
duration: 2000
});
},
complete: (event) => {
// 请求完成的回调函数(无论成功或失败都会调用)
console.log('请求完成', event);
}
});
},
}
}
</script>
<style>
.uni-input {
height: 30px;
line-height: 30px;
padding: 0px;
background-color: #FFFFFF;
}
.uni-input-wrapper {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
flex-wrap: nowrap;
background-color: #FFFFFF;
}
.diy-flex-row {
display: flex;
flex-direction: row;
margin-top: 15rpx;
margin-bottom: 15rpx;
font-size: 50rpx;
}
.diy-flex-column {
display: flex;
flex-direction: column;
}
.bg-image {
background-image: url('/static/背景.png');
background-image: url('/static/background.png');
/* 背景图片路径 */
background-size: cover;
/* 背景图片覆盖整个元素 */
@ -98,16 +219,16 @@
left: 0;
/* z-index: -1; */
}
.logo {
display: flex;
justify-content: center;
height: 200rpx;
width: 200rpx;
margin-top: 25rpx;
margin-top: 30rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 25rpx;
margin-bottom: 30rpx;
}
.text-area {
@ -116,7 +237,7 @@
}
.title {
font-size: 50rpx;
font-size: 55rpx;
color: #000000;
}
</style>

129
PDA/PDA/pages/main/main.vue Normal file
View File

@ -0,0 +1,129 @@
<template>
<view class="bg-image">
<view>
<navigator url="../index/index" open-type="redirect" hover-class="other-navigator-hover">
<view class="logOut-container">
<image class="logOut-image" src="/static/logOut.png"></image>
</view>
</navigator>
</view>
<view style="display: flex;flex-direction: row;margin-bottom: 10rpx;margin-top: 30rpx;">
<view style="flex: 1;"></view>
<view class="uni-flex uni-column" style="flex: 5;">
<navigator url="../bind/bind" hover-class="navigator-hover">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/bind.png" />
</view>
<view class="function-text">物料绑定</view>
</navigator>
</view>
<view class="uni-flex uni-column" style="flex: 5;">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/bindQuery.png" />
</view>
<view class="function-text">绑定查询</view>
</view>
<view class="uni-flex uni-column" style="flex: 5;">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/callIn.png" />
</view>
<view class="function-text">产线呼叫</view>
</view>
<view style="flex: 1;"></view>
</view>
<view style="display: flex;flex-direction: row;margin-bottom: 10rpx;margin-top: 30rpx;">
<view style="flex: 1;"></view>
<view class="uni-flex uni-column" style="flex: 5;">
<navigator url="../bind/bind" hover-class="navigator-hover">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/callOut.png" />
</view>
<view class="function-text">货架送回</view>
</navigator>
</view>
<view class="uni-flex uni-column" style="flex: 5;">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/stockTaking.png" />
</view>
<view class="function-text">库存盘点</view>
</view>
<view class="uni-flex uni-column" style="flex: 5;">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/task.png" />
</view>
<view class="function-text">任务管理</view>
</view>
<view style="flex: 1;"></view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
.bg-image {
background-image: url('/static/background.png');
/* 背景图片路径 */
background-size: cover;
/* 背景图片覆盖整个元素 */
background-position: center;
/* 背景图片居中 */
height: 100%;
/* 视图高度设置为100% */
width: 100%;
/* 视图宽度设置为100% */
position: fixed;
/* 视图定位为固定 */
top: 0;
left: 0;
/* z-index: -1; */
}
.logOut-container {
display: flex;
flex-direction: row;
justify-content: flex-end;
/* 水平方向上靠右 */
align-items: flex-start;
/* 垂直方向上靠上 */
height: 100%;
/* 或者其他适当的值 */
/* 其他样式 */
}
.logOut-image {
top: 20rpx;
right: 20rpx;
height: 60rpx;
width: 60rpx;
/* 不需要额外的定位样式 */
}
.function-image {
height: 140rpx;
width: 140rpx;
margin: 20rpx;
padding-left: 20rpx;
}
.function-text {
color: black;
text-align: center;
font-weight: bold;
font-size: 35rpx;
}
</style>

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

BIN
PDA/PDA/static/bind.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
PDA/PDA/static/callIn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
PDA/PDA/static/callOut.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
PDA/PDA/static/logOut.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

BIN
PDA/PDA/static/scan.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
PDA/PDA/static/task.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 850 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -0,0 +1,48 @@
.bg-image {
background-image: url('../../static/background.png');
/* 背景图片路径 */
background-size: cover;
/* 背景图片覆盖整个元素 */
background-position: center;
/* 背景图片居中 */
height: 100%;
/* 视图高度设置为100% */
width: 100%;
/* 视图宽度设置为100% */
position: fixed;
/* 视图定位为固定 */
top: 0;
left: 0;
/* z-index: -1; */
}
.logOut-container {
display: flex;
flex-direction: row;
justify-content: flex-end;
/* 水平方向上靠右 */
align-items: flex-start;
/* 垂直方向上靠上 */
height: 100%;
/* 或者其他适当的值 */
/* 其他样式 */
}
.logOut-image {
top: 0.625rem;
right: 0.625rem;
height: 1.875rem;
width: 1.875rem;
/* 不需要额外的定位样式 */
}
.function-image {
height: 4.375rem;
width: 4.375rem;
margin: 0.625rem;
padding-left: 0.625rem;
}
.function-text {
color: black;
text-align: center;
font-weight: bold;
font-size: 1.09375rem;
}

View File

@ -398,57 +398,57 @@ namespace WCS.BLL.Services.Service
}
else//登录模式需要校验密码
{
#region
if (LocalFile.Config.IsMx)
{
#region
try
{
var body = new
{
uername = request.UserName,
password = request.PassWord,
};
var Result = ApiHelp.GetDataFromHttpShortTime<MXResponse>("http://192.168.2.23:9213/integrate/login/queryGenerLogin", body, "POST", true);
//账号密码验证成功
if (Result != null && Result.code == 200)
{
//判断系统中是否有对应用户
user = await AuthDbHelp.db.Queryable<UserBase>()
.Where(t => t.LoginName == request.UserName)
.FirstAsync();
//Mes登录成功后wcs这边也添加一个用户
if (user == null)
{
user = new UserBase()
{
LoginName = request.UserName,
Password = request.PassWord,
RoleIds = new List<int>() { 2 },
IsAdmin = false,
Time = DateTime.Now,
};
await AuthDbHelp.db.Insertable(user).ExecuteCommandAsync();
}
else if (user.Password != request.PassWord)
{
user.Password = request.PassWord;
await AuthDbHelp.db.Updateable(user).ExecuteCommandAsync();
}
}
//账号密码验证失败
else
{
//#region 盟讯公司登录接入系统接
//if (LocalFile.Config.IsMx)
//{
// #region 调用接口 接入盟讯公司登
// try
// {
// var body = new
// {
// uername = request.UserName,
// password = request.PassWord,
// };
// var Result = ApiHelp.GetDataFromHttpShortTime<MXResponse>("http://192.168.2.23:9213/integrate/login/queryGenerLogin", body, "POST", true);
// //账号密码验证成功
// if (Result != null && Result.code == 200)
// {
// //判断系统中是否有对应用户
// user = await AuthDbHelp.db.Queryable<UserBase>()
// .Where(t => t.LoginName == request.UserName)
// .FirstAsync();
// //Mes登录成功后wcs这边也添加一个用户
// if (user == null)
// {
// user = new UserBase()
// {
// LoginName = request.UserName,
// Password = request.PassWord,
// RoleIds = new List<int>() { 2 },
// IsAdmin = false,
// Time = DateTime.Now,
// };
// await AuthDbHelp.db.Insertable(user).ExecuteCommandAsync();
// }
// else if (user.Password != request.PassWord)
// {
// user.Password = request.PassWord;
// await AuthDbHelp.db.Updateable(user).ExecuteCommandAsync();
// }
// }
// //账号密码验证失败
// else
// {
}
}
catch (Exception e)
{
// }
// }
// catch (Exception e)
// {
}
#endregion
}
#endregion
// }
// #endregion
//}
//#endregion
if (user == null)
user = await AuthDbHelp.db.Queryable<UserBase>()
.Where(t => t.LoginName == request.UserName)