diff --git a/PDA/PDA/pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue b/PDA/PDA/pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue
index db32940..492a51c 100644
--- a/PDA/PDA/pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue
+++ b/PDA/PDA/pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue
@@ -1,34 +1,5 @@
-
-
-
-
@@ -41,14 +12,14 @@
+ :placeholder="placeholderText" v-model="shelfCodeCondition" @blur="queryMatList">
-
+
@@ -63,20 +34,42 @@
货架码:{{shelfCode}}
-
+
- 当前位置:{{shelfCode}}
+ 运输状态:{{transStatusStr}}
-
-
-
-
+
+
+
+ 当前位置:{{currentLocationCode}}
+
+
+
+
+
+
+ 目标位置:{{destinationLocaiotnCode}}
+
+
+
+
+
+
+ 扫描的位置码:{{scanedShelfCode}}
+
+
+
+
+
+
+
+
-
@@ -105,16 +98,21 @@
export default {
data() {
return {
- locationId: null,
- locationCode: '',
+ //初始化
+ placeholderText: '请先扫描货架码',
+ shelfCodeCondition: '',
+
+ shelfId: 0,
+ shelfCode: '',
+ currentLocationId: 0,
+ currentLocationCode: '',
+ destinationLocationId: 0,
+ destinationLocaiotnCode: '',
+ transStatusStr: '',
+
+ scanedShelfCode: '', //扫描的位置编码
userName: '', //当前登录的用户名
-
- shelfId: null,
- shelfCode: '',
- placeholderText: '请先扫描货架码',
-
- matCodeCondition: '', //物料编码搜索条件
}
},
onShow: function() {
@@ -122,8 +120,11 @@
const self = this; // 保存this的引用
recive(function(res) {
- console.log("Success:" + res.data);
- self.analysisScanCode(res.data);
+ if (self.shelfCode == '') {
+ self.analysisScanCode(res.data);
+ } else {
+ self.saveScanedShelfCode(res.data);
+ }
}, function(err) {
console.log("Error:", JSON.stringify(err)); // 正确打印错误信息
});
@@ -132,19 +133,18 @@
analysisScanCode: function(encodedString) {
// 去除末尾的逗号和"..."(如果有的话)
encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
- this.shelfCode = encodedString;
+ this.shelfCodeCondition = encodedString;
//调用接口获取当前货架信息,查看当前货架的工位绑定情况
var serverIPAndPort = getServerIPAndPort();
+
uni.request({
url: 'http://' + serverIPAndPort +
- '/pdaStocktaking/getStocktakingInfosByShelfCode', // 请求的接口地址
+ '/pdaShelfLocationBindUnbind/getLocationInfoByShelfCode', // 请求的接口地址
method: 'POST', // 设置请求方式为 POST
data: {
- "shelfCode": this.shelfCode,
+ "shelfCode": encodedString,
"userName": this.userName,
"deviceType": "PDA",
- "pageNumber": 1,
- "pageSize": 1000
},
header: {
'Content-Type': 'application/json', // 如果需要以JSON格式发送数据
@@ -157,15 +157,22 @@
//未查询到信息
if (res.data.data == null || res.data.data.count == 0) {
uni.showToast({
- title: '该货架不存在绑定的物料信息!',
+ title: '获取失败,请重试!',
icon: 'none',
duration: 1500
});
return;
}
//有物料信息
- this.cardData = res.data.data.lists;
- this.recordCount = res.data.data.count;
+ this.shelfId = res.data.data.shelfId;
+ 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({
title: '获取成功!',
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() {
- 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 = '';
},
}
}
diff --git a/PDA/PDA/unpackage/dist/dev/app-plus/app-service.js b/PDA/PDA/unpackage/dist/dev/app-plus/app-service.js
index 0a5acc7..ab8935d 100644
--- a/PDA/PDA/unpackage/dist/dev/app-plus/app-service.js
+++ b/PDA/PDA/unpackage/dist/dev/app-plus/app-service.js
@@ -3466,43 +3466,49 @@ if (uni.restoreGlobal) {
const _sfc_main$1 = {
data() {
return {
- locationId: null,
- locationCode: "",
- userName: "",
- //当前登录的用户名
- shelfId: null,
- shelfCode: "",
+ //初始化
placeholderText: "请先扫描货架码",
- matCodeCondition: ""
- //物料编码搜索条件
+ shelfCodeCondition: "",
+ shelfId: 0,
+ shelfCode: "",
+ currentLocationId: 0,
+ currentLocationCode: "",
+ destinationLocationId: 0,
+ destinationLocaiotnCode: "",
+ transStatusStr: "",
+ scanedShelfCode: "",
+ //扫描的位置编码
+ userName: ""
+ //当前登录的用户名
};
},
onShow: function() {
this.userName = getConfig("userName", "admin");
const self = this;
recive(function(res) {
- formatAppLog("log", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:125", "Success:" + res.data);
- self.analysisScanCode(res.data);
+ if (self.shelfCode == "") {
+ self.analysisScanCode(res.data);
+ } else {
+ self.saveScanedShelfCode(res.data);
+ }
}, 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: {
analysisScanCode: function(encodedString) {
encodedString = encodedString.replace(/,\s*\.\.\.$/, "");
- this.shelfCode = encodedString;
+ this.shelfCodeCondition = encodedString;
var serverIPAndPort = getServerIPAndPort();
uni.request({
- url: "http://" + serverIPAndPort + "/pdaStocktaking/getStocktakingInfosByShelfCode",
+ url: "http://" + serverIPAndPort + "/pdaShelfLocationBindUnbind/getLocationInfoByShelfCode",
// 请求的接口地址
method: "POST",
// 设置请求方式为 POST
data: {
- "shelfCode": this.shelfCode,
+ "shelfCode": encodedString,
"userName": this.userName,
- "deviceType": "PDA",
- "pageNumber": 1,
- "pageSize": 1e3
+ "deviceType": "PDA"
},
header: {
"Content-Type": "application/json"
@@ -3513,14 +3519,20 @@ if (uni.restoreGlobal) {
if (res.data.code == 200) {
if (res.data.data == null || res.data.data.count == 0) {
uni.showToast({
- title: "该货架不存在绑定的物料信息!",
+ title: "获取失败,请重试!",
icon: "none",
duration: 1500
});
return;
}
- this.cardData = res.data.data.lists;
- this.recordCount = res.data.data.count;
+ this.shelfId = res.data.data.shelfId;
+ 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({
title: "获取成功!",
icon: "none",
@@ -3552,109 +3564,170 @@ if (uni.restoreGlobal) {
this.clear();
},
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() {
- 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) {
- const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_0);
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", { style: { "flex": "3" } }, [
vue.createCommentVNode(" 占位 ")
@@ -3679,17 +3752,17 @@ if (uni.restoreGlobal) {
class: "uni-input",
style: { "font-size": "50rpx", "padding": "10rpx" },
placeholder: $data.placeholderText,
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.matCodeCondition = $event),
- onBlur: _cache[4] || (_cache[4] = (...args) => _ctx.queryMatList && _ctx.queryMatList(...args))
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.shelfCodeCondition = $event),
+ onBlur: _cache[1] || (_cache[1] = (...args) => _ctx.queryMatList && _ctx.queryMatList(...args))
}, null, 40, ["placeholder"]), [
- [vue.vModelText, $data.matCodeCondition]
+ [vue.vModelText, $data.shelfCodeCondition]
])
]),
vue.createElementVNode("view", { style: { "flex": "3" } }),
vue.createElementVNode("view", { style: { "flex": "30" } }, [
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(
"view",
{ 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
/* TEXT */
)
@@ -3731,10 +3849,12 @@ if (uni.restoreGlobal) {
vue.createElementVNode("view", { style: { "flex": "40", "text-align": "center" } }, [
vue.createElementVNode("button", {
style: { "margin": "50rpx", "font-size": "40rpx" },
+ onClick: _cache[3] || (_cache[3] = (...args) => $options.bind && $options.bind(...args)),
size: "mini"
}, "绑 定"),
vue.createElementVNode("button", {
style: { "margin": "50rpx", "font-size": "40rpx", "background-color": "red" },
+ onClick: _cache[4] || (_cache[4] = (...args) => $options.unbind && $options.unbind(...args)),
size: "mini"
}, "解 绑")
])
diff --git a/WCS.BLL/Services/IService/IPDAShelfLocationBindUnbindService.cs b/WCS.BLL/Services/IService/IPDAShelfLocationBindUnbindService.cs
index 297b57f..0fd7ecc 100644
--- a/WCS.BLL/Services/IService/IPDAShelfLocationBindUnbindService.cs
+++ b/WCS.BLL/Services/IService/IPDAShelfLocationBindUnbindService.cs
@@ -17,20 +17,12 @@ namespace WCS.BLL.Services.IService
public interface IPDAShelfLocationBindUnbindService
{
///
- /// 通过货架编码查询当前绑定的位置
+ /// 通过货架编码查询当前绑定的位置等信息
///
///
///
public Task getLocationInfoByShelfCode(ShelfLocationBindUnbindRequest request);
- ///
- /// 扫码 通过位置码获取当前位置的相关信息和当前位置上的货架的信息
- ///
- ///
- ///
- public Task getLocationInfoByLocationInfo(ShelfLocationBindUnbindRequest request);
-
-
///
/// 货架绑定至位置
///
diff --git a/WCS.BLL/Services/Service/PDAShelfLocationBindUnbindService.cs b/WCS.BLL/Services/Service/PDAShelfLocationBindUnbindService.cs
new file mode 100644
index 0000000..8d960ef
--- /dev/null
+++ b/WCS.BLL/Services/Service/PDAShelfLocationBindUnbindService.cs
@@ -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 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()
+ .Where(t => t.ShelfCode == request.ShelfCode)
+ .Where(t => t.IsEnable)
+ .FirstAsync();
+ if (shelfInfo == null)
+ {
+ //通过货架编码匹配不到就通过当前位置码去匹配 获取当前位置上的货架等相关信息
+ shelfInfo = await DbHelp.db.Queryable()
+ .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()
+ {
+ 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}",
+ };
+ }
+ }
+
+ ///
+ /// 货架和位置绑定 绑定都绑定为 静止状态 当前位置为所传入的位置
+ ///
+ ///
+ ///
+ public async Task 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()
+ .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()
+ .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()
+ .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 shelfLocationUnBind(ShelfLocationBindUnbindRequest request)
+ {
+ try
+ {
+ //校验参数 传入数据为货架编码、货架ID 为上一个接口的返回数据
+ if (request == null || request.ShelfId == 0)
+ {
+ return new ResponseCommon()
+ {
+ Code = 205,
+ Message = $"解绑失败:货架参数异常,请重新扫描货架码!",
+ };
+ }
+
+ //获取货架数据
+ var shelfInfo = await DbHelp.db.Queryable()
+ .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}",
+ };
+ }
+ }
+ }
+}
diff --git a/WCS.Model/ApiModel/PDAShelfLocationBindUnbind/ShelfLocationBindUnbindResponse.cs b/WCS.Model/ApiModel/PDAShelfLocationBindUnbind/ShelfLocationBindUnbindResponse.cs
index 64195fc..84d6c7c 100644
--- a/WCS.Model/ApiModel/PDAShelfLocationBindUnbind/ShelfLocationBindUnbindResponse.cs
+++ b/WCS.Model/ApiModel/PDAShelfLocationBindUnbind/ShelfLocationBindUnbindResponse.cs
@@ -13,7 +13,15 @@ namespace WCS.Model.ApiModel.PDAShelfLocationBindUnbind
{
public int ShelfId { get; set; }
public string ShelfCode { get; set; }
- public int LocationId { get; set; } = 0;
- public string LocationCode { get; set; }
+ //当前位置ID
+ 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; }
}
}
diff --git a/WCS.WebApi/Controllers/PDAShelfLocationBindUnbindController.cs b/WCS.WebApi/Controllers/PDAShelfLocationBindUnbindController.cs
index b578326..f6eff5a 100644
--- a/WCS.WebApi/Controllers/PDAShelfLocationBindUnbindController.cs
+++ b/WCS.WebApi/Controllers/PDAShelfLocationBindUnbindController.cs
@@ -3,6 +3,7 @@ using WCS.BLL.Services.IService;
using WCS.BLL.Services.Service;
using WCS.Model;
using WCS.Model.ApiModel.MatBaseInfo;
+using WCS.Model.ApiModel.PDAShelfLocationBindUnbind;
using WCS.Model.ApiModel.Stocktaking;
namespace WCS.WebApi.Controllers
@@ -14,49 +15,64 @@ namespace WCS.WebApi.Controllers
[Route("[controller]")]
public class PDAShelfLocationBindUnbindController : ControllerBase
{
- public IStockTakingService _stockTakingService { get; set; }
- public PDAShelfLocationBindUnbindController(IStockTakingService stockTakingService)
+ public IPDAShelfLocationBindUnbindService _pdaShelfLocationBindUnbindService { get; set; }
+ public PDAShelfLocationBindUnbindController(IPDAShelfLocationBindUnbindService pdaShelfLocationBindUnbindService)
{
- _stockTakingService = stockTakingService;
+ _pdaShelfLocationBindUnbindService = pdaShelfLocationBindUnbindService;
}
[Route("getLocationInfoByShelfCode")]
[HttpPost(Name = "getLocationInfoByShelfCode")]
- public async Task getLocationInfoByShelfCode(StockTakingByIdRequest request)
+ public async Task getLocationInfoByShelfCode(ShelfLocationBindUnbindRequest request)
{
try
{
- #region 参数校验
- //判断参数 //数量可以为空 数量为空盘点确认 这边删除对应数据即可
- 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);
+ return await _pdaShelfLocationBindUnbindService.getLocationInfoByShelfCode(request);
}
catch (Exception ex)
{
return new ResponseCommon()
{
Code = 201,
- Message = ex.Message,
+ Message = "获取失败:" + ex.Message,
+ Data = null,
+ };
+ }
+ }
+
+ [Route("shelfLocationBind")]
+ [HttpPost(Name = "shelfLocationBind")]
+ public async Task 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 shelfLocationUnBind(ShelfLocationBindUnbindRequest request)
+ {
+ try
+ {
+ return await _pdaShelfLocationBindUnbindService.shelfLocationUnBind(request);
+ }
+ catch (Exception ex)
+ {
+ return new ResponseCommon()
+ {
+ Code = 201,
+ Message = "解绑失败:" + ex.Message,
Data = null,
};
}
diff --git a/WCS.WebApi/Program.cs b/WCS.WebApi/Program.cs
index 479aef8..7df87af 100644
--- a/WCS.WebApi/Program.cs
+++ b/WCS.WebApi/Program.cs
@@ -84,6 +84,7 @@ namespace WebApi
builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
+ builder.Services.AddScoped();
//롢ɵõģʽ
builder.Services.AddSingleton();