PDA产线呼叫功能优化
This commit is contained in:
@ -2,10 +2,10 @@
|
|||||||
<view class="bg-image">
|
<view class="bg-image">
|
||||||
<uni-popup ref="popup" type="dialog">
|
<uni-popup ref="popup" type="dialog">
|
||||||
<view class="popup-content">
|
<view class="popup-content">
|
||||||
<view style="margin: 3rpx;">
|
<view style="margin: 3rpx;">
|
||||||
<label>是否呼叫以下货架:</label>
|
<label>是否呼叫以下货架:</label>
|
||||||
</view>
|
</view>
|
||||||
<view style="font-size: 52rpx;text-align: center;margin-top: 15rpx;margin-bottom: 10rpx;">
|
<view style="font-size: 52rpx;text-align: center;margin-top: 15rpx;margin-bottom: 10rpx;">
|
||||||
<text>{{fixedInfo.shelfCode}}</text>
|
<text>{{fixedInfo.shelfCode}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="button-group">
|
<view class="button-group">
|
||||||
@ -33,7 +33,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view style="flex: 30;">
|
<view style="flex: 30;">
|
||||||
<button @click="queryMatList">查询</button>
|
<button @click="queryMatList(true)">查询</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -155,10 +155,7 @@
|
|||||||
//接口返回数据为200 表示获取成功!
|
//接口返回数据为200 表示获取成功!
|
||||||
if (res.data.code == 200) {
|
if (res.data.code == 200) {
|
||||||
hidePopup();
|
hidePopup();
|
||||||
|
proxy.queryMatList(false);
|
||||||
|
|
||||||
proxy.queryMatList();
|
|
||||||
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '呼叫成功!',
|
title: '呼叫成功!',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@ -166,9 +163,9 @@
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.data.message,
|
title: '呼叫失败:' + res.data.message,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2500
|
duration: 4000
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,6 +237,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
//扫码获取工位信息
|
||||||
analysisScanCode: function(encodedString) {
|
analysisScanCode: function(encodedString) {
|
||||||
// 去除末尾的逗号和"..."(如果有的话)
|
// 去除末尾的逗号和"..."(如果有的话)
|
||||||
encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
|
encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
|
||||||
@ -323,18 +321,21 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
//搜索获取物料信息
|
//搜索获取物料信息
|
||||||
queryMatList: function() {
|
queryMatList: function(isTip) {
|
||||||
if (this.locationCode == null || this.locationCode == '') {
|
if (this.locationCode == null || this.locationCode == '') {
|
||||||
uni.showToast({
|
if (isTip) {
|
||||||
title: '请先扫描工位码!',
|
uni.showToast({
|
||||||
icon: 'none',
|
title: '请先扫描工位码!',
|
||||||
duration: 1000
|
icon: 'none',
|
||||||
});
|
duration: 1000
|
||||||
|
});
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.matCodeCondition == this.locationCode) {
|
if (this.matCodeCondition == this.locationCode) {
|
||||||
this.matCodeCondition = '';
|
this.matCodeCondition = '';
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
var serverIPAndPort = getServerIPAndPort();
|
var serverIPAndPort = getServerIPAndPort();
|
||||||
uni.request({
|
uni.request({
|
||||||
@ -358,51 +359,62 @@
|
|||||||
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({
|
if (isTip) {
|
||||||
title: '获取失败!',
|
uni.showToast({
|
||||||
icon: 'none',
|
title: '获取失败!',
|
||||||
duration: 1500
|
icon: 'none',
|
||||||
});
|
duration: 1500
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
this.clear();
|
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({
|
if (isTip) {
|
||||||
title: '获取成功!',
|
uni.showToast({
|
||||||
icon: 'none',
|
title: '获取成功!',
|
||||||
duration: 100
|
icon: 'none',
|
||||||
});
|
duration: 100
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
if (isTip) {
|
||||||
title: '获取失败:' + res.data.message,
|
uni.showToast({
|
||||||
icon: 'none',
|
title: '获取失败:' + res.data.message,
|
||||||
duration: 3500
|
icon: 'none',
|
||||||
});
|
duration: 3500
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
this.clear();
|
this.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
if (isTip) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '服务器返回错误状态码' + res.statusCode,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 3000
|
||||||
|
});
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
if (isTip) {
|
||||||
|
// 请求失败的回调函数
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '服务器返回错误状态码' + res.statusCode,
|
title: '请求失败:' + err.errMsg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 3000
|
duration: 3000
|
||||||
});
|
});
|
||||||
this.clear();
|
this.clear();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
|
||||||
// 请求失败的回调函数
|
|
||||||
uni.showToast({
|
|
||||||
title: '请求失败:' + err.errMsg,
|
|
||||||
icon: 'none',
|
|
||||||
duration: 3000
|
|
||||||
});
|
|
||||||
|
|
||||||
this.clear();
|
|
||||||
},
|
|
||||||
complete: (event) => {
|
complete: (event) => {
|
||||||
// 请求完成的回调函数(无论成功或失败都会调用)
|
// 请求完成的回调函数(无论成功或失败都会调用)
|
||||||
console.log('请求完成', event);
|
console.log('请求完成', event);
|
||||||
|
@ -546,7 +546,7 @@
|
|||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '获取成功!',
|
title: '获取成功!',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 100
|
duration: 500
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -4239,7 +4239,7 @@ if (uni.restoreGlobal) {
|
|||||||
if (res.statusCode === 200) {
|
if (res.statusCode === 200) {
|
||||||
if (res.data.code == 200) {
|
if (res.data.code == 200) {
|
||||||
hidePopup();
|
hidePopup();
|
||||||
proxy.queryMatList();
|
proxy.queryMatList(false);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "呼叫成功!",
|
title: "呼叫成功!",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
@ -4247,9 +4247,9 @@ if (uni.restoreGlobal) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.data.message,
|
title: "呼叫失败:" + res.data.message,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
duration: 2500
|
duration: 4e3
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -4308,13 +4308,14 @@ if (uni.restoreGlobal) {
|
|||||||
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/productionLineCallIn/productionLineCallIn.vue:235", "Success:" + res.data);
|
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:232", "Success:" + res.data);
|
||||||
self.analysisScanCode(res.data);
|
self.analysisScanCode(res.data);
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:239", "Error:", JSON.stringify(err));
|
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:236", "Error:", JSON.stringify(err));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
//扫码获取工位信息
|
||||||
analysisScanCode: function(encodedString) {
|
analysisScanCode: function(encodedString) {
|
||||||
encodedString = encodedString.replace(/,\s*\.\.\.$/, "");
|
encodedString = encodedString.replace(/,\s*\.\.\.$/, "");
|
||||||
this.locationCode = encodedString;
|
this.locationCode = encodedString;
|
||||||
@ -4375,22 +4376,25 @@ if (uni.restoreGlobal) {
|
|||||||
this.clearLocation();
|
this.clearLocation();
|
||||||
},
|
},
|
||||||
complete: (event) => {
|
complete: (event) => {
|
||||||
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:318", "请求完成", event);
|
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:316", "请求完成", event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//搜索获取物料信息
|
//搜索获取物料信息
|
||||||
queryMatList: function() {
|
queryMatList: function(isTip) {
|
||||||
if (this.locationCode == null || this.locationCode == "") {
|
if (this.locationCode == null || this.locationCode == "") {
|
||||||
uni.showToast({
|
if (isTip) {
|
||||||
title: "请先扫描工位码!",
|
uni.showToast({
|
||||||
icon: "none",
|
title: "请先扫描工位码!",
|
||||||
duration: 1e3
|
icon: "none",
|
||||||
});
|
duration: 1e3
|
||||||
|
});
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.matCodeCondition == this.locationCode) {
|
if (this.matCodeCondition == this.locationCode) {
|
||||||
this.matCodeCondition = "";
|
this.matCodeCondition = "";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
var serverIPAndPort = getServerIPAndPort();
|
var serverIPAndPort = getServerIPAndPort();
|
||||||
uni.request({
|
uni.request({
|
||||||
@ -4413,48 +4417,58 @@ if (uni.restoreGlobal) {
|
|||||||
if (res.statusCode === 200) {
|
if (res.statusCode === 200) {
|
||||||
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({
|
if (isTip) {
|
||||||
title: "获取失败!",
|
uni.showToast({
|
||||||
icon: "none",
|
title: "获取失败!",
|
||||||
duration: 1500
|
icon: "none",
|
||||||
});
|
duration: 1500
|
||||||
|
});
|
||||||
|
}
|
||||||
this.clear();
|
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({
|
if (isTip) {
|
||||||
title: "获取成功!",
|
uni.showToast({
|
||||||
icon: "none",
|
title: "获取成功!",
|
||||||
duration: 100
|
icon: "none",
|
||||||
});
|
duration: 100
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
if (isTip) {
|
||||||
title: "获取失败:" + res.data.message,
|
uni.showToast({
|
||||||
icon: "none",
|
title: "获取失败:" + res.data.message,
|
||||||
duration: 3500
|
icon: "none",
|
||||||
});
|
duration: 3500
|
||||||
|
});
|
||||||
|
}
|
||||||
this.clear();
|
this.clear();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (isTip) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "服务器返回错误状态码" + res.statusCode,
|
||||||
|
icon: "none",
|
||||||
|
duration: 3e3
|
||||||
|
});
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
if (isTip) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "服务器返回错误状态码" + res.statusCode,
|
title: "请求失败:" + err.errMsg,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
duration: 3e3
|
duration: 3e3
|
||||||
});
|
});
|
||||||
this.clear();
|
this.clear();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
|
||||||
uni.showToast({
|
|
||||||
title: "请求失败:" + err.errMsg,
|
|
||||||
icon: "none",
|
|
||||||
duration: 3e3
|
|
||||||
});
|
|
||||||
this.clear();
|
|
||||||
},
|
|
||||||
complete: (event) => {
|
complete: (event) => {
|
||||||
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:408", "请求完成", event);
|
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:420", "请求完成", event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -4564,7 +4578,7 @@ if (uni.restoreGlobal) {
|
|||||||
vue.createElementVNode("view", { style: { "flex": "3" } }),
|
vue.createElementVNode("view", { style: { "flex": "3" } }),
|
||||||
vue.createElementVNode("view", { style: { "flex": "30" } }, [
|
vue.createElementVNode("view", { style: { "flex": "30" } }, [
|
||||||
vue.createElementVNode("button", {
|
vue.createElementVNode("button", {
|
||||||
onClick: _cache[4] || (_cache[4] = (...args) => $options.queryMatList && $options.queryMatList(...args))
|
onClick: _cache[4] || (_cache[4] = ($event) => $options.queryMatList(true))
|
||||||
}, "查询")
|
}, "查询")
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
@ -4993,7 +5007,7 @@ if (uni.restoreGlobal) {
|
|||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "获取成功!",
|
title: "获取成功!",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
duration: 100
|
duration: 500
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System;
|
||||||
using WCS.BLL.DbModels;
|
using WCS.BLL.DbModels;
|
||||||
|
using WCS.BLL.Manager;
|
||||||
using WCS.BLL.Services.IService;
|
using WCS.BLL.Services.IService;
|
||||||
using WCS.BLL.Services.Service;
|
using WCS.BLL.Services.Service;
|
||||||
using WCS.DAL.Db;
|
using WCS.DAL.Db;
|
||||||
@ -117,7 +119,7 @@ namespace WCS.WebApi.Controllers
|
|||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
{
|
{
|
||||||
Code = 201,
|
Code = 201,
|
||||||
Message = $"参数错误:请重新扫描工位码!",
|
Message = $"参数错误,请重新扫描工位码!",
|
||||||
Data = null,
|
Data = null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -130,7 +132,7 @@ namespace WCS.WebApi.Controllers
|
|||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
{
|
{
|
||||||
Code = 201,
|
Code = 201,
|
||||||
Message = $"获取失败:工位{request.LocationCode}不存在!",
|
Message = $"工位{request.LocationCode}不存在!",
|
||||||
Data = null,
|
Data = null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -139,20 +141,24 @@ namespace WCS.WebApi.Controllers
|
|||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
{
|
{
|
||||||
Code = 201,
|
Code = 201,
|
||||||
Message = $"获取失败:工位{locationInfo.LocationCode}已被禁用!",
|
Message = $"工位{locationInfo.LocationCode}已被禁用!",
|
||||||
Data = null,
|
Data = null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var shelfInfo = await DbHelp.db.Queryable<ShelfInfo>()
|
var shelfInfo = await DbHelp.db.Queryable<ShelfInfo>()
|
||||||
.Where(t => t.CurrentLocationId == locationInfo.Id)
|
.Where(t => t.CurrentLocationId == locationInfo.Id || t.DestinationLocationId == locationInfo.Id)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
if (shelfInfo != null)
|
if (shelfInfo != null)
|
||||||
{
|
{
|
||||||
|
if (shelfInfo.TransStatus == TransStatusEnum.运输中)
|
||||||
|
{
|
||||||
|
shelfInfo.ShelfCode = shelfInfo.ShelfCode + "(运输中)";
|
||||||
|
}
|
||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
{
|
{
|
||||||
Code = 301,
|
Code = 301,
|
||||||
Message = $"获取失败:工位{locationInfo.LocationCode}已被货架{shelfInfo.ShelfCode}占用!",
|
Message = $"当前工位[{locationInfo.LocationCode}]\r\n已被货架[{shelfInfo.ShelfCode}]占用\r\n无法通过此功能进行呼叫!",
|
||||||
Data = null,
|
Data = null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -163,7 +169,7 @@ namespace WCS.WebApi.Controllers
|
|||||||
.LeftJoin<ShelfInfo>((mci, si) => mci.ShelfId == si.Id)
|
.LeftJoin<ShelfInfo>((mci, si) => mci.ShelfId == si.Id)
|
||||||
//货架状态是静止的 代表这个货架没有被呼叫走哦
|
//货架状态是静止的 代表这个货架没有被呼叫走哦
|
||||||
.LeftJoin<LocationInfo>((mci, si, li) => (si.TransStatus == TransStatusEnum.静止 && si.CurrentLocationId == li.Id))
|
.LeftJoin<LocationInfo>((mci, si, li) => (si.TransStatus == TransStatusEnum.静止 && si.CurrentLocationId == li.Id))
|
||||||
.WhereIF(!string.IsNullOrEmpty(request.MatCodeCondition), (mci, si, li) => mci.MatCode.Contains(request.MatCodeCondition))
|
.WhereIF(!string.IsNullOrEmpty(request.MatCodeCondition), (mci, si, li) => mci.MatCode.Contains(request.MatCodeCondition) || mci.MatName.Contains(request.MatCodeCondition))
|
||||||
.Select((mci, si, li) => new MatDetailCurrentInfoModel()
|
.Select((mci, si, li) => new MatDetailCurrentInfoModel()
|
||||||
{
|
{
|
||||||
Id = mci.Id,
|
Id = mci.Id,
|
||||||
@ -235,42 +241,55 @@ namespace WCS.WebApi.Controllers
|
|||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
{
|
{
|
||||||
Code = 201,
|
Code = 201,
|
||||||
Message = $"呼叫失败:请重新扫描工位码!",
|
Message = $"请重新扫描工位码!",
|
||||||
Data = null,
|
Data = null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
//获取位置信息
|
//获取位置信息
|
||||||
var locationInfo = await DbHelp.db.Queryable<LocationInfo>()
|
var endLocation = await DbHelp.db.Queryable<LocationInfo>()
|
||||||
.Where(t => t.Id == request.LocationId)
|
.Where(t => t.Id == request.LocationId)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
if (locationInfo == null)
|
if (endLocation == null)
|
||||||
{
|
{
|
||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
{
|
{
|
||||||
Code = 201,
|
Code = 201,
|
||||||
Message = $"呼叫失败:工位{request.LocationCode}不存在!",
|
Message = $"当前工位{request.LocationCode}不存在!",
|
||||||
Data = null,
|
Data = null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (locationInfo.IsEnable == false)
|
if (endLocation.IsEnable == false)
|
||||||
{
|
{
|
||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
{
|
{
|
||||||
Code = 201,
|
Code = 201,
|
||||||
Message = $"呼叫失败:工位{locationInfo.LocationCode}已被禁用!",
|
Message = $"当前工位{endLocation.LocationCode}已被禁用!",
|
||||||
Data = null,
|
Data = null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var shelfInfo = await DbHelp.db.Queryable<ShelfInfo>()
|
var shelfInfo = await DbHelp.db.Queryable<ShelfInfo>()
|
||||||
.Where(t => t.CurrentLocationId == locationInfo.Id)
|
.Where(t => t.CurrentLocationId == endLocation.Id && t.TransStatus == TransStatusEnum.静止)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
if (shelfInfo != null)
|
if (shelfInfo != null)
|
||||||
{
|
{
|
||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
{
|
{
|
||||||
Code = 301,
|
Code = 301,
|
||||||
Message = $"呼叫失败:工位{locationInfo.LocationCode}已被货架{shelfInfo.ShelfCode}占用!",
|
Message = $"当前工位{endLocation.LocationCode}已被货架{shelfInfo.ShelfCode}占用!",
|
||||||
|
Data = null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
shelfInfo = await DbHelp.db.Queryable<ShelfInfo>()
|
||||||
|
.Where(t => t.DestinationLocationId == endLocation.Id && t.TransStatus == TransStatusEnum.运输中)
|
||||||
|
.FirstAsync();
|
||||||
|
if (shelfInfo != null)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 301,
|
||||||
|
Message = $"当前工位{endLocation.LocationCode}已呼叫货架{shelfInfo.ShelfCode}!\r\n请勿重新呼叫!",
|
||||||
Data = null,
|
Data = null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -286,31 +305,100 @@ namespace WCS.WebApi.Controllers
|
|||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
{
|
{
|
||||||
Code = 201,
|
Code = 201,
|
||||||
Message = $"呼叫失败:货架{shelfInfo.ShelfCode}不存在或已被禁用!",
|
Message = $"货架{shelfInfo.ShelfCode}不存在或已被禁用!",
|
||||||
Data = null,
|
Data = null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shelfInfo.TransStatus == TransStatusEnum.运输中)
|
if (shelfInfo.TransStatus == TransStatusEnum.运输中)
|
||||||
|
{
|
||||||
|
if (shelfInfo.DestinationLocationId == request.LocationId)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"呼叫失败:货架{shelfInfo.ShelfCode}已呼叫至当前工位,请等待!",
|
||||||
|
Data = null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"呼叫失败:货架{shelfInfo.ShelfCode}正在被运输中,请选择其他货架!",
|
||||||
|
Data = null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取起点位置
|
||||||
|
if (shelfInfo.CurrentLocationId == 0 || string.IsNullOrEmpty(shelfInfo.CurrentLocaiotnCode))
|
||||||
{
|
{
|
||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
{
|
{
|
||||||
Code = 201,
|
Code = 201,
|
||||||
Message = $"呼叫失败:货架{shelfInfo.ShelfCode}正在运输中!",
|
Message = $"货架{shelfInfo.ShelfCode}未与位置绑定,无法呼叫!",
|
||||||
|
Data = null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
var startLocation = await DbHelp.db.Queryable<LocationInfo>()
|
||||||
|
.Where(t => t.Id == shelfInfo.CurrentLocationId)
|
||||||
|
.FirstAsync();
|
||||||
|
if (startLocation == null)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"货架{shelfInfo.ShelfCode}未与位置绑定,无法呼叫!",
|
||||||
|
Data = null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (startLocation.IsEnable == false)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"货架{shelfInfo.ShelfCode}所在位置已被禁用,无法呼叫!",
|
||||||
Data = null,
|
Data = null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region
|
#region 调用AGV接口
|
||||||
//TO DO 调用AGV接口开始呼叫 呼叫成功更新运输状态和目标库位
|
var response = AGVManager.GenAgvSchedulingTask(startLocation, endLocation, shelfInfo.ShelfCode, request.UserName);
|
||||||
|
if (response.code == "0" && response.message == "成功")
|
||||||
return new ResponseCommon()
|
|
||||||
{
|
{
|
||||||
Code = 200,
|
//更新货架位置信息
|
||||||
Message = $"呼叫成功!",
|
shelfInfo.TransStatus = TransStatusEnum.运输中;
|
||||||
Data = null,
|
shelfInfo.DestinationLocationId = endLocation.Id;
|
||||||
};
|
shelfInfo.DestinationLocaiotnCode = endLocation.LocationCode;
|
||||||
|
DbHelp.db.Updateable(shelfInfo).ExecuteCommand();
|
||||||
|
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 200,
|
||||||
|
Message = "success",
|
||||||
|
Data = null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else if (response.code == "-999")
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"{response.message}\r\n请重试或等待上一个任务完成",
|
||||||
|
Data = null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"海康RCS返回:{response.message}",
|
||||||
|
Data = null,
|
||||||
|
};
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
Reference in New Issue
Block a user