From 243d0bbd20ab94b2e00dbc81737d700d13c5c468 Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Fri, 25 Jul 2025 13:29:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=97=A8=E6=A7=9B=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MESWebSite/Excel/装配Bom导入模板.xlsx | Bin 0 -> 18944 bytes MESWebSite/HttpHandlers/Bom_MKHandler.ashx.cs | 122 +++++- MESWebSite/HttpHandlers/ConfigHandler.ashx | 1 + MESWebSite/HttpHandlers/ConfigHandler.ashx.cs | 132 +++++++ .../HttpHandlers/ZP_MK_PlanHandler.ashx.cs | 15 +- MESWebSite/MESWebSite.csproj | 13 + MESWebSite/MESWebSite.csproj.user | 4 +- MESWebSite/Manage/Bom_MK.aspx | 138 ++++++- MESWebSite/Manage/Bom_MK.aspx.cs | 268 ++++++++++++- MESWebSite/Manage/Bom_MK.aspx.designer.cs | 54 +++ MESWebSite/Manage/Config.aspx | 354 ++++++++++++++++++ MESWebSite/Manage/Config.aspx.cs | 20 + MESWebSite/Manage/Config.aspx.designer.cs | 44 +++ MESWebSite/Manage/ZP_MK_Plan.aspx | 25 +- .../PublishProfiles/FolderProfile.pubxml | 17 + 15 files changed, 1184 insertions(+), 23 deletions(-) create mode 100644 MESWebSite/Excel/装配Bom导入模板.xlsx create mode 100644 MESWebSite/HttpHandlers/ConfigHandler.ashx create mode 100644 MESWebSite/HttpHandlers/ConfigHandler.ashx.cs create mode 100644 MESWebSite/Manage/Config.aspx create mode 100644 MESWebSite/Manage/Config.aspx.cs create mode 100644 MESWebSite/Manage/Config.aspx.designer.cs create mode 100644 MESWebSite/Properties/PublishProfiles/FolderProfile.pubxml diff --git a/MESWebSite/Excel/装配Bom导入模板.xlsx b/MESWebSite/Excel/装配Bom导入模板.x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^peiID+J_&l$Xy`$4VCfI% zaj+RM8W!8}kb{AF&ge&afmF6n;uylQiobDkgQEj1{#}S89P!IuN4Rz-UJ!9F0CmkE sdP2$_a=hTm56->e4{f`F#E+7?!gT;hz2N8x=RV+@3#Ey+|IOil07iB|t^fc4 literal 0 HcmV?d00001 diff --git a/MESWebSite/HttpHandlers/Bom_MKHandler.ashx.cs b/MESWebSite/HttpHandlers/Bom_MKHandler.ashx.cs index 86f79e7..0b49593 100644 --- a/MESWebSite/HttpHandlers/Bom_MKHandler.ashx.cs +++ b/MESWebSite/HttpHandlers/Bom_MKHandler.ashx.cs @@ -2,8 +2,11 @@ using MESClassLibrary.BLL.BasicInfo; using MESClassLibrary.EFModel; using MESWebSite.CommonClass; +using NPOI.SS.UserModel; +using NPOI.XSSF.UserModel; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Web; @@ -37,7 +40,10 @@ namespace MESWebSite.HttpHandlers case "DelInfo": DelInfo(); break; - + case "QueryExcel": + QueryExcel(); + break; + default: break; @@ -83,8 +89,36 @@ namespace MESWebSite.HttpHandlers string IsPartAssemble = Request.Params["IsPartAssemble"]; string StationNo = Request.Params["StationNo"]; string LineName = Request.Params["LineName"]; + string LeftCount = Request.Params["LeftCount"]; + string RightCount = Request.Params["RightCount"]; + string ProductName1 = Request.Params["ProductName1"]; + string ProductName2 = Request.Params["ProductName2"]; + + if(string.IsNullOrEmpty(LeftCount)) + { + LeftCount = "0"; + } + if (string.IsNullOrEmpty(RightCount)) + { + RightCount = "0"; + } + string lineName = ""; + BasicBLL lineNameDB = new BasicBLL(); + var lineNameList = lineNameDB.Search(p => p.LineName == LineName); + if (lineNameList != null && lineNameList.Count > 0) + { + lineName = lineNameList[0].LineName; + } + + if (string.IsNullOrEmpty(lineName)) + { + Response.Write(ResponseResult.Fail("产线不存在!")); + Response.End(); + return; + } + string stationNo = ""; BasicBLL stationDB = new BasicBLL(); var stationList = stationDB.Search(p => p.StationNo == StationNo); @@ -100,6 +134,44 @@ namespace MESWebSite.HttpHandlers return; } + //一个总成对应一个半成品 + BasicBLL partAssembleNum = new BasicBLL(); + int id_mk = int.Parse(BomID); + var partAssembleList = partAssembleNum.Search(p => p.PartNo1 == PartNo1 && p.IsPartAssemble == 1 && p.BomID != id_mk); + if (partAssembleList != null && partAssembleList.Count == 1 && IsPartAssemble == "1") + { + Response.Write(ResponseResult.Fail("一个总成只能配置一个半成品!")); + Response.End(); + return; + } + + //查询产品描述 + BasicBLL productDesc = new BasicBLL(); + var productDescList = productDesc.Search(p => p.PartNo == PartNo1); + if (productDescList != null && productDescList.Count >= 1 ) + { + ProductName1 = productDescList[0].ProductName; + } + else + { + Response.Write(ResponseResult.Fail("总成零件号:" + PartNo1 +" 产品信息不存在")); + Response.End(); + return; + } + + productDescList = productDesc.Search(p => p.PartNo == PartNo2); + if (productDescList != null && productDescList.Count >= 1) + { + ProductName2 = productDescList[0].ProductName; + } + else + { + Response.Write(ResponseResult.Fail("子零件号:" + PartNo2 + " 产品信息不存在")); + Response.End(); + return; + } + + Bom_MKBLL bll = new Bom_MKBLL(); tb_Bom_MK md = new tb_Bom_MK(); @@ -107,7 +179,12 @@ namespace MESWebSite.HttpHandlers md.PartNo2 = PartNo2; md.LineName = LineName; md.StationNo = StationNo; - if(IsPartAssemble == "1") + md.LeftCount = int.Parse(LeftCount); + md.RightCount = int.Parse(RightCount); + md.PartDesc1 = ProductName1; + md.PartDesc2 = ProductName2; + + if (IsPartAssemble == "1") { md.IsPartAssemble = 1; } @@ -129,6 +206,15 @@ namespace MESWebSite.HttpHandlers if (BomID == "0") { + BasicBLL partNoBindDB = new BasicBLL(); + var partNo1List = partNoBindDB.Search(p => p.PartNo1 == PartNo1 && p.PartNo2 == PartNo2 && p.LineName == LineName && p.StationNo == StationNo); + if (partNo1List != null && partNo1List.Count > 0) + { + Response.Write(ResponseResult.Fail("BOM总成零件号与子零件号绑定关系在系统中已存在")); + Response.End(); + return; + } + //新增 //md.BomID = Guid.NewGuid().ToString(); Response.Write(bll.AddInfo(md) == true ? ResponseResult.Success() : ResponseResult.Fail("添加失败")); @@ -158,5 +244,37 @@ namespace MESWebSite.HttpHandlers } + void QueryExcel() + { + string PartNo1 = Request.Params["PartNo1"]; + string LineName = Request.Params["LineName"]; + + Bom_MKBLL bll = new Bom_MKBLL(); + + List> list = bll.SearchForExcel(PartNo1, LineName); + XSSFWorkbook book = new XSSFWorkbook(); + ISheet sheet = book.CreateSheet("Sheet1"); + + for (int i = 0; i < list.Count; i++) + { + IRow row = sheet.CreateRow(i); + + for (int k = 0; k < list[i].Count; k++) + { + row.CreateCell(k).SetCellValue(list[i][k].ToString()); + } + + } + + // 写入到客户端 + MemoryStream ms = new MemoryStream(); + book.Write(ms); + Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}.xlsx", DateTime.Now.ToString("yyyyMMddHHmmssfff"))); + Response.BinaryWrite(ms.ToArray()); + book = null; + ms.Close(); + ms.Dispose(); + } + } } \ No newline at end of file diff --git a/MESWebSite/HttpHandlers/ConfigHandler.ashx b/MESWebSite/HttpHandlers/ConfigHandler.ashx new file mode 100644 index 0000000..210020a --- /dev/null +++ b/MESWebSite/HttpHandlers/ConfigHandler.ashx @@ -0,0 +1 @@ +<%@ WebHandler Language="C#" CodeBehind="ConfigHandler.ashx.cs" Class="MESWebSite.HttpHandlers.ConfigHandler" %> diff --git a/MESWebSite/HttpHandlers/ConfigHandler.ashx.cs b/MESWebSite/HttpHandlers/ConfigHandler.ashx.cs new file mode 100644 index 0000000..519f5f3 --- /dev/null +++ b/MESWebSite/HttpHandlers/ConfigHandler.ashx.cs @@ -0,0 +1,132 @@ +using MESClassLibrary.BLL.BasicInfo; +using MESClassLibrary.EFModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace MESWebSite.HttpHandlers +{ + /// + /// ConfigHandler 的摘要说明 + /// + public class ConfigHandler : 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; + default: + break; + + } + + } + public bool IsReusable + { + get + { + return false; + } + } + + void QueryList() + { + string page = Request.Params["page"]; + string pagesize = Request.Params["rows"]; + string name = Request.Params["name"]; + + if (string.IsNullOrEmpty(page)) + { + page = "0"; + } + if (string.IsNullOrEmpty(pagesize)) + { + pagesize = "15"; + } + ConfigBLL bll = new ConfigBLL(); + Response.Write(bll.SearchInfo(page, pagesize, name)); + Response.End(); + + + } + void SaveInfo() + { + string ID = Request.Params["ID"]; + string name = Request.Params["name"]; + string value = Request.Params["value"]; + string des = Request.Params["des"]; + + ConfigBLL bll = new ConfigBLL(); + tb_Config md = new tb_Config(); + + //md.name = name; + if(value != "true" && value != "false") + { + Response.Write("false"); + Response.End(); + return; + } + md.value = value; + //md.des = des; + + + + if (ID == "0") + { + //新增 + md.ID = Guid.NewGuid().ToString(); + Response.Write(bll.AddInfo(md) == true ? "true" : "false"); + } + else + { + //修改 + md.ID = ID; + Response.Write(bll.UpdateInfo(md) == true ? "true" : "false"); + } + Response.End(); + } + void DelInfo() + { + string ID = Request.Params["ID"]; + + ConfigBLL bll = new ConfigBLL(); + tb_Config md = new tb_Config(); + + md.ID = ID; + //Response.Write(bll.DelInfo(md) == true ? "true" : "false"); + Response.Write("false"); + Response.End(); + + } + void QueryForCombobox() + { + PlaceBLL bll = new PlaceBLL(); + Response.Write(bll.GetComboboxData()); + Response.End(); + + } + } +} \ No newline at end of file diff --git a/MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx.cs b/MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx.cs index 75d0df8..589c248 100644 --- a/MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx.cs +++ b/MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx.cs @@ -40,11 +40,12 @@ namespace MESWebSite.HttpHandlers string StartTime = GetParam("StartTime"); string EndTime = GetParam("EndTime"); string PartNo = GetParam("PartNo"); + string State = GetParam("State"); int page = Page.To32Int(); int pageSize = Rows.To32Int(); ZP_MK_PlanBLL bll = new ZP_MK_PlanBLL(); - string reslut = bll.SearchInfoAll(page, pageSize, StartTime, EndTime, PartNo); + string reslut = bll.SearchInfoAll(page, pageSize, StartTime, EndTime, PartNo, State); Response.Write(reslut); Response.End(); } @@ -126,17 +127,7 @@ namespace MESWebSite.HttpHandlers Station = station, }; - - //DataTable dt = bll.SearchOrderNo(DateTime.Now.ToString("yyyMMdd")); - //if (dt != null && dt.Rows.Count > 0) - //{ - // string old = dt.Rows[0]["OrderNo"].ToString(); - // zpp.OrderNo = DateTime.Now.ToString("yyyMMdd") + (Convert.ToInt32(old.Substring(old.Length - 4, 4))+1).ToString().PadLeft(4,'0'); - //} - //else - //{ - // zpp.OrderNo = DateTime.Now.ToString("yyyMMdd") + "0001"; - //} + if (id == "0") { diff --git a/MESWebSite/MESWebSite.csproj b/MESWebSite/MESWebSite.csproj index ccaf66e..86a2684 100644 --- a/MESWebSite/MESWebSite.csproj +++ b/MESWebSite/MESWebSite.csproj @@ -121,6 +121,7 @@ + @@ -840,6 +841,8 @@ + + @@ -1094,6 +1097,9 @@ BucketStateHandler.ashx + + ConfigHandler.ashx + XDProductHandler.ashx @@ -1363,6 +1369,13 @@ BucketState.aspx + + Config.aspx + ASPXCodeBehind + + + Config.aspx + XDStockArea.aspx ASPXCodeBehind diff --git a/MESWebSite/MESWebSite.csproj.user b/MESWebSite/MESWebSite.csproj.user index ced2bb3..9b19fce 100644 --- a/MESWebSite/MESWebSite.csproj.user +++ b/MESWebSite/MESWebSite.csproj.user @@ -1,7 +1,7 @@ - + - D:\Project\2、北汽模塑一厂\SVN\Code\MESWebSite\Properties\PublishProfiles\BBMPT1.pubxml + D:\job\BBMPT1\MESWebSite\Properties\PublishProfiles\FolderProfile.pubxml ProjectFiles Debug|Any CPU true diff --git a/MESWebSite/Manage/Bom_MK.aspx b/MESWebSite/Manage/Bom_MK.aspx index bd4c6b8..637c35d 100644 --- a/MESWebSite/Manage/Bom_MK.aspx +++ b/MESWebSite/Manage/Bom_MK.aspx @@ -77,6 +77,12 @@ 删除 + + 导出 + + + 导入 + @@ -153,7 +159,29 @@ data-options="valueField: 'StationID',textField: 'StationNo'"> * - + + + +

+ 左侧数量: +

+ + + + + + + +

+ 右侧数量: +

+ + + + + + + @@ -164,6 +192,34 @@ + + + + + + + diff --git a/MESWebSite/Manage/Bom_MK.aspx.cs b/MESWebSite/Manage/Bom_MK.aspx.cs index 9d22bf4..aa01a3a 100644 --- a/MESWebSite/Manage/Bom_MK.aspx.cs +++ b/MESWebSite/Manage/Bom_MK.aspx.cs @@ -1,9 +1,17 @@ -using System; +using MESClassLibrary.BLL.BasicInfo; +using MESClassLibrary.BLL.Log; +using MESClassLibrary.EFModel; +using System; using System.Collections.Generic; +using System.Data.OleDb; +using System.Data; using System.Linq; +using System.Reflection; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; +using System.IO; +using MESClassLibrary.BLL; namespace MESWebSite.Manage { @@ -16,5 +24,263 @@ namespace MESWebSite.Manage Response.Write(""); } } + + + protected void ImportExcel_Click(object sender, EventArgs e) + { + try + { + if (input01.PostedFile.ContentLength > 0) + { + string strUrl = "../Excel/"; + if (Directory.Exists(Server.MapPath(strUrl)) == false) + { + Directory.CreateDirectory(Server.MapPath(strUrl)); + } + String fileExtension = System.IO.Path.GetExtension(input01.PostedFile.FileName).ToLower(); + String fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + fileExtension; + input01.PostedFile.SaveAs(Server.MapPath(strUrl) + fileName); + string excelPath = Server.MapPath(strUrl) + fileName; + DataTable dt = null; + + #region 校验文件 + + try + { + dt = GetExcelTableByOleDB(excelPath, "Sheet1"); + if (dt != null && dt.Rows.Count > 1) + { + + } + else + { + ClientScript.RegisterStartupScript(this.GetType(), "tishi", ""); + return; + } + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + return; + } + + #endregion + + Bom_MKBLL bll = new Bom_MKBLL(); + List list = new List(); + tb_Bom_MK md = new tb_Bom_MK(); + + ProductBLL pbll = new ProductBLL(); + LineBLL linebll = new LineBLL(); + StationBLL stationbll = new StationBLL(); + BasicBLL partNoBindDB = new BasicBLL(); + + + #region 校验数据 + + if (dt != null && dt.Rows.Count > 0) + { + for (int i = 1; i < dt.Rows.Count; i++) + { + #region 值校验 + + string PartNo1 = dt.Rows[i][0].ToString(); + if (PartNo1 == "") + { + ClientScript.RegisterStartupScript(this.GetType(), "tishi", ""); + return; + } + string PartNo2 = dt.Rows[i][1].ToString(); + if (PartNo2 == "") + { + ClientScript.RegisterStartupScript(this.GetType(), "tishi", ""); + return; + } + + string LineName = dt.Rows[i][2].ToString(); + if (LineName == "") + { + ClientScript.RegisterStartupScript(this.GetType(), "tishi", ""); + return; + } + + string StationNo = dt.Rows[i][3].ToString(); + if (StationNo == "") + { + ClientScript.RegisterStartupScript(this.GetType(), "tishi", ""); + return; + } + + string LeftCount = dt.Rows[i][4].ToString(); + if (LeftCount == "") + { + ClientScript.RegisterStartupScript(this.GetType(), "tishi", ""); + return; + } + + string RightCount = dt.Rows[i][5].ToString(); + if (RightCount == "") + { + ClientScript.RegisterStartupScript(this.GetType(), "tishi", ""); + return; + } + + #endregion + + #region 逻辑校验 + + if (!pbll.IsExist(PartNo1)) + { + ClientScript.RegisterStartupScript(this.GetType(), "提示", ""); + return; + } + + if (!pbll.IsExist(PartNo2)) + { + ClientScript.RegisterStartupScript(this.GetType(), "提示", ""); + return; + } + + if (!linebll.IsExist(LineName)) + { + ClientScript.RegisterStartupScript(this.GetType(), "提示", ""); + return; + } + + if (!stationbll.IsExist(StationNo)) + { + ClientScript.RegisterStartupScript(this.GetType(), "提示", ""); + return; + } + + var partNo1List = partNoBindDB.Search(p => p.PartNo1 == PartNo1 && p.PartNo2 == PartNo2 && p.LineName == LineName && p.StationNo == StationNo); + if (partNo1List != null && partNo1List.Count > 0) + { + ClientScript.RegisterStartupScript(this.GetType(), "提示", ""); + return; + } + + #endregion + + var info = Request.Cookies.Get("LoginUserInfo"); + if (info != null) + { + md.UserID = info["UserID"].ToUpper(); + } + + + md.PartNo1 = PartNo1; + md.PartNo2 = PartNo2; + md.LineName = LineName; + md.StationNo = StationNo; + md.LeftCount = int.Parse(LeftCount); + md.RightCount = int.Parse(RightCount); + + list.Add(md); + } + } + + #endregion + + #region 存储数据 + + try + { + bool flag = false; + if (list.Count > 0) + { + foreach (var item in list) + { + flag = bll.AddInfo(item); + } + } + if (flag == true) + { + ClientScript.RegisterStartupScript(this.GetType(), "提示", ""); + } + else + { + ClientScript.RegisterStartupScript(this.GetType(), "提示", ""); + } + + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + } + + #endregion + } + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + } + } + + public DataTable GetExcelTableByOleDB(string strExcelPath, string tableName) + { + OleDbConnection objConn = null; + try + { + DataTable dtExcel = new DataTable(); + //数据表 + DataSet ds = new DataSet(); + //获取文件扩展名 + string strExtension = System.IO.Path.GetExtension(strExcelPath); + string strFileName = System.IO.Path.GetFileName(strExcelPath); + //Excel的连接 + + switch (strExtension) + { + case ".xls": + objConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strExcelPath + ";" + "Extended Properties=\"Excel 8.0;HDR=NO;IMEX=1;\""); + break; + case ".xlsx": + objConn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + strExcelPath + ";" + "Extended Properties=\"Excel 12.0;HDR=NO;IMEX=1;\""); + break; + + default: + objConn = null; + break; + } + if (objConn == null) + { + return null; + } + try + { + objConn.Open(); + } + catch (Exception ex) + { + + } + + //获取Excel中所有Sheet表的信息 + //System.Data.DataTable schemaTable = objConn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, null); + //获取Excel的第一个Sheet表名 + //string tableName = schemaTable.Rows[0][2].ToString().Trim(); + string strSql = "select * from [" + tableName + "$]"; + //获取Excel指定Sheet表中的信息 + OleDbCommand objCmd = new OleDbCommand(strSql, objConn); + OleDbDataAdapter myData = new OleDbDataAdapter(strSql, objConn); + myData.Fill(ds, tableName);//填充数据 + objConn.Close(); + //dtExcel即为excel文件中指定表中存储的信息 + dtExcel = ds.Tables[tableName]; + return dtExcel; + } + catch (Exception ex) + { + if (objConn != null) + { + objConn.Close(); + } + + return null; + } + } + } } \ No newline at end of file diff --git a/MESWebSite/Manage/Bom_MK.aspx.designer.cs b/MESWebSite/Manage/Bom_MK.aspx.designer.cs index 427fc22..b8f0584 100644 --- a/MESWebSite/Manage/Bom_MK.aspx.designer.cs +++ b/MESWebSite/Manage/Bom_MK.aspx.designer.cs @@ -23,6 +23,24 @@ namespace MESWebSite.Manage /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; + /// + /// ProductName1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlInputText ProductName1; + + /// + /// ProductName2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlInputText ProductName2; + /// /// lblMessage 控件。 /// @@ -32,6 +50,42 @@ namespace MESWebSite.Manage /// protected global::System.Web.UI.WebControls.Label lblMessage; + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label1; + + /// + /// Label2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label2; + + /// + /// ImportExcel 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button ImportExcel; + + /// + /// input01 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlInputFile input01; + /// /// UserID 控件。 /// diff --git a/MESWebSite/Manage/Config.aspx b/MESWebSite/Manage/Config.aspx new file mode 100644 index 0000000..7c9174a --- /dev/null +++ b/MESWebSite/Manage/Config.aspx @@ -0,0 +1,354 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Config.aspx.cs" Inherits="MESWebSite.Manage.Config" %> + + + + + + + + + + + + + + + + 配置信息 + + +
+
+ + + + + + + + + + + + +
配置信息 + 配置项: + 查询 + 新增 + + 编辑 + + 删除 +
+
+ +
+ + + + + + + + +
+ + diff --git a/MESWebSite/Manage/Config.aspx.cs b/MESWebSite/Manage/Config.aspx.cs new file mode 100644 index 0000000..d8112ab --- /dev/null +++ b/MESWebSite/Manage/Config.aspx.cs @@ -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 Config : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + if (Request.Cookies["LoginUserInfo"] == null) + { + Response.Write(""); + } + } + } +} \ No newline at end of file diff --git a/MESWebSite/Manage/Config.aspx.designer.cs b/MESWebSite/Manage/Config.aspx.designer.cs new file mode 100644 index 0000000..e69bb7c --- /dev/null +++ b/MESWebSite/Manage/Config.aspx.designer.cs @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace MESWebSite.Manage +{ + + + public partial class Config + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// lblMessage 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblMessage; + + /// + /// UserID 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlInputText UserID; + } +} diff --git a/MESWebSite/Manage/ZP_MK_Plan.aspx b/MESWebSite/Manage/ZP_MK_Plan.aspx index 2d34d91..7ee663a 100644 --- a/MESWebSite/Manage/ZP_MK_Plan.aspx +++ b/MESWebSite/Manage/ZP_MK_Plan.aspx @@ -57,10 +57,13 @@ - + +
门槛装配计划 零件号: 状态: + + 装配时间: @@ -290,6 +293,24 @@ return getTime(unixtime).substring(0, 19); } }, + { + field: 'State', title: '状态', sortable: 'true', width: 10, + formatter: function (value) { + if (value == 0) { + return "新建"; + } + else if (value == 1) { + return "启用"; + } + else if (value == 2) { + return "暂停"; + } + else { + return "完成"; + } + } + }, + ]], @@ -384,12 +405,14 @@ function SearchInfo() { var PartNo = $('#part_no_s').val(); + var State = $('#state_s').val(); var StartTime = $('#start_time').datebox('getValue'); var EndTime = $('#end_time').datebox('getValue'); dg.datagrid({ queryParams: { PartNo, + State, StartTime, EndTime } diff --git a/MESWebSite/Properties/PublishProfiles/FolderProfile.pubxml b/MESWebSite/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..0246c1b --- /dev/null +++ b/MESWebSite/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,17 @@ + + + + + false + false + true + Release + Any CPU + FileSystem + D:\发布\Mes + FileSystem + <_TargetId>Folder + + \ No newline at end of file