货架绑定解绑 接口明细+前端实现
This commit is contained in:
@ -1,34 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="bg-image">
|
<view class="bg-image">
|
||||||
<uni-popup ref="popup" type="dialog">
|
|
||||||
<view class="popup-content">
|
|
||||||
<view class="info-item">
|
|
||||||
<label>物料编码:</label>
|
|
||||||
<text>{{fixedInfo.matCode}}</text>
|
|
||||||
</view>
|
|
||||||
<view class="info-item">
|
|
||||||
<label>物料名称:</label>
|
|
||||||
<text>{{fixedInfo.matName}}</text>
|
|
||||||
</view>
|
|
||||||
<view class="info-item">
|
|
||||||
<label>物料规格:</label>
|
|
||||||
<text>{{fixedInfo.matSpec}}</text>
|
|
||||||
</view>
|
|
||||||
<view class="info-item">
|
|
||||||
<label>数量:</label>
|
|
||||||
<text>{{fixedInfo.matQty}}</text>
|
|
||||||
</view>
|
|
||||||
<view class="input-item" style="background-color: wheat;">
|
|
||||||
<label>盘点数量:</label>
|
|
||||||
<input ref="inputRef" v-model.number="inputValue" type="number" placeholder="输入数量" />
|
|
||||||
</view>
|
|
||||||
<view class="button-group">
|
|
||||||
<button @click="hidePopup">取消</button>
|
|
||||||
<button @click="saveData(fixedInfo)">保存</button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</uni-popup>
|
|
||||||
|
|
||||||
<view class="diy-flex-row">
|
<view class="diy-flex-row">
|
||||||
<view style="flex: 3">
|
<view style="flex: 3">
|
||||||
<!-- 占位 -->
|
<!-- 占位 -->
|
||||||
@ -41,14 +12,14 @@
|
|||||||
|
|
||||||
<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 id="inputMatCode" class="uni-input" style="font-size: 50rpx; padding: 10rpx;"
|
||||||
:placeholder="placeholderText" v-model="matCodeCondition" @blur="queryMatList"></input>
|
:placeholder="placeholderText" v-model="shelfCodeCondition" @blur="queryMatList"></input>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view style="flex: 3;">
|
<view style="flex: 3;">
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view style="flex: 30;">
|
<view style="flex: 30;">
|
||||||
<button @click="analysisScanCode(this.shelfCode)">切换</button>
|
<button @click="clear">清空</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -63,20 +34,42 @@
|
|||||||
<view style="width: 700rpx;">货架码:{{shelfCode}}</view>
|
<view style="width: 700rpx;">货架码:{{shelfCode}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="diy-flex-column" style="margin-top: 5rpx;">
|
<view class="diy-flex-column" style="margin-top: 5rpx;">
|
||||||
<view class="diy-flex-inforow">
|
<view class="diy-flex-inforow">
|
||||||
<view style="width: 10rpx;"></view>
|
<view style="width: 10rpx;"></view>
|
||||||
<view style="width: 700rpx;">当前位置:{{shelfCode}}</view>
|
<view style="width: 700rpx;">运输状态:{{transStatusStr}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view style="flex: 1;">
|
<view class="diy-flex-column" style="margin-top: 5rpx;">
|
||||||
<view style="flex: 40;text-align: center;">
|
<view class="diy-flex-inforow">
|
||||||
<button style="margin: 50rpx;font-size: 40rpx;" size="mini">绑 定</button>
|
<view style="width: 10rpx;"></view>
|
||||||
<button style="margin: 50rpx;font-size: 40rpx;background-color: red;" size="mini">解 绑</button>
|
<view style="width: 700rpx;">当前位置:{{currentLocationCode}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="diy-flex-column" style="margin-top: 5rpx;">
|
||||||
|
<view class="diy-flex-inforow">
|
||||||
|
<view style="width: 10rpx;"></view>
|
||||||
|
<view style="width: 700rpx;">目标位置:{{destinationLocaiotnCode}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="diy-flex-column" style="margin-top: 5rpx;">
|
||||||
|
<view class="diy-flex-inforow">
|
||||||
|
<view style="width: 10rpx;"></view>
|
||||||
|
<view style="width: 740rpx;">扫描的位置码:{{scanedShelfCode}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view style="flex: 1;">
|
||||||
|
<view style="flex: 40;text-align: center;">
|
||||||
|
<button style="margin: 50rpx;font-size: 40rpx;" @click="bind" size="mini">绑 定</button>
|
||||||
|
<button style="margin: 50rpx;font-size: 40rpx;background-color: red;" @click="unbind"
|
||||||
|
size="mini">解 绑</button>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -105,16 +98,21 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
locationId: null,
|
//初始化
|
||||||
locationCode: '',
|
placeholderText: '请先扫描货架码',
|
||||||
|
shelfCodeCondition: '',
|
||||||
|
|
||||||
|
shelfId: 0,
|
||||||
|
shelfCode: '',
|
||||||
|
currentLocationId: 0,
|
||||||
|
currentLocationCode: '',
|
||||||
|
destinationLocationId: 0,
|
||||||
|
destinationLocaiotnCode: '',
|
||||||
|
transStatusStr: '',
|
||||||
|
|
||||||
|
scanedShelfCode: '', //扫描的位置编码
|
||||||
|
|
||||||
userName: '', //当前登录的用户名
|
userName: '', //当前登录的用户名
|
||||||
|
|
||||||
shelfId: null,
|
|
||||||
shelfCode: '',
|
|
||||||
placeholderText: '请先扫描货架码',
|
|
||||||
|
|
||||||
matCodeCondition: '', //物料编码搜索条件
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
@ -122,8 +120,11 @@
|
|||||||
|
|
||||||
const self = this; // 保存this的引用
|
const self = this; // 保存this的引用
|
||||||
recive(function(res) {
|
recive(function(res) {
|
||||||
console.log("Success:" + res.data);
|
if (self.shelfCode == '') {
|
||||||
self.analysisScanCode(res.data);
|
self.analysisScanCode(res.data);
|
||||||
|
} else {
|
||||||
|
self.saveScanedShelfCode(res.data);
|
||||||
|
}
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
console.log("Error:", JSON.stringify(err)); // 正确打印错误信息
|
console.log("Error:", JSON.stringify(err)); // 正确打印错误信息
|
||||||
});
|
});
|
||||||
@ -132,19 +133,18 @@
|
|||||||
analysisScanCode: function(encodedString) {
|
analysisScanCode: function(encodedString) {
|
||||||
// 去除末尾的逗号和"..."(如果有的话)
|
// 去除末尾的逗号和"..."(如果有的话)
|
||||||
encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
|
encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
|
||||||
this.shelfCode = encodedString;
|
this.shelfCodeCondition = encodedString;
|
||||||
//调用接口获取当前货架信息,查看当前货架的工位绑定情况
|
//调用接口获取当前货架信息,查看当前货架的工位绑定情况
|
||||||
var serverIPAndPort = getServerIPAndPort();
|
var serverIPAndPort = getServerIPAndPort();
|
||||||
|
|
||||||
uni.request({
|
uni.request({
|
||||||
url: 'http://' + serverIPAndPort +
|
url: 'http://' + serverIPAndPort +
|
||||||
'/pdaStocktaking/getStocktakingInfosByShelfCode', // 请求的接口地址
|
'/pdaShelfLocationBindUnbind/getLocationInfoByShelfCode', // 请求的接口地址
|
||||||
method: 'POST', // 设置请求方式为 POST
|
method: 'POST', // 设置请求方式为 POST
|
||||||
data: {
|
data: {
|
||||||
"shelfCode": this.shelfCode,
|
"shelfCode": encodedString,
|
||||||
"userName": this.userName,
|
"userName": this.userName,
|
||||||
"deviceType": "PDA",
|
"deviceType": "PDA",
|
||||||
"pageNumber": 1,
|
|
||||||
"pageSize": 1000
|
|
||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
'Content-Type': 'application/json', // 如果需要以JSON格式发送数据
|
'Content-Type': 'application/json', // 如果需要以JSON格式发送数据
|
||||||
@ -157,15 +157,22 @@
|
|||||||
//未查询到信息
|
//未查询到信息
|
||||||
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: '获取失败,请重试!',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 1500
|
duration: 1500
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//有物料信息
|
//有物料信息
|
||||||
this.cardData = res.data.data.lists;
|
this.shelfId = res.data.data.shelfId;
|
||||||
this.recordCount = res.data.data.count;
|
this.shelfCode = res.data.data.shelfCode;
|
||||||
|
|
||||||
|
this.currentLocationId = res.data.data.currentLocationId;
|
||||||
|
this.currentLocationCode = res.data.data.currentLocationCode;
|
||||||
|
this.destinationLocationId = res.data.data.destinationLocationId;
|
||||||
|
this.destinationLocaiotnCode = res.data.data.destinationLocaiotnCode;
|
||||||
|
this.transStatusStr = res.data.data.transStatusStr;
|
||||||
|
this.scanedShelfCode = '';
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '获取成功!',
|
title: '获取成功!',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@ -206,10 +213,180 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
saveScanedShelfCode: function(encodedString) {
|
||||||
|
// 去除末尾的逗号和"..."(如果有的话)
|
||||||
|
encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
|
||||||
|
this.scanedShelfCode = encodedString;
|
||||||
|
},
|
||||||
|
bind: function() {
|
||||||
|
if (this.shelfId == 0 || this.shelfId == null) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请先扫描获取数据!',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 3500
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.scanedShelfCode == 0 || this.scanedShelfCode == null) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请先扫描获取位置码!',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 3500
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//调用接口获取当前货架信息,查看当前货架的工位绑定情况
|
||||||
|
var serverIPAndPort = getServerIPAndPort();
|
||||||
|
uni.request({
|
||||||
|
url: 'http://' + serverIPAndPort +
|
||||||
|
'/pdaShelfLocationBindUnbind/shelfLocationBind', // 请求的接口地址
|
||||||
|
method: 'POST', // 设置请求方式为 POST
|
||||||
|
data: {
|
||||||
|
"shelfId": this.shelfId,
|
||||||
|
"shelfCode": this.shelfCode,
|
||||||
|
"locationId": 0,
|
||||||
|
"locationCode": this.scanedShelfCode,
|
||||||
|
"userName": this.userName,
|
||||||
|
"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: 3000
|
||||||
|
});
|
||||||
|
//绑定成功
|
||||||
|
this.analysisScanCode(this.shelfCode);
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '绑定失败:' + res.data.message,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 4500
|
||||||
|
});
|
||||||
|
//this.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '服务器返回错误状态码' + res.statusCode,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 4500
|
||||||
|
});
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
// 请求失败的回调函数
|
||||||
|
uni.showToast({
|
||||||
|
title: '请求失败' + err,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 4000
|
||||||
|
});
|
||||||
|
|
||||||
|
this.clear();
|
||||||
|
},
|
||||||
|
complete: (event) => {
|
||||||
|
// 请求完成的回调函数(无论成功或失败都会调用)
|
||||||
|
console.log('请求完成', event);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//解绑
|
||||||
|
unbind: function() {
|
||||||
|
if (this.shelfId == 0 || this.shelfId == null) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请先扫描获取数据!',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 3500
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//调用接口获取当前货架信息,查看当前货架的工位绑定情况
|
||||||
|
var serverIPAndPort = getServerIPAndPort();
|
||||||
|
uni.request({
|
||||||
|
url: 'http://' + serverIPAndPort +
|
||||||
|
'/pdaShelfLocationBindUnbind/shelfLocationUnBind', // 请求的接口地址
|
||||||
|
method: 'POST', // 设置请求方式为 POST
|
||||||
|
data: {
|
||||||
|
"shelfId": this.shelfId,
|
||||||
|
"shelfCode": this.shelfCode,
|
||||||
|
"locationId": 0,
|
||||||
|
"locationCode": this.scanedShelfCode,
|
||||||
|
"userName": this.userName,
|
||||||
|
"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: 3000
|
||||||
|
});
|
||||||
|
//解绑成功
|
||||||
|
this.analysisScanCode(this.shelfCode);
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '解绑失败:' + res.data.message,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 4500
|
||||||
|
});
|
||||||
|
//this.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '服务器返回错误状态码' + res.statusCode,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 4500
|
||||||
|
});
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
// 请求失败的回调函数
|
||||||
|
uni.showToast({
|
||||||
|
title: '请求失败' + err,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 4000
|
||||||
|
});
|
||||||
|
|
||||||
|
this.clear();
|
||||||
|
},
|
||||||
|
complete: (event) => {
|
||||||
|
// 请求完成的回调函数(无论成功或失败都会调用)
|
||||||
|
console.log('请求完成', event);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
//清空当前界面所有内容
|
//清空当前界面所有内容
|
||||||
clear: function() {
|
clear: function() {
|
||||||
this.placeholderText = '请先扫描货架码';
|
this.placeholderText = '请先扫描';
|
||||||
|
this.shelfCodeCondition = '';
|
||||||
|
|
||||||
|
this.shelfId = 0;
|
||||||
|
this.shelfCode = '';
|
||||||
|
this.currentLocationId = 0;
|
||||||
|
this.currentLocationCode = '';
|
||||||
|
this.destinationLocationId = 0;
|
||||||
|
this.destinationLocaiotnCode = '';
|
||||||
|
this.transStatusStr = '';
|
||||||
|
|
||||||
|
this.scanedShelfCode = '';
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
358
PDA/PDA/unpackage/dist/dev/app-plus/app-service.js
vendored
358
PDA/PDA/unpackage/dist/dev/app-plus/app-service.js
vendored
@ -3466,43 +3466,49 @@ if (uni.restoreGlobal) {
|
|||||||
const _sfc_main$1 = {
|
const _sfc_main$1 = {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
locationId: null,
|
//初始化
|
||||||
locationCode: "",
|
|
||||||
userName: "",
|
|
||||||
//当前登录的用户名
|
|
||||||
shelfId: null,
|
|
||||||
shelfCode: "",
|
|
||||||
placeholderText: "请先扫描货架码",
|
placeholderText: "请先扫描货架码",
|
||||||
matCodeCondition: ""
|
shelfCodeCondition: "",
|
||||||
//物料编码搜索条件
|
shelfId: 0,
|
||||||
|
shelfCode: "",
|
||||||
|
currentLocationId: 0,
|
||||||
|
currentLocationCode: "",
|
||||||
|
destinationLocationId: 0,
|
||||||
|
destinationLocaiotnCode: "",
|
||||||
|
transStatusStr: "",
|
||||||
|
scanedShelfCode: "",
|
||||||
|
//扫描的位置编码
|
||||||
|
userName: ""
|
||||||
|
//当前登录的用户名
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
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/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:125", "Success:" + res.data);
|
if (self.shelfCode == "") {
|
||||||
self.analysisScanCode(res.data);
|
self.analysisScanCode(res.data);
|
||||||
|
} else {
|
||||||
|
self.saveScanedShelfCode(res.data);
|
||||||
|
}
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
formatAppLog("log", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:128", "Error:", JSON.stringify(err));
|
formatAppLog("log", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:129", "Error:", JSON.stringify(err));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
analysisScanCode: function(encodedString) {
|
analysisScanCode: function(encodedString) {
|
||||||
encodedString = encodedString.replace(/,\s*\.\.\.$/, "");
|
encodedString = encodedString.replace(/,\s*\.\.\.$/, "");
|
||||||
this.shelfCode = encodedString;
|
this.shelfCodeCondition = encodedString;
|
||||||
var serverIPAndPort = getServerIPAndPort();
|
var serverIPAndPort = getServerIPAndPort();
|
||||||
uni.request({
|
uni.request({
|
||||||
url: "http://" + serverIPAndPort + "/pdaStocktaking/getStocktakingInfosByShelfCode",
|
url: "http://" + serverIPAndPort + "/pdaShelfLocationBindUnbind/getLocationInfoByShelfCode",
|
||||||
// 请求的接口地址
|
// 请求的接口地址
|
||||||
method: "POST",
|
method: "POST",
|
||||||
// 设置请求方式为 POST
|
// 设置请求方式为 POST
|
||||||
data: {
|
data: {
|
||||||
"shelfCode": this.shelfCode,
|
"shelfCode": encodedString,
|
||||||
"userName": this.userName,
|
"userName": this.userName,
|
||||||
"deviceType": "PDA",
|
"deviceType": "PDA"
|
||||||
"pageNumber": 1,
|
|
||||||
"pageSize": 1e3
|
|
||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
@ -3513,14 +3519,20 @@ 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: "获取失败,请重试!",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
duration: 1500
|
duration: 1500
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.cardData = res.data.data.lists;
|
this.shelfId = res.data.data.shelfId;
|
||||||
this.recordCount = res.data.data.count;
|
this.shelfCode = res.data.data.shelfCode;
|
||||||
|
this.currentLocationId = res.data.data.currentLocationId;
|
||||||
|
this.currentLocationCode = res.data.data.currentLocationCode;
|
||||||
|
this.destinationLocationId = res.data.data.destinationLocationId;
|
||||||
|
this.destinationLocaiotnCode = res.data.data.destinationLocaiotnCode;
|
||||||
|
this.transStatusStr = res.data.data.transStatusStr;
|
||||||
|
this.scanedShelfCode = "";
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "获取成功!",
|
title: "获取成功!",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
@ -3552,109 +3564,170 @@ if (uni.restoreGlobal) {
|
|||||||
this.clear();
|
this.clear();
|
||||||
},
|
},
|
||||||
complete: (event) => {
|
complete: (event) => {
|
||||||
formatAppLog("log", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:205", "请求完成", event);
|
formatAppLog("log", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:212", "请求完成", event);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
saveScanedShelfCode: function(encodedString) {
|
||||||
|
encodedString = encodedString.replace(/,\s*\.\.\.$/, "");
|
||||||
|
this.scanedShelfCode = encodedString;
|
||||||
|
},
|
||||||
|
bind: function() {
|
||||||
|
if (this.shelfId == 0 || this.shelfId == null) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请先扫描获取数据!",
|
||||||
|
icon: "none",
|
||||||
|
duration: 3500
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.scanedShelfCode == 0 || this.scanedShelfCode == null) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请先扫描获取位置码!",
|
||||||
|
icon: "none",
|
||||||
|
duration: 3500
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var serverIPAndPort = getServerIPAndPort();
|
||||||
|
uni.request({
|
||||||
|
url: "http://" + serverIPAndPort + "/pdaShelfLocationBindUnbind/shelfLocationBind",
|
||||||
|
// 请求的接口地址
|
||||||
|
method: "POST",
|
||||||
|
// 设置请求方式为 POST
|
||||||
|
data: {
|
||||||
|
"shelfId": this.shelfId,
|
||||||
|
"shelfCode": this.shelfCode,
|
||||||
|
"locationId": 0,
|
||||||
|
"locationCode": this.scanedShelfCode,
|
||||||
|
"userName": this.userName,
|
||||||
|
"deviceType": "PDA"
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
// 如果需要以JSON格式发送数据
|
||||||
|
},
|
||||||
|
success: (res) => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
if (res.data.code == 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "绑定成功!",
|
||||||
|
icon: "none",
|
||||||
|
duration: 3e3
|
||||||
|
});
|
||||||
|
this.analysisScanCode(this.shelfCode);
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: "绑定失败:" + res.data.message,
|
||||||
|
icon: "none",
|
||||||
|
duration: 4500
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: "服务器返回错误状态码" + res.statusCode,
|
||||||
|
icon: "none",
|
||||||
|
duration: 4500
|
||||||
|
});
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请求失败" + err,
|
||||||
|
icon: "none",
|
||||||
|
duration: 4e3
|
||||||
|
});
|
||||||
|
this.clear();
|
||||||
|
},
|
||||||
|
complete: (event) => {
|
||||||
|
formatAppLog("log", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:297", "请求完成", event);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//解绑
|
||||||
|
unbind: function() {
|
||||||
|
if (this.shelfId == 0 || this.shelfId == null) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请先扫描获取数据!",
|
||||||
|
icon: "none",
|
||||||
|
duration: 3500
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var serverIPAndPort = getServerIPAndPort();
|
||||||
|
uni.request({
|
||||||
|
url: "http://" + serverIPAndPort + "/pdaShelfLocationBindUnbind/shelfLocationUnBind",
|
||||||
|
// 请求的接口地址
|
||||||
|
method: "POST",
|
||||||
|
// 设置请求方式为 POST
|
||||||
|
data: {
|
||||||
|
"shelfId": this.shelfId,
|
||||||
|
"shelfCode": this.shelfCode,
|
||||||
|
"locationId": 0,
|
||||||
|
"locationCode": this.scanedShelfCode,
|
||||||
|
"userName": this.userName,
|
||||||
|
"deviceType": "PDA"
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
// 如果需要以JSON格式发送数据
|
||||||
|
},
|
||||||
|
success: (res) => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
if (res.data.code == 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "解绑成功!",
|
||||||
|
icon: "none",
|
||||||
|
duration: 3e3
|
||||||
|
});
|
||||||
|
this.analysisScanCode(this.shelfCode);
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: "解绑失败:" + res.data.message,
|
||||||
|
icon: "none",
|
||||||
|
duration: 4500
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: "服务器返回错误状态码" + res.statusCode,
|
||||||
|
icon: "none",
|
||||||
|
duration: 4500
|
||||||
|
});
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请求失败" + err,
|
||||||
|
icon: "none",
|
||||||
|
duration: 4e3
|
||||||
|
});
|
||||||
|
this.clear();
|
||||||
|
},
|
||||||
|
complete: (event) => {
|
||||||
|
formatAppLog("log", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:371", "请求完成", event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//清空当前界面所有内容
|
//清空当前界面所有内容
|
||||||
clear: function() {
|
clear: function() {
|
||||||
this.placeholderText = "请先扫描货架码";
|
this.placeholderText = "请先扫描";
|
||||||
|
this.shelfCodeCondition = "";
|
||||||
|
this.shelfId = 0;
|
||||||
|
this.shelfCode = "";
|
||||||
|
this.currentLocationId = 0;
|
||||||
|
this.currentLocationCode = "";
|
||||||
|
this.destinationLocationId = 0;
|
||||||
|
this.destinationLocaiotnCode = "";
|
||||||
|
this.transStatusStr = "";
|
||||||
|
this.scanedShelfCode = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
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);
|
|
||||||
return vue.openBlock(), vue.createElementBlock("view", { class: "bg-image" }, [
|
return vue.openBlock(), vue.createElementBlock("view", { class: "bg-image" }, [
|
||||||
vue.createVNode(
|
|
||||||
_component_uni_popup,
|
|
||||||
{
|
|
||||||
ref: "popup",
|
|
||||||
type: "dialog"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
default: vue.withCtx(() => [
|
|
||||||
vue.createElementVNode("view", { class: "popup-content" }, [
|
|
||||||
vue.createElementVNode("view", { class: "info-item" }, [
|
|
||||||
vue.createElementVNode("label", null, "物料编码:"),
|
|
||||||
vue.createElementVNode(
|
|
||||||
"text",
|
|
||||||
null,
|
|
||||||
vue.toDisplayString(_ctx.fixedInfo.matCode),
|
|
||||||
1
|
|
||||||
/* TEXT */
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
vue.createElementVNode("view", { class: "info-item" }, [
|
|
||||||
vue.createElementVNode("label", null, "物料名称:"),
|
|
||||||
vue.createElementVNode(
|
|
||||||
"text",
|
|
||||||
null,
|
|
||||||
vue.toDisplayString(_ctx.fixedInfo.matName),
|
|
||||||
1
|
|
||||||
/* TEXT */
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
vue.createElementVNode("view", { class: "info-item" }, [
|
|
||||||
vue.createElementVNode("label", null, "物料规格:"),
|
|
||||||
vue.createElementVNode(
|
|
||||||
"text",
|
|
||||||
null,
|
|
||||||
vue.toDisplayString(_ctx.fixedInfo.matSpec),
|
|
||||||
1
|
|
||||||
/* TEXT */
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
vue.createElementVNode("view", { class: "info-item" }, [
|
|
||||||
vue.createElementVNode("label", null, "数量:"),
|
|
||||||
vue.createElementVNode(
|
|
||||||
"text",
|
|
||||||
null,
|
|
||||||
vue.toDisplayString(_ctx.fixedInfo.matQty),
|
|
||||||
1
|
|
||||||
/* TEXT */
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
vue.createElementVNode("view", {
|
|
||||||
class: "input-item",
|
|
||||||
style: { "background-color": "wheat" }
|
|
||||||
}, [
|
|
||||||
vue.createElementVNode("label", null, "盘点数量:"),
|
|
||||||
vue.withDirectives(vue.createElementVNode(
|
|
||||||
"input",
|
|
||||||
{
|
|
||||||
ref: "inputRef",
|
|
||||||
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.inputValue = $event),
|
|
||||||
type: "number",
|
|
||||||
placeholder: "输入数量"
|
|
||||||
},
|
|
||||||
null,
|
|
||||||
512
|
|
||||||
/* NEED_PATCH */
|
|
||||||
), [
|
|
||||||
[
|
|
||||||
vue.vModelText,
|
|
||||||
_ctx.inputValue,
|
|
||||||
void 0,
|
|
||||||
{ number: true }
|
|
||||||
]
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
vue.createElementVNode("view", { class: "button-group" }, [
|
|
||||||
vue.createElementVNode("button", {
|
|
||||||
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.hidePopup && _ctx.hidePopup(...args))
|
|
||||||
}, "取消"),
|
|
||||||
vue.createElementVNode("button", {
|
|
||||||
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.saveData(_ctx.fixedInfo))
|
|
||||||
}, "保存")
|
|
||||||
])
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
_: 1
|
|
||||||
/* STABLE */
|
|
||||||
},
|
|
||||||
512
|
|
||||||
/* NEED_PATCH */
|
|
||||||
),
|
|
||||||
vue.createElementVNode("view", { class: "diy-flex-row" }, [
|
vue.createElementVNode("view", { class: "diy-flex-row" }, [
|
||||||
vue.createElementVNode("view", { style: { "flex": "3" } }, [
|
vue.createElementVNode("view", { style: { "flex": "3" } }, [
|
||||||
vue.createCommentVNode(" 占位 ")
|
vue.createCommentVNode(" 占位 ")
|
||||||
@ -3679,17 +3752,17 @@ if (uni.restoreGlobal) {
|
|||||||
class: "uni-input",
|
class: "uni-input",
|
||||||
style: { "font-size": "50rpx", "padding": "10rpx" },
|
style: { "font-size": "50rpx", "padding": "10rpx" },
|
||||||
placeholder: $data.placeholderText,
|
placeholder: $data.placeholderText,
|
||||||
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.matCodeCondition = $event),
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.shelfCodeCondition = $event),
|
||||||
onBlur: _cache[4] || (_cache[4] = (...args) => _ctx.queryMatList && _ctx.queryMatList(...args))
|
onBlur: _cache[1] || (_cache[1] = (...args) => _ctx.queryMatList && _ctx.queryMatList(...args))
|
||||||
}, null, 40, ["placeholder"]), [
|
}, null, 40, ["placeholder"]), [
|
||||||
[vue.vModelText, $data.matCodeCondition]
|
[vue.vModelText, $data.shelfCodeCondition]
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
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[5] || (_cache[5] = ($event) => $options.analysisScanCode(this.shelfCode))
|
onClick: _cache[2] || (_cache[2] = (...args) => $options.clear && $options.clear(...args))
|
||||||
}, "切换")
|
}, "清空")
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
@ -3721,7 +3794,52 @@ if (uni.restoreGlobal) {
|
|||||||
vue.createElementVNode(
|
vue.createElementVNode(
|
||||||
"view",
|
"view",
|
||||||
{ style: { "width": "700rpx" } },
|
{ style: { "width": "700rpx" } },
|
||||||
"当前位置:" + vue.toDisplayString($data.shelfCode),
|
"运输状态:" + vue.toDisplayString($data.transStatusStr),
|
||||||
|
1
|
||||||
|
/* TEXT */
|
||||||
|
)
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
vue.createElementVNode("view", {
|
||||||
|
class: "diy-flex-column",
|
||||||
|
style: { "margin-top": "5rpx" }
|
||||||
|
}, [
|
||||||
|
vue.createElementVNode("view", { class: "diy-flex-inforow" }, [
|
||||||
|
vue.createElementVNode("view", { style: { "width": "10rpx" } }),
|
||||||
|
vue.createElementVNode(
|
||||||
|
"view",
|
||||||
|
{ style: { "width": "700rpx" } },
|
||||||
|
"当前位置:" + vue.toDisplayString($data.currentLocationCode),
|
||||||
|
1
|
||||||
|
/* TEXT */
|
||||||
|
)
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
vue.createElementVNode("view", {
|
||||||
|
class: "diy-flex-column",
|
||||||
|
style: { "margin-top": "5rpx" }
|
||||||
|
}, [
|
||||||
|
vue.createElementVNode("view", { class: "diy-flex-inforow" }, [
|
||||||
|
vue.createElementVNode("view", { style: { "width": "10rpx" } }),
|
||||||
|
vue.createElementVNode(
|
||||||
|
"view",
|
||||||
|
{ style: { "width": "700rpx" } },
|
||||||
|
"目标位置:" + vue.toDisplayString($data.destinationLocaiotnCode),
|
||||||
|
1
|
||||||
|
/* TEXT */
|
||||||
|
)
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
vue.createElementVNode("view", {
|
||||||
|
class: "diy-flex-column",
|
||||||
|
style: { "margin-top": "5rpx" }
|
||||||
|
}, [
|
||||||
|
vue.createElementVNode("view", { class: "diy-flex-inforow" }, [
|
||||||
|
vue.createElementVNode("view", { style: { "width": "10rpx" } }),
|
||||||
|
vue.createElementVNode(
|
||||||
|
"view",
|
||||||
|
{ style: { "width": "740rpx" } },
|
||||||
|
"扫描的位置码:" + vue.toDisplayString($data.scanedShelfCode),
|
||||||
1
|
1
|
||||||
/* TEXT */
|
/* TEXT */
|
||||||
)
|
)
|
||||||
@ -3731,10 +3849,12 @@ if (uni.restoreGlobal) {
|
|||||||
vue.createElementVNode("view", { style: { "flex": "40", "text-align": "center" } }, [
|
vue.createElementVNode("view", { style: { "flex": "40", "text-align": "center" } }, [
|
||||||
vue.createElementVNode("button", {
|
vue.createElementVNode("button", {
|
||||||
style: { "margin": "50rpx", "font-size": "40rpx" },
|
style: { "margin": "50rpx", "font-size": "40rpx" },
|
||||||
|
onClick: _cache[3] || (_cache[3] = (...args) => $options.bind && $options.bind(...args)),
|
||||||
size: "mini"
|
size: "mini"
|
||||||
}, "绑 定"),
|
}, "绑 定"),
|
||||||
vue.createElementVNode("button", {
|
vue.createElementVNode("button", {
|
||||||
style: { "margin": "50rpx", "font-size": "40rpx", "background-color": "red" },
|
style: { "margin": "50rpx", "font-size": "40rpx", "background-color": "red" },
|
||||||
|
onClick: _cache[4] || (_cache[4] = (...args) => $options.unbind && $options.unbind(...args)),
|
||||||
size: "mini"
|
size: "mini"
|
||||||
}, "解 绑")
|
}, "解 绑")
|
||||||
])
|
])
|
||||||
|
@ -17,20 +17,12 @@ namespace WCS.BLL.Services.IService
|
|||||||
public interface IPDAShelfLocationBindUnbindService
|
public interface IPDAShelfLocationBindUnbindService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 通过货架编码查询当前绑定的位置
|
/// 通过货架编码查询当前绑定的位置等信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<ResponseBase> getLocationInfoByShelfCode(ShelfLocationBindUnbindRequest request);
|
public Task<ResponseBase> getLocationInfoByShelfCode(ShelfLocationBindUnbindRequest request);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 扫码 通过位置码获取当前位置的相关信息和当前位置上的货架的信息
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public Task<ResponseBase> getLocationInfoByLocationInfo(ShelfLocationBindUnbindRequest request);
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 货架绑定至位置
|
/// 货架绑定至位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
227
WCS.BLL/Services/Service/PDAShelfLocationBindUnbindService.cs
Normal file
227
WCS.BLL/Services/Service/PDAShelfLocationBindUnbindService.cs
Normal file
@ -0,0 +1,227 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WCS.BLL.Services.IService;
|
||||||
|
using WCS.DAL.Db;
|
||||||
|
using WCS.DAL.DbModels;
|
||||||
|
using WCS.Model;
|
||||||
|
using WCS.Model.ApiModel.PDAShelfLocationBindUnbind;
|
||||||
|
|
||||||
|
namespace WCS.BLL.Services.Service
|
||||||
|
{
|
||||||
|
public class PDAShelfLocationBindUnbindService : IPDAShelfLocationBindUnbindService
|
||||||
|
{
|
||||||
|
public async Task<ResponseBase> getLocationInfoByShelfCode(ShelfLocationBindUnbindRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
request.ShelfCode.Replace("\r", string.Empty)
|
||||||
|
.Replace("\n", string.Empty)
|
||||||
|
.Trim();
|
||||||
|
//校验参数 传入数据为PDA扫描的货架编码
|
||||||
|
if (request == null || string.IsNullOrEmpty(request.ShelfCode))
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"获取失败:参数异常,货架码为空!",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//获取货架数据
|
||||||
|
var shelfInfo = await DbHelp.db.Queryable<ShelfInfo>()
|
||||||
|
.Where(t => t.ShelfCode == request.ShelfCode)
|
||||||
|
.Where(t => t.IsEnable)
|
||||||
|
.FirstAsync();
|
||||||
|
if (shelfInfo == null)
|
||||||
|
{
|
||||||
|
//通过货架编码匹配不到就通过当前位置码去匹配 获取当前位置上的货架等相关信息
|
||||||
|
shelfInfo = await DbHelp.db.Queryable<ShelfInfo>()
|
||||||
|
.Where(t => t.CurrentLocaiotnCode == request.ShelfCode || t.DestinationLocaiotnCode == request.ShelfCode)
|
||||||
|
.Where(t => t.IsEnable)
|
||||||
|
.FirstAsync();
|
||||||
|
if (shelfInfo == null)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"获取失败:货架{request.ShelfCode}不存在或已被禁用!",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//货架数据不为空
|
||||||
|
return new ResponseCommon<ShelfLocationBindUnbindResponseData>()
|
||||||
|
{
|
||||||
|
Code = 200,
|
||||||
|
Message = "success",
|
||||||
|
Data = new ShelfLocationBindUnbindResponseData()
|
||||||
|
{
|
||||||
|
ShelfId = shelfInfo.Id,
|
||||||
|
ShelfCode = shelfInfo.ShelfCode,
|
||||||
|
CurrentLocationId = shelfInfo.CurrentLocationId,
|
||||||
|
CurrentLocationCode = shelfInfo.CurrentLocaiotnCode,
|
||||||
|
DestinationLocationId = shelfInfo.DestinationLocationId,
|
||||||
|
DestinationLocaiotnCode = shelfInfo.DestinationLocaiotnCode,
|
||||||
|
TransStatusStr = shelfInfo.TransStatus.ToString(),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"获取失败:发生异常{ex.Message}",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 货架和位置绑定 绑定都绑定为 静止状态 当前位置为所传入的位置
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<ResponseBase> shelfLocationBind(ShelfLocationBindUnbindRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//校验参数 传入数据为货架编码、货架ID 为上一个接口的返回数据
|
||||||
|
if (request == null || request.ShelfId == 0)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 205,
|
||||||
|
Message = $"绑定失败:货架参数异常,请重新扫描货架码!",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//校验参数 传入数据为扫描的位置码
|
||||||
|
if (string.IsNullOrEmpty(request.LocationCode))
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"绑定失败:货架码参数异常,请重新扫描位置码!",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取货架数据
|
||||||
|
var shelfInfo = await DbHelp.db.Queryable<ShelfInfo>()
|
||||||
|
.Where(t => t.Id == request.ShelfId)
|
||||||
|
.Where(t => t.IsEnable)
|
||||||
|
.FirstAsync();
|
||||||
|
if (shelfInfo == null)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"绑定失败:货架{request.ShelfCode}不存在或已被禁用!",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取位置码代表的位置数据
|
||||||
|
var locationInfo = await DbHelp.db.Queryable<LocationInfo>()
|
||||||
|
.Where(t => t.LocationCode == request.LocationCode)
|
||||||
|
.Where(t => t.IsEnable)
|
||||||
|
.FirstAsync();
|
||||||
|
if (locationInfo == null)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"绑定失败:位置{request.LocationCode}不存在或已被禁用!",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//查询该位置是否已绑定货架
|
||||||
|
var shelfAlreadyBinded = await DbHelp.db.Queryable<ShelfInfo>()
|
||||||
|
.Where(t => t.DestinationLocationId == locationInfo.Id || t.CurrentLocationId == locationInfo.Id)
|
||||||
|
.Where(t => t.IsEnable)
|
||||||
|
.FirstAsync();
|
||||||
|
if (shelfAlreadyBinded != null)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"绑定失败:位置{request.LocationCode}已绑定货架{request.ShelfCode}\r\n请扫描位置码解绑后再进行绑定!",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//开始绑定
|
||||||
|
shelfInfo.CurrentLocaiotnCode = locationInfo.LocationCode;
|
||||||
|
shelfInfo.CurrentLocationId = locationInfo.Id;
|
||||||
|
shelfInfo.TransStatus = TransStatusEnum.静止;
|
||||||
|
DbHelp.db.Updateable(shelfInfo).ExecuteCommand();
|
||||||
|
|
||||||
|
//返回成功
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 200,
|
||||||
|
Message = "success",
|
||||||
|
Data = null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"绑定失败:发生异常{ex.Message}",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResponseBase> shelfLocationUnBind(ShelfLocationBindUnbindRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//校验参数 传入数据为货架编码、货架ID 为上一个接口的返回数据
|
||||||
|
if (request == null || request.ShelfId == 0)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 205,
|
||||||
|
Message = $"解绑失败:货架参数异常,请重新扫描货架码!",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取货架数据
|
||||||
|
var shelfInfo = await DbHelp.db.Queryable<ShelfInfo>()
|
||||||
|
.Where(t => t.Id == request.ShelfId)
|
||||||
|
.Where(t => t.IsEnable)
|
||||||
|
.FirstAsync();
|
||||||
|
if (shelfInfo == null)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"解绑失败:货架{request.ShelfCode}不存在或已被禁用!",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//开始解绑
|
||||||
|
shelfInfo.CurrentLocationId = 0;
|
||||||
|
shelfInfo.CurrentLocaiotnCode = string.Empty;
|
||||||
|
shelfInfo.DestinationLocationId = 0;
|
||||||
|
shelfInfo.DestinationLocaiotnCode = string.Empty;
|
||||||
|
shelfInfo.TransStatus = TransStatusEnum.静止;
|
||||||
|
DbHelp.db.Updateable(shelfInfo).ExecuteCommand();
|
||||||
|
|
||||||
|
//返回成功
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 200,
|
||||||
|
Message = "success",
|
||||||
|
Data = null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"解绑失败:发生异常{ex.Message}",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -13,7 +13,15 @@ namespace WCS.Model.ApiModel.PDAShelfLocationBindUnbind
|
|||||||
{
|
{
|
||||||
public int ShelfId { get; set; }
|
public int ShelfId { get; set; }
|
||||||
public string ShelfCode { get; set; }
|
public string ShelfCode { get; set; }
|
||||||
public int LocationId { get; set; } = 0;
|
//当前位置ID
|
||||||
public string LocationCode { get; set; }
|
public int CurrentLocationId { get; set; } = 0;
|
||||||
|
//当前位置的编码
|
||||||
|
public string CurrentLocationCode { get; set; }
|
||||||
|
//目标位置ID
|
||||||
|
public int DestinationLocationId { get; set; } = 0;
|
||||||
|
//目标位置编码
|
||||||
|
public string DestinationLocaiotnCode { get; set; } = string.Empty;
|
||||||
|
/// 货架运输状态字符串
|
||||||
|
public string TransStatusStr { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ using WCS.BLL.Services.IService;
|
|||||||
using WCS.BLL.Services.Service;
|
using WCS.BLL.Services.Service;
|
||||||
using WCS.Model;
|
using WCS.Model;
|
||||||
using WCS.Model.ApiModel.MatBaseInfo;
|
using WCS.Model.ApiModel.MatBaseInfo;
|
||||||
|
using WCS.Model.ApiModel.PDAShelfLocationBindUnbind;
|
||||||
using WCS.Model.ApiModel.Stocktaking;
|
using WCS.Model.ApiModel.Stocktaking;
|
||||||
|
|
||||||
namespace WCS.WebApi.Controllers
|
namespace WCS.WebApi.Controllers
|
||||||
@ -14,49 +15,64 @@ namespace WCS.WebApi.Controllers
|
|||||||
[Route("[controller]")]
|
[Route("[controller]")]
|
||||||
public class PDAShelfLocationBindUnbindController : ControllerBase
|
public class PDAShelfLocationBindUnbindController : ControllerBase
|
||||||
{
|
{
|
||||||
public IStockTakingService _stockTakingService { get; set; }
|
public IPDAShelfLocationBindUnbindService _pdaShelfLocationBindUnbindService { get; set; }
|
||||||
public PDAShelfLocationBindUnbindController(IStockTakingService stockTakingService)
|
public PDAShelfLocationBindUnbindController(IPDAShelfLocationBindUnbindService pdaShelfLocationBindUnbindService)
|
||||||
{
|
{
|
||||||
_stockTakingService = stockTakingService;
|
_pdaShelfLocationBindUnbindService = pdaShelfLocationBindUnbindService;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("getLocationInfoByShelfCode")]
|
[Route("getLocationInfoByShelfCode")]
|
||||||
[HttpPost(Name = "getLocationInfoByShelfCode")]
|
[HttpPost(Name = "getLocationInfoByShelfCode")]
|
||||||
public async Task<ResponseCommon> getLocationInfoByShelfCode(StockTakingByIdRequest request)
|
public async Task<ResponseBase> getLocationInfoByShelfCode(ShelfLocationBindUnbindRequest request)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#region 参数校验
|
return await _pdaShelfLocationBindUnbindService.getLocationInfoByShelfCode(request);
|
||||||
//判断参数 //数量可以为空 数量为空盘点确认 这边删除对应数据即可
|
|
||||||
if (request.MatDetailCurrentInfoId == 0)
|
|
||||||
{
|
|
||||||
return new ResponseCommon()
|
|
||||||
{
|
|
||||||
Code = 201,
|
|
||||||
Message = $"操作失败:参数传入错误(Id为0)!",
|
|
||||||
Data = null,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (request.StocktakingQty < 0)
|
|
||||||
{
|
|
||||||
return new ResponseCommon()
|
|
||||||
{
|
|
||||||
Code = 201,
|
|
||||||
Message = $"操作失败:数量应大于等于0!",
|
|
||||||
Data = null,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
return await _stockTakingService.stockTakingById(request);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
{
|
{
|
||||||
Code = 201,
|
Code = 201,
|
||||||
Message = ex.Message,
|
Message = "获取失败:" + ex.Message,
|
||||||
|
Data = null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Route("shelfLocationBind")]
|
||||||
|
[HttpPost(Name = "shelfLocationBind")]
|
||||||
|
public async Task<ResponseBase> shelfLocationBind(ShelfLocationBindUnbindRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _pdaShelfLocationBindUnbindService.shelfLocationBind(request);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = "绑定失败:" + ex.Message,
|
||||||
|
Data = null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Route("shelfLocationUnBind")]
|
||||||
|
[HttpPost(Name = "shelfLocationUnBind")]
|
||||||
|
public async Task<ResponseBase> shelfLocationUnBind(ShelfLocationBindUnbindRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _pdaShelfLocationBindUnbindService.shelfLocationUnBind(request);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = "解绑失败:" + ex.Message,
|
||||||
Data = null,
|
Data = null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,7 @@ namespace WebApi
|
|||||||
builder.Services.AddScoped<ILocationInfoService, LocationInfoService>();
|
builder.Services.AddScoped<ILocationInfoService, LocationInfoService>();
|
||||||
builder.Services.AddScoped<IMatDetailCurrentInfoService,MatDetailCurrentInfoService>();
|
builder.Services.AddScoped<IMatDetailCurrentInfoService,MatDetailCurrentInfoService>();
|
||||||
builder.Services.AddScoped<IBatchBindMatDetailService, BatchBindMatDetailService>();
|
builder.Services.AddScoped<IBatchBindMatDetailService, BatchBindMatDetailService>();
|
||||||
|
builder.Services.AddScoped<IPDAShelfLocationBindUnbindService, PDAShelfLocationBindUnbindService>();
|
||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>롢<EFBFBD><EBA1A2><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ģʽ
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>롢<EFBFBD><EBA1A2><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ģʽ
|
||||||
builder.Services.AddSingleton<IGenerateService, GenerateService>();
|
builder.Services.AddSingleton<IGenerateService, GenerateService>();
|
||||||
|
Reference in New Issue
Block a user