代码提交:货架送回

This commit is contained in:
hehaibing-1996
2025-02-20 17:05:26 +08:00
parent 5ae90bc9cd
commit b837395528
10 changed files with 778 additions and 295 deletions

View File

@ -32,7 +32,7 @@
<text>{{item.modifyUser}}</text> <text>{{item.modifyUser}}</text>
</view> </view>
<view class="content-time"> <view class="content-time">
<text>绑定时间:</text> <text>最后更新时间:</text>
<text>{{item.modifyTime}}</text> <text>{{item.modifyTime}}</text>
</view> </view>
</view> </view>

View File

@ -36,7 +36,7 @@
</view> </view>
<view class="uni-input-wrapper" style="flex: 60;"> <view class="uni-input-wrapper" style="flex: 60;">
<input id="inputMatCode" class="uni-input" style="font-size: 50rpx; padding: 10rpx;" <input ref="inputMatCode" class="uni-input" style="font-size: 50rpx; padding: 10rpx;"
:placeholder="placeholderText" v-model="matCodeCondition" @blur="queryMatList"></input> :placeholder="placeholderText" v-model="matCodeCondition" @blur="queryMatList"></input>
</view> </view>
@ -58,7 +58,7 @@
<view style="width: 740;">货架码:{{shelfCode}}</view> <view style="width: 740;">货架码:{{shelfCode}}</view>
</view> </view>
<view class="diy-flex-inforow"> <view class="diy-flex-inforow">
<view style="width: 740;">工位码:{{shelfCode}}</view> <view style="width: 740;">工位码:{{locationCode}}</view>
</view> </view>
</view> </view>
@ -66,22 +66,32 @@
<scroll-view class="scroll-view" scroll-y="true"> <scroll-view class="scroll-view" scroll-y="true">
<view v-for="(item, index) in cardData" :key="index" @touchstart="cardTouchStart" <view v-for="(item, index) in cardData" :key="index" @touchstart="cardTouchStart"
@touchmove="cardTouchMove" @longpress="longpress(item)"> @touchmove="cardTouchMove" @longpress="longpress(item)">
<StocktakingCard :class="cardClass(item)" :item="item" :currentIndex="index" :cardData="cardData" /> <Card :item="item" :currentIndex="index" :cardData="cardData" />
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<view class="floating-bar" <view
style="position: fixed; bottom: 0; left: 0; width: 100%; background-color: #fff; display: flex; justify-content: space-between; align-items: center; padding: 10rpx;"> style="position: fixed; bottom: 0; left: 0; width: 100%; display: flex; justify-content: space-between; align-items: center; z-index: 100;">
<select style="width: 200rpx;" v-model="selectedShelfAreaOption"> <!-- 货架区域选择 -->
<option v-for="area in shelfAreaOptions" :value="area.value" :key="area.id">{{area.text}}</option> <view class="picker-container1" style="position: relative;">
</select> <picker ref="shelfAreaPicker" :range="shelfAreaOptions" range-key="locationAreaName"
:value="selectedShelfAreaIndex" @change="onShelfAreaChange" style="font-size: 35rpx;">
<view class="uni-input">{{shelfAreaOptions[selectedShelfAreaIndex].locationAreaName}}</view>
</picker>
</view>
<select style="width: 200rpx;" v-model="selectedShelfTypeOption"> <!-- 货架类型选择 -->
<option v-for="type1 in shelfTypeOptions" :value="type1.value" :key="type1.id">{{type1.text}}</option> <view class="picker-container" style="position: relative;">
</select> <picker ref="shelfTypePicker" :range="shelfTypeOptions" range-key="text" :value="selectedShelfTypeIndex"
@change="onShelfTypeChange" style="font-size: 35rpx;width: 200rpx;">
<button style="width: 200rpx;background: green;color: white;">货架送回</button> <view class="uni-input">{{shelfTypeOptions[selectedShelfTypeIndex].text}}</view>
</picker>
</view>
<!-- 货架送回按钮 -->
<button style="width: 200rpx;margin: 2rpx; background: green; color: white;"
@click="sendBackShelf">货架送回</button>
</view> </view>
</view> </view>
@ -110,7 +120,7 @@
getServerIPAndPort getServerIPAndPort
} from '@/config.js'; } from '@/config.js';
import StocktakingCard from '@/components/StocktakingCard.vue'; import Card from '@/components/Card.vue';
import { import {
ref, ref,
onMounted, onMounted,
@ -123,7 +133,7 @@
export default { export default {
components: { components: {
uniPopup, uniPopup,
StocktakingCard Card
}, },
setup() { setup() {
const { const {
@ -142,14 +152,13 @@
const inputValue = ref(''); const inputValue = ref('');
const showPopup = (info) => { const showPopup = (info) => {
fixedInfo.infoId = info.id; fixedInfo.infoId = info.id;
console.log(fixedInfo.infoId);
fixedInfo.value.matName = info.matName; fixedInfo.value.matName = info.matName;
fixedInfo.value.matCode = info.matCode; fixedInfo.value.matCode = info.matCode;
fixedInfo.value.matSpec = info.matSpec; fixedInfo.value.matSpec = info.matSpec;
fixedInfo.value.matQty = info.matQty; fixedInfo.value.matQty = info.matQty;
fixedInfo.value.stocktakingQty = info.stocktakingQty;
inputValue.value = info.stocktakingQty == -1 ? info.matQty : info.stocktakingQty; inputValue.value = fixedInfo.value.matQty;
popup.value.open(); popup.value.open();
}; };
@ -159,11 +168,11 @@
}; };
const saveData = () => { const saveData = () => {
if (fixedInfo.value.stocktakingQty != -1 && inputValue.value == fixedInfo.value.stocktakingQty) { if (inputValue.value == fixedInfo.value.matQty) {
uni.showToast({ uni.showToast({
title: '本次修改未修改数量', title: '本次修改未修改数量',
icon: 'none', icon: 'none',
duration: 1500 duration: 2500
}); });
hidePopup(); hidePopup();
return; return;
@ -172,19 +181,18 @@
uni.showToast({ uni.showToast({
title: '您所输入的数量应该大于等于0', title: '您所输入的数量应该大于等于0',
icon: 'none', icon: 'none',
duration: 1500 duration: 2500
}); });
return; return;
} }
var serverIPAndPort = getServerIPAndPort(); var serverIPAndPort = getServerIPAndPort();
//调用接口进行数量的修改 //调用接口进行数量的修改
uni.request({ uni.request({
url: 'http://' + serverIPAndPort + url: 'http://' + serverIPAndPort +
'/pdaStocktaking/stockTakingById', // 请求的接口地址 '/PDAProductionLineCallOut/updateMatDetailCurrentInfoForCallOut', // 请求的接口地址
method: 'POST', // 设置请求方式为 POST method: 'POST', // 设置请求方式为 POST
data: { data: {
"stocktakingQty": inputValue.value, "matQty": inputValue.value,
"matDetailCurrentInfoId": fixedInfo.infoId, "matDetailCurrentInfoId": fixedInfo.infoId,
"userName": getConfig('userName', 'admin'), "userName": getConfig('userName', 'admin'),
"deviceType": "PDA" "deviceType": "PDA"
@ -197,17 +205,17 @@
if (res.statusCode === 200) { if (res.statusCode === 200) {
//接口返回数据为200 表示获取成功! //接口返回数据为200 表示获取成功!
if (res.data.code == 200) { if (res.data.code == 200) {
uni.showToast({
title: '成功!',
icon: 'none',
duration: 1200
});
hidePopup(); hidePopup();
uni.showToast({
title: '修改成功!',
icon: 'none',
duration: 2000
});
proxy.refreshData(); proxy.getCurrentMatInfo();
} else { } else {
uni.showToast({ uni.showToast({
title: '失败:' + res.data.message, title: '修改失败:' + res.data.message,
icon: 'none', icon: 'none',
duration: 2500 duration: 2500
}); });
@ -236,6 +244,7 @@
} }
}); });
}; };
return { return {
@ -250,14 +259,16 @@
data() { data() {
return { return {
locationId: null,
locationId: 0,
locationCode: '', locationCode: '',
shelfId: 0,
shelfCode: '',
userName: '', //当前登录的用户名 userName: '', //当前登录的用户名
recordCount: 0, recordCount: 0,
shelfId: null,
shelfCode: '',
placeholderText: '请先扫描货架码', placeholderText: '请先扫描货架码',
matCodeCondition: '', //物料编码搜索条件 matCodeCondition: '', //物料编码搜索条件
cardData: null, cardData: null,
@ -267,39 +278,27 @@
touchStartY: 0, touchStartY: 0,
isMove: false, //滑动标识 是否滑动 isMove: false, //滑动标识 是否滑动
// 货架区域选项
shelfAreaOptions: [{
id: 1,
locationAreaName: '请先扫货架码'
}],
selectedShelfAreaIndex: 0, // 选择的货架区域索引
selectedShelfAreaOption: '', // 初始选中值,可以是空字符串或预定义的值 // 货架类型选项
shelfAreaOptions: [ // 选项列表 shelfTypeOptions: [{
{
id: 1, id: 1,
value: 'type1', value: 'empty',
text: '类型1'
},
{
id: 2,
value: 'type2',
text: '类型2'
},
{
id: 3,
value: 'type3',
text: '类型3'
}
],
shelfTypeOptions: [ // 选项列表
{
id: 1,
value: '1',
text: '空货架' text: '空货架'
}, },
{ {
id: 2, id: 2,
value: '2', value: 'notEmpty',
text: '非空货架' text: '非空货架'
} },
// ... 其他选项
], ],
selectedShelfTypeOption: '', // 初始选中值,可以是空字符串或预定义的值 selectedShelfTypeIndex: 1, // 选择的货架类型索引
} }
}, },
onShow: function() { onShow: function() {
@ -314,25 +313,216 @@
}); });
}, },
methods: { methods: {
refreshData: function() { // 货架区域选择改变时触发
this.analysisScanCode(this.shelfCode); onShelfAreaChange(e) {
this.selectedShelfAreaIndex = e.detail.value;
// 你可以在这里添加其他逻辑,比如更新状态或发送请求
},
// 货架类型选择改变时触发
onShelfTypeChange(e) {
this.selectedShelfTypeIndex = e.detail.value;
// 你可以在这里添加其他逻辑,比如更新状态或发送请求
},
// 货架送回按钮点击时触发
sendBackShelf() {
//货架码
if (this.shelfId == 0 || this.shelfId == null) {
uni.showToast({
title: '请先扫货架码!',
icon: 'none',
duration: 1500
});
return;
}
//货架送回区域是否选择
if (shelfAreaOptions[selectedShelfAreaIndex].locationAreaName = '请先扫货架码') {
uni.showToast({
title: '该位置未绑定货架区域,请确认!',
icon: 'none',
duration: 1500
});
return;
}
//请求送回货架
var serverIPAndPort = getServerIPAndPort();
uni.request({
url: 'http://' + serverIPAndPort +
'/pdaProductionLineCallOut/getShelfInfoForCallOut', // 请求的接口地址
method: 'POST', // 设置请求方式为 POST
data: {
"shelfCode": this.shelfCode,
"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) {
uni.showToast({
title: '获取失败,请扫码重试!',
icon: 'none',
duration: 1500
});
return;
}
//绑定货架等信息
this.shelfId = res.data.data.shelfId;
this.shelfCode = res.data.data.shelfCode;
this.locationId = res.data.data.locationId;
this.locationCode = res.data.data.locationCode;
this.shelfAreaOptions = res.data.data.locationAreas;
//获取数据
this.getCurrentMatInfo();
return;
} else {
uni.showToast({
title: '获取失败:' + res.data.message,
icon: 'none',
duration: 3500
});
this.clear();
}
} else {
uni.showToast({
title: '服务器返回错误状态码' + res.statusCode,
icon: 'none',
duration: 3000
});
this.clear();
}
},
fail: (err) => {
// 请求失败的回调函数
uni.showToast({
title: '请求失败' + err,
icon: 'none',
duration: 3000
});
this.clear();
},
complete: (event) => {
// 请求完成的回调函数(无论成功或失败都会调用)
console.log('请求完成', event);
}
});
}, },
analysisScanCode: function(encodedString) { analysisScanCode: function(encodedString) {
// 去除末尾的逗号和"..."(如果有的话) // 去除末尾的逗号和"..."(如果有的话)
encodedString = encodedString.replace(/,\s*\.\.\.$/, ''); encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
this.shelfCode = encodedString; this.shelfCode = encodedString;
//调用接口获取当前工位信息 当前工位是否有货架
//获取当前货架和所在工位的信息
var serverIPAndPort = getServerIPAndPort(); var serverIPAndPort = getServerIPAndPort();
uni.request({ uni.request({
url: 'http://' + serverIPAndPort + url: 'http://' + serverIPAndPort +
'/pdaStocktaking/getStocktakingInfosByShelfCode', // 请求的接口地址 '/pdaProductionLineCallOut/getShelfInfoForCallOut', // 请求的接口地址
method: 'POST', // 设置请求方式为 POST method: 'POST', // 设置请求方式为 POST
data: { data: {
"shelfCode": this.shelfCode, "shelfCode": this.shelfCode,
"userName": this.userName, "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) {
uni.showToast({
title: '获取失败,请扫码重试!',
icon: 'none',
duration: 1500
});
return;
}
//绑定货架等信息
this.shelfId = res.data.data.shelfId;
this.shelfCode = res.data.data.shelfCode;
this.locationId = res.data.data.locationId;
this.locationCode = res.data.data.locationCode;
this.shelfAreaOptions = res.data.data.locationAreas;
//获取数据
this.getCurrentMatInfo();
return;
} else {
uni.showToast({
title: '获取失败:' + res.data.message,
icon: 'none',
duration: 3500
});
this.clear();
}
} else {
uni.showToast({
title: '服务器返回错误状态码' + res.statusCode,
icon: 'none',
duration: 3000
});
this.clear();
}
},
fail: (err) => {
// 请求失败的回调函数
uni.showToast({
title: '请求失败' + err,
icon: 'none',
duration: 3000
});
this.clear();
},
complete: (event) => {
// 请求完成的回调函数(无论成功或失败都会调用)
console.log('请求完成', event);
}
});
},
getCurrentMatInfo: function() {
if (this.shelfId == 0 || this.shelfId == null) {
uni.showToast({
title: '获取当前货架物料失败,请扫码重试!',
icon: 'none',
duration: 1500
});
return;
}
//获取当前货架和所在工位的信息
var serverIPAndPort = getServerIPAndPort();
uni.request({
url: 'http://' + serverIPAndPort +
'/matDetailCurrenInfo/getMatDetailCurrentInfos', // 请求的接口地址
method: 'POST', // 设置请求方式为 POST
data: {
"shelfCode": this.shelfCode,
"matCode": '',
"userName": this.userName,
"deviceType": "PDA", "deviceType": "PDA",
"pageNumber": 1, "pageNumber": 1,
"pageSize": 1000 "pageSize": 300,
}, },
header: { header: {
'Content-Type': 'application/json', // 如果需要以JSON格式发送数据 'Content-Type': 'application/json', // 如果需要以JSON格式发送数据
@ -393,6 +583,7 @@
console.log('请求完成', event); console.log('请求完成', event);
} }
}); });
}, },
//清空当前界面所有内容 //清空当前界面所有内容
@ -408,6 +599,7 @@
this.touchStartX = e.touches[0].clientX; this.touchStartX = e.touches[0].clientX;
this.touchStartY = e.touches[0].clientY; this.touchStartY = e.touches[0].clientY;
}, },
cardTouchMove(e) { cardTouchMove(e) {
var deltaX = e.changedTouches[0].clientX - this.touchStartX; var deltaX = e.changedTouches[0].clientX - this.touchStartX;
var deltaY = e.changedTouches[0].clientY - this.touchStartY; var deltaY = e.changedTouches[0].clientY - this.touchStartY;
@ -426,6 +618,39 @@
</script> </script>
<style> <style>
.picker-container1 {
border: 2rpx solid #000;
/* 设置边框宽度和颜色 */
padding: 2rpx;
/* 根据需要添加内边距 */
margin: 3rpx;
/* 根据需要添加外边距以分隔 pickers */
box-sizing: border-box;
/* 确保边框和内边距包含在总宽度内 */
width: calc(40% - 20rpx);
/* 设置宽度为父容器宽度的一半减去外边距 */
}
.picker-container {
border: 2rpx solid #000;
/* 设置边框宽度和颜色 */
padding: 2rpx;
/* 根据需要添加内边距 */
margin: 3rpx;
/* 根据需要添加外边距以分隔 pickers */
box-sizing: border-box;
/* 确保边框和内边距包含在总宽度内 */
width: calc(28% - 20rpx);
/* 设置宽度为父容器宽度的一半减去外边距 */
}
.uni-input {
width: 100%;
/* 确保输入框宽度与父容器一致 */
box-sizing: border-box;
/* 确保内边距和边框包含在总宽度内 */
}
.uni-input-wrapper { .uni-input-wrapper {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
@ -480,7 +705,7 @@
} }
.scroll-view { .scroll-view {
height: 75vh; height: 73.7vh;
} }
.popup-content { .popup-content {
@ -491,7 +716,6 @@
border-radius: 20rpx; border-radius: 20rpx;
} }
.input-item { .input-item {
margin-bottom: 5rpx; margin-bottom: 5rpx;
display: flex; display: flex;

View File

@ -1962,7 +1962,7 @@ if (uni.restoreGlobal) {
) )
]), ]),
vue.createElementVNode("view", { class: "content-time" }, [ vue.createElementVNode("view", { class: "content-time" }, [
vue.createElementVNode("text", null, "绑定时间:"), vue.createElementVNode("text", null, "最后更新时间:"),
vue.createElementVNode( vue.createElementVNode(
"text", "text",
null, null,
@ -4309,7 +4309,7 @@ if (uni.restoreGlobal) {
const _sfc_main$1 = { const _sfc_main$1 = {
components: { components: {
uniPopup, uniPopup,
StocktakingCard Card
}, },
setup() { setup() {
const { const {
@ -4327,23 +4327,23 @@ if (uni.restoreGlobal) {
const inputValue = vue.ref(""); const inputValue = vue.ref("");
const showPopup = (info) => { const showPopup = (info) => {
fixedInfo.infoId = info.id; fixedInfo.infoId = info.id;
formatAppLog("log", "at pages/productionLineCallOut/productionLineCallOut.vue:155", fixedInfo.infoId);
fixedInfo.value.matName = info.matName; fixedInfo.value.matName = info.matName;
fixedInfo.value.matCode = info.matCode; fixedInfo.value.matCode = info.matCode;
fixedInfo.value.matSpec = info.matSpec; fixedInfo.value.matSpec = info.matSpec;
fixedInfo.value.matQty = info.matQty; fixedInfo.value.matQty = info.matQty;
fixedInfo.value.stocktakingQty = info.stocktakingQty; inputValue.value = fixedInfo.value.matQty;
inputValue.value = info.stocktakingQty == -1 ? info.matQty : info.stocktakingQty;
popup.value.open(); popup.value.open();
}; };
const hidePopup = () => { const hidePopup = () => {
popup.value.close(); popup.value.close();
}; };
const saveData = () => { const saveData = () => {
if (fixedInfo.value.stocktakingQty != -1 && inputValue.value == fixedInfo.value.stocktakingQty) { if (inputValue.value == fixedInfo.value.matQty) {
uni.showToast({ uni.showToast({
title: "本次修改未修改数量", title: "本次修改未修改数量",
icon: "none", icon: "none",
duration: 1500 duration: 2500
}); });
hidePopup(); hidePopup();
return; return;
@ -4352,18 +4352,18 @@ if (uni.restoreGlobal) {
uni.showToast({ uni.showToast({
title: "您所输入的数量应该大于等于0", title: "您所输入的数量应该大于等于0",
icon: "none", icon: "none",
duration: 1500 duration: 2500
}); });
return; return;
} }
var serverIPAndPort = getServerIPAndPort(); var serverIPAndPort = getServerIPAndPort();
uni.request({ uni.request({
url: "http://" + serverIPAndPort + "/pdaStocktaking/stockTakingById", url: "http://" + serverIPAndPort + "/PDAProductionLineCallOut/updateMatDetailCurrentInfoForCallOut",
// 请求的接口地址 // 请求的接口地址
method: "POST", method: "POST",
// 设置请求方式为 POST // 设置请求方式为 POST
data: { data: {
"stocktakingQty": inputValue.value, "matQty": inputValue.value,
"matDetailCurrentInfoId": fixedInfo.infoId, "matDetailCurrentInfoId": fixedInfo.infoId,
"userName": getConfig("userName", "admin"), "userName": getConfig("userName", "admin"),
"deviceType": "PDA" "deviceType": "PDA"
@ -4375,16 +4375,16 @@ if (uni.restoreGlobal) {
success: (res) => { success: (res) => {
if (res.statusCode === 200) { if (res.statusCode === 200) {
if (res.data.code == 200) { if (res.data.code == 200) {
uni.showToast({
title: "成功!",
icon: "none",
duration: 1200
});
hidePopup(); hidePopup();
proxy.refreshData(); uni.showToast({
title: "修改成功!",
icon: "none",
duration: 2e3
});
proxy.getCurrentMatInfo();
} else { } else {
uni.showToast({ uni.showToast({
title: "失败:" + res.data.message, title: "修改失败:" + res.data.message,
icon: "none", icon: "none",
duration: 2500 duration: 2500
}); });
@ -4420,13 +4420,13 @@ if (uni.restoreGlobal) {
}, },
data() { data() {
return { return {
locationId: null, locationId: 0,
locationCode: "", locationCode: "",
shelfId: 0,
shelfCode: "",
userName: "", userName: "",
//当前登录的用户名 //当前登录的用户名
recordCount: 0, recordCount: 0,
shelfId: null,
shelfCode: "",
placeholderText: "请先扫描货架码", placeholderText: "请先扫描货架码",
matCodeCondition: "", matCodeCondition: "",
//物料编码搜索条件 //物料编码搜索条件
@ -4436,72 +4436,219 @@ if (uni.restoreGlobal) {
touchStartY: 0, touchStartY: 0,
isMove: false, isMove: false,
//滑动标识 是否滑动 //滑动标识 是否滑动
selectedShelfAreaOption: "", // 货架区域选项
// 初始选中值,可以是空字符串或预定义的值 shelfAreaOptions: [{
shelfAreaOptions: [ id: 1,
// 选项列表 locationAreaName: "请先扫货架码"
{ }],
id: 1, selectedShelfAreaIndex: 0,
value: "type1", // 选择的货架区域索引
text: "类型1" // 货架类型选项
},
{
id: 2,
value: "type2",
text: "类型2"
},
{
id: 3,
value: "type3",
text: "类型3"
}
],
shelfTypeOptions: [ shelfTypeOptions: [
// 选项列表
{ {
id: 1, id: 1,
value: "1", value: "empty",
text: "空货架" text: "空货架"
}, },
{ {
id: 2, id: 2,
value: "2", value: "notEmpty",
text: "非空货架" text: "非空货架"
} }
// ... 其他选项
], ],
selectedShelfTypeOption: "" selectedShelfTypeIndex: 1
// 初始选中值,可以是空字符串或预定义的值 // 选择的货架类型索引
}; };
}, },
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/productionLineCallOut/productionLineCallOut.vue:310", "Success:" + res.data); formatAppLog("log", "at pages/productionLineCallOut/productionLineCallOut.vue:309", "Success:" + res.data);
self.analysisScanCode(res.data); self.analysisScanCode(res.data);
}, function(err) { }, function(err) {
formatAppLog("log", "at pages/productionLineCallOut/productionLineCallOut.vue:313", "Error:", JSON.stringify(err)); formatAppLog("log", "at pages/productionLineCallOut/productionLineCallOut.vue:312", "Error:", JSON.stringify(err));
}); });
}, },
methods: { methods: {
refreshData: function() { // 货架区域选择改变时触发
this.analysisScanCode(this.shelfCode); onShelfAreaChange(e) {
this.selectedShelfAreaIndex = e.detail.value;
}, },
analysisScanCode: function(encodedString) { // 货架类型选择改变时触发
encodedString = encodedString.replace(/,\s*\.\.\.$/, ""); onShelfTypeChange(e) {
this.shelfCode = encodedString; this.selectedShelfTypeIndex = e.detail.value;
},
// 货架送回按钮点击时触发
sendBackShelf() {
if (this.shelfId == 0 || this.shelfId == null) {
uni.showToast({
title: "请先扫货架码!",
icon: "none",
duration: 1500
});
return;
}
if (shelfAreaOptions[selectedShelfAreaIndex].locationAreaName = "请先扫货架码") {
uni.showToast({
title: "该位置未绑定货架区域,请确认!",
icon: "none",
duration: 1500
});
return;
}
var serverIPAndPort = getServerIPAndPort(); var serverIPAndPort = getServerIPAndPort();
uni.request({ uni.request({
url: "http://" + serverIPAndPort + "/pdaStocktaking/getStocktakingInfosByShelfCode", url: "http://" + serverIPAndPort + "/pdaProductionLineCallOut/getShelfInfoForCallOut",
// 请求的接口地址 // 请求的接口地址
method: "POST", method: "POST",
// 设置请求方式为 POST // 设置请求方式为 POST
data: { data: {
"shelfCode": this.shelfCode, "shelfCode": this.shelfCode,
"userName": this.userName, "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) {
uni.showToast({
title: "获取失败,请扫码重试!",
icon: "none",
duration: 1500
});
return;
}
this.shelfId = res.data.data.shelfId;
this.shelfCode = res.data.data.shelfCode;
this.locationId = res.data.data.locationId;
this.locationCode = res.data.data.locationCode;
this.shelfAreaOptions = res.data.data.locationAreas;
this.getCurrentMatInfo();
return;
} else {
uni.showToast({
title: "获取失败:" + res.data.message,
icon: "none",
duration: 3500
});
this.clear();
}
} else {
uni.showToast({
title: "服务器返回错误状态码" + res.statusCode,
icon: "none",
duration: 3e3
});
this.clear();
}
},
fail: (err) => {
uni.showToast({
title: "请求失败" + err,
icon: "none",
duration: 3e3
});
this.clear();
},
complete: (event) => {
formatAppLog("log", "at pages/productionLineCallOut/productionLineCallOut.vue:419", "请求完成", event);
}
});
},
analysisScanCode: function(encodedString) {
encodedString = encodedString.replace(/,\s*\.\.\.$/, "");
this.shelfCode = encodedString;
var serverIPAndPort = getServerIPAndPort();
uni.request({
url: "http://" + serverIPAndPort + "/pdaProductionLineCallOut/getShelfInfoForCallOut",
// 请求的接口地址
method: "POST",
// 设置请求方式为 POST
data: {
"shelfCode": this.shelfCode,
"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) {
uni.showToast({
title: "获取失败,请扫码重试!",
icon: "none",
duration: 1500
});
return;
}
this.shelfId = res.data.data.shelfId;
this.shelfCode = res.data.data.shelfCode;
this.locationId = res.data.data.locationId;
this.locationCode = res.data.data.locationCode;
this.shelfAreaOptions = res.data.data.locationAreas;
this.getCurrentMatInfo();
return;
} else {
uni.showToast({
title: "获取失败:" + res.data.message,
icon: "none",
duration: 3500
});
this.clear();
}
} else {
uni.showToast({
title: "服务器返回错误状态码" + res.statusCode,
icon: "none",
duration: 3e3
});
this.clear();
}
},
fail: (err) => {
uni.showToast({
title: "请求失败" + err,
icon: "none",
duration: 3e3
});
this.clear();
},
complete: (event) => {
formatAppLog("log", "at pages/productionLineCallOut/productionLineCallOut.vue:499", "请求完成", event);
}
});
},
getCurrentMatInfo: function() {
if (this.shelfId == 0 || this.shelfId == null) {
uni.showToast({
title: "获取当前货架物料失败,请扫码重试!",
icon: "none",
duration: 1500
});
return;
}
var serverIPAndPort = getServerIPAndPort();
uni.request({
url: "http://" + serverIPAndPort + "/matDetailCurrenInfo/getMatDetailCurrentInfos",
// 请求的接口地址
method: "POST",
// 设置请求方式为 POST
data: {
"shelfCode": this.shelfCode,
"matCode": "",
"userName": this.userName,
"deviceType": "PDA", "deviceType": "PDA",
"pageNumber": 1, "pageNumber": 1,
"pageSize": 1e3 "pageSize": 300
}, },
header: { header: {
"Content-Type": "application/json" "Content-Type": "application/json"
@ -4551,7 +4698,7 @@ if (uni.restoreGlobal) {
this.clear(); this.clear();
}, },
complete: (event) => { complete: (event) => {
formatAppLog("log", "at pages/productionLineCallOut/productionLineCallOut.vue:393", "请求完成", event); formatAppLog("log", "at pages/productionLineCallOut/productionLineCallOut.vue:583", "请求完成", event);
} }
}); });
}, },
@ -4584,7 +4731,7 @@ if (uni.restoreGlobal) {
}; };
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_0); const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_0);
const _component_StocktakingCard = vue.resolveComponent("StocktakingCard"); const _component_Card = vue.resolveComponent("Card");
return vue.openBlock(), vue.createElementBlock("view", { class: "bg-image" }, [ return vue.openBlock(), vue.createElementBlock("view", { class: "bg-image" }, [
vue.createVNode( vue.createVNode(
_component_uni_popup, _component_uni_popup,
@ -4686,7 +4833,7 @@ if (uni.restoreGlobal) {
style: { "flex": "60" } style: { "flex": "60" }
}, [ }, [
vue.withDirectives(vue.createElementVNode("input", { vue.withDirectives(vue.createElementVNode("input", {
id: "inputMatCode", ref: "inputMatCode",
class: "uni-input", class: "uni-input",
style: { "font-size": "50rpx", "padding": "10rpx" }, style: { "font-size": "50rpx", "padding": "10rpx" },
placeholder: $data.placeholderText, placeholder: $data.placeholderText,
@ -4725,7 +4872,7 @@ if (uni.restoreGlobal) {
vue.createElementVNode( vue.createElementVNode(
"view", "view",
{ style: { "width": "740" } }, { style: { "width": "740" } },
"工位码:" + vue.toDisplayString($data.shelfCode), "工位码:" + vue.toDisplayString($data.locationCode),
1 1
/* TEXT */ /* TEXT */
) )
@ -4749,12 +4896,11 @@ if (uni.restoreGlobal) {
onTouchmove: _cache[7] || (_cache[7] = (...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_StocktakingCard, { vue.createVNode(_component_Card, {
class: vue.normalizeClass(_ctx.cardClass(item)),
item, item,
currentIndex: index, currentIndex: index,
cardData: $data.cardData cardData: $data.cardData
}, null, 8, ["class", "item", "currentIndex", "cardData"]) }, null, 8, ["item", "currentIndex", "cardData"])
], 40, ["onLongpress"]); ], 40, ["onLongpress"]);
}), }),
128 128
@ -4762,61 +4908,56 @@ if (uni.restoreGlobal) {
)) ))
]) ])
]), ]),
vue.createElementVNode("view", { vue.createElementVNode("view", { style: { "position": "fixed", "bottom": "0", "left": "0", "width": "100%", "display": "flex", "justify-content": "space-between", "align-items": "center", "z-index": "100" } }, [
class: "floating-bar", vue.createCommentVNode(" 货架区域选择 "),
style: { "position": "fixed", "bottom": "0", "left": "0", "width": "100%", "background-color": "#fff", "display": "flex", "justify-content": "space-between", "align-items": "center", "padding": "10rpx" } vue.createElementVNode("view", {
}, [ class: "picker-container1",
vue.withDirectives(vue.createElementVNode( style: { "position": "relative" }
"select", }, [
{ vue.createElementVNode("picker", {
style: { "width": "200rpx" }, ref: "shelfAreaPicker",
"onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => $data.selectedShelfAreaOption = $event) range: $data.shelfAreaOptions,
}, "range-key": "locationAreaName",
[ value: $data.selectedShelfAreaIndex,
(vue.openBlock(true), vue.createElementBlock( onChange: _cache[8] || (_cache[8] = (...args) => $options.onShelfAreaChange && $options.onShelfAreaChange(...args)),
vue.Fragment, style: { "font-size": "35rpx" }
null, }, [
vue.renderList($data.shelfAreaOptions, (area) => { vue.createElementVNode(
return vue.openBlock(), vue.createElementBlock("option", { "view",
value: area.value, { class: "uni-input" },
key: area.id vue.toDisplayString($data.shelfAreaOptions[$data.selectedShelfAreaIndex].locationAreaName),
}, vue.toDisplayString(area.text), 9, ["value"]); 1
}), /* TEXT */
128 )
/* KEYED_FRAGMENT */ ], 40, ["range", "value"])
))
],
512
/* NEED_PATCH */
), [
[vue.vModelSelect, $data.selectedShelfAreaOption]
]), ]),
vue.withDirectives(vue.createElementVNode( vue.createCommentVNode(" 货架类型选择 "),
"select", vue.createElementVNode("view", {
{ class: "picker-container",
style: { "width": "200rpx" }, style: { "position": "relative" }
"onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => $data.selectedShelfTypeOption = $event) }, [
}, vue.createElementVNode("picker", {
[ ref: "shelfTypePicker",
(vue.openBlock(true), vue.createElementBlock( range: $data.shelfTypeOptions,
vue.Fragment, "range-key": "text",
null, value: $data.selectedShelfTypeIndex,
vue.renderList($data.shelfTypeOptions, (type1) => { onChange: _cache[9] || (_cache[9] = (...args) => $options.onShelfTypeChange && $options.onShelfTypeChange(...args)),
return vue.openBlock(), vue.createElementBlock("option", { style: { "font-size": "35rpx", "width": "200rpx" }
value: type1.value, }, [
key: type1.id vue.createElementVNode(
}, vue.toDisplayString(type1.text), 9, ["value"]); "view",
}), { class: "uni-input" },
128 vue.toDisplayString($data.shelfTypeOptions[$data.selectedShelfTypeIndex].text),
/* KEYED_FRAGMENT */ 1
)) /* TEXT */
], )
512 ], 40, ["range", "value"])
/* NEED_PATCH */
), [
[vue.vModelSelect, $data.selectedShelfTypeOption]
]), ]),
vue.createElementVNode("button", { style: { "width": "200rpx", "background": "green", "color": "white" } }, "货架送回") vue.createCommentVNode(" 货架送回按钮 "),
vue.createElementVNode("button", {
style: { "width": "200rpx", "margin": "2rpx", "background": "green", "color": "white" },
onClick: _cache[10] || (_cache[10] = (...args) => $options.sendBackShelf && $options.sendBackShelf(...args))
}, "货架送回")
]) ])
]); ]);
} }

View File

@ -138,9 +138,6 @@ namespace WCS.BLL.Services.Service
Data = null Data = null
}; };
} }
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace WCS.Model.ApiModel.PDAProductionLineCallIn namespace WCS.Model.ApiModel.PDAProductionLineCallOut
{ {
public class CallOutRequest:RequestBase public class CallOutRequest:RequestBase
{ {
@ -10,5 +10,9 @@ namespace WCS.Model.ApiModel.PDAProductionLineCallIn
public string LocationCode { get; set; } public string LocationCode { get; set; }
public int ShelfId { get; set; } public int ShelfId { get; set; }
public string ShelfCode { get; set; } public string ShelfCode { get; set; }
//目标区域ID
public int LocationAreaId { get; set; }
//空货架/非空货架字符串
public string ShelfTypeStr { get; set; }
} }
} }

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.PDAProductionLineCallOut
{
public class GetShelfInfoForCallOutRequest:RequestBase
{
//传入扫描的货架信息
public string ShelfCode { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;
using WCS.Model.ApiModel.LocationInfo;
namespace WCS.Model.ApiModel.PDAProductionLineCallOut
{
public class GetShelfInfoForCallOutResponseData
{
public int ShelfId { get; set; }
public string ShelfCode { get; set; }
public int LocationId { get; set; }
public string LocationCode { get; set; }
public List<LocationAreaInfoModel> LocationAreas { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.PDAProductionLineCallOut
{
public class UpdateMatDetailCurrentInForCallOutRequest:RequestBase
{
/// <summary>
/// 货架存量Id
/// </summary>
public int MatDetailCurrentInfoId { get; set; }
/// <summary>
/// 修改后的数量
/// </summary>
public int MatQty { get; set; }
}
}

View File

@ -225,7 +225,7 @@ namespace WCS.WebApi.Controllers
/// <returns></returns> /// <returns></returns>
[Route("callIn")] [Route("callIn")]
[HttpPost(Name = "callIn")] [HttpPost(Name = "callIn")]
public async Task<ResponseCommon> callIn(CallOutRequest request) public async Task<ResponseCommon> callIn(CallInRequest request)
{ {
try try
{ {

View File

@ -5,11 +5,14 @@ using WCS.BLL.Services.Service;
using WCS.DAL.Db; using WCS.DAL.Db;
using WCS.DAL.DbModels; using WCS.DAL.DbModels;
using WCS.Model; using WCS.Model;
using WCS.Model.ApiModel.LocationInfo;
using WCS.Model.ApiModel.MatBaseInfo; using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.MatDetailCurrentInfo; using WCS.Model.ApiModel.MatDetailCurrentInfo;
using WCS.Model.ApiModel.PDAProductionLineCallIn; using WCS.Model.ApiModel.PDAProductionLineCallIn;
using WCS.Model.ApiModel.PDAProductionLineCallOut;
using WCS.Model.ApiModel.PDAShelfLocationBindUnbind; using WCS.Model.ApiModel.PDAShelfLocationBindUnbind;
using WCS.Model.ApiModel.Stocktaking; using WCS.Model.ApiModel.Stocktaking;
using WCS.Model.ApiModel.StoreInfo;
namespace WCS.WebApi.Controllers namespace WCS.WebApi.Controllers
{ {
@ -26,113 +29,97 @@ namespace WCS.WebApi.Controllers
} }
/// <summary> /// <summary>
/// 获取当前货架、当前工位、当前工位可以作为起点可以到的目标区域 /// 获取当前货架、当前货架的工位、当前工位可以作为起点可以到的目标区域
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <returns></returns> /// <returns></returns>
[Route("getMatDetailCurrentInfosForCallOut")] [Route("getShelfInfoForCallOut")]
[HttpPost(Name = "getMatDetailCurrentInfosForCallOut")] [HttpPost(Name = "getShelfInfoForCallOut")]
public async Task<ResponseCommon> getMatDetailCurrentInfosForCallIn(GetMatDetailCurrentInfosForCallInRequest request) public async Task<ResponseCommon> getShelfInfoForCallOut(GetShelfInfoForCallOutRequest request)
{ {
try try
{ {
#region //校验参数
if (request.LocationId == 0) if (string.IsNullOrEmpty(request.ShelfCode))
{ {
return new ResponseCommon() return new ResponseCommon()
{ {
Code = 201, Code = 201,
Message = $"参数错误:请重新扫描工位码!", Message = "参数错误请重新扫描货架码!",
Data = null, Data = null,
}; };
} }
//获取位置信息 //通过货架编码获取货架
var shelfInfo = await DbHelp.db.Queryable<ShelfInfo>()
.Where(t => t.ShelfCode == request.ShelfCode)
.Where(t => t.IsEnable)
.FirstAsync();
if (shelfInfo == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"货架{request.ShelfCode}不存在或已被禁用!",
Data = null,
};
}
//货架不处于静止状态
if (shelfInfo.TransStatus == TransStatusEnum.)
{
return new ResponseCommon()
{
Code = 201,
Message = $"货架{request.ShelfCode}处于运输中!",
Data = null,
};
}
//货架未绑定位置信息
if (string.IsNullOrEmpty(shelfInfo.CurrentLocaiotnCode) || shelfInfo.CurrentLocationId == 0)
{
return new ResponseCommon()
{
Code = 201,
Message = $"货架{request.ShelfCode}未绑定位置信息!",
Data = null,
};
}
//位置校验
var locationInfo = await DbHelp.db.Queryable<LocationInfo>() var locationInfo = await DbHelp.db.Queryable<LocationInfo>()
.Where(t => t.Id == request.LocationId) .Where(t => t.Id == shelfInfo.CurrentLocationId)
.FirstAsync(); .Where(t => t.IsEnable)
.FirstAsync();
if (locationInfo == null) if (locationInfo == null)
{ {
return new ResponseCommon() return new ResponseCommon()
{ {
Code = 201, Code = 201,
Message = $"获取失败:工位{request.LocationCode}不存在!", Message = $"工位{shelfInfo.CurrentLocaiotnCode}不存在或已被禁用!",
Data = null, Data = null,
}; };
} }
if (locationInfo.IsEnable == false) //获取工位作为起点 可以放置的目标区域
{ var locationAreas = await DbHelp.db.Queryable<LocationAreaInfo>()
return new ResponseCommon() .WhereIF(locationInfo.AllowDestinationLocationArea != null && locationInfo.AllowDestinationLocationArea.Count > 0, t => locationInfo.AllowDestinationLocationArea.Contains(t.Id))
{ .Select(t => new LocationAreaInfoModel()
Code = 201, {
Message = $"获取失败:工位{locationInfo.LocationCode}已被禁用!", Id = t.Id,
Data = null, LocationAreaName = t.LocationAreaName,
}; })
} .ToListAsync();
return new ResponseCommon()
var shelfInfo = await DbHelp.db.Queryable<ShelfInfo>()
.Where(t => t.CurrentLocationId == locationInfo.Id)
.FirstAsync();
if (shelfInfo != null)
{
return new ResponseCommon()
{
Code = 301,
Message = $"获取失败:工位{locationInfo.LocationCode}已被货架{shelfInfo.ShelfCode}占用!",
Data = null,
};
}
#endregion
#region
var recordsQueryable = DbHelp.db.Queryable<MatDetailCurrentInfo>()
.LeftJoin<ShelfInfo>((mci, si) => mci.ShelfId == si.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))
.Select((mci, si, li) => new MatDetailCurrentInfoModel()
{
Id = mci.Id,
ShelfId = mci.ShelfId,
ShelfCode = mci.ShelfCode,
ShelfType = mci.ShelfType,
LocationArea = li.LocationArea,
LocationCode = li.LocationCode,
MatCode = mci.MatCode,
MatName = mci.MatName,
MatSpec = mci.MatSpec,
MatUnit = mci.MatUnit,
MatCustomer = mci.MatCustomer,
MatQty = mci.MatQty,
MatSupplier = mci.MatSupplier,
StationCode = mci.StationCode,
ModifyUser = mci.ModifyUser,
ModifyTime = mci.ModifyTime
});
//分页
var totalCount = await recordsQueryable.CountAsync();
var records = await recordsQueryable
.OrderByDescending(mci => mci.Id)
.Skip((1 - 1) * 300).Take(300)
.ToListAsync();
return new PageQueryResponse<MatDetailCurrentInfoModel>()
{ {
Code = 200, Code = 200,
Message = $"success", Message = "success",
Data = new PageQueryResponseData<MatDetailCurrentInfoModel>() Data = new GetShelfInfoForCallOutResponseData()
{ {
TotalCount = totalCount, ShelfId = shelfInfo.Id,
MaxPage = 1, ShelfCode = shelfInfo.ShelfCode,
Count = records.Count, LocationId = locationInfo.Id,
Lists = records.ToList() LocationCode = locationInfo.LocationCode,
LocationAreas = locationAreas
} }
}; };
#endregion
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -145,77 +132,125 @@ namespace WCS.WebApi.Controllers
} }
} }
/// <summary>
/// 货架送回修改数量
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("updateMatDetailCurrentInfoForCallOut")]
[HttpPost(Name = "updateMatDetailCurrentInfoForCallOut")]
public async Task<ResponseCommon<object>> updateMatDetailCurrentInfoForCallOut(UpdateMatDetailCurrentInForCallOutRequest request)
{
try
{
var matDetailCurrentInfo = await DbHelp.db.Queryable<MatDetailCurrentInfo>() //.Where(t => t.MatDetailCurrentCode == request.MatDetailCurrentInfo.MatDetailCurrentCode)
.Where(t => t.Id == request.MatDetailCurrentInfoId)
.FirstAsync();
if (matDetailCurrentInfo == null)
{
return new ResponseCommon<Object>
{
Code = 205,
Message = $"更新库存信息失败:此条数据不存在,请确认!",
Data = null
};
}
matDetailCurrentInfo.MatQty = request.MatQty;
matDetailCurrentInfo.ModifyUser = request.UserName;
matDetailCurrentInfo.ModifyTime = DateTime.Now;
var rowNum = await DbHelp.db.Updateable(matDetailCurrentInfo).ExecuteCommandAsync();
if (rowNum == 0)
{
return new ResponseCommon<Object>
{
Code = 201,
Message = $"更新货架存量信息失败:请重试!",
Data = null
};
}
else
{
return new ResponseCommon<Object>
{
Code = 200,
Message = $"更新货架存量信息成功!",
Data = null
};
}
}
catch (Exception ex)
{
var response = new ResponseCommon<Object>
{
Code = 300,
Message = $"操作失败:{ex.Message}",
Data = null
};
return response;
}
}
/// <summary> /// <summary>
/// 货架送回 通过 货架ID 目标区域 是否为空货架 将货架送回 /// 货架送回 通过 货架ID 目标区域 是否为空货架等参数 将货架送回
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <returns></returns> /// <returns></returns>
[Route("callOut")] [Route("callOut")]
[HttpPost(Name = "callOut")] [HttpPost(Name = "callOut")]
public async Task<ResponseCommon> callIn(CallOutRequest request) public async Task<ResponseCommon> callOut(CallOutRequest request)
{ {
try try
{ {
#region #region
if (request.LocationId == 0) if (request.LocationId == 0)
{ {
return new ResponseCommon() return new ResponseCommon()
{ {
Code = 201, Code = 201,
Message = $"呼叫失败:请重新扫描工位码!", Message = $"送回失败:请重新扫描货架码!",
Data = null, Data = null,
}; };
} }
//获取位置信息 //获取位置信息
var locationInfo = await DbHelp.db.Queryable<LocationInfo>() var locationInfo = await DbHelp.db.Queryable<LocationInfo>()
.Where(t => t.Id == request.LocationId) .Where(t => t.Id == request.LocationId)
.FirstAsync(); .FirstAsync();
if (locationInfo == null) if (locationInfo == 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 (locationInfo.IsEnable == false)
{ {
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>()
.Where(t => t.CurrentLocationId == locationInfo.Id)
.FirstAsync();
if (shelfInfo != null)
{
return new ResponseCommon()
{
Code = 301,
Message = $"呼叫失败:工位{locationInfo.LocationCode}已被货架{shelfInfo.ShelfCode}占用!",
Data = null,
};
}
#endregion #endregion
#region #region
shelfInfo = await DbHelp.db.Queryable<ShelfInfo>() var shelfInfo = await DbHelp.db.Queryable<ShelfInfo>()
.Where(t => t.Id == request.ShelfId) .Where(t => t.Id == request.ShelfId)
.Where(t => t.IsEnable) .Where(t => t.IsEnable)
.FirstAsync(); .FirstAsync();
if (shelfInfo == null) if (shelfInfo == null)
{ {
return new ResponseCommon() return new ResponseCommon()
{ {
Code = 201, Code = 301,
Message = $"呼叫失败:货架{shelfInfo.ShelfCode}不存在或已被禁用!", Message = $"送回失败:货架{request.ShelfCode}不存在或已被禁用!",
Data = null, Data = null,
}; };
} }
@ -225,19 +260,53 @@ namespace WCS.WebApi.Controllers
return new ResponseCommon() return new ResponseCommon()
{ {
Code = 201, Code = 201,
Message = $"呼叫失败:货架{shelfInfo.ShelfCode}在运输中!", Message = $"呼叫失败:货架{shelfInfo.ShelfCode}已有任务在运输中!",
Data = null,
};
}
if (shelfInfo.CurrentLocationId != locationInfo.Id)
{
return new ResponseCommon()
{
Code = 201,
Message = $"呼叫失败:货架{shelfInfo.ShelfCode}已不在工位{locationInfo.LocationCode}上!",
Data = null, Data = null,
}; };
} }
#endregion #endregion
#region #region
//TO DO 调用AGV接口开始呼叫 呼叫成功更新运输状态和目标库位 if (request.ShelfTypeStr == "空货架")
{
var matCurrentInfos = await DbHelp.db.Queryable<MatDetailCurrentInfo>()
.Where(t => t.ShelfId == shelfInfo.Id)
.ToListAsync();
//To Do库存更新记录
//全部删除
DbHelp.db.Deleteable(matCurrentInfos).ExecuteCommand();
}
//如果不是非空货架 那么就清除数量为0的库存
else
{
var matCurrentInfos = await DbHelp.db.Queryable<MatDetailCurrentInfo>()
.Where(t => t.ShelfId == shelfInfo.Id)
.Where(t => t.MatQty == 0)
.ToListAsync();
//数量为0的不用更新修改记录 修改数据时更新
//全部删除
DbHelp.db.Deleteable(matCurrentInfos).ExecuteCommand();
}
#endregion
#region AGV接口
//TO DO 调用AGV接口开始呼叫 呼叫成功更新运输状态和目标库位
return new ResponseCommon() return new ResponseCommon()
{ {
Code = 200, Code = 200,
Message = $"呼叫成功!", Message = $"送回任务发送成功!",
Data = null, Data = null,
}; };
#endregion #endregion