From 064a849b97dfb2a03d35a5eb46ca6aa427cb9538 Mon Sep 17 00:00:00 2001 From: fei550 <1420031550@qq.com> Date: Fri, 27 Sep 2024 18:17:21 +0800 Subject: [PATCH] 1 --- DataBase/版本日志/SGGLDB_V2024-09-27.sql | 55 +++ SGGL/BLL/API/HJGL/APINDETrustService.cs | 120 ++++- .../BLL/API/HJGL/APIPackagingManageService.cs | 13 + SGGL/BLL/API/HJGL/APIPipeJointService.cs | 14 +- .../BLL/API/HJGL/APIPreWeldingDailyService.cs | 51 ++- SGGL/BLL/CLGL/TwArrivalStatisticsService.cs | 148 +++++- SGGL/BLL/CLGL/TwConst.cs | 20 + .../CLGL/TwInOutplandetailRelationService.cs | 2 +- SGGL/BLL/CLGL/TwInOutplandetailService.cs | 8 +- SGGL/BLL/CLGL/TwInOutplanmasterService.cs | 39 +- SGGL/BLL/CLGL/TwInputdetailService.cs | 1 + SGGL/BLL/CLGL/TwInputmasterService.cs | 2 +- SGGL/BLL/CLGL/TwMaterialstockService.cs | 3 +- SGGL/BLL/CLGL/TwOutputdetailService..cs | 9 +- .../WeldingManage/PipelineComponentService.cs | 2 +- .../BLL/HJGL/WeldingManage/PipelineService.cs | 50 +- .../FineUIPro.Web/CLGL/ArrivalStatistics.aspx | 10 +- .../CLGL/ArrivalStatistics.aspx.cs | 4 +- .../CLGL/ArrivalStatistics.aspx.designer.cs | 11 +- SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx | 23 +- SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx.cs | 113 +++++ .../CLGL/InPlanMaster.aspx.designer.cs | 9 + SGGL/FineUIPro.Web/CLGL/InPlanMasterEdit.aspx | 6 +- .../CLGL/InPlanMasterEdit.aspx.cs | 2 +- .../CLGL/InPlanMasterEdit.aspx.designer.cs | 9 + SGGL/FineUIPro.Web/CLGL/InputMaster.aspx | 16 +- SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.cs | 121 +++++ .../CLGL/InputMaster.aspx.designer.cs | 9 + SGGL/FineUIPro.Web/CLGL/MaterialStock.aspx | 23 +- SGGL/FineUIPro.Web/CLGL/MaterialStock.aspx.cs | 17 +- .../CLGL/MaterialStock.aspx.designer.cs | 36 ++ SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx | 83 +++- SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx.cs | 199 +++++--- .../CLGL/OutPlanMaster.aspx.designer.cs | 18 +- .../FineUIPro.Web/CLGL/OutPlanMasterEdit.aspx | 14 +- .../CLGL/OutPlanMasterEdit.aspx.cs | 3 +- .../CLGL/OutPlanMasterSelect.aspx.cs | 5 +- SGGL/FineUIPro.Web/CLGL/OutputMaster.aspx | 21 +- SGGL/FineUIPro.Web/CLGL/OutputMaster.aspx.cs | 113 ++++- .../CLGL/OutputMaster.aspx.designer.cs | 18 +- .../File/Excel/DataIn/材料入库导入模板.xlsx | Bin 8797 -> 8769 bytes .../File/Fastreport/材料入库单.frx | 221 +++++++++ .../File/Fastreport/材料入库计划单.frx | 218 +++++++++ .../File/Fastreport/材料出库单.frx | 227 +++++++++ .../File/Fastreport/材料出库计划单.frx | 218 +++++++++ .../File/Fastreport/焊口打印.frx | 165 +++++++ .../File/Fastreport/组件打印.frx | 23 +- .../HJGL/DataImport/MaterialInformation.aspx | 88 +++- .../DataImport/MaterialInformation.aspx.cs | 55 ++- .../MaterialInformation.aspx.designer.cs | 36 ++ .../HJGL/PreDesign/PipelingDivide.aspx | 6 +- .../HJGL/PreDesign/PipelingDivide.aspx.cs | 2 +- .../HJGL/WeldingManage/PipelineMatIn.aspx | 88 ++-- .../PipelineMatIn.aspx.designer.cs | 18 + .../HJGL/WeldingManage/WeldMatMatch.aspx | 209 ++++----- .../HJGL/WeldingManage/WeldMatMatch.aspx.cs | 432 +++++++++++++----- .../WeldMatMatch.aspx.designer.cs | 116 ++--- .../HJGL/WeldingManage/WeldTask.aspx | 5 +- .../HJGL/WeldingManage/WeldTask.aspx.cs | 44 ++ .../WeldingManage/WeldTask.aspx.designer.cs | 9 + .../Model/APIItem/HJGL/PackagingManageItem.cs | 1 + SGGL/Model/CLGL/Tw_ArrivalStatisticsOutPut.cs | 21 + SGGL/Model/CLGL/Tw_InOutDetailOutput.cs | 14 +- SGGL/Model/CLGL/Tw_InputDataIn.cs | 8 +- SGGL/Model/CLGL/Tw_MaterialStockOutput.cs | 1 + SGGL/Model/CLGL/Tw_PipeMatMatchOutput.cs | 25 + SGGL/Model/CLGL/Tw_PrintModel.cs | 36 ++ SGGL/Model/Model.cs | 36 ++ SGGL/Model/Model.csproj | 3 + .../Controllers/HJGL/NDETrustController.cs | 26 ++ .../HJGL/PackagingManageController.cs | 17 + .../Controllers/HJGL/PipeJointController.cs | 20 + .../HJGL/PreWeldingDailyController.cs | 29 ++ 73 files changed, 3248 insertions(+), 589 deletions(-) create mode 100644 DataBase/版本日志/SGGLDB_V2024-09-27.sql create mode 100644 SGGL/FineUIPro.Web/File/Fastreport/材料入库单.frx create mode 100644 SGGL/FineUIPro.Web/File/Fastreport/材料入库计划单.frx create mode 100644 SGGL/FineUIPro.Web/File/Fastreport/材料出库单.frx create mode 100644 SGGL/FineUIPro.Web/File/Fastreport/材料出库计划单.frx create mode 100644 SGGL/FineUIPro.Web/File/Fastreport/焊口打印.frx create mode 100644 SGGL/Model/CLGL/Tw_ArrivalStatisticsOutPut.cs create mode 100644 SGGL/Model/CLGL/Tw_PipeMatMatchOutput.cs create mode 100644 SGGL/Model/CLGL/Tw_PrintModel.cs diff --git a/DataBase/版本日志/SGGLDB_V2024-09-27.sql b/DataBase/版本日志/SGGLDB_V2024-09-27.sql new file mode 100644 index 00000000..f770542e --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2024-09-27.sql @@ -0,0 +1,55 @@ + +alter view dbo.View_HJGL_WeldingTask as + SELECT T.WeldTaskId, + T.WeldJointId, + T.CoverWelderId, + T.BackingWelderId, + cov.WelderCode AS CoverWelderCode, + back.WelderCode AS BackingWelderCode, + case when jot.JointAttribute is not null then jot.JointAttribute else T.JointAttribute end as JointAttribute, + T.WeldingMode, + T.ProjectId, + T.UnitWorkId, + T.UnitId, + T.TaskDate, + T.Tabler, + T.TableDate, + jot.WeldJointCode, + jot.Dia, + jot.DNDia, + jot.Thickness, + jot.Size, + jot.WeldingLocationId, + jot.Specification, + CASE WHEN jot.WeldingDailyId IS NULL THEN '' ELSE '' END AS IsWelding, + P.PipelineCode, + p.PipelineId, + B.WeldTypeCode, + M.WeldingMethodCode, + L.WeldingLocationCode, + t.CanWelderCode, + t.CanWelderId, + rod.ConsumablesName AS WeldingRodCode, + T.CanWeldingRodName, + T.CanWeldingWireName, + wire.ConsumablesName AS WeldingWireCode, + jot.WeldingDailyId, + p.PipeArea, + mater.MaterialCode, + (case + when charindex('/', jot.WeldJointCode) > 0 + then RIGHT(jot.WeldJointCode, CHARINDEX('/', REVERSE(jot.WeldJointCode)) - 1) + else jot.WeldJointCode end) as WeldJointNum + from HJGL_WeldTask T + left join HJGL_WeldJoint jot on T.WeldJointId = jot.WeldJointId + LEFT JOIN dbo.SitePerson_Person cov ON cov.PersonId = t.CoverWelderId and cov.ProjectId = t.ProjectId + LEFT JOIN dbo.SitePerson_Person back ON back.PersonId = t.BackingWelderId and back.ProjectId = t.ProjectId + LEFT join HJGL_Pipeline P on jot.PipelineId = P.PipelineId + left join Base_WeldType B on jot.WeldTypeId = B.WeldTypeId + LEFT join Base_WeldingMethod M on jot.WeldingMethodId = M.WeldingMethodId + left join Base_WeldingLocation L on jot.WeldingLocationId = L.WeldingLocationId + LEFT JOIN Base_Consumables AS wire ON wire.ConsumablesId = jot.WeldingWire + LEFT JOIN Base_Consumables AS rod ON rod.ConsumablesId = jot.WeldingRod + left join Base_Material as mater on jot.Material1Id = mater.MaterialId +go + diff --git a/SGGL/BLL/API/HJGL/APINDETrustService.cs b/SGGL/BLL/API/HJGL/APINDETrustService.cs index 40c1d406..f72da822 100644 --- a/SGGL/BLL/API/HJGL/APINDETrustService.cs +++ b/SGGL/BLL/API/HJGL/APINDETrustService.cs @@ -1,4 +1,5 @@ -using System; +using FineUIPro; +using System; using System.Collections.Generic; using System.Linq; @@ -257,7 +258,124 @@ namespace BLL BLL.PointBatchDetailService.AutoPoint(pointBatchId); } #endregion + /// + /// 手动点口 + /// + /// + /// + public static string ManualPointSave(string weldJointId) + { + string res = ""; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var PointBatchItemModel = db.HJGL_Batch_PointBatchItem.FirstOrDefault(e => e.WeldJointId == weldJointId); + var PointBatchId= PointBatchItemModel.PointBatchId; + var batch = BLL.PointBatchService.GetPointBatchById(PointBatchId); + if (!batch.EndDate.HasValue) + { + var weldJoint = (from x in db.View_HJGL_WeldJoint + where x.WeldJointId == weldJointId + select x).FirstOrDefault(); + Model.Project_Sys_Set batchSet = BLL.Project_SysSetService.GetSysSetBySetId("5", weldJoint.ProjectId); + if (batchSet != null && weldJoint != null) + { + int needJointNum = 0; + int pointNumG = 0; + int pointNumA = 0; + if (batchSet.SetValue.Contains("6")) //按管线组批 + { + var pipeline = (from x in db.HJGL_Pipeline + join y in db.HJGL_WeldJoint on x.PipelineId equals y.PipelineId + join z in db.HJGL_Batch_PointBatchItem on y.WeldJointId equals z.WeldJointId + where z.PointBatchId == PointBatchId + select x).FirstOrDefault(); + if (pipeline != null) + { + Model.Base_DetectionRate rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(pipeline.DetectionRateId); + if (rate != null) + { + int totalJointCount = db.HJGL_WeldJoint.Count(x => x.PipelineId == pipeline.PipelineId); + needJointNum = Convert.ToInt32(Math.Ceiling((totalJointCount * rate.DetectionRateValue.Value) * 0.01)); + // 安装口检测数量 + pointNumG = Convert.ToInt32(Math.Ceiling(needJointNum * 0.4)); + // 预制口要检测的数量 + pointNumA = needJointNum - pointNumG; + var pointGNum = (from x in db.HJGL_Batch_PointBatchItem + join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId + where y.PipelineId == pipeline.PipelineId && x.PointState == "1" && y.JointAttribute == "安装口" + select x).Count(); + var pointNotGNum = (from x in db.HJGL_Batch_PointBatchItem + join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId + where y.PipelineId == pipeline.PipelineId && x.PointState == "1" && y.JointAttribute == "预制口" + select x).Count(); + if (weldJoint.JointAttribute == "安装口" && pointGNum >= pointNumG) + { + res = "安装口已达检测标准,无需再点此安装口!"; + return res; + } + if (weldJoint.JointAttribute == "预制口" && pointNotGNum >= pointNumA) + { + res = "预制口已达检测标准,无需再点此预制口!"; + return res; + } + } + } + } + else //不按管线组批 + { + string unitWorkId = weldJoint.UnitWorkId; + string rateId = weldJoint.DetectionRateId; + string detectionType = weldJoint.DetectionType; + int totalJointNum = (from x in db.HJGL_WeldJoint + join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId + where y.DetectionRateId == rateId && y.UnitWorkId == unitWorkId && y.DetectionType == detectionType + select x).Count(); + Model.Base_DetectionRate rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(rateId); + if (rate != null) + { + needJointNum = Convert.ToInt32(Math.Ceiling((totalJointNum * rate.DetectionRateValue.Value) * 0.01)); + // 安装口检测数量 + pointNumG = Convert.ToInt32(Math.Ceiling(needJointNum * 0.4)); + // 预制口要检测的数量 + pointNumA = needJointNum - pointNumG; + var pointGNum = (from x in db.HJGL_Batch_PointBatchItem + join y in db.HJGL_Batch_PointBatch on x.PointBatchId equals y.PointBatchId + join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId + where y.DetectionRateId == rateId && y.UnitWorkId == unitWorkId && y.DetectionTypeId == detectionType + && x.PointState == "1" && z.JointAttribute == "安装口" + select x).Count(); + var pointNotGNum = (from x in db.HJGL_Batch_PointBatchItem + join y in db.HJGL_Batch_PointBatch on x.PointBatchId equals y.PointBatchId + join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId + where y.DetectionRateId == rateId && y.UnitWorkId == unitWorkId && y.DetectionTypeId == detectionType + && x.PointState == "1" && z.JointAttribute == "预制口" + select x).Count(); + if (weldJoint.JointAttribute == "安装口" && pointGNum >= pointNumG) + { + res = "安装口已达检测标准,无需再点此安装口!"; + return res; + } + if (weldJoint.JointAttribute == "预制口" && pointNotGNum >= pointNumA) + { + res = "预制口已达检测标准,无需再点此预制口!"; + return res; + } + } + } + } + PointBatchDetailService.UpdatePointBatchDetail(PointBatchItemModel.PointBatchItemId, "1", System.DateTime.Now); + + + } + else + { + res = "批已关闭,不能点口!"; + } + } + return res; + + } #region 点口调整 /// /// 点口调整 diff --git a/SGGL/BLL/API/HJGL/APIPackagingManageService.cs b/SGGL/BLL/API/HJGL/APIPackagingManageService.cs index c6fa17cf..76586b8e 100644 --- a/SGGL/BLL/API/HJGL/APIPackagingManageService.cs +++ b/SGGL/BLL/API/HJGL/APIPackagingManageService.cs @@ -67,6 +67,7 @@ namespace BLL where PipelineComponentIdList.Contains(x.PipelineComponentId) select new PackagingPrepipeItem { + PipelineComponentId = x.PipelineComponentId, PipelineComponentCode = x.PipelineComponentCode, PreUnit = "1/个", UnitWorkName = z.UnitWorkName, @@ -101,6 +102,18 @@ namespace BLL HJGL_PackagingmanageService.UpdateHJGL_PackagingManage(q); } } + public static void getSavePackagingInformationById(string packagingManageId, string PipelineComponentIds) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var table = db.HJGL_PackagingManage.FirstOrDefault(x => x.PackagingManageId == packagingManageId); + if (table != null) + { + table.PipelineComponentId = PipelineComponentIds; + } + BLL.HJGL_PackagingmanageService.UpdateHJGL_PackagingManage(table); + } + } } } diff --git a/SGGL/BLL/API/HJGL/APIPipeJointService.cs b/SGGL/BLL/API/HJGL/APIPipeJointService.cs index a5e440d5..13d578f1 100644 --- a/SGGL/BLL/API/HJGL/APIPipeJointService.cs +++ b/SGGL/BLL/API/HJGL/APIPipeJointService.cs @@ -1,4 +1,5 @@ -using System; +using Microsoft.SqlServer.Dts.Runtime; +using System; using System.Collections.Generic; using System.Linq; @@ -45,6 +46,17 @@ namespace BLL #endregion 获取管线信息 + public static Model.View_HJGL_WeldJoint GetHJGL_WeldJoint(string WeldJointId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + // 从数据库中获取符合条件的管线数据 + var weldjoint = db.View_HJGL_WeldJoint + .Where(p => p.WeldJointId == WeldJointId) + .FirstOrDefault(); + return weldjoint; + } + } #region 获取未焊接的焊口信息 diff --git a/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs b/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs index 8cdfd585..06cde587 100644 --- a/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs +++ b/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs @@ -1,8 +1,11 @@ -using System; +using Microsoft.SqlServer.Dts.Runtime; +using NPOI.SS.Formula.Functions; +using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; +using static QRCoder.PayloadGenerator; namespace BLL { @@ -254,6 +257,52 @@ namespace BLL } #endregion + public static string SaveWeldingDailyByWeldJointId(string WeldJointId, string Personid, string time) + { + string res = ""; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var peson=db.Person_Persons.FirstOrDefault(x => x.PersonId == Personid); + if (peson == null) + { + res = "人员不存在"; + return res; + } + var joint = db.View_HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == WeldJointId); + if (joint == null) + { + res = "焊口不存在"; + return res; + } + var weldingDaily = db.HJGL_WeldingDaily.FirstOrDefault(x => x.WeldingDate.Value.Date == Convert.ToDateTime(time).Date); + if (weldingDaily == null) + { + string perfix = string.Format("{0:yyyyMMdd}", System.DateTime.Now) + "-" + peson.PersonName + "-"; + weldingDaily = new Model.HJGL_WeldingDaily(); + weldingDaily.WeldingDailyId = Guid.NewGuid().ToString(); + weldingDaily.WeldingDailyCode = BLL.SQLHelper.RunProcNewId("SpGetThreeNumber", "dbo.HJGL_WeldingDaily", "WeldingDailyCode", joint.ProjectId, perfix); + weldingDaily.WeldingDate = Convert.ToDateTime(time).Date; + weldingDaily.ProjectId = joint.ProjectId; + weldingDaily.UnitWorkId = joint.UnitWorkId; + weldingDaily.UnitId = joint.UnitId; + weldingDaily.Tabler = Personid; + weldingDaily.TableDate = Convert.ToDateTime(time).Date; + db.HJGL_WeldingDaily.InsertOnSubmit(weldingDaily); + db.SubmitChanges(); + } + var batchC = BLL.Project_SysSetService.GetSysSetBySetId("5", joint.ProjectId); + if (batchC != null) + { + string batchCondition = batchC.SetValue; + InsertWeldingDailyItem(WeldJointId, Personid, Personid, joint.JointAttribute, weldingDaily.WeldingDate, batchCondition, true, weldingDaily.WeldingDailyId, joint.ProjectId); + } + BLL.WeldJointService.UpdateWeldJointAddG(WeldJointId, joint.JointAttribute, Const.BtnAdd); + + + } + return res; + } + #region 保存焊接日报明细 /// /// 保存焊接日报明细 diff --git a/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs b/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs index 8eacd96f..21b9cb28 100644 --- a/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs +++ b/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs @@ -1,15 +1,18 @@ -using System; +using Microsoft.SqlServer.Dts.Runtime; +using Model; +using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; namespace BLL { public class TwArrivalStatisticsService { - public static IEnumerable GetStatistics(string projectid,string materialCode) + public static List GetStatistics(string projectid,string materialCode) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { @@ -36,12 +39,12 @@ namespace BLL RealNum = g.Sum(x => x.ActNum) ?? 0, }; - var StatisticsList =from x in NeedOutMateriaList + var StatisticsList =(from x in NeedOutMateriaList join y in RealInMateriaList on x.Key equals y.Key into gg from y in gg.DefaultIfEmpty() join z in db.HJGL_MaterialCodeLib on x.Key equals z.MaterialCode into zz from z in zz.DefaultIfEmpty() - select new + select new Tw_ArrivalStatisticsOutPut { MaterialCode = x.Key, NeedNum = x.NeedNum, @@ -49,10 +52,139 @@ namespace BLL MaterialName = z.MaterialName, MaterialSpec=z.MaterialSpec, MaterialUnit=z.MaterialUnit, - }; - return StatisticsList.ToList(); + MaterialDef = z.MaterialDef, + MatchRate = (x.NeedNum == 0 ?0:Math.Round((y == null ? 0 : y.RealNum) / x.NeedNum, 4,MidpointRounding.ToEven)), + }).ToList(); + foreach (var item in StatisticsList) + { + item.MatchRateString = Math.Round(item.MatchRate*100, 2).ToString()+"%" ; + } + return StatisticsList ; } } - } - + + + + public static List GetPipeMatMatch(string projectid, List pipelineIds,string WarehouseCode) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var results = new List(); + + // 获取所需材料列表 + var requiredMaterials = (from x in db.HJGL_PipeLineMat + join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode + join z in db.HJGL_Pipeline on x.PipelineId equals z.PipelineId + where z.ProjectId == projectid && pipelineIds.Contains(z.PipelineId) + select new Tw_PipeMatMatchOutput + { + Id= Guid.NewGuid().ToString(), + PipelineId =x.PipelineId, + PipelineCode=z.PipelineCode, + PrefabricatedComponents=x.PrefabricatedComponents, + MaterialCode = x.MaterialCode, + MaterialName= y.MaterialName, + MaterialSpec= y.MaterialSpec, + MaterialUnit= y.MaterialUnit, + MaterialDef= y.MaterialDef, + NeedNum=x.Number, + } + ).ToList(); + Tw_MaterialStockOutput tw_MaterialStockOutput=new Tw_MaterialStockOutput(); + tw_MaterialStockOutput .WarehouseCode=WarehouseCode; + var stockList= TwMaterialstockService.GetTw_MaterialStockByModle(tw_MaterialStockOutput).ToList();//获取库存列表 + + // 模拟库存管理 + foreach (var material in requiredMaterials) + { + var thisMaterialStockNum = stockList.FirstOrDefault(x => x.PipeLineMatCode == material.MaterialCode)?.StockNum??0; + if (thisMaterialStockNum >= material.NeedNum) + { + material.MatchNum=material.NeedNum; + material.MatchRate=1; + material.MatchRateString="100%"; + } + else + { + material.MatchNum = thisMaterialStockNum<0?0:thisMaterialStockNum; + material.MatchRate = (material.NeedNum == 0 ? 0 : material.MatchNum??0 / material.NeedNum); + material.MatchRateString = Math.Round((decimal)material.MatchRate * 100, 2).ToString() + "%"; + + } + //修改stockList对应的库存数量 + var stock = stockList.FirstOrDefault(x => x.PipeLineMatCode == material.MaterialCode); + if (stock != null) + { + stock.StockNum -= material.MatchNum; + } + } + results = requiredMaterials; + return results; + } + } + + + public static List GetMatMatchByOutPlanMasterId(string outPlanMasterId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var results = new List(); + + // 获取所需材料列表 + var requiredMaterials = (from x in db.Tw_InOutPlanDetail_Relation + join master in db.Tw_InOutPlanMaster on x.InOutPlanMasterId equals master.Id + join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode + join z in db.HJGL_Pipeline on x.PipelineId equals z.PipelineId + where x.InOutPlanMasterId == outPlanMasterId + select new Tw_PipeMatMatchOutput + { + Id = Guid.NewGuid().ToString(), + PipelineId = x.PipelineId, + PipelineCode = z.PipelineCode, + PrefabricatedComponents = x.PrefabricatedComponents, + MaterialCode = x.MaterialCode, + MaterialName = y.MaterialName, + MaterialSpec = y.MaterialSpec, + MaterialUnit = y.MaterialUnit, + MaterialDef = y.MaterialDef, + NeedNum = x.Number, + } + ).ToList(); + var masterModle = db.Tw_InOutPlanMaster.FirstOrDefault(x => x.Id == outPlanMasterId); + Tw_MaterialStockOutput tw_MaterialStockOutput = new Tw_MaterialStockOutput(); + tw_MaterialStockOutput.WarehouseCode = masterModle.WarehouseCode; + var stockList = TwMaterialstockService.GetTw_MaterialStockByModle(tw_MaterialStockOutput).ToList();//获取库存列表 + + // 模拟库存管理 + foreach (var material in requiredMaterials) + { + var thisMaterialStockNum = stockList.FirstOrDefault(x => x.PipeLineMatCode == material.MaterialCode)?.StockNum ?? 0; + if (thisMaterialStockNum >= material.NeedNum) + { + material.MatchNum = material.NeedNum; + material.MatchRate = 1; + material.MatchRateString = "100%"; + } + else + { + material.MatchNum = thisMaterialStockNum < 0 ? 0 : thisMaterialStockNum; + material.MatchRate = (material.NeedNum == 0 ? 0 : material.MatchNum ?? 0 / material.NeedNum); + material.MatchRateString = Math.Round((decimal)material.MatchRate * 100, 2).ToString() + "%"; + + } + //修改stockList对应的库存数量 + var stock = stockList.FirstOrDefault(x => x.PipeLineMatCode == material.MaterialCode); + if (stock != null) + { + stock.StockNum -= material.MatchNum; + } + } + results = requiredMaterials; + return results; + } + + + } + } + } diff --git a/SGGL/BLL/CLGL/TwConst.cs b/SGGL/BLL/CLGL/TwConst.cs index 372a0762..11f0e9a2 100644 --- a/SGGL/BLL/CLGL/TwConst.cs +++ b/SGGL/BLL/CLGL/TwConst.cs @@ -42,6 +42,26 @@ namespace BLL { "补料出库" ,(int)TypeInt.补料出库}, { "其他出库" ,(int)TypeInt.其他出库}, { "散件出库" ,(int)TypeInt.散件出库} + }; + public static Dictionary PlanPrintMap = new Dictionary + { + { "采购通知单" ,(int)TypeInt.采购入库}, + { "退料通知单" ,(int)TypeInt.退料入库}, + { "其他入库通知单" ,(int)TypeInt.其他入库}, + { "材料领用申请单" ,(int)TypeInt.领料出库}, + { "补料申请单" ,(int)TypeInt.补料出库}, + { "其他出库申请单" ,(int)TypeInt.其他出库}, + { "散件出库申请单" ,(int)TypeInt.散件出库} + }; + public static Dictionary PrintMap = new Dictionary + { + { "采购入库单" ,(int)TypeInt.采购入库}, + { "退料入库单" ,(int)TypeInt.退料入库}, + { "其他入库单" ,(int)TypeInt.其他入库}, + { "材料出库单" ,(int)TypeInt.领料出库}, + { "补料出库单" ,(int)TypeInt.补料出库}, + { "其他出库单" ,(int)TypeInt.其他出库}, + { "散件出库单" ,(int)TypeInt.散件出库} }; public static Dictionary StateMap = new Dictionary { diff --git a/SGGL/BLL/CLGL/TwInOutplandetailRelationService.cs b/SGGL/BLL/CLGL/TwInOutplandetailRelationService.cs index 4dedfa16..f49782b3 100644 --- a/SGGL/BLL/CLGL/TwInOutplandetailRelationService.cs +++ b/SGGL/BLL/CLGL/TwInOutplandetailRelationService.cs @@ -70,7 +70,7 @@ namespace BLL x.PrefabricatedComponents, x.Number, mat.MaterialName, - + mat.MaterialDef }; } #endregion diff --git a/SGGL/BLL/CLGL/TwInOutplandetailService.cs b/SGGL/BLL/CLGL/TwInOutplandetailService.cs index 3719d426..45998070 100644 --- a/SGGL/BLL/CLGL/TwInOutplandetailService.cs +++ b/SGGL/BLL/CLGL/TwInOutplandetailService.cs @@ -27,7 +27,11 @@ namespace BLL join y in Funs.DB.HJGL_Pipeline_Component on x.PipelineComponentId equals y.PipelineComponentId into yy from y in yy.DefaultIfEmpty() join mat in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals mat.MaterialCode into mm - from mat in mm.DefaultIfEmpty() + from mat in mm.DefaultIfEmpty() + join master in Funs.DB.Tw_InOutPlanMaster on x.InOutPlanMasterId equals master.Id into masters + from master in masters.DefaultIfEmpty() + join stock in Funs.DB.Tw_MaterialStock on new { x.MaterialCode, master.WarehouseCode } equals new { MaterialCode = stock.PipeLineMatCode, stock.WarehouseCode } into st + from stock in st.DefaultIfEmpty() where (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && (string.IsNullOrEmpty(table.InOutPlanMasterId) || x.InOutPlanMasterId.Contains(table.InOutPlanMasterId)) && @@ -43,6 +47,8 @@ namespace BLL ActNum = x.ActNum, PipelineComponentCode = y.PipelineComponentCode, MaterialName = mat.MaterialName, + MaterialDef= mat.MaterialDef, + StockNum = stock.StockNum ?? 0, } ; diff --git a/SGGL/BLL/CLGL/TwInOutplanmasterService.cs b/SGGL/BLL/CLGL/TwInOutplanmasterService.cs index 00310faf..e12cc084 100644 --- a/SGGL/BLL/CLGL/TwInOutplanmasterService.cs +++ b/SGGL/BLL/CLGL/TwInOutplanmasterService.cs @@ -1,6 +1,7 @@ using EmitMapper; using FineUIPro; using Microsoft.Office.Interop.Word; +using Microsoft.SqlServer.Dts.Runtime; using MiniExcelLibs; using Model; using NPOI.Util; @@ -213,10 +214,6 @@ namespace BLL responeData.message = "导入数据为空!"; return responeData; } - var queryAll = new Tw_InOutMasterOutput() - { - ProjectId = projectid - }; var warehouseCodeList = temeplateDtoIns.Select(x => x.WarehouseCode).Distinct().ToList(); //获取导入文件的仓库编号 string errorWarehouseCode = ""; foreach (var item in warehouseCodeList) @@ -251,7 +248,15 @@ namespace BLL return responeData; } } - + string cusbilcode = GetDataInCusBillCode(projectid,UnitService.GetUnitCodeByUnitId(Person_PersonsService.GetPerson_PersonsById(creatUserId).UnitId)); + foreach (var item in temeplateDtoIns) + { + item.CusBillCode = cusbilcode; + } + /*var queryAll = new Tw_InOutMasterOutput() + { + ProjectId = projectid + }; var queryAllresult = GetModle(queryAll).Select(x => x.CusBillCode).Distinct().ToList();//查询所有的编号 var CusBillCodeList = temeplateDtoIns.Select(x => x.CusBillCode).Distinct().ToList(); //获取导入文件的编号 var IsContain = CusBillCodeList.Intersect(queryAllresult).ToList(); //判断导入文件中是有已存在的编号 @@ -260,7 +265,8 @@ namespace BLL responeData.code = 0; responeData.message = string.Join(",", IsContain)+ "编号已存在!"; return responeData; - } + }*/ + var CusBillCodeList = temeplateDtoIns.Select(x => x.CusBillCode).Distinct().ToList(); //获取导入文件的编号 #endregion //根据申请单编号分组插入数据 foreach (var CusBillCode in CusBillCodeList) @@ -510,6 +516,23 @@ namespace BLL return cusBillCode; } + + public static string GetDataInCusBillCode(string projectid, string unitcode) + { + + //生成规则是20240919-unitcode-AP-GR01 + string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + unitcode + "-AP-GR"; + var queryAll = new Tw_InOutMasterOutput() + { + ProjectId = projectid, + CusBillCode=cusBillCode, + }; + var queryAllresult = GetModle(queryAll).Count(); + cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0'); + return cusBillCode; + + } + /// /// 根据任务单生成出库计划单 /// @@ -655,5 +678,7 @@ namespace BLL } - } + + + } } \ No newline at end of file diff --git a/SGGL/BLL/CLGL/TwInputdetailService.cs b/SGGL/BLL/CLGL/TwInputdetailService.cs index a9cfabd5..2b8ec442 100644 --- a/SGGL/BLL/CLGL/TwInputdetailService.cs +++ b/SGGL/BLL/CLGL/TwInputdetailService.cs @@ -45,6 +45,7 @@ namespace BLL ActNum = x.ActNum, PipelineComponentCode = y.PipelineComponentCode, MaterialName = mat.MaterialName, + MaterialDef = mat.MaterialDef } ; diff --git a/SGGL/BLL/CLGL/TwInputmasterService.cs b/SGGL/BLL/CLGL/TwInputmasterService.cs index 0edabf36..f8296046 100644 --- a/SGGL/BLL/CLGL/TwInputmasterService.cs +++ b/SGGL/BLL/CLGL/TwInputmasterService.cs @@ -218,7 +218,7 @@ namespace BLL /// /// 根据计划单生成入库单 /// - public static void GenInMasterByPlanId(string planId, List detailLists) + public static void GenInMasterByPlanId(string planId, List detailLists,string remark) { //获取计划单 var planQueryModel = new Tw_InOutMasterOutput(); diff --git a/SGGL/BLL/CLGL/TwMaterialstockService.cs b/SGGL/BLL/CLGL/TwMaterialstockService.cs index d0ac9799..5e0322d3 100644 --- a/SGGL/BLL/CLGL/TwMaterialstockService.cs +++ b/SGGL/BLL/CLGL/TwMaterialstockService.cs @@ -42,7 +42,8 @@ namespace BLL ProjectId = x.ProjectId, MaterialName = mat.MaterialName, MaterialSpec = mat.MaterialSpec, - MaterialUnit = mat.MaterialUnit, + MaterialUnit = mat.MaterialUnit, + MaterialDef = mat.MaterialDef } ; diff --git a/SGGL/BLL/CLGL/TwOutputdetailService..cs b/SGGL/BLL/CLGL/TwOutputdetailService..cs index efa150b2..8b323214 100644 --- a/SGGL/BLL/CLGL/TwOutputdetailService..cs +++ b/SGGL/BLL/CLGL/TwOutputdetailService..cs @@ -27,9 +27,11 @@ namespace BLL var q = from x in Funs.DB.Tw_OutputDetail join y in Funs.DB.HJGL_Pipeline_Component on x.PipelineComponentId equals y.PipelineComponentId into yy from y in yy.DefaultIfEmpty() - join mat in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals mat.MaterialCode into mm + join mat in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals mat.MaterialCode into mm from mat in mm.DefaultIfEmpty() - join stock in Funs.DB.Tw_MaterialStock on x.MaterialCode equals stock.PipeLineMatCode into st + join master in Funs.DB.Tw_OutputMaster on x.OutputMasterId equals master.Id into masters + from master in masters.DefaultIfEmpty() + join stock in Funs.DB.Tw_MaterialStock on new { x.MaterialCode,master.WarehouseCode} equals new { MaterialCode=stock.PipeLineMatCode,stock.WarehouseCode } into st from stock in st.DefaultIfEmpty() where (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && @@ -48,7 +50,8 @@ namespace BLL MaterialName = mat.MaterialName, StockNum = stock.StockNum ?? 0, DiffNum = (x.ActNum??0) - (x.PlanNum??0), - } + MaterialDef = mat.MaterialDef + } ; return q; diff --git a/SGGL/BLL/HJGL/WeldingManage/PipelineComponentService.cs b/SGGL/BLL/HJGL/WeldingManage/PipelineComponentService.cs index f5ebd171..54061f84 100644 --- a/SGGL/BLL/HJGL/WeldingManage/PipelineComponentService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/PipelineComponentService.cs @@ -203,7 +203,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('-')).Replace("\"", ""); + model.DrawingName = model_mat.PrefabricatedComponents?.Substring(0, model_mat.PrefabricatedComponents.LastIndexOf('-')).Replace("\"", ""); model.State = state_0; model.ProductionState = 0; model.IsPrint = false; diff --git a/SGGL/BLL/HJGL/WeldingManage/PipelineService.cs b/SGGL/BLL/HJGL/WeldingManage/PipelineService.cs index e6047779..9b1f88ec 100644 --- a/SGGL/BLL/HJGL/WeldingManage/PipelineService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/PipelineService.cs @@ -340,30 +340,38 @@ namespace BLL /// public static List 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) + var q = Funs.DB.View_HJGL_WeldJoint + .Where(x => x.UnitWorkId == unitworkId) + .Select(x => new + { + x.PipelineId, + x.WeldingDate, + x.PipelineCode + }) + .Distinct() + .ToList(); // 立即执行查询并加载数据 + + if (q.Count == 0) { return new List(); } - 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(); + + // 分组并计算焊接日期不为null或空字符串的数量 + var noCompipeline = q.GroupBy(x => x.PipelineId) + .Select(g => new + { + PipelineId = g.Key, + Count = g.Count(x => !string.IsNullOrEmpty(x.WeldingDate)) // 直接计算 + }) + .ToList(); // 立即执行查询并加载数据 + + // 过滤出未完成的管道代码 + var NowComPipelineCode = noCompipeline + .Where(y => y.Count == 0) + .Join(q, y => y.PipelineId, x => x.PipelineId, (y, x) => x.PipelineCode) + .Distinct() + .ToList(); + return NowComPipelineCode; } /// diff --git a/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx b/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx index 89d31dcb..d1a6575c 100644 --- a/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx +++ b/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx @@ -30,7 +30,7 @@ ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch"> @@ -38,6 +38,7 @@ + @@ -61,6 +62,9 @@ + + @@ -73,7 +77,9 @@ - + + <%-- diff --git a/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx.cs b/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx.cs index 05deb577..9c58a5c7 100644 --- a/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx.cs +++ b/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx.cs @@ -28,7 +28,9 @@ namespace FineUIPro.Web.CLGL /// private void BindGrid() { - var tb = BLL.TwArrivalStatisticsService.GetStatistics(this.CurrUser.LoginProjectId, txtMaterialCode.Text.Trim()); + var tb = BLL.TwArrivalStatisticsService.GetStatistics(this.CurrUser.LoginProjectId, txtMaterialCode.Text.Trim()); + + lbRate.Text="匹配率:"+ Math.Round( tb.Sum(x=>x.MatchRate)*100/tb.Count() ,4) + "%"; //tb = GetFilteredTable(Grid1.FilteredData, tb); Grid1.DataSource = tb; Grid1.DataBind(); diff --git a/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx.designer.cs b/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx.designer.cs index e8989120..6c5fd013 100644 --- a/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx.designer.cs @@ -60,7 +60,7 @@ namespace FineUIPro.Web.CLGL protected global::FineUIPro.Toolbar Toolbar2; /// - /// txtMaterialCode 控件。 + /// txtMaterialCode 控件。 /// /// /// 自动生成的字段。 @@ -68,6 +68,15 @@ namespace FineUIPro.Web.CLGL /// protected global::FineUIPro.TextBox txtMaterialCode; + /// + /// lbRate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lbRate; + /// /// ToolbarFill1 控件。 /// diff --git a/SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx b/SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx index 0c681e14..69d798db 100644 --- a/SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx +++ b/SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx @@ -22,6 +22,7 @@ .f-grid-row.red { background-color: Yellow; } + @@ -40,7 +41,7 @@ ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="Id" SortDirection="DESC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" - EnableRowClickEvent="true" OnRowClick="Grid1_RowClick"> + EnableRowClickEvent="true" OnRowClick="Grid1_RowClick" OnRowCommand="Grid1_RowCommand"> @@ -107,6 +108,7 @@ + @@ -131,16 +133,16 @@ - - - + + @@ -169,9 +174,13 @@ + @@ -57,9 +59,7 @@ DataIDField="Id" EnableColumnLines="true" Height="400" EnableBigData="true" EnableTextSelection="True"> - - + diff --git a/SGGL/FineUIPro.Web/CLGL/InPlanMasterEdit.aspx.cs b/SGGL/FineUIPro.Web/CLGL/InPlanMasterEdit.aspx.cs index d6b58181..bf22a4c6 100644 --- a/SGGL/FineUIPro.Web/CLGL/InPlanMasterEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/CLGL/InPlanMasterEdit.aspx.cs @@ -88,7 +88,7 @@ namespace FineUIPro.Web.CLGL protected void btnSave_Click(object sender, EventArgs e) { - TwInputmasterService.GenInMasterByPlanId(Id, SaveDetail(Id)); + TwInputmasterService.GenInMasterByPlanId(Id, SaveDetail(Id),txtRemark.Text); ShowNotify("保存成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); } diff --git a/SGGL/FineUIPro.Web/CLGL/InPlanMasterEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/CLGL/InPlanMasterEdit.aspx.designer.cs index d106fa6f..9a638dc0 100644 --- a/SGGL/FineUIPro.Web/CLGL/InPlanMasterEdit.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/CLGL/InPlanMasterEdit.aspx.designer.cs @@ -122,6 +122,15 @@ namespace FineUIPro.Web.CLGL /// protected global::FineUIPro.TextBox txtReqUnitName; + /// + /// txtRemark 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtRemark; + /// /// Grid1 控件。 /// diff --git a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx index eff67bdd..364b789d 100644 --- a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx +++ b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx @@ -20,7 +20,7 @@ } .f-grid-row.red { - background-color: Yellow; + background-color: darkgoldenrod; } @@ -40,7 +40,7 @@ ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="Id" SortDirection="DESC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" - EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableRowClickEvent="true" OnRowClick="Grid1_RowClick"> + EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableRowClickEvent="true" OnRowClick="Grid1_RowClick" OnRowCommand="Grid1_RowCommand"> @@ -93,6 +93,7 @@ + @@ -126,7 +127,7 @@ - + + @@ -161,6 +165,10 @@ Title="编辑Tw_InOutPlanMaster" EnableIFrame="true" Height="650px" Width="1200px"> + - + + diff --git a/SGGL/FineUIPro.Web/CLGL/MaterialStock.aspx.cs b/SGGL/FineUIPro.Web/CLGL/MaterialStock.aspx.cs index 4f0467ce..4f6aefe7 100644 --- a/SGGL/FineUIPro.Web/CLGL/MaterialStock.aspx.cs +++ b/SGGL/FineUIPro.Web/CLGL/MaterialStock.aspx.cs @@ -17,6 +17,11 @@ namespace FineUIPro.Web.CLGL if (!IsPostBack) { this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString(); + drpWarehouse.DataTextField = "Text"; + drpWarehouse.DataValueField = "Value"; + drpWarehouse.DataSource = BLL.DropListService.HJGL_WarehouseCode(); + drpWarehouse.DataBind(); + Funs.FineUIPleaseSelect(this.drpWarehouse); // 绑定表格 this.BindGrid(); } @@ -29,6 +34,11 @@ namespace FineUIPro.Web.CLGL private void BindGrid() { Model.Tw_MaterialStockOutput table = new Model.Tw_MaterialStockOutput(); + table.PipeLineMatCode = txtMatCode.Text.Trim(); + if (drpWarehouse.SelectedValue!= Const._Null) + { + table.WarehouseCode = drpWarehouse.SelectedValue; + } table.ProjectId = this.CurrUser.LoginProjectId; var tb = BLL.TwMaterialstockService.GetListData(table, Grid1); Grid1.RecordCount = TwMaterialstockService.Count; @@ -218,6 +228,11 @@ namespace FineUIPro.Web.CLGL return sb.ToString(); } - #endregion + #endregion + + protected void btnSearch_Click(object sender, EventArgs e) + { + BindGrid(); + } } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/CLGL/MaterialStock.aspx.designer.cs b/SGGL/FineUIPro.Web/CLGL/MaterialStock.aspx.designer.cs index 5ff38c1d..dbee7c19 100644 --- a/SGGL/FineUIPro.Web/CLGL/MaterialStock.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/CLGL/MaterialStock.aspx.designer.cs @@ -59,6 +59,42 @@ namespace FineUIPro.Web.CLGL /// protected global::FineUIPro.Toolbar Toolbar2; + /// + /// drpWarehouse 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpWarehouse; + + /// + /// txtMatCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtMatCode; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnSearch 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSearch; + /// /// btnOut 控件。 /// diff --git a/SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx b/SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx index 903c7027..5d28b348 100644 --- a/SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx +++ b/SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx @@ -16,6 +16,10 @@ color: blue; font-weight: bold; } + .f-grid-row-summary .f-grid-cell-inner { + font-weight: bold; + color: red; + } @@ -81,19 +85,16 @@ - - + + AllowSorting="true" SortField="CusBillCode" SortDirection="ASC" OnSort="Grid1_Sort" OnRowCommand="Grid1_RowCommand" + EnableTextSelection="True" EnableRowClickEvent="true" OnRowClick="Grid1_RowClick" EnableRowGroup="true" DataRowGroupField="WeldTaskCode"> @@ -143,7 +144,8 @@ - + + @@ -163,19 +165,25 @@ - + - + + + + @@ -183,24 +191,45 @@ + runat="server" BoxFlex="1" DataKeyNames="Id" + ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="MaterialCode" EnableSummary="true" SummaryPosition="Bottom" + SortDirection="DESC" EnableRowGroup="true" DataRowGroupField="PipelineCode" AllowPaging="true" IsDatabasePaging="true" PageSize="10000"> - + - + - + - + - + + + + + + + + + @@ -222,8 +251,12 @@ EnableIFrame="true" EnableMaximize="false" Target="Top" EnableResize="false" runat="server" IsModal="true" Width="700px" Height="470px" OnClose="Window2_Close"> + - item.MatchRate) * 100, 2).ToString() + "%"; + + JObject summary = new JObject(); + //summary.Add("Major", "全部合计"); + summary.Add("MatchRateString", Rate); + + Grid3.SummaryData = summary; } #endregion @@ -220,6 +238,119 @@ namespace FineUIPro.Web.CLGL #endregion #region 维护事件 + protected void Grid1_RowCommand(object sender, GridCommandEventArgs e) + { + if (e.CommandName == "btnInPlanMasterPrint") + { + Print(e.RowID); + } + } + private void Print(string Id) + { + BLL.FastReportService.ResetData(); + if (string.IsNullOrEmpty(Id)) + { + + ShowNotify("请选择要打印的项", MessageBoxIcon.Warning); + return; + } + + Tw_InOutMasterOutput queryModel = new Tw_InOutMasterOutput() + { + Id = Id + }; + var result = TwInOutplanmasterService.GetListData(queryModel).FirstOrDefault(); + List tw_PrintMasters = new List(); + List tw_PrintDetails = new List(); + Model.Tw_PrintMaster printMaster = new Model.Tw_PrintMaster + { + + ReqUnitName = result.ReqUnitName, + CusBillCode = result.CusBillCode, + CreateDate = result.CreateDate.Value.ToString("yyyy-MM-dd"), + ProjectName = ProjectService.GetProjectNameByProjectId(result.ProjectId), + CategoryString = result.CategoryString, + BillName = TwConst.PlanPrintMap.Where(x => x.Value == result.TypeInt).Select(x => x.Key).FirstOrDefault(), + }; + tw_PrintMasters.Add(printMaster); + DataTable Table1 = LINQToDataTable(tw_PrintMasters); + if (Table1 != null) + { + Table1.TableName = "Table1"; + } + Tw_InOutPlanDetail_Relation queryModel2 = new Tw_InOutPlanDetail_Relation() + { + InOutPlanMasterId = Id + }; + var ListDetailRelation = TwInoutplandetailRelationService.GetTw_InOutPlanDetail_RelationByModle(queryModel2).ToList(); + int SortIndex = 1; + int SortIndex2 = 1; + var tw_PrintDetailRelation = (from x in ListDetailRelation + join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode + join z in Funs.DB.HJGL_Pipeline on x.PipelineId equals z.PipelineId + join m in Funs.DB.WBS_UnitWork on z.UnitWorkId equals m.UnitWorkId + select new Model.Tw_PrintDetail + { + SortIndex = SortIndex++, + PipelineCode = z.PipelineCode, + PipelineComponentCode = x.PrefabricatedComponents, + MaterialCode = y.MaterialCode, + MaterialDef = y.MaterialDef, + MaterialSpec = y.MaterialSpec, + MaterialUnit = y.MaterialUnit, + PlanNum = (x.Number ??0).ToString(), + UnitWorkName = m.UnitWorkName, + }).ToList(); + var UnitWorkName = tw_PrintDetailRelation.FirstOrDefault()?.UnitWorkName; + Tw_PrintDetail tw_PrintDetailRelation2 = new Tw_PrintDetail + { + MaterialDef = "材料编码合计" + }; + var tw_PrintDetail = (from x in Funs.DB.Tw_InOutPlanDetail + join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode + where x.InOutPlanMasterId == Id + select new Model.Tw_PrintDetail + { + SortIndex = 0, + PipelineCode = "-", + PipelineComponentCode = "-", + MaterialCode = y.MaterialCode, + MaterialDef = y.MaterialDef, + MaterialSpec = y.MaterialSpec, + MaterialUnit = y.MaterialUnit, + PlanNum = (x.PlanNum ?? 0).ToString(), + ActNum = (x.ActNum ?? 0).ToString(), + UnitWorkName = UnitWorkName, + }).ToList(); + foreach (var item in tw_PrintDetail) + { + item.SortIndex = SortIndex2++; + } + if (result.TypeInt == (int)TwConst.TypeInt.散件出库) + { + tw_PrintDetails.AddRange(tw_PrintDetailRelation); + + } + tw_PrintDetails.Add(tw_PrintDetailRelation2); + tw_PrintDetails.AddRange(tw_PrintDetail); + DataTable Data = LINQToDataTable(tw_PrintDetails); + if (Data != null) + { + Data.TableName = "Data"; + } + BLL.FastReportService.ResetData(); + BLL.FastReportService.AddFastreportTable(Table1); + BLL.FastReportService.AddFastreportTable(Data); + string initTemplatePath = ""; + string rootPath = Server.MapPath("~/"); + initTemplatePath = "File\\Fastreport\\材料出库计划单.frx"; + + if (File.Exists(rootPath + initTemplatePath)) + { + PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath))); + + } + } protected void Grid1_RowClick(object sender, GridRowClickEventArgs e) { if (e.RowIndex >= 0) @@ -415,71 +546,6 @@ namespace FineUIPro.Web.CLGL #endregion - #region 报表打印 - /// - /// 报表打印 - /// - /// - /// - protected void btnPrint_Click(object sender, EventArgs e) - { - string pipelineId = this.tvControlItem.SelectedNodeID; - var q = BLL.PipelineService.GetPipelineByPipelineId(pipelineId); - - if (q != null) - { - var jotCount = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == pipelineId select x).Count(); - var weldJotCount = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == pipelineId && x.WeldingDailyId != null select x).Count(); - if (jotCount == weldJotCount) - { - string varValue = string.Empty; - var project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId); - if (project != null) - { - varValue = project.ProjectName; - var unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(q.UnitWorkId); - if (unitWork != null) - { - varValue = varValue + "|" + unitWork.UnitWorkName; - } - } - List listStr = new List(); - listStr.Add(new SqlParameter("@IsoId", pipelineId)); - listStr.Add(new SqlParameter("@Flag", "0")); - SqlParameter[] parameter = listStr.ToArray(); - DataTable tb = BLL.SQLHelper.GetDataTableRunProc("HJGL_spJointWorkRecordNew", parameter); - string page = Funs.GetPagesCountByPageSize(11, 16, tb.Rows.Count).ToString(); - - - varValue = varValue + "|" + page; - - if (!string.IsNullOrEmpty(varValue)) - { - varValue = HttpUtility.UrlEncodeUnicode(varValue); - } - if (tb.Rows.Count <= 11) - { - PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReport1Id, pipelineId, varValue, this.CurrUser.LoginProjectId))); - } - else - { - PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReport1Id, pipelineId, varValue, this.CurrUser.LoginProjectId))); - } - } - else - { - ShowNotify("请选择焊接完成管线!", MessageBoxIcon.Warning); - return; - } - } - - else - { - ShowNotify("请选择管线!", MessageBoxIcon.Warning); - return; - } - } - #endregion #region 关闭弹出窗口及刷新页面 /// @@ -585,7 +651,6 @@ namespace FineUIPro.Web.CLGL { this.btnGenInOutMaster.Hidden = false; this.btnRevokeGenInOutMaster.Hidden = false; - this.btnPrint.Hidden = false; // this.btnMenuInOutPlanMasterEdit.Hidden = false; } if (buttonList.Contains(BLL.Const.BtnDelete)) diff --git a/SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx.designer.cs b/SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx.designer.cs index d4e274ce..01bf030f 100644 --- a/SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx.designer.cs @@ -212,15 +212,6 @@ namespace FineUIPro.Web.CLGL /// protected global::FineUIPro.Button btnRevokeGenInOutMaster; - /// - /// btnPrint 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Button btnPrint; - /// /// Grid1 控件。 /// @@ -311,6 +302,15 @@ namespace FineUIPro.Web.CLGL /// protected global::FineUIPro.Window Window2; + /// + /// Window3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window3; + /// /// Menu1 控件。 /// diff --git a/SGGL/FineUIPro.Web/CLGL/OutPlanMasterEdit.aspx b/SGGL/FineUIPro.Web/CLGL/OutPlanMasterEdit.aspx index bb8e6845..75576a8c 100644 --- a/SGGL/FineUIPro.Web/CLGL/OutPlanMasterEdit.aspx +++ b/SGGL/FineUIPro.Web/CLGL/OutPlanMasterEdit.aspx @@ -38,7 +38,7 @@ - + - - + @@ -82,16 +82,16 @@ - - - + + + diff --git a/SGGL/FineUIPro.Web/CLGL/OutPlanMasterEdit.aspx.cs b/SGGL/FineUIPro.Web/CLGL/OutPlanMasterEdit.aspx.cs index c30aec82..a5cc7869 100644 --- a/SGGL/FineUIPro.Web/CLGL/OutPlanMasterEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/CLGL/OutPlanMasterEdit.aspx.cs @@ -84,7 +84,8 @@ namespace FineUIPro.Web.CLGL { txtCreateMan.Text = this.CurrUser.PersonName; txtCreateDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); - drpReqUnit.SelectedValue = this.CurrUser.UnitId; + drpReqUnit.SelectedValue = this.CurrUser.UnitId; + txtCusBillCode.Text = TwInOutplanmasterService.GetDataInCusBillCode(this.CurrUser.LoginProjectId, this.CurrUser.UnitId); } diff --git a/SGGL/FineUIPro.Web/CLGL/OutPlanMasterSelect.aspx.cs b/SGGL/FineUIPro.Web/CLGL/OutPlanMasterSelect.aspx.cs index 9eed4e14..7b8d0010 100644 --- a/SGGL/FineUIPro.Web/CLGL/OutPlanMasterSelect.aspx.cs +++ b/SGGL/FineUIPro.Web/CLGL/OutPlanMasterSelect.aspx.cs @@ -124,14 +124,13 @@ namespace FineUIPro.Web.CLGL foreach (var item in pipeline) { TreeNode newNode = new TreeNode(); - int totalJointNum = joints.Count(x => x.PipelineId == item.PipelineId); - int weldJointNum = joints.Count(x => x.PipelineId == item.PipelineId && x.WeldingDailyId != null); + //bool istrue = BLL.HJGL_MaterialService.isInStockByPipeline(item.PipelineId, this.CurrUser.LoginProjectId); //if (istrue) //{ // newNode.CssClass = "tn-color-green"; //} - newNode.Text = item.PipelineCode + "(" + (totalJointNum - weldJointNum).ToString() + ")"; + newNode.Text = item.PipelineCode; newNode.NodeID = item.PipelineId; newNode.ToolTip = item.PipelineCode; newNode.EnableClickEvent = true; diff --git a/SGGL/FineUIPro.Web/CLGL/OutputMaster.aspx b/SGGL/FineUIPro.Web/CLGL/OutputMaster.aspx index 32fe173f..d3c4ff84 100644 --- a/SGGL/FineUIPro.Web/CLGL/OutputMaster.aspx +++ b/SGGL/FineUIPro.Web/CLGL/OutputMaster.aspx @@ -22,7 +22,7 @@ } .f-grid-row.yellow { - background-color: yellow; + background-color:darkgoldenrod; } @@ -83,10 +83,7 @@ - - + @@ -94,7 +91,7 @@ - + + @@ -160,7 +158,7 @@ <%-- + + @@ -204,6 +205,10 @@ EnableIFrame="true" EnableMaximize="false" Target="Top" EnableResize="false" runat="server" IsModal="true" Width="700px" Height="470px" OnClose="Window2_Close"> + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + @@ -231,7 +276,7 @@ IsModal="true" Width="800px" Height="560px"> - @@ -242,13 +287,22 @@ Text="删除" Icon="Delete"> - + + + +