<!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-xs12">
|
<div class="layui-col-xs3">
|
<label class="layui-form-label" style="width: 30px;padding-left: 0px;">条码</label>
|
</div>
|
<div class="layui-col-xs9">
|
<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>
|
</div>
|
<div class="layui-tab layui-col-xs12" style="margin-top:5px;" lay-filter="tab-Sc_ICMOBillWorkQtyStatus_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>
|
<li lay-id="3" style="padding:1px;">物料信息</li>
|
<li lay-id="4" 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">
|
<select name="HMainSourceBillType" id="HMainSourceBillType">
|
<option value="3710">生产订单</option>
|
<option value="-1">手工录入</option>
|
</select>
|
</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">
|
<div class="layui-col-xs8">
|
<input type="text" name="HSourceBillNo" id="HSourceBillNo" lay-verify="HSourceBillNo" 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="cmdHSourceBillNo" class="layui-btn" id="cmdHSourceBillNo" style="width: 45px; margin-left: 10px; padding-left: 12px">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-2px;"></i>
|
</button>
|
</div>
|
<div class="layui-col-xs2" style="float: right;">
|
<button type="button" lay-submit="" lay-filter="HSourceBillNo-BT" class="layui-btn" id="HSourceBillNo-BT" style="width: 45px; margin-left: -5px;padding-left:12px">OK</button>
|
</div>
|
</div>
|
</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 name="HDate" id="HDate" 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 class="layui-tab-item">
|
<div class="layui-form-item" style="padding:0px;margin:0px">
|
<div class="layui-row">
|
<div class="layui-col-xs2">
|
<label class="layui-form-label" style="width:30px;padding-left:0px;">班组</label>
|
</div>
|
<div class="layui-col-xs10">
|
<div class="layui-col-xs10">
|
<input type="text" name="HGroupName" id="HGroupName" lay-verify="HGroupName" onkeyup="value=value.replace(/\s+/g,'')" autocomplete="off" class="layui-input" onfocus="this.select();">
|
<input type="hidden" name="HGroupID" id="HGroupID" lay-verify="HGroupID" value="0" autocomplete="off" class="layui-input">
|
</div>
|
<div class="layui-col-xs2">
|
<button type="button" lay-submit="" lay-filter="HGroupID-BT" class="layui-btn" id="HGroupID-BT">...</button>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="layui-form-item" style="padding:0px;margin:0px">
|
<div class="layui-row">
|
<div class="layui-col-xs2">
|
<label class="layui-form-label" style="width:30px;padding-left:0px;">部门</label>
|
</div>
|
<div class="layui-col-xs10">
|
<div class="layui-col-xs10">
|
<input type="text" name="HDeptName" id="HDeptName" lay-verify="HDeptName" onkeyup="value=value.replace(/\s+/g,'')" autocomplete="off" class="layui-input" onfocus="this.select();">
|
<input type="hidden" name="HDeptID" id="HDeptID" lay-verify="HDeptID" value="0" autocomplete="off" class="layui-input">
|
</div>
|
<div class="layui-col-xs2">
|
<button type="button" lay-submit="" lay-filter="HDeptID-BT" class="layui-btn" id="HDeptID-BT">...</button>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="layui-form-item" style="padding:0px;margin:0px">
|
<div class="layui-row">
|
<div class="layui-col-xs2">
|
<label class="layui-form-label" style="width:30px;padding-left:0px;">生产资源</label>
|
</div>
|
<div class="layui-col-xs10">
|
<div class="layui-col-xs10">
|
<input type="text" name="HSourceName" id="HSourceName" lay-verify="HSourceName" onkeyup="value=value.replace(/\s+/g,'')" autocomplete="off" class="layui-input" onfocus="this.select();">
|
<input type="hidden" name="HSourceID" id="HSourceID" lay-verify="HSourceID" value="0" autocomplete="off" class="layui-input">
|
</div>
|
<div class="layui-col-xs2">
|
<button type="button" lay-submit="" lay-filter="HSourceID-BT" class="layui-btn" id="HSourceID-BT">...</button>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="layui-form-item" style="padding:0px;margin:0px">
|
<div class="layui-row">
|
<div class="layui-col-xs2">
|
<label class="layui-form-label" style="width:30px;padding-left:0px;">报工数量</label>
|
</div>
|
<div class="layui-col-xs10">
|
<div class="layui-col-xs10">
|
<input type="text" name="HQty" id="HQty" lay-verify="HQty" value="0" autocomplete="off" class="layui-input" style="border-radius: 5px;background-color:#efefef4d;" disabled>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="layui-form-item" style="padding:0px;margin:0px">
|
<div class="layui-row">
|
<div class="layui-col-xs2">
|
<label class="layui-form-label" style="width:30px;padding-left:0px;">组织</label>
|
</div>
|
<div class="layui-col-xs10">
|
<input type="text" name="HPRDORGName" id="HPRDORGName" lay-verify="HPRDORGName" autocomplete="off" class="layui-input" style="border-radius: 5px;background-color:#efefef4d;" disabled>
|
<input type="hidden" name="HPRDORGID" id="HPRDORGID" lay-verify="HPRDORGID" value="0" autocomplete="off" class="layui-input">
|
</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 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="BarCodelist-table" lay-filter="BarCodelist-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="HBillerID" id="HBillerID">
|
<input type="hidden" name="HRedBlueFlag" id="HRedBlueFlag">
|
<input type="hidden" name="HSourceBillListCtl" id="HSourceBillListCtl">
|
<input type="hidden" name="HICMOInterID" id="HICMOInterID" lay-verify="HICMOInterID" value="0">
|
<input type="hidden" name="HICMOEntryID" id="HICMOEntryID" lay-verify="HICMOEntryID" value="0">
|
<input type="hidden" name="HICMOBillNo" id="HICMOBillNo" lay-verify="HICMOBillNo" value="">
|
<!--失败提示音-->
|
<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 = '3724'
|
var HMaker = sessionStorage["HUserName"]
|
var HPRDORGID = sessionStorage["OrganizationID"] //组织ID
|
var OperationType = 1 //操作类型(1新增、2从缓存列表中返回)
|
var listOption = [];
|
var BarCodelistOption = [];
|
var columns = "";
|
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() {
|
//表头初始化赋值(根据登录用户获取 默认仓库、部门、组织等) new
|
$("#HDeptID").val(sessionStorage["HDeptID"]);
|
$("#HDeptName").val(sessionStorage["HDept"]);
|
$("#HSourceID").val(sessionStorage["HSourceID"]);
|
$("#HSourceName").val(sessionStorage["HSource"]);
|
$("#HMaker").val(sessionStorage["HUserName"]);
|
$("#HDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
|
$("#HBillerID").val(sessionStorage["HBillerID"]);
|
$("#HPRDORGID").val(sessionStorage["OrganizationID"]);
|
$("#HPRDORGName").val(sessionStorage["Organization"]);
|
$("#HBillType").val("3724");
|
$("#HRedBlueFlag").val("false");
|
|
//默认显示页面
|
element.tabChange('tab-Sc_ICMOBillWorkQtyStatus_PDA', '1');
|
set_InitDate(); //初始化表单时间
|
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 }
|
]];
|
listOption.data = data;
|
table.render(listOption);
|
BarCodelistOption.data = data;
|
table.render(BarCodelistOption);
|
|
//光标默认在条码位置上
|
var pFocus = $("#HBarCode");
|
pFocus.select();
|
pFocus.focus(); //获取光标
|
}
|
|
//初始化表单时间插件
|
function set_InitDate() {
|
//常规用法
|
laydate.render({
|
elem: '#HDate'
|
});
|
}
|
//初始化表格
|
function set_InitGrid() {
|
listOption = {
|
elem: '#wl-table'
|
//, toolbar: '#toolbarDemo'
|
, totalRow: true
|
, height: 'full-60'
|
, cellMinWidth: 90
|
, limit: 200
|
, 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 }
|
]]
|
};
|
|
//条码明细
|
BarCodelistOption = {
|
elem: '#BarCodelist-table'
|
//, toolbar: '#toolbarDemo'
|
, cellMinWidth: 90
|
, limit: 3000
|
, totalRow: true
|
, cols: [[
|
{ field: 'HQty', title: '数量', width: 80, totalRow: true }
|
, { field: 'HBarCode', title: '条码编号', width: 220 }
|
, { field: 'HMaterNumber', title: '物料代码', width: 150 }
|
, { field: 'HMaterName', title: '物料名称', width: 150 }
|
, { field: 'HMaterModel', title: '规格型号', width: 150 }
|
, { field: 'HMaterID', title: 'HMaterID', width: 150, hide: true }
|
, { field: 'HSourceInterID', title: 'HSourceInterID', width: 150, hide: true }
|
, { field: 'HSourceEntryID', title: 'HSourceEntryID', width: 150, hide: true }
|
, { field: 'HSourceBillNo', title: '源单单号', width: 150 }
|
, { field: 'HInterID', title: '主ID', width: 220, hide: true }
|
|
]]
|
, height: 500
|
, done: function () {
|
layer.closeAll("loading");
|
}
|
}
|
}
|
|
//#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
|
|
//判断是否新增,获取最大单据号
|
if (HInterID != 0) {
|
HSourceFlag = true;
|
}
|
else {
|
//获取最大单据ID、单据号
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/Web/GetMAXNum",
|
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 {
|
layer.msg(d.Message, { icon: 0, btn: ['确认'], time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示" });
|
}
|
},
|
complete: function (XHR, TS) { XHR = null }//回收资源
|
});
|
HSourceFlag = false;
|
}
|
|
//#endregion
|
|
//#region 基础资料选择
|
|
//#region 仓位
|
//扫描仓位条码
|
$('#HStockPlaceName').on('keydown', function (event) {
|
if (event.keyCode == 13) {
|
//仓库文本框为空时,清空对应ID
|
if ($("#HWHName").val() == '') {
|
$("#HWHID").val("0");
|
}
|
var sHWHID = $("#HWHID").val()
|
var HStockPlaceName = $('#HStockPlaceName').val()
|
if (HStockPlaceName == '') {
|
playSound();
|
$("#HWHID").val("0");
|
$("#HWHName").val("");
|
$("#HStockPlaceID").val("0");
|
$("#HStockPlaceName").val("");
|
layer.msg("仓位条码为空!", {
|
icon: 0, time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () {
|
$("#HStockPlaceName").select();
|
$("#HStockPlaceName").focus();
|
});
|
return;
|
}
|
|
layer.load(3);
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/WEBSController/GetStockPlace_Json",
|
async: false, //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
|
data: { "HBarCode": HStockPlaceName, "HWhID": sHWHID, "HPRDORGID": HPRDORGID },
|
success: function (result) {
|
if (result.count == 1) { // 说明验证成功了,
|
$("#HStockPlaceName").val(result.data[0].HName);
|
$("#HStockPlaceID").val(result.data[0].HItemID);
|
$("#HWHName").val(result.data[0].HWhName);
|
$("#HWHID").val(result.data[0].HWHID);
|
//光标显示到条码上
|
$("#HBarCode").select();
|
$("#HBarCode").focus();
|
}
|
else {
|
playSound();
|
$("#HWHID").val("0");
|
$("#HWHName").val("");
|
$("#HStockPlaceID").val("0");
|
$("#HStockPlaceName").val("");
|
layer.msg(result.Message, {
|
icon: 0, time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () {
|
$("#HStockPlaceName").select();
|
$("#HStockPlaceName").focus();
|
});
|
}
|
layer.closeAll("loading");
|
},
|
complete: function (XHR, TS) { XHR = null }//回收资源
|
});
|
}
|
});
|
|
//仓位按钮
|
form.on('submit(HSpID-BT)', function () {
|
//仓库文本框为空时,清空对应ID
|
if ($("#HWHName").val() == '') {
|
$("#HWHID").val("0");
|
}
|
layer.open({
|
type: 2
|
, area: ['100%', '100%']
|
, title: '仓位列表'
|
, shade: 0.6 //遮罩透明度
|
, maxmin: true //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启
|
, content: ['../../../views/Baseset/基础资料/Gy_StockPlaceListNew.html?HWhID=' + $("#HWHID").val() + '&Type=HSpID&HOrgID=' + HPRDORGID + '', 'yes']
|
, resize: false
|
, cancel: function () {
|
//$(".layui-btn").removeClass("layui-btn-disabled");
|
}
|
})
|
});
|
|
//#endregion
|
|
//#region 班组
|
//扫描班组条码
|
$('#HGroupName').on('keydown', function (event) {
|
if (event.keyCode == 13) {
|
var HGroupName = $('#HGroupName').val()
|
if (HGroupName == '') {
|
playSound();
|
$("#HGroupID").val("0");
|
$("#HGroupName").val("");
|
layer.msg("班组条码为空!", {
|
icon: 0, time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () {
|
$("#HGroupName").select();
|
$("#HGroupName").focus();
|
});
|
return;
|
}
|
|
layer.load(3);
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/WEBSController/GetGroup_Json",
|
async: false, //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
|
data: { "HBarCode": HGroupName, "HPRDORGID": HPRDORGID },
|
success: function (result) {
|
if (result.count == 1) { // 说明验证成功了,
|
$("#HGroupID").val(result.data[0].HItemID);
|
$("#HGroupName").val(result.data[0].HName);
|
element.tabChange('tab-Sc_ICMOBillWorkQtyStatus_PDA', '2');
|
//光标显示到条码上
|
$("#HBarCode").select();
|
$("#HBarCode").focus();
|
}
|
else {
|
playSound();
|
$("#HGroupID").val("0");
|
$("#HGroupName").val("");
|
layer.msg(result.Message, {
|
icon: 0, time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () {
|
$("#HGroupName").select();
|
$("#HGroupName").focus();
|
});
|
}
|
layer.closeAll("loading");
|
},
|
complete: function (XHR, TS) { XHR = null }//回收资源
|
});
|
}
|
});
|
|
//班组按钮
|
form.on('submit(HGroupID-BT)', function () {
|
layer.open({
|
type: 2
|
, area: ['100%', '100%']
|
, title: '班组列表'
|
, shade: 0.6 //遮罩透明度
|
, maxmin: true //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启
|
, content: ['../../../views/Baseset/基础资料/Gy_GroupList.html?HPRDORGID=' + HPRDORGID + '', 'yes']
|
, resize: false
|
, cancel: function () {
|
//$(".layui-btn").removeClass("layui-btn-disabled");
|
}
|
})
|
});
|
|
//#endregion
|
|
//#region 部门
|
//扫描部门条码
|
$('#HDeptName').on('keydown', function (event) {
|
if (event.keyCode == 13) {
|
var HDeptName = $('#HDeptName').val()
|
if (HDeptName == '') {
|
playSound();
|
$("#HDeptID").val("0");
|
$("#HDeptName").val("");
|
layer.msg("部门条码为空!", {
|
icon: 0, time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () {
|
$("#HDeptName").select();
|
$("#HDeptName").focus();
|
});
|
return;
|
}
|
|
layer.load(3);
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/WEBSController/GetDepartment_Json",
|
async: false, //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
|
data: { "HBarCode": HDeptName },
|
success: function (result) {
|
if (result.count == 1) { // 说明验证成功了,
|
$("#HDeptID").val(result.data[0].HItemID);
|
$("#HDeptName").val(result.data[0].HName);
|
element.tabChange('tab-Sc_ICMOBillWorkQtyStatus_PDA', '2');
|
//光标显示到条码上
|
$("#HBarCode").select();
|
$("#HBarCode").focus();
|
}
|
else {
|
playSound();
|
$("#HDeptID").val("0");
|
$("#HDeptName").val("");
|
layer.msg(result.Message, {
|
icon: 0, time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () {
|
$("#HDeptName").select();
|
$("#HDeptName").focus();
|
});
|
}
|
layer.closeAll("loading");
|
},
|
complete: function (XHR, TS) { XHR = null }//回收资源
|
});
|
}
|
});
|
|
//部门按钮
|
form.on('submit(HDeptID-BT)', function () {
|
layer.open({
|
type: 2
|
, area: ['100%', '100%']
|
, title: '部门列表'
|
, shade: 0.6 //遮罩透明度
|
, maxmin: true //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启
|
, content: ['../../../views/Baseset/基础资料/Gy_DepartmentList_PDA.html?HPRDORGID=' + HPRDORGID + '&Type=HDept1', 'yes']
|
, resize: false
|
, cancel: function () {
|
//$(".layui-btn").removeClass("layui-btn-disabled");
|
}
|
})
|
});
|
|
//#endregion
|
|
//生产资源按钮
|
form.on('submit(HSourceID-BT)', function () {
|
layer.open({
|
type: 2
|
, area: ['100%', '100%']
|
, title: '部门列表'
|
, shade: 0.6 //遮罩透明度
|
, maxmin: true //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启
|
, content: ['../../../views/Baseset/基础资料/Gy_GetProductionResourcesList.html', 'yes']
|
, resize: false
|
, cancel: function () {
|
|
}
|
})
|
});
|
|
//#endregion
|
|
|
//#region 功能控件
|
|
//#region 提交
|
form.on('submit(cmdSaver)', function (data) {
|
|
var sSubStr = table.cache['wl-table'];
|
if (AllowLoadData(sSubStr) != false)//非空验证
|
{
|
save(HInterID, HBillNo, $('#HSourceID').val());
|
}
|
});
|
|
//#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 源单选择
|
|
form.on('submit(cmdHSourceBillNo)', function () {
|
var HSourceTitle = "";
|
var HSourceBillType = $("#HMainSourceBillType").val()
|
if (HSourceBillType == '3710') {
|
HSourceTitle = "生产订单";
|
}
|
|
layer.open({
|
type: 2
|
, area: ['100%', '100%']
|
, title: HSourceTitle + '列表'//标题
|
, shade: 0.6 //遮罩透明度
|
, maxmin: true //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启
|
, content: ['../../../views/公共页面/Kf_SourceBillEditDlg_PDA.html?HBillType =' + HBillType + '&HSourceBillType =' + HSourceBillType + '&HPRDORGID =' + HPRDORGID, 'yes']
|
, resize: false
|
, cancel: function () {
|
//$(".layui-btn").removeClass("layui-btn-disabled");
|
}
|
, end: function () {
|
if ($("#HSourceBillListCtl").val() == '1') {
|
GetMeesageBySourceBillNo();
|
$("#HSourceBillListCtl").val("0"); //用于区分源单列表界面关闭状态(1为返回,0为退出)
|
}
|
}
|
})
|
});
|
|
//#endregion
|
|
|
//#region 扫描源单条码
|
|
//扫描源单条码
|
$('#HSourceBillNo').on('keydown', function (event) {
|
if (event.keyCode == 13) {
|
GetMeesageBySourceBillNo();
|
}
|
});
|
|
//源单按钮
|
form.on('submit(HSourceBillNo-BT)', function (data) {
|
GetMeesageBySourceBillNo();
|
});
|
|
//扫描源单条码
|
function GetMeesageBySourceBillNo(obj) {
|
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/Sc_MESBeginStepWorkBill/Get_Sc_ICMOList",
|
async: false, //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
|
data: { "HBarCode": $("#HSourceBillNo").val(), "user": HMaker },
|
success: function (result) {
|
if (result.count == 1) { // 说明验证成功了,
|
playSound_OK();
|
element.tabChange('tab-Sc_ICMOBillWorkQtyStatus_PDA', '3');
|
var data = result.data;
|
var subarr = [];
|
|
for (var i = 0; i < data.length; i++) {
|
subarr.push({
|
"数量": 0, "物料代码": data[i].产品代码, "物料名称": data[i].产品名称, "规格型号": data[i].规格型号,
|
"辅助属性": data[i].辅助属性, "源单单号": data[i].单据号, "条码个数": 0
|
});
|
}
|
|
listOption.data = subarr;
|
table.render(listOption);
|
$("#HBarCode").select();
|
$("#HBarCode").focus();
|
}
|
else {
|
playSound();
|
layer.msg(result.Message, {
|
icon: 5, time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () {
|
element.tabChange('tab-Sc_ICMOBillWorkQtyStatus_PDA', '1');
|
$("#HSourceBillNo").select();
|
$("#HSourceBillNo").focus();
|
});
|
}
|
},
|
complete: function (XHR, TS) { XHR = null }//回收资源
|
});
|
layer.closeAll("loading");
|
}
|
|
//#endregion
|
|
|
//#region 扫描物料条码
|
|
//扫描条码
|
$('#HBarCode').on('keydown', function (event) {
|
if (event.keyCode == 13) {
|
GetMeesageByBarCode();
|
$("#HBarCode").select();
|
$("#HBarCode").focus(); //获取光标
|
}
|
});
|
|
|
//扫条码
|
function GetMeesageByBarCode(obj) {
|
var sBarCode = $('#HBarCode').val();
|
var HSourceName = $('#HSourceName').val();
|
if (sBarCode == '') {
|
playSound();
|
layer.msg("条码为空,请扫描条码!", {
|
icon: 0, time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () {
|
$("#HBarCode").select();
|
$("#HBarCode").focus();
|
});
|
return;
|
}
|
if (HSourceName == '') {
|
playSound();
|
layer.msg("生产资源为空,请选着生产资源!", {
|
icon: 0, time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () {
|
});
|
return;
|
}
|
if (sBarCode != "") {
|
$('#HBarCode').val("");
|
}
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/Sc_MESBeginStepWorkBill/Get_Gy_BarCodeBill_CusList",
|
async: false, //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
|
data: { "HBarCode": sBarCode, "user": HMaker },
|
success: function (result) {
|
if (result.count == 1) {
|
if ($("#HSourceBillNo").val() != result.data[0].HSourceBillNo) {
|
playSound();
|
layer.msg("条码对应的生产订单与当前订单不一致", {
|
icon: 5, time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () {
|
$("#HBarCode").select();
|
$("#HBarCode").focus();
|
});
|
}
|
else {
|
var exists = BarCodelistOption.data.some(function (item) {
|
return item.HBarCode === sBarCode;
|
});
|
if (exists) {
|
playSound();
|
layer.msg("该条码已被扫描,不能重复扫描", {
|
icon: 5, time: 3000, offset: 'auto', skin: 'layui-layer-lan', title: "提示"
|
}, function () {
|
$("#HBarCode").select();
|
$("#HBarCode").focus();
|
});
|
return; // 退出,不再执行后续添加逻辑
|
}
|
var saveSuccess = save_sub($('#HInterID').val(), sBarCode, $('#HSourceID').val());
|
if (!saveSuccess) {
|
// 如果保存失败,直接退出,不执行后面任何逻辑
|
return;
|
}
|
var subarr = BarCodelistOption.data;
|
subarr.push({
|
"HQty": 1, "HBarCode": sBarCode, "HMaterID": result.data[0].HItemID, "HMaterNumber": result.data[0].HNumber, "HMaterName": result.data[0].HName, "HMaterModel": result.data[0].HModel,
|
"HSourceBillNo": result.data[0].HSourceBillNo, "HSourceInterID": result.data[0].HSourceInterID,
|
"HSourceEntryID": result.data[0].HSourceEntryID, "HInterID": $("#HInterID").val()
|
});
|
|
BarCodelistOption.data = subarr;
|
table.render(BarCodelistOption);
|
listOption.data.forEach(function (item) {
|
item.数量 = (parseFloat(item.数量) || 0) + 1;
|
item.条码个数 = (parseFloat(item.条码个数) || 0) + 1;
|
});
|
table.render(listOption);
|
$("#HQty").val((parseFloat($("#HQty").val()) || 0) + 1);
|
}
|
}
|
else {
|
playSound();
|
layer.msg(result.Message, {
|
icon: 5, time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示", btn: ['确认']
|
}, function () {
|
$("#HBarCode").select();
|
$("#HBarCode").focus();
|
});
|
}
|
},
|
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").select();
|
$("#HBarCode").focus();
|
});
|
}
|
});
|
layer.closeAll("loading");
|
}
|
|
|
//#region 提交
|
|
function save(HInterID, HBIllno, HSourceID) {
|
var index = layer.load();
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "Sc_MESBeginStepWorkBill/savrSc_ICMOBillWorkQtyStatus_Tmp",
|
async: true,
|
data: { "HInterID": HInterID, "HBIllno": HBIllno, "HSourceID": HSourceID, "HQty": $("#HQty").val(), "user": sessionStorage["HUserName"] },
|
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 () {
|
if (OperationType == 2) {
|
parent.location.href = "../../WMS扫码模块/产量汇报/Sc_ICMOBillWorkQtyStatusList_PDA.html";
|
}
|
else {
|
parent.location.href = "../../../views/index_Mobile.html";
|
}
|
}//关闭
|
}
|
, function () {
|
location.replace('Sc_ICMOBillWorkQtyStatus_PDA.html?OperationType=1&HInterID=0');
|
});//新增
|
}
|
else {
|
layer.close(index);
|
layer.msg(data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
|
}
|
},
|
error: function (err) {
|
layer.close(index);
|
layer.msg("错误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
|
}
|
});
|
}
|
//扫描条码保存数据到临时表
|
function save_sub(HInterID, HBarCode, HSourceID) {
|
var index = layer.load();
|
var isSuccess = false; // 默认失败
|
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "Sc_MESBeginStepWorkBill/savrSc_ICMOBillWorkQtyStatus_Tmp_Sub",
|
async: false,
|
data: {
|
"HInterID": HInterID,
|
"HBarCode": HBarCode,
|
"HSourceID": HSourceID,
|
"user": sessionStorage["HUserName"]
|
},
|
success: function (data) {
|
if (data.count == 1) {
|
layer.close(index);
|
layer.msg("扫描成功", { icon: 1, time: 1500 });
|
isSuccess = true;
|
} else {
|
layer.close(index);
|
layer.msg(data.Message, {
|
icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示"
|
});
|
isSuccess = false;
|
}
|
},
|
error: function (err) {
|
layer.close(index);
|
layer.msg("保存条码失败:" + err.statusText, {
|
icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "系统错误"
|
});
|
isSuccess = false;
|
}
|
});
|
|
return isSuccess; // 同步返回结果
|
}
|
//#endregion
|
|
//#endregion
|
|
});
|
|
//以上为layui模块
|
//此处方法涉及到被外部页面parent.方法名调用的必须放在Layui方法外部
|
|
//点击按钮选择后 返回班组信息
|
function GetHGroupValue(obj) {
|
if (obj.length > 0) {
|
$("#HGroupName").val(obj[0].HName);
|
$("#HGroupID").val(obj[0].HItemID);
|
}
|
}
|
//点击按钮选择后 返回部门信息
|
function GetHDeptNameValue(obj) {
|
if (obj.length > 0) {
|
$("#HDeptName").val(obj[0].HName);
|
$("#HDeptID").val(obj[0].HItemID);
|
}
|
}
|
//点击按钮选择后 返回源单单号
|
function GetHSourceBillValue(obj) {
|
if (obj.length > 0) {
|
$("#HSourceBillNo").val(obj[0].单据号);
|
$("#HSourceBillListCtl").val("1");
|
}
|
}
|
//点击按钮选择后 返回生产资源信息
|
function GetProductionResourcesValue(obj) {
|
if (obj.length > 0) {
|
$("#HSourceName").val(obj[0].生产资源);
|
$("#HSourceID").val(obj[0].HItemID);
|
}
|
}
|
|
//单据上传前判断
|
function AllowLoadData(sSubStr) {
|
if (HInterID == 0) {
|
layer.msg("单据内码获取失败,错误的单据内码!", { icon: 5, btn: ['确认'], time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示" });
|
return false;
|
}
|
if (HBillNo == '') {
|
layer.msg("单据号获取失败,错误的单据号!", { icon: 5, btn: ['确认'], time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示" });
|
return false;
|
}
|
if (sSubStr.length == 0) {
|
layer.msg("没有扫码信息,请先扫描条码,确认无误后再提交!", { icon: 5, btn: ['确认'], time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示" });
|
return false;
|
}
|
//判断是否已扫描物料条码
|
else {
|
var s = 0;
|
for (var i = 0; i <= sSubStr.length - 1; i++) {
|
if (sSubStr[i].数量 > 0) {
|
s = 1;
|
}
|
}
|
if (s == 0) {
|
layer.msg("没有扫描物料条码,请先扫描物料条码,确认无误后再提交!", { icon: 5, btn: ['确认'], time: 100000, offset: 'auto', skin: 'layui-layer-lan', title: "温馨提示" });
|
return false;
|
}
|
}
|
return true;
|
}
|
</script>
|
|
</body>
|
</html>
|