提交代码

This commit is contained in:
2023-11-22 17:10:54 +08:00
parent a4006d57d9
commit aedd071d96
6 changed files with 358 additions and 120 deletions
+76 -65
View File
@@ -20,24 +20,24 @@ namespace BLL
/// <summary>
/// 工厂预制
/// </summary>
public const string PipeArea_SHOP="1";
public const string PipeArea_SHOP = "1";
/// <summary>
/// 现场安装
/// </summary>
public const string PipeArea_FIELD = "2";
public const string PipeArea_FIELD = "2";
public const int pageSize = 20;
public static List<Model.HJGL_Pipeline> hJGL_Pipelines
{
get;
set;
get;
set;
}
/// <summary>
/// 实际日期类型
/// </summary>
public enum ActDateType
public enum ActDateType
{
/// <summary>
/// 实际开始日期(预制)
@@ -46,16 +46,16 @@ namespace BLL
/// <summary>
/// 实际完成日期(预制)
/// </summary>
ActDateEnd_Shop ,
ActDateEnd_Shop,
/// <summary>
/// 实际开始日期(安装)
/// </summary>
ActDateStart_FIELD ,
ActDateStart_FIELD,
/// <summary>
/// 实际完成日期(安装)
/// </summary>
ActDateEnd_FIELD ,
}
ActDateEnd_FIELD,
}
/// <summary>
/// 管线划分
/// </summary>
@@ -67,7 +67,7 @@ namespace BLL
list[1] = new ListItem("现场安装", PipeArea_FIELD);
return list;
}
public static void RestPipelineAndJoints(string projectid )
public static void RestPipelineAndJoints(string projectid)
{
PipelineService.hJGL_Pipelines = PipelineService.GetPipelinesByProjectId(projectid);
WeldJointService.hJGL_WeldJoints = WeldJointService.GetWeldJointByProjectid(projectid);
@@ -92,7 +92,7 @@ namespace BLL
var PlanEndDate = mdoel.PlanEndDate;
var ActStartDate = new DateTime?();
var ActEndDate = new DateTime?();
if (!string .IsNullOrEmpty(GetDateByPipelineId(pipelineId, ActDateType.ActDateStart_FIELD)))
if (!string.IsNullOrEmpty(GetDateByPipelineId(pipelineId, ActDateType.ActDateStart_FIELD)))
{
ActStartDate = Convert.ToDateTime(GetDateByPipelineId(pipelineId, ActDateType.ActDateStart_FIELD));
}
@@ -100,22 +100,22 @@ namespace BLL
{
ActEndDate = Convert.ToDateTime(GetDateByPipelineId(pipelineId, ActDateType.ActDateEnd_FIELD));
}
if (PlanStartDate==null|| PlanEndDate==null)
if (PlanStartDate == null || PlanEndDate == null)
{
mdoel.State = 0;
UpdatePipeline(mdoel);
return;
}
if (ActStartDate==null&&DateTime.Compare(DateTime.Now,PlanStartDate.Value)<0)
if (ActStartDate == null && DateTime.Compare(DateTime.Now, PlanStartDate.Value) < 0)
{
mdoel.State = 0;
}
else if(ActStartDate == null && DateTime.Compare(DateTime.Now, PlanStartDate.Value) > 0)
else if (ActStartDate == null && DateTime.Compare(DateTime.Now, PlanStartDate.Value) > 0)
{
mdoel.State = 1;
}
else if (ActStartDate!=null && DateTime.Compare(ActStartDate.Value, PlanStartDate.Value)<0 && ActEndDate==null)
else if (ActStartDate != null && DateTime.Compare(ActStartDate.Value, PlanStartDate.Value) < 0 && ActEndDate == null)
{
mdoel.State = 2;
}
@@ -138,7 +138,7 @@ namespace BLL
/// <returns></returns>
public static string GetDateByPipelineId(object pipelineId, ActDateType actDateType)
{
string result ="";
string result = "";
string _pipelineId = pipelineId.ToString();
string ActDateStart_Shop = "";
string ActDateEnd_Shop = "";
@@ -149,15 +149,16 @@ namespace BLL
var joints = BLL.WeldJointService.GetWeldJointsByPipelineId(_pipelineId);
int joint_Shop_count = joints.Where(x => x.JointAttribute == "预制口").Count();
int joint_Field_count = joints.Where(x => x.JointAttribute == "安装口").Count();
var TaskJoints = (from x in Funs.DB.View_HJGL_WeldingTask where x.ProjectId == pipemodel.ProjectId && x.PipelineCode == pipemodel.PipelineCode && x.WeldingDailyId!=null
select x).ToList();
var TaskJoints = (from x in Funs.DB.View_HJGL_WeldingTask
where x.ProjectId == pipemodel.ProjectId && x.PipelineCode == pipemodel.PipelineCode && x.WeldingDailyId != null
select x).ToList();
var TaskJoints_Shop = TaskJoints.Where(x => x.JointAttribute == "预制口").ToList();
var TaskJoints_Field= TaskJoints.Where(x => x.JointAttribute == "安装口").ToList();
if (TaskJoints_Shop.Count>0)
var TaskJoints_Field = TaskJoints.Where(x => x.JointAttribute == "安装口").ToList();
if (TaskJoints_Shop.Count > 0)
{
ActDateStart_Shop = TaskJoints_Shop.OrderBy(x => x.TaskDate).First().TaskDate.Value.ToShortDateString();
}
if (joint_Shop_count== TaskJoints_Shop.Count&& joint_Shop_count>0)
if (joint_Shop_count == TaskJoints_Shop.Count && joint_Shop_count > 0)
{
ActDateEnd_Shop = TaskJoints_Shop.OrderByDescending(x => x.TaskDate).First().TaskDate.Value.Date.ToShortDateString();
}
@@ -194,14 +195,14 @@ namespace BLL
/// <param name="WeldJointId"></param>
public static void UpdataDateByWeldJointId(string WeldJointId)
{
DateTime ? ActDateStart_FIELD = new DateTime();
DateTime ? ActDateEnd_FIELD = new DateTime();
DateTime? ActDateStart_FIELD = new DateTime();
DateTime? ActDateEnd_FIELD = new DateTime();
string JointAttribute = "";
var model_joint=BLL.WeldJointService.GetWeldJointByWeldJointId(WeldJointId);
if (model_joint!=null)
var model_joint = BLL.WeldJointService.GetWeldJointByWeldJointId(WeldJointId);
if (model_joint != null)
{
JointAttribute = model_joint.JointAttribute;
var model_pipeline = GetPipelineByPipelineId(model_joint.PipelineId);
@@ -211,7 +212,7 @@ namespace BLL
select x).ToList();
switch (JointAttribute)
{
case "安装口":
int joint_Field_count = joints.Where(x => x.JointAttribute == "安装口").Count();
var TaskJoints_Field = TaskJoints.Where(x => x.JointAttribute == "安装口").ToList();
@@ -231,8 +232,8 @@ namespace BLL
break;
}
}
}
}
/// <summary>
/// 根据管线code获取管线信息
@@ -251,8 +252,8 @@ namespace BLL
public static List<HJGL_Pipeline> GetHJGL_PipelineList(HJGL_Pipeline model)
{
var db = Funs.DB;
var pipelineList =( from x in Funs.DB.HJGL_Pipeline
where
var pipelineList = (from x in Funs.DB.HJGL_Pipeline
where
(string.IsNullOrEmpty(model.ProjectId) || x.ProjectId.Contains(model.ProjectId))
&& (string.IsNullOrEmpty(model.UnitWorkId) || x.UnitWorkId.Contains(model.UnitWorkId))
&& (string.IsNullOrEmpty(model.PipelineCode) || x.PipelineCode.Contains(model.PipelineCode))
@@ -260,15 +261,15 @@ namespace BLL
&& (string.IsNullOrEmpty(model.DesignPress) || x.DesignPress.Contains(model.DesignPress))
/* && (string.IsNullOrEmpty(model.MaterialCode) || x.MaterialCode.Contains(model.MaterialCode))*/
select x).ToList();
if (model.IsFinished!=null)
if (model.IsFinished != null)
{
if (model.IsFinished==true)
if (model.IsFinished == true)
{
pipelineList= pipelineList.Where(x => x.IsFinished == true).ToList();
pipelineList = pipelineList.Where(x => x.IsFinished == true).ToList();
}
else
{
pipelineList = pipelineList.Where(x => x.IsFinished == false||x.IsFinished==null).ToList();
pipelineList = pipelineList.Where(x => x.IsFinished == false || x.IsFinished == null).ToList();
}
@@ -338,16 +339,17 @@ namespace BLL
/// </summary>
/// <param name="unitworkId"></param>
/// <returns></returns>
public static List<string> GetNoComPipelinesByUnitWordId(string unitworkId)
public static List<string> GetNoComPipelinesByUnitWordId(string unitworkId)
{
var q = (from x in Funs.DB.View_HJGL_WeldJoint
where x.UnitWorkId == unitworkId
select new {
PipelineId=x.PipelineId,
WeldingDate=x.WeldingDate,
PipelineCode=x.PipelineCode
where x.UnitWorkId == unitworkId
select new
{
PipelineId = x.PipelineId,
WeldingDate = x.WeldingDate,
PipelineCode = x.PipelineCode
}).Distinct();
if (q.Count()==0)
if (q.Count() == 0)
{
return new List<string>();
}
@@ -359,10 +361,10 @@ namespace BLL
Count = (from x2 in g where x2.WeldingDate != null && x2.WeldingDate != "" select x2).Count(),
};
var NowComPipelineCode = (from x in q
join y in noCompipeline on x.PipelineId equals y.PipelineId
where y.Count == 0
select x.PipelineCode
).Distinct(). ToList();
join y in noCompipeline on x.PipelineId equals y.PipelineId
where y.Count == 0
select x.PipelineCode
).Distinct().ToList();
return NowComPipelineCode;
}
/// <summary>
@@ -370,7 +372,7 @@ namespace BLL
/// </summary>
/// <param name="projectid"></param>
/// <param name="unitworkid"></param>
public static void DownPipeArea_SHOPFile(string projectid,string unitworkid)
public static void DownPipeArea_SHOPFile(string projectid, string unitworkid)
{
string templatePath = Funs.RootPath + @"File\Excel\DataOut\WeldingPlanDataOut_SHOP.xlsx";
string path = Funs.RootPath + @"File\Excel\DataOut\WeldingPlanDataOut_SHOP.xlsx";
@@ -442,7 +444,7 @@ namespace BLL
["Data"] = tb,
};
MiniExcel.SaveAsByTemplate(path, templatePath, value);
HJGL_DataImportService.DownFile(path.Replace(Funs.RootPath,"") , "焊接施工计划(预制).xlsx");
HJGL_DataImportService.DownFile(path.Replace(Funs.RootPath, ""), "焊接施工计划(预制).xlsx");
File.Delete(path);
}
/// <summary>
@@ -451,7 +453,7 @@ namespace BLL
/// <param name="projectid"></param>
/// <param name="unitworkid"></param>
public static void DownPipeArea_FIELDFile(string projectid, string unitworkid)
{
{
string templatePath = Funs.RootPath + @"File\Excel\DataOut\WeldingPlanDataOut2.xlsx";
string path = Funs.RootPath + @"File\Excel\DataOut\WeldingPlanDataOut2.xlsx";
path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd-HH-mm}", DateTime.Now) + ".xlsx");
@@ -555,10 +557,10 @@ namespace BLL
q = Funs.DB.HJGL_Pipeline.FirstOrDefault(x => x.PipelineCode == pipelineCode && x.UnitWorkId == unitWorkId);
return q;
}
/// <summary>
/// 添加管线信息
/// </summary>
/// <param name="pipeline"></param>
/// <summary>
/// 添加管线信息
/// </summary>
/// <param name="pipeline"></param>
public static void AddPipeline(Model.HJGL_Pipeline pipeline)
{
Model.SGGLDB db = Funs.DB;
@@ -589,7 +591,7 @@ namespace BLL
newPipeline.PCtype = pipeline.PCtype;
newPipeline.MaterialId = pipeline.MaterialId;
newPipeline.State = pipeline.State;
newPipeline.FlowingSection=pipeline.FlowingSection;
newPipeline.FlowingSection = pipeline.FlowingSection;
db.HJGL_Pipeline.InsertOnSubmit(newPipeline);
db.SubmitChanges();
}
@@ -755,7 +757,7 @@ namespace BLL
}
}
public static void BindTreeNodes(FineUIPro.TreeNode node,string pipecode,string ProjectId,int pageSize)
public static void BindTreeNodes(FineUIPro.TreeNode node, string pipecode, string ProjectId, int pageSize)
{
var pipeline = (from x in Funs.DB.HJGL_Pipeline
where x.ProjectId == ProjectId && x.UnitWorkId == node.NodeID
@@ -798,7 +800,7 @@ namespace BLL
/// <param name="MaterialCode"></param>
/// <param name="ProjectId"></param>
/// <param name="pageSize"></param>
public static void BindTreeNodes(FineUIPro.TreeNode node, string pipecode,string MaterialCode, string ProjectId, int pageSize)
public static void BindTreeNodes(FineUIPro.TreeNode node, string pipecode, string MaterialCode, string ProjectId, int pageSize)
{
//var pipeline = (from x in Funs.DB.HJGL_Pipeline
// where x.ProjectId == ProjectId && x.UnitWorkId == node.NodeID
@@ -806,8 +808,8 @@ namespace BLL
// orderby x.PipelineCode
// select x).ToList();
var pipeline = (from x in Funs.DB.HJGL_Pipeline
join y in Funs.DB.HJGL_PipeLineMat.Where(m => m.MaterialCode.Contains(MaterialCode)) on x.PipelineId equals y.PipelineId
where x.ProjectId == ProjectId && x.UnitWorkId == node.NodeID && x.PipelineCode.Contains(pipecode)
join y in Funs.DB.HJGL_PipeLineMat.Where(m => m.MaterialCode.Contains(MaterialCode)) on x.PipelineId equals y.PipelineId
where x.ProjectId == ProjectId && x.UnitWorkId == node.NodeID && x.PipelineCode.Contains(pipecode)
select x).Distinct().ToList();
var hJGL_WeldJoints = (from x in Funs.DB.HJGL_WeldJoint where x.ProjectId == ProjectId select x).ToList();
int pageindex = int.Parse(node.CommandName.Split('|')[0]);
@@ -837,23 +839,28 @@ namespace BLL
}
}
}
public static void BindTreeNodes(FineUIPro.TreeNode node,bool isExitWPQId, string pipecode, string ProjectId, int pageSize)
public static void BindTreeNodes(FineUIPro.TreeNode node, bool isExitWPQId, string pipecode, string ProjectId, int pageSize, string pipeArea)
{
string pipeAreasql = string.Empty;
if (pipeArea != BLL.Const._Null)
{
pipeAreasql += " AND PipeArea='" + pipeArea + "'";
}
if (isExitWPQId)
{
string strSql = "SELECT distinct PipelineId, PipelineCode FROM View_HJGL_WeldJoint WHERE IsTwoJoint IS NULL AND UnitWorkId =@UnitWorkId AND WPQId IS NULL order by PipelineCode";
string strSql = "SELECT distinct PipelineId, PipelineCode FROM View_HJGL_WeldJoint WHERE IsTwoJoint IS NULL AND UnitWorkId =@UnitWorkId AND WPQId IS NULL" + pipeAreasql + " order by PipelineCode";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@UnitWorkId", node.NodeID));
if (!string .IsNullOrEmpty(pipecode))
if (!string.IsNullOrEmpty(pipecode))
{
strSql += " and PipelineCode=@PipelineCode ";
listStr.Add(new SqlParameter("@PipelineCode", ""+ pipecode + ""));
listStr.Add(new SqlParameter("@PipelineCode", "" + pipecode + ""));
}
SqlParameter[] parameter = listStr.ToArray();
System.Data.DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
var pipeline = Funs.TableToEntity<Model.PipeLineIdCodeItem>(dt);
var hJGL_WeldJoints = (from x in Funs.DB.HJGL_WeldJoint where x.ProjectId == ProjectId select x).ToList();
int pageindex = int.Parse(node.CommandName.Split('|')[0]);
int pageCount = int.Parse(node.CommandName.Split('|')[1]);
@@ -890,6 +897,10 @@ namespace BLL
&& x.PipelineCode.Contains(pipecode)
orderby x.PipelineCode
select x).ToList();
if (pipeArea != BLL.Const._Null)
{
pipeline = pipeline.Where(x => x.PipeArea == pipeArea).ToList();
}
var hJGL_WeldJoints = (from x in Funs.DB.HJGL_WeldJoint where x.ProjectId == ProjectId select x).ToList();
int pageindex = int.Parse(node.CommandName.Split('|')[0]);
int pageCount = int.Parse(node.CommandName.Split('|')[1]);