You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
304 lines
13 KiB
304 lines
13 KiB
|
3 years ago
|
<!DOCTYPE html>
|
||
|
|
<html xmlns:th="http://www.w3.org/1999/xhtml">
|
||
|
|
<html xmlns:th="http://www.thymeleaf.org">
|
||
|
|
<head>
|
||
|
|
<meta charset="utf-8">
|
||
|
|
<title>扫码</title>
|
||
|
|
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all">
|
||
|
|
<link rel="stylesheet" href="/static/css/layuimini.css?v=2.0.4.2" media="all">
|
||
|
|
<link rel="stylesheet" href="/static/css/themes/default.css" media="all">
|
||
|
|
<link rel="stylesheet" href="/static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
|
||
|
|
<!--[if lt IE 9]>
|
||
|
|
<script src="/static/js/html5.min.js"></script>
|
||
|
|
<script src="/static/js/respond.min.js"></script>
|
||
|
|
<![endif]-->
|
||
|
|
<!-- vue相关-->
|
||
|
|
<script src="../static/js/vue/vue.js"></script>
|
||
|
|
<script src="../static/js/vue/vue-router.js"></script>
|
||
|
|
<script src="../static/lib/http-vue-loader/src/httpVueLoader.js"></script>
|
||
|
|
<script src="../static/js/VueQrcodeReader.umd.min.js"></script>
|
||
|
|
<style>
|
||
|
|
.validation-success,
|
||
|
|
.validation-failure,
|
||
|
|
.validation-pending {
|
||
|
|
position: absolute;
|
||
|
|
width: 100%;
|
||
|
|
height: 100%;
|
||
|
|
|
||
|
|
background-color: rgba(255, 255, 255, .8);
|
||
|
|
text-align: center;
|
||
|
|
font-weight: bold;
|
||
|
|
font-size: 1.4rem;
|
||
|
|
padding: 10px;
|
||
|
|
|
||
|
|
display: flex;
|
||
|
|
flex-flow: column nowrap;
|
||
|
|
justify-content: center;
|
||
|
|
}
|
||
|
|
|
||
|
|
.validation-success {
|
||
|
|
color: green;
|
||
|
|
}
|
||
|
|
|
||
|
|
.validation-failure {
|
||
|
|
color: red;
|
||
|
|
}
|
||
|
|
</style>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
|
||
|
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
|
||
|
|
<script>
|
||
|
|
|
||
|
|
function outboundLogic() {
|
||
|
|
|
||
|
|
};
|
||
|
|
function temporaryScanValue() {
|
||
|
|
|
||
|
|
}
|
||
|
|
function chooseInOrOut() {
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
var materialList = [],
|
||
|
|
depository= null,
|
||
|
|
place=null;
|
||
|
|
let params = {}; // 用于暂存扫描结果
|
||
|
|
|
||
|
|
|
||
|
|
layui.$(function () {
|
||
|
|
parent.wx.scanQRCode({
|
||
|
|
desc: 'scanQRCode desc',
|
||
|
|
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
|
||
|
|
scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
|
||
|
|
success: function (res) {
|
||
|
|
// 回调
|
||
|
|
var result = res.resultStr;//当needResult为1时返回处理结果
|
||
|
|
var req = {};
|
||
|
|
req.qrCode = result;
|
||
|
|
outboundLogic(req);
|
||
|
|
},
|
||
|
|
error: function (res) {
|
||
|
|
if (res.errMsg.indexOf('function_not_exist') > 0) {
|
||
|
|
alert('版本过低请升级')
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
})
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
outboundLogic = function (req) {
|
||
|
|
layui.$.ajax({
|
||
|
|
url: "/material/qywxScanCodeOut",
|
||
|
|
type: "post",
|
||
|
|
dataType: 'json',
|
||
|
|
data: JSON.stringify(req),
|
||
|
|
contentType: "application/json;charset=utf-8",
|
||
|
|
success: function (d) {
|
||
|
|
var data = d.data;
|
||
|
|
// 获取标准
|
||
|
|
var flag = data.flag;
|
||
|
|
if (flag === 0) {
|
||
|
|
// 如果是无效码
|
||
|
|
layer.msg("扫描失败,请确认扫描是否正确");
|
||
|
|
}
|
||
|
|
else if (flag === 1) {
|
||
|
|
// 如果是物料
|
||
|
|
material = data.material;
|
||
|
|
materialList.push(material);
|
||
|
|
layer.confirm("是否继续扫描",
|
||
|
|
{
|
||
|
|
btn: ["继续", "取消"]
|
||
|
|
},
|
||
|
|
function () { // 继续扫描物料
|
||
|
|
layer.close(layer.index); // 关闭弹窗
|
||
|
|
parent.wx.scanQRCode({
|
||
|
|
desc: 'scanQRCode desc',
|
||
|
|
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
|
||
|
|
scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
|
||
|
|
success: function (res) {
|
||
|
|
// 回调
|
||
|
|
var result = res.resultStr;//当needResult为1时返回处理结果
|
||
|
|
var param = {};
|
||
|
|
param.qrCode = result;
|
||
|
|
outboundLogic(param);
|
||
|
|
},
|
||
|
|
error: function (res) {
|
||
|
|
if (res.errMsg.indexOf('function_not_exist') > 0) {
|
||
|
|
alert('版本过低请升级')
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
},
|
||
|
|
function () {
|
||
|
|
// 不扫描物料
|
||
|
|
params.materialList = materialList;
|
||
|
|
params.depository = depository;
|
||
|
|
params.place = place;
|
||
|
|
temporaryScanValue(params); // 将物料暂存
|
||
|
|
if (depository !== null || place !== null) {
|
||
|
|
// 如果已经扫描了仓库或库位
|
||
|
|
// 弹出选择框
|
||
|
|
chooseInOrOut();
|
||
|
|
} else {
|
||
|
|
// 如果没有扫描仓库或库位
|
||
|
|
layer.confirm("暂未扫描仓库,是否继续该操作",
|
||
|
|
{
|
||
|
|
btn: ["继续", "取消"]
|
||
|
|
},
|
||
|
|
function () {// 继续
|
||
|
|
// 弹出选择框
|
||
|
|
chooseInOrOut();
|
||
|
|
},
|
||
|
|
function () { // 取消当前操作
|
||
|
|
layer.close(layer.index); // 关闭弹窗
|
||
|
|
parent.wx.scanQRCode({
|
||
|
|
desc: 'scanQRCode desc',
|
||
|
|
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
|
||
|
|
scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
|
||
|
|
success: function (res) {
|
||
|
|
// 回调
|
||
|
|
var result = res.resultStr;//当needResult为1时返回处理结果
|
||
|
|
var param = {};
|
||
|
|
param.qrCode = result;
|
||
|
|
outboundLogic(param);
|
||
|
|
},
|
||
|
|
error: function (res) {
|
||
|
|
if (res.errMsg.indexOf('function_not_exist') > 0) {
|
||
|
|
alert('版本过低请升级')
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
)
|
||
|
|
}
|
||
|
|
})
|
||
|
|
}
|
||
|
|
else if (flag === 2) {
|
||
|
|
// 如果扫描的为库位
|
||
|
|
place = data.place;// 暂存扫描结果
|
||
|
|
params.depository = depository;
|
||
|
|
params.place = place;
|
||
|
|
params.materialList = materialList;
|
||
|
|
if (materialList.length > 0) {
|
||
|
|
// 如果有物料
|
||
|
|
temporaryScanValue(params); // 将数据暂存至redis中
|
||
|
|
chooseInOrOut(); // 弹出选择框
|
||
|
|
} else {
|
||
|
|
// 如果没有
|
||
|
|
layer.confirm("当前并未扫描物料,是否继续扫描",
|
||
|
|
{btn:["继续","取消"]},
|
||
|
|
function () { // 继续扫描
|
||
|
|
layer.close(layer.index); // 关闭弹窗
|
||
|
|
parent.wx.scanQRCode({
|
||
|
|
desc: 'scanQRCode desc',
|
||
|
|
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
|
||
|
|
scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
|
||
|
|
success: function (res) {
|
||
|
|
// 回调
|
||
|
|
var result = res.resultStr;//当needResult为1时返回处理结果
|
||
|
|
var req = {};
|
||
|
|
req.qrCode = result;
|
||
|
|
outboundLogic(req);
|
||
|
|
},
|
||
|
|
error: function (res) {
|
||
|
|
if (res.errMsg.indexOf('function_not_exist') > 0) {
|
||
|
|
alert('版本过低请升级')
|
||
|
|
}
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
function () {
|
||
|
|
temporaryScanValue(params); // 将数据暂存
|
||
|
|
chooseInOrOut(); // 弹出选择框
|
||
|
|
}
|
||
|
|
)
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
} else if (flag === 3) {
|
||
|
|
// 如果是仓库
|
||
|
|
depository = data.depository;
|
||
|
|
params.depository = depository;
|
||
|
|
params.place = place;
|
||
|
|
params.materialList = materialList;
|
||
|
|
if (materialList.length > 0) {
|
||
|
|
// 如果有物料
|
||
|
|
temporaryScanValue(params); // 将数据暂存至redis中
|
||
|
|
chooseInOrOut(); // 弹出选择框
|
||
|
|
} else {
|
||
|
|
// 如果没有
|
||
|
|
layer.confirm("暂未选择物料,是否继续扫描", {
|
||
|
|
btn:["继续","取消"]
|
||
|
|
},function () { // 继续
|
||
|
|
layer.close(layer.index); // 关闭弹窗
|
||
|
|
parent.wx.scanQRCode({
|
||
|
|
desc: 'scanQRCode desc',
|
||
|
|
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
|
||
|
|
scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
|
||
|
|
success: function (res) {
|
||
|
|
// 回调
|
||
|
|
var result = res.resultStr;//当needResult为1时返回处理结果
|
||
|
|
var req = {};
|
||
|
|
req.qrCode = result;
|
||
|
|
outboundLogic(req);
|
||
|
|
},
|
||
|
|
error: function (res) {
|
||
|
|
if (res.errMsg.indexOf('function_not_exist') > 0) {
|
||
|
|
alert('版本过低请升级')
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
},function () { // 取消
|
||
|
|
temporaryScanValue(params); // 将数据暂存
|
||
|
|
chooseInOrOut(); // 弹出选择框
|
||
|
|
})
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
})
|
||
|
|
};
|
||
|
|
temporaryScanValue = function (params) {
|
||
|
|
layui.$.ajax({
|
||
|
|
url: "/material/temporaryValue",
|
||
|
|
type: 'post',
|
||
|
|
dataType: 'json',
|
||
|
|
contentType: "application/json;charset=utf-8",
|
||
|
|
data: JSON.stringify(params)
|
||
|
|
});
|
||
|
|
};
|
||
|
|
// 弹出入库|出库选择框
|
||
|
|
chooseInOrOut = function () {
|
||
|
|
layer.confirm("是否入库", {
|
||
|
|
btn: ["入库", "取消"]
|
||
|
|
},
|
||
|
|
function () { // 选择入库
|
||
|
|
layer.open({
|
||
|
|
type: 2,
|
||
|
|
title: '入库',
|
||
|
|
skin: 'layui-layer-rim',
|
||
|
|
maxmin: true,
|
||
|
|
shadeClose: true, //点击遮罩关闭层
|
||
|
|
area: ['100%', '100%'],
|
||
|
|
move: '.layui-layer-title',
|
||
|
|
fixed: false,
|
||
|
|
content: '/application_in_scanQrCode',
|
||
|
|
end: function () {
|
||
|
|
var index = parent.layer.getFrameIndex(window.name);
|
||
|
|
parent.layer.close(index);
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
function () { // 选择取消
|
||
|
|
var index = parent.layer.getFrameIndex(window.name);
|
||
|
|
parent.layer.close(index);
|
||
|
|
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
</script>
|
||
|
|
</body>
|
||
|
|
</html>
|