<!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" style="display:none;">
|
<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" style="display:none;">
|
<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="HEmpName" id="HEmpName" lay-verify="HEmpName" autocomplete="off" class="layui-input" style="border-radius: 5px;background-color:#efefef4d;" disabled>
|
<input type="hidden" name="HEmpID" id="HEmpID" lay-verify="HEmpID" 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:45px;padding-left:0px;">司机</label>
|
</div>
|
<div class="layui-col-xs9">
|
<input type="text" name="HShipper" id="HShipper" lay-verify="HShipper" 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="HCarNumber" id="HCarNumber" lay-verify="HCarNumber" 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="HPhone" id="HPhone" lay-verify="HPhone" 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="HOutReason" id="HOutReason" lay-verify="HOutReason" autocomplete="off" class="layui-input" style="border-radius: 5px;background-color:#efefef4d;" disabled>
|
</div>
|
</div>
|
<div class="layui-row" style="display:none;">
|
<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="HMaterName" id="HMaterName" lay-verify="HMaterName" 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="HOutAddress" id="HOutAddress" lay-verify="HOutAddress" 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="HRemark" id="HRemark" lay-verify="HRemark" 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="HPieceQty_Total" id="HPieceQty_Total" value="0" lay-verify="HPieceQty_Total" 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="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="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>
|
<!--失败提示音-->
|
<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 user = sessionStorage["HUserName"]
|
var HStockOrgID = sessionStorage["OrganizationID"] //组织ID
|
var OperationType = 1 //操作类型(1新增、2从缓存列表中返回)
|
var listOption = [];
|
var columns = "";
|
var HModName = "Xs_OutDoorBill_PDA";
|
var ModRightName = "CE_OutDoorCheck"; //模块权限参数
|
var titleData = []; //不需要显示的字段
|
|
//#endregion
|
|
//#region 页面加载相关判断
|
//#region 判断是否登录 未登录则跳到登录页
|
if (sessionStorage.login != "login") {
|
layer.confirm("登录失效,请重新登录!", {
|
icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
|
}, function () { window.location.href = "../../user/login_pda.html"; });
|
}
|
//#endregion
|
|
//#region 用户模块权限判断
|
CheckModRight();
|
//#endregion
|
//#endregion
|
|
//#region 初始化界面
|
set_ClearBill();
|
//#endregion
|
|
//#region 功能控件
|
//#region 提交
|
form.on('submit(cmdSaver)', function (data) {
|
//序列化表头信息和子表信息
|
var sMainStr = JSON.stringify(data.field);
|
var sSubStr = JSON.stringify(listOption.data);
|
|
//拼接参数
|
var sMainSub = sMainStr + ';' + sSubStr + ";" + sessionStorage["HUserName"];
|
|
if (AllowLoadData() != false) //非空验证
|
{
|
layer.load(3);
|
$.ajax({
|
type: "POST",
|
url: GetWEBURL() + "/Xs_OutDoorBill/OutDoorCheck_Xs_OutDoorBill",
|
async: false, //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
|
data: { "msg": sMainSub },
|
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_QiaoYi.html";
|
}//关闭
|
}
|
, function () {
|
location.replace('Xs_OutDoorBill_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_QiaoYi.html";
|
}
|
});
|
})
|
|
//#endregion
|
//#endregion
|
|
//#region 页面方法
|
//#region 页面初始化方法
|
function set_ClearBill() {
|
//默认显示页面
|
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 }
|
, { 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(); //获取光标
|
}
|
//#endregion
|
|
//#region 初始化表格
|
function set_InitGrid() {
|
listOption = {
|
elem: '#wl-table'
|
//, toolbar: '#toolbarDemo'
|
, totalRow: true
|
, height: 'full-60'
|
, cellMinWidth: 90
|
, limit: 50
|
};
|
}
|
//#endregion
|
|
//#region 数据校验
|
function AllowLoadData() {
|
return true;
|
}
|
//#endregion
|
|
//#region 用户模块权限判断
|
function CheckModRight() {
|
layer.load(3);
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/WEBSController/CheckModRight_Json",
|
async: false, //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
|
data: { "ModRightName": ModRightName, "HUserName": user },
|
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_QiaoYi.html"; });
|
}
|
},
|
complete: function (XHR, TS) { XHR = null }//回收资源
|
});
|
layer.closeAll("loading");
|
}
|
//#endregion
|
|
//#region 失败提示音
|
function playSound() {
|
console.log("playSound");
|
var audio = document.getElementById("cs");
|
audio.play();
|
audio.onended = function () {
|
// 当音频播报完成时,调用 pause 和设置 currentTime 为 0 以停止播报并重置
|
audio.pause();
|
audio.currentTime = 0;
|
};
|
}
|
//#endregion
|
//#region 成功提示音
|
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;
|
};
|
}
|
//#endregion
|
//#endregion
|
|
|
|
|
|
//#region 扫描单据号条码
|
//#region 扫描单据号条码
|
$('#HBarCode').on('keydown', function (event) {
|
if (event.keyCode == 13) {
|
GetMeesageBySourceBillNo();
|
}
|
});
|
//#endregion
|
|
//#region 单据号按钮
|
form.on('submit(HBarCode-BT)', function (data) {
|
GetMeesageBySourceBillNo();
|
});
|
//#endregion
|
|
//#region 扫描单据号条码
|
function GetMeesageBySourceBillNo(obj) {
|
var HBarCode = $('#HBarCode').val()
|
var HBillNo = $('#HBillNo').val()
|
if (HBillNo != '') {
|
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() + "/Xs_OutDoorBill/cx_PDA",
|
async: false, //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
|
data: { "HBillNo": HBarCode, "HStockOrgID": HStockOrgID },
|
success: function (result) {
|
var data = [];
|
var col = [];
|
if (result.count == 1 && result.data.length>0) {
|
playSound_OK();
|
|
var HIsSubBillFlag = 0; //用于标记需要显示在子表的字段
|
|
//给空的数组赋值
|
for (var key in result.list) {
|
if (result.list[key].ColmCols == "hsubid") {
|
HIsSubBillFlag = 1;
|
}
|
|
if (HIsSubBillFlag == 1) {
|
//动态获取列表所有列名
|
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' });
|
//}
|
}
|
}
|
}
|
|
var HPieceQty_Total = 0;
|
for (var i = 0; i < result.data.length; i++) {
|
HPieceQty_Total += result.data[i]["件数"];
|
}
|
|
$("#HPieceQty_Total").val(HPieceQty_Total);
|
|
columns = col;
|
listOption.cols = [columns];
|
listOption.data = result.data;
|
listOption.totalRow = true;
|
table.render(listOption);
|
|
//$("#HCusID").val(result.data[0].HCusID);
|
//$("#HCusName").val(result.data[0].客户);
|
//$("#HEmpID").val(result.data[0].HEmpID);
|
//$("#HEmpName").val(result.data[0].业务员);
|
$("#HCusID").val(0);
|
$("#HCusName").val("");
|
$("#HEmpID").val(0);
|
$("#HEmpName").val("");
|
|
$("#HShipper").val(result.data[0].司机);
|
$("#HCarNumber").val(result.data[0].车牌号);
|
$("#HPhone").val(result.data[0].联系电话);
|
$("#HOutReason").val(result.data[0].出门原因);
|
$("#HMaterName").val(result.data[0].装运何物);
|
$("#HOutAddress").val(result.data[0].出门地点);
|
$("#HRemark").val(result.data[0].表头备注);
|
$("#HStockOrgID").val(result.data[0].HStockOrgID);
|
$("#HStockOrgName").val(result.data[0].组织);
|
$("#HInterID").val(result.data[0].hmainid);
|
$("#HBillNo").val(result.data[0].单据号);
|
|
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 }
|
, { field: '客户', title: '客户', width: 100 }
|
//, { field: '销售出库单号', title: '销售出库单号', width: 100 }
|
//, { field: '销售订单号', title: '销售订单号', width: 100 }
|
]];
|
listOption.data = data;
|
table.render(listOption);
|
|
if (result.count == 1 && result.data.length == 0) {
|
layer.msg("未查询到单据信息,请检查单据是否审核!", {
|
icon: 5, time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () {
|
element.tabChange('tab-Xs_OutDoorCheckBill_PDA', '1');
|
$("#HBarCode").select();
|
$("#HBarCode").focus();
|
});
|
} else {
|
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
|
//#endregion
|
|
|
|
});
|
|
//以上为layui模块
|
//此处方法涉及到被外部页面parent.方法名调用的必须放在Layui方法外部
|
|
|
</script>
|
|
</body>
|
</html>
|