一厂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.
 
 
 
 
 

753 lines
30 KiB

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ModelInfo.aspx.cs" Inherits="MESWebSite.Manage.ModelInfo" %>
<!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>
<style>
#w td {
padding: 5px 5px;
text-align: left;
vertical-align: middle;
}
#w .title {
vertical-align: middle;
text-align: right;
width: 80px;
height: 40px;
}
p {
padding: 5px;
font-size: small;
font-family: 微软雅黑;
}
.datagrid {
text-align: center;
}
</style>
<title>模具信息</title>
</head>
<body>
<form id="form1" runat="server">
<div class="top">
<table style="width: 100%">
<tr style="display: flex;flex-direction: row; flex-wrap: wrap;">
<td><span class="title">模具信息</span>
</td>
<td style="width: 100px;"></td>
<td style="width: 360px;">模具编号:
<input type="text" id="ModelNo_s" style="width: 140px;" /></td>
<td style="width: 80px;"><a class="topsearchBtn">查询</a></td>
<td style="width: 80px">
<a class="topaddBtn">新增</a>
</td>
<td style="width: 80px">
<a class="toppenBtn" id="EditBtn">编辑</a>
</td>
<td style="width: 80px">
<a class="topdelBtn">删除</a>
</td>
<td style="width: 80px">
<a class="toppenBtn" id="UpdateBtn">更改</a>
</td>
<td style="width: 80px">
<a class="topexcelBtn" id="exportbtn">导出</a>
</td>
</tr>
</table>
</div>
<table id="tb" title="模具信息" style="width: 99%;">
</table>
<!-- 编辑窗口 -->
<div id="w" style="padding: 10px; visibility: hidden" title="编辑">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="title">
<p>
模具编号:
</p>
</td>
<td colspan="2">
<input id="ModelNo" type="text" class="text" style="width: 230px; height: 30px;" /><span style="color: red; font-size: 18px; vertical-align: middle;">*</span>
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
模具名称:
</p>
</td>
<td colspan="2">
<input id="ModelName" type="text" class="text" style="width: 230px; height: 30px;" />
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
固定资产编号:
</p>
</td>
<td colspan="2">
<input id="PermanentAssetsNo" type="text" class="text" style="width: 230px; height: 30px;" />
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
注塑机吨位:
</p>
</td>
<td colspan="2">
<input id="Tonnage" type="text" class="text" style="width: 230px; height: 30px;" />
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
模具寿命:
</p>
</td>
<td colspan="2">
<input id="ServiceLife" type="text" class="text" style="width: 230px; height: 30px;" />
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
供应商:
</p>
</td>
<td colspan="2">
<input id="Supplier" type="text" class="text" style="width: 230px; height: 30px;" />
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
零件重量:
</p>
</td>
<td colspan="2">
<input id="PartWeight" type="text" class="text" style="width: 230px; height: 30px;" />
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
注塑周期:
</p>
</td>
<td colspan="2">
<input id="InjectionPeriod" type="text" class="text" style="width: 230px; height: 30px;" />
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
定位环尺寸:
</p>
</td>
<td colspan="2">
<input id="LocatingRingSize" type="text" class="text" style="width: 230px; height: 30px;" />
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
顶出形式:
</p>
</td>
<td colspan="2">
<input id="OutForm" type="text" class="text" style="width: 230px; height: 30px;" />
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
模具重量:
</p>
</td>
<td colspan="2">
<input id="ModelWeight" type="text" class="text" style="width: 230px; height: 30px;" />
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
流道形式:
</p>
</td>
<td colspan="2">
<input id="RunnerForm" type="text" class="text" style="width: 230px; height: 30px;" />
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
型腔数:
</p>
</td>
<td colspan="2">
<input id="ModelCavityNo" type="text" class="text" style="width: 230px; height: 30px;" />
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
模具尺寸:
</p>
</td>
<td colspan="2">
<input id="ModelSize" type="text" class="text" style="width: 230px; height: 30px;" />
</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>
</div>
<div id="u" style="padding: 10px; visibility: hidden" title="编辑">
<div class="top">
<table cellpadding="0" cellspacing="0" style="width: 100%">
<tr>
<td style="width: 100px;">更改目的:<input type="text" id="Purpose" style="width: 140px;" />
</td>
<td style="width: 100px;">E/Q状态:<input type="text" id="State" style="width: 140px;" />
</td>
<td style="width: 100px;">供应商:<input type="text" id="Supplier_u" style="width: 140px;" />
</td>
<td style="width: 100px;">备注:<input type="text" id="Remarks" style="width: 140px;" />
</td>
<td style="width: 100px;">更新时间:
<input id="UpdateDate" class="easyui-datebox" editable="fasle" data-options="showSeconds:false" style="width: 100px; height: 30px;" />
</td>
<td style="width: 80px">
<a class="topaddBtn" id="saveUBtn">保存</a>
</td>
<td style="width: 80px">
<a class="topdelBtn" id="delUBtn">删除</a>
</td>
</tr>
</table>
</div>
<table id="tb_u" title="模具更新信息" style="width: 99%;"></table>
</div>
<div hidden="hidden">
<asp:Label ID="lblMessage" runat="server" Text=""></asp:Label>
</div>
<input id="UserID" type="text" hidden="hidden" runat="server" />
<input id="ModelID" type="text" hidden="hidden" runat="server" />
<script>
/**************** 全局变量 ***************/
var PrimaryID; //要编辑的id
var dg = $('#tb'); //表格
var dg_u = $('#tb_u'); //表格
var isEdit = false; //是否为编辑状态
/**************** DOM加载 ***************/
$(function () {
$.ajaxSetup({
cache: false //关闭AJAX缓存
});
//新增按钮点击
$('.topaddBtn').first().click(function () {
isEdit = false;
$('#w').window('open');
});
//编辑按钮点击
$('#EditBtn').first().click(function () {
isEdit = true;
initEidtWidget();
});
//更改记录编辑
$('#UpdateBtn').first().click(function () {
initUpdateWidget();
});
//删除按钮
$('.topdelBtn').first().click(function () {
$.messager.confirm('提示框', '你确定要删除吗?', function (r) {
if (r) {
deleteInfos();
}
});
});
//删除按钮
$('#delUBtn').first().click(function () {
$.messager.confirm('提示框', '你确定要删除吗?', function (r) {
if (r) {
deleteupdateInfos();
}
});
});
$("#exportbtn").bind('click', function () {
var ModelNo = $('#ModelNo_s').val();
var queryParams = {
ModelNo: ModelNo
};
post('<%=ResolveUrl("~/HttpHandlers/ModelInfoHandler.ashx?method=QueryExcel1") %>', queryParams);
});
//搜索按钮
$('.topsearchBtn').first().click(function () {
SearchInfo();
});
//保存按钮
$('#saveBtn').bind('click', function () {
SaveInfo(isEdit);
});
//保存按钮
$('#saveUBtn').bind('click', function () {
SaveUpdateInfo();
});
//编辑窗口加载
$('#w').window({
modal: true,
closed: true,
minimizable: false,
maximizable: false,
collapsible: false,
width: 460,
height: 520,
footer: '#ft',
top: 20,
onBeforeClose: function () { clearw(); },
onBeforeOpen: function () {
$('#w').css('visibility', 'visible'); $('#ft').css('visibility', 'visible');
}
});
//编辑窗口加载
$('#u').window({
modal: true,
closed: true,
minimizable: false,
maximizable: false,
collapsible: false,
width: 1000,
height: 700,
footer: '',
top: 20,
onBeforeClose: function () {
},
onBeforeOpen: function () {
$('#u').css('visibility', 'visible');
}
});
dg = $('#tb').datagrid({
fitColumns: true,
nowrap: false,
striped: true,
collapsible: false,
url: "/HttpHandlers/ModelInfoHandler.ashx?method=QueryList",
remoteSort: false,
columns: [[
{ field: 'ID', title: 'ID', hidden: true },
{ field: 'ModelNo', title: '模具编号', sortable: 'true', width: 10 },
{ field: 'ModelName', title: '模具名称', sortable: 'true', width: 10 },
{ field: 'PermanentAssetsNo', title: '固定资产编号', sortable: 'true', width: 10 },
{ field: 'Tonnage', title: '注塑机吨位', sortable: 'true', width: 10 },
{ field: 'ServiceLife', title: '模具寿命', sortable: 'true', width: 10 },
{ field: 'Supplier', title: '供应商', sortable: 'true', width: 10 },
{ field: 'PartWeight', title: '零件重量', sortable: 'true', width: 10 },
{ field: 'InjectionPeriod', title: '注塑周期', sortable: 'true', width: 10 },
{ field: 'LocatingRingSize', title: '定位环尺寸', sortable: 'true', width: 10 },
{ field: 'OutForm', title: '顶出形式', sortable: 'true', width: 10 },
{ field: 'ModelWeight', title: '模具重量', sortable: 'true', width: 10 },
{ field: 'RunnerForm', title: '流道形式', sortable: 'true', width: 10 },
{ field: 'ModelCavityNo', title: '型腔数', sortable: 'true', width: 10 },
{ field: 'ModelSize', title: '模具尺寸', sortable: 'true', width: 10 }
]],
pagination: true,//表示在datagrid设置分页
rownumbers: true,
singleSelect: true
});
dg.datagrid('getPager').pagination({
pageSize: 10,
pageNumber: 1,
pageList: [10, 20, 30, 40, 50],
beforePageText: '第',//页数文本框前显示的汉字
afterPageText: '页 共 {pages} 页',
displayMsg: '当前显示 {from} - {to} 条记录 共 {total} 条记录',
});
});
/**************** 主要业务程序 ***************/
//新增 / 编辑
function SaveInfo(isEdit) {
var ID = isEdit == true ? PrimaryID : 0;
var ModelNo = $('#ModelNo').val();
var ModelName = $('#ModelName').val();
var PermanentAssetsNo = $('#PermanentAssetsNo').val();
var Tonnage = $('#Tonnage').val();
var ServiceLife = $('#ServiceLife').val();
var Supplier = $('#Supplier').val();
var PartWeight = $('#PartWeight').val();
var InjectionPeriod = $('#InjectionPeriod').val();
var LocatingRingSize = $('#LocatingRingSize').val();
var OutForm = $('#OutForm').val();
var ModelWeight = $('#ModelWeight').val();
var RunnerForm = $('#RunnerForm').val();
var ModelCavityNo = $('#ModelCavityNo').val();
var ModelSize = $('#ModelSize').val();
if (ModelNo == "") {
$.messager.alert('提示', '模具编号不能为空,请重新输入', 'warning');
return;
}
var model = {
ID: ID,
ModelNo: ModelNo,
ModelName: ModelName,
PermanentAssetsNo: PermanentAssetsNo,
Tonnage: Tonnage,
ServiceLife: ServiceLife,
Supplier: Supplier,
PartWeight: PartWeight,
InjectionPeriod: InjectionPeriod,
LocatingRingSize: LocatingRingSize,
OutForm: OutForm,
ModelWeight: ModelWeight,
RunnerForm: RunnerForm,
ModelCavityNo: ModelCavityNo,
ModelSize: ModelSize,
method: 'SaveInfo'
};
SaveModel(model);
}
function SaveModel(model) {
$.ajax({
type: "POST",
async: false,
url: "/HttpHandlers/ModelInfoHandler.ashx",
data: model,
success: function (data) {
if (data == 'true') {
$.messager.alert('提示', '已保存', 'info');
dg.datagrid('reload');
$('#w').window('close');
}
else {
$.messager.alert('提示', '保存失败,请查看是否编号重复', 'warning');
}
},
error: function () {
}
});
}
function SaveUpdateInfo() {
var ModelID = $('#ModelID').val();
var Purpose = $('#Purpose').val();
var State = $('#State').val();
var Supplier_u = $('#Supplier_u').val();
var Remarks = $('#Remarks').val();
var AddTime = $('#UpdateDate').datebox('getValue');
if (Purpose == "") {
$.messager.alert('提示', '模具编号不能为空,请重新输入', 'warning');
return;
}
var model = {
ModelID: ModelID,
Purpose: Purpose,
State: State,
Supplier_u: Supplier_u,
Remarks: Remarks,
AddTime: AddTime,
method: 'SaveUpdateInfo'
};
SaveUpdateModel(model);
}
function SaveUpdateModel(model) {
$.ajax({
type: "POST",
async: false,
url: "/HttpHandlers/ModelInfoHandler.ashx",
data: model,
success: function (data) {
if (data == 'true') {
$.messager.alert('提示', '已保存', 'info');
dg_u.datagrid('reload');
}
else {
$.messager.alert('提示', '保存失败,请查看是否编号重复', 'warning');
}
},
error: function () {
}
});
}
//查询方法
function SearchInfo() {
var ModelNo = $('#ModelNo_s').val();
var queryParams = {
ModelNo: ModelNo
};
dg.datagrid({
queryParams: queryParams
});
//dg.datagrid('reload');
}
//编辑时加载窗体数据
function initEidtWidget() {
var selRows = dg.datagrid('getSelections');
if (selRows.length > 1) {
$.messager.alert('提示', '每次只能编辑一条记录,请重新选取', 'warning');
return;
} else if (selRows.length == 0) {
$.messager.alert('提示', '请选择一条记录进行编辑', 'warning');
return;
}
//窗体数据初始化
var row = selRows[0];
PrimaryID = row.ID;
$('#ModelID').val(row.ID);
$('#ModelNo').val(row.ModelNo);
$('#ModelName').val(row.ModelName);
$('#PermanentAssetsNo').val(row.PermanentAssetsNo);
$('#Tonnage').val(row.Tonnage);
$('#ServiceLife').val(row.ServiceLife);
$('#Supplier').val(row.Supplier);
$('#PartWeight').val(row.PartWeight);
$('#InjectionPeriod').val(row.InjectionPeriod);
$('#LocatingRingSize').val(row.LocatingRingSize);
$('#OutForm').val(row.OutForm);
$('#ModelWeight').val(row.ModelWeight);
$('#RunnerForm').val(row.RunnerForm);
$('#ModelCavityNo').val(row.ModelCavityNo);
$('#ModelSize').val(row.ModelSize);
$('#w').window('open');
}
//删除方法
function deleteInfos() {
var selRows = dg.datagrid('getSelections');
if (selRows.length > 1) {
$.messager.alert('提示', '每次只能删除一条记录,请重新选取', 'warning');
return;
} else if (selRows.length == 0) {
$.messager.alert('提示', '请选择一条记录进行删除', 'warning');
return;
}
var row = selRows[0];
var model = {
ID: row.ID,
method: 'DelInfo'
};
$.ajax({
url: "/HttpHandlers/ModelInfoHandler.ashx",
data: model,
async: false,
success: function (data) {
if (data == 'true') {
$.messager.alert('提示', '已删除', 'info');
dg.datagrid('reload');
}
else {
$.messager.alert('提示', '由于有关联数据,删除失败', 'warning');
}
},
error: function () {
}
});
}
function deleteupdateInfos() {
var selRows = dg_u.datagrid('getSelections');
if (selRows.length > 1) {
$.messager.alert('提示', '每次只能删除一条记录,请重新选取', 'warning');
return;
} else if (selRows.length == 0) {
$.messager.alert('提示', '请选择一条记录进行删除', 'warning');
return;
}
var row = selRows[0];
var model = {
ID: row.ID,
method: 'DelUpdateInfo'
};
$.ajax({
url: "/HttpHandlers/ModelInfoHandler.ashx",
data: model,
async: false,
success: function (data) {
if (data == 'true') {
$.messager.alert('提示', '已删除', 'info');
dg_u.datagrid('reload');
}
else {
$.messager.alert('提示', '由于有关联数据,删除失败', 'warning');
}
},
error: function () {
}
});
}
/**************** 辅助业务程序 ***************/
/**********************************************/
/***************** 窗体程序 *******************/
/**********************************************/
//编辑窗口关闭清空数据
function clearw() {
$('#ModelNo').val('');
$('#ModelName').val('');
$('#PermanentAssetsNo').val('');
$('#Tonnage').val('');
$('#ServiceLife').val('');
$('#Supplier').val('');
$('#PartWeight').val('');
$('#InjectionPeriod').val('');
$('#LocatingRingSize').val('');
$('#OutForm').val('');
$('#ModelWeight').val('');
$('#RunnerForm').val('');
$('#ModelCavityNo').val('');
$('#ModelSize').val('');
}
function initUpdateWidget() {
var selRows = dg.datagrid('getSelections');
if (selRows.length > 1) {
$.messager.alert('提示', '每次只能编辑一条记录,请重新选取', 'warning');
return;
} else if (selRows.length == 0) {
$.messager.alert('提示', '请选择一条记录进行编辑', 'warning');
return;
}
//窗体数据初始化
var row = selRows[0];
var ID = row.ID;
$('#ModelID').val(row.ID);
dg_u = $('#tb_u').datagrid({
fitColumns: true,
nowrap: false,
striped: true,
collapsible: false,
url: "/HttpHandlers/ModelInfoHandler.ashx?method=QueryUpdateList&ModelID=" + ID,
remoteSort: false,
columns: [[
{ field: 'ID', title: 'ID', hidden: true },
{ field: 'Purpose', title: '更改目的', sortable: 'true', width: 20 },
{ field: 'State', title: 'E/Q状态', sortable: 'true', width: 20 },
{ field: 'Supplier', title: '供应商', sortable: 'true', width: 20 },
{ field: 'Remarks', title: '备注', sortable: 'true', width: 20 },
{
field: 'AddTime', title: '更新时间', sortable: 'true', width: 10,
formatter: function (date) {
return getFDate(date);
}
}
]],
pagination: true,//表示在datagrid设置分页
rownumbers: true,
singleSelect: true
});
dg_u.datagrid('getPager').pagination({
pageSize: 10,
pageNumber: 1,
pageList: [10, 20, 30, 40, 50],
beforePageText: '第',//页数文本框前显示的汉字
afterPageText: '页 共 {pages} 页',
displayMsg: '当前显示 {from} - {to} 条记录 共 {total} 条记录',
});
$('#u').window('open');
}
function getFDate(date) {
var d = eval('new ' + date.substr(1, date.length - 2));
var ar_date = [d.getFullYear(), d.getMonth() + 1, d.getDate()];
for (var i = 0; i < ar_date.length; i++) ar_date[i] = dFormat(ar_date[i]);
return ar_date.join('-');
}
function dFormat(i) {
return i < 10 ? "0" + i.toString() : i;
}
function post(url, PARAMS) {
var temp_form = document.createElement("form");
temp_form.action = url;
temp_form.target = "_blank";
temp_form.method = "post";
temp_form.style.display = "none"; for (var x in PARAMS) {
var opt = document.createElement("textarea");
opt.name = x;
opt.value = PARAMS[x];
temp_form.appendChild(opt);
}
document.body.appendChild(temp_form);
temp_form.submit();
}
</script>
</form>
</body>
</html>