<!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-xs2">
|
<label class="layui-form-label" style="width: 45px;padding-left: 0px;">箱条码</label>
|
</div>
|
<div class="layui-col-xs8">
|
<input type="text" name="HBarCode_Pack" id="HBarCode_Pack" lay-verify="HBarCode_Pack" 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_Pack-BT" class="layui-btn" id="HBarCode_Pack-BT" style="width: 45px; margin-left: 8px;padding-left:12px">OK</button>
|
</div>
|
</div>
|
<div class="layui-tab layui-col-xs12" style="margin-top:5px;" lay-filter="tab-Sc_UnPackUnionBill_Packing_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-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 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="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>
|
</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="HBillSubType" id="HBillSubType">
|
<!--失败提示音-->
|
<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 = '3783'
|
var HBillSubType = '1' //子类型(1拆箱、2拆托)
|
var HMaker = sessionStorage["HUserName"]
|
var HStockOrgID = sessionStorage["OrganizationID"] //组织ID
|
var listOption = [];
|
var columns = "";
|
var HModName = "Sc_UnPackUnionBill_Packing_PDA";
|
var ModRightName = "CE_UnPackUnionBill_Packing"; //模块权限参数
|
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"; });
|
}
|
|
//失败提示音
|
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"]);
|
$("#HBillType").val(HBillType);
|
$("#HBillSubType").val(HBillSubType);
|
$("#HInterID").val(0);
|
$("#HBillNo").val('');
|
HInterID = $('#HInterID').val()
|
HBillNo = $('#HBillNo').val()
|
|
//默认显示页面
|
element.tabChange('tab-Sc_UnPackUnionBill_Packing_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_Pack");
|
pFocus.select();
|
pFocus.focus(); //获取光标
|
}
|
|
//初始化表格
|
function set_InitGrid() {
|
listOption = {
|
elem: '#wl-table'
|
//, toolbar: '#toolbarDemo'
|
, totalRow: true
|
, height: 'full-60'
|
, cellMinWidth: 90
|
, limit: 200
|
};
|
}
|
|
//#region 点击行选中高亮
|
table.on('row(wl-table)', function (obj) {
|
//选中行改变颜色
|
$(".layui-table-body tr ").attr({ "style": "background:" }); //其他tr恢复原样
|
obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click'); //选中行样式
|
obj.tr.find('i[class="layui-anim layui-icon"]').trigger("click"); //选中radio样式
|
$(obj.tr.selector).attr({ "style": "background:#ceedfa;color:black" }); //改变当前tr背景颜色和字体颜色
|
})
|
//#endregion
|
|
|
//#endregion
|
|
|
//#region 功能控件
|
|
//#region 拆箱
|
form.on('submit(cmdSaver)', function (data) {
|
document.getElementById("cmdSaver").disabled = true; //按钮变为不可编辑状态
|
var sSubStr = table.cache['wl-table'];
|
var HBarCode_Pack = $('#HBarCode_Pack').val()
|
if (AllowLoadData(sSubStr) != false)//非空验证
|
{
|
layer.load(3);
|
$.ajax(
|
{
|
type: "GET",
|
url: GetWEBURL() + "/WEBSController/set_SaveUnPackUnionBill_Json",
|
async: false, //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
|
data: { "HInterID": HInterID, "HBillNo": HBillNo, "HBarCode_Pack": HBarCode_Pack, "HMaker": HMaker },
|
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('Sc_UnPackUnionBill_Packing_PDA.html?HInterID=0');
|
});//新增
|
}
|
else {
|
layer.msg(data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示" });
|
document.getElementById("cmdSaver").disabled = false; //按钮变为可编辑状态
|
}
|
},
|
complete: function (XHR, TS) { XHR = null },//回收资源
|
error: function (err) {
|
layer.msg("错误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示" });
|
document.getElementById("cmdSaver").disabled = false; //按钮变为可编辑状态
|
}
|
});
|
layer.closeAll("loading");
|
return;
|
}
|
});
|
|
//#endregion
|
|
//#region 退出
|
|
form.on('submit(cmdCancel)', function () {
|
layer.confirm('您确定要退出吗?', { icon: 3, title: '提示' }, function (index) {
|
parent.location.href = "../../../../views/index_Mobile.html";
|
});
|
})
|
|
//#endregion
|
|
//#endregion
|
|
|
//#region 扫描箱条码
|
|
//扫描箱条码
|
$('#HBarCode_Pack').on('keydown', function (event) {
|
if (event.keyCode == 13) {
|
GetMeesageByBarCode_Pack();
|
}
|
});
|
|
//箱条码按钮
|
form.on('submit(HBarCode_Pack-BT)', function (data) {
|
GetMeesageByBarCode_Pack();
|
});
|
|
//扫箱条码
|
function GetMeesageByBarCode_Pack(obj) {
|
var HBarCode_Pack = $('#HBarCode_Pack').val()
|
if (HBarCode_Pack == '') {
|
playSound();
|
layer.msg("箱条码不能为空,请扫描箱条码!", {
|
icon: 0, time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () {
|
$("#HBarCode_Pack").select();
|
$("#HBarCode_Pack").focus();
|
});
|
return;
|
}
|
layer.load(3)
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/WEBSController/Get_PackBarCode_UnPackUnionBill_Json",
|
async: false, //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
|
data: { "HBarCode_Pack": HBarCode_Pack, "HBillSubType": HBillSubType },
|
success: function (result) {
|
var data = [];
|
var col = [];
|
if (result.count == 1) {
|
playSound_OK();
|
$("#HInterID").val(result.data[0].HInterID);
|
$("#HBillNo").val(result.data[0].HBillNo);
|
HInterID = $('#HInterID').val()
|
HBillNo = $('#HBillNo').val()
|
|
//显示表体明细
|
//给空的数组赋值
|
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', 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: 'left', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 120 });
|
break;
|
default:
|
|
if (data[i].name == '数量') {
|
col.push({ field: data[i].id, title: data[i].name, align: 'left', totalRow: true });
|
} else if (data[i].name == '物料代码') {
|
col.push({ field: data[i].id, title: data[i].name, align: 'left', width: 120 });
|
} else if (data[i].name == '物料名称' || data[i].name == '规格型号') {
|
col.push({ field: data[i].id, title: data[i].name, align: 'left', width: 180 });
|
} else {
|
col.push({ field: data[i].id, title: data[i].name, align: 'left', width: 220 });
|
}
|
}
|
}
|
}
|
columns = col;
|
listOption.cols = [columns];
|
listOption.data = result.data;
|
listOption.totalRow = true;
|
table.cache['wl-table'] = null; //清空表格缓存数据
|
table.render(listOption);
|
}
|
else {
|
playSound();
|
layer.msg(result.Message, {
|
icon: 5, time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () {
|
$("#HBarCode_Pack").select();
|
$("#HBarCode_Pack").focus();
|
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 }
|
]];
|
listOption.data = data;
|
table.render(listOption);
|
});
|
}
|
},
|
complete: function (XHR, TS) { XHR = null },//回收资源
|
error: function (err) {
|
playSound();
|
layer.msg("错误!" + err, {
|
icon: 5, time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () {
|
$("#HBarCode_Pack").select();
|
$("#HBarCode_Pack").focus();
|
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 }
|
]];
|
listOption.data = data;
|
table.render(listOption);
|
});
|
}
|
});
|
layer.closeAll("loading");
|
}
|
|
//#endregion
|
|
});
|
|
//以上为layui模块
|
//此处方法涉及到被外部页面parent.方法名调用的必须放在Layui方法外部
|
|
//单据上传前判断
|
function AllowLoadData(sSubStr) {
|
if (sSubStr.length == 0) {
|
layer.msg("没有拆箱信息,请先扫描箱条码,确认无误后再拆箱!", { icon: 5, btn: ['确认'], time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示" });
|
return false;
|
}
|
return true;
|
}
|
</script>
|
|
</body>
|
</html>
|