物料绑定 前端调用接口等逻辑

This commit is contained in:
hehaibing-1996
2025-01-16 18:30:56 +08:00
parent 0ec750119d
commit 11f14f6d35
9 changed files with 906 additions and 94 deletions

View File

@ -10,7 +10,7 @@ export function getConfig(key, defaultValue) {
}
export function getServerIPAndPort() {
var serverIP = getConfig('serverIP', '127.0.0.1');
var serverIP = getConfig('serverIP', '192.168.139.36');
var serverPort = getConfig('serverPort', '8888');
return serverIP + ':' + serverPort;
}

View File

@ -26,6 +26,13 @@
{
"navigationBarTitleText" : "智慧物流系统-物料绑定"
}
},
{
"path" : "pages/bindSelectMat/bindSelectMat",
"style" :
{
"navigationBarTitleText" : ""
}
}
],
"globalStyle": {

View File

@ -1,5 +1,7 @@
<template>
<view class="bg-image">
<bindSelectMat ref="proup" @close="handlePopupClose" @selected="bindSelectedMat" />
<view class="diy-flex-row">
<view style="flex: 3">
<!-- 占位 -->
@ -11,15 +13,15 @@
</view>
<view class="uni-input-wrapper" style="flex: 60;">
<input id="inputMatCode" class="uni-input" style="font-size: 50rpx; padding: 10rpx;" placeholder="请先扫描工位码"
v-model="matCode"></input>
<input id="inputMatCode" class="uni-input" style="font-size: 50rpx; padding: 10rpx;"
:placeholder="placeholderText" v-model="matCodeCondition" @blur="queryMatList"></input>
</view>
<view style="flex: 3;">
</view>
<view style="flex: 30;">
<button>查询</button>
<button @click="queryMatList">查询</button>
</view>
</view>
</view>
@ -34,7 +36,7 @@
<view style="flex: 35;">工位编码</view>
<view style="flex: 50;">{{locationCode}}</view>
<view style="flex: 50;overflow:hidden;">{{locationCode}}</view>
<view style="flex: 40;">
<button class="mini-btn" type="warn" size="mini">呼叫货架</button>
@ -47,7 +49,7 @@
<view style="flex: 35;">货架编码</view>
<view style="flex: 90;">{{shelfCode}}</view>
<view style="flex: 90;overflow:hidden;">{{shelfCode}}</view>
</view>
@ -57,7 +59,7 @@
<view style="flex: 35;">物料编码</view>
<view style="flex: 90;">{{matCode}}</view>
<view style="flex: 90;overflow:hidden;">{{matCode}}</view>
</view>
@ -67,7 +69,7 @@
<view style="flex: 35;">物料名称</view>
<view style="flex: 90;">{{matName}}</view>
<view style="flex: 90;overflow:hidden;">{{matName}}</view>
</view>
@ -77,7 +79,7 @@
<view style="flex: 35;">物料规格</view>
<view style="flex: 90;">{{matSpec}}</view>
<view style="flex: 90;overflow:hidden;">{{matSpec}}</view>
</view>
@ -98,28 +100,292 @@
</view>
<view style="flex: 1;">
<view style="flex: 40;text-align: center;">
<button style="margin: 50rpx;" size="mini">送货架</button>
</view>
</view>
</view>
</view>
</template>
<script>
import bindSelectMat from '@/pages/bindSelectMat/bindSelectMat.vue';
import {
recive
} from '../../src/libs/Broadcast.js';
import {
unregisterReceiver
} from '../../src/libs/Broadcast.js';
import {
getConfig
} from '@/config.js';
import {
saveConfig
} from '@/config.js';
import {
getServerIPAndPort
} from '@/config.js';
export default {
components: {
bindSelectMat
},
data() {
return {
isNeedScanLocationCode: true,
isNeedCallShelfCode: true,
placeholderText: '请先扫描工位码',
matCodeCondition: '', //物料编码搜索条件
matBaseInfoId: null,
matCode: '',
locationId: null,
locationCode: '',
shelfId: null,
shelfCode: '',
matCode: '',
matName: '',
matSpec: '',
matQty: 100
matQty: 100, //默认数量值
userName: '', //当前登录的用户名
}
},
onShow: function() {
this.userName = getConfig('userName', 'admin');
const self = this; // 保存this的引用
recive(function(res) {
console.log("Success:" + res.data);
self.analysisScanCode(res.data);
}, function(err) {
console.log("Error:", JSON.stringify(err)); // 正确打印错误信息
});
},
methods: {
analysisScanCode: function(encodedString) {
// 去除末尾的逗号和"..."(如果有的话)
encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
// 分割字符串并转换为字节数组
let byteStrings = encodedString.split(',');
let byteArray = [];
for (let byteString of byteStrings) {
byteArray.push(parseInt(byteString, 10)); // 将字符串转换为十进制整数
}
// 将字节数组转换为UTF-8字符串
// 注意这里使用了一个简单的循环来构建字符串因为String.fromCharCode.apply可能在大数据上性能不佳
let originalString = '';
for (let i = 0; i < byteArray.length; i++) {
// 对于每个字节使用fromCharCode转换为对应的字符
// 注意这里假设你的字节数组已经是正确的UTF-8编码并且不需要额外的处理来组合多字节字符
originalString += String.fromCharCode(byteArray[i]);
}
this.locationCode = 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);
}
});
},
bindSelectedMat: function(item) {
console.log('用户选择了项目:', item);
this.matCode = item.matCode;
this.matName = item.matName;
this.matSpec = item.matSpec;
this.matBaseInfoId = item.id;
},
//物料绑定
bind: function() {
console.log('123');
document.getElementById('inputMatCode').scrollIntoView(true);
console.log('111');
this.userName = getConfig('userName', '');
var serverIPAndPort = getServerIPAndPort();
uni.request({
url: 'http://' + serverIPAndPort + '/pdaMatBind/bindMatDetail', // 请求的接口地址
method: 'POST', // 设置请求方式为 POST
data: {
"locationId": this.locationId,
"locationCode": this.locationCode,
"shelfId": this.shelfId,
"shelfCode": this.shelfCode,
"matBaseInfoId": this.matBaseInfoId,
"matCode": this.matCode,
"qty": this.matQty,
"userName": this.userName,
"deviceType": "PDA"
},
header: {
'Content-Type': 'application/json', // 如果需要以JSON格式发送数据
},
success: (res) => {
// 请求成功的回调函数
if (res.statusCode === 200) {
//接口返回数据为200 表示获取成功!
if (res.data.code == 200) {
this.clearMatInfo();
uni.showToast({
title: '绑定成功!',
icon: 'none',
duration: 1500
});
} else {
this.visible = false;
uni.showToast({
title: '绑定失败:' + res.data.message,
icon: 'none',
duration: 1500
});
}
} else {
uni.showToast({
title: '绑定失败:服务器返回错误状态码' + res.statusCode,
icon: 'none',
duration: 1500
});
}
},
fail: (err) => {
// 请求失败的回调函数
uni.showToast({
title: '绑定失败:请求失败' + err,
icon: 'none',
duration: 1500
});
},
complete: (event) => {
// 请求完成的回调函数(无论成功或失败都会调用)
console.log('请求完成', event);
}
});
},
queryMatList: function() {
if (this.isNeedScanLocationCode) {
uni.showToast({
title: '请先扫描工位码!',
icon: 'none',
duration: 1000
});
return;
}
if (this.isNeedCallShelfCode) {
uni.showToast({
title: '请先呼叫货架!',
icon: 'none',
duration: 1000
});
return;
}
if (this.matCodeCondition == null || this.matCodeCondition == '') {
uni.showToast({
title: '输入物料编码或物料名称后进行查询!',
icon: 'none',
duration: 1000
});
return;
} else {
this.clearMatInfo();
saveConfig('matCodeCondition', this.matCodeCondition);
this.$refs.proup.show();
}
},
//清空当前界面所有内容
clear: function() {
this.locationId = null;
this.locationCode = '';
this.shelfId = null;
this.shelfCode = '';
this.isNeedCallShelfCode = true;
this.isNeedScanLocationCode = true;
this.placeholderText = '请先扫描工位码';
},
clearMatInfo: function() {
this.matCode = '';
this.matName = '';
this.matSpec = '';
},
handlePopupClose() {
// 弹出层关闭后的处理逻辑
console.log('弹出层已关闭');
},
}
}

View File

@ -0,0 +1,153 @@
<template>
<view class="popup-container" v-if="visible">
<view class="popup-content">
<scroll-view class="scroll-view" scroll-y="true">
<!-- <uni-list-item v-for="(item, index) in matBaseInfoList" :key="index" :title="item.matCode"
:note="item.matName" :rightText="item.matSpec" @click="onItemClick(item)"></uni-list-item>
-->
<view v-for="(item, index) in matBaseInfoList" :key="index" class="list-item" @click="onItemClick(item)">
{{ item.matCode }} - {{ item.matName }} - {{ item.matSpec }}
</view>
</scroll-view>
<button @click="handleClose">关闭</button>
</view>
</view>
</template>
<script>
import {
getConfig
} from '@/config.js';
import {
saveConfig
} from '@/config.js';
import {
getServerIPAndPort
} from '@/config.js';
export default {
data() {
return {
visible: false,
matCodeCondition: '',
userName: '',
matBaseInfoList: [], // 用于存储物料数据的数组
};
},
methods: {
show() {
this.visible = true;
this.matCodeCondition = getConfig('matCodeCondition', '');
this.userName = getConfig('userName', '');
var serverIPAndPort = getServerIPAndPort();
//获取列表
uni.request({
url: 'http://' + serverIPAndPort + '/matBaseInfo/getMatBaseInfo', // 请求的接口地址
method: 'POST', // 设置请求方式为 POST
data: {
"MatCode": this.matCodeCondition,
"MatName": "",
"MatSpec": "",
"IsEnable": null,
"PageNumber": 1,
"PageSize": 20,
"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.lists != null && res.data.data.lists.length > 0) {
this.matBaseInfoList = res.data.data.lists;
} else {
this.visible = false;
uni.showToast({
title: '根据查询条件未查询到物料!',
icon: 'none',
duration: 1500
});
}
} else {
this.visible = false;
uni.showToast({
title: '查询物料失败:' + res.data.message,
icon: 'none',
duration: 1500
});
}
} else {
uni.showToast({
title: '查询物料失败:服务器返回错误状态码' + res.statusCode,
icon: 'none',
duration: 1500
});
}
},
fail: (err) => {
// 请求失败的回调函数
uni.showToast({
title: '查询物料失败:请求失败' + err,
icon: 'none',
duration: 1500
});
},
complete: (event) => {
// 请求完成的回调函数(无论成功或失败都会调用)
console.log('请求完成', event);
}
});
},
handleClose() {
this.visible = false;
this.$emit('close');
},
onItemClick(item) {
this.visible = false;
this.$emit('selected',item);
}
}
};
</script>
<style scoped>
.list-item {
padding: 10px;
border-bottom: 1px solid #ccc;
}
.popup-container {
width: 100%;
height: 100%;
z-index: 1;
}
.popup-content {
border-radius: 10rpx;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
/* 使用transform来居中 */
width: 650rpx;
max-height: 750rpx;
background-color: rgba(0, 0, 0, 1);
background-color: white;
z-index: 2;
}
.scroll-view {
max-width: 700rpx;
/* 设置滚动区域的高度 */
}
</style>

View File

@ -87,29 +87,6 @@
unregisterReceiver()
},
methods: {
getEquipmentInfo(encodedString) {
// 去除末尾的逗号和"..."(如果有的话)
encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
console.log("1:" + encodedString);
// 分割字符串并转换为字节数组
let byteStrings = encodedString.split(',');
let byteArray = [];
for (let byteString of byteStrings) {
byteArray.push(parseInt(byteString, 10)); // 将字符串转换为十进制整数
}
console.log("2:" + encodedString);
// 将字节数组转换为UTF-8字符串
// 注意这里使用了一个简单的循环来构建字符串因为String.fromCharCode.apply可能在大数据上性能不佳
let originalString = '';
for (let i = 0; i < byteArray.length; i++) {
// 对于每个字节使用fromCharCode转换为对应的字符
// 注意这里假设你的字节数组已经是正确的UTF-8编码并且不需要额外的处理来组合多字节字符
originalString += String.fromCharCode(byteArray[i]);
}
console.log("3:" + originalString);
this.title = originalString;
console.log("4:" + this.title);
},
login() {
var serverIPAndPort = getServerIPAndPort();
console.log('http://' + serverIPAndPort + '/user/userLogin');

View File

@ -2,7 +2,7 @@
;(function(){
let u=void 0,isReady=false,onReadyCallbacks=[],isServiceReady=false,onServiceReadyCallbacks=[];
const __uniConfig = {"pages":[],"globalStyle":{"backgroundColor":"#F8F8F8","navigationBar":{"backgroundColor":"#F8F8F8","titleText":"智慧物流系统-移动端","type":"default","titleColor":"#000000"},"isNVue":false},"nvue":{"compiler":"uni-app","styleCompiler":"uni-app","flex-direction":"column"},"renderer":"auto","appname":"PDA","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":true},"compilerVersion":"4.36","entryPagePath":"pages/index/index","entryPageQuery":"","realEntryPagePath":"","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000},"locales":{},"darkmode":false,"themeConfig":{}};
const __uniRoutes = [{"path":"pages/index/index","meta":{"isQuit":true,"isEntry":true,"navigationBar":{"titleText":"智慧物流系统-登录","type":"default"},"isNVue":false}},{"path":"pages/config/config","meta":{"navigationBar":{"titleText":"智慧物流系统-用户配置","type":"default"},"isNVue":false}},{"path":"pages/main/main","meta":{"navigationBar":{"titleText":"智慧物流系统-主页","type":"default"},"isNVue":false}},{"path":"pages/bind/bind","meta":{"navigationBar":{"titleText":"智慧物流系统-物料绑定","type":"default"},"isNVue":false}}].map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute));
const __uniRoutes = [{"path":"pages/index/index","meta":{"isQuit":true,"isEntry":true,"navigationBar":{"titleText":"智慧物流系统-登录","type":"default"},"isNVue":false}},{"path":"pages/config/config","meta":{"navigationBar":{"titleText":"智慧物流系统-用户配置","type":"default"},"isNVue":false}},{"path":"pages/main/main","meta":{"navigationBar":{"titleText":"智慧物流系统-主页","type":"default"},"isNVue":false}},{"path":"pages/bind/bind","meta":{"navigationBar":{"titleText":"智慧物流系统-物料绑定","type":"default"},"isNVue":false}},{"path":"pages/bindSelectMat/bindSelectMat","meta":{"navigationBar":{"titleText":"","type":"default"},"isNVue":false}}].map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute));
__uniConfig.styles=[];//styles
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});

View File

@ -40,6 +40,85 @@ if (uni.restoreGlobal) {
}
var main = null;
var receiver = null;
function recive(success, fail) {
main = plus.android.runtimeMainActivity();
receiver = plus.android.implements("io.dcloud.feature.internal.reflect.BroadcastReceiver", {
onReceive: function(context, intent) {
plus.android.importClass(intent);
var action = intent.getAction();
var data;
switch (action) {
case "com.android.server.scannerservice.broadcast":
data = intent.getExtra("scannerdata");
break;
case "android.intent.action.SCANRESULT":
data = intent.getExtra("value");
break;
case "android.intent.ACTION_DECODE_DATA":
data = intent.getExtra("barcode_string");
break;
case "com.android.provider.sdlmessage":
data = intent.getExtra("msg");
break;
case "com.neusoft.action.scanner.read":
data = intent.getStringExtra("scanner_value");
if (data == null) {
data = intent.getStringExtra("Scanner_value");
}
break;
case "nlscan.action.SCANNER_RESULT":
data = intent.getExtra("SCAN_BARCODE1");
break;
case "com.barcode.sendBroadcast":
data = intent.getExtra("BARCODE");
break;
case "scan.rcv.message":
let barocode = intent.getByteArrayExtra("barocode");
let barocodelen = intent.getIntExtra("length", 0);
data = new String(barocode, 0, barocodelen);
break;
case "xlyk.wz":
data = intent.getExtra("qrcode");
break;
case "com.android.scanner.broadcast":
data = intent.getExtra("scandata");
break;
case "com.honeywell.scan.broadcast":
data = intent.getExtra("data");
break;
}
if (data) {
success({
type: "barcode",
data: data.replace(/\n/, "").replace(/\t/, "").trim()
//处理结束符和换行符为空
});
} else {
fail({
type: "barcode",
data: "未识别到扫码数据"
//处理结束符和换行符为空
});
}
}
});
var IntentFilter = plus.android.importClass("android.content.IntentFilter");
plus.android.importClass("android.content.Intent");
var filter = new IntentFilter();
filter.addAction("com.android.provider.sdlMessage");
filter.addAction("com.neusoft.action.scanner.read");
filter.addAction("nlscan.action.SCANNER_RESULT");
filter.addAction("scan.rcv.message");
filter.addAction("com.android.server.scannerservice.broadcast");
filter.addAction("android.intent.action.SCANRESULT");
filter.addAction("android.intent.ACTION_DECODE_DATA");
filter.addAction("com.barcode.sendBroadcast");
filter.addAction("xlyk.wz");
filter.addAction("com.android.scanner.broadcast");
filter.addAction("com.android.scanner.broadcast");
filter.addAction("com.honeywell.scan.broadcast");
main.registerReceiver(receiver, filter);
}
function unregisterReceiver() {
formatAppLog("log", "at src/libs/Broadcast.js:110", "取消监听广播");
main.unregisterReceiver(receiver);
@ -51,7 +130,7 @@ if (uni.restoreGlobal) {
return uni.getStorageSync(key) || defaultValue;
}
function getServerIPAndPort() {
var serverIP = getConfig("serverIP", "127.0.0.1");
var serverIP = getConfig("serverIP", "192.168.139.36");
var serverPort = getConfig("serverPort", "8888");
return serverIP + ":" + serverPort;
}
@ -63,7 +142,7 @@ if (uni.restoreGlobal) {
}
return target;
};
const _sfc_main$4 = {
const _sfc_main$5 = {
data() {
return {
title: "登录",
@ -84,26 +163,9 @@ if (uni.restoreGlobal) {
unregisterReceiver();
},
methods: {
getEquipmentInfo(encodedString) {
encodedString = encodedString.replace(/,\s*\.\.\.$/, "");
formatAppLog("log", "at pages/index/index.vue:93", "1:" + encodedString);
let byteStrings = encodedString.split(",");
let byteArray = [];
for (let byteString of byteStrings) {
byteArray.push(parseInt(byteString, 10));
}
formatAppLog("log", "at pages/index/index.vue:100", "2:" + encodedString);
let originalString = "";
for (let i = 0; i < byteArray.length; i++) {
originalString += String.fromCharCode(byteArray[i]);
}
formatAppLog("log", "at pages/index/index.vue:109", "3:" + originalString);
this.title = originalString;
formatAppLog("log", "at pages/index/index.vue:111", "4:" + this.title);
},
login() {
var serverIPAndPort = getServerIPAndPort();
formatAppLog("log", "at pages/index/index.vue:115", "http://" + serverIPAndPort + "/user/userLogin");
formatAppLog("log", "at pages/index/index.vue:92", "http://" + serverIPAndPort + "/user/userLogin");
uni.request({
url: "http://" + serverIPAndPort + "/user/userLogin",
// 请求的接口地址
@ -150,13 +212,13 @@ if (uni.restoreGlobal) {
});
},
complete: (event) => {
formatAppLog("log", "at pages/index/index.vue:167", "请求完成", event);
formatAppLog("log", "at pages/index/index.vue:144", "请求完成", event);
}
});
}
}
};
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("view", { class: "bg-image" }, [
vue.createElementVNode("navigator", {
url: "../config/config",
@ -242,8 +304,8 @@ if (uni.restoreGlobal) {
])
]);
}
const PagesIndexIndex = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$3], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/index/index.vue"]]);
const _sfc_main$3 = {
const PagesIndexIndex = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$4], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/index/index.vue"]]);
const _sfc_main$4 = {
data() {
return {
serverIP: "",
@ -265,7 +327,7 @@ if (uni.restoreGlobal) {
}
}
};
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("view", { class: "container" }, [
vue.createElementVNode("view", null, [
vue.createElementVNode("label", null, "服务器IP:"),
@ -302,7 +364,7 @@ if (uni.restoreGlobal) {
}, "保存配置")
]);
}
const PagesConfigConfig = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/config/config.vue"]]);
const PagesConfigConfig = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$3], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/config/config.vue"]]);
const _imports_0$1 = "/static/logOut.png";
const _imports_1 = "/static/bind.png";
const _imports_2 = "/static/bindQuery.png";
@ -310,13 +372,13 @@ if (uni.restoreGlobal) {
const _imports_4 = "/static/callOut.png";
const _imports_5 = "/static/stockTaking.png";
const _imports_6 = "/static/task.png";
const _sfc_main$2 = {
const _sfc_main$3 = {
data() {
return {};
},
methods: {}
};
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("view", { class: "bg-image" }, [
vue.createElementVNode("view", null, [
vue.createElementVNode("navigator", {
@ -442,30 +504,367 @@ if (uni.restoreGlobal) {
])
]);
}
const PagesMainMain = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/main/main.vue"]]);
const _imports_0 = "/static/scan.png";
const _sfc_main$1 = {
const PagesMainMain = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/main/main.vue"]]);
const _sfc_main$2 = {
data() {
return {
visible: false,
matCodeCondition: "",
userName: "",
matBaseInfoList: []
// 用于存储物料数据的数组
};
},
methods: {
show() {
this.visible = true;
this.matCodeCondition = getConfig("matCodeCondition", "");
this.userName = getConfig("userName", "");
var serverIPAndPort = getServerIPAndPort();
uni.request({
url: "http://" + serverIPAndPort + "/matBaseInfo/getMatBaseInfo",
// 请求的接口地址
method: "POST",
// 设置请求方式为 POST
data: {
"MatCode": this.matCodeCondition,
"MatName": "",
"MatSpec": "",
"IsEnable": null,
"PageNumber": 1,
"PageSize": 20,
"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.lists != null && res.data.data.lists.length > 0) {
this.matBaseInfoList = res.data.data.lists;
} else {
this.visible = false;
uni.showToast({
title: "根据查询条件未查询到物料!",
icon: "none",
duration: 1500
});
}
} else {
this.visible = false;
uni.showToast({
title: "查询物料失败:" + res.data.message,
icon: "none",
duration: 1500
});
}
} else {
uni.showToast({
title: "查询物料失败:服务器返回错误状态码" + res.statusCode,
icon: "none",
duration: 1500
});
}
},
fail: (err) => {
uni.showToast({
title: "查询物料失败:请求失败" + err,
icon: "none",
duration: 1500
});
},
complete: (event) => {
formatAppLog("log", "at pages/bindSelectMat/bindSelectMat.vue:106", "请求完成", event);
}
});
},
handleClose() {
this.visible = false;
this.$emit("close");
},
onItemClick(item) {
this.visible = false;
this.$emit("selected", item);
}
}
};
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
return $data.visible ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "popup-container"
}, [
vue.createElementVNode("view", { class: "popup-content" }, [
vue.createElementVNode("scroll-view", {
class: "scroll-view",
"scroll-y": "true"
}, [
vue.createCommentVNode(' <uni-list-item v-for="(item, index) in matBaseInfoList" :key="index" :title="item.matCode"\r\n :note="item.matName" :rightText="item.matSpec" @click="onItemClick(item)"></uni-list-item>\r\n '),
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($data.matBaseInfoList, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
key: index,
class: "list-item",
onClick: ($event) => $options.onItemClick(item)
}, vue.toDisplayString(item.matCode) + " - " + vue.toDisplayString(item.matName) + " - " + vue.toDisplayString(item.matSpec), 9, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
]),
vue.createElementVNode("button", {
onClick: _cache[0] || (_cache[0] = (...args) => $options.handleClose && $options.handleClose(...args))
}, "关闭")
])
])) : vue.createCommentVNode("v-if", true);
}
const PagesBindSelectMatBindSelectMat = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__scopeId", "data-v-68e7b952"], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/bindSelectMat/bindSelectMat.vue"]]);
const _imports_0 = "/static/scan.png";
const _sfc_main$1 = {
components: {
bindSelectMat: PagesBindSelectMatBindSelectMat
},
data() {
return {
isNeedScanLocationCode: true,
isNeedCallShelfCode: true,
placeholderText: "请先扫描工位码",
matCodeCondition: "",
//物料编码搜索条件
matBaseInfoId: null,
matCode: "",
locationId: null,
locationCode: "",
shelfId: null,
shelfCode: "",
matCode: "",
matName: "",
matSpec: "",
matQty: 100
matQty: 100,
//默认数量值
userName: ""
//当前登录的用户名
};
},
onShow: function() {
this.userName = getConfig("userName", "admin");
const self = this;
recive(function(res) {
formatAppLog("log", "at pages/bind/bind.vue:166", "Success:" + res.data);
self.analysisScanCode(res.data);
}, function(err) {
formatAppLog("log", "at pages/bind/bind.vue:169", "Error:", JSON.stringify(err));
});
},
methods: {
analysisScanCode: function(encodedString) {
encodedString = encodedString.replace(/,\s*\.\.\.$/, "");
let byteStrings = encodedString.split(",");
let byteArray = [];
for (let byteString of byteStrings) {
byteArray.push(parseInt(byteString, 10));
}
let originalString = "";
for (let i = 0; i < byteArray.length; i++) {
originalString += String.fromCharCode(byteArray[i]);
}
this.locationCode = 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) {
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: 3e3
});
this.clear();
}
},
fail: (err) => {
uni.showToast({
title: "请求失败" + err,
icon: "none",
duration: 3e3
});
this.clear();
},
complete: (event) => {
formatAppLog("log", "at pages/bind/bind.vue:260", "请求完成", event);
}
});
},
bindSelectedMat: function(item) {
formatAppLog("log", "at pages/bind/bind.vue:267", "用户选择了项目:", item);
this.matCode = item.matCode;
this.matName = item.matName;
this.matSpec = item.matSpec;
this.matBaseInfoId = item.id;
},
//物料绑定
bind: function() {
formatAppLog("log", "at pages/bind/bind.vue:120", "123");
document.getElementById("inputMatCode").scrollIntoView(true);
formatAppLog("log", "at pages/bind/bind.vue:122", "111");
this.userName = getConfig("userName", "");
var serverIPAndPort = getServerIPAndPort();
uni.request({
url: "http://" + serverIPAndPort + "/pdaMatBind/bindMatDetail",
// 请求的接口地址
method: "POST",
// 设置请求方式为 POST
data: {
"locationId": this.locationId,
"locationCode": this.locationCode,
"shelfId": this.shelfId,
"shelfCode": this.shelfCode,
"matBaseInfoId": this.matBaseInfoId,
"matCode": this.matCode,
"qty": this.matQty,
"userName": this.userName,
"deviceType": "PDA"
},
header: {
"Content-Type": "application/json"
// 如果需要以JSON格式发送数据
},
success: (res) => {
if (res.statusCode === 200) {
if (res.data.code == 200) {
this.clearMatInfo();
uni.showToast({
title: "绑定成功!",
icon: "none",
duration: 1500
});
} else {
this.visible = false;
uni.showToast({
title: "绑定失败:" + res.data.message,
icon: "none",
duration: 1500
});
}
} else {
uni.showToast({
title: "绑定失败:服务器返回错误状态码" + res.statusCode,
icon: "none",
duration: 1500
});
}
},
fail: (err) => {
uni.showToast({
title: "绑定失败:请求失败" + err,
icon: "none",
duration: 1500
});
},
complete: (event) => {
formatAppLog("log", "at pages/bind/bind.vue:334", "请求完成", event);
}
});
},
queryMatList: function() {
if (this.isNeedScanLocationCode) {
uni.showToast({
title: "请先扫描工位码!",
icon: "none",
duration: 1e3
});
return;
}
if (this.isNeedCallShelfCode) {
uni.showToast({
title: "请先呼叫货架!",
icon: "none",
duration: 1e3
});
return;
}
if (this.matCodeCondition == null || this.matCodeCondition == "") {
uni.showToast({
title: "输入物料编码或物料名称后进行查询!",
icon: "none",
duration: 1e3
});
return;
} else {
this.clearMatInfo();
saveConfig("matCodeCondition", this.matCodeCondition);
this.$refs.proup.show();
}
},
//清空当前界面所有内容
clear: function() {
this.locationId = null;
this.locationCode = "";
this.shelfId = null;
this.shelfCode = "";
this.isNeedCallShelfCode = true;
this.isNeedScanLocationCode = true;
this.placeholderText = "请先扫描工位码";
},
clearMatInfo: function() {
this.matCode = "";
this.matName = "";
this.matSpec = "";
},
handlePopupClose() {
formatAppLog("log", "at pages/bind/bind.vue:388", "弹出层已关闭");
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_bindSelectMat = vue.resolveComponent("bindSelectMat");
return vue.openBlock(), vue.createElementBlock("view", { class: "bg-image" }, [
vue.createVNode(_component_bindSelectMat, {
ref: "proup",
onClose: $options.handlePopupClose,
onSelected: $options.bindSelectedMat
}, null, 8, ["onClose", "onSelected"]),
vue.createElementVNode("view", { class: "diy-flex-row" }, [
vue.createElementVNode("view", { style: { "flex": "3" } }, [
vue.createCommentVNode(" 占位 ")
@ -485,25 +884,22 @@ if (uni.restoreGlobal) {
class: "uni-input-wrapper",
style: { "flex": "60" }
}, [
vue.withDirectives(vue.createElementVNode(
"input",
{
id: "inputMatCode",
class: "uni-input",
style: { "font-size": "50rpx", "padding": "10rpx" },
placeholder: "请先扫描工位码",
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.matCode = $event)
},
null,
512
/* NEED_PATCH */
), [
[vue.vModelText, $data.matCode]
vue.withDirectives(vue.createElementVNode("input", {
id: "inputMatCode",
class: "uni-input",
style: { "font-size": "50rpx", "padding": "10rpx" },
placeholder: $data.placeholderText,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.matCodeCondition = $event),
onBlur: _cache[1] || (_cache[1] = (...args) => $options.queryMatList && $options.queryMatList(...args))
}, null, 40, ["placeholder"]), [
[vue.vModelText, $data.matCodeCondition]
])
]),
vue.createElementVNode("view", { style: { "flex": "3" } }),
vue.createElementVNode("view", { style: { "flex": "30" } }, [
vue.createElementVNode("button", null, "查询")
vue.createElementVNode("button", {
onClick: _cache[2] || (_cache[2] = (...args) => $options.queryMatList && $options.queryMatList(...args))
}, "查询")
])
])
]),
@ -523,7 +919,7 @@ if (uni.restoreGlobal) {
vue.createElementVNode("view", { style: { "flex": "35" } }, "工位编码:"),
vue.createElementVNode(
"view",
{ style: { "flex": "50" } },
{ style: { "flex": "50", "overflow": "hidden" } },
vue.toDisplayString($data.locationCode),
1
/* TEXT */
@ -544,7 +940,7 @@ if (uni.restoreGlobal) {
vue.createElementVNode("view", { style: { "flex": "35" } }, "货架编码:"),
vue.createElementVNode(
"view",
{ style: { "flex": "90" } },
{ style: { "flex": "90", "overflow": "hidden" } },
vue.toDisplayString($data.shelfCode),
1
/* TEXT */
@ -558,7 +954,7 @@ if (uni.restoreGlobal) {
vue.createElementVNode("view", { style: { "flex": "35" } }, "物料编码:"),
vue.createElementVNode(
"view",
{ style: { "flex": "90" } },
{ style: { "flex": "90", "overflow": "hidden" } },
vue.toDisplayString($data.matCode),
1
/* TEXT */
@ -572,7 +968,7 @@ if (uni.restoreGlobal) {
vue.createElementVNode("view", { style: { "flex": "35" } }, "物料名称:"),
vue.createElementVNode(
"view",
{ style: { "flex": "90" } },
{ style: { "flex": "90", "overflow": "hidden" } },
vue.toDisplayString($data.matName),
1
/* TEXT */
@ -586,7 +982,7 @@ if (uni.restoreGlobal) {
vue.createElementVNode("view", { style: { "flex": "35" } }, "物料规格:"),
vue.createElementVNode(
"view",
{ style: { "flex": "90" } },
{ style: { "flex": "90", "overflow": "hidden" } },
vue.toDisplayString($data.matSpec),
1
/* TEXT */
@ -608,7 +1004,7 @@ if (uni.restoreGlobal) {
class: "uni-input",
style: { "font-size": "40rpx" },
placeholder: "请输入物料数量",
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.matQty = $event)
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.matQty = $event)
},
null,
512
@ -619,13 +1015,21 @@ if (uni.restoreGlobal) {
]),
vue.createElementVNode("view", { style: { "flex": "40" } }, [
vue.createElementVNode("button", {
onClick: _cache[2] || (_cache[2] = (...args) => $options.bind && $options.bind(...args)),
onClick: _cache[4] || (_cache[4] = (...args) => $options.bind && $options.bind(...args)),
class: "mini-btn",
style: { "margin-left": "10rpx" },
type: "warn",
size: "mini"
}, "绑定")
])
]),
vue.createElementVNode("view", { style: { "flex": "1" } }, [
vue.createElementVNode("view", { style: { "flex": "40", "text-align": "center" } }, [
vue.createElementVNode("button", {
style: { "margin": "50rpx" },
size: "mini"
}, "送货架")
])
])
])
]);
@ -635,6 +1039,7 @@ if (uni.restoreGlobal) {
__definePage("pages/config/config", PagesConfigConfig);
__definePage("pages/main/main", PagesMainMain);
__definePage("pages/bind/bind", PagesBindBind);
__definePage("pages/bindSelectMat/bindSelectMat", PagesBindSelectMatBindSelectMat);
const _sfc_main = {
onLaunch: function() {
formatAppLog("log", "at App.vue:4", "App Launch");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -48,6 +48,10 @@ namespace 智慧物流软件系统
public string ModuleCodePattern { get; set; }
/// <summary>
/// 工位编码 WCS前端当前的工位编码
/// </summary>
public string LocationCode { get; set; }
#region
public bool IsMx { get; set; }