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.
1123 lines
45 KiB
1123 lines
45 KiB
6 months ago
|
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Plan_Punch_new.aspx.cs" Inherits="MESWebSite.Manage.Plan_Punch_new" %>
|
||
|
|
||
|
<!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" style="width: 150px">冲孔装配计划-新</span>
|
||
|
</td>
|
||
|
<td style="width: 200px"></td>
|
||
|
<td style="float: left">创建时间:
|
||
|
<input id="StartTime_s" class="easyui-datebox" style="width: 130px;" /> 至
|
||
|
<input id="EndTime_s" class="easyui-datebox" style="width: 130px;" />
|
||
|
订单号:
|
||
|
<input type="text" id="OrderNo_s" style="width: 140px;" /> <a class="topsearchBtn">查询</a></td>
|
||
|
<td style="width: 600px">
|
||
|
<a class="topaddBtn">新增生产计划</a>
|
||
|
<a class="topaddBtn" id="updatePlan">追加生产计划</a>
|
||
|
<a class="toppenBtn">编辑</a>
|
||
|
<a class="topdelBtn">删除</a>
|
||
|
<a class="topexcelBtn" id="openexcel">导入</a>
|
||
|
<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>
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
计划日期:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<input id="StartTime" class="easyui-datetimebox" data-options="formatter:ww4,required:true,showSeconds:false" style="width: 130px;" />
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
班次:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<select id="Banci_1" class="easyui-combobox" style="width: 110px; height: 30px;" data-options="valueField: 'Name',textField: 'Name'">
|
||
|
<option value='A班'>A班</option>
|
||
|
<option value='B班'>B班</option>
|
||
|
</select>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
生产计划单号:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<input id="OrderNo" type="text" class="text" style="width: 230px; height: 30px;" disabled />
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
序号:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<input id="Item" type="text" class="text" style="width: 230px; height: 30px;" disabled />
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
工位:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<select id="fl_StNo" class="easyui-combobox" style="width: 230px; height: 30px;"
|
||
|
data-options="valueField: 'StationNo',textField: 'StationNo'">
|
||
|
</select>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
零件号:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<select id="fl_PartNo" class="easyui-combobox" style="width: 230px; height: 30px;"
|
||
|
data-options="valueField: 'PartNo',textField: 'PartNo'">
|
||
|
</select>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
零件名称:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<input id="PartName" type="text" class="text" style="width: 230px; height: 30px;" disabled />
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
数量:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<input id="OrderCount" 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="Des" 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="w_u" 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="StartTime_u" class="easyui-datetimebox" data-options="formatter:ww4,required:true,showSeconds:false" style="width: 130px;" />
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
生产计划单号:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<select id="fl_OrderNo_u" class="easyui-combobox" style="width: 230px; height: 30px;"
|
||
|
data-options="valueField: 'valueField',textField: 'textField'">
|
||
|
</select>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
序号:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<input id="Item_u" type="text" class="text" style="width: 230px; height: 30px;" disabled />
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
工位:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<select id="fl_StNo_u" class="easyui-combobox" style="width: 230px; height: 30px;"
|
||
|
data-options="valueField: 'StationNo',textField: 'StationNo'">
|
||
|
</select>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
零件号:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<select id="fl_PartNo_u" class="easyui-combobox" style="width: 230px; height: 30px;"
|
||
|
data-options="valueField: 'PartNo',textField: 'PartNo'">
|
||
|
</select>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
零件名称:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<input id="PartName_u" type="text" class="text" style="width: 230px; height: 30px;" disabled />
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
配置:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<input id="PartConfig_u" type="text" class="text" style="width: 230px; height: 30px;" disabled />
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
数量:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<input id="OrderCount_u" 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="Des_u" type="text" class="text" style="width: 230px; height: 30px;" />
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
</table>
|
||
|
</div>
|
||
|
<!-- 追加计划窗口 - footer -->
|
||
|
<div id="ft_u" style="padding: 10px; text-align: center; background-color: #f9f9f9; visibility: hidden">
|
||
|
<a class="saveBtn" id="saveBtn_u">保存</a>
|
||
|
</div>
|
||
|
|
||
|
<!-- Excel编辑窗口 -->
|
||
|
<div id="wexcel" style="padding: 10px; visibility: hidden" title="Excel模板">
|
||
|
<table cellpadding="0" cellspacing="0">
|
||
|
<tr>
|
||
|
<td>
|
||
|
<a class="topexcelBtn" id="cexcel">选择文件</a>
|
||
|
<span id="input_file"></span>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td style="padding-top: 20px;">
|
||
|
<a href="../Excel/冲孔装配计划导入模板.xls" class="topexcelBtn" style="text-decoration: none;">导出模板</a>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div>
|
||
|
<!-- Excel编辑窗口 - footer -->
|
||
|
<div id="ftexcel" style="padding: 10px; text-align: center; background-color: #f9f9f9; visibility: hidden">
|
||
|
<a class="saveBtn" id="saveBtnexcel">导入数据</a>
|
||
|
</div>
|
||
|
|
||
|
<div hidden="hidden">
|
||
|
<asp:Label ID="lblMessage" runat="server" Text=""></asp:Label>
|
||
|
<asp:Button ID="ImportExcel" runat="server" Text="导入Excel" OnClick="ImportExcel_Click" />
|
||
|
<input type="file" id="input01" runat="server" class="file" onchange="inputChange()" />
|
||
|
</div>
|
||
|
<input id="UserID" type="text" hidden="hidden" runat="server" />
|
||
|
|
||
|
<script>
|
||
|
|
||
|
/**************** 全局变量 ***************/
|
||
|
var PrimaryID; //要编辑的id
|
||
|
var dg = $('#tb'); //表格
|
||
|
var isEdit = false; //是否为编辑状态
|
||
|
|
||
|
/**************** DOM加载 ***************/
|
||
|
$(function () {
|
||
|
$.ajaxSetup({
|
||
|
cache: false //关闭AJAX缓存
|
||
|
});
|
||
|
|
||
|
var curr_time = new Date();
|
||
|
var str = curr_time.getFullYear() + "-";
|
||
|
str += curr_time.getMonth() + 1 + "-";
|
||
|
str += curr_time.getDate();
|
||
|
|
||
|
$('#StartTime_s').datebox('setValue', str + " 00:00:00");
|
||
|
$('#EndTime_s').datebox('setValue', str + " 23:59:59");
|
||
|
|
||
|
$("#StartTime").datetimebox({
|
||
|
stopFirstChangeEvent: true,
|
||
|
onChange: function () {
|
||
|
var options = $(this).datebox('options');
|
||
|
if (options.stopFirstChangeEvent) {
|
||
|
options.stopFirstChangeEvent = false;
|
||
|
return;
|
||
|
}
|
||
|
//onchange的逻辑
|
||
|
var StartTime = $('#StartTime').datetimebox('getValue');
|
||
|
|
||
|
var Banci = $('#Banci_1').combobox('getText');
|
||
|
|
||
|
var model = {
|
||
|
StartTime: StartTime,
|
||
|
Banci: Banci,
|
||
|
method: 'SearchOrderNo'
|
||
|
};
|
||
|
|
||
|
|
||
|
$.ajax({
|
||
|
type: "POST",
|
||
|
async: false,
|
||
|
url: "/HttpHandlers/Plan_PunchHandler.ashx",
|
||
|
data: model,
|
||
|
success: function (data) {
|
||
|
if (data != '') {
|
||
|
$('#OrderNo').val(data);
|
||
|
$('#Item').val('1');
|
||
|
|
||
|
}
|
||
|
else {
|
||
|
$.messager.alert('提示', '获取生产计划单号异常', 'warning');
|
||
|
}
|
||
|
|
||
|
},
|
||
|
error: function () {
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$('#StartTime').datebox('setValue', str + " 00:00:00");
|
||
|
|
||
|
$('#Banci_1').combobox({
|
||
|
onSelect: function (row) {
|
||
|
var opts = $(this).combobox('options');
|
||
|
var Banci = row[opts.valueField];
|
||
|
|
||
|
var str = $('#StartTime').datetimebox('getValue');
|
||
|
|
||
|
var model = {
|
||
|
StartTime: str,
|
||
|
Banci: Banci,
|
||
|
method: 'SearchOrderNo'
|
||
|
};
|
||
|
|
||
|
$.ajax({
|
||
|
type: "POST",
|
||
|
async: false,
|
||
|
url: "/HttpHandlers/Plan_PunchHandler.ashx",
|
||
|
data: model,
|
||
|
success: function (data) {
|
||
|
if (data != '') {
|
||
|
$('#OrderNo').val(data);
|
||
|
$('#Item').val('1');
|
||
|
|
||
|
}
|
||
|
else {
|
||
|
$.messager.alert('提示', '获取生产计划单号异常', 'warning');
|
||
|
}
|
||
|
|
||
|
},
|
||
|
error: function () {
|
||
|
}
|
||
|
});
|
||
|
|
||
|
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$('#fl_StNo').combobox({
|
||
|
url: '/HttpHandlers/StationHandler.ashx?method=QueryForCombobox&StationNo=ZP',
|
||
|
onLoadSuccess: function () {
|
||
|
|
||
|
},
|
||
|
onSelect: function (row) {
|
||
|
var stationNo = row.StationNo;
|
||
|
|
||
|
$.ajax({
|
||
|
type: "POST",
|
||
|
async: false,
|
||
|
success: function () {
|
||
|
$('#fl_PartNo').combobox(
|
||
|
{
|
||
|
url: '/HttpHandlers/Plan_PunchNewHandler.ashx?method=QueryForCombobox_partNo&stationNo=' + stationNo,
|
||
|
onLoadSuccess: function () {
|
||
|
},
|
||
|
onSelect: function (row1) {
|
||
|
var model = {
|
||
|
PartNo: row1.PartNo,
|
||
|
method: 'GetMistake'
|
||
|
};
|
||
|
|
||
|
$.ajax({
|
||
|
type: "POST",
|
||
|
async: false,
|
||
|
url: "/HttpHandlers/Plan_PunchHandler.ashx",
|
||
|
data: model,
|
||
|
success: function (data) {
|
||
|
if (data != null) {
|
||
|
var obj = JSON.parse(data);
|
||
|
$('#PartName').val(obj.ProductName);
|
||
|
$('#PartConfig').val(obj.OptionName);
|
||
|
}
|
||
|
|
||
|
},
|
||
|
error: function () {
|
||
|
}
|
||
|
});
|
||
|
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
error: function () {
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$('#fl_StNo_u').combobox({
|
||
|
url: '/HttpHandlers/StationHandler.ashx?method=QueryForCombobox&StationNo=ZP',
|
||
|
onLoadSuccess: function () {
|
||
|
|
||
|
},
|
||
|
onSelect: function (row) {
|
||
|
var stationNo = row.StationNo;
|
||
|
|
||
|
$.ajax({
|
||
|
type: "POST",
|
||
|
async: false,
|
||
|
success: function () {
|
||
|
$('#fl_PartNo_u').combobox({
|
||
|
url: '/HttpHandlers/Plan_PunchNewHandler.ashx?method=QueryForCombobox_partNo&stationNo=' + stationNo,
|
||
|
onLoadSuccess: function () {
|
||
|
|
||
|
},
|
||
|
onSelect: function (row1) {
|
||
|
|
||
|
var model = {
|
||
|
PartNo: row1.PartNo,
|
||
|
method: 'GetMistake'
|
||
|
};
|
||
|
|
||
|
$.ajax({
|
||
|
type: "POST",
|
||
|
async: false,
|
||
|
url: "/HttpHandlers/Plan_PunchHandler.ashx",
|
||
|
data: model,
|
||
|
success: function (data) {
|
||
|
if (data != null) {
|
||
|
var obj = JSON.parse(data);
|
||
|
$('#PartName_u').val(obj.ProductName);
|
||
|
$('#PartConfig_u').val(obj.OptionName);
|
||
|
}
|
||
|
|
||
|
},
|
||
|
error: function () {
|
||
|
}
|
||
|
});
|
||
|
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
error: function () {
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
|
||
|
|
||
|
$("#StartTime_u").datetimebox({
|
||
|
stopFirstChangeEvent: true,
|
||
|
onChange: function () {
|
||
|
var options = $(this).datebox('options');
|
||
|
if (options.stopFirstChangeEvent) {
|
||
|
options.stopFirstChangeEvent = false;
|
||
|
return;
|
||
|
}
|
||
|
//onchange的逻辑
|
||
|
var StartTime = $('#StartTime_u').datetimebox('getValue');
|
||
|
|
||
|
$('#fl_OrderNo_u').combobox({
|
||
|
url: '/HttpHandlers/Plan_PunchNewHandler.ashx?method=QueryForComboboxOrderNo&StartTime=' + StartTime,
|
||
|
onLoadSuccess: function () {
|
||
|
|
||
|
},
|
||
|
onSelect: function (row) {
|
||
|
|
||
|
var model = {
|
||
|
OrderNo: row.textField,
|
||
|
method: 'QueryForItem'
|
||
|
};
|
||
|
|
||
|
$.ajax({
|
||
|
type: "POST",
|
||
|
async: false,
|
||
|
url: "/HttpHandlers/Plan_PunchNewHandler.ashx",
|
||
|
data: model,
|
||
|
success: function (data) {
|
||
|
if (data != '') {
|
||
|
|
||
|
$('#Item_u').val(data);
|
||
|
|
||
|
}
|
||
|
else {
|
||
|
$.messager.alert('提示', '获取序号失败', 'warning');
|
||
|
}
|
||
|
|
||
|
},
|
||
|
error: function () {
|
||
|
}
|
||
|
});
|
||
|
|
||
|
}
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
});
|
||
|
|
||
|
//新增按钮点击
|
||
|
$('.topaddBtn').first().click(function () {
|
||
|
isEdit = false;
|
||
|
$('#w').window('open');
|
||
|
$("#fl_StNo").combobox('readonly', false); //取消只读
|
||
|
$("#fl_PartNo").combobox('readonly', false); //取消只读
|
||
|
$("#Banci_1").combobox('readonly', false); //取消只读
|
||
|
var curr_time = new Date();
|
||
|
var str = curr_time.getFullYear() + "-";
|
||
|
str += curr_time.getMonth() + 1 + "-";
|
||
|
str += curr_time.getDate()
|
||
|
|
||
|
|
||
|
$('#StartTime').datebox('setValue', str);
|
||
|
|
||
|
var Banci = $('#Banci_1').combobox('getValue');
|
||
|
|
||
|
var model = {
|
||
|
StartTime: str,
|
||
|
Banci: Banci,
|
||
|
method: 'SearchOrderNo'
|
||
|
};
|
||
|
|
||
|
|
||
|
$.ajax({
|
||
|
type: "POST",
|
||
|
async: false,
|
||
|
url: "/HttpHandlers/Plan_PunchNewHandler.ashx",
|
||
|
data: model,
|
||
|
success: function (data) {
|
||
|
if (data != '') {
|
||
|
$('#OrderNo').val(data);
|
||
|
$('#Item').val('1');
|
||
|
|
||
|
}
|
||
|
else {
|
||
|
$.messager.alert('提示', '获取生产计划单号异常', 'warning');
|
||
|
}
|
||
|
|
||
|
},
|
||
|
error: function () {
|
||
|
}
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
});
|
||
|
|
||
|
$('#updatePlan').first().click(function () {
|
||
|
isEdit = false;
|
||
|
$('#w_u').window('open');
|
||
|
|
||
|
var curr_time = new Date();
|
||
|
var str = curr_time.getFullYear() + "-";
|
||
|
str += curr_time.getMonth() + 1 + "-";
|
||
|
str += curr_time.getDate()
|
||
|
|
||
|
|
||
|
$('#StartTime_u').datebox('setValue', str);
|
||
|
|
||
|
$('#fl_OrderNo_u').combobox({
|
||
|
url: '/HttpHandlers/Plan_PunchNewHandler.ashx?method=QueryForComboboxOrderNo&StartTime=' + str,
|
||
|
onLoadSuccess: function () {
|
||
|
|
||
|
},
|
||
|
onSelect: function (row) {
|
||
|
|
||
|
var model = {
|
||
|
OrderNo: row.textField,
|
||
|
method: 'QueryForItem'
|
||
|
};
|
||
|
|
||
|
$.ajax({
|
||
|
type: "POST",
|
||
|
async: false,
|
||
|
url: "/HttpHandlers/Plan_PunchNewHandler.ashx",
|
||
|
data: model,
|
||
|
success: function (data) {
|
||
|
if (data != '') {
|
||
|
|
||
|
$('#Item_u').val(data);
|
||
|
|
||
|
}
|
||
|
else {
|
||
|
$.messager.alert('提示', '获取序号失败!', 'warning');
|
||
|
}
|
||
|
|
||
|
},
|
||
|
error: function () {
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
|
||
|
//编辑按钮点击
|
||
|
$('.toppenBtn').first().click(function () {
|
||
|
isEdit = true;
|
||
|
initEidtWidget();
|
||
|
});
|
||
|
|
||
|
//删除按钮
|
||
|
$('.topdelBtn').first().click(function () {
|
||
|
$.messager.confirm('提示框', '你确定要删除吗?', function (r) {
|
||
|
if (r) {
|
||
|
deleteInfos();
|
||
|
}
|
||
|
});
|
||
|
|
||
|
});
|
||
|
|
||
|
//搜索按钮
|
||
|
$('.topsearchBtn').first().click(function () {
|
||
|
SearchInfo();
|
||
|
});
|
||
|
|
||
|
//新增计划保存按钮
|
||
|
$('#saveBtn').bind('click', function () {
|
||
|
SaveInfo(isEdit);
|
||
|
});
|
||
|
|
||
|
//追加计划保存
|
||
|
$('#saveBtn_u').bind('click', function () {
|
||
|
SaveInfo_u();
|
||
|
});
|
||
|
|
||
|
//导入EXCEL
|
||
|
$('#openexcel').first().click(function () {
|
||
|
$('#wexcel').window('open');
|
||
|
});
|
||
|
$('#saveBtnexcel').bind('click', function () {
|
||
|
$('#ImportExcel').click();
|
||
|
});
|
||
|
$('#cexcel').bind('click', function () {
|
||
|
$('#input01').click();
|
||
|
});
|
||
|
|
||
|
|
||
|
//新增生产计划窗口加载
|
||
|
$('#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');
|
||
|
}
|
||
|
|
||
|
});
|
||
|
|
||
|
//追加生产计划窗口加载
|
||
|
$('#w_u').window({
|
||
|
modal: true,
|
||
|
closed: true,
|
||
|
minimizable: false,
|
||
|
maximizable: false,
|
||
|
collapsible: false,
|
||
|
width: 460,
|
||
|
height: 620,
|
||
|
footer: '#ft_u',
|
||
|
top: 20,
|
||
|
onBeforeClose: function () { clearw_u(); },
|
||
|
onBeforeOpen: function () {
|
||
|
$('#w_u').css('visibility', 'visible'); $('#ft_u').css('visibility', 'visible');
|
||
|
}
|
||
|
|
||
|
});
|
||
|
|
||
|
$('#wexcel').window({
|
||
|
modal: true,
|
||
|
closed: true,
|
||
|
minimizable: false,
|
||
|
maximizable: false,
|
||
|
collapsible: false,
|
||
|
width: 200,
|
||
|
height: 200,
|
||
|
footer: '#ftexcel',
|
||
|
top: 20,
|
||
|
onBeforeClose: function () { clearw(); },
|
||
|
onBeforeOpen: function () { $('#wexcel').css('visibility', 'visible'); $('#ftexcel').css('visibility', 'visible'); }
|
||
|
});
|
||
|
|
||
|
|
||
|
dg = $('#tb').datagrid({
|
||
|
fitColumns: true,
|
||
|
nowrap: false,
|
||
|
striped: true,
|
||
|
collapsible: false,
|
||
|
url: "/HttpHandlers/Plan_PunchNewHandler.ashx?method=QueryList",
|
||
|
//sortName: 'sortNumber',
|
||
|
//sortOrder: 'asc',
|
||
|
remoteSort: false,
|
||
|
columns: [[
|
||
|
{ field: 'ID', title: 'ID', hidden: true },
|
||
|
{ field: 'OrderNo', title: '生产计划单号', sortable: 'true', width: 10 },
|
||
|
{ field: 'Item', title: '序号', sortable: 'true', width: 5 },
|
||
|
{ field: 'StationNo', title: '工位号', sortable: 'true', width: 10 },
|
||
|
{ field: 'StationDes', title: '工位名称', sortable: 'true', width: 10 },
|
||
|
{ field: 'PartNo', title: '零件号', sortable: 'true', width: 10 },
|
||
|
{ field: 'PartName', title: '零件名称', sortable: 'true', width: 10 },
|
||
|
{ field: 'OrderCount', title: '数量', sortable: 'true', width: 5 },
|
||
|
{ field: 'LyCount', title: '领用数量', hidden: true },
|
||
|
{ field: 'CompleteCount', title: '完成数量', sortable: 'true', width: 5 },
|
||
|
{ field: 'BadCount', title: '不良数', sortable: 'true', width: 5 },
|
||
|
{ field: 'Des', title: '备注', sortable: 'true', width: 15 },
|
||
|
{
|
||
|
field: 'CreateTime', title: '创建日期', sortable: 'true', width: 10,
|
||
|
formatter: function (date) {
|
||
|
var pa = /.*\((.*)\)/;
|
||
|
var unixtime = date.match(pa)[1].substring(0, 10);
|
||
|
return getTime(unixtime);
|
||
|
}
|
||
|
}
|
||
|
//{ field: 'CompleteCount', 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} 条记录',
|
||
|
});
|
||
|
|
||
|
|
||
|
$("#exportbtn").bind('click', function () {
|
||
|
|
||
|
var StartTime = $('#StartTime_s').datetimebox('getValue');
|
||
|
var EndTime = $('#EndTime_s').datetimebox('getValue');
|
||
|
var OrderNo = $('#OrderNo_s').val();
|
||
|
|
||
|
var queryParams = {
|
||
|
StartTime: StartTime,
|
||
|
EndTime: EndTime,
|
||
|
OrderNo: OrderNo
|
||
|
};
|
||
|
|
||
|
post('<%=ResolveUrl("~/HttpHandlers/Plan_PunchNewHandler.ashx?method=QueryExcel") %>', queryParams);
|
||
|
});
|
||
|
});
|
||
|
|
||
|
/**************** 主要业务程序 ***************/
|
||
|
//新增 / 编辑
|
||
|
function SaveInfo(isEdit) {
|
||
|
|
||
|
var ID = isEdit == true ? PrimaryID : 0;
|
||
|
|
||
|
var OrderNo = $('#OrderNo').val();
|
||
|
var Item = $('#Item').val();
|
||
|
var StationNo = $('#fl_StNo').combobox('getText');
|
||
|
var PartNo = $('#fl_PartNo').combobox('getText');
|
||
|
var PartName = $('#PartName').val();
|
||
|
var PartConfig = $('#PartConfig').val();
|
||
|
var OrderCount = $('#OrderCount').val();
|
||
|
var Des = $('#Des').val();
|
||
|
|
||
|
if (OrderNo === "") {
|
||
|
$.messager.alert('提示', '生产计划单号不能为空,请重新输入', 'warning');
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (StationNo === "") {
|
||
|
$.messager.alert('提示', '工位不能为空,请重新输入', 'warning');
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (PartNo === "") {
|
||
|
$.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(OrderCount)) {
|
||
|
$.messager.alert('提示', '计划数量:请输入正确的数值!', 'warning');
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
var model = {
|
||
|
ID: ID,
|
||
|
OrderNo: OrderNo,
|
||
|
Item: Item,
|
||
|
StationNo:StationNo,
|
||
|
PartNo: PartNo,
|
||
|
PartName: PartName,
|
||
|
PartConfig: PartConfig,
|
||
|
OrderCount: OrderCount,
|
||
|
Des: Des,
|
||
|
method: 'SaveInfo'
|
||
|
};
|
||
|
|
||
|
SaveModel(model);
|
||
|
}
|
||
|
|
||
|
function SaveModel(model) {
|
||
|
$.ajax({
|
||
|
type: "POST",
|
||
|
async: false,
|
||
|
url: "/HttpHandlers/Plan_PunchNewHandler.ashx",
|
||
|
data: model,
|
||
|
success: function (data) {
|
||
|
if (data == 'true') {
|
||
|
$.messager.alert('提示', '已保存', 'info');
|
||
|
dg.datagrid('reload');
|
||
|
clearw();
|
||
|
$('#w').window('close');
|
||
|
}
|
||
|
else {
|
||
|
$.messager.alert('提示', '保存失败,请查看是否编号重复', 'warning');
|
||
|
}
|
||
|
|
||
|
},
|
||
|
error: function () {
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function SaveInfo_u() {
|
||
|
var ID = 0;
|
||
|
var OrderNo = $('#fl_OrderNo_u').combobox('getText');
|
||
|
var Item = $('#Item_u').val();
|
||
|
var StationNo = $('#fl_StNo_u').combobox('getText');
|
||
|
var PartNo = $('#fl_PartNo_u').combobox('getText');
|
||
|
var PartName = $('#PartName_u').val();
|
||
|
var PartConfig = $('#PartConfig_u').val();
|
||
|
var OrderCount = $('#OrderCount_u').val();
|
||
|
var Des = $('#Des_u').val();
|
||
|
|
||
|
if (OrderNo == "") {
|
||
|
$.messager.alert('提示', '生产计划单号不能为空,请重新输入', 'warning');
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (StationNo === "") {
|
||
|
$.messager.alert('提示', '工位不能为空,请重新输入', 'warning');
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (PartNo === "") {
|
||
|
$.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(OrderCount)) {
|
||
|
$.messager.alert('提示', '计划数量:请输入正确的数值!', 'warning');
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
var model = {
|
||
|
ID: ID,
|
||
|
OrderNo: OrderNo,
|
||
|
Item: Item,
|
||
|
StationNo: StationNo,
|
||
|
PartNo: PartNo,
|
||
|
PartName: PartName,
|
||
|
PartConfig: PartConfig,
|
||
|
OrderCount: OrderCount,
|
||
|
Des: Des,
|
||
|
method: 'SaveInfo_u'
|
||
|
};
|
||
|
|
||
|
SaveModel_u(model);
|
||
|
}
|
||
|
|
||
|
function SaveModel_u(model) {
|
||
|
$.ajax({
|
||
|
type: "POST",
|
||
|
async: false,
|
||
|
url: "/HttpHandlers/Plan_PunchNewHandler.ashx",
|
||
|
data: model,
|
||
|
success: function (data) {
|
||
|
if (data == 'true') {
|
||
|
$.messager.alert('提示', '已保存', 'info');
|
||
|
dg.datagrid('reload');
|
||
|
$('#w_u').window('close');
|
||
|
}
|
||
|
else {
|
||
|
$.messager.alert('提示', '保存失败', 'warning');
|
||
|
}
|
||
|
|
||
|
},
|
||
|
error: function () {
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
|
||
|
//查询方法
|
||
|
function SearchInfo() {
|
||
|
|
||
|
var StartTime = $('#StartTime_s').datetimebox('getValue');
|
||
|
var EndTime = $('#EndTime_s').datetimebox('getValue');
|
||
|
var OrderNo = $('#OrderNo_s').val();
|
||
|
|
||
|
var queryParams = {
|
||
|
StartTime: StartTime,
|
||
|
EndTime: EndTime,
|
||
|
OrderNo: OrderNo
|
||
|
};
|
||
|
|
||
|
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;
|
||
|
|
||
|
var pa = /.*\((.*)\)/;
|
||
|
var unixtime = row.CreateTime.match(pa)[1].substring(0, 10);
|
||
|
|
||
|
$('#StartTime').datebox('setValue', getTime(unixtime).substring(0, 10));
|
||
|
$('#OrderNo').val(row.OrderNo);
|
||
|
$('#Item').val(row.Item);
|
||
|
$('#fl_StNo').combobox('select', row.StationNo);
|
||
|
$('#fl_StNo').combobox('readonly', true); //只读
|
||
|
$('#fl_PartNo').combobox('select', row.PartNo);
|
||
|
$("#fl_PartNo").combobox('readonly', true); //只读
|
||
|
|
||
|
$('#Banci_1').combobox('select', row.OrderNo.substring(0, 1));
|
||
|
$("#Banci_1").combobox('readonly', true); //只读
|
||
|
|
||
|
|
||
|
$('#PartName').val(row.PartName);
|
||
|
$('#PartConfig').val(row.PartConfig);
|
||
|
$('#OrderCount').val(row.OrderCount);
|
||
|
$('#Des').val(row.Des);
|
||
|
|
||
|
$('#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/Plan_PunchNewHandler.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() {
|
||
|
$('#StartTime').val('');
|
||
|
$('#OrderNo').val('');
|
||
|
$('#Item').val('');
|
||
|
$('#fl_StNo').combobox('clear');
|
||
|
$('#fl_PartNo').combobox('clear');
|
||
|
$('#PartName').val('');
|
||
|
$('#PartConfig').val('');
|
||
|
$('#OrderCount').val('');
|
||
|
$('#Des').val('');
|
||
|
|
||
|
}
|
||
|
function clearw_u() {
|
||
|
$('#StartTime_u').val('');
|
||
|
$('#fl_OrderNo_u').combobox('clear');
|
||
|
$('#fl_StNo_u').combobox('clear');
|
||
|
$('#fl_PartNo_u').combobox('clear');
|
||
|
$('#Item_u').val('');
|
||
|
$('#PartName_u').val('');
|
||
|
$('#PartConfig_u').val('');
|
||
|
$('#OrderCount_u').val('');
|
||
|
$('#Des_u').val('');
|
||
|
|
||
|
}
|
||
|
|
||
|
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);
|
||
|
|
||
|
}
|
||
|
|
||
|
function inputChange() {
|
||
|
$('#input_file').html($('#input01').val());
|
||
|
}
|
||
|
|
||
|
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>
|