11
This commit is contained in:
@@ -10,6 +10,8 @@ using NPOI.XSSF.UserModel;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using BLL;
|
||||
using Org.BouncyCastle.Ocsp;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
|
||||
namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
||||
{
|
||||
@@ -499,6 +501,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
||||
var componentss = from x in Funs.DB.Base_Components select x;//安装组件
|
||||
var consumabless = from x in Funs.DB.Base_Consumables select x;//焊接耗材(焊丝、焊条)
|
||||
var wpsList = from x in Funs.DB.WPQ_WPQList select x;
|
||||
var coodeList = from x in Funs.DB.Base_MaterialCoode where x.ProjectId == this.CurrUser.LoginProjectId select x; //coode
|
||||
|
||||
List<Model.SpWeldingDaily> dayList = new List<Model.SpWeldingDaily>();
|
||||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||||
@@ -579,7 +582,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
||||
{
|
||||
var pipeline = from x in Funs.DB.Pipeline_Pipeline
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.WorkAreaId == areaId
|
||||
&& x.InstallationId == insId && x.PipelineCode == ds.Tables[0].Rows[i]["管线号"].ToString()
|
||||
&& x.InstallationId == insId && x.WorkAreaId==areaId && x.PipelineCode == ds.Tables[0].Rows[i]["管线号"].ToString()
|
||||
select x;
|
||||
|
||||
if (pipeline.Count() > 0)
|
||||
@@ -630,6 +633,8 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
||||
d.Material2Id = jot.First().Material2Id;
|
||||
d.PipeAssembly1Id = jot.First().PipeAssembly1Id;
|
||||
d.PipeAssembly2Id = jot.First().PipeAssembly2Id;
|
||||
d.Coode1 = jot.First().Coode1;
|
||||
d.Coode2 = jot.First().Coode2;
|
||||
d.HeartNo1 = jot.First().HeartNo1;
|
||||
d.HeartNo2 = jot.First().HeartNo2;
|
||||
d.WeldSilkId = jot.First().WeldSilkId;
|
||||
@@ -750,14 +755,13 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
||||
}
|
||||
else
|
||||
{
|
||||
d.JointAttribute = att;
|
||||
if (att == "S")
|
||||
{
|
||||
d.JointAttribute = "活动S";
|
||||
d.JointArea = "S";
|
||||
}
|
||||
else
|
||||
{
|
||||
d.JointAttribute = "固定G";
|
||||
d.JointArea = "F";
|
||||
}
|
||||
}
|
||||
@@ -1014,14 +1018,71 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
||||
d.PipeAssembly2Id = com.ComponentsId;
|
||||
}
|
||||
}
|
||||
if (ds.Tables[0].Rows[i]["Coode1"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["Coode1"].ToString()))
|
||||
{
|
||||
var cood = coodeList.FirstOrDefault(x => x.Coode == ds.Tables[0].Rows[i]["Coode1"].ToString());
|
||||
if (cood == null)
|
||||
{
|
||||
errorInfos += "Coode1:[" + ds.Tables[0].Rows[i]["Coode1"].ToString() + "]不存在;";
|
||||
}
|
||||
else
|
||||
{
|
||||
d.Coode1 = cood.Coode;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errorInfos += (i + 2) + "行,Coode1不能为空!</br>";
|
||||
}
|
||||
if (ds.Tables[0].Rows[i]["Coode2"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["Coode2"].ToString()))
|
||||
{
|
||||
var cood = coodeList.FirstOrDefault(x => x.Coode == ds.Tables[0].Rows[i]["Coode2"].ToString());
|
||||
if (cood == null)
|
||||
{
|
||||
errorInfos += "Coode2:[" + ds.Tables[0].Rows[i]["Coode2"].ToString() + "]不存在;";
|
||||
}
|
||||
else
|
||||
{
|
||||
d.Coode1 = cood.Coode;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errorInfos += (i + 2) + "行,Coode2不能为空!</br>";
|
||||
}
|
||||
|
||||
if (ds.Tables[0].Rows[i]["炉批号1"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["炉批号1"].ToString()))
|
||||
{
|
||||
d.HeartNo1 = ds.Tables[0].Rows[i]["炉批号1"].ToString();
|
||||
var cood = coodeList.FirstOrDefault(x => x.Coode == d.Coode1 && x.HeartNo == ds.Tables[0].Rows[i]["炉批号1"].ToString());
|
||||
if (cood == null)
|
||||
{
|
||||
errorInfos += "炉批号1:[" + ds.Tables[0].Rows[i]["炉批号1"].ToString() + "]或对应的Coode1不存在;";
|
||||
}
|
||||
else
|
||||
{
|
||||
d.HeartNo1 = ds.Tables[0].Rows[i]["炉批号1"].ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errorInfos += (i + 2) + "行,炉批号1不能为空!</br>";
|
||||
}
|
||||
|
||||
if (ds.Tables[0].Rows[i]["炉批号2"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["炉批号2"].ToString()))
|
||||
{
|
||||
d.HeartNo2 = ds.Tables[0].Rows[i]["炉批号2"].ToString();
|
||||
var cood = coodeList.FirstOrDefault(x => x.Coode == d.Coode2 && x.HeartNo == ds.Tables[0].Rows[i]["炉批号2"].ToString());
|
||||
if (cood == null)
|
||||
{
|
||||
errorInfos += "炉批号2:[" + ds.Tables[0].Rows[i]["炉批号2"].ToString() + "]或对应的Coode2不存在;";
|
||||
}
|
||||
else
|
||||
{
|
||||
d.HeartNo2 = ds.Tables[0].Rows[i]["炉批号2"].ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errorInfos += (i + 2) + "行,炉批号2不能为空!</br>";
|
||||
}
|
||||
|
||||
//if (ds.Tables[0].Rows[i]["焊丝"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["焊丝"].ToString()))
|
||||
@@ -1237,12 +1298,55 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
||||
#endregion
|
||||
}
|
||||
|
||||
// 判断Coode数量
|
||||
string coodeNumError=string.Empty;
|
||||
var coode1Group = dayList.GroupBy(x => new { x.Coode1, x.HeartNo1 }).Select(g => new { Coode = g.Key.Coode1, HeartNo = g.Key.HeartNo1 });
|
||||
var coode2Group = dayList.GroupBy(x => new { x.Coode2, x.HeartNo2 }).Select(g => new { Coode = g.Key.Coode2, HeartNo = g.Key.HeartNo2 });
|
||||
var coodeListGroup= coode1Group.Union(coode2Group).Distinct();
|
||||
string[] jotList = dayList.Select(x => x.WeldJointId).ToArray();
|
||||
foreach (var c in coodeListGroup)
|
||||
{
|
||||
var coodeNum = from x in Funs.DB.Base_MaterialCoode
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.Coode == c.Coode && x.HeartNo == c.HeartNo
|
||||
select x;
|
||||
int daily1 = (from x in dayList where x.Coode1 == c.Coode && x.HeartNo1 == c.HeartNo select x).Count();
|
||||
int daily2 = (from x in dayList where x.Coode2== c.Coode && x.HeartNo2 == c.HeartNo select x).Count();
|
||||
int jotCoode1 = (from x in Funs.DB.Pipeline_WeldJoint
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.Coode1 == c.Coode && x.HeartNo1 == c.HeartNo
|
||||
&& !jotList.Contains(x.WeldJointId)
|
||||
select x).Count();
|
||||
int jotCoode2 = (from x in Funs.DB.Pipeline_WeldJoint
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.Coode2 == c.Coode && x.HeartNo2 == c.HeartNo
|
||||
&& !jotList.Contains(x.WeldJointId)
|
||||
select x).Count();
|
||||
if (coodeNum.Count() > 0 && coodeNum.First().Amount != null)
|
||||
{
|
||||
if (daily1 + daily2 + jotCoode1 + jotCoode2 > coodeNum.First().Amount.Value)
|
||||
{
|
||||
coodeNumError += "Coode:" + c.Coode + "对应的炉批号:" + c.HeartNo + "的数量已超出,";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (!string.IsNullOrEmpty(coodeNumError))
|
||||
{
|
||||
coodeNumError = coodeNumError + "请检查后再导入";
|
||||
}
|
||||
|
||||
// 数据验证错误,返回
|
||||
if (!string.IsNullOrEmpty(errorInfos))
|
||||
{
|
||||
ShowNotify(errorInfos, MessageBoxIcon.Warning, 10000);
|
||||
return;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(coodeNumError))
|
||||
{
|
||||
ShowNotify(coodeNumError, MessageBoxIcon.Warning, 10000);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 焊工资质符全条件
|
||||
@@ -1282,6 +1386,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
||||
newWeldJoint.WeldTypeId = item.WeldTypeId;
|
||||
newWeldJoint.JointAttribute = item.JointAttribute;
|
||||
newWeldJoint.WeldingLocationId = item.WeldingLocationId;
|
||||
|
||||
newWeldJoint.Size = item.Size;
|
||||
newWeldJoint.ANSISCH = item.ANSISCH;
|
||||
newWeldJoint.Dia = item.Dia;
|
||||
|
||||
Reference in New Issue
Block a user