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.
559 lines
22 KiB
559 lines
22 KiB
2 months ago
|
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ZPBom.aspx.cs" Inherits="MESWebSite.Manage.ZPBom" %>
|
||
|
|
||
|
<!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;
|
||
|
}
|
||
|
|
||
|
.search_first{
|
||
|
margin-left: 15%
|
||
|
}
|
||
|
|
||
|
/* 中等屏幕 桌面显示器 992至1400 */
|
||
|
@media screen and (min-width:992px) and (max-width:1400px){
|
||
|
.search_first{
|
||
|
margin-left: 0.1%
|
||
|
}
|
||
|
}
|
||
|
</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: 100px;"></td>
|
||
|
<td style="width: 300px;">总成零件号:
|
||
|
<input type="text" id="PartNo1_s" style="width: 140px;" /></td>
|
||
|
<td style="width: 300px;">关键零件:
|
||
|
<input type="text" id="PartNo2_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">编辑</a>
|
||
|
</td>
|
||
|
<td style="width: 80px;">
|
||
|
<a class="topdelBtn">删除</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" style="width: 110px;">
|
||
|
<p>
|
||
|
工位编号:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<select id="st_no" 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="p_no1" class="easyui-combobox" style="width: 234px; height: 36px;"
|
||
|
data-options="valueField: 'ProductID',textField: 'PartNo'">
|
||
|
</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="p_no2" class="easyui-combobox" style="width: 234px; height: 36px;"
|
||
|
data-options="valueField: 'ProductID',textField: 'PartNo'">
|
||
|
</select>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
模具号:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<input id="mo_no" 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="step" type="text" class="text" style="width: 230px; height: 30px;" disabled value="" />
|
||
|
</td>
|
||
|
</tr>
|
||
|
<%--<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
高配:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<input type="checkbox" name="IsHigh" id="IsHigh" value="0" />
|
||
|
</td>
|
||
|
</tr>--%>
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
单个条码:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<input type="checkbox" name="IsCode" id="IsCode" value="0" />
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="title" style="width: 110px;">
|
||
|
<p>
|
||
|
拍照:
|
||
|
</p>
|
||
|
</td>
|
||
|
<td colspan="2">
|
||
|
<input type="checkbox" name="IsPhoto" id="IsPhoto" 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" />
|
||
|
|
||
|
<script>
|
||
|
|
||
|
/**************** 全局变量 ***************/
|
||
|
var PrimaryID; //要编辑的id
|
||
|
var dg = $('#tb'); //表格
|
||
|
var isEdit = false; //是否为编辑状态
|
||
|
|
||
|
/**************** DOM加载 ***************/
|
||
|
$(function () {
|
||
|
$.ajaxSetup({
|
||
|
cache: false //关闭AJAX缓存
|
||
|
});
|
||
|
|
||
|
//新增按钮点击
|
||
|
$('.topaddBtn').first().click(function () {
|
||
|
isEdit = false;
|
||
|
|
||
|
$('#w').window('open');
|
||
|
});
|
||
|
|
||
|
//编辑按钮点击
|
||
|
$('.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);
|
||
|
});
|
||
|
|
||
|
//onchange事件
|
||
|
$('#p_no1').combobox({
|
||
|
url: '/HttpHandlers/ProductHandler.ashx?method=GetComboboxProduct4',
|
||
|
onSelect: function (row) {
|
||
|
var stationID = $('#st_no').combo('getValue');
|
||
|
var model = {
|
||
|
stationID:stationID,
|
||
|
ProductID: row.ProductID,
|
||
|
method: 'QueryForStep'
|
||
|
};
|
||
|
|
||
|
$.ajax({
|
||
|
type: "POST",
|
||
|
async: false,
|
||
|
url: "/HttpHandlers/ZPBomHandler.ashx",
|
||
|
data: model,
|
||
|
success: function (data) {
|
||
|
if (data != '') {
|
||
|
$('#step').val(data);
|
||
|
}
|
||
|
else {
|
||
|
$.messager.alert('提示', '获取步骤号失败', 'warning');
|
||
|
}
|
||
|
|
||
|
},
|
||
|
error: function () {
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
|
||
|
//编辑窗口加载
|
||
|
$('#w').window({
|
||
|
modal: true,
|
||
|
closed: true,
|
||
|
minimizable: false,
|
||
|
maximizable: false,
|
||
|
collapsible: false,
|
||
|
width: 500,
|
||
|
height: 620,
|
||
|
footer: '#ft',
|
||
|
top: 20,
|
||
|
onBeforeClose: function () { clearw(); },
|
||
|
onBeforeOpen: function () {
|
||
|
$('#w').css('visibility', 'visible'); $('#ft').css('visibility', 'visible');
|
||
|
}
|
||
|
});
|
||
|
|
||
|
dg = $('#tb').datagrid({
|
||
|
fitColumns: true,
|
||
|
nowrap: false,
|
||
|
striped: true,
|
||
|
collapsible: false,
|
||
|
url: "/HttpHandlers/ZPBomHandler.ashx?method=QueryList",
|
||
|
remoteSort: false,
|
||
|
columns: [[
|
||
|
{ field: 'ID', title: 'ID', hidden: true },
|
||
|
{ field: 'StationID', title: 'StationID', hidden: true },
|
||
|
{ field: 'ProductID1', title: 'ProductID1', hidden: true },
|
||
|
{ field: 'ProductID2', title: 'ProductID2', hidden: true },
|
||
|
{ field: 'StationNo', title: '工位', sortable: 'true', width: 10 },
|
||
|
{ field: 'Des', title: '工位描述', sortable: 'true', width: 10 },
|
||
|
{ field: 'PartNo1', title: '总成零件号', sortable: 'true', width: 8 },
|
||
|
{ field: 'ProductName1', title: '总成零件名称', sortable: 'true', width: 10 },
|
||
|
{ field: 'PartNo2', title: '关键零件号', sortable: 'true', width: 8 },
|
||
|
{ field: 'ProductName2', title: '关键零件名称', sortable: 'true', width: 10 },
|
||
|
{ field: 'Step', title: '步骤', sortable: 'true', width: 10 },
|
||
|
{ field: 'MouldNo', title: '模具号', sortable: 'true', width: 6 },
|
||
|
//{
|
||
|
// field: 'IsHigh', title: '高/低配', sortable: 'true', width: 10,
|
||
|
// formatter: function (value) {
|
||
|
// if (value == 0) {
|
||
|
// return "低配";
|
||
|
// } else if (value == 1) {
|
||
|
// return "高配";
|
||
|
// } else {
|
||
|
// return "无";
|
||
|
// }
|
||
|
// }
|
||
|
//},
|
||
|
{
|
||
|
field: 'IsScanCode', title: '单个条码', sortable: 'true', width: 10,
|
||
|
formatter: function (value) {
|
||
|
if (value == 0) {
|
||
|
return "否";
|
||
|
} else {
|
||
|
return "是";
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'IsPhoto', title: '拍照', sortable: 'true', width: 10,
|
||
|
formatter: function (value) {
|
||
|
if (value == 0) {
|
||
|
return "否";
|
||
|
} else {
|
||
|
return "是";
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
]],
|
||
|
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} 条记录',
|
||
|
});
|
||
|
|
||
|
reloadst_id();
|
||
|
reloadpart_id();
|
||
|
});
|
||
|
|
||
|
|
||
|
function checkboxValue(ctl) {
|
||
|
return ctl.is(':checked') ? 1 : 0;
|
||
|
}
|
||
|
|
||
|
/**************** 主要业务程序 ***************/
|
||
|
//新增 / 编辑
|
||
|
function SaveInfo(isEdit) {
|
||
|
|
||
|
var ID = isEdit == true ? PrimaryID : 0;
|
||
|
var StationID = $('#st_no').combo('getValue');
|
||
|
var ProductID1 = $('#p_no1').combo('getValue');
|
||
|
var ProductID2 = $('#p_no2').combo('getValue');
|
||
|
var MouldNo = $('#mo_no').val();
|
||
|
var Step = $('#step').val();
|
||
|
//var IsHigh = checkboxValue($('#IsHigh'));
|
||
|
var IsCode = checkboxValue($('#IsCode'));
|
||
|
var IsPhoto = checkboxValue($('#IsPhoto'));
|
||
|
|
||
|
if (StationID == "") {
|
||
|
$.messager.alert('提示', '工位不能为空,请重新输入', 'warning');
|
||
|
return;
|
||
|
}
|
||
|
if (ProductID1 == "") {
|
||
|
$.messager.alert('提示', '产品不能为空,请重新输入', 'warning');
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (checkComboBoxValue('p_no1', ProductID1) == false) {
|
||
|
$.messager.alert('提示', '总成零件号有误,请重新输入', 'warning');
|
||
|
return;
|
||
|
}
|
||
|
if (ProductID2 != "") {
|
||
|
if (checkComboBoxValue('p_no2', ProductID2) == false) {
|
||
|
$.messager.alert('提示', '关键零件号有误,请重新输入', 'warning');
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
if (Step == "") {
|
||
|
$.messager.alert('提示', '步骤不能为空,请重新输入', 'warning');
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
var model = {
|
||
|
ID: ID,
|
||
|
StationID: StationID,
|
||
|
ProductID1: ProductID1,
|
||
|
ProductID2: ProductID2,
|
||
|
MouldNo: MouldNo,
|
||
|
Step: Step,
|
||
|
//IsHigh: IsHigh,
|
||
|
IsCode: IsCode,
|
||
|
IsPhoto: IsPhoto,
|
||
|
method: 'SaveInfo'
|
||
|
};
|
||
|
SaveModel(model);
|
||
|
}
|
||
|
|
||
|
function SaveModel(model) {
|
||
|
$.ajax({
|
||
|
type: "POST",
|
||
|
async: false,
|
||
|
url: "/HttpHandlers/ZPBomHandler.ashx",
|
||
|
data: model,
|
||
|
success: function (data) {
|
||
|
if (data == 'true') {
|
||
|
$.messager.alert('提示', '已保存', 'info');
|
||
|
dg.datagrid('reload');
|
||
|
$('#w').window('close');
|
||
|
}
|
||
|
else {
|
||
|
//$.messager.alert('提示', '保存失败', 'warning');
|
||
|
$.messager.alert('提示', '保存失败,' + data, 'warning');
|
||
|
}
|
||
|
},
|
||
|
error: function () {
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function checkComboBoxValue(id,value){
|
||
|
var valueField = $("#"+id).combobox("options").valueField;
|
||
|
|
||
|
var allData = $("#"+id).combobox("getData");
|
||
|
var result = false;
|
||
|
for (var i = 0; i < allData.length; i++) {
|
||
|
if (value == allData[i][valueField]) {
|
||
|
result = true;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
//查询方法
|
||
|
function SearchInfo() {
|
||
|
var PartNo1 = $('#PartNo1_s').val();
|
||
|
var PartNo2 = $('#PartNo2_s').val();
|
||
|
|
||
|
var queryParams = {
|
||
|
PartNo1: PartNo1,
|
||
|
PartNo2: PartNo2
|
||
|
};
|
||
|
dg.datagrid({
|
||
|
queryParams: queryParams
|
||
|
});
|
||
|
}
|
||
|
|
||
|
//编辑时加载窗体数据
|
||
|
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;
|
||
|
$('#st_no').combobox('select', row.StationID);
|
||
|
$('#p_no1').combobox('select', row.ProductID1);
|
||
|
$('#p_no2').combobox('select', row.ProductID2);
|
||
|
$('#mo_no').val(row.MouldNo);
|
||
|
$('#step').val(row.Step);
|
||
|
//toggleChecked("#IsHigh", row.IsHigh);
|
||
|
toggleChecked("#IsCode", row.IsScanCode);
|
||
|
toggleChecked("#IsPhoto", row.IsPhoto);
|
||
|
$('#w').window('open');
|
||
|
|
||
|
}
|
||
|
|
||
|
function toggleChecked(id, checked) {
|
||
|
+checked ? $(id).prop("checked", "checked") : $(id).removeAttr("checked");
|
||
|
}
|
||
|
|
||
|
function toggleDisabled(id, disabled) {
|
||
|
+disabled ? $(id).prop("disabled", "disabled") : $(id).removeAttr("disabled");
|
||
|
}
|
||
|
//删除方法
|
||
|
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/ZPBomHandler.ashx",
|
||
|
data: model,
|
||
|
async: false,
|
||
|
success: function (data) {
|
||
|
if (data == 'true') {
|
||
|
$.messager.alert('提示', '已删除', 'info');
|
||
|
dg.datagrid('reload');
|
||
|
}
|
||
|
else {
|
||
|
$.messager.alert('提示', '由于有关联数据,删除失败', 'warning');
|
||
|
}
|
||
|
},
|
||
|
error: function () {
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function isAssetTypeAnImage(ext) {
|
||
|
return [
|
||
|
'png', 'jpg', 'jpeg', 'bmp', 'gif'].
|
||
|
indexOf(ext.toLowerCase()) !== -1;
|
||
|
}
|
||
|
|
||
|
|
||
|
/**************** 辅助业务程序 ***************/
|
||
|
/**********************************************/
|
||
|
/***************** 窗体程序 *******************/
|
||
|
/**********************************************/
|
||
|
//编辑窗口关闭清空数据
|
||
|
function clearw() {
|
||
|
$('#st_no').combobox('clear');
|
||
|
$('#p_no1').combobox('clear');
|
||
|
$('#p_no2').combobox('clear');
|
||
|
$('#mo_no').val('');
|
||
|
//toggleChecked("#IsHigh", 0);
|
||
|
toggleChecked("#IsCode", 0);
|
||
|
toggleChecked("#IsPhoto", 0);
|
||
|
}
|
||
|
|
||
|
function reloadst_id() {
|
||
|
$('#st_no').combobox('reload', '/HttpHandlers/StationHandler.ashx?method=QueryForComboboxByLineID');
|
||
|
}
|
||
|
|
||
|
function reloadpart_id() {
|
||
|
$('#p_no2').combobox('reload', '/HttpHandlers/ProductHandler.ashx?method=GetComboboxProductAll');
|
||
|
}
|
||
|
|
||
|
</script>
|
||
|
</form>
|
||
|
</body>
|
||
|
</html>
|