ruoxing.wang 4 days ago
parent
commit
8354909c3c
  1. 83
      MESClassLibrary/BLL/BasicInfo/Bom_MKBLL.cs
  2. 143
      MESClassLibrary/BLL/BasicInfo/ConfigBLL.cs
  3. 21
      MESClassLibrary/BLL/BasicInfo/LineBLL.cs
  4. 19
      MESClassLibrary/BLL/BasicInfo/ProductBLL.cs
  5. 21
      MESClassLibrary/BLL/BasicInfo/StationBLL.cs
  6. 47
      MESClassLibrary/BLL/ZPPlan/ZP_MK_PlanBLL.cs
  7. 2
      MESClassLibrary/EFModel/BBMPT.Context.cs
  8. 70
      MESClassLibrary/EFModel/BBMPT.edmx
  9. 163
      MESClassLibrary/EFModel/BBMPT.edmx.diagram
  10. 6
      MESClassLibrary/EFModel/tb_Bom_MK.cs
  11. 2
      MESClassLibrary/MESClassLibrary.csproj
  12. 14
      MESClassLibrary/Model/ConfigModel .cs
  13. BIN
      MESWebSite/Excel/装配Bom导入模板.xlsx
  14. 130
      MESWebSite/HttpHandlers/Bom_MKHandler.ashx.cs
  15. 1
      MESWebSite/HttpHandlers/ConfigHandler.ashx
  16. 132
      MESWebSite/HttpHandlers/ConfigHandler.ashx.cs
  17. 14
      MESWebSite/HttpHandlers/StationHandler.ashx.cs
  18. 17
      MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx.cs
  19. 13
      MESWebSite/MESWebSite.csproj
  20. 4
      MESWebSite/MESWebSite.csproj.user
  21. 225
      MESWebSite/Manage/Bom_MK.aspx
  22. 268
      MESWebSite/Manage/Bom_MK.aspx.cs
  23. 54
      MESWebSite/Manage/Bom_MK.aspx.designer.cs
  24. 354
      MESWebSite/Manage/Config.aspx
  25. 20
      MESWebSite/Manage/Config.aspx.cs
  26. 44
      MESWebSite/Manage/Config.aspx.designer.cs
  27. 81
      MESWebSite/Manage/ZP_MK_Plan.aspx
  28. 17
      MESWebSite/Properties/PublishProfiles/FolderProfile.pubxml
  29. 185
      WebService/AppWebservice.asmx.cs
  30. 120
      WebService/Function.cs
  31. 43
      WebService/Model/MKModel .cs
  32. 1
      WebService/WebService.csproj
  33. 4
      WebService/WebService.csproj.user

83
MESClassLibrary/BLL/BasicInfo/Bom_MKBLL.cs

@ -60,9 +60,17 @@ namespace MESClassLibrary.BLL.BasicInfo
//}
//初始化要更新的字段
string[] proNames = new string[2];
string[] proNames = new string[10];
proNames[0] = "PartNo1";
proNames[1] = "PartNo2";
proNames[2] = "LineName";
proNames[3] = "StationNo";
proNames[4] = "IsChecked";
proNames[5] = "IsPartAssemble";
proNames[6] = "LeftCount";
proNames[7] = "RightCount";
proNames[8] = "PartDesc1";
proNames[9] = "PartDesc2";
//必填字段初始化,如果不需要更新必填字段则设置为空即可,时间类型无需初始化
//如果没有初始化必填字段,更新会报错
@ -102,7 +110,7 @@ namespace MESClassLibrary.BLL.BasicInfo
/// 查询全部信息分页
/// </summary>
/// <returns></returns>
public string SearchInfoAll(string page, string pagesize, string partNo1, string partNo2, string placeName)
public string SearchInfoAll(string page, string pagesize, string partNo1, string partNo2, string lineName)
{
try
{
@ -121,9 +129,9 @@ namespace MESClassLibrary.BLL.BasicInfo
list = list.Where(p => p.PartNo2 != null && p.PartNo2.Contains(partNo2) ).ToList();
}
if (!String.IsNullOrEmpty(placeName))
if (!String.IsNullOrEmpty(lineName))
{
list = list.Where(p => p.PlaceName != null && p.PlaceName.Contains(placeName)).ToList();
list = list.Where(p => p.LineName != null && p.LineName.Contains(lineName)).ToList();
}
if (list.Count > 0)
@ -277,5 +285,72 @@ namespace MESClassLibrary.BLL.BasicInfo
}
}
public List<List<string>> SearchForExcel(string paintNo, string stock)
{
try
{
List<List<string>> list1 = new List<List<string>>();
List<tb_Bom_MK> list = new List<tb_Bom_MK>();
string jsonStr = "[]";
int total = 0;//总行数
list = db.SearchAllInfo();
if (!string.IsNullOrWhiteSpace(paintNo))
{
list = list.Where(p => p.PartNo1.Equals(paintNo)).ToList();
}
if (!string.IsNullOrWhiteSpace(stock))
{
list = list.Where(p => p.LineName.Equals(stock)).ToList();
}
if (list != null && list.Count() > 0)
{
List<string> title_ = new List<string>();
title_.Add("总成零件号");
title_.Add("产品名称");
title_.Add("子零件号");
title_.Add("子零件名称");
title_.Add("是否检测");
title_.Add("是否半成品");
title_.Add("产线");
title_.Add("工位号");
title_.Add("左侧数量");
title_.Add("右侧数量");
list1.Add(title_);
List<string> titleList = new List<string>();
foreach (var item in list)
{
List<string> rowList = new List<string>();
rowList.Add(item.PartNo1 == null ? "" : item.PartNo1);
rowList.Add(item.PartDesc1 == null ? "" : item.PartDesc1);
rowList.Add(item.PartNo2 == null ? "" : item.PartNo2);
rowList.Add(item.PartDesc2 == null ? "" : item.PartDesc2);
rowList.Add(item.IsChecked == null ? "" : item.IsChecked.ToString());
rowList.Add(item.IsPartAssemble == null ? "" : item.IsPartAssemble.ToString());
rowList.Add(item.LineName == null ? "" : item.LineName);
rowList.Add(item.StationNo == null ? "" : item.StationNo);
rowList.Add(item.LeftCount == null ? "" : item.LeftCount.ToString());
rowList.Add(item.RightCount == null ? "" : item.RightCount.ToString());
list1.Add(rowList);
}
}
return list1;
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
return null;
}
}
}
}

143
MESClassLibrary/BLL/BasicInfo/ConfigBLL.cs

@ -0,0 +1,143 @@
using MESClassLibrary.BLL.Log;
using MESClassLibrary.EFModel;
using MESClassLibrary.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace MESClassLibrary.BLL.BasicInfo
{
public class ConfigBLL
{
BasicBLL<tb_Config> db = new BasicBLL<tb_Config>();
/// <summary>
/// 查询信息
/// </summary>
/// <returns></returns>
public string SearchInfo(string page, string pagesize, string name)
{
try
{
string jsonStr = "[]";
int total = 0;//总行数
List<tb_Config> list = db.SearchAllInfo();
if (!String.IsNullOrEmpty(name))
{
list = list.Where(p => p.name == name).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<tb_Config> ModelList = new List<tb_Config>();
foreach (var item in list)
{
if(item.name == "PunchAssembleVerifyQA")
{
ModelList.Add(item);
}
}
#endregion
JsonDataModel<tb_Config> md = new JsonDataModel<tb_Config>();
md.total = total.ToString();
md.rows = ModelList;
jsonStr = JSONTools.ScriptSerialize<JsonDataModel<tb_Config>>(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_Config md)
{
try
{
var list = db.SearchInfoByKey("name", md.name);//判断是否有重复数据
if (list != null)
{
if (list.Where(p => p.name != md.name).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_Config md)
{
try
{
var list = db.SearchAllInfo().Where(p => p.name == md.name).ToList();//判断是否有重复数据
if (list.Count > 0)
{
return false;
}
//初始化要更新的字段
string[] proNames = new string[1];
proNames[0] = "value";
//proNames[1] = "des";
//必填字段初始化,如果不需要更新必填字段则设置为空即可,时间类型无需初始化
//如果没有初始化必填字段,更新会报错
//md.Des = "";
return db.UpdateInfo(md, proNames);
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
return false;
}
}
/// 删除配置项信息
public bool DelInfo(tb_Config md)
{
try
{
return db.DelInfo(md);
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
return false;
}
}
}
}

21
MESClassLibrary/BLL/BasicInfo/LineBLL.cs

@ -166,5 +166,26 @@ namespace MESClassLibrary.BLL.BasicInfo
return "";
}
}
public bool IsExist(string lineName)
{
try
{
var list = db.SearchAllInfo().Where(p => p.LineName.Equals(lineName)).ToList();
if (list.Count > 0)
{
return true;
}
return false;
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
return false;
}
}
}
}

19
MESClassLibrary/BLL/BasicInfo/ProductBLL.cs

@ -664,6 +664,25 @@ namespace MESClassLibrary.BLL.BasicInfo
}
}
public bool IsExist(string partNo)
{
try
{
var list = db.SearchAllInfo().Where(p => p.PartNo.Equals(partNo)).ToList();
if (list.Count > 0)
{
return true;
}
return false;
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
return false;
}
}
}
}

21
MESClassLibrary/BLL/BasicInfo/StationBLL.cs

@ -257,5 +257,26 @@ namespace MESClassLibrary.BLL.BasicInfo
{
return da.SearchStationNameByID(stationID);
}
public bool IsExist(string stationNo)
{
try
{
var list = db.SearchAllInfo().Where(p => p.StationNo.Equals(stationNo)).ToList();
if (list.Count > 0)
{
return true;
}
return false;
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
return false;
}
}
}
}

47
MESClassLibrary/BLL/ZPPlan/ZP_MK_PlanBLL.cs

@ -57,7 +57,10 @@ namespace MESClassLibrary.BLL.BasicInfo
{
try
{
var data = db.SearchInfoByID(md.ID.ToString());
var list = db.SearchAllInfo().Where(p => p.ID == md.ID).ToList();//查询明细
if(list.Count==0) return false;
var data = list[0];
//var data = db.SearchInfoByID(md.ID.ToString());
if (data.State == 3)
{
msg = "该计划已经完成";
@ -69,13 +72,11 @@ namespace MESClassLibrary.BLL.BasicInfo
return false;
}
if (data.OKCount.GetValueOrDefault(0) == 0)
{
//data.StationID = md.StationID;
{
data.PartNo = md.PartNo;
data.OrderDate = md.OrderDate;
}
//data.IsOneMore = md.IsOneMore;
data.OrderCount = md.OrderCount;
data.OrderName = md.OrderName;
return db.UpdateInfo(data);
@ -117,13 +118,43 @@ namespace MESClassLibrary.BLL.BasicInfo
int pagesize,
string startTime,
string endTime,
string partNo)
string partNo, string state)
{
try
{
int stateFlag = 0;
if(!string.IsNullOrEmpty(state))
{
if(state == "新建")
{
stateFlag = 0;
}
else if(state == "启用")
{
stateFlag = 1;
}
else if (state == "暂停")
{
stateFlag = 2;
}
else if (state == "完成")
{
stateFlag = 3;
}
else
{
stateFlag = 0;
}
}
string jsonStr = "[]";
int total = 0;//总行数
IEnumerable<tb_ZP_MK_Plan> list = SearchDB(startTime, endTime, partNo);
if(!string.IsNullOrEmpty(state))
{
list = list.Where(p => p.State == stateFlag);
}
if (list.Any())
{
List<ZP_MK_PlanModel> modelList = new List<ZP_MK_PlanModel>();
@ -202,8 +233,8 @@ namespace MESClassLibrary.BLL.BasicInfo
{
list = db.Search(
q => (q.OrderDate >= st &&
q.OrderDate <= et) &&
q.State != 3,
q.OrderDate <= et)
,
q => q.OrderDate);
}
else

2
MESClassLibrary/EFModel/BBMPT.Context.cs

@ -195,7 +195,7 @@ namespace MESClassLibrary.EFModel
public virtual DbSet<t_XD_ProductType> t_XD_ProductType { get; set; }
public virtual DbSet<W_XD_Product_del> W_XD_Product_del { get; set; }
public virtual DbSet<t_XD_StockArea> t_XD_StockArea { get; set; }
public virtual DbSet<tb_Bom_MK> tb_Bom_MK { get; set; }
public virtual DbSet<tb_ZP_MK_Plan> tb_ZP_MK_Plan { get; set; }
public virtual DbSet<tb_Bom_MK> tb_Bom_MK { get; set; }
}
}

70
MESClassLibrary/EFModel/BBMPT.edmx

@ -662,9 +662,13 @@
<Property Name="PartNo2" Type="nvarchar" MaxLength="50" />
<Property Name="UserID" Type="char" MaxLength="36" />
<Property Name="IsChecked" Type="bit" />
<Property Name="PlaceName" Type="nvarchar" MaxLength="100" />
<Property Name="LineName" Type="nvarchar" MaxLength="100" />
<Property Name="IsPartAssemble" Type="int" />
<Property Name="StationNo" Type="varchar" MaxLength="50" />
<Property Name="LeftCount" Type="int" />
<Property Name="RightCount" Type="int" />
<Property Name="PartDesc1" Type="nvarchar" MaxLength="50" />
<Property Name="PartDesc2" Type="nvarchar" MaxLength="50" />
</EntityType>
<EntityType Name="tb_Box_247">
<Key>
@ -3591,8 +3595,8 @@
<EntitySet Name="t_XD_ProductType" EntityType="BBMPTModel.t_XD_ProductType" />
<EntitySet Name="W_XD_Product_del" EntityType="BBMPTModel.W_XD_Product_del" />
<EntitySet Name="t_XD_StockArea" EntityType="BBMPTModel.t_XD_StockArea" />
<EntitySet Name="tb_Bom_MK" EntityType="BBMPTModel.tb_Bom_MK" />
<EntitySet Name="tb_ZP_MK_Plan" EntityType="BBMPTModel.tb_ZP_MK_Plan" />
<EntitySet Name="tb_Bom_MK" EntityType="BBMPTModel.tb_Bom_MK" />
</EntityContainer>
<EntityType Name="LogErr">
<Key>
@ -6081,19 +6085,6 @@
<Property Name="Name" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
<Property Name="U8Code" Type="String" MaxLength="20" FixedLength="false" Unicode="true" />
</EntityType>
<EntityType Name="tb_Bom_MK">
<Key>
<PropertyRef Name="BomID" />
</Key>
<Property Name="BomID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="PartNo1" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="PartNo2" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="UserID" Type="String" MaxLength="36" FixedLength="true" Unicode="false" />
<Property Name="IsChecked" Type="Boolean" />
<Property Name="PlaceName" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
<Property Name="IsPartAssemble" Type="Int32" />
<Property Name="StationNo" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="tb_ZP_MK_Plan">
<Key>
<PropertyRef Name="ID" />
@ -6114,6 +6105,23 @@
<Property Name="FinishTime" Type="DateTime" Precision="3" />
<Property Name="RepairCount" Type="Int32" />
</EntityType>
<EntityType Name="tb_Bom_MK">
<Key>
<PropertyRef Name="BomID" />
</Key>
<Property Name="BomID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="PartNo1" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="PartNo2" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="UserID" Type="String" MaxLength="36" FixedLength="true" Unicode="false" />
<Property Name="IsChecked" Type="Boolean" />
<Property Name="LineName" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
<Property Name="IsPartAssemble" Type="Int32" />
<Property Name="StationNo" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="LeftCount" Type="Int32" />
<Property Name="RightCount" Type="Int32" />
<Property Name="PartDesc1" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="PartDesc2" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
</EntityType>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
@ -8754,20 +8762,6 @@
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="tb_Bom_MK">
<EntityTypeMapping TypeName="BBMPTModel.tb_Bom_MK">
<MappingFragment StoreEntitySet="tb_Bom_MK">
<ScalarProperty Name="StationNo" ColumnName="StationNo" />
<ScalarProperty Name="IsPartAssemble" ColumnName="IsPartAssemble" />
<ScalarProperty Name="PlaceName" ColumnName="PlaceName" />
<ScalarProperty Name="IsChecked" ColumnName="IsChecked" />
<ScalarProperty Name="UserID" ColumnName="UserID" />
<ScalarProperty Name="PartNo2" ColumnName="PartNo2" />
<ScalarProperty Name="PartNo1" ColumnName="PartNo1" />
<ScalarProperty Name="BomID" ColumnName="BomID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="tb_ZP_MK_Plan">
<EntityTypeMapping TypeName="BBMPTModel.tb_ZP_MK_Plan">
<MappingFragment StoreEntitySet="tb_ZP_MK_Plan">
@ -8789,6 +8783,24 @@
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="tb_Bom_MK">
<EntityTypeMapping TypeName="BBMPTModel.tb_Bom_MK">
<MappingFragment StoreEntitySet="tb_Bom_MK">
<ScalarProperty Name="PartDesc2" ColumnName="PartDesc2" />
<ScalarProperty Name="PartDesc1" ColumnName="PartDesc1" />
<ScalarProperty Name="RightCount" ColumnName="RightCount" />
<ScalarProperty Name="LeftCount" ColumnName="LeftCount" />
<ScalarProperty Name="StationNo" ColumnName="StationNo" />
<ScalarProperty Name="IsPartAssemble" ColumnName="IsPartAssemble" />
<ScalarProperty Name="LineName" ColumnName="LineName" />
<ScalarProperty Name="IsChecked" ColumnName="IsChecked" />
<ScalarProperty Name="UserID" ColumnName="UserID" />
<ScalarProperty Name="PartNo2" ColumnName="PartNo2" />
<ScalarProperty Name="PartNo1" ColumnName="PartNo1" />
<ScalarProperty Name="BomID" ColumnName="BomID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>

163
MESClassLibrary/EFModel/BBMPT.edmx.diagram

@ -173,8 +173,9 @@
<EntityTypeShape EntityType="BBMPTModel.View_1" Width="1.5" PointX="0.5" PointY="18.625" IsExpanded="false" />
<AssociationConnector Association="BBMPTModel.FK_T_SYS_RO_REFERENCE_T_SYS_PO" />
<EntityTypeShape EntityType="BBMPTModel.tb_ForeignColorMap" Width="1.5" PointX="0.5" PointY="3.75" IsExpanded="false" />
<EntityTypeShape EntityType="BBMPTModel.tb_Bom_MK" Width="1.5" PointX="7.5884246675243716" PointY="25.518843707404493" />
<EntityTypeShape EntityType="BBMPTModel.tb_ZP_MK_Plan" Width="1.5" PointX="8.6183643250811688" PointY="11.701445868099782" />
<EntityTypeShape EntityType="BBMPTModel.tb_Bom_MK" Width="1.5" PointX="10.472593807835409" PointY="1.783981130357823" />
@ -6599,6 +6600,166 @@
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r85
</Diagram>
<Diagram DiagramId="56fb9509dfdb4dde96dce5edc0ce3e94" Name="Diagram2" >
</Diagram>

6
MESClassLibrary/EFModel/tb_Bom_MK.cs

@ -19,8 +19,12 @@ namespace MESClassLibrary.EFModel
public string PartNo2 { get; set; }
public string UserID { get; set; }
public Nullable<bool> IsChecked { get; set; }
public string PlaceName { get; set; }
public string LineName { get; set; }
public Nullable<int> IsPartAssemble { get; set; }
public string StationNo { get; set; }
public Nullable<int> LeftCount { get; set; }
public Nullable<int> RightCount { get; set; }
public string PartDesc1 { get; set; }
public string PartDesc2 { get; set; }
}
}

2
MESClassLibrary/MESClassLibrary.csproj

@ -67,6 +67,7 @@
<Compile Include="BLL\BasicInfo\Bom_MKBLL.cs" />
<Compile Include="BLL\BasicInfo\BomBLL.cs" />
<Compile Include="BLL\BasicInfo\BucketInfoBLL.cs" />
<Compile Include="BLL\BasicInfo\ConfigBLL.cs" />
<Compile Include="BLL\BasicInfo\XDStockAreaBLL.cs" />
<Compile Include="BLL\BasicInfo\XDCarModelBLL.cs" />
<Compile Include="BLL\BasicInfo\CarTypeBLL.cs" />
@ -831,6 +832,7 @@
<Compile Include="Model\PartMstrModel.cs" />
<Compile Include="Model\PartRecordModel.cs" />
<Compile Include="Model\PieDataModel.cs" />
<Compile Include="Model\ConfigModel .cs" />
<Compile Include="Model\PlaceModel.cs" />
<Compile Include="Model\PlasticModel.cs" />
<Compile Include="Model\PLCBreakModel.cs" />

14
MESClassLibrary/Model/ConfigModel .cs

@ -0,0 +1,14 @@
using MESClassLibrary.EFModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MESClassLibrary.Model
{
public class ConfigModel : tb_Config
{
public string FactoryName { get; set; }
}
}

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

Binary file not shown.

130
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;
@ -58,7 +64,7 @@ namespace MESWebSite.HttpHandlers
string pagesize = Request.Params["rows"];
string partNo1 = Request.Params["PartNo1"];
string partNo2 = Request.Params["PartNo2"];
string placeName = Request.Params["PlaceName"];
string lineName = Request.Params["LineName"];
if (string.IsNullOrEmpty(page))
{
@ -69,7 +75,7 @@ namespace MESWebSite.HttpHandlers
pagesize = "15";
}
Bom_MKBLL bll = new Bom_MKBLL();
Response.Write(bll.SearchInfoAll(page, pagesize, partNo1, partNo2, placeName));
Response.Write(bll.SearchInfoAll(page, pagesize, partNo1, partNo2, lineName));
Response.End();
@ -82,9 +88,37 @@ namespace MESWebSite.HttpHandlers
string IsChecked = Request.Params["IsChecked"];
string IsPartAssemble = Request.Params["IsPartAssemble"];
string StationNo = Request.Params["StationNo"];
string PlaceName = Request.Params["PlaceName"];
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,14 +134,57 @@ 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();
md.PartNo1 = PartNo1;
md.PartNo2 = PartNo2;
md.PlaceName = PlaceName;
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();
}
}
}

14
MESWebSite/HttpHandlers/StationHandler.ashx.cs

@ -41,6 +41,9 @@ namespace MESWebSite.HttpHandlers
case "QueryForComboboxByLineID":
QueryForComboboxByLineID();
break;
case "QueryForComboboxByLineIDNew":
QueryForComboboxByLineIDNew();
break;
default:
break;
@ -147,5 +150,16 @@ namespace MESWebSite.HttpHandlers
Response.End();
}
void QueryForComboboxByLineIDNew()
{
string LineID = Request.Params["LineID"];
StationBLL bll = new StationBLL();
Response.Write(bll.GetComboboxDataByLine(LineID));
Response.End();
}
}
}

17
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();
}
@ -117,7 +118,7 @@ namespace MESWebSite.HttpHandlers
tb_ZP_MK_Plan zpp = new tb_ZP_MK_Plan
{
ID = int.Parse(id),
PartNo = partNo,
OrderDate = orderDate,
OrderCount = orderCount,
@ -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>

225
MESWebSite/Manage/Bom_MK.aspx

@ -49,7 +49,7 @@
}
}
</style>
<title>门槛BOM信息</title>
<title>装配BOM信息</title>
</head>
<body>
<form id="form1" runat="server">
@ -60,12 +60,12 @@
<td><span class="title" style="width: 150px">BOM信息</span>
</td>
<td style="width: 50px;"></td>
<td style="width: 300px;">注塑件零件号:
<td style="width: 300px;">总成零件号:
<input type="text" id="PartNo1_s" style="width: 140px;" /></td>
<td style="width: 300px;">塑料粒子零件号:
<td style="width: 300px;">子零件号:
<input type="text" id="PartNo2_s" style="width: 140px;" /></td>
<td style="width: 200px;">地点
<input type="text" id="PlaceName_s" style="width: 140px;" /></td>
<td style="width: 200px;">产线
<input type="text" id="LineName_s" style="width: 140px;" /></td>
<td style="width: 80px" ><a class="topsearchBtn">查询</a></td>
<td style="width: 80px">
@ -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>
@ -88,7 +94,7 @@
<tr>
<td class="title" style="width: 110px;">
<p>
注塑件(零件号)
总成零件号
</p>
</td>
<td colspan="2">
@ -100,7 +106,7 @@
<tr>
<td class="title" style="width: 110px;">
<p>
塑料粒零件号
子零件号:
</p>
</td>
<td colspan="2">
@ -130,6 +136,18 @@
<input id="IsPartAssemble" type="checkbox"/>
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
产线:
</p>
</td>
<td colspan="2">
<select id="line_id" class="easyui-combobox" style="width: 234px; height: 36px;"
data-options="valueField: 'LineID',textField: 'LineName'">
</select><span style="color: red; font-size: 18px; vertical-align: middle;">*</span>
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
@ -137,19 +155,33 @@
</p>
</td>
<td colspan="2">
<input id="StationNo" type="text" class="text" style="width: 220px; height: 30px;" /><span style="color: red; font-size: 18px; vertical-align: middle;">*</span>
</td>
<select id="station_id" class="easyui-combobox" style="width: 234px; height: 36px;"
data-options="valueField: 'StationID',textField: 'StationNo'">
</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="PlaceName" type="text" class="text" style="width: 220px; height: 30px;" /><span style="color: red; font-size: 18px; vertical-align: middle;">*</span>
<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 -->
@ -160,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>
@ -174,6 +234,7 @@
cache: false //关闭AJAX缓存
});
reloadline_station();
//新增按钮点击
$('.topaddBtn').first().click(function () {
@ -237,10 +298,10 @@
remoteSort: false,
columns: [[
{ field: 'BomID', title: 'BomID', hidden: true },
{ field: 'PartNo1', title: '注塑件(零件号)', sortable: 'true', width: 10 },
{ 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: 'PartNo2', title: '子零件号', sortable: 'true', width: 10 },
{ field: 'ProductName2', title: '子零件号名称', sortable: 'true', width: 10 },
{
field: 'IsChecked', title: '是否检测', sortable: 'true', width: 10,
formatter: function (value) {
@ -261,8 +322,11 @@
}
}
},
{ field: 'LineName', title: '产线', sortable: 'true', width: 10 },
{ field: 'StationNo', title: '工位号', sortable: 'true', width: 10 },
{ field: 'PlaceName', title: '地点', sortable: 'true', width: 10 },
{ field: 'LeftCount', title: '左侧数量', sortable: 'true', width: 10 },
{ field: 'RightCount', title: '右侧数量', sortable: 'true', width: 10 },
]],
pagination: true,//表示在datagrid设置分页
@ -278,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'); }
});
});
/**************** 主要业务程序 ***************/
@ -287,8 +393,8 @@
var BomID = isEdit == true ? PrimaryID : 0;
var PartNo1 = $('#fl_id_1').combo('getValue');
var PartNo2 = $('#fl_id_2').combo('getValue');
var PlaceName = $('#PlaceName').val();
var StationNo = $('#StationNo').val();
var LineName = $('#line_id').combo('getText');
var StationNo = $('#station_id').combo('getText');
var IsChecked = 0;
if ($('#IsChecked').is(':checked')) {
@ -300,24 +406,29 @@
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');
$.messager.alert('提示', '总成零件号不能为空,请重新输入', 'warning');
return;
}
if (PartNo2 == "") {
$.messager.alert('提示', '塑料粒子不能为空,请重新输入', 'warning');
$.messager.alert('提示', '子零件不能为空,请重新输入', 'warning');
return;
}
if (StationNo == "") {
$.messager.alert('提示', '工位号不能为空,请重新输入', 'warning');
if (LineName == "") {
$.messager.alert('提示', '产线不能为空,请重新输入', 'warning');
return;
}
if (PlaceName == "") {
$.messager.alert('提示', '地点不能为空,请重新输入', 'warning');
if (StationNo == "") {
$.messager.alert('提示', '工位号不能为空,请重新输入', 'warning');
return;
}
var model = {
BomID: BomID,
@ -326,7 +437,11 @@
IsChecked: IsChecked,
IsPartAssemble: IsPartAssemble,
StationNo: StationNo,
PlaceName: PlaceName,
LineName: LineName,
LeftCount: LeftCount,
RightCount: RightCount,
ProductName1: ProductName1,
ProductName2: ProductName2,
method: 'SaveInfo'
};
SaveModel(model);
@ -358,12 +473,12 @@
var PartNo1 = $('#PartNo1_s').val();
var PartNo2 = $('#PartNo2_s').val();
var PlaceName = $('#PlaceName_s').val();
var LineName = $('#LineName_s').val();
var queryParams = {
PartNo1: PartNo1,
PartNo2: PartNo2,
PlaceName: PlaceName
LineName: LineName
};
dg.datagrid({
queryParams: queryParams
@ -400,8 +515,13 @@
$('#IsPartAssemble').prop("checked", "checked")
}
$('#PlaceName').val(row.PlaceName);
$('#StationNo').val(row.StationNo);
$('#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');
}
@ -451,16 +571,55 @@
$('#fl_id_2').combo('clear');
$('#IsChecked').removeAttr("checked");
$('#IsPartAssemble').removeAttr("checked");
$('#PlaceName').val('');
$('#StationNo').val('');
$('#line_id').combo('clear');
$('#station_id').combo('clear');
$('#LeftCount').val('');
$('#RightCount').val('');
$('#ProductName1').val('');
$('#ProductName2').val('');
}
function reloadfl_id() {
$('#fl_id_1').combobox('reload', '/HttpHandlers/ProductHandler.ashx?method=QueryForCombobox&ProductTypeNo=2000');
$('#fl_id_2').combobox('reload', '/HttpHandlers/ProductHandler.ashx?method=QueryForCombobox&ProductTypeNo=1101');
$('#fl_id_1').combobox('reload', '/HttpHandlers/ProductHandler.ashx?method=QueryForCombobox&ProductTypeNo=6000');
$('#fl_id_2').combobox('reload', '/HttpHandlers/ProductHandler.ashx?method=QueryForCombobox&ProductTypeNo=6001');
}
function reloadline_station() {
$('#line_id').combobox({
url: '/HttpHandlers/LineHandler.ashx?method=QueryForCombobox',
onLoadSuccess: function () {
var val = $(this).combobox('getData');
$(this).combobox('select', val[0].LineID);
},
onSelect: function (row) {
$('#station_id').combobox({
url: '/HttpHandlers/StationHandler.ashx?method=QueryForComboboxByLineIDNew&&LineID=' + row.LineID + '',
onLoadSuccess: function () {
//var val = $(this).combobox('getData');
//$(this).combobox('select', val[0].ID);
},
});
}
});
}
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;
}
}

81
MESWebSite/Manage/ZP_MK_Plan.aspx

@ -57,11 +57,14 @@
<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;"> 装配日期:
<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');}" />
</td>
@ -108,7 +111,7 @@
</td>
<td colspan="2">
<select id="part_no" class="easyui-combobox" style="width: 200px; height: 30px;"
data-options="valueField: 'PartNo',textField: 'ProductName'">
data-options="valueField: 'PartNo',textField: 'PartName'">
</select>
</td>
</tr>
@ -129,7 +132,9 @@
</p>
</td>
<td colspan="2">
<input id="Line" type="text" class="text" style="width: 230px; height: 30px;" />
<select id="line_id" class="easyui-combobox" style="width: 234px; height: 36px;"
data-options="valueField: 'LineID',textField: 'LineName'">
</select><span style="color: red; font-size: 18px; vertical-align: middle;">*</span>
</td>
</tr>
<tr>
@ -139,7 +144,9 @@
</p>
</td>
<td colspan="2">
<input id="Station" type="text" class="text" style="width: 230px; height: 30px;" />
<select id="station_id" class="easyui-combobox" style="width: 234px; height: 36px;"
data-options="valueField: 'StationID',textField: 'StationNo'">
</select><span style="color: red; font-size: 18px; vertical-align: middle;">*</span>
</td>
</tr>
<tr>
@ -155,7 +162,7 @@
<tr>
<td class="title" style="width: 110px;">
<p>
装配日期
装配时间
</p>
</td>
<td>
@ -188,6 +195,7 @@
});
// 下拉框加载
reloadline_station();
//reload_station_no('#station_no');
reload_part_no('#part_no');
//新增按钮点击
@ -285,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 "完成";
}
}
},
]],
@ -308,14 +334,12 @@
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 PartNo = $('#part_no').combo('getValue');
var OrderDate = $('#OrderDate').datebox('getValue');
var OrderCount = $('#OrderCount').val();
var OrderName = $('#OrderName').val();
var Line = $('#Line').val();
var Station = $('#Station').val();
var Line = $('#line_id').combo('getText');
var Station = $('#station_id').combo('getText');
if (PartNo == "") {
$.messager.alert('提示', '零件不能为空,请重新输入', 'warning');
@ -381,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
}
@ -413,8 +439,8 @@
//toggleChecked('#IsOneMore', row.IsOneMore);
$('#OrderCount').val(row.OrderCount);
$('#OrderName').val(row.OrderName);
$('#Line').val(row.Line);
$('#Station').val(row.Station);
$('#line_id').combobox('select', row.Line);
$('#station_id').combobox('select', row.Station);
var pa = /.*\((.*)\)/;
var unixtime = row.OrderDate.match(pa)[1].substring(0, 10);
$('#OrderDate').datetimebox('setValue', getTime(unixtime).substring(0, 19));
@ -467,8 +493,8 @@
$('#OrderDate').datebox('setValue', '');
$('#OrderCount').val('');
$('#OrderName').val('');
$('#Line').val('');
$('#Station').val('');
$('#line_id').combo('clear');
$('#station_id').combo('clear');
}
function toggleChecked(id, checked) {
@ -482,7 +508,7 @@
* 加载产品下拉信息
**/
function reload_part_no(ctl) {
base_reload_combobox(ctl, '/HttpHandlers/ProductHandler.ashx?method=GetComboboxProduct4');
base_reload_combobox(ctl, '/HttpHandlers/ProductHandler.ashx?method=QueryForCombobox&ProductTypeNo=6000');
}
function reload_station_no(ctl) {
@ -507,6 +533,27 @@
document.body.appendChild(temp_form);
temp_form.submit();
}
function reloadline_station() {
$('#line_id').combobox({
url: '/HttpHandlers/LineHandler.ashx?method=QueryForCombobox',
onLoadSuccess: function () {
var val = $(this).combobox('getData');
$(this).combobox('select', val[0].LineID);
},
onSelect: function (row) {
$('#station_id').combobox({
url: '/HttpHandlers/StationHandler.ashx?method=QueryForComboboxByLineIDNew&&LineID=' + row.LineID + '',
onLoadSuccess: function () {
//var val = $(this).combobox('getData');
//$(this).combobox('select', val[0].ID);
},
});
}
});
}
</script>
</form>
</body>

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>

185
WebService/AppWebservice.asmx.cs

@ -1,6 +1,9 @@
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Runtime.Remoting.Contexts;
using System.Text;
using System.Web.Script.Services;
using System.Web.Services;
using Tools;
@ -25,6 +28,188 @@ namespace Webservice
return "Hello World";
}
/// <summary>
/// 箱码与总成码关系绑定
/// </summary>
/// <param name="app_id"></param>
/// <param name="boxCode"></param>
/// <param name="barCode"></param>
/// <param name="sign"></param>
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void BindBoxCodeAndBarCode(string app_id, string boxCode, string barCode, string sign)
{
string errorReason = "";
JsonModel<MKModel> model = new JsonModel<MKModel>();
model.Result = "0";
model.ResultType = "Result";
model.ResultRowsCount = "0";
model.ErrReason = errorReason;
model.DataList = null;
LogHelper.WriteSysLogBase("箱码与总成码关系绑定,入参boxCode=" + boxCode + ",barCode=" + barCode, MethodBase.GetCurrentMethod().Name);
Context.Response.ContentType = "application/json; charset=utf-8";
#region 参数判断
//if (string.IsNullOrWhiteSpace(app_id))
//{
// model.ErrReason = "缺少必要传入参数 app_id";
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model));
// return;
//}
if (string.IsNullOrWhiteSpace(boxCode))
{
model.ErrReason = "缺少必要传入参数 boxCode";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model));
return;
}
//箱码格式验证
var boxCodeList = boxCode.Split(';');
if (!boxCode.Contains("PN") || !boxCode.Contains("PKG") || !boxCode.Contains("QTY") || boxCodeList.Length != 7 || boxCodeList[0].Length != 16 || boxCodeList[1].Length != 12 || boxCodeList[5].Length != 16)
{
model.ErrReason = "箱码标签格式不对";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model));
return;
}
//if (string.IsNullOrWhiteSpace(barCode))
//{
// model.ErrReason = "缺少必要传入参数 barCode";
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model));
// return;
//}
//if (string.IsNullOrWhiteSpace(sign))
//{
// model.ErrReason = "缺少必要传入参数 sign";
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model));
// return;
//}
//bool access = Function.AppIDIsRight(app_id.Trim());
//if (!access)
//{
// model.ErrReason = "APP接口调用标识不正确 远程服务器拒绝了此次连接请求";
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model));
// return;
//}
//string[] param = { Function.app_secret.Trim(), boxCode.Trim(), barCode.Trim() };
//bool paramIsRight = Function.signIsRight(param, sign);
//if (!paramIsRight)
//{
// model.ErrReason = "sign参数传输错误 远程服务器拒绝了此次连接请求";
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model));
// return;
//}
#endregion
string errorReasonBoxData = "";
DataTable dt = Function.GetCodeRecords(boxCode, out errorReasonBoxData);
List<MKModel> listInfo = new List<MKModel>();
if (dt.Rows.Count < 1)
{
model.ResultRowsCount = "0";
model.DataList = null;
if (string.IsNullOrEmpty(errorReasonBoxData))
{
model.Result = "1";
model.ErrReason = "";
}
else
{
model.Result = "0";
model.ErrReason = errorReasonBoxData;
}
}
else
{
listInfo = Tools.DataTableToList.ConvertTo<MKModel>(dt);
model.ResultRowsCount = listInfo.Count.ToString();
model.DataList = listInfo;
}
if(!string.IsNullOrEmpty(barCode))
{
#region 数据合法性判断
//总成码格式验证
var barCodeList = barCode.Split(';');
if (!barCode.Contains("S104") || !barCode.Contains(".") || barCodeList[0].Length != 17 || barCodeList[1].Length != 4 || barCodeList[2].Length != 4)
{
model.Result = "0";
model.ErrReason = "总成条码格式不对或不存在";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model));
return;
}
//箱码和总成码零件验证
string boxPartNo = boxCodeList[0].Substring(3,10);
string barCodePartNo = barCodeList[0].Substring(0, 10);
if(boxPartNo != barCodePartNo)
{
model.Result = "0";
model.ErrReason = "箱码和总成条码零件号不符";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model));
return;
}
#endregion
int updateNum = Function.BindBoxCodeAndBarCode(boxCode, barCode, out errorReason);
dt = Function.GetCodeRecords(boxCode, out errorReasonBoxData);
if (dt.Rows.Count < 1)
{
model.ResultRowsCount = "0";
model.DataList = null;
if (string.IsNullOrEmpty(errorReasonBoxData))
{
model.Result = "1";
model.ErrReason = "";
}
else
{
model.Result = "0";
model.ErrReason = errorReasonBoxData;
}
}
else
{
listInfo = Tools.DataTableToList.ConvertTo<MKModel>(dt);
model.ResultRowsCount = listInfo.Count.ToString();
model.DataList = listInfo;
}
if (!string.IsNullOrEmpty(errorReason) && !string.IsNullOrEmpty(barCode))
{
model.Result = "0";
model.ErrReason = errorReason;
}
else
{
model.Result = "1";
string qtyValue = "0";
var boxCodeSplit = boxCode.Split(';');
foreach (string part in boxCodeSplit)
{
if (part.StartsWith("QTY:"))
{
qtyValue = part.Substring(4); // 从"QTY:"后的字符开始截取
}
}
if (listInfo.Count.ToString() == qtyValue)
{
}
}
}
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model));
}
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void MD5Encrypt(string str)

120
WebService/Function.cs

@ -325,6 +325,126 @@ namespace Webservice
}
}
/// <summary>
/// 获取装箱记录
/// </summary>
/// <param name="boxCode"></param>
/// <param name="errorReason"></param>
/// <returns></returns>
public static DataTable GetCodeRecords(string boxCode, out string errorReason)
{
DataTable res = new DataTable();
try
{
string sql = @"
select * from tb_Punch_Code_Record where BoxCode = '" + boxCode + @"' order by CreateTime desc
";
res = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null);
errorReason = "";
return res;
}
catch (Exception ex)
{
LogHelper.WriteLogManager(ex);
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
errorReason = ex.Message;
return res;
}
}
/// <summary>
/// 箱码和总成码绑定
/// </summary>
/// <param name="boxCode"></param>
/// <param name="barCode"></param>
/// <param name="errorReason"></param>
/// <returns></returns>
public static int BindBoxCodeAndBarCode(string boxCode, string barCode, out string errorReason)
{
int updateNum = 0;
string qtyValue = "0";
try
{
errorReason = "";
var boxCodeSplit = boxCode.Split(';');
foreach (string part in boxCodeSplit)
{
if (part.StartsWith("QTY:"))
{
qtyValue = part.Substring(4); // 从"QTY:"后的字符开始截取
}
}
DataTable dtBoxNum = GetCodeRecords(boxCode, out errorReason);
if(dtBoxNum != null && dtBoxNum.Rows.Count.ToString() == qtyValue)
{
errorReason = "扫描总数超出箱码限制数量";
return updateNum;
}
string sql = @"
select top 1 * from tb_Punch_Code_Record where Flag=1 and ZcBarCode = '" + barCode + @"' order by CreateTime desc
";
DataTable dt = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null);
if (dt != null && dt.Rows.Count > 0)
{
string id = dt.Rows[0]["ID"].ToString();
string barcode = dt.Rows[0]["barcode"].ToString();
string zcBarCode = dt.Rows[0]["ZcBarCode"].ToString();
string boxCodeDB = dt.Rows[0]["BoxCode"].ToString();
if(string.IsNullOrEmpty(boxCodeDB))
{
string updateSql = @" update [dbo].[tb_Punch_Code_Record] set BoxCode='" + boxCode + "',pkg='"+qtyValue+"' where ID='" + id + "'";
updateNum = SqlHelper.ExecuteNonQuery(SqlHelper.SqlConnString, CommandType.Text, updateSql, null);
if (updateNum == 0)
{
errorReason = "总成条码装箱失败";
}
else
{
string insertSql = @"
insert into tb_Punch_Interface(PackageCode,OneBarCode)
values('" + boxCode + "','"+ barCode + @"')
";
int insertNum = SqlHelper.ExecuteNonQuery(SqlHelper.SqlConnString, CommandType.Text, insertSql, null);
}
}
else
{
if(boxCode.Trim() == boxCodeDB.Trim())
{
errorReason = "总成条码已装箱";
}
else
{
errorReason = "总成条码已被其他箱码装箱";
}
}
}
else
{
errorReason = "总成条码格式不对或不存在";
}
return updateNum;
}
catch (Exception ex)
{
LogHelper.WriteLogManager(ex);
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
errorReason = ex.Message;
return updateNum;
}
}
public static DataTable GetMaterialInfo(string drumCode, out string errorReason)
{
DataTable res = new DataTable();

43
WebService/Model/MKModel .cs

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebService.Model
{
public class MKModel
{
/// <summary>
/// 塑件码
/// </summary>
public string barcode { get; set; }
/// <summary>
/// 总成零件号
/// </summary>
public string ZcBarCode { get; set; }
///// <summary>
///// 订单号
///// </summary>
//public string OrderNo { get; set; }
///// <summary>
///// 班次
///// </summary>
//public string WorkClass { get; set; }
/// <summary>
/// 合格标记
/// </summary>
public int Flag { get; set; }
/// <summary>
/// 箱码
/// </summary>
public string BoxCode { get; set; }
///// <summary>
///// 标包
///// </summary>
//public string PKG { get; set; }
///// <summary>
///// 创建时间
///// </summary>
//public DateTime CreateTime { get; set; }
}
}

1
WebService/WebService.csproj

@ -122,6 +122,7 @@
</Compile>
<Compile Include="Model\AddPartModel.cs" />
<Compile Include="Model\ColorInfoModel.cs" />
<Compile Include="Model\MKModel .cs" />
<Compile Include="Model\InfoModel.cs" />
<Compile Include="Model\InspectModel.cs" />
<Compile Include="Model\JsonModel.cs" />

4
WebService/WebService.csproj.user

@ -1,4 +1,4 @@
<?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>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
@ -15,7 +15,7 @@
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<StartPageUrl>WMSWebService.asmx</StartPageUrl>
<StartPageUrl>AppWebservice.asmx</StartPageUrl>
<StartAction>SpecificPage</StartAction>
<AspNetDebugging>True</AspNetDebugging>
<SilverlightDebugging>False</SilverlightDebugging>

Loading…
Cancel
Save