<!DOCTYPE html>
|
<html>
|
<head>
|
<meta 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.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
<link rel="stylesheet" href="../../../../layuiadmin/layui/css/layui.css" media="all">
|
<link rel="stylesheet" href="../../../../layuiadmin/style/admin.css" media="all">
|
<script src="../../../../layuiadmin/layui/layui.js"></script>
|
<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>
|
<script src="../../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
|
<script src="../../../../layuiadmin/PageTitle.js"></script>
|
<style type="text/css">
|
/*.main-btn {*/ /*头部主按钮*/
|
/*padding: 0 2px;*/ /*调整按钮左右空隙大小*/
|
/*height: 30px;
|
line-height: 30px;
|
}*/
|
.btn-title {
|
font-size: 16px;
|
}
|
/* 防止下拉框的下拉列表被隐藏---必须设置--- */
|
.layui-table-cell {
|
overflow: visible !important;
|
}
|
/* 使得下拉框与单元格刚好合适 */
|
td .layui-form-select {
|
margin-top: -10px;
|
margin-left: -15px;
|
margin-right: -15px;
|
}
|
|
/* .layui-form-item .layui-inline {
|
margin-top: 0px;
|
margin-bottom: 5px;
|
margin-right: 0px;
|
}
|
|
.layui-form-label {
|
width: 25%;
|
}*/
|
</style>
|
</head>
|
<body>
|
|
<div class="layui-fluid" style="padding: 0;">
|
<div class="layui-card" style="padding: 15px;">
|
<div class="layui-card-body" style="padding: 1px;">
|
<form class="layui-form" lay-filter="component-form-group" action="">
|
<div class="layui-card-header">
|
<div class="layui-btn-group">
|
<button type="button" id="add-btn" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_SaveBill">保存</button>
|
<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_CheckBill">审核</button>
|
<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Exit">退出</button>
|
</div>
|
</div>
|
<div class="layui-tab" lay-filter="tab-POStockInBill">
|
<h1 style="text-align: center; padding: 10px 0;"><b>生产质量汇报单</b></h1>
|
<ul class="layui-tab-title" lay-filter="tab-all">
|
<li lay-id="1" style="padding:1px;" class="layui-this">基本信息</li>
|
<li lay-id="2" style="padding:1px;">制单信息</li>
|
</ul>
|
<div class="layui-tab-content">
|
<!--基本信息-->
|
<div class="layui-tab-item layui-show">
|
<div class="layui-form-item" style="padding-top: 10px;">
|
<div class="layui-row">
|
<div class="layui-inline">
|
<label class="layui-form-label">单据编号<label style="color:red"> * </label></label>
|
<div class="layui-input-inline">
|
<input type="text" class="layui-input" name="HBillNo" id="HBillNo" style="background-color:#efefef4d;" readonly>
|
<input type="hidden" name="HInterID" id="HInterID" value="0">
|
<input type="hidden" name="HBillSubType" id="HBillSubType" value="0">
|
<input type="hidden" name="HSTOCKORGID" id="HSTOCKORGID" value="0" lay-verify="HSTOCKORGID">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">日期<label style="color:red"> * </label></label>
|
<div class="layui-input-block">
|
<input type="date" class="layui-input" lay-verify="HDate" name="HDate" id="HDate" style="width:190px;">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">登记人<label style="color:red"> * </label></label>
|
<div class="layui-input-inline">
|
<input type="text" name="HEmpName" id="HEmpName" class="layui-input" value="" style="float: left; width: 150px; background-color: #efefef4d;" readonly>
|
<input type="hidden" name="HEmpID" id="HEmpID" class="layui-input" value="0" style="float:left;width:150px;">
|
<button type="button" lay-submit="" class="layui-btn" lay-filter="HEmpList" style="width:40px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
|
</button>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">生产车间</label>
|
<div class="layui-input-inline">
|
<input type="text" name="HDeptName" id="HDeptName" class="layui-input" value="" style="float: left; width: 150px; background-color: #efefef4d;" readonly>
|
<input type="hidden" name="HDeptID" id="HDeptID" class="layui-input" value="0" style="float:left;width:150px;">
|
<button type="button" lay-submit="" class="layui-btn" lay-filter="HDeptList" style="width:40px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
|
</button>
|
</div>
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-inline">
|
<label class="layui-form-label">班组</label>
|
<div class="layui-input-inline">
|
<input type="text" name="HGroupName" id="HGroupName" class="layui-input" value="" style="float: left; width: 150px; background-color: #efefef4d;" readonly>
|
<input type="hidden" name="HGroupID" id="HGroupID" class="layui-input" value="0" style="float:left;width:150px;">
|
<button type="button" lay-submit="" class="layui-btn" lay-filter="HGroupList" style="width:40px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
|
</button>
|
</div>
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-inline">
|
<label class="layui-form-label">备注</label>
|
<div class="layui-input-block">
|
<input class="layui-input" name="HRemark" id="HRemark" autocomplete="off" style="width: 1135px;">
|
</div>
|
</div>
|
</div>
|
<div class="layui-row" style="margin-top:10px;">
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">组织<label style="color:red"> * </label></label>
|
<div class="layui-input-block" style="margin-left: 120px; width: 501px;">
|
<select name="HOrgID" id="HOrgID" lay-verify="HOrgID">
|
<!--动态渲染组织-->
|
</select>
|
</div>
|
</div>
|
</div>
|
<!--隐藏字段-->
|
<div class="layui-row" style="display:none;">
|
<div class="layui-inline">
|
<div class="layui-input-block">
|
<input class="layui-input" name="HMainSourceInterID" id="HMainSourceInterID" value="0" autocomplete="off">
|
<input class="layui-input" name="HMainSourceEntryID" id="HMainSourceEntryID" value="0" autocomplete="off">
|
<input class="layui-input" name="HMainSourceBillNo" id="HMainSourceBillNo" value="" autocomplete="off">
|
<input class="layui-input" name="HMainSourceBillType" id="HMainSourceBillType" value="" autocomplete="off">
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<!--制单信息-->
|
<div class="layui-tab-item">
|
<div class="layui-form-item">
|
<div class="layui-row">
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">制单人</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" name="HMaker" id="HMaker" style="background-color:#efefef4d;" readonly>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">修改人</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" name="HUpDater" id="HUpDater" style="background-color:#efefef4d;" readonly>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">审核人</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" name="HChecker" id="HChecker" style="background-color:#efefef4d;" readonly>
|
</div>
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">制单日期</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" name="HMakeDate" id="HMakeDate" style="background-color:#efefef4d;" readonly>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">修改日期</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" name="HUpDateDate" id="HUpDateDate" style="background-color:#efefef4d;" readonly>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">审核日期</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" name="HCheckDate" id="HCheckDate" style="background-color:#efefef4d;" readonly>
|
</div>
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">关闭人</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" name="HCloseMan" id="HCloseMan" style="background-color:#efefef4d;" readonly>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">作废人</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" name="HDeleteMan" id="HDeleteMan" style="background-color:#efefef4d;" readonly>
|
</div>
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">关闭日期</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" name="HCloseDate" id="HCloseDate" style="background-color:#efefef4d;" readonly>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">作废日期</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" name="HDeleteDate" id="HDeleteDate" style="background-color:#efefef4d;" readonly>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<!--子表1-->
|
<table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
|
<script type="text/html" id="toolbarDemo">
|
<div class="layui-btn-container">
|
<!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-AddLine"><i class="layui-icon layui-icon-form"></i>增加一行</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-InsertLine"><i class="layui-icon layui-icon-form"></i>插入一行</button>-->
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-CopyLine"><i class="layui-icon layui-icon-form"></i>复制一行</button>
|
<!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Up"><i class="layui-icon layui-icon-form"></i>上移</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Under"><i class="layui-icon layui-icon-form"></i>下移</button>-->
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn"><i class="layui-icon layui-icon-form"></i>列设置</button>
|
</div>
|
</script>
|
|
<script type="text/html" id="xuhao">
|
{{d.LAY_TABLE_INDEX+1}}
|
</script>
|
</form>
|
</div>
|
</div>
|
</div>
|
<script type="text/html" id="barDemo">
|
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
</script>
|
<!--行下拉选择(判定结果)-->
|
<script type="text/html" id="HResult">
|
<select name="HResult" lay-filter="HResult" id="HResult{{d.LAY_TABLE_INDEX+1}}">
|
<option value="报废">报废</option>
|
<option value="返工">返工</option>
|
<option value="特采">特采</option>
|
<option value="放行">放行</option>
|
<option value="工废">工废</option>
|
<option value="料废">料废</option>
|
<option value="样件保留">样件保留</option>
|
<option value="">请选择</option>
|
</select>
|
</script>
|
<!--物料代码单元格按钮-->
|
<script type="text/html" id="HMaterNumberbtn">
|
<input type="text" class="layui-input" name="HMaterNumber" id="HMaterNumber{{d.LAY_TABLE_INDEX+1}}" style="float:left;width:105px;height:175%;margin: -5px -5px -30px -15px !important"><!--上右下左-->
|
<a class="layui-btn layui-btn-xs layui-btn-normal" layui-icon-search lay-event="HMaterNumberbtn" style="float:right;width:35px;height:38px; background-color:transparent;border-style:none;color:black;font-size:20px;">...</a>
|
</script>
|
<!--当前工序单元格按钮-->
|
<script type="text/html" id="HNowProcNamebtn">
|
<input type="text" class="layui-input" name="HNowProcName" id="HNowProcName{{d.LAY_TABLE_INDEX+1}}" style="float:left;width:105px;height:175%;margin: -5px -5px -30px -15px !important"><!--上右下左-->
|
<a class="layui-btn layui-btn-xs layui-btn-normal" layui-icon-search lay-event="HNowProcNamebtn" style="float:right;width:35px;height:38px; background-color:transparent;border-style:none;color:black;font-size:20px;">...</a>
|
</script>
|
<!--责任工序单元格按钮-->
|
<script type="text/html" id="HBadProcNamebtn">
|
<input type="text" class="layui-input" name="HBadProcName" id="HBadProcName{{d.LAY_TABLE_INDEX+1}}" style="float:left;width:105px;height:175%;margin: -5px -5px -30px -15px !important"><!--上右下左-->
|
<a class="layui-btn layui-btn-xs layui-btn-normal" layui-icon-search lay-event="HBadProcNamebtn" style="float:right;width:35px;height:38px; background-color:transparent;border-style:none;color:black;font-size:20px;">...</a>
|
</script>
|
<!--检验员单元格按钮-->
|
<script type="text/html" id="HEmpNamebtn">
|
<input type="text" class="layui-input" name="HEmpName" id="HEmpName{{d.LAY_TABLE_INDEX+1}}" style="float:left;width:105px;height:175%;margin: -5px -5px -30px -15px !important"><!--上右下左-->
|
<a class="layui-btn layui-btn-xs layui-btn-normal" layui-icon-search lay-event="HEmpNamebtn" style="float:right;width:35px;height:38px; background-color:transparent;border-style:none;color:black;font-size:20px;">...</a>
|
</script>
|
<!--生产资源单元格按钮-->
|
<script type="text/html" id="HSourceNamebtn">
|
<input type="text" class="layui-input" name="HSourceName" id="HSourceName{{d.LAY_TABLE_INDEX+1}}" style="float:left;width:105px;height:175%;margin: -5px -5px -30px -15px !important"><!--上右下左-->
|
<a class="layui-btn layui-btn-xs layui-btn-normal" layui-icon-search lay-event="HSourceNamebtn" style="float:right;width:35px;height:38px; background-color:transparent;border-style:none;color:black;font-size:20px;">...</a>
|
</script>
|
<!--不良原因单元格按钮-->
|
<script type="text/html" id="HBadReasonbtn">
|
<input type="text" class="layui-input" name="HBadReason" id="HBadReason{{d.LAY_TABLE_INDEX+1}}" style="float:left;width:105px;height:175%;margin: -5px -5px -30px -15px !important"><!--上右下左-->
|
<a class="layui-btn layui-btn-xs layui-btn-normal" layui-icon-search lay-event="HBadReasonbtn" style="float:right;width:35px;height:38px; background-color:transparent;border-style:none;color:black;font-size:20px;">...</a>
|
</script>
|
<!--不良现象单元格按钮-->
|
<script type="text/html" id="HBadPhenomenabtn">
|
<input type="text" class="layui-input" name="HBadPhenomena" id="HBadPhenomena{{d.LAY_TABLE_INDEX+1}}" style="float:left;width:105px;height:175%;margin: -5px -5px -30px -15px !important"><!--上右下左-->
|
<a class="layui-btn layui-btn-xs layui-btn-normal" layui-icon-search lay-event="HBadPhenomenabtn" style="float:right;width:35px;height:38px; background-color:transparent;border-style:none;color:black;font-size:20px;">...</a>
|
</script>
|
<script>
|
//#region 折叠注释
|
var HDataTemp = {};
|
//#endregion
|
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 option = {};
|
//记录组织的值
|
var HOrgIDBar = 0;
|
|
//获取页面跳转参数
|
var params = get_UrlVars();
|
var OperationType = params[params[0]]; //从参数中获取 数据类型 1添加 保存 2复制 3 编辑
|
var linterid = params[params[1]]; //从参数中获取 单据内码
|
var HBillSubType = params[params[2]]; //从参数中获取 单据子类型
|
var HEntryID = params[params[4]]; //获取单据子id
|
//#endregion
|
|
|
|
|
//#region 【动态获取模块名称】
|
var HModuleType = "3717";
|
//通过单据类型,从数据库动态获取单据模块命名,引用js文件 PageTitle.js
|
if (HBillSubType == '3717-1') {
|
var HPageTitle = "微瑕品记录单";
|
} else {
|
var HPageTitle = get_PageTitle(HModuleType) == "" ? $("h1").html() : get_PageTitle(HModuleType);
|
}
|
$("h1").html('<b>' + HPageTitle + '</b>');
|
//#endregion
|
|
//模块名
|
var HModName = "Sc_QualityReportStepBill_New";
|
var HBillType = "3717";
|
|
//#region 进入页面即加载
|
|
//#region 判断是否登录 未登录则跳到登录页
|
get_LoginIs();
|
//#endregion
|
|
//#region 判断并设置操作类型、页面初始化
|
if (OperationType == null || OperationType == 1) { //新增
|
//新增页面初始化
|
Init_setAdd();
|
}
|
else if (OperationType == 3) { //编辑
|
$("#HInterID").val(linterid);
|
//子表初始化
|
set_InitGrid();
|
//加载表体和表体数据
|
RoadBillMain(linterid);
|
}
|
else if (OperationType == 4) { //下推
|
//子表初始化
|
set_InitGrid();
|
setInit_PushByICMOBill(linterid);
|
}
|
else if (OperationType == 5) { //流转卡下推
|
//子表初始化
|
set_InitGrid();
|
set_ProcessBill(linterid, HEntryID);
|
}
|
else if (OperationType == 6) { //出站汇报单下推
|
//子表初始化
|
set_InitGrid();
|
set_StationOutBill(linterid);
|
}
|
//#endregion
|
|
//#region 初始化组织
|
Organ();
|
//#endregion
|
|
//#region 列设置:子表1
|
DisPlay_HideColumn();
|
//#endregion
|
//#endregion
|
|
//#region 触发事件:包括form.on(){}格式的所有点击事件、选择事件等
|
//#region 弹窗选择触发事件
|
//#region 选择生产车间按钮
|
form.on('submit(HDeptList)', function () {
|
get_checkDept();
|
});
|
//#endregion
|
|
//#region 选择登记人按钮
|
form.on('submit(HEmpList)', function () {
|
get_checkEmp();
|
});
|
//#endregion
|
|
//#region 选择班组按钮
|
form.on('submit(HGroupList)', function () {
|
get_checkGroup();
|
});
|
//#endregion
|
//#endregion
|
|
//#region 表头按钮触发事件
|
//#region 保存按钮
|
form.on('submit(set_SaveBill)', function (data) {
|
if (OperationType == 4) {
|
//#region 判断源单状态
|
var HSourceBillData = "";
|
var HSourceBillData = getSourceBillStatus_ICMOBill(); //获取源单数据
|
if (HSourceBillData != "none") {
|
if (HSourceBillData.length == 0) {
|
layer.alert("保存失败!未查询到源单单据!", { icon: 5 });
|
return;
|
} else if (HSourceBillData[0]["单据状态"] != "已审核") {
|
var err = "保存失败!原因:源单单据状态为“" + HSourceBillData[0]["状态"] + "”,不允许保存!";
|
layer.alert(err, { icon: 5 });
|
return;
|
}
|
} else {
|
return;
|
}
|
//#endregion
|
}
|
if (AllowLoadData(data)) {
|
set_SaveBill(data);
|
}
|
});
|
//#endregion
|
|
//#region 审核按钮
|
form.on('submit(set_CheckBill)', function (data) {
|
set_CheckBill(0);
|
});
|
//#endregion
|
|
//#region 退出按钮
|
form.on('submit(Exit)', function () {
|
if (params[1] != null) {
|
Pub_Close(1);
|
} else if (params[1] == null) {
|
Pub_Close(2);
|
}
|
})
|
//#endregion
|
//#endregion
|
|
//#region 子表相关监听事件
|
//#region 子表1:头工具栏按钮触发事件
|
table.on('toolbar(mainTable)', function (obj) {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
|
//新增行表格数据
|
var NewRow = {
|
"HMaterID": "0",
|
"物料代码": "",
|
"物料名称": "",
|
"规格型号": "",
|
"HPRocID": "0",
|
"工序": "",
|
"HNowProcID": "0",
|
"当前工序": "",
|
"HBadProcID": "0",
|
"责任工序": "",
|
"HUnitID": "0",
|
"计量单位": "",
|
"HQty": "0",
|
"HResult": "报废",
|
"HEmpID": "0",
|
"检验员": "",
|
"HSourceID": "0",
|
"生产资源": "",
|
"HBadReasonID": "0",
|
"不良原因": "",
|
"HBadPhenomenaID": "0",
|
"不良现象": "",
|
"HBarCode": "",
|
"HReportType": "3",
|
"HRemark": "",
|
"HICMOInterID": "0",
|
"HICMOEntryID": "0",
|
"HICMOBillNo": "",
|
"HProcExchInterID": "0",
|
"HProcExchEntryID": "0",
|
"HProcExchBillNo": "",
|
"HSourceInterID": "0",
|
"HSourceEntryID": "0",
|
"HSourceBillNo": "",
|
"HSourceBillType": "",
|
"HAddr": "",
|
"HMaker": "",
|
"HMakeDate": Format(new Date(), 'yyyy-MM-dd')
|
};
|
switch (obj.event) {
|
//新增一行
|
case 'btn-AddLine': btnAddLine(NewRow);
|
break;
|
//复制一行
|
case 'btn-CopyLine': btnCopyLine(data);
|
break;
|
//指定位置下插入一行
|
case 'btn-InsertLine': btnInsertLine(NewRow)
|
break;
|
//上移
|
case 'btn-Up': btn_up();
|
break;
|
//下移
|
case 'btn-Under': btn_under();
|
break;
|
//列设置
|
case 'set_HideColumn':
|
get_HideColumn();
|
break;
|
}
|
});
|
//#endregion
|
|
//#region 行内事件
|
table.on('tool(mainTable)', function (obj) {
|
set_GridDelete(obj); //行内删除
|
set_GridCellCheck(obj); //行内快捷键筛选
|
//设置 新发货时间
|
if (obj.event == 'HDate_New') {
|
var data = obj.data;
|
var field = $(this).data('field');
|
laydate.render({
|
elem: this.firstChild
|
, show: true //直接显示
|
, closeStop: this
|
, done: function (nowDate) {
|
//时间选择完成,行数据更新
|
data[field] = nowDate;
|
obj.update(data);
|
}
|
});
|
}
|
//物料
|
if (obj.event == 'HMaterNumberbtn') {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "物料列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../../基础资料/公用基础资料/Gy_Material.html?openType=2&HOrgID=' + HOrgID, 'yes']
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
|
obj.update({
|
"HMaterID": checkStatus.data[0].HItemID
|
, "物料代码": checkStatus.data[0].物料代码
|
, "物料名称": checkStatus.data[0].物料名称
|
})
|
$("#HMaterNumber" + (Number($(obj.tr).attr("data-index")) + Number(1))).val(checkStatus.data[0].物料代码)
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
if (JSON.stringify(HDataTemp) != '{}') {
|
//更新表格缓存的数据
|
obj.update({
|
"HMaterID": HDataTemp.HItemID
|
, "物料代码": HDataTemp.物料代码
|
, "物料名称": HDataTemp.物料名称
|
, "规格型号": HDataTemp.规格型号
|
, "HUnitID": HDataTemp.HUnitID
|
, "计量单位": HDataTemp.计量单位名称
|
})
|
HDataTemp = {};
|
}
|
if (option.data[$(obj.tr).attr("data-index")].物料代码 != '') {
|
$("#HMaterNumber" + (Number($(obj.tr).attr("data-index")) + Number(1))).val(option.data[$(obj.tr).attr("data-index")].物料代码);
|
return;
|
}
|
}
|
})
|
}
|
//当前工序
|
if (obj.event == 'HNowProcNamebtn') {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "当前工序列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../../基础资料/生产基础资料/Gy_Process.html?openType=2', 'yes']
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
//更新表格缓存的数据
|
obj.update({
|
"HNowProcID": checkStatus.data[0].HItemID
|
, "当前工序": checkStatus.data[0].工序名称
|
})
|
$("#HNowProcName" + (Number($(obj.tr).attr("data-index")) + Number(1))).val(checkStatus.data[0].工序名称)
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
}
|
})
|
}
|
//责任工序
|
if (obj.event == 'HBadProcNamebtn') {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "责任工序列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../../基础资料/生产基础资料/Gy_Process.html?openType=2', 'yes']
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
//更新表格缓存的数据
|
obj.update({
|
"HBadProcID": checkStatus.data[0].HItemID
|
, "责任工序": checkStatus.data[0].工序名称
|
})
|
$("#HBadProcName" + (Number($(obj.tr).attr("data-index")) + Number(1))).val(checkStatus.data[0].工序名称)
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
}
|
})
|
}
|
//检验员
|
if (obj.event == 'HEmpNamebtn') {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "检验员列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../../基础资料/公用基础资料/Gy_EmployeeList.html?Type=HSecManager&openType=2', 'yes']
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
//更新表格缓存的数据
|
obj.update({
|
"检验员": checkStatus.data[0].职员名称
|
, "HEmpID": checkStatus.data[0].HItemID
|
})
|
$("#HEmpName" + (Number($(obj.tr).attr("data-index")) + Number(1))).val(checkStatus.data[0].职员名称)
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
if (JSON.stringify(HDataTemp) != '{}') {
|
//更新表格缓存的数据
|
obj.update({
|
"HEmpID": HDataTemp.HItemID
|
, "检验员": HDataTemp.职员名称
|
})
|
HDataTemp = {};
|
}
|
}
|
})
|
}
|
//生产资源
|
if (obj.event == 'HSourceNamebtn') {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "生产资源列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../../基础资料/生产基础资料/Gy_Source.html?Htype=&openType=2', 'yes']
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
//更新表格缓存的数据
|
obj.update({
|
"生产资源": checkStatus.data[0].生产资源名称
|
, "HSourceID": checkStatus.data[0].HItemID
|
})
|
$("#HSourceName" + (Number($(obj.tr).attr("data-index")) + Number(1))).val(checkStatus.data[0].生产资源名称)
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
if (JSON.stringify(HDataTemp) != '{}') {
|
//更新表格缓存的数据
|
obj.update({
|
"HSourceID": HDataTemp.HItemID
|
, "生产资源": HDataTemp.生产资源名称
|
})
|
HDataTemp = {};
|
}
|
}
|
})
|
}
|
//不良原因
|
if (obj.event == 'HBadReasonbtn') {
|
var HProcName = obj.data.工序;
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "不良原因列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../../基础资料/生产基础资料/Gy_BadReason.html?Type=BadReason&HProcName=' + HProcName + '&openType=2', 'yes']
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
//更新表格缓存的数据
|
obj.update({
|
"不良原因": checkStatus.data[0].不良原因名称
|
, "HBadReasonID": checkStatus.data[0].HItemID
|
})
|
$("#HBadReason" + (Number($(obj.tr).attr("data-index")) + Number(1))).val(checkStatus.data[0].不良原因名称)
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
if (JSON.stringify(HDataTemp) != '{}') {
|
//更新表格缓存的数据
|
obj.update({
|
"HBadReasonID": HDataTemp.HItemID
|
, "不良原因": HDataTemp.不良原因名称
|
})
|
HDataTemp = {};
|
}
|
}
|
})
|
}
|
//不良现象
|
if (obj.event == 'HBadPhenomenabtn') {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "不良现象" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../../基础资料/公用基础资料/Gy_BadPhenomena.html?openType=2', "yes"]
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
obj.update({
|
"HBadPhenomenaID": checkStatus.data[0].HItemID
|
, "不良现象": checkStatus.data[0].不良现象名称
|
})
|
$("#HBadPhenomena" + (Number($(obj.tr).attr("data-index")) + Number(1))).val(checkStatus.data[0].不良现象名称)
|
layer.close(index);//关闭弹窗
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
});
|
//#endregion
|
|
//#region 监听单元格编辑 单元格编辑后 变更
|
table.on('edit(mainTable)', function (obj) {
|
//数值格式校验工具
|
var ref = /^\d+(\.\d+)?$/; //非负数正则表达式
|
var temp = "";
|
|
// 单元格编辑之前的值
|
var oldText = $(this).prev().text();
|
var value = obj.value //得到修改后的值
|
, data = obj.data //得到所在行所有键值
|
, field = obj.field; //得到字段
|
//layer.msg('[ID: ' + data.id + '] ' + field + ' 字段更改为:' + value);
|
|
switch (field) {
|
case "HQty": //数量
|
//数据格式校验
|
temp = value + "";
|
if (!ref.test(temp) || temp == 0) {
|
//恢复数据到编辑前
|
obj.update({
|
HQty: oldText
|
});
|
table.render(option);
|
|
//刷新表格同时根据option中HResult值设置下拉列表
|
setSelectHResultByTableRender();
|
|
layer.msg("数量请输入大于0的数字!");
|
return;
|
}
|
//同步更新表格和缓存对应的值
|
obj.update({
|
HQty: value
|
});
|
break;
|
default:
|
}
|
});
|
//#endregion
|
|
//#region 表格行选择处理(下拉列表-判定结果)
|
form.on('select(HResult)', function (data) {
|
//获取下拉框选中的值
|
var elem = data.othis.parents('tr');
|
var dataindex = elem.attr("data-index");
|
$.each(option.data, function (index, value) {
|
if (index == dataindex) {
|
value.HResult = data.value;
|
}
|
});
|
});
|
//#endregion
|
|
//#endregion
|
//#endregion
|
|
|
//#region 本页面所有被调用的方法
|
//#region 判断是否登录 未登录则跳到登录页
|
function get_LoginIs() {
|
if (sessionStorage.login != "login") {
|
layer.confirm("登录失效,请重新登录!", {
|
icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
|
}, function () { window.location.href = "../../../user/login.html"; });
|
}
|
}
|
//#endregion
|
|
//#region 时间转换
|
function formatDate(date) {
|
var d = new Date(date),
|
month = '' + (d.getMonth() + 1),
|
day = '' + d.getDate(),
|
year = d.getFullYear();
|
|
if (month.length < 2) {
|
month = '0' + month;
|
}
|
if (day.length < 2) {
|
day = '0' + day;
|
}
|
|
return [year, month, day].join('-');
|
}
|
//#endregion
|
|
//#region 获取组织
|
function Organ() {
|
//获取登录页组织列
|
var Organization = '';
|
$.ajax({
|
type: "get",
|
url: GetWEBURL() + "/Web/GetOrganizations",
|
success: function (result) {
|
if (result.count == 1) { // 说明验证成功了,
|
var data = result.data;
|
for (var i = 0; i < data.length; i++) {
|
Organization += '<option style="color:blue;" value="' + data[i].ID + '">' + data[i].Name + '</option>';
|
}
|
$("#HOrgID").append(Organization);
|
if (OperationType == 1 || OperationType == 4 || OperationType == 3) {
|
HOrgIDBar = sessionStorage["OrganizationID"];
|
}
|
$("#HOrgID").val(HOrgIDBar);
|
form.render('select');
|
}
|
layer.closeAll("loading");
|
}
|
})
|
}
|
//#endregion
|
|
//#region 生成单据号
|
function createBillNo() {
|
$.ajax({
|
url: GetWEBURL() + "/Web/GetMAXNum",
|
type: "GET",
|
data: { "HBillType": HBillType },
|
success: function (d) {
|
$("#HInterID").val(d.data[0].HInterID);
|
$("#HBillNo").val(d.data[0].HBillNo);
|
}
|
});
|
}
|
//#endregion
|
|
//#region 子表1初始化
|
function set_InitGrid() {
|
option = {
|
elem: '#mainTable'
|
, toolbar: '#toolbarDemo'
|
, totalRow: true
|
, limit: 500
|
, height: 500
|
, loading: false
|
, cols: [[ //子表
|
{ type: 'checkbox', totalRowText: '合计行' }
|
, { type: 'numbers', title: '序号', width: 100, style: "background-color:#efefef4d;" }
|
, { field: 'HMaterID', title: 'HMaterID', width: 100, style: "background-color:#efefef4d;", hide: true }
|
, { field: '物料代码', title: '物料代码', width: 150, event: "HMaterID", edit: 'text', templet: '#HMaterNumberbtn' }//f7
|
, { field: '物料名称', title: '物料名称', width: 150, style: "background-color:#efefef4d;" }
|
, { field: '规格型号', title: '规格型号', width: 150, style: "background-color:#efefef4d;" }
|
, { field: 'HProcID', title: 'HProcID', width: 100, style: "background-color:#efefef4d;", hide: true }
|
, { field: '工序', title: '工序', width: 150 }
|
, { field: 'HNowProcID', title: 'HNowProcID', width: 100, style: "background-color:#efefef4d;", hide: true }
|
, { field: '当前工序', title: '当前工序', width: 150, event: "HNowProcID", edit: 'text', templet: '#HNowProcNamebtn' }
|
, { field: 'HBadProcID', title: 'HBadProcID', width: 100, style: "background-color:#efefef4d;", hide: true }
|
, { field: '责任工序', title: '责任工序', width: 150, event: "HBadProcID", edit: 'text', templet: '#HBadProcNamebtn' }
|
, { field: 'HUnitID', title: 'HUnitID', width: 100, style: "background-color:#efefef4d;", hide: true }
|
, { field: '计量单位', title: '计量单位', width: 100, style: "background-color:#efefef4d;" }//f7
|
, { field: 'HQty', title: '数量', width: 100, totalRow: true, edit: 'text' }
|
, { field: 'HResult', title: '判定结果', width: 100, templet: '#HResult' }
|
, { field: 'HEmpID', title: 'HEmpID', width: 100, style: "background-color:#efefef4d;", hide: true }
|
, { field: '检验员', title: '检验员', width: 150, event: "HEmp", edit: 'text', templet: '#HEmpNamebtn' }
|
, { field: 'HSourceID', title: 'HSourceID', width: 100, style: "background-color:#efefef4d;", hide: true }
|
, { field: '生产资源', title: '生产资源', width: 150, event: "HSource", edit: 'text', templet: '#HSourceNamebtn' }
|
, { field: 'HBadReasonID', title: 'HBadReasonID', width: 100, style: "background-color:#efefef4d;", hide: true }
|
, { field: '不良原因', title: '不良原因', width: 150, event: "HBadReason", edit: 'text', templet: '#HBadReasonbtn' }
|
, { field: 'HBadPhenomenaID', title: 'HBadPhenomenaID', width: 100, style: "background-color:#efefef4d;", hide: true }
|
, { field: '不良现象', title: '不良现象', width: 150, event: "HBadPhenomena", edit: 'text', templet: '#HBadPhenomenabtn' }
|
, { field: 'HRemark', title: '备注', width: 100, edit: 'text' }
|
|
, { field: 'HICMOInterID', title: '生产订单主内码', hide: true, style: 'background-color: #f9f9f9;' } //f7
|
, { field: 'HICMOEntryID', title: '生产订单子内码', hide: true, style: 'background-color: #f9f9f9;' } //f7
|
, { field: 'HICMOBillNo', title: '生产订单号', width: 160, style: 'background-color: #f9f9f9;' } //f7
|
, { field: 'HProcExchInterID', title: '工序流转卡内码', hide: true, style: 'background-color: #f9f9f9;' } //f7
|
, { field: 'HProcExchEntryID', title: '工序流转卡子内码', hide: true, style: 'background-color: #f9f9f9;' } //f7
|
, { field: 'HProcExchBillNo', title: '工序流转卡号', width: 160, style: 'background-color: #f9f9f9;' } //f7
|
, { field: 'HSourceInterID', title: '源单内码', hide: true, style: 'background-color: #f9f9f9;' } //f7
|
, { field: 'HSourceEntryID', title: '源单子内码', hide: true, style: 'background-color: #f9f9f9;' } //f7
|
, { field: 'HSourceBillNo', title: '源单单号', hide: true, style: 'background-color: #f9f9f9;' } //f7
|
, { field: 'HSourceBillType', title: '源单类型', hide: true, style: 'background-color: #f9f9f9;' } //f7
|
|
, { field: 'HBarCode', title: '条形码', width: 100, hide: true }
|
, { field: 'HReportType', title: '汇报类型', width: 100, hide: true }
|
, { field: 'HAddr', title: 'MAC机器地址', width: 100, hide: true }
|
, { field: 'HMaker', title: '扫描人', width: 100, hide: true }
|
, { field: 'HMakeDate', title: '扫描日期', width: 100, hide: true }
|
|
, { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 70 }
|
]]
|
, done: function (res, curr, count) {
|
option.data = res.data;
|
//去掉下拉框失焦事件否则在下拉框里输入值
|
$('.layui-form-select').find('input').unbind("blur");
|
//表格重载回显下拉框里的数据
|
$('tr').each(function (e) {
|
var $cr = $(this);
|
var dataIndex = $cr.attr("data-index");
|
$.each(option.data, function (index, value) {
|
if (value.LAY_TNDEX == dataIndex) {
|
$cr.find('input').val(value.HResult);
|
}
|
});
|
});
|
}
|
}
|
|
|
|
var rowdata = [{
|
"HMaterID": "0",
|
"物料代码": "",
|
"物料名称": "",
|
"规格型号": "",
|
"HPRocID": "0",
|
"工序": "",
|
"HNowProcID": "0",
|
"当前工序": "",
|
"HBadProcID": "0",
|
"责任工序": "",
|
"HUnitID": "0",
|
"计量单位": "",
|
"HQty": "0",
|
"HResult": "报废",
|
"HEmpID": "0",
|
"检验员": "",
|
"HSourceID": "0",
|
"生产资源": "",
|
"HBadReasonID": "0",
|
"不良原因": "",
|
"HBadPhenomenaID": "0",
|
"不良现象": "",
|
"HBarCode": "",
|
"HReportType": "3",
|
"HRemark": "",
|
"HICMOInterID": "0",
|
"HICMOEntryID": "0",
|
"HICMOBillNo": "",
|
"HProcExchInterID": "0",
|
"HProcExchEntryID": "0",
|
"HProcExchBillNo": "",
|
"HSourceInterID": "0",
|
"HSourceEntryID": "0",
|
"HSourceBillNo": "",
|
"HSourceBillType": "",
|
"HAddr": "",
|
"HMaker": "",
|
"HMakeDate": Format(new Date(), 'yyyy-MM-dd')
|
}];
|
|
option.data = rowdata;
|
table.render(option);
|
}
|
//#endregion
|
|
//#region 新增页面初始化
|
function Init_setAdd() {
|
//设置操作类型为 新增
|
OperationType = 1;
|
|
//生成并设置主表的内码和单据号
|
createBillNo();
|
|
//相关文本框信息初始化
|
$("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
|
$("#HMaker").val(sessionStorage["HUserName"]);
|
$("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
|
|
//初始化并列设置:子表1
|
set_InitGrid();
|
DisPlay_HideColumn();
|
}
|
//#endregion
|
|
//#region 编辑页面初始化
|
function RoadBillMain(linterid) {
|
//查询检验方案单是否存在
|
var ajaxLoad = layer.load();
|
$.ajax({
|
url: GetWEBURL() + "/Sc_QualityReportBill/cx",
|
async: false,
|
type: "GET",
|
data: {
|
"HInterID": linterid
|
},
|
success: function (result) {
|
if (result.code == 1) { // 说明验证成功了,
|
var data = result.data[0];
|
|
form.val("component-form-group", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
|
"HBillNo": data.单据号
|
, "HDate": formatDate(data.日期)
|
, "HEmpID": data.HMainEmpID
|
, "HEmpName": data.登记人
|
, "HDeptID": data.HDeptID
|
, "HDeptName": data.生产车间
|
, "HGroupID": data.HGroupID
|
, "HGroupName": data.班组
|
, "HRemark": data.表头备注
|
|
, "HMainSourceInterID": data.HMainSourceInterID
|
, "HMainSourceEntryID": data.HMainSourceEntryID
|
, "HMainSourceBillNo": data.HMainSourceBillNo
|
, "HMainSourceBillType": data.HMainSourceBillType
|
|
, "HMaker": data.制单人
|
, "HMakeDate": data.制单人 == "" ? "" : formatDate(data.制单日期)
|
, "HUpDater": data.修改人
|
, "HUpDateDate": data.修改人 == "" ? "" : formatDate(data.修改日期)
|
, "HChecker": data.审核人
|
, "HCheckDate": data.审核人 == "" ? "" : formatDate(data.审核日期)
|
, "HCloseMan": data.关闭人
|
, "HCloseDate": data.关闭人 == "" ? "" : formatDate(data.关闭日期)
|
, "HDeleteMan": data.作废人
|
, "HDeleteDate": data.作废人 == "" ? "" : formatDate(data.作废日期)
|
});
|
|
//组织的值HOrgID变化,重新渲染
|
HOrgIDBar = data.HOrgID;
|
|
//子表 赋值
|
var rowdata = [];
|
for (var i = 0; i < result.data.length; i++) {
|
data = result.data[i];
|
rowdata.push(
|
{
|
"HMaterID": data.HMaterID,
|
"物料代码": data.物料代码,
|
"物料名称": data.物料名称,
|
"规格型号": data.规格型号,
|
"HUnitID": data.HUnitID,
|
"计量单位": data.计量单位,
|
"HQty": data.数量,
|
"HProcID": data.HProcID,
|
"工序": data.工序名称,
|
"HNowProcID": data.HNowProcID,
|
"当前工序": data.当前工序,
|
"HBadProcID": data.HBadProcID,
|
"责任工序": data.责任工序,
|
"HResult": data.判定结果,
|
"HEmpID": data.HEmpID,
|
"检验员": data.检验员,
|
"HSourceID": data.HSourceID,
|
"生产资源": data.生产资源,
|
"HBadReasonID": data.HBadReasonID,
|
"不良原因": data.不良原因,
|
"HBadPhenomenaID": data.HBadPhenomenaID,
|
"不良现象": data.不良现象,
|
"HBarCode": data.HBarCode,
|
"HReportType": data.HReportType,
|
"HRemark": data.备注,
|
"HICMOInterID": data.HICMOInterID,
|
"HICMOEntryID": data.HICMOEntryID,
|
"HICMOBillNo": data.HICMOBillNo,
|
"HProcExchInterID": data.HProcExchInterID,
|
"HProcExchEntryID": data.HProcExchEntryID,
|
"HProcExchBillNo": data.HProcExchBillNo,
|
"HSourceInterID": data.HSourceInterID,
|
"HSourceEntryID": data.HSourceEntryID,
|
"HSourceBillNo": data.HSourceBillNo,
|
"HSourceBillType": data.HSourceBillType,
|
"HAddr": data.HAddr,
|
"HMaker": data.HMaker,
|
"HMakeDate": formatDate(data.HMakeDate),
|
}
|
);
|
}
|
option.data = rowdata;
|
|
table.render(option);
|
|
//刷新表格同时根据option中HResult值设置下拉列表
|
setSelectHResultByTableRender();
|
|
for (var i = 1; i <= option.data.length; i++) {
|
$('#HMaterNumber' + i + '').val(option.data[i - 1].物料代码);
|
$('#HNowProcName' + i + '').val(option.data[i - 1].当前工序);
|
$('#HBadProcName' + i + '').val(option.data[i - 1].责任工序);
|
$('#HEmpName' + i + '').val(option.data[i - 1].检验员);
|
$('#HSourceName' + i + '').val(option.data[i - 1].生产资源);
|
$('#HBadReason' + i + '').val(option.data[i - 1].不良原因);
|
$('#HBadPhenomena' + i + '').val(option.data[i - 1].不良现象);
|
}
|
form.render('select');
|
|
layer.close(ajaxLoad);
|
} else {
|
layer.close(ajaxLoad);
|
layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
|
}
|
}, error: function () {
|
layer.close(ajaxLoad);
|
layer.alert("发生错误!", { icon: 5 });
|
}
|
});
|
}
|
//#endregion
|
|
//#region (生产订单)下推页面初始化
|
function setInit_PushByICMOBill(linterid) {
|
//生成并设置主表的内码和单据号
|
createBillNo();
|
|
//相关文本框信息初始化
|
$("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
|
$("#HMaker").val(sessionStorage["HUserName"]);
|
$("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
|
|
//查询生产订单是否存在
|
var ajaxLoad = layer.load();
|
var sWhere = " and HPRDORGID=" + sessionStorage["OrganizationID"] + " and hmainid='" + linterid + "' and HEntryID=" + HEntryID;
|
$.ajax({
|
url: GetWEBURL() + "/LEMS/MES_IF_ICMOBillList_Json",
|
type: "GET",
|
async: false,
|
data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
|
success: function (d) {
|
var result = d;
|
|
if (result.code == 1) { // 说明验证成功了,
|
var data = result.data[0];
|
|
form.val("component-form-group", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
|
"HEmpID": data.HEmpID
|
, "HEmpName": data.业务员
|
, "HDeptID": data.HDeptID
|
, "HDeptName": data.生产车间
|
|
, "HMainSourceInterID": linterid
|
, "HMainSourceEntryID": HEntryID
|
, "HMainSourceBillNo": data.单据号
|
, "HMainSourceBillType": params[params[2]]
|
});
|
|
//组织的值HOrgID变化,重新渲染
|
HOrgIDBar = data.HOrgID;
|
|
//子表 赋值
|
var rowdata = [];
|
for (var i = 0; i < result.data.length; i++) {
|
rowdata.push(
|
{
|
"HMaterID": result.data[i]["HMaterID"],
|
"物料代码": result.data[i]["产品代码"],
|
"物料名称": result.data[i]["产品名称"],
|
"规格型号": result.data[i]["规格型号"],
|
"HUnitID": result.data[i]["HUnitID"],
|
"计量单位": result.data[i]["计量单位"],
|
"HQty": result.data[i]["生产任务单数量"],
|
"HSourceID": result.data[i]["HSourceID"],
|
"生产资源": result.data[i]["生产资源"],
|
|
"HRemark": "",
|
"HProcExchInterID": "0",
|
"HProcExchEntryID": "0",
|
"HProcExchBillNo": "",
|
"HICMOInterID": result.data[i]["hmainid"],
|
"HICMOEntryID": result.data[i]["HEntryID"],
|
"HICMOBillNo": result.data[i]["单据号"],
|
"HSourceInterID": result.data[i]["hmainid"],
|
"HSourceEntryID": result.data[i]["HEntryID"],
|
"HSourceBillNo": result.data[i]["单据号"],
|
"HSourceBillType": result.data[i]["单据类型"],
|
|
"HResult": "报废",
|
"HEmpID": "0",
|
"检验员": "",
|
"HPRocID": "0",
|
"工序": "",
|
"HNowProcID": "0",
|
"当前工序": "",
|
"HBadProcID": "0",
|
"责任工序": "",
|
"HBadReasonID": "0",
|
"不良原因": "",
|
"HBadPhenomenaID": "0",
|
"不良现象": "",
|
"HBarCode": "",
|
"HReportType": "3",
|
"HAddr": "",
|
"HMaker": "",
|
"HMakeDate": Format(new Date(), 'yyyy-MM-dd')
|
}
|
);
|
}
|
option.data = rowdata;
|
|
table.render(option);
|
layer.close(ajaxLoad);
|
} else {
|
layer.close(ajaxLoad);
|
layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
|
}
|
}, error: function () {
|
layer.close(ajaxLoad);
|
layer.alert("发生错误!", { icon: 5 });
|
}
|
})
|
}
|
//#endregion
|
|
//#region (工序流转卡)下推页面初始化
|
function set_ProcessBill(linterid, HEntryID) {
|
//生成并设置主表的内码和单据号
|
createBillNo();
|
|
//相关文本框信息初始化
|
$("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
|
$("#HMaker").val(sessionStorage["HUserName"]);
|
$("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
|
|
var ajaxLoad = layer.load();
|
|
$.ajax({
|
url: GetWEBURL() + "/LEMS/MES_IF_ProcessBillList_Json",
|
type: "GET",
|
async: false,
|
data: { "hinterid": linterid, "HEntryID": HEntryID, "user": sessionStorage["HUserName"] },
|
success: function (d) {
|
var result = d;
|
|
if (result.code == 1) { // 说明验证成功了,
|
var data = result.data[0];
|
|
//组织的值HOrgID变化,重新渲染
|
HOrgIDBar = data.HPRDORGID;
|
//子表 赋值
|
var rowdata = [];
|
for (var i = 0; i < result.data.length; i++) {
|
rowdata.push(
|
{
|
"HMaterID": result.data[i]["HMaterID"],
|
"物料代码": result.data[i]["产品代码"],
|
"物料名称": result.data[i]["产品名称"],
|
"规格型号": result.data[i]["规格型号"],
|
"HProcID": result.data[i]["HProcID"],
|
"工序": result.data[i]["工序名称"],
|
"HUnitID": result.data[i]["HUnitID"],
|
"计量单位": result.data[i]["计量单位"],
|
"HQty": result.data[i]["生产任务单数量"],
|
"HSourceID": "0",
|
"生产资源": "",
|
"HNowProcID": "0",
|
"当前工序": "",
|
"HBadProcID": "0",
|
"责任工序": "",
|
|
"HRemark": "",
|
"HProcExchInterID": "0",
|
"HProcExchEntryID": "0",
|
"HProcExchBillNo": "",
|
"HICMOInterID": result.data[i]["hicmointerid"],
|
"HICMOEntryID": result.data[i]["HICMOEntryID"],
|
"HICMOBillNo": result.data[i]["任务单号"],
|
|
"HProcExchInterID": result.data[i]["hmainid"],
|
"HProcExchEntryID": result.data[i]["HEntryID"],
|
"HProcExchBillNo": result.data[i]["单据号"],
|
|
|
"HSourceInterID": result.data[i]["hmainid"],
|
"HSourceEntryID": result.data[i]["HEntryID"],
|
"HSourceBillNo": result.data[i]["单据号"],
|
"HSourceBillType": result.data[i]["单据类型"],
|
|
"HResult": "报废",
|
"HEmpID": "0",
|
"检验员": "",
|
"HBadReasonID": "0",
|
"不良原因": "",
|
"HBadPhenomenaID": "0",
|
"不良现象": "",
|
"HBarCode": "",
|
"HReportType": "3",
|
"HAddr": "",
|
"HMaker": "",
|
"HMakeDate": Format(new Date(), 'yyyy-MM-dd')
|
}
|
);
|
}
|
option.data = rowdata;
|
|
table.render(option);
|
layer.close(ajaxLoad);
|
} else {
|
layer.close(ajaxLoad);
|
layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
|
}
|
}, error: function () {
|
layer.close(ajaxLoad);
|
layer.alert("发生错误!", { icon: 5 });
|
}
|
})
|
}
|
//#endregion
|
|
//#region (出站汇报单)下推页面初始化
|
function set_StationOutBill(linterid) {
|
//生成并设置主表的内码和单据号
|
createBillNo();
|
|
//相关文本框信息初始化
|
$("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
|
$("#HMaker").val(sessionStorage["HUserName"]);
|
$("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
|
|
var ajaxLoad = layer.load();
|
|
$.ajax({
|
url: GetWEBURL() + "/Cj_StationOutBill/PushDownBackInfo",
|
type: "GET",
|
async: false,
|
data: { "linterid": linterid, "user": sessionStorage["HUserName"] },
|
success: function (result) {
|
if (result.code == 1) { // 说明验证成功了,
|
var data = result.data[0];
|
//主表赋值
|
$("#HEmpID").val(sessionStorage["HEmpID"] == undefined ? 0 : sessionStorage["HEmpID"]);
|
$("#HEmpName").val(sessionStorage["HEmpName"]);
|
$("#HDeptID").val(data.HDeptID);
|
$("#HDeptName").val(data.车间);
|
$("#HGroupID").val(data.HGroupID);
|
$("#HGroupName").val(data.生产班组);
|
|
//组织的值HOrgID变化,重新渲染
|
HOrgIDBar = data.组织;
|
|
//子表 赋值
|
var rowdata = [];
|
for (var i = 0; i < result.data.length; i++) {
|
rowdata.push(
|
{
|
"HMaterID": result.data[i]["HMaterID"],
|
"物料代码": result.data[i]["产品代码"],
|
"物料名称": result.data[i]["产品名称"],
|
"规格型号": result.data[i]["规格型号"],
|
"HProcID": result.data[i]["HProcID"],
|
"工序": result.data[i]["工序"],
|
"HUnitID": result.data[i]["HUnitID"],
|
"计量单位": result.data[i]["计量单位"],
|
"HQty": 1,
|
"HSourceID": result.data[i]["HSourceID"],
|
"生产资源": result.data[i]["生产资源"],
|
"HNowProcID": "0",
|
"当前工序": "",
|
"HBadProcID": "0",
|
"责任工序": "",
|
"HRemark": "",
|
"HProcExchInterID": result.data[i]["HProcExchInterID"],
|
"HProcExchEntryID": result.data[i]["HProcExchEntryID"],
|
"HProcExchBillNo": result.data[i]["工序流转卡号"],
|
"HICMOInterID": result.data[i]["HICMOInterID"],
|
"HICMOEntryID": result.data[i]["HICMOEntryID"],
|
"HICMOBillNo": result.data[i]["生产订单号"],
|
"HSourceInterID": result.data[i]["hmainid"],
|
"HSourceEntryID": "0",
|
"HSourceBillNo": result.data[i]["单据号"],
|
"HSourceBillType": result.data[i]["单据类型"],
|
"HResult": "",
|
"HEmpID": "0",
|
"检验员": "",
|
"HBadReasonID": "0",
|
"不良原因": "",
|
"HBadPhenomenaID": "0",
|
"不良现象": "",
|
"HBarCode": "",
|
"HReportType": "3",
|
"HAddr": "",
|
"HMaker": "",
|
"HMakeDate": Format(new Date(), 'yyyy-MM-dd')
|
}
|
);
|
}
|
option.data = rowdata;
|
|
table.render(option);
|
layer.close(ajaxLoad);
|
} else {
|
layer.close(ajaxLoad);
|
layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
|
}
|
}, error: function () {
|
layer.close(ajaxLoad);
|
layer.alert("发生错误!", { icon: 5 });
|
}
|
})
|
}
|
//#endregion
|
|
//#region 弹窗选择方法
|
//#region 生产车间选择页面
|
function get_checkDept() {
|
layer.open({
|
type: 2//弹窗类型
|
, skin: 'layui-layer-rim' //加上边框
|
, area: ['90%', '90%']//大小
|
, title: '生产车间列表'//标题
|
, shift: 2//弹出动画
|
, content: ['../../../基础资料/公用基础资料/Gy_DepartmentList.html?openType=2&HOrgName=' + sessionStorage["Organization"], 'yes']
|
, btn: ['确定', '取消']
|
, btn1: function (index, layero) {//按钮【按钮一】的回调
|
var iframeWindow = window['layui-layer-iframe' + index] //获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
|
if (checkStatus.data.length === 0) {
|
return layer.msg('请选择数据');
|
}
|
$("#HDeptName").val(checkStatus.data[0].部门名称);
|
$("#HDeptID").val(checkStatus.data[0].HItemID);
|
layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
//#endregion
|
|
//#region 登记人选择页面
|
function get_checkEmp() {
|
layer.open({
|
type: 2//弹窗类型
|
, skin: 'layui-layer-rim' //加上边框
|
, area: ['90%', '90%']//大小
|
, title: '登记人列表'//标题
|
, shift: 2//弹出动画
|
, content: ['../../../基础资料/公用基础资料/Gy_EmployeeList.html?Type=HEmp', 'yes']
|
, btn: ['确定', '取消']
|
, btn1: function (index, layero) {//按钮【按钮一】的回调
|
var iframeWindow = window['layui-layer-iframe' + index] //获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
|
if (checkStatus.data.length === 0) {
|
return layer.msg('请选择数据');
|
}
|
$("#HEmpName").val(checkStatus.data[0].职员名称);
|
$("#HEmpID").val(checkStatus.data[0].HItemID);
|
|
getEmpInfoByHEmpID(checkStatus.data[0].HItemID);
|
layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
//#endregion
|
|
//#region 班组选择页面
|
function get_checkGroup() {
|
layer.open({
|
type: 2//弹窗类型
|
, skin: 'layui-layer-rim' //加上边框
|
, area: ['90%', '90%']//大小
|
, title: '班组列表'//标题
|
, shift: 2//弹出动画
|
, content: ['../../../基础资料/工资基础资料/Gy_Group.html?Type=HGroup&openType=2', 'yes']
|
, btn: ['确定', '取消']
|
, btn1: function (index, layero) {//按钮【按钮一】的回调
|
var iframeWindow = window['layui-layer-iframe' + index] //获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
|
if (checkStatus.data.length === 0) {
|
return layer.msg('请选择数据');
|
}
|
$("#HGroupName").val(checkStatus.data[0].班组名称);
|
$("#HGroupID").val(checkStatus.data[0].HItemID);
|
|
layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
//#endregion
|
//#endregion
|
|
//#region 保存方法
|
function set_SaveBill(data) {
|
//记录操作类型
|
var refSav = "";
|
if (OperationType == 1 || OperationType == 2 || OperationType == 4 || OperationType == 5 || OperationType == 6) {
|
refSav = "Add";
|
data.field.HChangeDate = new Date();
|
data.field.HSTOCKORGID = data.field.HOrgID;
|
data.field.HBillSubType = HBillSubType == '3717-1' ? HBillSubType : '3717';
|
}
|
if (OperationType == 3) {
|
refSav = "Update";
|
data.field.HChangeDate = new Date();
|
data.field.HSTOCKORGID = data.field.HOrgID;
|
}
|
|
//若为编辑-保存,则更新修改人和修改时间
|
if (OperationType == 3) {
|
data.field.HUpDater = sessionStorage["HUserName"];
|
data.field.HUpDateDate = Format(new Date(), "yyyy-MM-dd");
|
$("#HUpDater").val(sessionStorage["HUserName"]);
|
$("#HUpDateDate").val(Format(new Date(), "yyyy-MM-dd"));
|
}
|
//筛选删除之后不为空的数据组
|
var row = [];
|
for (var i = 0; i < table.cache['mainTable'].length; i++) {
|
if (table.cache['mainTable'][i] != "") {
|
if (table.cache["mainTable"][i].物料名称.indexOf("\"") != -1 || table.cache["mainTable"][i].物料名称.indexOf(";") != -1) {
|
table.cache["mainTable"][i].物料名称 = table.cache["mainTable"][i].物料名称.replaceAll("\"", "”").replaceAll(";", ";")
|
}
|
if (table.cache["mainTable"][i].规格型号.indexOf("\"") != -1 || table.cache["mainTable"][i].规格型号.indexOf(";") != -1) {
|
table.cache["mainTable"][i].规格型号 = table.cache["mainTable"][i].规格型号.replaceAll("\"", "”").replaceAll(";", ";")
|
}
|
|
row.push(table.cache['mainTable'][i])
|
}
|
}
|
//序列化表头信息和子表信息
|
var sMainStr = JSON.stringify(data.field);
|
var sSubStr = JSON.stringify(row);
|
//拼接参数
|
var sMainSub = sMainStr + ';' + sSubStr + ';' + refSav + ";" + sessionStorage["HUserName"];
|
|
var index = layer.load();
|
$.ajax({
|
type: "POST",
|
url: GetWEBURL() + "/Sc_QualityReportBill/SaveSc_QualityReportBill", //方法所在页面和方法名
|
async: true,
|
data: { "msg": sMainSub },
|
dataType: "json",
|
success: function (data) {
|
if (data.count == 1) { // 说明验证成功了,
|
layer.msg(data.Message, { icon: 1 });
|
$('#add-btn').addClass("layui-btn-disabled").attr("disabled", true);
|
layer.close(index);
|
}
|
else {
|
layer.alert(data.Message, { icon: 5 });
|
layer.close(index);
|
}
|
},
|
error: function (err) {
|
layer.alert("错误:" + err, { icon: 5 });
|
layer.close(index);
|
}
|
});
|
}
|
//#endregion
|
|
//#region 数据校验
|
function AllowLoadData(data) {
|
//数值格式校验工具
|
var ref = /^\d+(\.\d+)?$/; //非负数正则表达式
|
var temp = "";
|
|
//#region 表头数据检验
|
if ($("#HBillNo").val() == "") {
|
layer.msg("单据编号不能为空!");
|
return false;
|
}
|
|
if ($("#HDate").val() == "") {
|
layer.msg("日期不能为空!");
|
return false;
|
}
|
|
//if ($("#HDeptID").val() == "0") {
|
// layer.msg("生产车间未选择!");
|
// return false;
|
//}
|
|
if ($("#HEmpID").val() == "0" || $("#HEmpID").val() == undefined || $("#HEmpID").val() == null || $("#HEmpName").val() == "") {
|
layer.msg("登记人未选择!");
|
return false;
|
}
|
//#endregion
|
|
//#region 子表 数据检验
|
if (option.data.length == 0) {
|
layer.msg("生产质量汇报单子表中未存在记录!");
|
return false;
|
}
|
|
for (var i = 0; i < option.data.length; i++) {
|
//数量格式校验
|
temp = option.data[i]["HQty"] + "";
|
if (temp == "0") {
|
layer.msg("第" + (i + 1) + "行:数量不能为0!");
|
return false;
|
} else if (!ref.test(temp)) {
|
layer.msg("第" + (i + 1) + "行:数量请输入大于0的数字!");
|
return false;
|
}
|
if (option.data[i]["HMaterID"] == 0 || option.data[i]["HMaterID"] == undefined || option.data[i]["HMaterID"] == null) {
|
layer.msg("第" + (i + 1) + "行:物料信息不允许为空!");
|
return false;
|
}
|
if (option.data[i]["HProcID"] == 0 || option.data[i]["HProcID"] == undefined || option.data[i]["HProcID"] == null) {
|
layer.msg("第" + (i + 1) + "行:工序信息不允许为空!");
|
return false;
|
}
|
if (option.data[i]["HResult"] == 0 || option.data[i]["HResult"] == undefined || option.data[i]["HResult"] == null) {
|
layer.msg("第" + (i + 1) + "行:判定结果不允许为空!");
|
return false;
|
}
|
if (option.data[i]["HBadReasonID"] == 0 || option.data[i]["HBadReasonID"] == undefined || option.data[i]["HBadReasonID"] == null) {
|
layer.msg("第" + (i + 1) + "行:不良原因不允许为空!");
|
return false;
|
}
|
}
|
//#endregion
|
return true;
|
}
|
//#endregion
|
|
//#region 子表相关方法
|
//#region 在末尾增加一行
|
function btnAddLine(NewRow) {
|
table.cache["mainTable"].push(NewRow);
|
option.data = table.cache["mainTable"];
|
table.render(option);
|
|
//刷新表格同时根据option中HResult值设置下拉列表
|
setSelectHResultByTableRender();
|
|
//rows++;
|
layer.msg('增加一行按钮!')
|
}
|
//#endregion
|
|
//#region 在指定行下插入一行
|
function btnInsertLine(NewRow) {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length === 1) {
|
var tables = []; //存储插入一行后的表格数据
|
//获取表格的全部行
|
var rowList = table.cache['mainTable'];
|
for (var i = 0; i < rowList.length; i++) { //遍历表格的行
|
tables.push(option.data[i]);
|
if (rowList[i].LAY_CHECKED == true) { //获取选中行的位置
|
tables.push(NewRow);
|
}
|
}
|
option.data = tables;
|
table.render(option);
|
|
//刷新表格同时根据option中HResult值设置下拉列表
|
setSelectHResultByTableRender();
|
} else {
|
layer.msg('请选择一行数据编辑!');
|
}
|
}
|
//#endregion
|
|
//#region 复制一行
|
function btnCopyLine(data) {
|
var copydata = JSON.stringify(data);
|
if (data.length <= 0) {
|
layer.msg("请选择需要复制的一行!");
|
}
|
else if (data.length > 1) {
|
layer.msg("只能选择复制一行!");
|
}
|
else {
|
var copydata2 = copydata.substring(1, copydata.length);//去除首行字符'['
|
var copyrow = copydata2.substring(0, copydata2.length - 1);//去除末尾字符']'
|
table.cache["mainTable"].push(JSON.parse(copyrow));//将复制的行强转成json追加到表格上
|
option.data = table.cache["mainTable"];//将数据绑定到data上
|
//设置复制得到的记录的实际称重为0
|
option.data[option.data.length - 1].HWeight = "0";
|
|
table.render(option);//将数据渲染到表格上
|
|
|
//刷新表格同时根据option中HResult值设置下拉列表
|
setSelectHResultByTableRender();
|
|
for (var i = 1; i <= option.data.length; i++) {
|
$('#HMaterNumber' + i + '').val(option.data[i - 1].HBadReasonNumber);
|
$('#HNowProcName' + i + '').val(option.data[i - 1].HBadPhenomenaName);
|
$('#HBadProcName' + i + '').val(option.data[i - 1].HBadPhenomenaName);
|
$('#HEmpName' + i + '').val(option.data[i - 1].HBadPhenomenaName);
|
$('#HSourceName' + i + '').val(option.data[i - 1].HBadPhenomenaName);
|
$('#HBadReason' + i + '').val(option.data[i - 1].HBadPhenomenaName);
|
$('#HBadPhenomena' + i + '').val(option.data[i - 1].HBadPhenomenaName);
|
}
|
form.render('select');
|
}
|
}
|
//#endregion
|
|
//#region 上移
|
function btn_up() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (data.length == 1) {
|
var tables = [];
|
//获取表格的全部行
|
var rowList = table.cache['mainTable'];
|
for (var i = 0; i < rowList.length; i++) { //遍历表格的行
|
if (rowList[i].LAY_CHECKED == true) { //获取选中行的位置
|
//如果是第一行上移,则失败并提醒
|
if (i == 0) {
|
layer.msg("第一行数据无法上移!");
|
return;
|
}
|
tables.push(option.data[i - 1]);
|
data[0].LAY_CHECKED = true;
|
option.data[i - 1] = data[0];
|
option.data[i] = tables[0];
|
table.render(option);
|
|
//刷新表格同时根据option中HResult值设置下拉列表
|
setSelectHResultByTableRender();
|
break;
|
}
|
}
|
} else {
|
layer.msg("请选择一行数据!");
|
}
|
}
|
//#endregion
|
|
//#region 下移
|
function btn_under() {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (data.length == 1) {
|
var tables = [];
|
//获取表格的全部行
|
var rowList = table.cache['mainTable'];
|
for (var i = 0; i < rowList.length; i++) { //遍历表格的行
|
if (rowList[i].LAY_CHECKED == true) { //获取选中行的位置
|
//如果是最后一行下移,则失败并提醒
|
if (i == option.data.length - 1) {
|
layer.msg("最后一行数据无法下移!");
|
return;
|
}
|
|
|
tables.push(option.data[i + 1]);
|
data[0].LAY_CHECKED = true;
|
option.data[i + 1] = data[0];
|
option.data[i] = tables[0];
|
table.render(option);
|
|
//刷新表格同时根据option中HResult值设置下拉列表
|
setSelectHResultByTableRender();
|
break;
|
}
|
}
|
} else {
|
layer.msg("请选择一行数据!");
|
}
|
}
|
//#endregion
|
|
//#region 表格行内事件删除
|
function set_GridDelete(obj) {
|
var data = obj.data;
|
var rowIndex = $(obj.tr).attr("data-index");
|
if (obj.event === 'del') {
|
layer.confirm('真的删除行么', function (index) {
|
console.log("索引为:" + rowIndex);
|
//if (rowIndex === '0') {
|
// layer.msg('首行无法删除!!!');
|
//} else {
|
//obj.del();
|
//layer.close(index);
|
var oldData = table.cache["mainTable"];
|
oldData.splice(obj.tr.data('index'), 1);
|
option.data = oldData;
|
table.render(option);
|
|
//刷新表格同时根据option中HResult值设置下拉列表
|
setSelectHResultByTableRender();
|
layer.close(index);
|
/*}*/
|
});
|
}
|
}
|
//#endregion
|
|
//#region 行内快捷键筛选
|
function set_GridCellCheck(obj) {
|
$(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) {
|
if (event.key == "F7") {
|
//物料
|
if (obj.event == "HMaterID") {
|
var HOrgID = $("#HOrgID").val();
|
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "物料列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../../基础资料/公用基础资料/Gy_Material.html?openType=2&HOrgID=' + HOrgID, 'yes']
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
|
//更新表格缓存的数据
|
obj.update({
|
"HMaterID": checkStatus.data[0].HItemID
|
, "物料代码": checkStatus.data[0].物料代码
|
, "物料名称": checkStatus.data[0].物料名称
|
, "规格型号": checkStatus.data[0].规格型号
|
, "HUnitID": checkStatus.data[0].HUnitID
|
, "计量单位": checkStatus.data[0].计量单位名称
|
})
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
if (JSON.stringify(HDataTemp) != '{}') {
|
//更新表格缓存的数据
|
obj.update({
|
"HMaterID": HDataTemp.HItemID
|
, "物料代码": HDataTemp.物料代码
|
, "物料名称": HDataTemp.物料名称
|
, "规格型号": HDataTemp.规格型号
|
, "HUnitID": HDataTemp.HUnitID
|
, "计量单位": HDataTemp.计量单位名称
|
})
|
HDataTemp = {};
|
}
|
}
|
})
|
}
|
//计量单位
|
if (obj.event == "HUnitID") {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "计量单位列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../../Baseset/基础资料/Gy_UnitList.html?Type=&openType=2', 'yes']
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
//更新表格缓存的数据
|
obj.update({
|
"计量单位": checkStatus.data[0].计量单位名称
|
, "HUnitID": checkStatus.data[0].HItemID
|
})
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
if (JSON.stringify(HDataTemp) != '{}') {
|
//更新表格缓存的数据
|
obj.update({
|
"HUnitID": HDataTemp.HItemID
|
, "计量单位": HDataTemp.计量单位名称
|
})
|
HDataTemp = {};
|
}
|
}
|
})
|
}
|
//检验员
|
if (obj.event == "HEmp") {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "检验员列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../../基础资料/公用基础资料/Gy_EmployeeList.html?Type=HSecManager&openType=2', 'yes']
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
//更新表格缓存的数据
|
obj.update({
|
"检验员": checkStatus.data[0].职员名称
|
, "HEmpID": checkStatus.data[0].HItemID
|
})
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
if (JSON.stringify(HDataTemp) != '{}') {
|
//更新表格缓存的数据
|
obj.update({
|
"HEmpID": HDataTemp.HItemID
|
, "检验员": HDataTemp.职员名称
|
})
|
HDataTemp = {};
|
}
|
}
|
})
|
}
|
//生产资源
|
if (obj.event == "HSource") {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "生产资源列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../../基础资料/生产基础资料/Gy_Source.html?Htype=&openType=2', 'yes']
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
//更新表格缓存的数据
|
obj.update({
|
"生产资源": checkStatus.data[0].生产资源名称
|
, "HSourceID": checkStatus.data[0].HItemID
|
})
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
if (JSON.stringify(HDataTemp) != '{}') {
|
//更新表格缓存的数据
|
obj.update({
|
"HSourceID": HDataTemp.HItemID
|
, "生产资源": HDataTemp.生产资源名称
|
})
|
HDataTemp = {};
|
}
|
}
|
})
|
}
|
//不良原因
|
if (obj.event == "HBadReason") {
|
var HProcName = obj.data.工序;
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "不良原因列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../../基础资料/生产基础资料/Gy_BadReason.html?Type=BadReason&HProcName=' + HProcName + '&openType=2', 'yes']
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
//更新表格缓存的数据
|
obj.update({
|
"不良原因": checkStatus.data[0].不良原因名称
|
, "HBadReasonID": checkStatus.data[0].HItemID
|
})
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
if (JSON.stringify(HDataTemp) != '{}') {
|
//更新表格缓存的数据
|
obj.update({
|
"HBadReasonID": HDataTemp.HItemID
|
, "不良原因": HDataTemp.不良原因名称
|
})
|
HDataTemp = {};
|
}
|
}
|
})
|
}
|
if (obj.event == "HBadPhenomena") {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "不良现象" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../../基础资料/公用基础资料/Gy_BadPhenomena.html?openType=2', "yes"]
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
obj.update({
|
"HBadPhenomenaID": checkStatus.data[0].HItemID
|
, "不良现象": checkStatus.data[0].不良现象名称
|
})
|
layer.close(index);//关闭弹窗
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
//责任工序列表
|
if (obj.event == "HBadProcID") {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "责任工序列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../../基础资料/生产基础资料/Gy_Process.html?openType=2', 'yes']
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
//更新表格缓存的数据
|
obj.update({
|
"HBadProcID": checkStatus.data[0].HItemID
|
, "责任工序": checkStatus.data[0].工序名称
|
})
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
}
|
})
|
}
|
//当前工序列表
|
if (obj.event == "HNowProcID") {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "当前工序列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../../基础资料/生产基础资料/Gy_Process.html?openType=2', 'yes']
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
//更新表格缓存的数据
|
obj.update({
|
"HNowProcID": checkStatus.data[0].HItemID
|
, "当前工序": checkStatus.data[0].工序名称
|
})
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
}
|
})
|
}
|
obj.event = "";
|
return false;
|
}
|
})
|
}
|
//#endregion
|
|
//#region 子表1:隐藏列设置
|
function get_HideColumn() {
|
var colName = "";
|
var contentUrl = "";
|
for (var i = 1; i < option.cols[0].length - 1; i++) {
|
colName += option.cols[0][i]["title"] + ",";
|
}
|
var urlStr = window.document.location.pathname;//获取文件路径
|
var urlLen = urlStr.split('/');
|
for (var i = 0; i < urlLen.length - 4; i++) {
|
contentUrl += "../";
|
}
|
colName = encodeURI(colName.substring(0, colName.length - 1));//对 URI 进行编码
|
|
contentUrl += '基础资料/隐藏列设置/Gy_GridView_Hide.html?HModName=' + HModName + '&colName=' + colName;
|
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "隐藏列设置" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["50%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: [contentUrl, "yes"]
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//刷新表格数据
|
DisPlay_HideColumn();
|
//更新表格缓存的数据
|
layer.close(index);//关闭弹窗
|
}
|
})
|
}
|
//#endregion
|
//#region 子表1:显示列数据
|
function DisPlay_HideColumn() {
|
$.ajax({
|
url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
|
type: "GET",
|
data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
|
async: false,
|
success: function (data1) {
|
if (data1.data.length != 0) {
|
var dataCol = [];//数据库查询出的列数据
|
var titleData = ["HMaterID", "HUnitID", "HEmpID", "HSourceID", "HBadReasonID", "生产订单主内码", "生产订单子内码", "生产订单号", "工序流转卡内码", "工序流转卡子内码", "工序流转卡号", "源单内码", "源单子内码", "源单单号", "源单类型", "条形码", "汇报类型", "MAC机器地址", "扫描人", "扫描日期"];//不需要显示的字段 可扩展
|
//titleData = [];
|
|
dataCol = data1.data[0].HGridString.split(',');
|
|
for (var i = 0; i < option.cols[0].length - 2; i++) {
|
var dataCols = dataCol[i].split('|');
|
//隐藏列
|
if (dataCols[1] == 1) {
|
option.cols[0][i + 1]["hide"] = true;
|
}
|
//设置列宽
|
if (dataCols[3] > 0) {
|
option.cols[0][i + 1]["width"] = dataCols[3];
|
}
|
//设置内容字体大小
|
if (data1.data[0].HFontSize != 0) {
|
option.cols[0][i + 1]["style"] += "font-size:" + data1.data[0].HFontSize + "px;";
|
} else {
|
option.cols[0][i + 1]["style"] += "font-size:100%";
|
}
|
//设置列宽
|
//if (data1.data[0].HColumnWidth != 0) {
|
// option.cols[0][i + 1]["width"] = data1.data[0].HColumnWidth + "px;";
|
//} else {
|
// option.cols[0][i + 1]["width"] = "";
|
//}
|
//显示列
|
if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
|
option.cols[0][i + 1]["hide"] = false;
|
}
|
//字体所在位置(左 居中 右)
|
switch (dataCols[2]) {
|
case "L":
|
option.cols[0][i + 1]["align"] = "left";
|
break;
|
case "M":
|
option.cols[0][i + 1]["align"] = "center";
|
break;
|
case "R":
|
option.cols[0][i + 1]["align"] = "right";
|
break;
|
}
|
}
|
|
//取消冻结列
|
for (var i = 1; i < option.cols[0].length - 1; i++) {
|
if (option.cols[0][i]["fixed"] != null) {
|
option.cols[0][i]["fixed"] = null;
|
}
|
else {
|
break;
|
}
|
}
|
//冻结列
|
if (data1.data[0].HFixCols != 0) {
|
for (var i = 0; i < data1.data[0].HFixCols; i++) {
|
if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) {
|
data1.data[0].HFixCols += 1;
|
}
|
option.cols[0][i + 1]["fixed"] = "left";
|
}
|
}
|
table.render(option);
|
|
//刷新表格同时根据option中HResult值设置下拉列表
|
setSelectHResultByTableRender();
|
for (var i = 1; i <= option.data.length; i++) {
|
$('#HMaterNumber' + i + '').val(option.data[i - 1].物料代码);
|
$('#HNowProcName' + i + '').val(option.data[i - 1].当前工序);
|
$('#HBadProcName' + i + '').val(option.data[i - 1].责任工序);
|
$('#HEmpName' + i + '').val(option.data[i - 1].检验员);
|
$('#HSourceName' + i + '').val(option.data[i - 1].生产资源);
|
$('#HBadReason' + i + '').val(option.data[i - 1].不良原因);
|
$('#HBadPhenomena' + i + '').val(option.data[i - 1].不良现象);
|
}
|
form.render('select');
|
} else {
|
table.render(option);
|
|
//刷新表格同时根据option中HResult值设置下拉列表
|
setSelectHResultByTableRender();
|
for (var i = 1; i <= option.data.length; i++) {
|
$('#HMaterNumber' + i + '').val(option.data[i - 1].物料代码);
|
$('#HNowProcName' + i + '').val(option.data[i - 1].当前工序);
|
$('#HBadProcName' + i + '').val(option.data[i - 1].责任工序);
|
$('#HEmpName' + i + '').val(option.data[i - 1].检验员);
|
$('#HSourceName' + i + '').val(option.data[i - 1].生产资源);
|
$('#HBadReason' + i + '').val(option.data[i - 1].不良原因);
|
$('#HBadPhenomena' + i + '').val(option.data[i - 1].不良现象);
|
}
|
form.render('select');
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
})
|
}
|
//#endregion
|
|
//#region 刷新表格同时根据option中HResult值设置下拉列表
|
function setSelectHResultByTableRender() {
|
for (var i = 1; i <= option.data.length; i++) {
|
$('#HResult' + i + '').val(option.data[i - 1].HResult);
|
}
|
form.render('select');
|
}
|
//#endregion
|
//#endregion
|
|
|
//#region 反审核/审核数据
|
function set_CheckBill(num) {
|
var InterID = $("#HInterID").val();
|
//逻辑审核方法
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/Sc_QualityReportBill/AuditSc_QualityReportBill", //方法所在页面和方法名
|
data: { "HInterID": InterID, "IsAudit": num, "CurUserName": sessionStorage["HUserName"] },
|
success: function (result) {
|
if (result.count == 1) {
|
layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
|
// 得到frame索引
|
var index = layer.getFrameIndex(window.name);
|
//关闭当前frame
|
layer.close(index);
|
//修改为功后刷新界面
|
$("#btnSearch").trigger('click');
|
});
|
|
} else {
|
layer.alert(result.code + result.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
//#endregion
|
|
|
//#region 获取源单-生产订单单据状态
|
function getSourceBillStatus_ICMOBill() {
|
var HSourceBillData = "none";
|
var sWhere = " and hmainid = " + $("#HMainSourceInterID").val();
|
$.ajax({
|
url: GetWEBURL() + '/LEMS/MES_IF_ICMOBillList_Json',
|
async: false,
|
type: "GET",
|
data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
|
success: function (data1) {
|
if (data1.count == 1) {
|
HSourceBillData = data1.data;
|
} else {
|
layer.alert(data1.code + "源单单据状态判断失败!", { icon: 5 });
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
return HSourceBillData;
|
}
|
//#endregion
|
//#endregion
|
|
|
//以上是layui模块
|
});
|
// 基础资料返回数据
|
function GetHEmpValue(obj) //返回销售员
|
{
|
$("#HEmpName").val(obj[0].职员名称);
|
$("#HEmpID").val(obj[0].HItemID);
|
|
getEmpInfoByHEmpID(obj[0].HItemID);
|
}
|
|
function GetHDeptNameValue(obj) //返回销售部门
|
{
|
$("#HDeptName").val(obj[0].部门名称);
|
$("#HDeptID").val(obj[0].HItemID);
|
}
|
|
function GetHGroupValue(obj) //返回班组
|
{
|
$("#HGroupName").val(obj[0].班组名称);
|
$("#HGroupID").val(obj[0].HItemID);
|
}
|
|
function GetMaterValue(obj) //物料名称
|
{
|
HDataTemp = obj[0];
|
}
|
|
function GetUnitValue(obj) //计量单位
|
{
|
HDataTemp = obj[0];
|
}
|
|
function GetHSecManagerValue(obj) //返回检验员
|
{
|
HDataTemp = obj[0];
|
}
|
|
function GetGySource(obj) //返回生产资源
|
{
|
HDataTemp = obj[0];
|
}
|
|
function GetBadReasonaValue(obj) //返回不良原因
|
{
|
HDataTemp = obj[0];
|
}
|
|
//#region 处理小数显示位数(data:需要处理的数据;num:数据的类型(如1:数量;2:金额;3:单价))
|
function dealDoubleToFixed(data, num) {
|
//用于设置小数位数
|
var dotLength = 0;
|
|
if (num == 1) { //当数据为数量时,最多保留6位小数
|
//设置最多保留6位小数
|
dotLength = 6;
|
} else if (num == 2) { //当数据为金额时,最多保留2位小数
|
//设置最多保留2位小数
|
dotLength = 2;
|
} else if (num == 3) { //当数据为单价时,最多保留4位小数
|
//设置最多保留4位小数
|
dotLength = 4;
|
}
|
|
//判断是否存在小数点及其索引位置
|
data = data + "";
|
var index = data.indexOf(".");
|
|
//处理数据并返回
|
if (index < 0) {
|
return data * 1;
|
} else {
|
//获取小数位数
|
var length = data.length - index - 1;
|
if (length <= dotLength) {
|
return data * 1;
|
} else {
|
data = data * 1;
|
return data.toFixed(dotLength);
|
}
|
}
|
}
|
//#endregion
|
|
//#region 根据职员获取部门
|
function getEmpInfoByHEmpID(HEmpID) {
|
$.ajax({
|
url: GetWEBURL() + "/Xs_SeOrderBill/getEmpInfoByHEmpID",
|
async: false,
|
type: "GET",
|
data: {
|
"HEmpID": HEmpID
|
},
|
success: function (result) {
|
if (result.code == 1) { // 说明验证成功了,
|
var data = result.data[0];
|
|
$("#HDeptID").val(data.HDeptID);
|
$("#HDeptName").val(data.HDeptName);
|
} else {
|
layer.alert(result.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.alert("发生错误!", { icon: 5 });
|
}
|
});
|
}
|
//#endregion
|
</script>
|
</body>
|
</html>
|