From fff350b4ea311133db440d20f13c7e9dd73490f4 Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Tue, 8 Jul 2025 14:48:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=97=A8=E6=A7=9B=E8=A3=85?= =?UTF-8?q?=E9=85=8D=E8=AE=A1=E5=88=92=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MESWebSite/Export/ExportZP_MK_Plan.cs | 31 ++ .../HttpHandlers/ZP_MK_PlanHandler.ashx | 1 + .../HttpHandlers/ZP_MK_PlanHandler.ashx.cs | 124 +++++ MESWebSite/MESWebSite.csproj | 13 + MESWebSite/Manage/ZP_MK_Plan.aspx | 496 ++++++++++++++++++ MESWebSite/Manage/ZP_MK_Plan.aspx.cs | 17 + MESWebSite/Manage/ZP_MK_Plan.aspx.designer.cs | 44 ++ 7 files changed, 726 insertions(+) create mode 100644 MESWebSite/Export/ExportZP_MK_Plan.cs create mode 100644 MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx create mode 100644 MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx.cs create mode 100644 MESWebSite/Manage/ZP_MK_Plan.aspx create mode 100644 MESWebSite/Manage/ZP_MK_Plan.aspx.cs create mode 100644 MESWebSite/Manage/ZP_MK_Plan.aspx.designer.cs diff --git a/MESWebSite/Export/ExportZP_MK_Plan.cs b/MESWebSite/Export/ExportZP_MK_Plan.cs new file mode 100644 index 0000000..affd494 --- /dev/null +++ b/MESWebSite/Export/ExportZP_MK_Plan.cs @@ -0,0 +1,31 @@ +using MESWebSite.CommonClass; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace MESWebSite.Export +{ + public class ExportZP_MK_Plan + { + [ExportHeader(HeaderName = "计划编号")] + public string OrderNo { get; set; } + + [ExportHeader(HeaderName = "计划编号")] + public string OrderName { get; set; } + + [ExportHeader(HeaderName = "序号")] + public Nullable Item { get; set; } + + [ExportHeader(HeaderName ="产品名称")] + public string ProductName { get; set; } + [ExportHeader(HeaderName = "零件编号")] + public string PartNo { get; set; } + [ExportHeader(HeaderName = "计划数量")] + public Nullable OrderCount { get; set; } + [ExportHeader(HeaderName = "生产数量")] + public Nullable ProductCount { get; set; } + [ExportHeader(HeaderName = "装配日期")] + public Nullable OrderDate { get; set; } + } +} \ No newline at end of file diff --git a/MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx b/MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx new file mode 100644 index 0000000..ff1a6da --- /dev/null +++ b/MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx @@ -0,0 +1 @@ +<%@ WebHandler Language="C#" CodeBehind="ZP_MK_PlanHandler.ashx.cs" Class="MESWebSite.HttpHandlers.ZP_MK_PlanHandler" %> diff --git a/MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx.cs b/MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx.cs new file mode 100644 index 0000000..f03b245 --- /dev/null +++ b/MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx.cs @@ -0,0 +1,124 @@ +using MESClassLibrary.BLL.BasicInfo; +using MESClassLibrary.EFModel; +using MESClassLibrary.Model; +using MESWebSite.CommonClass; +using MESWebSite.Export; +using MESWebSite.Tool; +using NPOI.XSSF.UserModel; +using System; +using System.Collections.Generic; +using System.Data; +using System.IO; +using System.Linq; +using System.Web; + +namespace MESWebSite.HttpHandlers +{ + /// + /// ZP_MK_PlanHandler 的摘要说明 + /// + public class ZP_MK_PlanHandler : BaseHandler + { + + public ZP_MK_PlanHandler() : base() + { + RegisterAction(ExportExcel); + } + + protected override void DelInfo() + { + string ID = GetParam("ID"); + ZP_MK_PlanBLL bll = new ZP_MK_PlanBLL(); + Response.Write(bll.DeleteInfo(new tb_ZP_MK_Plan() { ID = ID }) ? ResponseResult.Success() : ResponseResult.Fail("删除失败")); + Response.End(); + } + + protected override void QueryList() + { + string StartTime = GetParam("StartTime"); + string EndTime = GetParam("EndTime"); + string PartNo = GetParam("PartNo"); + 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); + Response.Write(reslut); + Response.End(); + } + + protected override void SaveInfo() + { + string id = GetParam("ID"); + //string stationID = GetParam("StationID"); + string partNo = GetParam("PartNo"); + int orderCount = GetParam("OrderCount").To32Int(); + string orderName = GetParam("OrderName"); + string line = GetParam("Line"); + string station = GetParam("Station"); + + DateTime orderDate; + if (!DateTime.TryParse(GetParam("OrderDate"), out orderDate)) + { + Response.Write("false"); + Response.End(); + return; + }; + ZP_MK_PlanBLL bll = new ZP_MK_PlanBLL(); + + tb_ZP_MK_Plan zpp = new tb_ZP_MK_Plan + { + ID = id, + //StationID = stationID, + PartNo = partNo, + OrderDate = orderDate, + OrderCount = orderCount, + OrderName = orderName, + Line = line, + 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") + { + Response.Write(bll.AddInfo(zpp) ? ResponseResult.Success() : ResponseResult.Fail("添加失败")); + } + else + { + string msg = string.Empty; + Response.Write(bll.UpdateInfo(zpp, ref msg) ? ResponseResult.Success() : ResponseResult.Fail(msg)); + } + Response.End(); + } + + public void ExportExcel() + { + + string StartTime = GetParam("StartTime"); + string EndTime = GetParam("EndTime"); + string PartNo = GetParam("PartNo"); + ZP_MK_PlanBLL bll = new ZP_MK_PlanBLL(); + List result = bll.SearchByCreateTime(StartTime, EndTime, PartNo); + ExcelTool excelTool = new ExcelTool(); + XSSFWorkbook book = excelTool.Export(result, typeof(ExportZP_MK_Plan)); + using (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()); + Response.End(); + } + } + } +} \ No newline at end of file diff --git a/MESWebSite/MESWebSite.csproj b/MESWebSite/MESWebSite.csproj index a65e91c..af2dafe 100644 --- a/MESWebSite/MESWebSite.csproj +++ b/MESWebSite/MESWebSite.csproj @@ -174,6 +174,7 @@ + @@ -836,6 +837,7 @@ + @@ -1068,6 +1070,7 @@ + @@ -1293,6 +1296,9 @@ ZPBomHandler.ashx + + ZP_MK_PlanHandler.ashx + ZPPlanHandler.ashx @@ -1849,6 +1855,13 @@ ZPPlan.aspx + + ZP_MK_Plan.aspx + ASPXCodeBehind + + + ZP_MK_Plan.aspx + SystemManager.ashx diff --git a/MESWebSite/Manage/ZP_MK_Plan.aspx b/MESWebSite/Manage/ZP_MK_Plan.aspx new file mode 100644 index 0000000..5b41339 --- /dev/null +++ b/MESWebSite/Manage/ZP_MK_Plan.aspx @@ -0,0 +1,496 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ZP_MK_Plan.aspx.cs" Inherits="MESWebSite.Manage.ZP_MK_Plan" %> + + + + + + + + + + + + + + + + 门槛装配计划 + + +
+
+ + + + + + + + + + + + + + +
门槛装配计划 零件号: + + 装配日期: + + + 查询 + 新增 + + 编辑 + + 删除 + + 导出 +
+
+ +
+ + + + + + + + +
+ + diff --git a/MESWebSite/Manage/ZP_MK_Plan.aspx.cs b/MESWebSite/Manage/ZP_MK_Plan.aspx.cs new file mode 100644 index 0000000..4d6958d --- /dev/null +++ b/MESWebSite/Manage/ZP_MK_Plan.aspx.cs @@ -0,0 +1,17 @@ +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 ZP_MK_Plan : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + + } + } +} \ No newline at end of file diff --git a/MESWebSite/Manage/ZP_MK_Plan.aspx.designer.cs b/MESWebSite/Manage/ZP_MK_Plan.aspx.designer.cs new file mode 100644 index 0000000..745d026 --- /dev/null +++ b/MESWebSite/Manage/ZP_MK_Plan.aspx.designer.cs @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace MESWebSite.Manage +{ + + + public partial class ZP_MK_Plan + { + + /// + /// 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; + } +}