ruoxing.wang
2 weeks ago
16 changed files with 1089 additions and 44 deletions
@ -0,0 +1,247 @@ |
|||
using MESClassLibrary.BLL.Log; |
|||
using MESClassLibrary.EFModel; |
|||
using MESClassLibrary.Model; |
|||
using MESClassLibrary.DAL.BasicInfo; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using System.Data; |
|||
using System.Data.SqlClient; |
|||
|
|||
namespace MESClassLibrary.BLL.BasicInfo |
|||
{ |
|||
public class ForeignColorMapBLL |
|||
{ |
|||
//BasicBLL<tb_ForeignColorMap> db = new BasicBLL<tb_ForeignColorMap>();
|
|||
//ForeignColorMapDAL da =new ForeignColorMapDAL();
|
|||
|
|||
///// <summary>
|
|||
///// 查询信息
|
|||
///// </summary>
|
|||
///// <returns></returns>
|
|||
//public string SearchInfo(string page, string pagesize, string StationNo, string LineID)
|
|||
//{
|
|||
// try
|
|||
// {
|
|||
// string jsonStr = "[]";
|
|||
// int total = 0;//总行数
|
|||
// List<tb_ForeignColorMap> list = db.SearchAllInfo();
|
|||
|
|||
// if (!String.IsNullOrEmpty(LineID))
|
|||
// {
|
|||
// list = list.Where(p => p.LineID == LineID).ToList();//按条件分页查询
|
|||
// }
|
|||
|
|||
// if (!String.IsNullOrEmpty(StationNo))
|
|||
// {
|
|||
// list = list.Where(p => p.StationNo != null && p.StationNo.Contains(StationNo)).ToList();//按条件分页查询
|
|||
// }
|
|||
|
|||
// if (list.Count > 0)
|
|||
// {
|
|||
// total = list.Count;
|
|||
// int Skipcount = (Convert.ToInt32(page) - 1) * Convert.ToInt32(pagesize);
|
|||
// list = list.Skip(Skipcount).Take(Convert.ToInt32(pagesize)).ToList();
|
|||
|
|||
// #region 联查
|
|||
// List<StationModel> StationList = new List<StationModel>();
|
|||
// BasicBLL<tb_Line> pl_db = new BasicBLL<tb_Line>();
|
|||
// var pl_list = pl_db.SearchAllInfo().ToList();
|
|||
// foreach (var item in list)
|
|||
// {
|
|||
// StationModel dm = Tool.Mapper<StationModel, tb_Station>(item);
|
|||
// var info = pl_list.FirstOrDefault(p => p.LineID == item.LineID);
|
|||
// if (info != null)
|
|||
// {
|
|||
// dm.LineName = info.LineName;
|
|||
// }
|
|||
// StationList.Add(dm);
|
|||
// }
|
|||
// #endregion
|
|||
|
|||
// JsonDataModel<StationModel> md = new JsonDataModel<StationModel>();
|
|||
// md.total = total.ToString();
|
|||
// md.rows = StationList;
|
|||
// jsonStr = JSONTools.ScriptSerialize<JsonDataModel<StationModel>>(md);
|
|||
// }
|
|||
// return jsonStr;
|
|||
// }
|
|||
// catch (Exception ex)
|
|||
// {
|
|||
// LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|||
// return "";
|
|||
// }
|
|||
|
|||
|
|||
//}
|
|||
///// <summary>
|
|||
///// 添加信息
|
|||
///// </summary>
|
|||
///// <param name="md">生产线模型对象</param>
|
|||
///// <returns></returns>
|
|||
//public bool AddInfo(tb_Station md)
|
|||
//{
|
|||
// try
|
|||
// {
|
|||
// var list = db.SearchInfoByKey("StationNo", md.StationNo);//判断是否有重复数据
|
|||
// if (list != null)
|
|||
// {
|
|||
// if (list.Where(p => p.StationID != md.StationID).Count() > 0)
|
|||
// {
|
|||
// return false;
|
|||
// }
|
|||
|
|||
// }
|
|||
|
|||
// return db.AddInfo(md);
|
|||
// }
|
|||
// catch (Exception ex)
|
|||
// {
|
|||
// LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|||
// return false;
|
|||
// }
|
|||
|
|||
//}
|
|||
///// <summary>
|
|||
///// 修改信息
|
|||
///// </summary>
|
|||
///// <param name="md">生产线模型对象</param>
|
|||
///// <returns></returns>
|
|||
//public bool UpdateInfo(tb_Station md)
|
|||
//{
|
|||
// try
|
|||
// {
|
|||
// var list = db.SearchAllInfo().Where(p => p.StationNo == md.StationNo && p.StationID != md.StationID).ToList();//判断是否有重复数据
|
|||
// if (list.Count > 0)
|
|||
// {
|
|||
// return false;
|
|||
// }
|
|||
|
|||
// //初始化要更新的字段
|
|||
// string[] proNames = new string[4];
|
|||
// proNames[0] = "LineID";
|
|||
// proNames[1] = "StationNo";
|
|||
// proNames[2] = "Des";
|
|||
// proNames[3] = "ChangeMould";
|
|||
|
|||
// //必填字段初始化,如果不需要更新必填字段则设置为空即可,时间类型无需初始化
|
|||
// //如果没有初始化必填字段,更新会报错
|
|||
// //md.Des = "";
|
|||
|
|||
// return db.UpdateInfo(md, proNames);
|
|||
// }
|
|||
// catch (Exception ex)
|
|||
// {
|
|||
// LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|||
// return false;
|
|||
// }
|
|||
//}
|
|||
///// 删除生产线信息
|
|||
//public bool DelInfo(tb_Station md)
|
|||
//{
|
|||
// try
|
|||
// {
|
|||
// return db.DelInfo(md);
|
|||
// }
|
|||
// catch (Exception ex)
|
|||
// {
|
|||
// LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|||
// return false;
|
|||
// }
|
|||
//}
|
|||
|
|||
//public string GetComboboxData(string StationNo)
|
|||
//{
|
|||
// try
|
|||
// {
|
|||
// string jsonStr = "[]";
|
|||
// if (StationNo == null || StationNo == "")
|
|||
// {
|
|||
// var list = db.SearchAllInfo().ToList();//判断是否有重复数据
|
|||
// jsonStr = JSONTools.ScriptSerialize<List<tb_Station>>(list);
|
|||
// }
|
|||
// else
|
|||
// {
|
|||
// var list = db.SearchInfoContains("StationNo", StationNo).ToList();//判断是否有重复数据
|
|||
// jsonStr = JSONTools.ScriptSerialize<List<tb_Station>>(list);
|
|||
// }
|
|||
|
|||
// return jsonStr;
|
|||
// }
|
|||
// catch (Exception ex)
|
|||
// {
|
|||
// LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
|
|||
// return "";
|
|||
// }
|
|||
//}
|
|||
|
|||
//public string GetComboboxDataByLine(string LineID)
|
|||
//{
|
|||
// try
|
|||
// {
|
|||
// string jsonStr = "[]";
|
|||
// if (LineID == null || LineID == "")
|
|||
// {
|
|||
// var list = db.SearchAllInfo().ToList();//判断是否有重复数据
|
|||
// jsonStr = JSONTools.ScriptSerialize<List<tb_Station>>(list);
|
|||
// }
|
|||
// else
|
|||
// {
|
|||
// var list = db.SearchInfoContains("LineID", LineID).ToList();//判断是否有重复数据
|
|||
// jsonStr = JSONTools.ScriptSerialize<List<tb_Station>>(list);
|
|||
// }
|
|||
|
|||
// return jsonStr;
|
|||
// }
|
|||
// catch (Exception)
|
|||
// {
|
|||
// return "";
|
|||
// }
|
|||
//}
|
|||
|
|||
//public DataTable SearchInfoByNo(string station)
|
|||
//{
|
|||
// StationDAL db = new StationDAL();
|
|||
|
|||
// try
|
|||
// {
|
|||
// return db.SearchInfoByNo(station);
|
|||
// }
|
|||
// catch (Exception ex)
|
|||
// {
|
|||
// LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|||
// return null;
|
|||
// }
|
|||
//}
|
|||
|
|||
//public List<tb_Station> SearchAll()
|
|||
//{
|
|||
// return db.SearchAllInfo();
|
|||
//}
|
|||
|
|||
//public bool UpdateTime(DateTime time, string staionNo)
|
|||
//{
|
|||
// try
|
|||
// {
|
|||
// return da.UpdateTime(time, staionNo);
|
|||
// }
|
|||
// catch (Exception ex)
|
|||
// {
|
|||
// LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
|
|||
// return false;
|
|||
// }
|
|||
//}
|
|||
///// <summary>
|
|||
///// 根据stationID 查询StationNo
|
|||
///// </summary>
|
|||
///// <param name="stationID"></param>
|
|||
///// <returns></returns>
|
|||
//public string SearchStationNameByID(string stationID)
|
|||
//{
|
|||
// return da.SearchStationNameByID(stationID);
|
|||
//}
|
|||
} |
|||
} |
@ -0,0 +1,52 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
|
|||
namespace MESClassLibrary |
|||
{ |
|||
public class BussinessHelper |
|||
{ |
|||
/// <summary>
|
|||
/// 注塑打印机模板名称
|
|||
/// </summary>
|
|||
/// <param name="stationNo">工位编号</param>
|
|||
/// <param name="isSupply">是否直供件0:非直供 1:直供</param>
|
|||
/// <returns></returns>
|
|||
public static string PrintMoudleName(string stationNo, string isSupply = "0") |
|||
{ |
|||
if ("IM05,IM08,IM10".Contains(stationNo)) //二维小条码
|
|||
{ |
|||
return "单个条码2.grf"; |
|||
} |
|||
else if ("IM06,IM07,IM09,IM11,IM12,".Contains(stationNo)) //一维条码
|
|||
{ |
|||
return "单个条码.grf"; |
|||
} |
|||
|
|||
else if ("IM01,IM02,IM03,IM04,IM15,IM18,IM20".Contains(stationNo)) //小米大条码
|
|||
{ |
|||
return "Sill.grf"; |
|||
} |
|||
else if ("IM13,IM14".Contains(stationNo)) //直供条码
|
|||
{ |
|||
//return "单个条码1.grf";
|
|||
if (isSupply == "0") //13,14机台,直供件打二维码 非直供件打一维码
|
|||
{ |
|||
return "单个条码.grf"; |
|||
} |
|||
else |
|||
{ |
|||
return "单个条码2.grf"; |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
return "单个条码2.grf"; |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,88 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using MESClassLibrary.BLL.Log; |
|||
using MESClassLibrary.Model; |
|||
using System.Data; |
|||
using System.Data.SqlClient; |
|||
using System.Reflection; |
|||
|
|||
namespace MESClassLibrary.DAL.BasicInfo |
|||
{ |
|||
public class ForeignColorMapDAL |
|||
{ |
|||
public static string TableName = "tb_Station"; |
|||
|
|||
public DataTable SearchInfoByNo(string station) |
|||
{ |
|||
try |
|||
{ |
|||
string sql = @"SELECT s.*,l.LineName FROM dbo.tb_Station s
|
|||
LEFT JOIN dbo.tb_Line l |
|||
ON l.LineID = s.LineID where StationNo=@StationNo";
|
|||
|
|||
SqlParameter[] param = new SqlParameter[1]; |
|||
param[0] = new SqlParameter("@StationNo", SqlDbType.VarChar); |
|||
param[0].Value = station; |
|||
|
|||
return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0]; |
|||
|
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public bool UpdateTime(DateTime time,string staionNo) |
|||
{ |
|||
try |
|||
{ |
|||
string sql = @"update " + TableName + " set PrintTime=@PrintTime where StationNo=@StationNo"; |
|||
|
|||
SqlParameter[] param = new SqlParameter[2]; |
|||
|
|||
param[0] = new SqlParameter("@PrintTime", SqlDbType.DateTime); |
|||
param[0].Value = time; |
|||
|
|||
param[1] = new SqlParameter("@StationNo", SqlDbType.VarChar); |
|||
param[1].Value = staionNo; |
|||
|
|||
SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param); |
|||
return true; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return false; |
|||
} |
|||
} |
|||
public string SearchStationNameByID(string stationID) |
|||
{ |
|||
try |
|||
{ |
|||
string sql = @"SELECT * FROM dbo.tb_Station s
|
|||
LEFT JOIN dbo.tb_Line l |
|||
ON l.LineID = s.LineID where StationID=@StationID";
|
|||
|
|||
SqlParameter[] param = new SqlParameter[1]; |
|||
param[0] = new SqlParameter("@StationID", SqlDbType.VarChar); |
|||
param[0].Value = stationID; |
|||
DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0]; |
|||
if (dt.Rows.Count > 0) |
|||
{ |
|||
return dt.Rows[0]["StationNo"].ToString(); |
|||
} |
|||
return null; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return null; |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,23 @@ |
|||
//------------------------------------------------------------------------------
|
|||
// <auto-generated>
|
|||
// 此代码已从模板生成。
|
|||
//
|
|||
// 手动更改此文件可能导致应用程序出现意外的行为。
|
|||
// 如果重新生成代码,将覆盖对此文件的手动更改。
|
|||
// </auto-generated>
|
|||
//------------------------------------------------------------------------------
|
|||
|
|||
namespace MESClassLibrary.EFModel |
|||
{ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
public partial class tb_ForeignColorMap |
|||
{ |
|||
public int Id { get; set; } |
|||
public string TypeCode { get; set; } |
|||
public string PartCode { get; set; } |
|||
public string PartName { get; set; } |
|||
public string Color { get; set; } |
|||
} |
|||
} |
@ -0,0 +1 @@ |
|||
<%@ WebHandler Language="C#" CodeBehind="ForeignColorMapHandler.ashx.cs" Class="MESWebSite.HttpHandlers.StationHandler" %> |
@ -0,0 +1,151 @@ |
|||
using MESClassLibrary.BLL.BasicInfo; |
|||
using MESClassLibrary.EFModel; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Web; |
|||
|
|||
namespace MESWebSite.HttpHandlers |
|||
{ |
|||
/// <summary>
|
|||
/// StationHandler 的摘要说明
|
|||
/// </summary>
|
|||
public class ForeignColorMapHandler : IHttpHandler |
|||
{ |
|||
|
|||
HttpRequest Request = null; |
|||
HttpResponse Response = null; |
|||
|
|||
public void ProcessRequest(HttpContext context) |
|||
{ |
|||
context.Response.ContentType = "text/plain"; |
|||
Request = context.Request; |
|||
Response = context.Response; |
|||
|
|||
string method = Request.Params["method"]; |
|||
switch (method) |
|||
{ |
|||
|
|||
case "QueryList": |
|||
QueryList(); |
|||
break; |
|||
case "SaveInfo": |
|||
SaveInfo(); |
|||
break; |
|||
case "DelInfo": |
|||
DelInfo(); |
|||
break; |
|||
case "QueryForCombobox": |
|||
QueryForCombobox(); |
|||
break; |
|||
case "QueryForComboboxByLineID": |
|||
QueryForComboboxByLineID(); |
|||
break; |
|||
default: |
|||
break; |
|||
|
|||
} |
|||
|
|||
} |
|||
public bool IsReusable |
|||
{ |
|||
get |
|||
{ |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
void QueryList() |
|||
{ |
|||
string page = Request.Params["page"]; |
|||
string pagesize = Request.Params["rows"]; |
|||
string PartCode = Request.Params["PartCode"]; |
|||
string TypeCode = Request.Params["TypeCode"]; |
|||
|
|||
|
|||
if (string.IsNullOrEmpty(page)) |
|||
{ |
|||
page = "0"; |
|||
} |
|||
if (string.IsNullOrEmpty(pagesize)) |
|||
{ |
|||
pagesize = "15"; |
|||
} |
|||
StationBLL bll = new StationBLL(); |
|||
Response.Write(bll.SearchInfo(page, pagesize, StationNo, LineID)); |
|||
Response.End(); |
|||
|
|||
|
|||
} |
|||
void SaveInfo() |
|||
{ |
|||
string StationID = Request.Params["StationID"]; |
|||
string LineID = Request.Params["LineID"]; |
|||
string StationNo = Request.Params["StationNo"]; |
|||
string Des = Request.Params["Des"]; |
|||
string time = Request.Params["time"]; |
|||
|
|||
StationBLL bll = new StationBLL(); |
|||
tb_Station md = new tb_Station(); |
|||
|
|||
md.LineID = LineID; |
|||
md.StationNo = StationNo; |
|||
md.Des = Des; |
|||
md.ChangeMould = Convert.ToInt32(time); |
|||
var info = Request.Cookies.Get("LoginUserInfo"); |
|||
if (info != null) |
|||
{ |
|||
md.UserID = info["UserID"].ToUpper(); |
|||
} |
|||
if (StationID == "0") |
|||
{ |
|||
//新增
|
|||
md.StationID = Guid.NewGuid().ToString(); |
|||
Response.Write(bll.AddInfo(md) == true ? "true" : "false"); |
|||
} |
|||
else |
|||
{ |
|||
//修改
|
|||
md.StationID = StationID; |
|||
Response.Write(bll.UpdateInfo(md) == true ? "true" : "false"); |
|||
} |
|||
Response.End(); |
|||
} |
|||
void DelInfo() |
|||
{ |
|||
string StationID = Request.Params["StationID"]; |
|||
|
|||
StationBLL bll = new StationBLL(); |
|||
tb_Station md = new tb_Station(); |
|||
md.StationID = StationID; |
|||
var info = Request.Cookies.Get("LoginUserInfo"); |
|||
if (info != null) |
|||
{ |
|||
md.UserID = info["UserID"].ToUpper(); |
|||
} |
|||
Response.Write(bll.DelInfo(md) == true ? "true" : "false"); |
|||
Response.End(); |
|||
|
|||
} |
|||
|
|||
void QueryForCombobox() |
|||
{ |
|||
string StationNo = Request.Params["StationNo"]; |
|||
|
|||
StationBLL bll = new StationBLL(); |
|||
Response.Write(bll.GetComboboxData(StationNo)); |
|||
Response.End(); |
|||
|
|||
} |
|||
|
|||
void QueryForComboboxByLineID() |
|||
{ |
|||
string LineID = "68dd1857-5e78-43f9-a065-6be76335e7fe"; |
|||
|
|||
StationBLL bll = new StationBLL(); |
|||
Response.Write(bll.GetComboboxDataByLine(LineID)); |
|||
Response.End(); |
|||
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,399 @@ |
|||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ForeignColorMap.aspx.cs" Inherits="MESWebSite.Manage.ForeignColorMap" %> |
|||
|
|||
|
|||
<!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: 29% |
|||
} |
|||
|
|||
/* 中等屏幕 桌面显示器 992至1400 */ |
|||
@media screen and (min-width:992px) and (max-width:1400px){ |
|||
.search_first{ |
|||
margin-left: 1% |
|||
} |
|||
|
|||
} |
|||
|
|||
</style> |
|||
<title>工位信息</title> |
|||
</head> |
|||
<body> |
|||
<form id="form1" runat="server"> |
|||
<div class="top"> |
|||
<table style="width: 110%"> |
|||
<tr style="display: flex;flex-direction: row; flex-wrap: wrap;" > |
|||
|
|||
<td><span class="title" style="width: 100px">工位信息</span> |
|||
</td> |
|||
<td style="width: 235px;"></td> |
|||
<td style="width: 235px;">程序号: |
|||
<%-- <select id="fl_id_s" class="easyui-combobox" style="width: 160px; height: 30px;" |
|||
data-options="valueField: 'TypeCode',textField: 'LineName'"> |
|||
</select>--%> |
|||
<input type="text" id="fl_id_s" style="width: 140px;" /> |
|||
|
|||
</td> |
|||
<td style="width: 235px;">零件号: |
|||
<input type="text" id="PartCode_s" style="width: 140px;" /></td> |
|||
<td style="width: "></td> |
|||
<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> |
|||
</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"> |
|||
<select id="fl_id" class="easyui-combobox" style="width: 234px; height: 36px;" |
|||
data-options="valueField: 'TypeCode',textField: 'LineName'"> |
|||
</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"> |
|||
<input id="PartCode" 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="PartName" 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="Color" 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 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缓存 |
|||
}); |
|||
|
|||
//下拉框加载 |
|||
//reloadfl_ids(); |
|||
|
|||
//新增按钮点击 |
|||
$('.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); |
|||
}); |
|||
|
|||
//编辑窗口加载 |
|||
$('#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'); |
|||
//reloadfl_id(); |
|||
} |
|||
|
|||
}); |
|||
|
|||
dg = $('#tb').datagrid({ |
|||
fitColumns: true, |
|||
nowrap: false, |
|||
striped: true, |
|||
collapsible: false, |
|||
url: "/HttpHandlers/ForeignColorMapHandler.ashx?method=QueryList", |
|||
//sortName: 'sortNumber', |
|||
//sortOrder: 'asc', |
|||
remoteSort: false, |
|||
columns: [[ |
|||
{ field: 'ID', title: 'ID', hidden: true }, |
|||
{ field: 'TypeCode', title: '程序号', sortable: 'true', width: 10 }, |
|||
{ field: 'PartCode', title: '零件号', sortable: 'true', width: 10 }, |
|||
{ field: 'PartName', title: '零件名称', sortable: 'true', width: 30 }, |
|||
{ field: 'Color', title: 'Color', 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 TypeCode = $('#fl_id').combo('getValue'); |
|||
var PartCode = $('#PartCode_s').val(); |
|||
var PartName = $('#PartName').val(); |
|||
var Color = $('#Color').val(); |
|||
|
|||
if (TypeCode == "") { |
|||
$.messager.alert('提示', '程序号不能为空,请重新输入', 'warning'); |
|||
return; |
|||
} |
|||
if (PartCode == "") { |
|||
$.messager.alert('提示', '零件号不能为空,请重新输入', 'warning'); |
|||
return; |
|||
} |
|||
var r = /^\+?[1-9][0-9]*$/; //正整数 |
|||
|
|||
if (!r.test(PartName)) { |
|||
$.messager.alert('提示', '换模时间必须为正整数,请重新输入', 'warning'); |
|||
return; |
|||
} |
|||
|
|||
var model = { |
|||
ID: ID, |
|||
TypeCode: TypeCode, |
|||
PartCode: PartCode, |
|||
PartName: PartName, |
|||
Color: Color, |
|||
method: 'SaveInfo' |
|||
}; |
|||
SaveModel(model); |
|||
} |
|||
function SaveModel(model) { |
|||
$.ajax({ |
|||
type: "POST", |
|||
async: false, |
|||
url: "/HttpHandlers/ForeignColorMapHandler.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 TypeCode = $('#fl_id_s').combo('getValue'); |
|||
var PartCode = $('#PartCode_s').val(); |
|||
|
|||
var queryParams = { |
|||
TypeCode: TypeCode, |
|||
PartCode: PartCode |
|||
}; |
|||
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; |
|||
$('#fl_id').combobox('select', row.TypeCode); |
|||
$('#PartCode_s').val(row.PartCode); |
|||
$('#Color').val(row.Color); |
|||
$('#PartName').val(row.PartName); |
|||
$('#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/ForeignColorMapHandler.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').combo('clear'); |
|||
$('#PartCode_s').val(''); |
|||
$('#PartName').val(''); |
|||
$('#Color').val(''); |
|||
|
|||
} |
|||
|
|||
function reloadfl_id() { |
|||
$('#fl_id').combobox('reload', '/HttpHandlers/LineHandler.ashx?method=QueryForCombobox'); |
|||
} |
|||
|
|||
//function reloadfl_ids() { |
|||
// $('#fl_id_s').combobox('reload', '/HttpHandlers/LineHandler.ashx?method=QueryForCombobox'); |
|||
//} |
|||
|
|||
</script> |
|||
</form> |
|||
</body> |
|||
</html> |
@ -0,0 +1,20 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Web; |
|||
using System.Web.UI; |
|||
using System.Web.UI.WebControls; |
|||
|
|||
namespace MESWebSite.Manage |
|||
{ |
|||
public partial class ForeignColorMap : System.Web.UI.Page |
|||
{ |
|||
protected void Page_Load(object sender, EventArgs e) |
|||
{ |
|||
if (Request.Cookies["LoginUserInfo"] == null) |
|||
{ |
|||
Response.Write("<script language=javascript>alert('您的登录信息已过期,请重新登录!');top.location.href='../Login.aspx';</script>"); |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,44 @@ |
|||
//------------------------------------------------------------------------------
|
|||
// <自动生成>
|
|||
// 此代码由工具生成。
|
|||
//
|
|||
// 对此文件的更改可能导致不正确的行为,如果
|
|||
// 重新生成代码,则所做更改将丢失。
|
|||
// </自动生成>
|
|||
//------------------------------------------------------------------------------
|
|||
|
|||
namespace MESWebSite.Manage |
|||
{ |
|||
|
|||
|
|||
public partial class ForeignColorMap |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// form1 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::System.Web.UI.HtmlControls.HtmlForm form1; |
|||
|
|||
/// <summary>
|
|||
/// lblMessage 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::System.Web.UI.WebControls.Label lblMessage; |
|||
|
|||
/// <summary>
|
|||
/// UserID 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::System.Web.UI.HtmlControls.HtmlInputText UserID; |
|||
} |
|||
} |
Loading…
Reference in new issue