PDA任务查询功能优化

This commit is contained in:
hehaibing-1996
2025-02-25 19:51:07 +08:00
parent 44fb5831b2
commit f7d15a1f73
3 changed files with 224 additions and 51 deletions

View File

@ -22,9 +22,10 @@
<label>任务状态</label> <label>任务状态</label>
<text>{{fixedInfo.taskStatusStr}}</text> <text>{{fixedInfo.taskStatusStr}}</text>
</view> </view>
<view> <view>
<button style="background-color: bisque;margin-top: 10rpx;" @click="saveData">{{fixedInfo.buttonMode}}</button> <button style="background-color: bisque;margin-top: 10rpx;"
@click="saveData">{{fixedInfo.buttonMode}}</button>
</view> </view>
<view class="button-group"> <view class="button-group">
@ -72,7 +73,14 @@
<view style="display: flex;flex-direction: row;width: 455rpx;"> <view style="display: flex;flex-direction: row;width: 455rpx;">
<view>任务状态</view> <view>任务状态</view>
<view>123</view> <view class="picker-container" style="font-size: 30rpx;">
<picker :range="taskStatusOptions" @change="onTaskStatusChange" range-key="taskStatusName"
:value="selectedtaskStatusIndex">
<view class="uni-input" style="padding-left: 5rpx;">
{{taskStatusOptions[selectedtaskStatusIndex].taskStatusName}}
</view>
</picker>
</view>
</view> </view>
</view> </view>
@ -140,8 +148,8 @@
shelfCode: '', shelfCode: '',
startLocationCode: '', startLocationCode: '',
endLocationCode: '', endLocationCode: '',
taskStatusStr:'', taskStatusStr: '',
buttonMode:'无法操作' buttonMode: '无法操作'
}; };
const popup = ref(null); const popup = ref(null);
const inputValue = ref(''); const inputValue = ref('');
@ -153,20 +161,15 @@
fixedInfo.startLocationCode = info.startLocationCode; fixedInfo.startLocationCode = info.startLocationCode;
fixedInfo.endLocationCode = info.endLocationCode; fixedInfo.endLocationCode = info.endLocationCode;
fixedInfo.taskStatusStr = info.taskStatusStr; fixedInfo.taskStatusStr = info.taskStatusStr;
if(info.taskStatusStr == '已创建' || info.taskStatusStr == '正在执行') if (info.taskStatusStr == '已创建' || info.taskStatusStr == '正在执行') {
{
fixedInfo.buttonMode = '取消任务'; fixedInfo.buttonMode = '取消任务';
} } else if (info.taskStatusStr == '取消完成') {
else if(info.taskStatusStr == '取消完成')
{
fixedInfo.buttonMode = '重新发送'; fixedInfo.buttonMode = '重新发送';
} } else {
else
{
fixedInfo.buttonMode = '无法操作'; fixedInfo.buttonMode = '无法操作';
} }
popup.value.open(); popup.value.open();
}; };
@ -177,18 +180,13 @@
const saveData = () => { const saveData = () => {
var url = ''; var url = '';
var serverIPAndPort = getServerIPAndPort(); var serverIPAndPort = getServerIPAndPort();
if(fixedInfo.taskStatusStr == '已创建' || fixedInfo.taskStatusStr == '正在执行') if (fixedInfo.taskStatusStr == '已创建' || fixedInfo.taskStatusStr == '正在执行') {
{
//取消任务 //取消任务
url = 'http://' + serverIPAndPort + '/agvTask/cancelAGVTask'; url = 'http://' + serverIPAndPort + '/agvTask/cancelAGVTask';
} } else if (fixedInfo.taskStatusStr == '取消完成') {
else if(fixedInfo.taskStatusStr == '取消完成')
{
//重新发送任务 //重新发送任务
url = 'http://' + serverIPAndPort + '/agvTask/resendAGVTask'; url = 'http://' + serverIPAndPort + '/agvTask/resendAGVTask';
} } else {
else
{
return; return;
} }
//调用接口进行数量的修改 //调用接口进行数量的修改
@ -216,7 +214,7 @@
duration: 2000 duration: 2000
}); });
proxy.analysisScanCode(); proxy.analysisScanCode();
} else { } else {
uni.showToast({ uni.showToast({
title: '操作失败:' + res.data.message, title: '操作失败:' + res.data.message,
@ -277,6 +275,13 @@
touchStartX: 0, touchStartX: 0,
touchStartY: 0, touchStartY: 0,
isMove: false, //滑动标识 是否滑动 isMove: false, //滑动标识 是否滑动
// 货架区域选项
taskStatusOptions: [{
id: null,
taskStatusName: '全部'
}],
selectedtaskStatusIndex: 0, //
} }
}, },
onShow: function() { onShow: function() {
@ -289,17 +294,23 @@
}, function(err) { }, function(err) {
console.log("Error:", JSON.stringify(err)); // 正确打印错误信息 console.log("Error:", JSON.stringify(err)); // 正确打印错误信息
}); });
self.getTaskStatus();
}, },
methods: { methods: {
onTaskStatusChange(e) {
this.selectedtaskStatusIndex = e.detail.value;
this.analysisScanCode();
},
analysisScanCode: function() { analysisScanCode: function() {
//调用接口获取当前工位信息 当前工位是否有货架 //获取任务
var serverIPAndPort = getServerIPAndPort(); var serverIPAndPort = getServerIPAndPort();
uni.request({ uni.request({
url: 'http://' + serverIPAndPort + url: 'http://' + serverIPAndPort +
'/agvTask/getAGVTasks', // 请求的接口地址 '/agvTask/getAGVTasks', // 请求的接口地址
method: 'POST', // 设置请求方式为 POST method: 'POST', // 设置请求方式为 POST
data: { data: {
"taskStatus": null, "taskStatus": this.taskStatusOptions[this.selectedtaskStatusIndex].id,
"userName": this.userName, "userName": this.userName,
"deviceType": "PDA", "deviceType": "PDA",
"pageNumber": 1, "pageNumber": 1,
@ -316,20 +327,17 @@
//未查询到信息 //未查询到信息
if (res.data.data == null || res.data.data.count == 0) { if (res.data.data == null || res.data.data.count == 0) {
uni.showToast({ uni.showToast({
title: '未查询到对应状态的任务信息!', title: '未查询到状态为['+this.taskStatusOptions[this.selectedtaskStatusIndex].taskStatusName+']的任务信息!',
icon: 'none', icon: 'none',
duration: 1500 duration: 2500
}); });
this.clear();
return; return;
} }
//有物料信息 //有物料信息
this.cardData = res.data.data.lists; this.cardData = res.data.data.lists;
this.recordCount = res.data.data.count; this.recordCount = res.data.data.count;
uni.showToast({
title: '获取成功!',
icon: 'none',
duration: 100
});
} else { } else {
uni.showToast({ uni.showToast({
@ -367,9 +375,59 @@
}, },
getTaskStatus: function() {
//获取任务
var serverIPAndPort = getServerIPAndPort();
uni.request({
url: 'http://' + serverIPAndPort +
'/agvTask/getAGVTaskStatus', // 请求的接口地址
method: 'POST', // 设置请求方式为 POST
data: {
"userName": this.userName,
"deviceType": "PDA",
},
header: {
'Content-Type': 'application/json', // 如果需要以JSON格式发送数据
},
success: (res) => {
// 请求成功的回调函数
if (res.statusCode === 200) {
//接口返回数据为200 表示获取成功!
if (res.data.code == 200) {
//未查询到信息
if (res.data.data == null || res.data.data.count == 0) {
return;
}
this.taskStatusOptions = res.data.data;
this.selectedtaskStatusIndex = 2;//默认查询正在执行的任务
this.analysisScanCode();
} else {
return;
}
} else {
return;
}
},
fail: (err) => {
// 请求失败的回调函数
return;
},
complete: (event) => {
// 请求完成的回调函数(无论成功或失败都会调用)
console.log('请求完成', event);
}
});
},
//清空当前界面所有内容 //清空当前界面所有内容
clear: function() { clear: function() {
this.placeholderText = '请先扫描货架码'; this.placeholderText = '';
this.cardData = null; this.cardData = null;
this.recordCount = 0; this.recordCount = 0;
}, },
@ -498,4 +556,16 @@
color: #fff; color: #fff;
cursor: pointer; cursor: pointer;
} }
.picker-container {
border-radius: 5rpx;
border: 2rpx solid #000;
/* 设置边框宽度和颜色 */
margin-left: 25rpx;
margin-right: 25rpx;
/* 上下边距为5rpx左右边距自动以实现水平居中 */
width: 200rpx;
/* 设置宽度 */
/* 其他样式保持不变 */
}
</style> </style>

View File

@ -5545,21 +5545,33 @@ if (uni.restoreGlobal) {
//监控滑动的位置 //监控滑动的位置
touchStartX: 0, touchStartX: 0,
touchStartY: 0, touchStartY: 0,
isMove: false isMove: false,
//滑动标识 是否滑动 //滑动标识 是否滑动
// 货架区域选项
taskStatusOptions: [{
id: null,
taskStatusName: "全部"
}],
selectedtaskStatusIndex: 0
//
}; };
}, },
onShow: function() { onShow: function() {
this.userName = getConfig("userName", "admin"); this.userName = getConfig("userName", "admin");
const self = this; const self = this;
recive(function(res) { recive(function(res) {
formatAppLog("log", "at pages/agvTasks/agvTasks.vue:287", "Success:" + res.data); formatAppLog("log", "at pages/agvTasks/agvTasks.vue:292", "Success:" + res.data);
self.analysisScanCode(); self.analysisScanCode();
}, function(err) { }, function(err) {
formatAppLog("log", "at pages/agvTasks/agvTasks.vue:290", "Error:", JSON.stringify(err)); formatAppLog("log", "at pages/agvTasks/agvTasks.vue:295", "Error:", JSON.stringify(err));
}); });
self.getTaskStatus();
}, },
methods: { methods: {
onTaskStatusChange(e) {
this.selectedtaskStatusIndex = e.detail.value;
this.analysisScanCode();
},
analysisScanCode: function() { analysisScanCode: function() {
var serverIPAndPort = getServerIPAndPort(); var serverIPAndPort = getServerIPAndPort();
uni.request({ uni.request({
@ -5568,7 +5580,7 @@ if (uni.restoreGlobal) {
method: "POST", method: "POST",
// 设置请求方式为 POST // 设置请求方式为 POST
data: { data: {
"taskStatus": null, "taskStatus": this.taskStatusOptions[this.selectedtaskStatusIndex].id,
"userName": this.userName, "userName": this.userName,
"deviceType": "PDA", "deviceType": "PDA",
"pageNumber": 1, "pageNumber": 1,
@ -5583,19 +5595,15 @@ if (uni.restoreGlobal) {
if (res.data.code == 200) { if (res.data.code == 200) {
if (res.data.data == null || res.data.data.count == 0) { if (res.data.data == null || res.data.data.count == 0) {
uni.showToast({ uni.showToast({
title: "未查询到对应状态的任务信息!", title: "未查询到状态为[" + this.taskStatusOptions[this.selectedtaskStatusIndex].taskStatusName + "]的任务信息!",
icon: "none", icon: "none",
duration: 1500 duration: 2500
}); });
this.clear();
return; return;
} }
this.cardData = res.data.data.lists; this.cardData = res.data.data.lists;
this.recordCount = res.data.data.count; this.recordCount = res.data.data.count;
uni.showToast({
title: "获取成功!",
icon: "none",
duration: 100
});
} else { } else {
uni.showToast({ uni.showToast({
title: "获取失败:" + res.data.message, title: "获取失败:" + res.data.message,
@ -5622,13 +5630,52 @@ if (uni.restoreGlobal) {
this.clear(); this.clear();
}, },
complete: (event) => { complete: (event) => {
formatAppLog("log", "at pages/agvTasks/agvTasks.vue:364", "请求完成", event); formatAppLog("log", "at pages/agvTasks/agvTasks.vue:372", "请求完成", event);
}
});
},
getTaskStatus: function() {
var serverIPAndPort = getServerIPAndPort();
uni.request({
url: "http://" + serverIPAndPort + "/agvTask/getAGVTaskStatus",
// 请求的接口地址
method: "POST",
// 设置请求方式为 POST
data: {
"userName": this.userName,
"deviceType": "PDA"
},
header: {
"Content-Type": "application/json"
// 如果需要以JSON格式发送数据
},
success: (res) => {
if (res.statusCode === 200) {
if (res.data.code == 200) {
if (res.data.data == null || res.data.data.count == 0) {
return;
}
this.taskStatusOptions = res.data.data;
this.selectedtaskStatusIndex = 2;
this.analysisScanCode();
} else {
return;
}
} else {
return;
}
},
fail: (err) => {
return;
},
complete: (event) => {
formatAppLog("log", "at pages/agvTasks/agvTasks.vue:420", "请求完成", event);
} }
}); });
}, },
//清空当前界面所有内容 //清空当前界面所有内容
clear: function() { clear: function() {
this.placeholderText = "请先扫描货架码"; this.placeholderText = "";
this.cardData = null; this.cardData = null;
this.recordCount = 0; this.recordCount = 0;
}, },
@ -5799,7 +5846,28 @@ if (uni.restoreGlobal) {
vue.createElementVNode("view", { style: { "width": "10rpx" } }), vue.createElementVNode("view", { style: { "width": "10rpx" } }),
vue.createElementVNode("view", { style: { "display": "flex", "flex-direction": "row", "width": "455rpx" } }, [ vue.createElementVNode("view", { style: { "display": "flex", "flex-direction": "row", "width": "455rpx" } }, [
vue.createElementVNode("view", null, "任务状态:"), vue.createElementVNode("view", null, "任务状态:"),
vue.createElementVNode("view", null, "123") vue.createElementVNode("view", {
class: "picker-container",
style: { "font-size": "30rpx" }
}, [
vue.createElementVNode("picker", {
range: $data.taskStatusOptions,
onChange: _cache[5] || (_cache[5] = (...args) => $options.onTaskStatusChange && $options.onTaskStatusChange(...args)),
"range-key": "taskStatusName",
value: $data.selectedtaskStatusIndex
}, [
vue.createElementVNode(
"view",
{
class: "uni-input",
style: { "padding-left": "5rpx" }
},
vue.toDisplayString($data.taskStatusOptions[$data.selectedtaskStatusIndex].taskStatusName),
1
/* TEXT */
)
], 40, ["range", "value"])
])
]) ])
]) ])
]), ]),
@ -5817,8 +5885,8 @@ if (uni.restoreGlobal) {
vue.renderList($data.cardData, (item, index) => { vue.renderList($data.cardData, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", { return vue.openBlock(), vue.createElementBlock("view", {
key: index, key: index,
onTouchstart: _cache[5] || (_cache[5] = (...args) => $options.cardTouchStart && $options.cardTouchStart(...args)), onTouchstart: _cache[6] || (_cache[6] = (...args) => $options.cardTouchStart && $options.cardTouchStart(...args)),
onTouchmove: _cache[6] || (_cache[6] = (...args) => $options.cardTouchMove && $options.cardTouchMove(...args)), onTouchmove: _cache[7] || (_cache[7] = (...args) => $options.cardTouchMove && $options.cardTouchMove(...args)),
onLongpress: ($event) => $options.longpress(item) onLongpress: ($event) => $options.longpress(item)
}, [ }, [
vue.createVNode(_component_TaskCard, { vue.createVNode(_component_TaskCard, {

View File

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json; using Newtonsoft.Json;
using NPOI.POIFS.Crypt.Dsig;
using NPOI.SS.Formula.Functions; using NPOI.SS.Formula.Functions;
using SqlSugar; using SqlSugar;
using WCS.BLL; using WCS.BLL;
@ -31,6 +32,40 @@ namespace WCS.WebApi.Controllers
_PDAMatBindService = PDAMatBindService; _PDAMatBindService = PDAMatBindService;
} }
[Route("getAGVTaskStatus")]
[HttpPost(Name = "getAGVTaskStatus")]
public async Task<ResponseCommon> getAGVTaskStatus(RequestBase request)
{
try
{
var status = new List<GetAGVTasksResponseData>();
status.Add(new GetAGVTasksResponseData{Id = null,TaskStatusName="全部" });
var statusesInDb = Enum.GetValues(typeof(TaskStatusEnum))
.Cast<TaskStatusEnum>()
.ToList();
statusesInDb.ForEach(t => status.Add(new GetAGVTasksResponseData{ Id = (int)t,TaskStatusName = t.ToString()}));
return new ResponseCommon
{
Code=200,
Data = status,
Message = "success"
};
}
catch (Exception ex)
{
return new ResponseCommon
{
Code = 300,
Message = $"操作失败:{ex.Message}",
};
}
}
public class GetAGVTasksResponseData
{
public int? Id { get; set; }
public string TaskStatusName { get; set; }
}
/// <summary> /// <summary>
/// 获取AGV任务列表 /// 获取AGV任务列表
/// </summary> /// </summary>
@ -47,7 +82,7 @@ namespace WCS.WebApi.Controllers
.WhereIF(string.IsNullOrEmpty(request.CreateUser), t => t.CreateUser.Contains(request.CreateUser)) .WhereIF(string.IsNullOrEmpty(request.CreateUser), t => t.CreateUser.Contains(request.CreateUser))
.WhereIF(string.IsNullOrEmpty(request.StartLocationCode), t => t.StartLocationCode.Contains(request.StartLocationCode)) .WhereIF(string.IsNullOrEmpty(request.StartLocationCode), t => t.StartLocationCode.Contains(request.StartLocationCode))
.WhereIF(string.IsNullOrEmpty(request.EndLocationCode), t => t.StartLocationCode.Contains(request.EndLocationCode)) .WhereIF(string.IsNullOrEmpty(request.EndLocationCode), t => t.StartLocationCode.Contains(request.EndLocationCode))
.WhereIF(request.TaskStatus !=null, t => t.TaskStatus == request.TaskStatus); .WhereIF(request.TaskStatus != null, t => t.TaskStatus == request.TaskStatus);
var totalCount = await recordsQueryable.CountAsync(); var totalCount = await recordsQueryable.CountAsync();
var records = await recordsQueryable var records = await recordsQueryable