库存盘点页面 库存查询修改数量

This commit is contained in:
hehaibing-1996
2025-01-24 07:59:10 +08:00
parent 2085c6e216
commit deef6d4cb3
10 changed files with 1720 additions and 181 deletions

18
PDA/PDA/package-lock.json generated Normal file
View File

@ -0,0 +1,18 @@
{
"name": "PDA",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"@dcloudio/uni-ui": "^1.5.7"
}
},
"node_modules/@dcloudio/uni-ui": {
"version": "1.5.7",
"resolved": "https://registry.npmjs.org/@dcloudio/uni-ui/-/uni-ui-1.5.7.tgz",
"integrity": "sha512-DugxSIrQrze1FLdUOj9a+JEQ0bHGjnJTcGUK1mN/MivKg7nuKJBRWk5Ipa9sUdoBznX6ndz5h2e7Uao6x1CdCw==",
"license": "Apache-2.0"
}
}
}

5
PDA/PDA/package.json Normal file
View File

@ -0,0 +1,5 @@
{
"dependencies": {
"@dcloudio/uni-ui": "^1.5.7"
}
}

View File

@ -40,6 +40,13 @@
{
"navigationBarTitleText" : "智慧物流系统-绑定查询"
}
},
{
"path" : "pages/stockTaking/stockTaking",
"style" :
{
"navigationBarTitleText" : "智慧物流系统-库存盘点"
}
}
],
"globalStyle": {

View File

@ -47,10 +47,12 @@
</navigator>
</view>
<view class="uni-flex uni-column" style="flex: 5;">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/stockTaking.png" />
</view>
<view class="function-text">库存盘点</view>
<navigator url="../stockTaking/stockTaking" hover-class="navigator-hover">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/stockTaking.png" />
</view>
<view class="function-text">库存盘点</view>
</navigator>
</view>
<view class="uni-flex uni-column" style="flex: 5;">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">

View File

@ -1,6 +1,29 @@
<template>
<view class="bg-image">
<bindSelectMat ref="proup" @close="handlePopupClose" @selected="bindSelectedMat" />
<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="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">保存</button>
</view>
</view>
</uni-popup>
<view class="diy-flex-row">
<view style="flex: 3">
@ -46,11 +69,13 @@
<view class="diy-flex-column" style="margin-top: 5rpx;">
<scroll-view class="scroll-view" scroll-y="true">
<view v-for="(item, index) in cardData" :key="index">
<view v-for="(item, index) in cardData" :key="index" @longpress="longpress(item)">
<Card :item="item" :currentIndex="index" :cardData="cardData" />
</view>
</scroll-view>
</view>
</view>
</template>
@ -76,29 +101,154 @@
import {
getServerIPAndPort
} from '@/config.js';
import Card from '@/components/Card.vue';
import {
ref,
nextTick
} from 'vue';
import uniPopup from '@/node_modules/@dcloudio/uni-ui/lib/uni-popup/uni-popup';
export default {
components: {
bindSelectMat,
uniPopup,
Card
},
setup() {
// 不能修改的信息
const fixedInfo = {
infoId: 0,
matCode: '示例名称',
matName: '这是一段示例描述',
matSpec: '',
matQty: 0,
};
const popup = ref(null);
const inputValue = ref('');
const showPopup = (info) => {
fixedInfo.infoId = info.id;
fixedInfo.matCode = info.matCode;
fixedInfo.matName = info.matName;
fixedInfo.matSpec = info.matSpec;
fixedInfo.matQty = info.matQty;
inputValue.value = info.matQty;
popup.value.open();
// nextTick(() => {
// inputRef.value.focus();
// });
};
const hidePopup = () => {
popup.value.close();
};
const saveData = () => {
if (inputValue.value == fixedInfo.matQty) {
uni.showToast({
title: '本次修改未修改数量',
icon: 'none',
duration: 1500
});
hidePopup();
return;
}
if (inputValue.value < 0) {
uni.showToast({
title: '您所输入的数量应该大于0',
icon: 'none',
duration: 1500
});
return;
}
if (inputValue.value == 0) {
uni.showToast({
title: '数量为0请使用删除功能',
icon: 'none',
duration: 1500
});
return;
}
var serverIPAndPort = getServerIPAndPort();
//调用接口进行数量的修改
uni.request({
url: 'http://' + serverIPAndPort +'/matDetailCurrenInfo/updateMatDetailCurrentInfoById', // 请求的接口地址
method: 'POST', // 设置请求方式为 POST
data: {
"matQty": inputValue.value,
"matDetailCurrentInfoId": fixedInfo.infoId,
"userName": getConfig('userName', 'admin'),
"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: 1200
});
hidePopup();
} else {
uni.showToast({
title: '修改失败:' + res.data.message,
icon: 'none',
duration: 2500
});
}
} else {
uni.showToast({
title: '服务器返回错误状态码' + res.statusCode,
icon: 'none',
duration: 2500
});
}
},
fail: (err) => {
// 请求失败的回调函数
uni.showToast({
title: '请求失败' + err,
icon: 'none',
duration: 2500
});
this.clear();
},
complete: (event) => {
// 请求完成的回调函数(无论成功或失败都会调用)
}
});
};
return {
fixedInfo,
popup,
inputValue,
showPopup,
hidePopup,
saveData
};
},
data() {
return {
isNeedScanLocationCode: true,
isNeedCallShelfCode: true,
matBaseInfoId: null,
matCode: '',
locationId: null,
locationCode: '',
matCode: '',
matName: '',
matSpec: '',
matQty: 100, //默认数量值
userName: '', //当前登录的用户名
recordCount: 0,
@ -141,81 +291,9 @@
this.shelfCode = originalString;
//调用接口获取当前工位信息 当前工位是否有货架
var serverIPAndPort = getServerIPAndPort();
// uni.request({
// url: 'http://' + serverIPAndPort + '/pdaMatBind/getShelfInfoByLocationCode', // 请求的接口地址
// method: 'POST', // 设置请求方式为 POST
// data: {
// "locationCode": this.locationCode,
// "userName": this.userName,
// "deviceType": "PDA"
// },
// header: {
// 'Content-Type': 'application/json', // 如果需要以JSON格式发送数据
// },
// success: (res) => {
// // 请求成功的回调函数
// if (res.statusCode === 200) {
// //接口返回数据为200 表示获取成功!
// if (res.data.code == 200) {
// this.locationId = res.data.data.locationId;
// this.shelfId = res.data.data.shelfId;
// this.shelfCode = res.data.data.shelfCode;
// if (this.shelfId == null) {
// this.shelfCode = '(工位无货架,请呼叫!)';
// this.isNeedScanLocationCode = false;
// this.isNeedCallShelfCode = true;
// this.placeholderText = '请呼叫货架';
// } else {
// this.isNeedScanLocationCode = false;
// this.isNeedCallShelfCode = false;
// this.placeholderText = '输入编码或名称';
// }
// uni.showToast({
// title: '获取成功!',
// icon: 'none',
// duration: 1500
// });
// } 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);
// }
// });
uni.request({
url: 'http://' + serverIPAndPort +
'/matDetailCurrenInfo/getMatDetailCurrentInfos', // 请求的接口地址
'/matDetailCurrenInfo/getMatDetailCurrentInfos', // 请求的接口地址
method: 'POST', // 设置请求方式为 POST
data: {
"shelfCode": this.shelfCode,
@ -288,14 +366,6 @@
},
bindSelectedMat: function(item) {
console.log('用户选择了项目:', item);
this.matCode = item.matCode;
this.matName = item.matName;
this.matSpec = item.matSpec;
this.matBaseInfoId = item.id;
},
queryMatList: function() {
if (this.shelfCode == null || this.shelfCode == '') {
uni.showToast({
@ -310,7 +380,7 @@
var serverIPAndPort = getServerIPAndPort();
uni.request({
url: 'http://' + serverIPAndPort +
'/matDetailCurrenInfo/getMatDetailCurrentInfos', // 请求的接口地址
'/matDetailCurrenInfo/getMatDetailCurrentInfos', // 请求的接口地址
method: 'POST', // 设置请求方式为 POST
data: {
"shelfCode": this.shelfCode,
@ -385,22 +455,22 @@
//清空当前界面所有内容
clear: function() {
this.locationId = null;
this.locationCode = '';
this.shelfId = null;
this.shelfCode = '';
this.isNeedCallShelfCode = true;
this.isNeedScanLocationCode = true;
this.placeholderText = '请先扫描货架码';
this.cardData = null;
this.recordCount = 0;
},
clearMatInfo: function() {
this.matCode = '';
this.matName = '';
this.matSpec = '';
},
handlePopupClose() {
// 弹出层关闭后的处理逻辑
console.log('弹出层已关闭');
//长按
longpress(item) {
// uni.showToast({
// title: '您长按了' + item.matCode,
// icon: 'none',
// duration: 1500
// });
this.showPopup(item);
//this.$refs.popup.open();
},
}
}
@ -463,4 +533,46 @@
.scroll-view {
height: 75vh;
}
.popup-content {
padding: 20px;
background-color: rgba(0, 0, 0, 1);
background-color: white;
z-index: 2;
border-radius: 20rpx;
}
.input-item {
margin-bottom: 5rpx;
display: flex;
align-items: center;
/* 让内部元素垂直居中 */
}
.input-item label {
display: inline-block;
}
.input-item input {
display: inline-block;
background: wheat;
width: 280rpx;
}
.button-group {
display: flex;
justify-content: space-between;
margin-top: 20rpx;
}
.button-group button {
margin-top: 20rpx;
padding: 10rpx 10rpx;
border: none;
border-radius: 5px;
background-color: #007AFF;
color: #fff;
cursor: pointer;
}
</style>

View File

@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

File diff suppressed because it is too large Load Diff

View File

@ -154,6 +154,8 @@ namespace WCS.BLL.Services.Service
}
}
public async Task<ResponseCommon<object>> deleteMatDetailCurrentInfo(DeleteInfosRequest request)
{
//先查询出具体的Id
@ -182,5 +184,7 @@ namespace WCS.BLL.Services.Service
return response;
}
}
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.MatDetailCurrentInfo
{
public class UpdateMatDetailCurrentInfoByIdRequest : RequestBase
{
public int MatDetailCurrentInfoId { get; set; }
public int MatQty { get; set; }
}
}

View File

@ -6,6 +6,7 @@ using WCS.Model.ApiModel.StoreInfo;
using WCS.BLL.DbModels;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.MatDetailCurrentInfo;
using WCS.DAL.DbModels;
namespace WCS.WebApi.Controllers
{
@ -36,6 +37,22 @@ namespace WCS.WebApi.Controllers
return await _matDetailCurrentInfoService.updateMatDetailCurrentInfo(request);
}
[HttpPost("updateMatDetailCurrentInfoById")]
public async Task<ResponseCommon<object>> updateMatDetailCurrentInfoById(UpdateMatDetailCurrentInfoByIdRequest request)
{
var transRequest = new AddLocaionInfoRequest<MatDetailCurrentInfo>()
{
UserName = request.UserName,
DeviceType = request.DeviceType,
LocationInfo = new MatDetailCurrentInfo()
{
Id = request.MatDetailCurrentInfoId,
MatQty = request.MatQty,
}
};
return await _matDetailCurrentInfoService.updateMatDetailCurrentInfo(transRequest);
}
[HttpPost("deleteMatDetailCurrentInfo")]
public async Task<ResponseCommon<object>> deleteMatDetailCurrentInfo(DeleteInfosRequest request)
{