代码提交:货架送回

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>
</view>
<view class="content-time">
<text>绑定时间:</text>
<text>最后更新时间:</text>
<text>{{item.modifyTime}}</text>
</view>
</view>

View File

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

View File

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

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.PDAProductionLineCallIn
namespace WCS.Model.ApiModel.PDAProductionLineCallOut
{
public class CallOutRequest:RequestBase
{
@ -10,5 +10,9 @@ namespace WCS.Model.ApiModel.PDAProductionLineCallIn
public string LocationCode { get; set; }
public int ShelfId { 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>
[Route("callIn")]
[HttpPost(Name = "callIn")]
public async Task<ResponseCommon> callIn(CallOutRequest request)
public async Task<ResponseCommon> callIn(CallInRequest request)
{
try
{

View File

@ -5,11 +5,14 @@ using WCS.BLL.Services.Service;
using WCS.DAL.Db;
using WCS.DAL.DbModels;
using WCS.Model;
using WCS.Model.ApiModel.LocationInfo;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.MatDetailCurrentInfo;
using WCS.Model.ApiModel.PDAProductionLineCallIn;
using WCS.Model.ApiModel.PDAProductionLineCallOut;
using WCS.Model.ApiModel.PDAShelfLocationBindUnbind;
using WCS.Model.ApiModel.Stocktaking;
using WCS.Model.ApiModel.StoreInfo;
namespace WCS.WebApi.Controllers
{
@ -26,113 +29,97 @@ namespace WCS.WebApi.Controllers
}
/// <summary>
/// 获取当前货架、当前工位、当前工位可以作为起点可以到的目标区域
/// 获取当前货架、当前货架的工位、当前工位可以作为起点可以到的目标区域
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("getMatDetailCurrentInfosForCallOut")]
[HttpPost(Name = "getMatDetailCurrentInfosForCallOut")]
public async Task<ResponseCommon> getMatDetailCurrentInfosForCallIn(GetMatDetailCurrentInfosForCallInRequest request)
[Route("getShelfInfoForCallOut")]
[HttpPost(Name = "getShelfInfoForCallOut")]
public async Task<ResponseCommon> getShelfInfoForCallOut(GetShelfInfoForCallOutRequest request)
{
try
{
#region
if (request.LocationId == 0)
//校验参数
if (string.IsNullOrEmpty(request.ShelfCode))
{
return new ResponseCommon()
{
Code = 201,
Message = $"参数错误:请重新扫描工位码!",
Message = "参数错误请重新扫描货架码!",
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>()
.Where(t => t.Id == request.LocationId)
.FirstAsync();
.Where(t => t.Id == shelfInfo.CurrentLocationId)
.Where(t => t.IsEnable)
.FirstAsync();
if (locationInfo == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"获取失败:工位{request.LocationCode}不存在!",
Message = $"工位{shelfInfo.CurrentLocaiotnCode}不存在或已被禁用!",
Data = null,
};
}
if (locationInfo.IsEnable == false)
{
return new ResponseCommon()
{
Code = 201,
Message = $"获取失败:工位{locationInfo.LocationCode}已被禁用!",
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
#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>()
//获取工位作为起点 可以放置的目标区域
var locationAreas = await DbHelp.db.Queryable<LocationAreaInfo>()
.WhereIF(locationInfo.AllowDestinationLocationArea != null && locationInfo.AllowDestinationLocationArea.Count > 0, t => locationInfo.AllowDestinationLocationArea.Contains(t.Id))
.Select(t => new LocationAreaInfoModel()
{
Id = t.Id,
LocationAreaName = t.LocationAreaName,
})
.ToListAsync();
return new ResponseCommon()
{
Code = 200,
Message = $"success",
Data = new PageQueryResponseData<MatDetailCurrentInfoModel>()
Message = "success",
Data = new GetShelfInfoForCallOutResponseData()
{
TotalCount = totalCount,
MaxPage = 1,
Count = records.Count,
Lists = records.ToList()
ShelfId = shelfInfo.Id,
ShelfCode = shelfInfo.ShelfCode,
LocationId = locationInfo.Id,
LocationCode = locationInfo.LocationCode,
LocationAreas = locationAreas
}
};
#endregion
}
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>
/// 货架送回 通过 货架ID 目标区域 是否为空货架 将货架送回
/// 货架送回 通过 货架ID 目标区域 是否为空货架等参数 将货架送回
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("callOut")]
[HttpPost(Name = "callOut")]
public async Task<ResponseCommon> callIn(CallOutRequest request)
public async Task<ResponseCommon> callOut(CallOutRequest request)
{
try
{
#region
#region
if (request.LocationId == 0)
{
return new ResponseCommon()
{
Code = 201,
Message = $"呼叫失败:请重新扫描工位码!",
Message = $"送回失败:请重新扫描货架码!",
Data = null,
};
}
//获取位置信息
var locationInfo = await DbHelp.db.Queryable<LocationInfo>()
.Where(t => t.Id == request.LocationId)
.FirstAsync();
.Where(t => t.Id == request.LocationId)
.FirstAsync();
if (locationInfo == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"呼叫失败:工位{request.LocationCode}不存在!",
Message = $"送回失败:工位{request.LocationCode}不存在!",
Data = null,
};
}
if (locationInfo.IsEnable == false)
{
return new ResponseCommon()
{
Code = 201,
Message = $"呼叫失败:工位{locationInfo.LocationCode}已被禁用!",
Message = $"送回失败:工位{locationInfo.LocationCode}已被禁用!",
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
#region
shelfInfo = await DbHelp.db.Queryable<ShelfInfo>()
.Where(t => t.Id == request.ShelfId)
.Where(t => t.IsEnable)
.FirstAsync();
#region
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 = $"呼叫失败:货架{shelfInfo.ShelfCode}不存在或已被禁用!",
Code = 301,
Message = $"送回失败:货架{request.ShelfCode}不存在或已被禁用!",
Data = null,
};
}
@ -225,19 +260,53 @@ namespace WCS.WebApi.Controllers
return new ResponseCommon()
{
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,
};
}
#endregion
#region
//TO DO 调用AGV接口开始呼叫 呼叫成功更新运输状态和目标库位
#region
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()
{
Code = 200,
Message = $"呼叫成功!",
Message = $"送回任务发送成功!",
Data = null,
};
#endregion