<!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/zgqCustom/zgqCustom.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 type="text/javascript" src="../../../layuiadmin/lib/extend/echarts.min.js"></script>
|
<!--<style>
|
.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: 5px;
|
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: 2px;background-color: #efefef;">
|
<div class="layui-card-body" style="padding: 1px;">
|
<form class="layui-form" action="" lay-filter="formData" style="background-color:white;">
|
<div style="padding: 2px; ">
|
<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnAdd" id="btnSave">新增</button>
|
<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnCancel" id="btnEdit">退出</button>
|
</div>
|
<!--<div class="layui-tab" lay-filter="tab-POStockInBill">
|
<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>
|
<li lay-id="2" style="padding:1px;">不良率占比分析</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 style="width: 750px;height:350px; border: 1px solid #000; display:inline-block;">
|
<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; width: 501px;">
|
<input type="text" class="layui-input" lay-verify="HBarCode" name="HBarCode" id="HBarCode">
|
</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="HBillNo" lay-verify="HBillNo" id="HBillNo" style="background-color:#efefef4d;" readonly>
|
<input type="hidden" name="HInterID" id="HInterID" lay-verify="HInterID">
|
<input type="hidden" name="HEntryID" id="HEntryID" lay-verify="HEntryID" value="1">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;padding: 9px 18px;">维修人</label>
|
<div class="layui-input-block" style="margin-left: 77px;">
|
<input type="text" class="layui-input" lay-verify="HEmpName" name="HEmpName" id="HEmpName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
|
<input type="hidden" name="HEmpID" id="HEmpID" lay-verify="HEmpID" value="0">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchHEmp" id="btnSearchHEmp" style="padding: 0 10px;float: right;margin-right: 3px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
|
</button>
|
</div>
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;padding: 9px 18px;">不良原因</label>
|
<div class="layui-input-block" style="margin-left: 77px;">
|
<input type="text" class="layui-input" lay-verify="HBadReasonName" name="HBadReasonName" id="HBadReasonName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
|
<input type="hidden" name="HBadReasonID" id="HBadReasonID" lay-verify="HBadReasonID" value="0">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchHBadReason" id="btnSearchHBadReason" style="padding: 0 10px;float: right;margin-right: 3px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
|
</button>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;padding: 9px 18px;">不良类型</label>
|
<div class="layui-input-block" style="margin-left: 77px;">
|
<input type="text" class="layui-input" lay-verify="HBadTypeName" name="HBadTypeName" id="HBadTypeName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
|
<input type="hidden" name="HBadTypeID" id="HBadTypeID" lay-verify="HBadTypeID" value="0">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchHBadType" id="btnSearchHBadType" style="padding: 0 10px;float: right;margin-right: 3px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
|
</button>
|
</div>
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;padding: 9px 18px;">不良后果</label>
|
<div class="layui-input-block" style="margin-left: 77px;">
|
<input type="text" class="layui-input" lay-verify="HBadResultName" name="HBadResultName" id="HBadResultName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
|
<input type="hidden" name="HBadResultID" id="HBadResultID" lay-verify="HBadResultID" value="0">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchHBadResult" id="btnSearchHBadResult" style="padding: 0 10px;float: right;margin-right: 3px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
|
</button>
|
</div>
|
</div>
|
<div class="layui-inline" style="width:300px;">
|
<label class="layui-form-label" style="width: 85px;">维修结果</label>
|
<div class="layui-input-block" style="margin-left: 120px; width: 180px;">
|
<select name="HRepairResult" id="HRepairResult" lay-filter="HRepairResult" style="width: 180px;">
|
<option style="color:blue;" selected="selected" value="OK">OK</option>
|
<option style="color:blue;" value="NG">NG</option>
|
</select>
|
</div>
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">产品MAC</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" lay-verify="HProdMac" name="HProdMac" id="HProdMac" style="background-color:#efefef4d;" readonly>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">产品SN</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" lay-verify="HMaterSN" name="HMaterSN" id="HMaterSN" 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; width: 501px;">
|
<input type="text" class="layui-input" lay-verify="HRemark" name="HRemark" id="HRemark">
|
</div>
|
</div>
|
<div class="layui-inline" style="display:none;">
|
<label class="layui-form-label" style="width: 85px;">不良工序</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" lay-verify="HBadProcName" name="HBadProcName" id="HBadProcName" style="background-color:#efefef4d;" readonly>
|
<input type="hidden" name="HBadProcID" id="HBadProcID" lay-verify="HBadProcID" value="0">
|
</div>
|
</div>
|
<div class="layui-inline" style="display:none;">
|
<label class="layui-form-label" style="width: 85px;">维修方法</label>
|
<div class="layui-input-block" style="margin-left: 120px; width: 501px;">
|
<input type="text" class="layui-input" lay-verify="HRepairType" name="HRepairType" id="HRepairType">
|
</div>
|
</div>
|
<div class="layui-inline" style="display:none;">
|
<label class="layui-form-label" style="width: 85px;">数量</label>
|
<div class="layui-input-block" style="margin-left: 120px; width: 501px;">
|
<input type="text" class="layui-input" lay-verify="HQty" name="HQty" id="HQty" value="0">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<div class="layui-input-block" style="margin-left: 120px; width: 501px;">
|
<input type="hidden" name="HCreator" id="HCreator" lay-verify="HCreator">
|
<input type="hidden" name="HCreateDate" id="HCreateDate" lay-verify="HCreateDate">
|
|
<input type="hidden" name="HSourceInterID" id="HSourceInterID" lay-verify="HSourceInterID" value="0">
|
<input type="hidden" name="HSourceEntryID" id="HSourceEntryID" lay-verify="HSourceEntryID" value="0">
|
<input type="hidden" name="HSourceBillNo" id="HSourceBillNo" lay-verify="HSourceBillNo" value="">
|
<input type="hidden" name="HSourceBillType" id="HSourceBillType" lay-verify="HSourceBillType" value="">
|
<input type="hidden" name="HRelationQty" id="HRelationQty" lay-verify="HRelationQty" value="0">
|
<input type="hidden" name="HRelationMoney" id="HRelationMoney" lay-verify="HRelationMoney" value="0">
|
|
<input type="hidden" name="HMacAddr" id="HMacAddr" lay-verify="HMacAddr">
|
<input type="hidden" name="HIPAddr" id="HIPAddr" lay-verify="HIPAddr">
|
|
<!--记录子页面(更换配件)子表的临时数据-->
|
<input type="hidden" name="subMaterList_Temp" id="subMaterList_Temp" lay-verify="subMaterList_Temp">
|
|
</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; width: 501px;">
|
<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="NGSave" id="NGSave">NG保存</button>
|
<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="OKSave" id="OKSave">OK保存</button>
|
</div>
|
</div>
|
</div>
|
</div>
|
<!--</div>
|
</div>-->
|
<!--当前工单-->
|
<!--<div class="layui-tab-item">
|
<div class="layui-form-item">-->
|
<div style="width: 820px; height: 350px; border: 1px solid #000; display: inline-block; ">
|
<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" lay-verify="HICMOBillNo" name="HICMOBillNo" id="HICMOBillNo" style="background-color:#efefef4d;" readonly>
|
<input type="hidden" name="HICMOInterID" id="HICMOInterID" lay-verify="HICMOInterID" value="0">
|
<input type="hidden" name="HICMOEntryID" id="HICMOEntryID" lay-verify="HICMOEntryID" value="0">
|
</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" lay-verify="HSplitNO" name="HSplitNO" id="HSplitNO" 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" lay-verify="HMaterNumber" name="HMaterNumber" id="HMaterNumber" style="background-color:#efefef4d;" readonly>
|
<input type="hidden" name="HMaterID" id="HMaterID" lay-verify="HMaterID" value="0">
|
</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" lay-verify="HMaterName" name="HMaterName" id="HMaterName" 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" lay-verify="HMaterModel" name="HMaterModel" id="HMaterModel" 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" lay-verify="HUnitName" name="HUnitName" id="HUnitName" style="background-color:#efefef4d;" readonly>
|
<input type="hidden" name="HUnitID" id="HUnitID" lay-verify="HUnitID" value="0">
|
</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" lay-verify="HSourceName" name="HSourceName" id="HSourceName" style="background-color:#efefef4d;" readonly>
|
<input type="hidden" name="HSourceID" id="HSourceID" lay-verify="HSourceID" value="0">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">日期</label>
|
<div class="layui-input-block" style="margin-left: 120px; width:180px;">
|
<input type="date" class="layui-input" lay-verify="HDate" name="HDate" id="HDate" style="padding-left: 80px;">
|
</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" lay-verify="HWorkStationName" name="HWorkStationName" id="HWorkStationName" style="background-color:#efefef4d;" readonly>
|
<input type="hidden" name="HWorkStationID" id="HWorkStationID" lay-verify="HWorkStationID" value="0">
|
</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" lay-verify="HProcessName" name="HProcessName" id="HProcessName" style="background-color:#efefef4d;" readonly>
|
<input type="hidden" name="HProcess" id="HProcess" lay-verify="HProcess" value="0">
|
</div>
|
</div>
|
</div>
|
<div class="layui-row">
|
<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="HProdOrgID" id="HProdOrgID" lay-verify="HProdOrgID">
|
<!--动态渲染生产组织-->
|
</select>
|
</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;width:501px;">
|
<input type="text" class="layui-input" lay-verify="HDeptName" name="HDeptName" id="HDeptName" style="background-color:#efefef4d;" readonly>
|
<input type="hidden" name="HDeptID" id="HDeptID" lay-verify="HDeptID" value="0">
|
</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; width: 501px;">
|
<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="ChangeBill" id="ChangeBill"> 换 单 </button>
|
<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="ChangeMater" id="ChangeMater"> 换 配 件</button>
|
<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="CurrentBill" id="CurrentBill">当前工单</button>
|
</div>
|
</div>
|
</div>
|
</div>
|
<!--</div>
|
</div>-->
|
<!--不良率占比分析-->
|
<!--<div class="layui-tab-item">
|
<div class="layui-form-item">-->
|
<div style="width: 750px; height: 350px; display: inline-block; ">
|
<div class="layui-row">
|
<div id="HBadReasonECharts" style="width: 600px;height:350px;"></div>
|
</div>
|
</div>
|
<!--</div>
|
</div>-->
|
<!--子表信息-->
|
<!--<div class="layui-tab-item">
|
<div class="layui-form-item">-->
|
<div style="width: 820px; height: 350px; border: 1px solid #000; display: inline-block; ">
|
<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-CopyLine"><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>
|
</div>
|
<!--</div>
|
</div>-->
|
<!--</div>
|
</div>-->
|
</form>
|
</div>
|
</div>
|
</div>
|
<!--子表表:删除-->
|
<script type="text/html" id="barDemo">
|
<!--<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>-->
|
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
</script>
|
<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
|
, element = layui.element;
|
|
//模块名
|
var HModName = "Sc_SourceLineRepairBill";
|
//表格渲染参数
|
var option = {}; //项目阶段表渲染参数
|
var titleData = ["HInterID", "HEntryID", "HBadReasonID"];//子表不需要显示的字段 可扩展
|
|
//获取参数
|
var params = getUrlVars();
|
var OperationType = params[params[0]]; //从参数中获取 数据类型 1添加 保存 2复制 3 编辑
|
var linterid = params[params[1]]; //从参数中获取 单据内码
|
|
//#endregion
|
|
//#region 进入页面即加载
|
//#region 判断是否登录 未登录则跳到登录页
|
if (sessionStorage.login != "login") {
|
layer.confirm("登录失效,请重新登录!", {
|
icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
|
}, function () { window.location.href = "../../user/login.html"; });
|
}
|
//#endregion
|
|
//#region 初始化生产组织
|
Organ();
|
//#endregion
|
|
//#region 判断并设置操作类型、页面初始化
|
if (OperationType == null || OperationType == 1) { //新增
|
set_ClearBill();
|
}
|
//#endregion
|
|
//#region 初始化表格
|
DisPlay_HideColumn();
|
//#endregion
|
|
//#endregion
|
|
//#region 触发事件:包括form.on(){}格式的所有点击事件、选择事件等
|
//#region 弹窗选择触发事件
|
//#region 选择维修人按钮
|
form.on('submit(btnSearchHEmp)', function () {
|
get_checkSearchHEmp();
|
});
|
//#endregion
|
|
//#region 选择不良原因按钮
|
form.on('submit(btnSearchHBadReason)', function () {
|
get_checkSearchHBadReason();
|
});
|
//#endregion
|
|
//#region 选择不良类型按钮
|
form.on('submit(btnSearchHBadType)', function () {
|
get_checkSearchHBadType();
|
});
|
//#endregion
|
|
//#region 选择不良后果按钮
|
form.on('submit(btnSearchHBadResult)', function () {
|
get_checkSearchHBadResult();
|
});
|
//#endregion
|
//#endregion
|
|
//#region 操作按钮触发事件
|
//#region 新增
|
form.on('submit(btnAdd)', function (data) {
|
//layer.msg("新增");
|
set_ClearBill();
|
});
|
//#endregion
|
|
//#region 退出
|
form.on('submit(btnCancel)', function (data) {
|
if (params[1] != null) {
|
Pub_Close(1);
|
} else if (params[1] == null) {
|
Pub_Close(2);
|
}
|
});
|
//#endregion
|
|
//#region NG保存
|
form.on('submit(NGSave)', function (data) {
|
set_AddNew(data,1);
|
});
|
//#endregion
|
|
//#region OK保存
|
form.on('submit(OKSave)', function (data) {
|
set_AddNew(data,2);
|
});
|
//#endregion
|
|
//#region 换单
|
form.on('submit(ChangeBill)', function (data) {
|
//layer.msg("换单");
|
get_checkSearchChangeBill();
|
});
|
//#endregion
|
|
//#region 换配件
|
form.on('submit(ChangeMater)', function (data) {
|
//layer.msg("换配件");
|
get_checkSearchChangeMater();
|
});
|
//#endregion
|
|
//#region 当前工单
|
form.on('submit(CurrentBill)', function (data) {
|
layer.msg("当前工单");
|
});
|
//#endregion
|
//#endregion
|
|
//#region 文本框监听
|
$(document).ready(function () {
|
//#region 条形码回车事件监听
|
$("#HBarCode").on('input keyup', function (data) {
|
if (data.keyCode == "13") {
|
//layer.msg(data.keyCode);
|
touchedByEnter_HBarCode();
|
}
|
});
|
//#endregion
|
});
|
//#endregion
|
|
//#region 复选框 选中/取消 触发事件
|
//#endregion
|
|
//#region 子表:头工具栏事件
|
table.on('toolbar(mainTable)', function (obj) {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
|
//新增行表格数据
|
var NewRow =
|
{
|
"RowID": (table.cache["mainTable"].length + 1) * 10
|
, "HDate": Format(new Date(), "yyyy-MM-dd")
|
, "HMaterID": "0"
|
, "HMaterName": ""
|
, "HMaterSN": ""
|
, "HBadReasonID": "0"
|
, "HBadReasonName": ""
|
, "HResult": ""
|
};
|
switch (obj.event) {
|
case 'btn-AddLine':
|
table.cache["mainTable"].push(NewRow);
|
option.data = table.cache["mainTable"];
|
table.render(option);
|
break;
|
case 'btn-CopyLine':
|
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上
|
table.render(option);//将数据渲染到表格上
|
}
|
break;
|
//列设置
|
case 'set_HideColumn':
|
get_HideColumn();
|
break;
|
}
|
});
|
//#endregion
|
|
//#region 子表:行内事件
|
table.on('tool(mainTable)', function (obj) {
|
set_GridDelete(obj); //行内删除
|
//set_GridCellCheck(obj); //行内快捷键筛选
|
|
});
|
//#endregion
|
|
//#region 子表:行内鼠标离开事件:检查项目阶段是否重复
|
table.on('edit(mainTable)', function (obj) {
|
|
})
|
//#endregion
|
|
//#region 子表:单元格编辑监听
|
table.on('edit(mainTable)', function (obj) {
|
// 单元格编辑之前的值
|
var oldText = $(this).prev().text();
|
var value = obj.value //得到修改后的值
|
, data = obj.data //得到所在行所有键值
|
, field = obj.field; //得到字段
|
//正则表达式-校验非负浮点数
|
var ref = /^\d+(\.\d+)?$/;
|
|
switch (field) {
|
case "HQty": //数量
|
//if (!ref.test(value)) { //若输入值格式不正确,则变回原来的值
|
// obj.update({
|
// HQty: oldText
|
// });
|
// layer.msg("数量:数据错误,请输入非负小数")
|
//} else {
|
// var HQty = value; //数量
|
// var HPrice = data.HPrice; //工价
|
// var HPriceRate = data.HPriceRate; //定额浮动比率
|
|
// var HSubsidyQty = data.HSubsidyQty; //补贴数量
|
|
// var HPackQty = data.HPackQty; //包装数量
|
// var HPackPrice = data.HPackPrice; //包装单价
|
|
// var HDeuctTotal = data.HDeuctTotal * 1; //扣款小计
|
// var HSubsidyTotal = data.HSubsidyTotal * 1; //补贴合计
|
|
// obj.update({
|
// HMoney: (HQty * HPrice * HPriceRate) + (HSubsidyQty * HPrice) + (HPackQty * HPackPrice) + HSubsidyTotal - HDeuctTotal //金额= (数量*单价*定额浮动比率) + (补贴数量*工价) + (包装数量*包装单价) - 补贴合计 - 扣款小计
|
// });
|
//}
|
break;
|
default:
|
}
|
});
|
//#endregion
|
|
|
|
//#region 监听提交
|
form.verify({
|
numberOrEmpty: function (value, item) {
|
|
// if (value != '') {
|
if (!/^\d+$/.test(value)) {
|
return '不能为空或数字或者0';
|
}
|
//}
|
}
|
});
|
//#endregion
|
|
|
|
//#endregion
|
|
//#region 此页面所有的方法
|
//#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>';
|
}
|
$("#HProdOrgID").empty();
|
$("#HProdOrgID").append(Organization);
|
if (OperationType == 1) {
|
HOrgIDBar = sessionStorage["OrganizationID"];
|
}
|
$("#HProdOrgID").val(HOrgIDBar);
|
form.render('select');
|
}
|
layer.closeAll("loading");
|
}
|
})
|
}
|
//#endregion
|
|
//#region 获取参数
|
function getUrlVars() {
|
var vars = [], hash;
|
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
for (var i = 0; i < hashes.length; i++) {
|
hash = hashes[i].split('=');
|
vars.push(hash[0]);
|
vars[hash[0]] = hash[1];
|
}
|
return vars;
|
}
|
//#endregion
|
|
//#region 生成单据号
|
function createBillNo() {
|
$.ajax({
|
url: GetWEBURL() + "/Web/GetMAXNum",
|
async: false,
|
type: "GET",
|
data: { "HBillType": '3748' },
|
success: function (d) {
|
//console.log(d.data);
|
$("#HInterID").val(d.data[0].HInterID);
|
$("#HBillNo").val(d.data[0].HBillNo);
|
$("#HEntryID").val("1");
|
$("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
|
}
|
});
|
}
|
//#endregion
|
|
//#region 获取表头初始信息
|
function getMainInfo() {
|
var Czybm = sessionStorage["Czybm"];
|
|
$.ajax({
|
url: GetWEBURL() + "/Sc_SourceLineRepairBill/getMainInfo",
|
type: "GET",
|
async: false,
|
data: { "Czybm": Czybm, "user": sessionStorage["HUserName"] },
|
success: function (result) {
|
if (result.count == 1) {
|
var tableMain = result.data;
|
var subMaterList_Temp = [];
|
|
//主表 赋值
|
form.val("formData", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
|
|
"HCreator": tableMain[0]["HCheckManName"]
|
, "HCreateDate": Format(new Date(), "yyyy-MM-dd")
|
, "HBadProcID": tableMain[0]["HProcID"] == null ? 0 : tableMain[0]["HProcID"]
|
, "HBadProcName": tableMain[0]["HProcName"]
|
|
|
, "HICMOInterID": tableMain[0]["HICMOInterID"] == null ? 0 : tableMain[0]["HICMOInterID"]
|
, "HICMOEntryID": tableMain[0]["HICMOEntryID"] == null ? 0 : tableMain[0]["HICMOEntryID"]
|
, "HICMOBillNo": tableMain[0]["HICMOBillNo"]
|
, "HSplitNO": tableMain[0]["HSplitNO"]
|
|
, "HEmpID": tableMain[0]["HCheckManID"] == null ? 0 : tableMain[0]["HCheckManID"]
|
, "HEmpName": tableMain[0]["HCheckManName"]
|
, "HDeptID": tableMain[0]["HDeptID"] == null ? 0 : tableMain[0]["HDeptID"]
|
, "HDeptName": tableMain[0]["HDeptName"]
|
|
, "HSourceID": tableMain[0]["HSourceID"] == null ? 0 : tableMain[0]["HSourceID"]
|
, "HSourceName": tableMain[0]["HSourceName"]
|
|
, "HMaterID": tableMain[0]["HMaterID"] == null ? 0 : tableMain[0]["HMaterID"]
|
, "HMaterNumber": tableMain[0]["HMaterNumber"]
|
, "HMaterName": tableMain[0]["HMaterName"]
|
, "HMaterModel": tableMain[0]["HMaterModel"]
|
, "HUnitID": tableMain[0]["HUnitID"] == null ? 0 : tableMain[0]["HUnitID"]
|
, "HUnitName": tableMain[0]["HUnitName"]
|
|
, "HProcess": tableMain[0]["HProcID"] == null ? 0 : tableMain[0]["HProcID"]
|
, "HProcessName": tableMain[0]["HProcName"]
|
|
, "HSourceInterID": tableMain[0]["HICMOInterID"] == null ? 0 : tableMain[0]["HICMOInterID"]
|
, "HSourceEntryID": tableMain[0]["HICMOEntryID"] == null ? 0 : tableMain[0]["HICMOEntryID"]
|
, "HSourceBillNo": tableMain[0]["HICMOBillNo"]
|
, "HSourceBillType": tableMain[0]["HICMOBillType"]
|
|
, "subMaterList_Temp": JSON.stringify(subMaterList_Temp)
|
|
});
|
} else {
|
//layer.alert(result.code + result.Message, { icon: 5 });
|
layer.msg(result.Message);
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
})
|
}
|
//#endregion
|
|
//#region 子表初始化
|
function get_InitGrid() {
|
option = {
|
elem: '#mainTable'
|
, toolbar: '#toolbarDemo'
|
, async: true
|
, page: false
|
, totalRow: true
|
, cellMinWidth: 120
|
, height: 400
|
}
|
|
var HSourceInterID = $("#HSourceInterID").val();
|
var HSourceEntryID = $("#HSourceEntryID").val();
|
var HDate = $("#HDate").val();
|
var ajaxLoad = layer.load();
|
$.ajax({
|
url: GetWEBURL() + "/Sc_SourceLineRepairBill/getSubInfo",
|
type: "GET",
|
async: false,
|
data: { "HSourceInterID": HSourceInterID, "HSourceEntryID": HSourceEntryID, "HDate": HDate, "user": sessionStorage["HUserName"] },
|
success: function (data1) {
|
if (data1.count == 1) {
|
var data = [];
|
var col = [];
|
//给空的数组赋值
|
for (var key in data1.list) {
|
data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
|
}
|
//在列表左边添加勾选框
|
col.push({ type: 'checkbox', fixed: 'left' });
|
col.push({ type: 'numbers', title: '序号', style: 'background-color: #f9f9f9;' });
|
for (var i = 0; i < data.length; i++) {
|
// if (data[i].name == 'HInterID' || data[i].name == 'HBillType' || data[i].name == 'hmainid') {
|
if ($.inArray(data[i].name, titleData) > -1) {
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
|
}
|
else {
|
switch (data[i].Type) {
|
//int
|
case 'DateTime':
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 120 });
|
break;
|
default:
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 120 });
|
}
|
}
|
}
|
col.push({ fixed: 'right', title: '操作', toolbar: '#barDemo' });
|
|
option.cols = [col];
|
option.data = data1.data;
|
table.render(option);
|
//刷新表格数据
|
DisPlay_HideColumn();
|
layer.close(ajaxLoad);
|
} else {
|
layer.close(ajaxLoad);
|
layer.alert(data1.code + data1.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.close(ajaxLoad);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
})
|
}
|
//#endregion
|
|
//#region 不良率占比分析图渲染
|
function set_InitECharts(result) {
|
var chartDom = document.getElementById('HBadReasonECharts'); //获取需要渲染的节点
|
var myChart = echarts.init(chartDom, null, {
|
renderer: 'canvas',
|
useDirtyRect: false
|
}); //获取组件渲染对象
|
var option1; //渲染参数
|
var totalQty = 0; //当前生产订单的不良原因总数
|
var data1 = []; //不良原因列表,作为不良率占比分析图的x轴坐标
|
var data2 = []; //对应不良原因的占比列表,作为y轴数据
|
|
//计算当前生产订单的不良原因总数
|
for (var i = 0; i < result.length; i++) {
|
totalQty += result[i]["HBadReasonQty"];
|
}
|
//获取不良原因数量最多的8个不良原因
|
for (var i = 0; i < result.length; i++) {
|
if (data1.length == 8) {
|
break;
|
} else {
|
data1.push(result[i]["HBadReasonName"]);
|
}
|
}
|
//获取不良原因对应的占比
|
for (var i = 0; i < data1.length; i++) {
|
var rate = ((result[i]["HBadReasonQty"] / totalQty) * 100).toFixed(2);
|
data2.push(rate);
|
}
|
|
option1 = {
|
xAxis: {
|
type: 'category',
|
data: data1
|
},
|
yAxis: {
|
type: 'value'
|
},
|
series: [
|
{
|
data: data2,
|
type: 'bar',
|
showBackground: true,
|
backgroundStyle: {
|
color: 'rgba(180, 180, 180, 0.2)'
|
},
|
label: {
|
show: true, //开启显示
|
position: 'top', //在上方显示
|
formatter: '{c}%',//显示百分号
|
textStyle: { //数值样式
|
color: 'black',//字体颜色
|
fontSize: 10//字体大小
|
}
|
}
|
}
|
]
|
};
|
|
if (option1 && typeof option1 === 'object') {
|
myChart.setOption(option1);
|
}
|
}
|
//#endregion
|
|
//#region 不良率占比分析图数据获取
|
function getBadReasonRateInfo() {
|
var HSourceInterID = $("#HSourceInterID").val();
|
var HSourceEntryID = $("#HSourceEntryID").val();
|
|
$.ajax({
|
url: GetWEBURL() + "/Sc_SourceLineRepairBill/getBadReasonRateInfo",
|
type: "GET",
|
async: false,
|
data: { "HSourceInterID": HSourceInterID, "HSourceEntryID": HSourceEntryID },
|
success: function (result) {
|
if (result.count == 1) {
|
//渲染不良率占比分析图
|
set_InitECharts(result.data);
|
} else {
|
layer.alert(result.code + result.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
})
|
}
|
//#endregion
|
|
//#region 页面初始化
|
function set_ClearBill() {
|
OperationType = 1;
|
//生成并设置主表的内码和单据号、日期
|
createBillNo();
|
//设置表头初始信息
|
getMainInfo();
|
//初始化项目阶段表
|
get_InitGrid();
|
//不良率占比分析图渲染
|
getBadReasonRateInfo();
|
}
|
//#endregion
|
|
//#region 维修人选择页面
|
function get_checkSearchHEmp() {
|
//打开员工小窗体
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "员工列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../../views/基础资料/公用基础资料/Gy_EmployeeList.html?type=HEmp', '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("请选择一条数据");
|
}
|
|
$("#HEmpID").val(checkStatus.data[0].HItemID);//内码
|
$("#HEmpName").val(checkStatus.data[0].职员名称);//名称
|
layer.close(index);//关闭弹窗
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
//#endregion
|
|
//#region 不良原因选择页面
|
function get_checkSearchHBadReason() {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "不良原因列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ["../../../views/基础资料/生产基础资料/Gy_BadReason.html", "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("请选择一条数据");
|
}
|
|
$("#HBadReasonID").val(checkStatus.data[0].HItemID);//内码
|
$("#HBadReasonName").val(checkStatus.data[0].不良原因名称);//名称
|
layer.close(index);//关闭弹窗
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
//#endregion
|
|
//#region 不良类型选择页面
|
function get_checkSearchHBadType() {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "不良类型列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ["../../../views/基础资料/生产基础资料/Gy_BadType.html", "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("请选择一条数据");
|
}
|
|
layer.msg("不良类型");
|
$("#HBadTypeID").val(checkStatus.data[0].HItemID);//内码
|
$("#HBadTypeName").val(checkStatus.data[0].不良类型名称);//名称
|
layer.close(index);//关闭弹窗
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
//#endregion
|
|
//#region 不良后果选择页面
|
function get_checkSearchHBadResult() {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "不良后果列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ["../../../views/基础资料/生产基础资料/Gy_BadResult.html", "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("请选择一条数据");
|
}
|
|
layer.msg("不良后果");
|
$("#HBadResultID").val(checkStatus.data[0].HItemID);//内码
|
$("#HBadResultName").val(checkStatus.data[0].不良后果名称);//名称
|
layer.close(index);//关闭弹窗
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
//#endregion
|
|
//#region 条形码回车事件
|
function touchedByEnter_HBarCode() {
|
var HBarCode = $("#HBarCode").val();
|
|
$.ajax({
|
url: GetWEBURL() + "/Sc_SourceLineRepairBill/getBarCodeInfo",
|
type: "GET",
|
async: false,
|
data: { "HBarCode": HBarCode},
|
success: function (result) {
|
if (result.count == 1) {
|
|
} else {
|
layer.alert(result.code + result.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
})
|
}
|
//#endregion
|
|
//#region 生产日计划工单选择页面
|
function get_checkSearchChangeBill() {
|
var HSourceID = $("#HSourceID").val();
|
var HDate = $("#HDate").val();
|
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "生产日计划工单列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ["../../生产管理/生产日计划工单/JIT_DayPlanBillList.html?OperationType=2&HSourceID=" + HSourceID + "&HDate=" + HDate, "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("请选择一条数据");
|
}
|
|
$("HCreateDate").val(Format(new Date(), "yyyy-MM-dd"));
|
$("#HBadProcID").val(checkStatus.data[0].HProcID);
|
$("#HBadProcName").val(checkStatus.data[0].工序);
|
|
$("#HSplitNO").val(checkStatus.data[0].单据号);
|
$("#HICMOInterID").val(checkStatus.data[0].生产订单内码);
|
$("#HICMOEntryID").val(checkStatus.data[0].生产订单明细内码);
|
$("#HICMOBillNo").val(checkStatus.data[0].生产订单号);
|
|
$("#HDeptID").val(checkStatus.data[0].HDeptID);
|
$("#HDeptName").val(checkStatus.data[0].部门);
|
|
$("#HSourceID").val(checkStatus.data[0].HSourceID);
|
$("#HSourceName").val(checkStatus.data[0].生产资源);
|
|
$("#HMaterID").val(checkStatus.data[0].HMaterID);
|
$("#HMaterNumber").val(checkStatus.data[0].物料代码);
|
$("#HMaterName").val(checkStatus.data[0].物料名称);
|
$("#HMaterModel").val(checkStatus.data[0].规格型号);
|
$("#HUnitID").val(checkStatus.data[0].HUnitID);
|
$("#HUnitName").val(checkStatus.data[0].计量单位);
|
|
$("#HProcess").val(checkStatus.data[0].HProcID);
|
$("#HProcessName").val(checkStatus.data[0].工序);
|
|
$("#HSourceInterID").val(checkStatus.data[0].生产订单内码);
|
$("#HSourceEntryID").val(checkStatus.data[0].生产订单明细内码);
|
$("#HSourceBillNo").val(checkStatus.data[0].生产订单号);
|
$("#HSourceBillType").val(checkStatus.data[0].生产订单类型);
|
|
//layer.msg("换单");
|
layer.close(index);//关闭弹窗
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
//#endregion
|
|
//#region 换配件页面
|
function get_checkSearchChangeMater() {
|
var HInterID = $("#HInterID").val();
|
var HBillNo = $("#HBillNo").val();
|
var HEmpName = $("#HEmpName").val();
|
var HProdMac = $("#HProdMac").val();
|
var HSourceInterID = $("#HSourceInterID").val();
|
var HSourceEntryID = $("#HSourceEntryID").val();
|
var HSourceBillNo = $("#HSourceBillNo").val();
|
var HSourceBillType = $("#HSourceBillType").val();
|
var HBarCode = $("#HBarCode").val();
|
|
|
//var url = "../../计划管理/产线返修平台/Sc_SourceLineRepairBill_ChangeMater.html?OperationType=2&HInterID=" + HInterID + "&HSourceInterID=" + HSourceInterID + "&HSourceEntryID=" + HSourceEntryID + "&HSourceBillNo=" + HSourceBillNo + "&HSourceBillType=" + HSourceBillType + "&HBarCode=" + HBarCode + "&subMaterListLength=" + subMaterListLength + "&HBillNo=" + HBillNo + "&HEmpName=" + HEmpName + "&HProdMac=" + HProdMac;
|
|
var dataParams = {
|
'OperationType': 2
|
, 'HInterID': HInterID
|
, 'HBillNo': HBillNo
|
, 'HEmpName': HEmpName
|
, 'HProdMac': HProdMac
|
, 'HSourceInterID': HSourceInterID
|
, 'HSourceEntryID': HSourceEntryID
|
, 'HSourceBillNo': HSourceBillNo
|
, 'HSourceBillType': HSourceBillType
|
, 'HBarCode': HBarCode
|
, 'subMaterList_Temp': $("#subMaterList_Temp").val()
|
}
|
var datajson = JSON.stringify(dataParams);
|
url = encodeURI('../../计划管理/产线返修平台/Sc_SourceLineRepairBill_ChangeMater.html?datajson=' + datajson);
|
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "产线返修平台(更换配件)" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: [url, "yes"]
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
|
|
layer.close(index);//关闭弹窗
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
//#endregion
|
|
//#region 保存HMaker
|
function set_AddNew(data,HSaveType) {
|
data.field.HReportType = "3";
|
//获取表头数据
|
var tableMain = {
|
"HInterID": $("#HInterID").val()
|
, "HBillNo": $("#HBillNo").val()
|
, "HDate": $("#HDate").val()
|
, "HEmpID": $("#HEmpID").val()
|
, "HDeptID": $("#HDeptID").val()
|
, "HSourceID": $("#HSourceID").val()
|
, "HProdOrgID": $("#HProdOrgID").val()
|
, "HMaterID": $("#HMaterID").val()
|
, "HWorkStationID": $("#HWorkStationID").val()
|
, "HProcess": $("#HProcess").val()
|
, "HIPAddr": $("#HIPAddr").val()
|
, "HMacAddr": $("#HMacAddr").val()
|
, "HProdMac": $("#HProdMac").val()
|
, "HBarCode": $("#HBarCode").val()
|
}
|
//获取子表1数据
|
var tableSub = {
|
"HInterID": $("#HInterID").val()
|
, "HEntryID": $("#HEntryID").val()
|
, "HBillNo_bak": $("#HBillNo").val()
|
, "HRemark": $("#HRemark").val()
|
, "HSourceInterID": $("#HSourceInterID").val()
|
, "HSourceEntryID": $("#HSourceEntryID").val()
|
, "HSourceBillNo": $("#HSourceBillNo").val()
|
, "HSourceBillType": $("#HSourceBillType").val()
|
, "HBadReasonID": $("#HBadReasonID").val()
|
, "HBadTypeID": $("#HBadTypeID").val()
|
, "HBadResultID": $("#HBadResultID").val()
|
, "HBadProcID": $("#HBadProcID").val()
|
, "HRepairResult": $("#HRepairResult").val()
|
, "HCreator": $("#HCreator").val()
|
, "HCreateDate": $("#HCreateDate").val()
|
}
|
|
//获取表头数据并序列化
|
var sMainStr = JSON.stringify(tableMain);
|
//序列化子表1数据
|
var sSubStr = JSON.stringify(tableSub);
|
//获取子表2数据序列化
|
var sSubMaterStr = $("#subMaterList_Temp").val();
|
|
|
//拼接序列化的数据
|
var sMainSub = sMainStr + ';' + sSubStr + ";" + sSubMaterStr + ";" + sessionStorage["HUserName"];
|
|
var index = layer.load();
|
$.ajax({
|
type: "POST",
|
url: GetWEBURL() + "Sc_SourceLineRepairBillSub/AddSourceLineRepairBill",
|
async: true,
|
data: { "sMainSub": sMainSub },
|
dataType: "json",
|
success: function (data) {
|
if (data.count == 1) {
|
//生成并设置主表的内码和单据号、日期
|
createBillNo();
|
//更新表头
|
getMainInfo();
|
//更新子表
|
get_InitGrid();
|
//更新不良率占比分析图
|
getBadReasonRateInfo();
|
|
layer.close(index);
|
layer.msg("提交成功");
|
}
|
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: "温馨提示" });
|
}
|
});
|
}
|
//#endregion
|
|
//#region 编辑 页面赋值
|
function RoadBillMain(linterid)//加载表头
|
{
|
//$.ajax({
|
// url: GetWEBURL() + "/Pay_SingleBalBill/editInit",
|
// type: "GET",
|
// async: false,
|
// data: { "HInterID": linterid, "user": sessionStorage["HUserName"] },
|
// success: function (result) {
|
// var tableMain = result.data[0];
|
// var tableSub = result.data[1];
|
|
// //主表 赋值
|
// form.val("formData", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
|
// "HInterID": tableMain[0]["HInterID"]
|
// });
|
|
// //子表 赋值
|
// option.data = tableSub;
|
// table.render(option);
|
// }
|
//})
|
}
|
//#endregion
|
|
//#region 数据校验
|
function AllowLoadData(data) {
|
//#region 表头数据检验
|
if ($("#HBillNo").val() == "") {
|
layer.msg("单据号不能为空!");
|
return false;
|
}
|
//#endregion
|
return true;
|
}
|
//#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) {
|
var HInterID = obj.data.HInterID;
|
var HEntryID = obj.data.HEntryID;
|
|
var ajaxLoad = layer.load();
|
$.ajax({
|
url: GetWEBURL() + "/Sc_SourceLineRepairBill/deleteSubInfo",
|
type: "GET",
|
async: false,
|
data: { "HInterID": HInterID, "HEntryID": HEntryID, "user": sessionStorage["HUserName"] },
|
success: function (result) {
|
if (result.count == 1) {
|
layer.msg("删除成功!");
|
get_InitGrid();
|
getBadReasonRateInfo();
|
layer.close(ajaxLoad);
|
} else {
|
layer.alert(result.code + result.Message, { icon: 5 });
|
layer.close(ajaxLoad);
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
layer.close(ajaxLoad);
|
}
|
})
|
});
|
}
|
}
|
//#endregion
|
|
//#region 隐藏列设置
|
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 显示列数据
|
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 = [];//数据库查询出的列数据
|
|
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);
|
} else {
|
table.render(option);
|
}
|
}, error: function () {
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
})
|
}
|
//#endregion
|
//#endregion
|
|
|
|
|
});
|
|
//维修人
|
function GetHEmpValue(obj) {
|
$("#HEmpID").val(obj[0].HItemID);//内码
|
$("#HEmpName").val(obj[0].职员名称);//名称
|
}
|
//不良原因
|
function GetBadReasonValue(obj) {
|
$("#HBadReasonID").val(obj[0].HItemID);//内码
|
$("#HBadReasonName").val(obj[0].不良原因名称);//名称
|
}
|
//不良类型
|
function GetBadTypeValue(obj) {
|
$("#HBadTypeID").val(obj[0].HItemID);//内码
|
$("#HBadTypeName").val(obj[0].不良类型名称);//名称
|
}
|
//不良后果
|
function GetBadResultValue(obj) {
|
$("#HBadResultID").val(obj[0].HItemID);//内码
|
$("#HBadResultName").val(obj[0].不良后果名称);//名称
|
}
|
|
</script>
|
</body>
|
</html>
|