2023-02-20 001 焊接修改

This commit is contained in:
2023-02-20 10:49:51 +08:00
parent 7e66339f48
commit ef6bbc170e
37 changed files with 1649 additions and 306 deletions
+1
View File
@@ -372,6 +372,7 @@
<Compile Include="HJGL\TestPackage\TestPackageApproveService.cs" />
<Compile Include="HJGL\TestPackage\TestPackageAuditService.cs" />
<Compile Include="HJGL\TestPackage\TestPackageEditService.cs" />
<Compile Include="HJGL\WeldingManage\HJGL_ComponentJointService.cs" />
<Compile Include="HJGL\WeldingManage\HJGL_WeldingReportService.cs" />
<Compile Include="HJGL\WeldingManage\PipelineComponentService.cs" />
<Compile Include="HJGL\WeldingManage\PipelineMatService.cs" />
+13 -9
View File
@@ -104,15 +104,19 @@ namespace BLL
{
string url = Funs.RootPath + filePah.Replace('/', '\\');
FileInfo info = new FileInfo(url);
long fileSize = info.Length;
System.Web.HttpContext.Current.Response.BufferOutput = true;
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
System.Web.HttpContext.Current.Response.TransmitFile(url, 0, fileSize);
System.Web.HttpContext.Current.Response.Flush();
System.Web.HttpContext.Current.Response.Close();
if (info.Exists)
{
long fileSize = info.Length;
System.Web.HttpContext.Current.Response.BufferOutput = true;
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
System.Web.HttpContext.Current.Response.TransmitFile(url, 0, fileSize);
System.Web.HttpContext.Current.Response.Flush();
System.Web.HttpContext.Current.Response.Close();
}
}
catch (System.Exception ex)
{
+108 -38
View File
@@ -108,23 +108,57 @@ namespace BLL
/// <returns></returns>
public static DataTable GetSHOPStockDt( string projectid)
{
string strSql = @" select
mat.MaterialCode,
lib.MaterialName,
lib.MaterialSpec,
lib.MaterialUnit,
sum( mat.Num)+ISNULL( aa.Num,0) as MaterialNum
from HJGL_MaterialManage mat
left join HJGL_MaterialCodeLib lib on mat.MaterialCode=lib.MaterialCode
left join (SELECT lib.MaterialCode,lib.MaterialName,lib.MaterialUnit,
lib.MaterialSpec,lib.MaterialMade,-sum( pipe.Number) as num
FROM dbo.HJGL_PipeLineMat pipe
LEFT JOIN dbo.HJGL_MaterialCodeLib lib ON lib.MaterialCode = pipe.MaterialCode
LEFT JOIN HJGL_Pipeline line ON pipe.PipelineId=line.PipelineId
WHERE line.PipeArea=@PipeArea and line.State=1
group by lib.MaterialCode,lib.MaterialName,lib.MaterialUnit, lib.MaterialSpec,lib.MaterialMade) as aa on mat.MaterialCode=aa.MaterialCode
where mat.projectid=@projectid
group by mat.MaterialCode,lib.MaterialName,lib.MaterialSpec,lib.MaterialMade,lib.MaterialUnit,aa.num
string strSql = @" SELECT mat.MaterialCode,
lib.MaterialName,
lib.MaterialSpec,
lib.MaterialUnit,
sum( mat.Num)+ISNULL( aa.Num,
0) AS MaterialNum
FROM HJGL_MaterialManage mat
LEFT JOIN HJGL_MaterialCodeLib lib
ON mat.MaterialCode=lib.MaterialCode
LEFT JOIN
(SELECT stockused.MaterialCode,
stockused.MaterialName,
stockused.MaterialUnit,
stockused.MaterialSpec,
stockused.MaterialMade,
-sum( stockused.num) AS num
FROM
(SELECT lib.MaterialCode,
lib.MaterialName,
lib.MaterialUnit,
lib.MaterialSpec,
lib.MaterialMade,
-sum( pipe.Number) AS num
FROM dbo.HJGL_PipeLineMat pipe
LEFT JOIN HJGL_Pipeline_ComponentJoint comjoint
ON comjoint.PipelineComponentCode =pipe.PrefabricatedComponents
LEFT JOIN HJGL_MaterialCodeLib lib
ON lib.MaterialCode = pipe.MaterialCode
WHERE comjoint.State=1
GROUP BY lib.MaterialCode,lib.MaterialName,lib.MaterialUnit, lib.MaterialSpec,lib.MaterialMade
UNION
SELECT lib.MaterialCode,
lib.MaterialName,
lib.MaterialUnit,
lib.MaterialSpec,
lib.MaterialMade,
-sum( pipe.Number) AS num
FROM dbo.HJGL_PipeLineMat pipe
LEFT JOIN HJGL_MaterialCodeLib lib
ON lib.MaterialCode = pipe.MaterialCode
LEFT JOIN HJGL_Pipeline line
ON pipe.PipelineId=line.PipelineId
LEFT JOIN View_HJGL_WeldJoint weldjoint
ON weldjoint.PipelineId=line.PipelineId
WHERE weldjoint.JointAttribute='安装口'
AND weldjoint .WeldingDailyId !=''
GROUP BY lib.MaterialCode,lib.MaterialName,lib.MaterialUnit, lib.MaterialSpec,lib.MaterialMade ) AS stockused
GROUP BY stockused.MaterialCode,stockused.MaterialName,stockused.MaterialUnit,stockused.MaterialSpec,stockused.MaterialMade ) AS aa
ON mat.MaterialCode=aa.MaterialCode
WHERE mat.projectid=@projectid
GROUP BY mat.MaterialCode,lib.MaterialName,lib.MaterialSpec,lib.MaterialMade,lib.MaterialUnit,aa.num
";
List<SqlParameter> listStr = new List<SqlParameter>();
@@ -136,26 +170,61 @@ namespace BLL
}
public static DataTable GetFIELDStockDt(string projectid)
{
string strSql = @" select
mat.MaterialCode,
string strSql = @"
SELECT mat.MaterialCode,
lib.MaterialName,
lib.MaterialSpec,
lib.MaterialUnit,
sum( mat.Num)+ISNULL( aa.Num,
0) AS MaterialNum
FROM Material_Material mat
LEFT JOIN HJGL_MaterialCodeLib lib
ON mat.MaterialCode=lib.MaterialCode
LEFT JOIN Material_Inspection Ins
ON mat.InspectionId=Ins.InspectionId
LEFT JOIN
(SELECT stockused.MaterialCode,
stockused.MaterialName,
stockused.MaterialUnit,
stockused.MaterialSpec,
stockused.MaterialMade,
-sum( stockused.num) AS num
FROM
(SELECT lib.MaterialCode,
lib.MaterialName,
lib.MaterialSpec,
lib.MaterialUnit,
sum( mat.Num)+ISNULL( aa.Num,0) as MaterialNum
from Material_Material mat
left join HJGL_MaterialCodeLib lib on mat.MaterialCode=lib.MaterialCode
left join Material_Inspection Ins on mat.InspectionId=Ins.InspectionId
left join (SELECT lib.MaterialCode,lib.MaterialName,lib.MaterialUnit,
lib.MaterialSpec,lib.MaterialMade,-sum( pipe.Number) as num
FROM dbo.HJGL_PipeLineMat pipe
LEFT JOIN dbo.HJGL_MaterialCodeLib lib ON lib.MaterialCode = pipe.MaterialCode
LEFT JOIN HJGL_Pipeline line ON pipe.PipelineId=line.PipelineId
WHERE line.PipeArea=@PipeArea
group by lib.MaterialCode,lib.MaterialName,lib.MaterialUnit, lib.MaterialSpec,lib.MaterialMade) as aa on mat.MaterialCode=aa.MaterialCode
where mat.projectid=@Projectid and Ins.State=@State
group by mat.MaterialCode,lib.MaterialName,lib.MaterialSpec,lib.MaterialMade,lib.MaterialUnit,aa.num
";
lib.MaterialSpec,
lib.MaterialMade,
-sum( pipe.Number) AS num
FROM dbo.HJGL_PipeLineMat pipe
LEFT JOIN HJGL_Pipeline_ComponentJoint comjoint
ON comjoint.PipelineComponentCode =pipe.PrefabricatedComponents
LEFT JOIN HJGL_MaterialCodeLib lib
ON lib.MaterialCode = pipe.MaterialCode
WHERE comjoint.State=1
GROUP BY lib.MaterialCode,lib.MaterialName,lib.MaterialUnit, lib.MaterialSpec,lib.MaterialMade
UNION
SELECT lib.MaterialCode,
lib.MaterialName,
lib.MaterialUnit,
lib.MaterialSpec,
lib.MaterialMade,
-sum( pipe.Number) AS num
FROM dbo.HJGL_PipeLineMat pipe
LEFT JOIN HJGL_MaterialCodeLib lib
ON lib.MaterialCode = pipe.MaterialCode
LEFT JOIN HJGL_Pipeline line
ON pipe.PipelineId=line.PipelineId
LEFT JOIN View_HJGL_WeldJoint weldjoint
ON weldjoint.PipelineId=line.PipelineId
WHERE weldjoint.JointAttribute='安装口'
AND weldjoint .WeldingDailyId !=''
GROUP BY lib.MaterialCode,lib.MaterialName,lib.MaterialUnit, lib.MaterialSpec,lib.MaterialMade ) AS stockused
GROUP BY stockused.MaterialCode,stockused.MaterialName,stockused.MaterialUnit,stockused.MaterialSpec,stockused.MaterialMade ) AS aa
ON mat.MaterialCode=aa.MaterialCode
WHERE mat.projectid=@Projectid
AND Ins.State=@State
GROUP BY mat.MaterialCode,lib.MaterialName,lib.MaterialSpec,lib.MaterialMade,lib.MaterialUnit,aa.num ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@Projectid", projectid));
listStr.Add(new SqlParameter("@PipeArea", BLL.PipelineService.PipeArea_SHOP));
@@ -284,12 +353,13 @@ namespace BLL
if ((decimal)item.Number > StockNum) //实际大于库存
{
state = false; //库存不足
return state;
}
}
else
{
state = false; //库存不足
return state;
}
}
@@ -297,14 +367,14 @@ namespace BLL
else
{
state = false; //库存不足
return state;
}
}
else
{
state = false; //库存不足
return state;
}
}
@@ -0,0 +1,193 @@
using FineUIPro;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public static class HJGL_PipelineComponentjointService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
public static List<Model.HJGL_Pipeline_ComponentJoint> GetHJGL_Pipeline_ComponentJointByModle(Model.HJGL_Pipeline_ComponentJoint table)
{
var q = from x in db.HJGL_Pipeline_ComponentJoint
where
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
(string.IsNullOrEmpty(table.PipelineComponentId) || x.PipelineComponentId.Contains(table.PipelineComponentId)) &&
(string.IsNullOrEmpty(table.PipelineComponentCode) || x.PipelineComponentCode.Contains(table.PipelineComponentCode)) &&
(string.IsNullOrEmpty(table.WeldJointId) || x.WeldJointId.Contains(table.WeldJointId)) &&
(string.IsNullOrEmpty(table.WeldJointCode) || x.WeldJointCode.Contains(table.WeldJointCode))
select x
;
return q.ToList();
}
/// 获取分页列表
/// </summary>
/// <param name="PageIndex">页码</param>
/// <param name="PageSize">每页数量</param>
/// <returns></returns>
public static IEnumerable getListData(Model.HJGL_Pipeline_ComponentJoint table, Grid Grid1)
{
var q = GetHJGL_Pipeline_ComponentJointByModle(table);
count = q.Count();
if (count == 0)
{
return null;
}
// q= q.Take(Grid1.PageSize * Grid1.PageIndex).Skip(Grid1.PageSize * (Grid1.PageIndex)).ToList();
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in q
select new
{
x.Id,
x.PipelineComponentId,
x.PipelineComponentCode,
x.WeldJointId,
x.WeldJointCode,
x.State,
};
}
#endregion
public static Model.HJGL_Pipeline_ComponentJoint GetHJGL_Pipeline_ComponentJointById(string Id)
{
return db.HJGL_Pipeline_ComponentJoint.FirstOrDefault(x => x.Id == Id);
}
public static Model.HJGL_Pipeline_ComponentJoint GetHJGL_Pipeline_ComponentJointByWeldJointId(string WeldJointId)
{
return db.HJGL_Pipeline_ComponentJoint.FirstOrDefault(x => x.WeldJointId == WeldJointId);
}
public static void AddHJGL_Pipeline_ComponentJoint(Model.HJGL_Pipeline_ComponentJoint newtable)
{
Model.HJGL_Pipeline_ComponentJoint table = new Model.HJGL_Pipeline_ComponentJoint
{
Id = newtable.Id,
PipelineComponentId = newtable.PipelineComponentId,
PipelineComponentCode = newtable.PipelineComponentCode,
WeldJointId = newtable.WeldJointId,
WeldJointCode = newtable.WeldJointCode,
State = newtable.State,
};
db.HJGL_Pipeline_ComponentJoint.InsertOnSubmit(table);
db.SubmitChanges();
}
public static void AddBulkHJGL_Pipeline_ComponentJoint(List<Model.HJGL_Pipeline_ComponentJoint> newtables)
{
db.HJGL_Pipeline_ComponentJoint.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
public static void UpdateHJGL_Pipeline_ComponentJoint(Model.HJGL_Pipeline_ComponentJoint newtable)
{
Model.HJGL_Pipeline_ComponentJoint table = db.HJGL_Pipeline_ComponentJoint.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.PipelineComponentId = newtable.PipelineComponentId;
table.PipelineComponentCode = newtable.PipelineComponentCode;
table.WeldJointId = newtable.WeldJointId;
table.WeldJointCode = newtable.WeldJointCode;
table.State = newtable.State;
db.SubmitChanges();
}
}
/// <summary>
/// 根据焊口号更改状态
/// </summary>
/// <param name="WeldJointId"></param>
public static void UpdateStateByWeldJointId(string WeldJointId,DateTime TaskDate)
{
Model.HJGL_Pipeline_ComponentJoint table = db.HJGL_Pipeline_ComponentJoint.FirstOrDefault(x => x.WeldJointId == WeldJointId);
if (table != null)
{
table.State =1;
db.SubmitChanges();
GetProductionByPipelineComponentId(table.PipelineComponentId, TaskDate);
}
}
public static void GetProductionByPipelineComponentId(string PipelineComponentId, DateTime TaskDate)
{
var q = db.HJGL_Pipeline_ComponentJoint.Where(x => x.PipelineComponentId == PipelineComponentId).ToList();
if (q.Count!=0)
{
var NotProductionNum = (from x in q where x.State == 0 select x).Count(); //未生产数量
var ProductionNum = (from x in q where x.State == 1 select x).Count(); //已生产数量
if (NotProductionNum == 0) //全部完成
{
HJGL_PipelineComponentService.UpdateProductionState(PipelineComponentId, 2, TaskDate);
}
else if (ProductionNum == 0)//未动工
{
HJGL_PipelineComponentService.UpdateProductionState(PipelineComponentId, 0, TaskDate);
}
else //已生产
{
HJGL_PipelineComponentService.UpdateProductionState(PipelineComponentId, 1, TaskDate);
}
}
}
public static void DeleteHJGL_Pipeline_ComponentJointById(string Id)
{
Model.HJGL_Pipeline_ComponentJoint table = db.HJGL_Pipeline_ComponentJoint.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
db.HJGL_Pipeline_ComponentJoint.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
public static void DeleteHJGL_Pipeline_ComponentJointByPipelineComponentId(string PipelineComponentId)
{
var table = db.HJGL_Pipeline_ComponentJoint.Where(x => x.PipelineComponentId == PipelineComponentId);
if (table != null)
{
db.HJGL_Pipeline_ComponentJoint.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
}
public static void DeleteALLHJGL_Pipeline_ComponentJoint()
{
if (db.HJGL_Pipeline_ComponentJoint != null)
{
db.HJGL_Pipeline_ComponentJoint.DeleteAllOnSubmit(db.HJGL_Pipeline_ComponentJoint);
db.SubmitChanges();
}
}
}
}
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI.WebControls;
@@ -18,6 +19,8 @@ namespace BLL
/// 已装箱
/// </summary>
public static int state_2 = 2;
public static ListItem[] GetState()
{
ListItem[] list = new ListItem[3];
@@ -26,6 +29,14 @@ namespace BLL
list[2] = new ListItem("已出库", state_2.ToString());
return list;
}
public static ListItem[] GetProductionState()
{
ListItem[] list = new ListItem[3];
list[0] = new ListItem("未开始", "0");
list[1] = new ListItem("已开始", "1");
list[2] = new ListItem("已完成", "2");
return list;
}
/// <summary>
/// 根据ID获取组件信息
/// </summary>
@@ -95,6 +106,7 @@ namespace BLL
model.PipelineComponentCode = model_mat.PrefabricatedComponents;
model.DrawingName = model_mat.PrefabricatedComponents.Substring(0, model_mat.PrefabricatedComponents.LastIndexOf('-')).Replace("\"", "");
model.State = state_0;
model.ProductionState = 0;
UpdatePipelineComponent(model);
}
else
@@ -105,6 +117,7 @@ namespace BLL
model.PipelineComponentCode = model_mat.PrefabricatedComponents;
model.DrawingName = model_mat.PrefabricatedComponents.Substring(0, model_mat.PrefabricatedComponents.LastIndexOf('-')).Replace("\"", "");
model.State = state_0;
model.ProductionState = 0;
AddPipelineComponent(model);
}
@@ -135,6 +148,7 @@ namespace BLL
newPipeline.DrawingName = pipeline.DrawingName;
newPipeline.ReceiveMan= pipeline.ReceiveMan;
newPipeline.ReceiveDate= pipeline.ReceiveDate;
newPipeline.ProductionState= pipeline.ProductionState;
db.HJGL_Pipeline_Component.InsertOnSubmit(newPipeline);
db.SubmitChanges();
}
@@ -164,6 +178,7 @@ namespace BLL
newPipeline.DrawingName = pipeline.DrawingName;
newPipeline.ReceiveMan = pipeline.ReceiveMan;
newPipeline.ReceiveDate = pipeline.ReceiveDate;
newPipeline.ProductionState = pipeline.ProductionState;
db.SubmitChanges();
}
@@ -179,6 +194,40 @@ namespace BLL
}
}
/// <summary>
/// 修改生产状态
/// </summary>
/// <param name="pipelineComponentId"></param>
/// <param name="BoxNumber"></param>
public static void UpdateProductionState(string pipelineComponentId, int state, DateTime TaskDate)
{
var q = GetPipelineComponentById(pipelineComponentId);
if (q!=null)
{
q.ProductionState = state;
if (state==2)
{
q.ActEndDate = TaskDate;
}
else if(state==1)
{
if (q.ActStartDate ==null)
{
q.ActStartDate = TaskDate;
}
else
{
if (DateTime.Compare(TaskDate,q.ActStartDate.Value) < 0)
{
q.ActStartDate = TaskDate;
}
}
}
UpdatePipelineComponent(q);
}
}
/// <summary>
/// 根据作业管线Id删除一个作业管线信息
@@ -275,5 +324,16 @@ namespace BLL
Funs.FineUIPleaseSelect(dropName);
}
}
public static void InitMainItemDownProductionStateList(FineUIPro.DropDownList dropName, bool isShowPlease)
{
dropName.DataValueField = "Value";
dropName.DataTextField = "Text";
dropName.DataSource = GetProductionState();
dropName.DataBind();
if (isShowPlease)
{
Funs.FineUIPleaseSelect(dropName);
}
}
}
}
+126 -18
View File
@@ -55,6 +55,10 @@ namespace BLL
/// </summary>
ActDateEnd_FIELD ,
}
/// <summary>
/// 管线划分
/// </summary>
/// <returns></returns>
public static ListItem[] GetPipeArea()
{
ListItem[] list = new ListItem[2];
@@ -76,6 +80,10 @@ namespace BLL
{
return Funs.DB.HJGL_Pipeline.FirstOrDefault(e => e.PipelineId == pipelineId);
}
/// <summary>
/// 根据管线id获取管线状态
/// </summary>
/// <param name="pipelineId"></param>
public static void GetStateByPipelineId(string pipelineId)
{
var mdoel = GetPipelineByPipelineId(pipelineId);
@@ -91,6 +99,13 @@ namespace BLL
{
ActEndDate = Convert.ToDateTime(GetDateByPipelineId(pipelineId, ActDateType.ActDateEnd_FIELD));
}
if (PlanStartDate==null|| PlanEndDate==null)
{
mdoel.State = 0;
UpdatePipeline(mdoel);
return;
}
if (ActStartDate==null&&DateTime.Compare(DateTime.Now,PlanStartDate.Value)<0)
{
mdoel.State = 0;
@@ -114,6 +129,12 @@ namespace BLL
UpdatePipeline(mdoel);
}
/// <summary>
/// 根据管线id获取实际开始,实际完成日期
/// </summary>
/// <param name="pipelineId"></param>
/// <param name="actDateType"></param>
/// <returns></returns>
public static string GetDateByPipelineId(object pipelineId, ActDateType actDateType)
{
string result ="";
@@ -127,7 +148,7 @@ 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
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();
@@ -165,10 +186,66 @@ namespace BLL
return result;
}
/// <summary>
/// 根据焊口更改管线和组件(预制)的实际开始日期和完成日期
/// </summary>
/// <param name="WeldJointId"></param>
public static void UpdataDateByWeldJointId(string WeldJointId)
{
DateTime ActDateStart_FIELD = new DateTime();
DateTime ActDateEnd_FIELD = new DateTime();
string JointAttribute = "";
var model_joint=BLL.WeldJointService.GetWeldJointByWeldJointId(WeldJointId);
if (model_joint!=null)
{
JointAttribute = model_joint.JointAttribute;
var model_pipeline = GetPipelineByPipelineId(model_joint.PipelineId);
var joints = BLL.WeldJointService.GetWeldJointsByPipelineId(model_joint.PipelineId);
var TaskJoints = (from x in Funs.DB.View_HJGL_WeldingTask
where x.ProjectId == model_pipeline.ProjectId && x.PipelineCode == model_pipeline.PipelineCode && x.WeldingDailyId != null
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();
if (TaskJoints_Field.Count > 0)
{
ActDateStart_FIELD = TaskJoints_Field.OrderBy(x => x.TaskDate).First().TaskDate.Value;
}
if (joint_Field_count == TaskJoints_Field.Count && joint_Field_count > 0)
{
ActDateEnd_FIELD = TaskJoints_Field.OrderByDescending(x => x.TaskDate).First().TaskDate.Value;
}
model_pipeline.ActStartDate = ActDateStart_FIELD;
model_pipeline.ActEndDate = ActDateEnd_FIELD;
UpdatePipeline(model_pipeline);
break;
}
}
}
/// <summary>
/// 根据管线code获取管线信息
/// </summary>
/// <param name="pipelineCode"></param>
/// <returns></returns>
public static Model.HJGL_Pipeline GetPipelineByPipelineCode(string pipelineCode)
{
return Funs.DB.HJGL_Pipeline.FirstOrDefault(e => e.PipelineCode == pipelineCode);
}
/// <summary>
/// 根据管线信息筛选管线
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public static List<HJGL_Pipeline> GetView_HJGL_Pipelines(HJGL_Pipeline model)
{
var db = Funs.DB;
@@ -228,6 +305,38 @@ namespace BLL
return Funs.DB.View_HJGL_Pipeline.FirstOrDefault(e => e.PipelineId == pipelineId);
}
/// <summary>
/// 根据主项id获取未完成管线
/// </summary>
/// <param name="unitworkId"></param>
/// <returns></returns>
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
}).Distinct();
if (q.Count()==0)
{
return new List<string>();
}
var noCompipeline = from x in q
group x by x.PipelineId into g
select new
{
PipelineId = g.Key,
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();
return NowComPipelineCode;
}
/// <summary>
/// 下载预制口管线导入模板
/// </summary>
/// <param name="projectid"></param>
@@ -377,7 +486,7 @@ namespace BLL
}
/// <summary>
/// 根据管线Code获取管线信息
/// 根据管线code查询管线是否存在
/// </summary>
/// <param name="isoNo"></param>
/// <returns></returns>
@@ -404,20 +513,12 @@ namespace BLL
}
}
public static bool IsExistPipelineCode(string pipelineCode, string unitWorkId)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_Pipeline q = null;
q = Funs.DB.HJGL_Pipeline.FirstOrDefault(x => x.PipelineCode == pipelineCode && x.UnitWorkId == unitWorkId);
if (q != null)
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 根据管线code获取管线信息
/// </summary>
/// <param name="pipelineCode">管线号</param>
/// <param name="unitWorkId">主项id</param>
/// <returns></returns>
public static HJGL_Pipeline GetPipelineByCode(string pipelineCode, string unitWorkId)
{
Model.SGGLDB db = Funs.DB;
@@ -425,7 +526,10 @@ namespace BLL
q = Funs.DB.HJGL_Pipeline.FirstOrDefault(x => x.PipelineCode == pipelineCode && x.UnitWorkId == unitWorkId);
return q;
}
/// <summary>
/// 添加管线信息
/// </summary>
/// <param name="pipeline"></param>
public static void AddPipeline(Model.HJGL_Pipeline pipeline)
{
Model.SGGLDB db = Funs.DB;
@@ -520,7 +624,11 @@ namespace BLL
}
}
// 管线划分
/// <summary>
/// 修改管线划分
/// </summary>
/// <param name="pipelineId"></param>
/// <param name="pipelineArea"></param>
public static void UpdatePipelineArea(string pipelineId, string pipelineArea)
{
Model.SGGLDB db = Funs.DB;
@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using WIA;
namespace BLL
{
@@ -45,35 +46,57 @@ namespace BLL
public static List<Model.SpWeldingDailyItem> GetWeldingDailyItem(string weldingDailyId)
{
List<Model.SpWeldingDailyItem> returnViewMatch = new List<Model.SpWeldingDailyItem>();
var weldlineLists = from x in Funs.DB.View_HJGL_WeldJoint
var weldlineLists = (from x in Funs.DB.View_HJGL_WeldJoint
where x.WeldingDailyId == weldingDailyId
select x;
if (weldlineLists.Count() > 0)
{
foreach (var item in weldlineLists)
{
Model.SpWeldingDailyItem newWeldReportItem = new Model.SpWeldingDailyItem();
newWeldReportItem.WeldJointId = item.WeldJointId;
newWeldReportItem.WeldJointCode = item.WeldJointCode;
newWeldReportItem.PipelineCode = item.PipelineCode;
newWeldReportItem.CoverWelderCode = item.CoverWelderCode;
newWeldReportItem.CoverWelderId = item.CoverWelderId;
newWeldReportItem.BackingWelderCode = item.BackingWelderCode;
newWeldReportItem.BackingWelderId = item.BackingWelderId;
//newWeldReportItem.WeldTypeId = item.WeldTypeCode;
newWeldReportItem.JointArea = item.JointArea;
newWeldReportItem.WeldingLocationId = item.WeldingLocationId;
newWeldReportItem.WeldingLocationCode = item.WeldingLocationCode;
newWeldReportItem.JointAttribute = item.JointAttribute;
newWeldReportItem.Size = item.Size;
newWeldReportItem.Dia = item.Dia;
newWeldReportItem.Thickness = item.Thickness;
newWeldReportItem.WeldingMethodCode = item.WeldingMethodCode;
newWeldReportItem.WeldingWireCode = item.WeldingWireCode;
newWeldReportItem.WeldingRodCode = item.WeldingRodCode;
returnViewMatch.Add(newWeldReportItem);
}
}
select new SpWeldingDailyItem
{
WeldJointId = x.WeldJointId,
WeldJointCode = x.WeldJointCode,
PipelineCode = x.PipelineCode,
CoverWelderCode = x.CoverWelderCode,
CoverWelderId = x.CoverWelderId,
BackingWelderCode = x.BackingWelderCode,
BackingWelderId = x.BackingWelderId,
WeldTypeId = x.WeldTypeCode,
JointArea = x.JointArea,
WeldingLocationId = x.WeldingLocationId,
WeldingLocationCode = x.WeldingLocationCode,
JointAttribute = x.JointAttribute,
Size = x.Size,
Dia = x.Dia,
Thickness = x.Thickness,
WeldingMethodCode = x.WeldingMethodCode,
WeldingWireCode = x.WeldingWireCode,
WeldingRodCode = x.WeldingRodCode
}).ToList();
returnViewMatch = weldlineLists;
//if (weldlineLists.Count() > 0)
//{
// foreach (var item in weldlineLists)
// {
// Model.SpWeldingDailyItem newWeldReportItem = new Model.SpWeldingDailyItem();
// newWeldReportItem.WeldJointId = item.WeldJointId;
// newWeldReportItem.WeldJointCode = item.WeldJointCode;
// newWeldReportItem.PipelineCode = item.PipelineCode;
// newWeldReportItem.CoverWelderCode = item.CoverWelderCode;
// newWeldReportItem.CoverWelderId = item.CoverWelderId;
// newWeldReportItem.BackingWelderCode = item.BackingWelderCode;
// newWeldReportItem.BackingWelderId = item.BackingWelderId;
// //newWeldReportItem.WeldTypeId = item.WeldTypeCode;
// newWeldReportItem.JointArea = item.JointArea;
// newWeldReportItem.WeldingLocationId = item.WeldingLocationId;
// newWeldReportItem.WeldingLocationCode = item.WeldingLocationCode;
// newWeldReportItem.JointAttribute = item.JointAttribute;
// newWeldReportItem.Size = item.Size;
// newWeldReportItem.Dia = item.Dia;
// newWeldReportItem.Thickness = item.Thickness;
// newWeldReportItem.WeldingMethodCode = item.WeldingMethodCode;
// newWeldReportItem.WeldingWireCode = item.WeldingWireCode;
// newWeldReportItem.WeldingRodCode = item.WeldingRodCode;
// returnViewMatch.Add(newWeldReportItem);
// }
//}
return returnViewMatch;
}