一厂MES,含注塑,喷涂,冲孔
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

484 lines
21 KiB

2 months ago
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CommonlyInspection.aspx.cs" Inherits="MESWebSite.Manage.CommonlyInspection" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/CSS/Basics.css" rel="stylesheet" />
<link href="/Scripts/jquery-easyui-1.4.3/themes/metro/easyui.css" rel="stylesheet" type="text/css" />
<link href="/Scripts/jquery-easyui-1.4.3/themes/icon.css" rel="stylesheet" type="text/css" />
<link href="/Scripts/jquery-easyui-1.4.3/themes/color.css" rel="stylesheet" type="text/css" />
<script src="/Scripts/jquery-easyui-1.4.3/jquery.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery-easyui-1.4.3/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/Scripts/MyJs.js" type="text/javascript"></script>
<title>一般保全点检管理</title>
</head>
<body>
<form id="form1" runat="server">
<div class="top">
<table cellpadding="0" cellspacing="0" style="width: 100%">
<tr>
<td><span class="title">一般保全点检管理</span>
</td>
<td></td>
<td style="width: 272px;">点检日期:
<input id="start_time" class="easyui-datetimebox" style="width: 180px; height: 30px;" data-options="formatter:ww4,required:true,showSeconds:false" />
</td>
<td style="width: 205px;">产线:
<select id="fl_id_s" class="easyui-combobox" style="width: 140px; height: 30px;"
data-options="valueField: 'StationID',textField: 'StationNo'">
</select></td>
<td style="width: 205px;">设备:
<select id="device_id_s" class="easyui-combobox" style="width: 140px; height: 30px;"
data-options="valueField: 'DeviceID',textField: 'DeviceName'">
</select></td>
<td style="width: 205px;">版本:
<select id="version_id_s" class="easyui-combobox" style="width: 140px; height: 30px;"
data-options="valueField: 'ID',textField: 'Version'">
</select></td>
<td style="width: 75px;"><a class="topsearchBtn">查询</a></td>
<td style="width: 80px">
<a class="toppenBtn">编辑</a>
</td>
</tr>
</table>
</div>
<div id="Report_div" hidden="hidden" style="float: left; width: 100%">
<span id="ReportDate" style="float: left;"></span>
<span id="ReportP" style="float: left; margin-left: 100px;"></span>
<span id="ReportD" style="float: left; margin-left: 100px;"></span>
<span id="DeviceModel" style="float: left; margin-left: 100px;"></span>
<span id="FixNo" style="float: left; margin-left: 100px;"></span>
</div>
<div id="ReportTable_div" style="float: left; margin-top: 20px;">
</div>
<!-- 编辑窗口 -->
<div id="w" style="padding: 10px; visibility: hidden" title="编辑">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="title" style="width: 50px;">
<p>
日期:
</p>
</td>
<td>
<input id="CheckDate" class="easyui-datetimebox" data-options="formatter:ww4,required:true,showSeconds:false" style="width: 100px;" />
</td>
<td class="title" style="width: 50px; padding-left: 20px;">
<p>
产线:
</p>
</td>
<td>
<select id="fl_id" class="easyui-combobox" style="width: 100px; height: 25px;"
data-options="valueField: 'StationID',textField: 'StationNo'">
</select>
</td>
<td class="title" style="width: 50px; padding-left: 20px;">
<p>
设备:
</p>
</td>
<td>
<select id="device_id" class="easyui-combobox" style="width: 150px; height: 25px;"
data-options="valueField: 'DeviceID',textField: 'DeviceName'">
</select>
</td>
<td class="title" style="width: 50px; padding-left: 20px;">
<p>
版本:
</p>
</td>
<td>
<select id="version_id" class="easyui-combobox" style="width: 100px; height: 25px;"
data-options="valueField: 'ID',textField: 'Version'">
</select>
</td>
<td class="title" style="width: 50px; padding-left: 20px;">
<p>
班次:
</p>
</td>
<td>
<select id="CheckType" class="easyui-combobox" style="width: 100px; height: 25px;">
<option value='0'>白班</option>
<option value='1'>夜班</option>
</select>
</td>
</tr>
</table>
<div id="itable"></div>
<table border="1" width="900" cellspacing="0" cellpadding="5">
<tr>
<td width="200">检查者</td>
<td width="200">
<select class="easyui-combobox" id="CheckUserCombo" style="width: 200px; height: 25px;" data-options="valueField: 'UserID',textField: 'RealName'"></select></td>
<td width="200">确认者</td>
<td width="200">
<select class="easyui-combobox" id="ConfirmUserCombo" style="width: 200px; height: 25px;" data-options="valueField: 'UserID',textField: 'RealName'"></select></td>
</tr>
</table>
</div>
<!-- 编辑窗口 - footer -->
<div id="ft" style="padding: 10px; text-align: center; background-color: #f9f9f9; visibility: hidden">
<a class="saveBtn" id="saveBtn">保存</a> <a class="saveBtn" id="flashBtn">刷新</a>
</div>
<div style="padding: 10px; text-align: center; background-color: #f9f9f9;">
</div>
<input id="UserID" type="text" hidden="hidden" runat="server" />
<script>
/**************** 全局变量 ***************/
var dg = $('#tb'); //表格
/**************** DOM加载 ***************/
$(function () {
$.ajaxSetup({
cache: false //关闭AJAX缓存
});
//编辑按钮点击
$('.toppenBtn').first().click(function () {
$('#w').window('open');
});
//删除按钮
$('.topdelBtn').first().click(function () {
$.messager.confirm('提示框', '你确定要删除吗?', function (r) {
if (r) {
deleteInfos();
}
});
});
//搜索按钮
$('.topsearchBtn').first().click(function () {
SearchInfo();
});
//保存按钮
$('#saveBtn').bind('click', function () {
SaveInfo();
});
//下拉框加载
$('#fl_id_s').combobox({
url: '/HttpHandlers/StationHandler.ashx?method=QueryForCombobox',
onLoadSuccess: function () {
var val = $(this).combobox('getData');
$(this).combobox('select', val[0].StationID);
},
onSelect: function (row) {
$('#device_id_s').combobox({
url: '/HttpHandlers/DeviceHandler.ashx?method=QueryForComboboxByStationID&&fl_id=' + row.StationID + '',
onLoadSuccess: function () {
//var val = $(this).combobox('getData');
//$(this).combobox('select', val[0].ID);
},
onSelect: function (row) {
$('#version_id_s').combobox({
url: '/HttpHandlers/CommonlyInspectionVersionHandler.ashx?method=QueryForCombobox&&d_id=' + row.DeviceID + '',
onLoadSuccess: function () {
//var val = $(this).combobox('getData');
//$(this).combobox('select', val[0].ID);
}
});
}
});
}
});
$('#CheckUserCombo').combobox({
url: '/HttpHandlers/UserHandler.ashx?method=QueryForCombobox',
onLoadSuccess: function () {
var val = $(this).combobox('getData');
$(this).combobox('select', val[0].UserID);
}
});
$('#ConfirmUserCombo').combobox({
url: '/HttpHandlers/UserHandler.ashx?method=QueryForCombobox',
onLoadSuccess: function () {
var val = $(this).combobox('getData');
$(this).combobox('select', val[0].UserID);
}
});
var d = new Date();
var str = '';
str += d.getFullYear() + '-';
str += d.getMonth() + 1 + '-';
str += d.getDate();
$('#start_time').datetimebox('setValue', str);
$('#CheckDate').datetimebox({
stopFirstChangeEvent: true,
onChange: function () {
var options = $(this).datetimebox('options');
if (options.stopFirstChangeEvent) {
options.stopFirstChangeEvent = false;
return;
}
//以下写onchange的逻辑
//var VersionID = $('#version_id').combobox('getValue');
//if (VersionID != "") {
// EditRecord(VersionID)
//}
}
});
//编辑窗口加载
$('#w').window({
modal: true,
closed: true,
minimizable: false,
maximizable: false,
collapsible: false,
width: 960,
height: 700,
footer: '#ft',
top: 20,
onBeforeClose: function () { clearw(); },
onBeforeOpen: function () {
$('#w').css('visibility', 'visible'); $('#ft').css('visibility', 'visible');
$('#fl_id').combobox({
url: '/HttpHandlers/StationHandler.ashx?method=QueryForCombobox',
onLoadSuccess: function () {
var val = $(this).combobox('getData');
$(this).combobox('select', val[0].StationID);
},
onSelect: function (row) {
$('#device_id').combobox({
url: '/HttpHandlers/DeviceHandler.ashx?method=QueryForComboboxByStationID&&fl_id=' + row.StationID + '',
onLoadSuccess: function () {
},
onSelect: function (row) {
$('#version_id').combobox({
url: '/HttpHandlers/CommonlyInspectionVersionHandler.ashx?method=QueryForCombobox&&d_id=' + row.DeviceID + '',
onLoadSuccess: function () {
},
onSelect: function (row) {
//EditRecord(row.ID);
}
});
}
});
}
});
var d = new Date();
var str = '';
str += d.getFullYear() + '-';
str += d.getMonth() + 1 + '-';
str += d.getDate();
$('#CheckDate').datetimebox('setValue', str);
}
});
$('#flashBtn').bind('click', function () {
var VersionID = $('#version_id').combobox('getValue');
EditRecord(VersionID);
});
});
/**************** 主要业务程序 ***************/
// 编辑
function EditRecord(VersionID) {
var CheckDate = $('#CheckDate').datetimebox('getValue');
var CheckType = $('#CheckType').combobox('getValue');
//获取点检内容
$.ajax({
url: "CommonlyInspection.aspx/GetDate",
datatype: 'json',
type: "Post",
data: "{'VersionID':'" + VersionID + "','CheckDate':'" + CheckDate + "','CheckType':'" + CheckType + "'}",
contentType: "application/json; charset=utf-8",
success: function (data) {
$('#itable').html("");
if (data != null && data.d != "") {
try {
$('#itable').html(data.d);
var CheckUserID = $('#CheckUserID').val();
var ConfirmUserID = $('#ConfirmUserID').val();
if (CheckUserID != "") {
$('#CheckUserCombo').combobox('select', CheckUserID);
}
else {
$('#CheckUserCombo').combobox('clear');
}
if (ConfirmUserID != "") {
$('#ConfirmUserCombo').combobox('select', ConfirmUserID);
}
else {
$('#ConfirmUserCombo').combobox('clear');
}
} catch (e) {
}
}
}
});
}
function SaveInfo() {
var CommonlyInspection = "";
$("#itable").find("select").each(function (i, n) {
var obj = $(n)
CommonlyInspection += obj.attr('name') + ":" + obj.val() + ",";
});
$("#itable").find("input").each(function (i, n) {
var obj = $(n)
CommonlyInspection += obj.attr('name') + ":" + obj.val() + ",";
});
var CheckUserID = $('#CheckUserCombo').combo('getValue');
var ConfirmUserID = $('#ConfirmUserCombo').combo('getValue');
var CheckDate = $('#CheckDate').datetimebox('getValue');
var CheckType = $('#CheckType').combobox('getValue');
var userid = $('#UserID').val();
var ErrMes = $('#ErrMes').val();
var method = "AddInfo";
if ($('#InspectionContentFlag').val() == "0") {
method = "AddInfo";
}
if ($('#InspectionContentFlag').val() == "1") {
method = "EditInfo";
}
var model = {
CommonlyInspection: CommonlyInspection,
CheckUserID: CheckUserID,
ConfirmUserID: ConfirmUserID,
UserID: userid,
CheckDate: CheckDate,
CheckType: CheckType,
ErrMes: ErrMes,
method: method
};
SaveModel(model);
}
function SaveModel(model) {
$.ajax({
type: "POST",
async: false,
url: "/HttpHandlers/CommonlyInspectionHandler.ashx",
data: model,
success: function (data) {
if (data == 'true') {
$.messager.alert('提示', '已保存', 'info');
$('#w').window('close');
}
else {
$.messager.alert('提示', '保存失败', 'warning');
}
},
error: function () {
}
});
}
//查询方法
function SearchInfo() {
try {
var time = $('#start_time').datetimebox('getValue');
time = time.substr(0, 7);
var pl = "产线:" + $('#fl_id_s').combobox('getText');
var de = "设备:" + $('#device_id_s').combobox('getText');
var DeviceID = $('#device_id_s').combobox('getValue');
$('#ReportDate').html(time);
$('#ReportP').html(pl);
$('#ReportD').html(de);
$.ajax({
url: "CommonlyInspection.aspx/QueryOne",
datatype: 'json',
type: "Post",
data: "{'DeviceID':'" + DeviceID + "'}",
contentType: "application/json; charset=utf-8",
success: function (data) {
if (data != null && data.d != "") {
var obj = JSON.parse(data.d);
$('#FixNo').html("固定资产号:" + obj.FixNo);
$('#DeviceModel').html("设备型号:" + obj.DeviceModel);
}
}
});
$('#Report_div').show();
var VersionID = $('#version_id_s').combobox('getValue');
$.ajax({
url: "CommonlyInspection.aspx/GetReportDate",
datatype: 'json',
type: "Post",
data: "{'VersionID':'" + VersionID + "','CheckDate':'" + time + "'}",
contentType: "application/json; charset=utf-8",
success: function (data) {
$('#itable').html("");
if (data != null && data.d != "") {
$('#ReportTable_div').html(data.d);
}
else {
$('#ReportTable_div').html('');
}
}
});
} catch (e) {
}
}
/**************** 辅助业务程序 ***************/
//编辑窗口关闭清空数据
function clearw() {
$('#fl_id').combobox('clear');
$('#device_id').combobox('clear');
$('#version_id').combobox('clear');
$('#CheckDate').datetimebox('setValue', '');
$('#itable').html('');
}
function ww4(date) {
var y = date.getFullYear();
var m = date.getMonth() + 1;
var d = date.getDate();
return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
}
</script>
</form>
</body>
</html>