<!DOCTYPE html>
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<title>出门确认单</title>
|
<meta name="renderer" content="webkit">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<!--引用layui样式文件-->
|
<link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
|
<link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
|
<!--引用layui js文件-->
|
<script src="../../../layuiadmin/layui/layui.js"></script>
|
<script src="../../../layuiadmin/Scripts/json2.js"></script>
|
<script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
|
<script src="../../../layuiadmin/Scripts/webConfig.js"></script>
|
<script src="../../../layuiadmin/PubCustom.js"></script>
|
<style>
|
.layui-col-xs8 {
|
width: 55.666667%;
|
}
|
</style>
|
</head>
|
<body>
|
<div class="layui-fluid" style="padding:0">
|
<div class="layui-card" style="padding: 1px">
|
<div class="layui-card-body" style="padding: 0px; height:800px;">
|
<form class="layui-form" action="" lay-filter="component-form-group">
|
<div style="background-color:#0085E8;">
|
<span style="color: white;"><i class="layui-icon layui-icon-form"></i>出门确认单</span>
|
</div>
|
<div class="layui-form-item" style="padding:15px;margin:0px">
|
<div class="layui-row">
|
<div class="layui-col-xs3">
|
<label class="layui-form-label" style="width: 50px;padding-left: 0px;">单据号</label>
|
</div>
|
<div class="layui-col-xs7">
|
<input type="text" name="HBarCode" id="HBarCode" lay-verify="HBarCode" onkeyup="value=value.replace(/\s+/g,'')" autocomplete="off" class="layui-input" onfocus="this.select();">
|
</div>
|
<div class="layui-col-xs2">
|
<button type="button" lay-submit="" lay-filter="HBarCode-BT" class="layui-btn layui_btn_sm" id="HBarCode-BT">确定</button>
|
</div>
|
</div>
|
<div class="layui-tab layui-col-xs12" style="margin-top:5px;" lay-filter="tab-Xs_OutDoorCheckBill_PDA">
|
<ul class="layui-tab-title" lay-filter="tab-all">
|
<li lay-id="1" style="padding:1px;">表头信息</li>
|
<li lay-id="2" style="padding:1px;">物料信息</li>
|
</ul>
|
<div class="layui-tab-content">
|
<!--表头信息-->
|
<div class="layui-tab-item">
|
<div class="layui-form-item" style="padding: 0px; margin: 0px">
|
<div class="layui-row">
|
<div class="layui-col-xs3">
|
<label class="layui-form-label" style="width:60px;padding-left:0px;">扫描单号</label>
|
</div>
|
<div class="layui-col-xs9">
|
<input type="text" name="HMainSourceBillNo" id="HMainSourceBillNo" lay-verify="HMainSourceBillNo" autocomplete="off" class="layui-input" style="border-radius: 5px;background-color:#efefef4d;" disabled>
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-col-xs3">
|
<label class="layui-form-label" style="width:45px;padding-left:0px;">客户</label>
|
</div>
|
<div class="layui-col-xs9">
|
<input type="text" name="HCusName" id="HCusName" lay-verify="HCusName" autocomplete="off" class="layui-input" style="border-radius: 5px;background-color:#efefef4d;" disabled>
|
<input type="hidden" name="HCusID" id="HCusID" lay-verify="HCusID" value="0" autocomplete="off" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-col-xs3">
|
<label class="layui-form-label" style="width:60px;padding-left:0px;">出门说明</label>
|
</div>
|
<div class="layui-col-xs9">
|
<input type="text" name="HExplanation" id="HExplanation" lay-verify="HExplanation" autocomplete="off" class="layui-input" style="border-radius: 5px;">
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-col-xs3">
|
<label class="layui-form-label" style="width:60px;padding-left:0px;">组织</label>
|
</div>
|
<div class="layui-col-xs9">
|
<input type="text" name="HStockOrgName" id="HStockOrgName" lay-verify="HStockOrgName" autocomplete="off" class="layui-input" style="border-radius: 5px;background-color:#efefef4d;" disabled>
|
<input type="hidden" name="HStockOrgID" id="HStockOrgID" lay-verify="HStockOrgID" value="0" autocomplete="off" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-col-xs3">
|
<label class="layui-form-label" style="width:60px;padding-left:0px;">制单人</label>
|
</div>
|
<div class="layui-col-xs9">
|
<input type="text" name="HMaker" id="HMaker" lay-verify="HMaker" autocomplete="off" class="layui-input" style="border-radius: 5px;background-color:#efefef4d;" disabled>
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-col-xs3">
|
<label class="layui-form-label" style="width:60px;padding-left:0px;">单据号</label>
|
</div>
|
<div class="layui-col-xs9">
|
<input type="text" name="HBillNo" id="HBillNo" lay-verify="HBillNo" autocomplete="off" class="layui-input" style="border-radius: 5px;background-color:#efefef4d;" disabled>
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-col-xs3">
|
<label class="layui-form-label" style="width:60px;padding-left:0px;">单据ID</label>
|
</div>
|
<div class="layui-col-xs9">
|
<input type="text" name="HInterID" id="HInterID" lay-verify="HInterID" value="0" autocomplete="off" class="layui-input" style="border-radius: 5px;background-color:#efefef4d;" disabled>
|
</div>
|
</div>
|
</div>
|
</div>
|
<!--物料信息-->
|
<div class="layui-tab-item">
|
<div class="layui-row">
|
<div class="layui-col-xs12">
|
<div class="layui-form-item" style="padding:0px;margin:0px"></div>
|
<table class="layui-hide" id="wl-table" lay-filter="wl-table"></table>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="layer-footer" style="z-index: 10; position: fixed; text-align: center; bottom: 0; width:100%; height:50px">
|
<button type="button" lay-submit="" lay-filter="cmdSaver" class="layui-btn" id="cmdSaver">提交</button>
|
<button type="button" lay-submit="" lay-filter="cmdCancel" class="layui-btn" id="cmdCancel">退出</button>
|
</div>
|
</div>
|
|
<!--隐藏字段-->
|
<input type="hidden" name="HBillType" id="HBillType">
|
<input type="hidden" name="HMainSourceBillType" id="HMainSourceBillType">
|
<input type="hidden" name="HMainSourceInterID" id="HMainSourceInterID">
|
<!--失败提示音-->
|
<div id="" style="display:none;">
|
<audio id="cs" hidden controls>
|
<source src="../../video/jingbao.wav" type="audio/ogg">
|
</audio>
|
</div>
|
<!--成功提示音-->
|
<div id="" style="display:none;">
|
<audio id="cs2" hidden controls>
|
<source src="../../video/success.wav" type="audio/ogg">
|
</audio>
|
</div>
|
</form>
|
</div>
|
</div>
|
</div>
|
<script>
|
layui.config({
|
base: '../../../layuiadmin/' //静态资源所在路径
|
}).extend({
|
index: 'lib/index' //主入口模块
|
}).use(['index', 'form', 'laydate', 'table', 'element'], function () {
|
|
//#region 公共变量
|
var $ = layui.$
|
, admin = layui.admin
|
, layer = layui.layer
|
, table = layui.table
|
, form = layui.form
|
, laydate = layui.laydate
|
, element = layui.element;
|
var HInterID = $('#HInterID').val()
|
var HBillNo = $('#HBillNo').val()
|
var HBillType = '1427'
|
var HMaker = sessionStorage["HUserName"]
|
var HStockOrgID = sessionStorage["OrganizationID"] //组织ID
|
var OperationType = 1 //操作类型(1新增、2从缓存列表中返回)
|
var listOption = [];
|
var columns = "";
|
var HModName = "Xs_OutDoorCheckBill_PDA";
|
var ModRightName = "CE_OutDoorCheck"; //模块权限参数
|
var titleData = []; //不需要显示的字段
|
|
//#endregion
|
|
//判断是否登录 未登录则跳到登录页
|
if (sessionStorage.login != "login") {
|
layer.confirm("登录失效,请重新登录!", {
|
icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
|
}, function () { window.location.href = "../../user/login_pda.html"; });
|
}
|
|
//#region 用户模块权限判断
|
|
//用户模块权限判断
|
CheckModRight();
|
|
function CheckModRight() {
|
layer.load(3);
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/WEBSController/CheckModRight_Json",
|
async: false, //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
|
data: { "ModRightName": ModRightName, "HUserName": HMaker },
|
success: function (d) {
|
if (d.count == 1) {
|
}
|
else {
|
layer.msg(d.Message, {
|
icon: 0, time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () { parent.location.href = "../../../views/index_Mobile.html"; });
|
}
|
},
|
complete: function (XHR, TS) { XHR = null }//回收资源
|
});
|
layer.closeAll("loading");
|
}
|
//#endregion
|
|
//失败提示音
|
function playSound() {
|
console.log("playSound");
|
var audio = document.getElementById("cs");
|
audio.play();
|
audio.onended = function () {
|
// 当音频播报完成时,调用 pause 和设置 currentTime 为 0 以停止播报并重置
|
audio.pause();
|
audio.currentTime = 0;
|
};
|
}
|
//成功提示音
|
function playSound_OK() {
|
console.log("playSound_OK");
|
var audio = document.getElementById("cs2");
|
audio.play();
|
audio.onended = function () {
|
// 当音频播报完成时,调用 pause 和设置 currentTime 为 0 以停止播报并重置
|
audio.pause();
|
audio.currentTime = 0;
|
};
|
}
|
|
//#region 初始化界面
|
|
set_ClearBill();
|
|
function set_ClearBill() {
|
$("#HMaker").val(sessionStorage["HUserName"]);
|
$("#HStockOrgID").val(sessionStorage["OrganizationID"]);
|
$("#HStockOrgName").val(sessionStorage["Organization"]);
|
$("#HBillType").val("1427");
|
//获取最大单据ID、单据号
|
get_MAXNum();
|
//默认显示页面
|
element.tabChange('tab-Xs_OutDoorCheckBill_PDA', '1');
|
set_InitGrid(); //初始化表格
|
|
var data = [];
|
listOption.cols = [[
|
{ field: '件数', title: '件数', width: 100 }
|
, { field: '数量', title: '数量', width: 100 }
|
, { field: '物料名称', title: '物料名称', width: 100 }
|
, { field: '规格型号', title: '规格型号', width: 100 }
|
, { field: '物料代码', title: '物料代码', width: 100 }
|
]];
|
listOption.data = data;
|
table.render(listOption);
|
|
//光标默认在条码位置上
|
var pFocus = $("#HBarCode");
|
pFocus.select();
|
pFocus.focus(); //获取光标
|
}
|
|
//#region 获取最大单据ID、单据号
|
function get_MAXNum() {
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/WEBSController/GetMaxBillNoAndID_Json",
|
async: false, //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
|
data: { "HBillType": HBillType },
|
success: function (d) {
|
if (d.count == 1) {
|
$("#HInterID").val(d.data[0].HInterID);
|
$("#HBillNo").val(d.data[0].HBillNo);
|
HInterID = $('#HInterID').val()
|
HBillNo = $('#HBillNo').val()
|
}
|
else {
|
$("#HInterID").val("0");
|
$("#HBillNo").val("");
|
layer.msg(d.Message, { icon: 0, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
|
}
|
},
|
complete: function (XHR, TS) { XHR = null }//回收资源
|
});
|
}
|
//#endregion
|
|
//初始化表格
|
function set_InitGrid() {
|
listOption = {
|
elem: '#wl-table'
|
//, toolbar: '#toolbarDemo'
|
, totalRow: true
|
, height: 'full-60'
|
, cellMinWidth: 90
|
, limit: 50
|
};
|
}
|
|
//#endregion
|
|
|
//#region 功能控件
|
|
//#region 提交
|
form.on('submit(cmdSaver)', function (data) {
|
var sMainStr = JSON.stringify(data.field);
|
var sSubStr = table.cache['wl-table'];
|
if (AllowLoadData(sSubStr) != false)//非空验证
|
{
|
layer.load(3);
|
$.ajax(
|
{
|
type: "POST",
|
url: GetWEBURL() + "/WEBSController/set_SaveOutDoorCheckBill_Json",
|
async: false, //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
|
data: { "sMainSub": sMainStr },
|
dataType: "json",
|
success: function (data) {
|
if (data.count == 1) { // 说明验证成功了
|
layer.confirm(data.Message, {
|
icon: 1, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['新增','关闭'],
|
btn2: function () {
|
parent.location.href = "../../../views/index_Mobile.html";
|
}//关闭
|
}
|
, function () {
|
location.replace('Xs_OutDoorCheckBill_PDA.html');
|
});//新增
|
}
|
else {
|
layer.msg(data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
|
}
|
},
|
complete: function (XHR, TS) { XHR = null },//回收资源
|
error: function (err) {
|
layer.msg("错误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
|
}
|
});
|
layer.closeAll("loading");
|
return;
|
}
|
});
|
|
//#endregion
|
|
//#region 退出
|
|
form.on('submit(cmdCancel)', function () {
|
layer.confirm('您确定要退出吗?', { icon: 3, title: '提示' }, function (index) {
|
if (OperationType == 2) {
|
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
|
parent.location.reload(); //刷新父页面,注意一定要在关闭当前iframe层之前执行刷新
|
parent.layer.close(index); //再执行关闭
|
}
|
else {
|
parent.location.href = "../../../views/index_Mobile.html";
|
}
|
});
|
})
|
|
//#endregion
|
|
//#endregion
|
|
|
//#region 扫描单据号条码
|
|
//扫描单据号条码
|
$('#HBarCode').on('keydown', function (event) {
|
if (event.keyCode == 13) {
|
GetMeesageBySourceBillNo();
|
}
|
});
|
|
//单据号按钮
|
form.on('submit(HBarCode-BT)', function (data) {
|
GetMeesageBySourceBillNo();
|
});
|
|
//扫描单据号条码
|
function GetMeesageBySourceBillNo(obj) {
|
var HBarCode = $('#HBarCode').val()
|
var HMainSourceBillNo = $('#HMainSourceBillNo').val()
|
if (HMainSourceBillNo != '') {
|
playSound();
|
layer.msg("已存在扫码记录,不允许多次扫描,请提交后再扫描!", {
|
icon: 0, time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () {
|
$("#HBarCode").select();
|
$("#HBarCode").focus();
|
});
|
return;
|
}
|
layer.load(3)
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/WEBSController/Get_SourceBarCode_OutDoorCheck_Json",
|
async: false, //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
|
data: { "HBarCode": HBarCode, "HStockOrgID": HStockOrgID },
|
success: function (result) {
|
var data = [];
|
var col = [];
|
if (result.count == 1) {
|
playSound_OK();
|
//给空的数组赋值
|
for (var key in result.list) {
|
//动态获取列表所有列名
|
data.push({ "id": result.list[key].ColmCols, "name": result.list[key].ColmCols, "Type": result.list[key].ColmType });
|
//获取不需要显示的列(H开头的列不显示)
|
var patrn = new RegExp(/^h/i);
|
if (patrn.test(result.list[key].ColmCols)) {
|
titleData[key] = result.list[key].ColmCols;
|
}
|
}
|
|
//在列表左边添加勾选框
|
col.push({ type: 'radio', fixed: 'left', totalRowText: '合计' });
|
for (var i = 0; i < data.length; i++) {
|
if ($.inArray(data[i].name, titleData) > -1) {
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
|
}
|
else {
|
switch (data[i].Type) {
|
//int
|
case 'DateTime':
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 200 });
|
break;
|
case 'Decimal':
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', totalRow: true });
|
break;
|
case 'Int32':
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', totalRow: true });
|
break;
|
default:
|
|
//if (data[i].name == '数量' || data[i].name == '件数') {
|
// col.push({ field: data[i].id, title: data[i].name, align: 'center', totalRow: true });
|
//} else {
|
col.push({ field: data[i].id, title: data[i].name, align: 'center' });
|
//}
|
}
|
}
|
}
|
columns = col;
|
listOption.cols = [columns];
|
listOption.data = result.data;
|
listOption.totalRow = true;
|
table.render(listOption);
|
|
$("#HMainSourceInterID").val(result.data[0].HInterID);
|
$("#HMainSourceBillNo").val(result.data[0].HBillNo);
|
$("#HMainSourceBillType").val(result.data[0].HBillType);
|
$("#HCusID").val(result.data[0].HCusID);
|
$("#HCusName").val(result.data[0].HCusName);
|
$("#HStockOrgID").val(result.data[0].HStockOrgID);
|
$("#HStockOrgName").val(result.data[0].HStockOrgName);
|
element.tabChange('tab-Xs_OutDoorCheckBill_PDA', '2');
|
$("#HBarCode").select();
|
$("#HBarCode").focus();
|
}
|
else {
|
playSound();
|
listOption.cols = [[
|
{ field: '件数', title: '件数', width: 100 }
|
, { field: '数量', title: '数量', width: 100 }
|
, { field: '物料名称', title: '物料名称', width: 100 }
|
, { field: '规格型号', title: '规格型号', width: 100 }
|
, { field: '物料代码', title: '物料代码', width: 100 }
|
]];
|
listOption.data = data;
|
table.render(listOption);
|
|
layer.msg(result.Message, {
|
icon: 5, time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () {
|
element.tabChange('tab-Xs_OutDoorCheckBill_PDA', '1');
|
$("#HBarCode").select();
|
$("#HBarCode").focus();
|
});
|
}
|
},
|
complete: function (XHR, TS) { XHR = null }//回收资源
|
});
|
layer.closeAll("loading");
|
}
|
|
//#endregion
|
|
|
|
});
|
|
//以上为layui模块
|
//此处方法涉及到被外部页面parent.方法名调用的必须放在Layui方法外部
|
|
//单据上传前判断
|
function AllowLoadData(sSubStr) {
|
if (HInterID == 0) {
|
layer.msg("单据内码获取失败,错误的单据内码!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
|
return false;
|
}
|
if (HBillNo == '') {
|
layer.msg("单据号获取失败,错误的单据号!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
|
return false;
|
}
|
if (sSubStr.length == 0) {
|
layer.msg("没有扫描所要出库单据号,请先扫描需要出库的单据号,确认无误后再提交!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
|
return false;
|
}
|
return true;
|
}
|
</script>
|
|
</body>
|
</html>
|