Browse Source

更新配置功能

master
周红军 2 days ago
parent
commit
88baba8831
  1. 73
      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. 36
      MESClassLibrary/BLL/ZPPlan/ZP_MK_PlanBLL.cs
  7. 12
      MESClassLibrary/EFModel/BBMPT.edmx
  8. 163
      MESClassLibrary/EFModel/BBMPT.edmx.diagram
  9. 4
      MESClassLibrary/EFModel/tb_Bom_MK.cs
  10. 2
      MESClassLibrary/MESClassLibrary.csproj
  11. 14
      MESClassLibrary/Model/ConfigModel .cs

73
MESClassLibrary/BLL/BasicInfo/Bom_MKBLL.cs

@ -60,13 +60,17 @@ namespace MESClassLibrary.BLL.BasicInfo
//}
//初始化要更新的字段
string[] proNames = new string[6];
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";
//必填字段初始化,如果不需要更新必填字段则设置为空即可,时间类型无需初始化
//如果没有初始化必填字段,更新会报错
@ -281,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;
}
}
}
}

36
MESClassLibrary/BLL/ZPPlan/ZP_MK_PlanBLL.cs

@ -118,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>();
@ -203,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

12
MESClassLibrary/EFModel/BBMPT.edmx

@ -665,6 +665,10 @@
<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>
@ -6113,6 +6117,10 @@
<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>
@ -8778,6 +8786,10 @@
<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" />

163
MESClassLibrary/EFModel/BBMPT.edmx.diagram

@ -174,7 +174,8 @@
<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_ZP_MK_Plan" Width="1.5" PointX="8.6183643250811688" PointY="11.701445868099782" />
<EntityTypeShape EntityType="BBMPTModel.tb_Bom_MK" Width="1.5" PointX="0.83173512333619182" PointY="30.64839208063129" />
<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>

4
MESClassLibrary/EFModel/tb_Bom_MK.cs

@ -22,5 +22,9 @@ namespace MESClassLibrary.EFModel
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; }
}
}
Loading…
Cancel
Save