Browse Source

新增门槛装配计划页面

master
周红军 2 weeks ago
parent
commit
fff350b4ea
  1. 31
      MESWebSite/Export/ExportZP_MK_Plan.cs
  2. 1
      MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx
  3. 124
      MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx.cs
  4. 13
      MESWebSite/MESWebSite.csproj
  5. 496
      MESWebSite/Manage/ZP_MK_Plan.aspx
  6. 17
      MESWebSite/Manage/ZP_MK_Plan.aspx.cs
  7. 44
      MESWebSite/Manage/ZP_MK_Plan.aspx.designer.cs

31
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<int> Item { get; set; }
[ExportHeader(HeaderName ="产品名称")]
public string ProductName { get; set; }
[ExportHeader(HeaderName = "零件编号")]
public string PartNo { get; set; }
[ExportHeader(HeaderName = "计划数量")]
public Nullable<int> OrderCount { get; set; }
[ExportHeader(HeaderName = "生产数量")]
public Nullable<int> ProductCount { get; set; }
[ExportHeader(HeaderName = "装配日期")]
public Nullable<System.DateTime> OrderDate { get; set; }
}
}

1
MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx

@ -0,0 +1 @@
<%@ WebHandler Language="C#" CodeBehind="ZP_MK_PlanHandler.ashx.cs" Class="MESWebSite.HttpHandlers.ZP_MK_PlanHandler" %>

124
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
{
/// <summary>
/// ZP_MK_PlanHandler 的摘要说明
/// </summary>
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<ZP_MK_PlanModel> 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();
}
}
}
}

13
MESWebSite/MESWebSite.csproj

@ -174,6 +174,7 @@
<Content Include="Manage\ZpBadInjectionSearch.aspx" />
<Content Include="Manage\ZPBom.aspx" />
<Content Include="Manage\ZPPlan.aspx" />
<Content Include="Manage\ZP_MK_Plan.aspx" />
<Content Include="PDF\20200409101110668.jpg" />
<Content Include="PDF\20200409101203760.jpg" />
<Content Include="PDF\20200409101239287.jpg" />
@ -836,6 +837,7 @@
<Content Include="HttpHandlers\XDColorHandler.ashx" />
<Content Include="HttpHandlers\XDProductHandler.ashx" />
<Content Include="HttpHandlers\XDStockAreaHandler.ashx" />
<Content Include="HttpHandlers\ZP_MK_PlanHandler.ashx" />
<None Include="Properties\PublishProfiles\BBMPT1.pubxml" />
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" />
<None Include="Properties\PublishProfiles\Web.config.pubxml" />
@ -1068,6 +1070,7 @@
<Compile Include="CommonClass\ResponseResult.cs" />
<Compile Include="CommonClass\SQLHelper.cs" />
<Compile Include="CommonClass\StringHelper.cs" />
<Compile Include="Export\ExportZP_MK_Plan.cs" />
<Compile Include="Export\ExportZPPlan.cs" />
<Compile Include="HelperTools.cs" />
<Compile Include="HttpHandlers\BadInjectionSearchHandler.ashx.cs">
@ -1293,6 +1296,9 @@
<Compile Include="HttpHandlers\ZPBomHandler.ashx.cs">
<DependentUpon>ZPBomHandler.ashx</DependentUpon>
</Compile>
<Compile Include="HttpHandlers\ZP_MK_PlanHandler.ashx.cs">
<DependentUpon>ZP_MK_PlanHandler.ashx</DependentUpon>
</Compile>
<Compile Include="HttpHandlers\ZPPlanHandler.ashx.cs">
<DependentUpon>ZPPlanHandler.ashx</DependentUpon>
</Compile>
@ -1849,6 +1855,13 @@
<Compile Include="Manage\ZPPlan.aspx.designer.cs">
<DependentUpon>ZPPlan.aspx</DependentUpon>
</Compile>
<Compile Include="Manage\ZP_MK_Plan.aspx.cs">
<DependentUpon>ZP_MK_Plan.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Manage\ZP_MK_Plan.aspx.designer.cs">
<DependentUpon>ZP_MK_Plan.aspx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Service\SystemManager.ashx.cs">
<DependentUpon>SystemManager.ashx</DependentUpon>

496
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" %>
<!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: 17%
}
}
</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: 120px">门槛装配计划</span></td>
<td style="width: 100px;"></td>
<td style="width: 260px;"> 零件号:
<input type="text" id="part_no_s" style="width: 140px;"/>
</td>
<td style="width: 380px;"> 装配日期:
<input id="start_time" class="easyui-datebox" style="width: 130px; height: 30px;" data-options="required:false" />
<input id="end_time" class="easyui-datebox" style="width: 130px; height: 30px;" data-options="required:false" />
</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 style="width: 80px;">
<a class="topexcelBtn">导出</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="station_no" class="easyui-combobox" style="width: 200px; height: 30px;"
data-options="valueField: 'StationID',textField: 'StationNo'">
</select>
</td>
</tr>--%>
<tr>
<td class="title" style="width: 110px;">
<p>
产品名称:
</p>
</td>
<td colspan="2">
<select id="part_no" class="easyui-combobox" style="width: 200px; height: 30px;"
data-options="valueField: 'PartNo',textField: 'ProductName'">
</select>
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
计划名称:
</p>
</td>
<td colspan="2">
<input id="OrderName" 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="Line" 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="Station" 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="OrderCount" type="text" class="text" style="width: 230px; height: 30px;" />
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
装配日期:
</p>
</td>
<td>
<input id="OrderDate" class="easyui-datebox" style="width: 180px; height: 30px;" data-options="required:true" />
</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; //是否为编辑状态
var handlerUrl = "/HttpHandlers/ZP_MK_PlanHandler.ashx";
/**************** DOM加载 ***************/
$(function () {
$.ajaxSetup({
cache: false //关闭AJAX缓存
});
// 下拉框加载
//reload_station_no('#station_no');
reload_part_no('#part_no');
//新增按钮点击
$('.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();
}
});
});
$('.topexcelBtn').first().click(function () {
var StartTime = $('#start_time').datebox('getValue');
var EndTime = $('#end_time').datebox('getValue');
var queryParams = {
StartTime,
EndTime
};
post('<%=ResolveUrl("~/HttpHandlers/ZP_MK_PlanHandler.ashx?method=ExportExcel") %>', queryParams);
});
//搜索按钮
$('.topsearchBtn').first().click(function () {
SearchInfo();
});
//保存按钮
$('#saveBtn').bind('click', function () {
SaveInfo(isEdit);
});
//$('#IsOneMore').change(function() {
// $('#part_no').combo('clear');
// reload_part_no('#part_no');
//})
//编辑窗口加载
$('#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');
}
});
dg = $('#tb').datagrid({
fitColumns: true,
nowrap: false,
striped: true,
collapsible: false,
url: handlerUrl + "?method=QueryList",
//sortName: 'sortNumber',
//sortOrder: 'asc',
remoteSort: false,
columns: [[
{ field: 'ID', title: 'ID', hidden: true },
{ field: 'OrderNo', title: '计划编号', sortable: 'true', width: 10 },
{ field: 'OrderName', title: '计划名称', sortable: 'true', width: 8 },
{ field: 'Line', title: '产线', sortable: 'true', width: 8 },
{ field: 'Station', title: '工位号', sortable: 'true', width: 8 },
{ field: 'Item', title: '序号', sortable: 'true', width: 10 },
{ field: 'PartNo', title: '零件编号', sortable: 'true', width: 10 },
{ field: 'ProductName', title: '产品名称', sortable: 'true', width: 10 },
{ field: 'OrderCount', title: '计划数量', sortable: 'true', width: 10 },
{ field: 'ProductCount', title: '生产数量', sortable: 'true', width: 10 },
{
field: 'OrderDate', title: '装配日期', sortable: 'true', width: 10,
formatter: function (date) {
var pa = /.*\((.*)\)/;
var unixtime = date.match(pa)[1].substring(0, 10);
return getTime(unixtime).substring(0, 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 PartNo = $('#part_no').combo('getValue');
//var StationID = $('#station_no').combo('getValue');
var OrderDate = $('#OrderDate').datebox('getValue');
//var IsOneMore = checkboxValue($('#IsOneMore'));
var OrderCount = $('#OrderCount').val();
var OrderName = $('#OrderName').val();
var Line = $('#Line').val();
var Station = $('#Station').val();
if (PartNo == "") {
$.messager.alert('提示', '零件不能为空,请重新输入', 'warning');
return;
}
if (OrderName == "") {
$.messager.alert('提示', '计划名称不能为空,请重新输入', 'warning');
return;
}
var model = {
ID,
PartNo,
//StationID,
OrderName,
OrderDate,
OrderCount,
Line,
Station,
method: 'SaveInfo'
};
SaveModel(model);
}
function SaveModel(model) {
$.ajax({
type: "POST",
async: false,
url: handlerUrl,
data: model,
dataType: 'json',
success: function (res) {
if (res.IsSuccess) {
$.messager.alert('提示', '已保存', 'info');
dg.datagrid('reload');
$('#w').window('close');
}
else {
$.messager.alert('错误', res.Message, 'warning');
}
},
error: function () {
}
});
}
//查询方法
function SearchInfo() {
var PartNo = $('#part_no_s').val();
var StartTime = $('#start_time').datebox('getValue');
var EndTime = $('#end_time').datebox('getValue');
dg.datagrid({
queryParams: {
PartNo,
StartTime,
EndTime
}
});
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;
$('#part_no').combobox('select', row.PartNo);
//$('#station_no').combobox('select', row.StationID);
//toggleChecked('#IsOneMore', row.IsOneMore);
$('#OrderCount').val(row.OrderCount);
$('#OrderName').val(row.OrderName);
$('#Line').val(row.Line);
$('#Station').val(row.Station);
var pa = /.*\((.*)\)/;
var unixtime = row.OrderDate.match(pa)[1].substring(0, 10);
$('#OrderDate').datebox('setValue', getTime(unixtime).substring(0, 10))
$('#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: handlerUrl,
data: model,
dataType: 'json',
async: false,
success: function (res) {
if (res.IsSuccess) {
$.messager.alert('提示', '已删除', 'info');
dg.datagrid('reload');
}
else {
$.messager.alert('提示', res.Message, 'warning');
}
},
error: function () {
}
});
}
/**************** 辅助业务程序 ***************/
/**********************************************/
/***************** 窗体程序 *******************/
/**********************************************/
//编辑窗口关闭清空数据
function clearw() {
$('#part_no').combo('clear');
//$('#station_no').combo('clear');
$('#OrderDate').datebox('setValue', '');
$('#OrderCount').val('');
$('#OrderName').val('');
$('#Line').val('');
$('#Station').val('');
}
function toggleChecked(id, checked) {
+checked ? $(id).prop("checked", "checked") : $(id).removeAttr("checked");
}
function checkboxValue(ctl) {
return ctl.is(':checked') ? 1 : 0;
}
/**
* 加载产品下拉信息
**/
function reload_part_no(ctl) {
base_reload_combobox(ctl, '/HttpHandlers/ProductHandler.ashx?method=GetComboboxProduct4');
}
function reload_station_no(ctl) {
base_reload_combobox(ctl, '/HttpHandlers/StationHandler.ashx?method=QueryForCombobox&StationNo=ZP');
}
function base_reload_combobox(ctl, url) {
$(ctl).combobox('reload', url);
}
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>

17
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)
{
}
}
}

44
MESWebSite/Manage/ZP_MK_Plan.aspx.designer.cs

@ -0,0 +1,44 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace MESWebSite.Manage
{
public partial class ZP_MK_Plan
{
/// <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…
Cancel
Save