diff --git a/.vs/SGGL_SeDin/v17/.wsuo b/.vs/SGGL_SeDin/v17/.wsuo index 7dcba977..6ea53edc 100644 Binary files a/.vs/SGGL_SeDin/v17/.wsuo and b/.vs/SGGL_SeDin/v17/.wsuo differ diff --git a/DataBase/版本日志/SGGLDB_V2022-11-23.sql b/DataBase/版本日志/SGGLDB_V2022-11-23.sql new file mode 100644 index 00000000..6379d691 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2022-11-23.sql @@ -0,0 +1,6 @@ +alter table [dbo].[HJGL_MaterialCodeLib] alter column [MaterialName] nvarchar(300) +alter table [dbo].[HJGL_MaterialCodeLib] alter column MaterialSpec nvarchar(300) +alter table [dbo].[HJGL_MaterialCodeLib] alter column MaterialMade nvarchar(300) +alter table [dbo].[HJGL_MaterialCodeLib] alter column [MaterialDef] nvarchar(3000) +alter table [dbo].[HJGL_MaterialCodeLib] alter column PipeGrade nvarchar(300) +alter table [dbo].[HJGL_MaterialCodeLib] alter column MaterialUnit nvarchar(300) \ No newline at end of file diff --git a/DataBase/版本日志/SGGLDB_V2022-11-24.sql b/DataBase/版本日志/SGGLDB_V2022-11-24.sql new file mode 100644 index 00000000..fa97c725 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2022-11-24.sql @@ -0,0 +1 @@ +alter table [dbo].[HJGL_MaterialManage] alter column [SpecificationAndModel] nvarchar(1000) \ No newline at end of file diff --git a/SGGL/BLL/Common/Funs.cs b/SGGL/BLL/Common/Funs.cs index 1316fc53..8e8742d7 100644 --- a/SGGL/BLL/Common/Funs.cs +++ b/SGGL/BLL/Common/Funs.cs @@ -1022,11 +1022,17 @@ namespace BLL T entity = new T(); foreach (PropertyInfo p in pArray) { + if (string.IsNullOrEmpty(row[p.Name].ToString())) + { + p.SetValue(entity, "", null); + continue; + } if (row[p.Name] is Int64) { p.SetValue(entity, Convert.ToInt32(row[p.Name]), null); continue; } + p.SetValue(entity, row[p.Name], null); } list.Add(entity); diff --git a/SGGL/BLL/HJGL/BaseInfo/MaterialCodeLibService.cs b/SGGL/BLL/HJGL/BaseInfo/MaterialCodeLibService.cs index f8ced0a0..ad2f067c 100644 --- a/SGGL/BLL/HJGL/BaseInfo/MaterialCodeLibService.cs +++ b/SGGL/BLL/HJGL/BaseInfo/MaterialCodeLibService.cs @@ -1,6 +1,7 @@ namespace BLL { using Model; + using System.Collections.Generic; using System.Linq; public static class MaterialCodeLibService { @@ -12,7 +13,11 @@ { return Funs.DB.HJGL_MaterialCodeLib.FirstOrDefault(e => e.MaterialCode == materialCode); } - + public static List GetMaterialCodeLibList() + { + var q = (from x in Funs.DB.HJGL_MaterialCodeLib select x).ToList(); + return q; + } /// /// 增加材料库信息 /// @@ -34,7 +39,12 @@ db.HJGL_MaterialCodeLib.InsertOnSubmit(newCodeLib); db.SubmitChanges(); } - + public static void AddBulkMaterialCodeLib(List codeLib) + { + Model.SGGLDB db = Funs.DB; + db.HJGL_MaterialCodeLib.InsertAllOnSubmit(codeLib); + db.SubmitChanges(); + } /// /// 修改材料库信息 /// diff --git a/SGGL/BLL/HJGL/PreDesign/HJGL_MaterialService.cs b/SGGL/BLL/HJGL/PreDesign/HJGL_MaterialService.cs index 4cb51e43..3a270e0b 100644 --- a/SGGL/BLL/HJGL/PreDesign/HJGL_MaterialService.cs +++ b/SGGL/BLL/HJGL/PreDesign/HJGL_MaterialService.cs @@ -9,6 +9,22 @@ namespace BLL { public class HJGL_MaterialService { + /// + /// 工程预制库存 + /// + public static List materialStockItems_SHOP + { + get; + set; + } + /// + /// 现场安装库存 + /// + public static List materialStockItems_FIELD + { + get; + set; + } /// /// 获取材料信息 /// @@ -96,7 +112,6 @@ namespace BLL mat.MaterialCode, lib.MaterialName, lib.MaterialSpec, - lib.MaterialMade, lib.MaterialUnit, sum( mat.Num)+ISNULL( aa.Num,0) as MaterialNum from HJGL_MaterialManage mat @@ -125,7 +140,6 @@ namespace BLL mat.MaterialCode, lib.MaterialName, lib.MaterialSpec, - lib.MaterialMade, lib.MaterialUnit, sum( mat.Num)+ISNULL( aa.Num,0) as MaterialNum from Material_Material mat @@ -240,12 +254,30 @@ namespace BLL if (q != null && q.Count() > 0) //判断管线是否有关联材料 { var pipemodel = BLL.PipelineService.GetPipelineByPipelineId(pipelineid); - List list = GetMaterialStockItems(projectid, pipemodel.PipeArea); - if (list != null && list.Count > 0) //判断是否有库存信息 + List materialStockItems = new List(); + if (pipemodel.PipeArea==PipelineService.PipeArea_SHOP) + { + if (HJGL_MaterialService.materialStockItems_SHOP.Count == 0) + { + HJGL_MaterialService.materialStockItems_SHOP = GetMaterialStockItems(projectid, pipemodel.PipeArea); + } + materialStockItems = materialStockItems_SHOP; + } + else if (pipemodel.PipeArea == PipelineService.PipeArea_FIELD) + { + if(HJGL_MaterialService.materialStockItems_FIELD.Count == 0) + { + HJGL_MaterialService.materialStockItems_FIELD = GetMaterialStockItems(projectid, pipemodel.PipeArea); + } + materialStockItems = materialStockItems_FIELD; + } + + //List materialStockItems = GetMaterialStockItems(projectid, pipemodel.PipeArea); + if (materialStockItems != null && materialStockItems.Count > 0) //判断是否有库存信息 { foreach (var item in q) { - var StockMater = list.Where(x => x.MaterialCode == item.MaterialCode).FirstOrDefault(); + var StockMater = materialStockItems.Where(x => x.MaterialCode == item.MaterialCode).FirstOrDefault(); if (StockMater != null) //判断该材料是否存在库存 { var StockNum = StockMater.MaterialNum; diff --git a/SGGL/BLL/HJGL/WeldingManage/PipelineComponentService.cs b/SGGL/BLL/HJGL/WeldingManage/PipelineComponentService.cs index bfd3ef12..6aeb6db9 100644 --- a/SGGL/BLL/HJGL/WeldingManage/PipelineComponentService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/PipelineComponentService.cs @@ -93,7 +93,7 @@ namespace BLL { model.PipelineId = PipelineId; model.PipelineComponentCode = model_mat.PrefabricatedComponents; - model.DrawingName = model_mat.PrefabricatedComponents.Substring(0, model_mat.PrefabricatedComponents.LastIndexOf('-')); + model.DrawingName = model_mat.PrefabricatedComponents.Substring(0, model_mat.PrefabricatedComponents.LastIndexOf('-')).Replace("\"", ""); model.State = state_0; UpdatePipelineComponent(model); } @@ -103,7 +103,7 @@ namespace BLL model.PipelineComponentId = SQLHelper.GetNewID(); model.PipelineId = PipelineId; model.PipelineComponentCode = model_mat.PrefabricatedComponents; - model.DrawingName = model_mat.PrefabricatedComponents.Substring(0, model_mat.PrefabricatedComponents.LastIndexOf('-')); + model.DrawingName = model_mat.PrefabricatedComponents.Substring(0, model_mat.PrefabricatedComponents.LastIndexOf('-')).Replace("\"", ""); model.State = state_0; AddPipelineComponent(model); } diff --git a/SGGL/BLL/HJGL/WeldingManage/PipelineService.cs b/SGGL/BLL/HJGL/WeldingManage/PipelineService.cs index 338ddfbd..6ee295b8 100644 --- a/SGGL/BLL/HJGL/WeldingManage/PipelineService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/PipelineService.cs @@ -24,7 +24,13 @@ namespace BLL /// 现场安装 /// public const string PipeArea_FIELD = "2"; - + public static List hJGL_Pipelines + { + + get; + set; + + } /// /// 实际日期类型 /// @@ -54,7 +60,11 @@ namespace BLL list[1] = new ListItem("现场安装", PipeArea_FIELD); return list; } - + public static void RestPipelineAndJoints(string projectid ) + { + PipelineService.hJGL_Pipelines = PipelineService.GetPipelinesByProjectId(projectid); + WeldJointService.hJGL_WeldJoints = WeldJointService.GetWeldJointByProjectid(projectid); + } /// /// 根据管线ID获取管线信息 /// @@ -65,11 +75,7 @@ namespace BLL return Funs.DB.HJGL_Pipeline.FirstOrDefault(e => e.PipelineId == pipelineId); } public static void GetStateByPipelineId(string pipelineId) - {//< f:ListItem Value = "0" Text = "未开始" /> - // < f:ListItem Value = "1" Text = "未开始且延误" /> - // < f:ListItem Value = "2" Text = "开始" /> - // < f:ListItem Value = "3" Text = "已开始且延误" /> - // < f:ListItem Value = "4" Text = "完成" /> + { var mdoel = GetPipelineByPipelineId(pipelineId); var PlanStartDate = mdoel.PlanStartDate; var PlanEndDate = mdoel.PlanEndDate; @@ -161,18 +167,18 @@ namespace BLL { return Funs.DB.HJGL_Pipeline.FirstOrDefault(e => e.PipelineCode == pipelineCode); } - public static List GetView_HJGL_Pipelines(View_HJGL_Pipeline model) + public static List GetView_HJGL_Pipelines(HJGL_Pipeline model) { var db = Funs.DB; - var pipelineList =( from x in db.View_HJGL_Pipeline - where + var pipelineList =( from x in hJGL_Pipelines + 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)) && (string.IsNullOrEmpty(model.SingleName) || x.SingleName.Contains(model.SingleName)) && (string.IsNullOrEmpty(model.DesignPress) || x.DesignPress.Contains(model.DesignPress)) - && (string.IsNullOrEmpty(model.MaterialCode) || x.MaterialCode.Contains(model.MaterialCode)) - select x).ToList(); + /* && (string.IsNullOrEmpty(model.MaterialCode) || x.MaterialCode.Contains(model.MaterialCode))*/ + select x).ToList(); if (model.IsFinished!=null) { if (model.IsFinished==true) @@ -200,6 +206,17 @@ namespace BLL return q; } /// + /// 根据项目获取所有管线 + /// + /// + /// + public static List GetPipelinesByProjectId(string ProjectId) + { + + var q = Funs.DB.HJGL_Pipeline.Where(e => e.ProjectId == ProjectId).ToList(); + return q; + } + /// /// 根据管线ID获取管线信息 /// /// @@ -385,10 +402,28 @@ 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; + } + } + public static HJGL_Pipeline GetPipelineByCode(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); + return q; + } + public static void AddPipeline(Model.HJGL_Pipeline pipeline) { Model.SGGLDB db = Funs.DB; diff --git a/SGGL/BLL/HJGL/WeldingManage/WeldJointService.cs b/SGGL/BLL/HJGL/WeldingManage/WeldJointService.cs index ef34565d..62805c45 100644 --- a/SGGL/BLL/HJGL/WeldingManage/WeldJointService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/WeldJointService.cs @@ -1,11 +1,21 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using System.Web; namespace BLL { public static class WeldJointService { + public static List hJGL_WeldJoints + { + + get; + set; + + } /// /// 根据焊口Id获取焊口信息 /// @@ -59,6 +69,15 @@ namespace BLL var q = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == PipelineId select x).ToList(); return q; } + + public static Model.HJGL_WeldJoint GetWeldJointsByWeldJointCode(string PipelineId, string WeldJointCode) + { + var q=(from x in Funs.DB.HJGL_WeldJoint where x.PipelineId==PipelineId && x.WeldJointCode==WeldJointCode select x ).FirstOrDefault(); + + return q; + } + + /// /// 添加 /// @@ -312,6 +331,26 @@ namespace BLL Model.SGGLDB db = Funs.DB; return db.View_HJGL_WeldJoint.FirstOrDefault(e => e.WeldJointId == weldJointId); } + public static List GetWeldJointByUnitworkId(string UnitWorkId) + { + Model.SGGLDB db = Funs.DB; + var q = (from x in db.HJGL_WeldJoint + join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId into tt + from g in tt.DefaultIfEmpty() + where g.UnitWorkId == UnitWorkId + select x).ToList(); + + return q; + } + public static List GetWeldJointByProjectid(string ProjectId) + { + Model.SGGLDB db = Funs.DB; + + var q = (from x in db.HJGL_WeldJoint + where x.ProjectId == ProjectId + select x).ToList(); + return q; + } /// /// 根据焊口Id获取插入焊口数 diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index a03ae3e3..f230b035 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -102,8 +102,8 @@ False - - ..\packages\MiniExcel.1.26.5\lib\net45\MiniExcel.dll + + ..\packages\MiniExcel.1.29.0\lib\net45\MiniExcel.dll ..\packages\Newtonsoft.Json.12.0.1\lib\net40\Newtonsoft.Json.dll diff --git a/SGGL/FineUIPro.Web/HJGL/BaseInfo/MaterialCodeLibIn.aspx.cs b/SGGL/FineUIPro.Web/HJGL/BaseInfo/MaterialCodeLibIn.aspx.cs index 276504bc..f41e3f9a 100644 --- a/SGGL/FineUIPro.Web/HJGL/BaseInfo/MaterialCodeLibIn.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/BaseInfo/MaterialCodeLibIn.aspx.cs @@ -85,7 +85,8 @@ namespace FineUIPro.Web.HJGL.BaseInfo string message = string.Empty; errorInfos = string.Empty; List codeLib = new List(); - + List codeLib_update = new List(); + var materialcodelist =MaterialCodeLibService.GetMaterialCodeLibList(); if (this.fuAttachUrl.HasFile == false) { ShowNotify("请选择Excel文件!", MessageBoxIcon.Warning); @@ -155,7 +156,17 @@ namespace FineUIPro.Web.HJGL.BaseInfo //= SQLHelper.GetNewID(typeof(Model.Editor_CostReport)); if (!codeLib.Select(x => x.MaterialCode).Contains(item.MaterialCode)) { - codeLib.Add(item); + + if (materialcodelist.Select(x => x.MaterialCode).Contains(item.MaterialCode)) + { + codeLib_update.Add(item); + } + else + { + codeLib.Add(item); + + } + } #endregion @@ -173,8 +184,41 @@ namespace FineUIPro.Web.HJGL.BaseInfo Alert.ShowInTop(errorInfos, MessageBoxIcon.Warning); return; } + codeLib = (from x in codeLib + select new HJGL_MaterialCodeLib + { + MaterialCode=x.MaterialCode, + MaterialDef=x.MaterialDef, + MaterialSpec=x.MaterialSpec, + MaterialUnit=x.MaterialUnit, + MaterialName=x.MaterialName, - foreach (var item in codeLib) + }).DistinctBy(temp=> new + { + temp.MaterialCode, + temp.MaterialDef, + temp.MaterialSpec, + temp.MaterialUnit, + temp.MaterialName + }).ToList(); + codeLib_update = (from x in codeLib_update + select new HJGL_MaterialCodeLib + { + MaterialCode = x.MaterialCode, + MaterialDef = x.MaterialDef, + MaterialSpec = x.MaterialSpec, + MaterialUnit = x.MaterialUnit, + MaterialName = x.MaterialName, + + }).DistinctBy(temp => new + { + temp.MaterialCode, + temp.MaterialDef, + temp.MaterialSpec, + temp.MaterialUnit, + temp.MaterialName + }).ToList(); + foreach (var item in codeLib_update) { var mewCostReport = BLL.MaterialCodeLibService.GetMaterialCodeLib(item.MaterialCode); if (mewCostReport == null) @@ -186,7 +230,7 @@ namespace FineUIPro.Web.HJGL.BaseInfo BLL.MaterialCodeLibService.UpdateMaterialCodeLib(item); } } - + MaterialCodeLibService.AddBulkMaterialCodeLib(codeLib); ShowNotify("数据导入成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); diff --git a/SGGL/FineUIPro.Web/HJGL/DataImport/MaterialInformation.aspx b/SGGL/FineUIPro.Web/HJGL/DataImport/MaterialInformation.aspx index 9874c64c..3acacc87 100644 --- a/SGGL/FineUIPro.Web/HJGL/DataImport/MaterialInformation.aspx +++ b/SGGL/FineUIPro.Web/HJGL/DataImport/MaterialInformation.aspx @@ -98,7 +98,7 @@ - + + + +