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.
517 lines
21 KiB
517 lines
21 KiB
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="InjectionRecord.aspx.cs" Inherits="MESWebSite.Manage.InjectionRecord" %>
|
|
|
|
<!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;
|
|
padding: 0px;
|
|
}
|
|
|
|
p {
|
|
padding: 0px 5px;
|
|
font-size: small;
|
|
font-family: 微软雅黑;
|
|
margin: 0px;
|
|
}
|
|
|
|
.tree-folder-open, .tree-folder, .tree-file {
|
|
display: none;
|
|
}
|
|
|
|
.datagrid {
|
|
text-align: center;
|
|
}
|
|
|
|
.ttb {
|
|
width: 180px;
|
|
display: block;
|
|
}
|
|
</style>
|
|
<title>注塑浇口废料信息</title>
|
|
<script>
|
|
|
|
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<form id="form1" runat="server">
|
|
<div class="top">
|
|
<table cellpadding="0" cellspacing="0" style="width: 100%">
|
|
<thead>
|
|
<tr>
|
|
<td><span class="title">注塑浇口废料信息</span></td>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
<tr>
|
|
<td style="width: 415px;">注塑机台:<select id="fl_id_m_s" class="easyui-combobox" style="width: 100px;"
|
|
data-options="valueField: 'StationID',textField: 'StationNo'">
|
|
</select>
|
|
|
|
时间:
|
|
<input id="StartTime" class="easyui-datetimebox" data-options="onShowPanel:function(){ $(this).datetimebox('spinner').timespinner('setValue','00:00:00');}" /> 至
|
|
<input id="EndTime" class="easyui-datetimebox" data-options="onShowPanel:function(){ $(this).datetimebox('spinner').timespinner('setValue','23:59:59');}" />
|
|
|
|
<a class="topsearchBtn">查询</a>
|
|
|
|
<a class="topaddBtn">新增</a>
|
|
|
|
<a class="toppenBtn">编辑</a>
|
|
|
|
<a class="topdelBtn">删除</a>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</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" style="width: 110px;">
|
|
<p>
|
|
日期:
|
|
</p>
|
|
</td>
|
|
<td colspan="2">
|
|
<input id="RecordDate" class="easyui-datebox" editable="fasle" data-options="showSeconds:false" style="width: 234px; height: 36px;" />
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="title" style="width: 110px;">
|
|
<p>
|
|
班次:
|
|
</p>
|
|
</td>
|
|
<td colspan="2">
|
|
<select name="workClass" id="workClass" class="easyui-combobox">
|
|
<option value="A">白班</option>
|
|
<option value="B">夜班</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="title" style="width: 110px;">
|
|
<p>
|
|
机台:
|
|
</p>
|
|
</td>
|
|
<td colspan="2">
|
|
<select id="fl_id" class="easyui-combobox" style="width: 234px; height: 36px;"
|
|
data-options="valueField: 'StationID',textField: 'StationNo'">
|
|
</select><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">
|
|
<select id="fl_id_p" class="easyui-combobox" style="width: 234px; height: 36px;"
|
|
data-options="valueField: 'c_id',textField: 'c_text'">
|
|
</select><span style="color: red; font-size: 18px; vertical-align: middle;">*</span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="title" style="width: 110px;">
|
|
<p>
|
|
浇口重量(kg):
|
|
</p>
|
|
</td>
|
|
<td colspan="2">
|
|
<input id="JK_Weight" type="number" style="width: 234px; height: 36px;" value="0" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="title" style="width: 110px;">
|
|
<p>
|
|
废料块重量(kg):
|
|
</p>
|
|
</td>
|
|
<td colspan="2">
|
|
<input id="Waste_Weight" type="number" class="text" style="width: 230px; height: 30px;" value="0" />
|
|
</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 hidden="hidden">
|
|
<asp:Label ID="lblMessage" runat="server" Text=""></asp:Label>
|
|
</div>
|
|
<input id="UserID" type="text" hidden="hidden" runat="server" />
|
|
<input id="PartNo" type="text" hidden="hidden" runat="server" />
|
|
<script>
|
|
/**************** 全局变量 ***************/
|
|
var PrimaryID; //要编辑的id
|
|
var dg = $('#tb'); //表格
|
|
var isEdit = false; //是否为编辑状态
|
|
|
|
/**************** DOM加载 ***************/
|
|
$(function () {
|
|
|
|
var curr_time = new Date();
|
|
var str = curr_time.getFullYear() + "-";
|
|
str += curr_time.getMonth() + 1 + "-";
|
|
str += curr_time.getDate()
|
|
|
|
$('#StartTime').datetimebox('setValue', str + " 00:00:00");
|
|
$('#EndTime').datetimebox('setValue', str + " 23:59:59");
|
|
|
|
$.ajaxSetup({
|
|
cache: false //关闭AJAX缓存
|
|
});
|
|
|
|
//编辑窗口加载
|
|
$('#w').window({
|
|
modal: true,
|
|
closed: true,
|
|
minimizable: false,
|
|
maximizable: false,
|
|
collapsible: false,
|
|
width: 460,
|
|
height: 620,
|
|
footer: '#ft',
|
|
top: 20,
|
|
onBeforeClose: function () { clearw(); },
|
|
onBeforeOpen: function () {
|
|
$('#w').css('visibility', 'visible'); $('#ft').css('visibility', 'visible');
|
|
reloadfl_id();
|
|
}
|
|
|
|
});
|
|
|
|
//新增按钮点击
|
|
$('.topaddBtn').first().click(function () {
|
|
isEdit = false;
|
|
$('#w').window('open');
|
|
});
|
|
|
|
//编辑按钮点击
|
|
$('.toppenBtn').first().click(function () {
|
|
isEdit = true;
|
|
initEidtWidget();
|
|
});
|
|
|
|
//保存按钮
|
|
$('#saveBtn').bind('click', function () {
|
|
SaveInfo(isEdit);
|
|
});
|
|
|
|
//删除按钮
|
|
$('.topdelBtn').first().click(function () {
|
|
$.messager.confirm('提示框', '你确定要删除吗?', function (r) {
|
|
if (r) {
|
|
deleteInfos();
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
//搜索按钮
|
|
$('.topsearchBtn').first().click(function () {
|
|
SearchInfo();
|
|
});
|
|
|
|
//下拉框加载
|
|
reloadfl_ids();
|
|
|
|
$('#fl_id_p').combobox({
|
|
onSelect: function (record) {
|
|
$('#PartNo').val(record.c_name2);
|
|
}
|
|
});
|
|
|
|
//排序
|
|
function sorts(obj, sortName, sortOrder) {
|
|
var queryParams = $('#' + obj).datagrid('options').queryParams;
|
|
queryParams.sortName = sortName;
|
|
queryParams.sortOrder = sortOrder;
|
|
console.log(queryParams.sortOrder)
|
|
$('#' + obj).datagrid('reload');
|
|
}
|
|
|
|
var StationID = $('#fl_id_m_s').combobox('getValue');
|
|
var StartTime = $('#StartTime').datetimebox('getValue');
|
|
var EndTime = $('#EndTime').datetimebox('getValue');
|
|
|
|
var queryParams = {
|
|
StationID: StationID,
|
|
StartTime: StartTime,
|
|
EndTime: EndTime
|
|
};
|
|
|
|
|
|
dg = $('#tb').datagrid({
|
|
fitColumns: true,
|
|
nowrap: false,
|
|
striped: true,
|
|
collapsible: true,
|
|
url: "/HttpHandlers/InjectionRecordHandler.ashx?method=QueryList",
|
|
queryParams: queryParams,
|
|
remoteSort: false,
|
|
columns: [[
|
|
{ field: 'ID', title: 'ID', hidden: true },
|
|
{
|
|
field: 'RecordDate', title: '日期', sortable: 'true', width: 20,
|
|
formatter: function (date) {
|
|
var pa = /.*\((.*)\)/;
|
|
var unixtime = date.match(pa)[1].substring(0, 10);
|
|
return getTime(unixtime).substring(0, 10);
|
|
}
|
|
},
|
|
{ field: 'workClass', title: '班次', sortable: 'true', width: 20 },
|
|
{ field: 'StationNo', title: '注塑机台', sortable: 'true', width: 30 },
|
|
{ field: 'StockNo', title: '存货代码', sortable: 'true', width: 50 },
|
|
{ field: 'PartNo', title: '零件号', sortable: 'true', width: 50 },
|
|
{ field: 'JK_Weight', title: '浇口重量(kg)', sortable: 'true', width: 50 },
|
|
{ field: 'Waste_Weight', title: '废料块重量(kg)', sortable: 'true', width: 50 }
|
|
]],
|
|
onSortColumn: function (sort, order) {
|
|
sorts('tb', sort, order);//调用排序方法。
|
|
},
|
|
pagination: true,//表示在datagrid设置分页
|
|
rownumbers: true,
|
|
singleSelect: true
|
|
});
|
|
|
|
dg.datagrid('getPager').pagination({
|
|
pageSize: 10,
|
|
pageNumber: 1,
|
|
pageList: [10, 20, 30, 40, 50, 100],
|
|
beforePageText: '第',//页数文本框前显示的汉字
|
|
afterPageText: '页 共 {pages} 页',
|
|
displayMsg: '当前显示 {from} - {to} 条记录 共 {total} 条记录',
|
|
});
|
|
});
|
|
|
|
/**************** 主要业务程序 ***************/
|
|
//新增 / 编辑
|
|
function SaveInfo(isEdit) {
|
|
|
|
var ID = isEdit == true ? PrimaryID : 0;
|
|
var RecordDate = $('#RecordDate').datebox('getValue');
|
|
var workClass = $('#workClass').combobox('getValue');
|
|
var StationID = $('#fl_id').combobox('getValue');
|
|
var StockNo = $('#fl_id_p').combobox('getValue');
|
|
var PartNo = $('#PartNo').val();
|
|
var JK_Weight = $('#JK_Weight').val();
|
|
var Waste_Weight = $('#Waste_Weight').val();
|
|
if (RecordDate == "") {
|
|
$.messager.alert('提示', '日期不能为空,请重新输入', 'warning');
|
|
return;
|
|
}
|
|
if (workClass == "") {
|
|
$.messager.alert('提示', '班次不能为空,请重新输入', 'warning');
|
|
return;
|
|
}
|
|
if (StationID == "") {
|
|
$.messager.alert('提示', '机号不能为空,请重新输入', 'warning');
|
|
return;
|
|
}
|
|
|
|
|
|
//var re = /^\d+(?:\.\d{1,2})?$/;//小数最多2位
|
|
//var re = /^[+-]?\d+(?:\.\d{1,2})?$/;//分正负小数最多2位
|
|
var re = /^[0-9]+$/;
|
|
if (!re.test(JK_Weight)) {
|
|
$.messager.alert('提示', '计划数量:请输入正确的数值!', 'warning');
|
|
return;
|
|
}
|
|
|
|
if (!re.test(Waste_Weight)) {
|
|
$.messager.alert('提示', '计划数量:请输入正确的数值!', 'warning');
|
|
return;
|
|
}
|
|
|
|
var model = {
|
|
ID: ID,
|
|
StationID: StationID,
|
|
RecordDate: RecordDate,
|
|
workClass: workClass,
|
|
JK_Weight: JK_Weight,
|
|
Waste_Weight: Waste_Weight,
|
|
StockNo: StockNo,
|
|
PartNo: PartNo,
|
|
method: 'SaveInfo'
|
|
};
|
|
SaveModel(model);
|
|
}
|
|
function SaveModel(model) {
|
|
$.ajax({
|
|
type: "POST",
|
|
async: false,
|
|
url: "/HttpHandlers/InjectionRecordHandler.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 SearchInfo() {
|
|
|
|
var StationID = $('#fl_id_m_s').combobox('getValue');
|
|
var StartTime = $('#StartTime').datetimebox('getValue');
|
|
var EndTime = $('#EndTime').datetimebox('getValue');
|
|
|
|
var queryParams = {
|
|
StationID: StationID,
|
|
StartTime: StartTime,
|
|
EndTime: EndTime
|
|
};
|
|
dg.datagrid({
|
|
queryParams: queryParams
|
|
});
|
|
|
|
}
|
|
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();
|
|
}
|
|
|
|
//编辑时加载窗体数据
|
|
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;
|
|
$('#fl_id').combobox('select', row.StationID);
|
|
$('#workClass').combobox('select', row.workClass);
|
|
$('#fl_id_p').combobox('select', row.StockNo);
|
|
$('#PartNo').val(row.PartNo);
|
|
$('#JK_Weight').val(row.JK_Weight);
|
|
$('#Waste_Weight').val(row.Waste_Weight);
|
|
|
|
var pa = /.*\((.*)\)/;
|
|
var unixtime = row.RecordDate.match(pa)[1].substring(0, 10);
|
|
|
|
$('#RecordDate').datebox('setValue', getTime(unixtime).substring(0, 10))
|
|
$('#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/InjectionRecordHandler.ashx",
|
|
data: model,
|
|
async: false,
|
|
success: function (data) {
|
|
if (data == 'true') {
|
|
$.messager.alert('提示', '已删除', 'info');
|
|
dg.datagrid('reload');
|
|
}
|
|
else {
|
|
$.messager.alert('提示', '由于有关联数据,删除失败', 'warning');
|
|
}
|
|
},
|
|
error: function () {
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
/**************** 辅助业务程序 ***************/
|
|
/**********************************************/
|
|
/***************** 窗体程序 *******************/
|
|
/**********************************************/
|
|
|
|
//编辑窗口关闭清空数据
|
|
function clearw() {
|
|
|
|
$('#fl_id').combobox('clear');
|
|
$('#RecordDate').datebox('setValue', '')
|
|
$('#workClass').combobox('clear');
|
|
$('#fl_id_p').combobox('clear');
|
|
$('#JK_Weight').val(0);
|
|
$('#Waste_Weight').val(0);
|
|
$('#PartNo').val('');
|
|
}
|
|
|
|
function reloadfl_ids() {
|
|
$('#fl_id_m_s').combobox('reload', '/HttpHandlers/StationHandler.ashx?method=QueryForCombobox&StationNo=IM');
|
|
}
|
|
|
|
function reloadfl_id() {
|
|
$('#fl_id').combobox('reload', '/HttpHandlers/StationHandler.ashx?method=QueryForCombobox&StationNo=IM');
|
|
|
|
$('#fl_id_p').combobox('reload', '/HttpHandlers/ProductHandler.ashx?method=GetComboboxDataForStockNo&ProductTypeNo=2000');
|
|
|
|
}
|
|
|
|
</script>
|
|
</form>
|
|
</body>
|
|
</html>
|
|
|