Browse Source

增加门槛配置功能

master^2
周红军 4 days ago
parent
commit
243d0bbd20
  1. BIN
      MESWebSite/Excel/装配Bom导入模板.xlsx
  2. 122
      MESWebSite/HttpHandlers/Bom_MKHandler.ashx.cs
  3. 1
      MESWebSite/HttpHandlers/ConfigHandler.ashx
  4. 132
      MESWebSite/HttpHandlers/ConfigHandler.ashx.cs
  5. 15
      MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx.cs
  6. 13
      MESWebSite/MESWebSite.csproj
  7. 4
      MESWebSite/MESWebSite.csproj.user
  8. 138
      MESWebSite/Manage/Bom_MK.aspx
  9. 268
      MESWebSite/Manage/Bom_MK.aspx.cs
  10. 54
      MESWebSite/Manage/Bom_MK.aspx.designer.cs
  11. 354
      MESWebSite/Manage/Config.aspx
  12. 20
      MESWebSite/Manage/Config.aspx.cs
  13. 44
      MESWebSite/Manage/Config.aspx.designer.cs
  14. 25
      MESWebSite/Manage/ZP_MK_Plan.aspx
  15. 17
      MESWebSite/Properties/PublishProfiles/FolderProfile.pubxml

BIN
MESWebSite/Excel/装配Bom导入模板.xlsx

Binary file not shown.

122
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<tb_Line> lineNameDB = new BasicBLL<tb_Line>();
var lineNameList = lineNameDB.Search<tb_Line>(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<tb_Station> stationDB = new BasicBLL<tb_Station>();
var stationList = stationDB.Search<tb_Station>(p => p.StationNo == StationNo);
@ -100,6 +134,44 @@ namespace MESWebSite.HttpHandlers
return;
}
//一个总成对应一个半成品
BasicBLL<tb_Bom_MK> partAssembleNum = new BasicBLL<tb_Bom_MK>();
int id_mk = int.Parse(BomID);
var partAssembleList = partAssembleNum.Search<tb_Bom_MK>(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<tb_Product> productDesc = new BasicBLL<tb_Product>();
var productDescList = productDesc.Search<tb_Product>(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<tb_Product>(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<tb_Bom_MK> partNoBindDB = new BasicBLL<tb_Bom_MK>();
var partNo1List = partNoBindDB.Search<tb_Bom_MK>(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<string>> 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();
}
}
}

1
MESWebSite/HttpHandlers/ConfigHandler.ashx

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

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

15
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")
{

13
MESWebSite/MESWebSite.csproj

@ -121,6 +121,7 @@
<Content Include="Manage\Bom_MK.aspx" />
<Content Include="Manage\BucketInfo.aspx" />
<Content Include="Manage\BucketState.aspx" />
<Content Include="Manage\Config.aspx" />
<Content Include="Manage\XDStockArea.aspx" />
<Content Include="Manage\XDProduct.aspx" />
<Content Include="Manage\XDColor.aspx" />
@ -840,6 +841,8 @@
<Content Include="HttpHandlers\XDStockAreaHandler.ashx" />
<Content Include="HttpHandlers\ZP_MK_PlanHandler.ashx" />
<Content Include="HttpHandlers\Bom_MKHandler.ashx" />
<None Include="Excel\装配Bom导入模板.xlsx" />
<Content Include="HttpHandlers\ConfigHandler.ashx" />
<None Include="Properties\PublishProfiles\BBMPT1.pubxml" />
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" />
<None Include="Properties\PublishProfiles\Web.config.pubxml" />
@ -1094,6 +1097,9 @@
<Compile Include="HttpHandlers\BucketStateHandler.ashx.cs">
<DependentUpon>BucketStateHandler.ashx</DependentUpon>
</Compile>
<Compile Include="HttpHandlers\ConfigHandler.ashx.cs">
<DependentUpon>ConfigHandler.ashx</DependentUpon>
</Compile>
<Compile Include="HttpHandlers\XDProductHandler.ashx.cs">
<DependentUpon>XDProductHandler.ashx</DependentUpon>
</Compile>
@ -1363,6 +1369,13 @@
<Compile Include="Manage\BucketState.aspx.designer.cs">
<DependentUpon>BucketState.aspx</DependentUpon>
</Compile>
<Compile Include="Manage\Config.aspx.cs">
<DependentUpon>Config.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Manage\Config.aspx.designer.cs">
<DependentUpon>Config.aspx</DependentUpon>
</Compile>
<Compile Include="Manage\XDStockArea.aspx.cs">
<DependentUpon>XDStockArea.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>

4
MESWebSite/MESWebSite.csproj.user

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<NameOfLastUsedPublishProfile>D:\Project\2、北汽模塑一厂\SVN\Code\MESWebSite\Properties\PublishProfiles\BBMPT1.pubxml</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>D:\job\BBMPT1\MESWebSite\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<ProjectView>ProjectFiles</ProjectView>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<UseIISExpress>true</UseIISExpress>

138
MESWebSite/Manage/Bom_MK.aspx

@ -77,6 +77,12 @@
<td style="width: 80px">
<a class="topdelBtn">删除</a>
</td>
<td style="width: 80px">
<a class="topexcelBtn" id="exportbtn">导出</a>
</td>
<td style="width: 80px">
<a class="topexcelBtn" id="openexcel">导入</a>
</td>
</tr>
</table>
</div>
@ -153,7 +159,29 @@
data-options="valueField: 'StationID',textField: 'StationNo'">
</select><span style="color: red; font-size: 18px; vertical-align: middle;">*</span>
</td>
</tr>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
左侧数量:
</p>
</td>
<td colspan="2">
<input id="LeftCount" 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="RightCount" type="text" class="text" style="width: 230px; height: 30px;" />
<input id="ProductName1" type="text" hidden="hidden" runat="server" />
<input id="ProductName2" type="text" hidden="hidden" runat="server" />
</td>
</tr>
</table>
</div>
<!-- 编辑窗口 - footer -->
@ -164,6 +192,34 @@
<div hidden="hidden">
<asp:Label ID="lblMessage" runat="server" Text=""></asp:Label>
</div>
<!-- Excel编辑窗口 -->
<div id="wexcel" style="padding: 10px; visibility: hidden" title="Excel模板">
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<a class="topexcelBtn" id="cexcel">选择文件</a>
<span id="input_file"></span>
</td>
</tr>
<tr>
<td style="padding-top: 20px;">
<a href="../Excel/装配Bom导入模板.xlsx" class="topexcelBtn" style="text-decoration: none;">导出模板</a>
</td>
</tr>
</table>
</div>
<!-- Excel编辑窗口 - footer -->
<div id="ftexcel" style="padding: 10px; text-align: center; background-color: #f9f9f9; visibility: hidden">
<a class="saveBtn" id="saveBtnexcel">导入模板</a>
</div>
<div hidden="hidden">
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
<asp:Label ID="Label2" runat="server" Text=""></asp:Label>
<asp:Button ID="ImportExcel" runat="server" Text="导入Excel" OnClick="ImportExcel_Click" />
<input type="file" id="input01" runat="server" class="file" onchange="inputChange()" />
</div>
<input id="UserID" type="text" hidden="hidden" runat="server" />
<script>
@ -245,7 +301,7 @@
{ field: 'PartNo1', title: '总成零件号', sortable: 'true', width: 10 },
{ field: 'ProductName1', title: '产品名称', sortable: 'true', width: 10 },
{ field: 'PartNo2', title: '子零件号', sortable: 'true', width: 10 },
{ field: 'ProductName2', title: '原料名称', sortable: 'true', width: 10 },
{ field: 'ProductName2', title: '子零件号名称', sortable: 'true', width: 10 },
{
field: 'IsChecked', title: '是否检测', sortable: 'true', width: 10,
formatter: function (value) {
@ -268,6 +324,8 @@
},
{ field: 'LineName', title: '产线', sortable: 'true', width: 10 },
{ field: 'StationNo', title: '工位号', sortable: 'true', width: 10 },
{ field: 'LeftCount', title: '左侧数量', sortable: 'true', width: 10 },
{ field: 'RightCount', title: '右侧数量', sortable: 'true', width: 10 },
]],
@ -284,6 +342,48 @@
afterPageText: '页 共 {pages} 页',
displayMsg: '当前显示 {from} - {to} 条记录 共 {total} 条记录',
});
$("#exportbtn").bind('click', function () {
var PaintNo = $('#Paint_No_s').val();
var StockNo = $('#StockNo_s').val();
var queryParams = {
PaintNo: PaintNo,
StockNo: StockNo
};
post('<%=ResolveUrl("~/HttpHandlers/Bom_MKHandler.ashx?method=QueryExcel") %>', queryParams);
});
//导入EXCEL
$('#openexcel').first().click(function () {
$('#wexcel').window('open');
});
$('#saveBtnexcel').bind('click', function () {
$('#ImportExcel').click();
});
$('#cexcel').bind('click', function () {
$('#input01').click();
});
$('#wexcel').window({
modal: true,
closed: true,
minimizable: false,
maximizable: false,
collapsible: false,
width: 200,
height: 200,
footer: '#ftexcel',
top: 20,
onBeforeClose: function () { clearw(); },
onBeforeOpen: function () { $('#wexcel').css('visibility', 'visible'); $('#ftexcel').css('visibility', 'visible'); }
});
});
/**************** 主要业务程序 ***************/
@ -306,6 +406,10 @@
if ($('#IsPartAssemble').is(':checked')) {
IsPartAssemble = 1;
}
var LeftCount = $('#LeftCount').val();
var RightCount = $('#RightCount').val();
var ProductName1 = $('#ProductName1').val();
var ProductName2 = $('#ProductName2').val();
if (PartNo1 == "") {
$.messager.alert('提示', '总成零件号不能为空,请重新输入', 'warning');
@ -334,6 +438,10 @@
IsPartAssemble: IsPartAssemble,
StationNo: StationNo,
LineName: LineName,
LeftCount: LeftCount,
RightCount: RightCount,
ProductName1: ProductName1,
ProductName2: ProductName2,
method: 'SaveInfo'
};
SaveModel(model);
@ -409,7 +517,11 @@
}
$('#line_id').combobox('select', row.LineName);
$('#station_id').combobox('select', row.StationNo);
$('#LeftCount').val(row.LeftCount);
$('#RightCount').val(row.RightCount);
$('#ProductName1').val(row.ProductName1);
$('#ProductName2').val(row.ProductName2);
$('#w').window('open');
}
@ -461,7 +573,10 @@
$('#IsPartAssemble').removeAttr("checked");
$('#line_id').combo('clear');
$('#station_id').combo('clear');
$('#LeftCount').val('');
$('#RightCount').val('');
$('#ProductName1').val('');
$('#ProductName2').val('');
}
function reloadfl_id() {
@ -491,7 +606,20 @@
});
}
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>

268
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("<script language=javascript>alert('您的登录信息已过期,请重新登录!');top.location.href='../Login.aspx';</script>");
}
}
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", "<script type='text/javascript'>$.messager.alert('提示', '模板内容为空', 'warning');</script>");
return;
}
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
return;
}
#endregion
Bom_MKBLL bll = new Bom_MKBLL();
List<tb_Bom_MK> list = new List<tb_Bom_MK>();
tb_Bom_MK md = new tb_Bom_MK();
ProductBLL pbll = new ProductBLL();
LineBLL linebll = new LineBLL();
StationBLL stationbll = new StationBLL();
BasicBLL<tb_Bom_MK> partNoBindDB = new BasicBLL<tb_Bom_MK>();
#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", "<script type='text/javascript'>$.messager.alert('提示', '第" + i.ToString() + "行,总成零件号为空,故无法导入', 'warning');</script>");
return;
}
string PartNo2 = dt.Rows[i][1].ToString();
if (PartNo2 == "")
{
ClientScript.RegisterStartupScript(this.GetType(), "tishi", "<script type='text/javascript'>$.messager.alert('提示', '第" + i.ToString() + "行,子零件号为空,故无法导入', 'warning');</script>");
return;
}
string LineName = dt.Rows[i][2].ToString();
if (LineName == "")
{
ClientScript.RegisterStartupScript(this.GetType(), "tishi", "<script type='text/javascript'>$.messager.alert('提示', '第" + i.ToString() + "行,产线为空,故无法导入', 'warning');</script>");
return;
}
string StationNo = dt.Rows[i][3].ToString();
if (StationNo == "")
{
ClientScript.RegisterStartupScript(this.GetType(), "tishi", "<script type='text/javascript'>$.messager.alert('提示', '第" + i.ToString() + "行,工位号为空,故无法导入', 'warning');</script>");
return;
}
string LeftCount = dt.Rows[i][4].ToString();
if (LeftCount == "")
{
ClientScript.RegisterStartupScript(this.GetType(), "tishi", "<script type='text/javascript'>$.messager.alert('提示', '第" + i.ToString() + "行,左侧数量为空,故无法导入', 'warning');</script>");
return;
}
string RightCount = dt.Rows[i][5].ToString();
if (RightCount == "")
{
ClientScript.RegisterStartupScript(this.GetType(), "tishi", "<script type='text/javascript'>$.messager.alert('提示', '第" + i.ToString() + "行,右侧数量为空,故无法导入', 'warning');</script>");
return;
}
#endregion
#region 逻辑校验
if (!pbll.IsExist(PartNo1))
{
ClientScript.RegisterStartupScript(this.GetType(), "提示", "<script type='text/javascript'>$.messager.alert('提示', '第" + i.ToString() + "行,总成零件号系统中不存在,故无法导入', 'warning');</script>");
return;
}
if (!pbll.IsExist(PartNo2))
{
ClientScript.RegisterStartupScript(this.GetType(), "提示", "<script type='text/javascript'>$.messager.alert('提示', '第" + i.ToString() + "行,子零件号系统中不存在,故无法导入', 'warning');</script>");
return;
}
if (!linebll.IsExist(LineName))
{
ClientScript.RegisterStartupScript(this.GetType(), "提示", "<script type='text/javascript'>$.messager.alert('提示', '第" + i.ToString() + "行,产线在系统中不存在,故无法导入', 'warning');</script>");
return;
}
if (!stationbll.IsExist(StationNo))
{
ClientScript.RegisterStartupScript(this.GetType(), "提示", "<script type='text/javascript'>$.messager.alert('提示', '第" + i.ToString() + "行,工位号在系统中不存在,故无法导入', 'warning');</script>");
return;
}
var partNo1List = partNoBindDB.Search<tb_Bom_MK>(p => p.PartNo1 == PartNo1 && p.PartNo2 == PartNo2 && p.LineName == LineName && p.StationNo == StationNo);
if (partNo1List != null && partNo1List.Count > 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "提示", "<script type='text/javascript'>$.messager.alert('提示', '第" + i.ToString() + "行,BOM总成零件号与子零件号绑定关系在系统中已存在,故无法导入', 'warning');</script>");
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(), "提示", "<script type='text/javascript'>$.messager.alert('提示','导入成功!', 'warning');</script>");
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "提示", "<script type='text/javascript'>$.messager.alert('提示','导入失败!', 'warning');</script>");
}
}
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;
}
}
}
}

54
MESWebSite/Manage/Bom_MK.aspx.designer.cs

@ -23,6 +23,24 @@ namespace MESWebSite.Manage
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// ProductName1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlInputText ProductName1;
/// <summary>
/// ProductName2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlInputText ProductName2;
/// <summary>
/// lblMessage 控件。
/// </summary>
@ -32,6 +50,42 @@ namespace MESWebSite.Manage
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblMessage;
/// <summary>
/// Label1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label1;
/// <summary>
/// Label2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label2;
/// <summary>
/// ImportExcel 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Button ImportExcel;
/// <summary>
/// input01 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlInputFile input01;
/// <summary>
/// UserID 控件。
/// </summary>

354
MESWebSite/Manage/Config.aspx

@ -0,0 +1,354 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Config.aspx.cs" Inherits="MESWebSite.Manage.Config" %>
<!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: 33%
}
/* 中等屏幕 桌面显示器 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: 100%">
<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;">配置项:
<input type="text" id="name_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">
<input id="name" 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="value" 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="des" 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缓存
});
//新增按钮点击
$('.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');
}
});
dg = $('#tb').datagrid({
fitColumns: true,
nowrap: false,
striped: true,
collapsible: false,
url: "/HttpHandlers/ConfigHandler.ashx?method=QueryList",
//sortName: 'sortNumber',
//sortOrder: 'asc',
remoteSort: false,
columns: [[
{ field: 'ID', title: 'ID', hidden: true },
{ field: 'name', title: '项目', sortable: 'true', width: 10 },
{ field: 'value', title: '值', sortable: 'true', width: 10 },
{ field: 'des', title: '描述', 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 name = $('#name').val();
var value = $('#value').val();
var des = $('#des').val();
if (name == "") {
$.messager.alert('提示', '配置项不能为空,请重新输入', 'warning');
return;
}
if (value == "") {
$.messager.alert('提示', '值不能为空,请重新输入', 'warning');
return;
}
var model = {
ID: ID,
name: name,
value: value,
des: des,
method: 'SaveInfo'
};
SaveModel(model);
}
function SaveModel(model) {
$.ajax({
type: "POST",
async: false,
url: "/HttpHandlers/ConfigHandler.ashx",
data: model,
success: function (data) {
if (data == 'true') {
$.messager.alert('提示', '已保存', 'info');
dg.datagrid('reload');
$('#w').window('close');
}
else {
$.messager.alert('提示', '保存失败,值只能是true或者false', 'warning');
}
},
error: function () {
}
});
}
//查询方法
function SearchInfo() {
var name = $('#name_s').val();
var queryParams = {
name: name
};
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;
$('#name').val(row.name);
$('#value').val(row.value);
$('#des').val(row.des);
$('#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/ConfigHandler.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() {
$('#name').val('');
$('#value').val('');
$('#des').val('');
}
</script>
</form>
</body>
</html>

20
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("<script language=javascript>alert('您的登录信息已过期,请重新登录!');top.location.href='../Login.aspx';</script>");
}
}
}
}

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

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

25
MESWebSite/Manage/ZP_MK_Plan.aspx

@ -57,10 +57,13 @@
<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: 160px;"> 状态:
<input type="text" id="state_s" style="width: 100px;"/>
</td>
<td style="width: 380px;"> 装配时间:
<input id="start_time" class="easyui-datetimebox" style="width: 130px; height: 30px;" data-options="onShowPanel:function(){ $(this).datetimebox('spinner').timespinner('setValue','00:00:00');}" />
<input id="end_time" class="easyui-datetimebox" style="width: 130px; height: 30px;" data-options="onShowPanel:function(){ $(this).datetimebox('spinner').timespinner('setValue','23:59:59');}" />
@ -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
}

17
MESWebSite/Properties/PublishProfiles/FolderProfile.pubxml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>false</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>D:\发布\Mes</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
</PropertyGroup>
</Project>
Loading…
Cancel
Save