diff --git a/.vs/SGGL_SeDin_New.slnx/v18/.wsuo b/.vs/SGGL_SeDin_New.slnx/v18/.wsuo index f2acacff..d6a76a28 100644 Binary files a/.vs/SGGL_SeDin_New.slnx/v18/.wsuo and b/.vs/SGGL_SeDin_New.slnx/v18/.wsuo differ diff --git a/.vs/SGGL_SeDin_New.slnx/v18/DocumentLayout.backup.json b/.vs/SGGL_SeDin_New.slnx/v18/DocumentLayout.backup.json index 7c674097..80b3ba54 100644 --- a/.vs/SGGL_SeDin_New.slnx/v18/DocumentLayout.backup.json +++ b/.vs/SGGL_SeDin_New.slnx/v18/DocumentLayout.backup.json @@ -67,10 +67,6 @@ "$type": "Bookmark", "Name": "ST:2:0:{b9f91511-5ca5-40ec-9726-f3e3a7e534e2}" }, - { - "$type": "Bookmark", - "Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}" - }, { "$type": "Bookmark", "Name": "ST:130:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" @@ -86,6 +82,18 @@ { "$type": "Bookmark", "Name": "ST:131:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" + }, + { + "$type": "Bookmark", + "Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}" } ] } diff --git a/.vs/SGGL_SeDin_New.slnx/v18/DocumentLayout.json b/.vs/SGGL_SeDin_New.slnx/v18/DocumentLayout.json index 3a6bdf60..80b3ba54 100644 --- a/.vs/SGGL_SeDin_New.slnx/v18/DocumentLayout.json +++ b/.vs/SGGL_SeDin_New.slnx/v18/DocumentLayout.json @@ -67,10 +67,6 @@ "$type": "Bookmark", "Name": "ST:2:0:{b9f91511-5ca5-40ec-9726-f3e3a7e534e2}" }, - { - "$type": "Bookmark", - "Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}" - }, { "$type": "Bookmark", "Name": "ST:130:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" @@ -87,13 +83,17 @@ "$type": "Bookmark", "Name": "ST:131:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" }, + { + "$type": "Bookmark", + "Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, { "$type": "Bookmark", "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" }, { "$type": "Bookmark", - "Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + "Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}" } ] } diff --git a/DataBase/版本日志/SGGLDB_V2025-10-29-001-lpf.sql b/DataBase/版本日志/SGGLDB_V2025-10-29-001-lpf.sql new file mode 100644 index 00000000..f7e33c7c --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2025-10-29-001-lpf.sql @@ -0,0 +1,103 @@ +Alter VIEW View_HJGL_InstallData + AS + WITH TwOutPutData as (select distinct twRelation.PipelineId, + outdetail.Id as TwOutputDetailId, + twRelation.MaterialCode, + master.Id as OutputMasterId + from Tw_OutputMaster master + join Tw_OutputDetail outdetail on outdetail.OutputMasterId = master.Id + join Tw_InOutPlanMaster planmaster on planmaster.Id = master.InOutPlanMasterId + join Tw_InOutPlanDetail_Relation twRelation + on twRelation.InOutPlanMasterId = planmaster.Id and + outdetail.MaterialCode = twRelation.MaterialCode + where master.TypeInt=70), + PrefabricatedData AS (SELECT pipe.PipeLineMatId as Id, + line.PipelineCode, + pipe.PrefabricatedComponents as Code, + 'Ԥ' as TypeStr, + '' as Matdef, + CAST(NULL AS DECIMAL(18, 2)) as Number, -- ȷָ + pack.PackagingCode, + trainnumber.TrainNumber, + line.FlowingSection, + line.UnitWorkId, + line.ProjectId, + pack.StackingPosition + FROM dbo.HJGL_PipeLineMat pipe + INNER JOIN dbo.HJGL_Pipeline line -- ΪINNER JOINܵ + ON pipe.PipelineId = line.PipelineId + LEFT JOIN dbo.HJGL_MaterialCodeLib lib + ON lib.MaterialCode = pipe.MaterialCode + LEFT JOIN HJGL_Pipeline_Component comonent + ON comonent.PipelineComponentCode = pipe.PrefabricatedComponents + LEFT JOIN HJGL_PackagingManageDetail packdetail + ON packdetail.PipelineComponentId = comonent.PipelineComponentId + LEFT JOIN HJGL_PackagingManage pack + ON packdetail.PackagingManageId = pack.PackagingManageId + AND pack.ProjectId = line.ProjectId -- Ŀ + LEFT JOIN HJGL_TrainNumberManage trainnumber + ON pack.TrainNumberId = trainnumber.Id + WHERE line.PipeArea = '1' + and (pipe.PrefabricatedComponents != '' + AND pipe.PrefabricatedComponents IS NOT NULL)), + LooseComponentsData AS (SELECT distinct pipe.PipeLineMatId as Id, + line.PipelineCode, + pipe.MaterialCode as Code, + 'Ԥɢ' as TypeStr, + lib.MaterialDef as Matdef, + cast( packdetail.Number as DECIMAL(18, 2)) as Number, + pack.PackagingCode, + trainnumber.TrainNumber, + line.FlowingSection, + line.UnitWorkId, + line.ProjectId, + pack.StackingPosition + FROM dbo.HJGL_PipeLineMat pipe + INNER JOIN HJGL_Pipeline line -- ΪINNER JOIN + ON pipe.PipelineId = line.PipelineId + LEFT JOIN dbo.HJGL_MaterialCodeLib lib + ON lib.MaterialCode = pipe.MaterialCode + LEFT JOIN HJGL_PackagingManageDetail packdetail + ON packdetail.MaterialCode = pipe.MaterialCode + LEFT JOIN TwOutPutData twOutPutData + ON twOutPutData.PipelineId = pipe.PipelineId and + twOutPutData.MaterialCode = packdetail.MaterialCode + LEFT JOIN HJGL_PackagingManage pack + ON packdetail.PackagingManageId = pack.PackagingManageId + AND pack.ProjectId = line.ProjectId -- Ŀ + LEFT JOIN HJGL_TrainNumberManage trainnumber + ON pack.TrainNumberId = trainnumber.Id + where line.PipeArea = '1' + and (pipe.PrefabricatedComponents is null or pipe.PrefabricatedComponents = '')) + +-- ϲ + SELECT * + FROM PrefabricatedData + UNION ALL + SELECT * + FROM LooseComponentsData +go + +INSERT INTO HJGL_PackagingManageDetail +SELECT NEWID(), + p.PackagingManageId, + HPC.PipelineId, + s.Value, + NULL, + NULL, + '2025-10-29 15:01:32.513', + 'C4A62EC0-E5D3-4EBF-A5FA-E56AA89633C0', + NULL +FROM HJGL_PackagingManage p +CROSS APPLY dbo.SplitString(p.PipelineComponentId, ',', 1) s +JOIN HJGL_Pipeline_Component HPC ON s.Value = HPC.PipelineComponentId +WHERE p.PipelineComponentId IS NOT NULL + AND p.PipelineComponentId != '' + AND NOT EXISTS ( + SELECT 1 + FROM HJGL_PackagingManageDetail pmd + WHERE pmd.PackagingManageId = p.PackagingManageId + AND pmd.PipelineId = HPC.PipelineId + AND pmd.PipelineComponentId = s.Value + -- жظֶΣԼ + ) \ No newline at end of file diff --git a/SGGL/BLL/API/HJGL/APIPackagingManageService.cs b/SGGL/BLL/API/HJGL/APIPackagingManageService.cs deleted file mode 100644 index 238a556d..00000000 --- a/SGGL/BLL/API/HJGL/APIPackagingManageService.cs +++ /dev/null @@ -1,264 +0,0 @@ -using Model; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace BLL -{ - public class APIPackagingManageService - - { - public static List GetPackagingManageList(PackagingManageInput filter, int pageIndex, int pageSize, out int totalCount) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - // base join query to include project and receive person - var baseQuery = from x in db.HJGL_PackagingManage - join n in db.Base_Project on x.ProjectId equals n.ProjectId - join m in db.Person_Persons on x.ReceiveMan equals m.PersonId into tt - from t in tt.DefaultIfEmpty() - select new { x, n, t }; - - if (filter != null) - { - if (!string.IsNullOrEmpty(filter.PackagingManageId)) - { - baseQuery = baseQuery.Where(z => z.x.PackagingManageId == filter.PackagingManageId); - } - if (!string.IsNullOrEmpty(filter.PackagingCode)) - { - baseQuery = baseQuery.Where(z => z.x.PackagingCode.Contains(filter.PackagingCode)); - } - if (!string.IsNullOrEmpty(filter.ProjectId)) - { - baseQuery = baseQuery.Where(z => z.x.ProjectId == filter.ProjectId); - } - if (!string.IsNullOrEmpty(filter.ProjectName)) - { - baseQuery = baseQuery.Where(z => z.n.ProjectName.Contains(filter.ProjectName)); - } - if (!string.IsNullOrEmpty(filter.ContactName)) - { - baseQuery = baseQuery.Where(z => z.x.ContactName.Contains(filter.ContactName)); - } - if (!string.IsNullOrEmpty(filter.ContactPhone)) - { - baseQuery = baseQuery.Where(z => z.x.ContactPhone.Contains(filter.ContactPhone)); - } - if (!string.IsNullOrEmpty(filter.StackingPosition)) - { - baseQuery = baseQuery.Where(z => z.x.StackingPosition.Contains(filter.StackingPosition)); - } - if (filter.State != null) - { - baseQuery = baseQuery.Where(z => z.x.State == filter.State); - } - if (!string.IsNullOrEmpty(filter.ReceiveMan)) - { - baseQuery = baseQuery.Where(z => z.x.ReceiveMan == filter.ReceiveMan || (z.t != null && z.t.PersonName.Contains(filter.ReceiveMan))); - } - if (!string.IsNullOrEmpty(filter.ReceiveDate)) - { - DateTime dt; - if (DateTime.TryParse(filter.ReceiveDate, out dt)) - { - var start = dt.Date; - var end = start.AddDays(1); - baseQuery = baseQuery.Where(z => z.x.ReceiveDate != null && z.x.ReceiveDate >= start && z.x.ReceiveDate < end); - } - } - if (!string.IsNullOrEmpty(filter.TrainNumberId)) - { - baseQuery = baseQuery.Where(z => z.x.TrainNumber != null && z.x.TrainNumber.Contains(filter.TrainNumberId)); - } - } - - baseQuery = baseQuery.OrderByDescending(z => (z.x.ReceiveDate ?? DateTime.MinValue)).ThenBy(z => z.x.PackagingCode); - - var q = (from z in baseQuery - select new PackagingManageDetailItem - { - PackagingManageId = z.x.PackagingManageId, - PackagingCode = z.x.PackagingCode, - ProjectName = z.n.ProjectName, - ContactName = z.x.ContactName, - ContactPhone = z.x.ContactPhone, - StackingPosition = z.x.StackingPosition, - State = z.x.State, - ReceiveMan = z.t.PersonName, - ReceiveDate = string.Format("{0:g}", z.x.ReceiveDate), - TrainNumber = z.x.TrainNumber, - }).Distinct(); - - totalCount = q.Count(); - - if (pageIndex <=0) pageIndex =1; - if (pageSize <=0) pageSize =20; - - return q.Skip((pageIndex -1) * pageSize).Take(pageSize).ToList(); - - } - } - - public static Model.PackagingManageItem GetPackagingInformationById(string projectId, string personId, string packagingManageId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - PackagingManageItem packagingManageItem = new PackagingManageItem(); - List packagingPrepipeItem = new List(); - - var q = (from x in db.HJGL_PackagingManage - join n in db.Base_Project on x.ProjectId equals n.ProjectId - join m in db.Person_Persons on x.ReceiveMan equals m.PersonId into tt - from t in tt.DefaultIfEmpty() - where x.PackagingManageId == packagingManageId - select new PackagingManageDetailItem - { - PackagingManageId = x.PackagingManageId, - PackagingCode = x.PackagingCode, - ProjectName = n.ProjectName, - ProjectId = x.ProjectId, - ContactName = x.ContactName, - ContactPhone = x.ContactPhone, - StackingPosition = x.StackingPosition, - State = x.State, - ReceiveMan = t.PersonName, - ReceiveDate = string.Format("{0:g}", x.ReceiveDate), - TrainNumber = x.TrainNumber, - }).FirstOrDefault(); - var tb_packing = (from x in db.HJGL_PackagingManage where x.PackagingManageId == packagingManageId select x).FirstOrDefault(); - var PipelineComponentIdList = tb_packing?.PipelineComponentId?.Split(','); - if (PipelineComponentIdList != null && PipelineComponentIdList.Count() > 0) - { - packagingPrepipeItem = (from x in db.HJGL_Pipeline_Component - join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId - join z in db.WBS_UnitWork on y.UnitWorkId equals z.UnitWorkId - where PipelineComponentIdList.Contains(x.PipelineComponentId) - select new PackagingPrepipeItem - { - PipelineComponentId = x.PipelineComponentId, - PipelineComponentCode = x.PipelineComponentCode, - PreUnit = "1/个", - UnitWorkName = z.UnitWorkName, - PlanStartDate = string.Format("{0:g}", y.PlanStartDate), - - }).ToList(); - } - - bool isPower = Person_PersonsService.IsGeneralUnitByPersonId(personId, projectId); - if (!isPower) - { - var roleList = Person_PersonsService.GetRoleListByProjectIdPersonId(projectId, personId); - if (roleList.Contains(Const.CQEngineer)) - { - isPower = true; - } - } - packagingManageItem.packagingManageDetailItem = q; - packagingManageItem.packagingPrepipeItems = packagingPrepipeItem; - packagingManageItem.isPower = isPower; - return packagingManageItem; - - } - - } - public static void GetPackingInfoConfirmArrival(string packagingManageId, string PersonId) - { - var q = BLL.HJGLPackagingmanageService.GetHJGL_PackagingManageById(packagingManageId); - if (q != null) - { - q.State = HJGLPackagingmanageService.state_2; - q.ReceiveMan = PersonId; - q.ReceiveDate = DateTime.Now; - HJGLPackagingmanageService.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) - { - if (string.IsNullOrEmpty(table.PipelineComponentId)) - { - table.PipelineComponentId = PipelineComponentIds; - } - else - { - HashSet set = new HashSet(); - string[] oldIds = table.PipelineComponentId.Split(','); - foreach (var id in oldIds) - { - set.Add(id); - } - string[] newIds = PipelineComponentIds.Split(','); - foreach (var id in newIds) - { - set.Add(id); - } - table.PipelineComponentId = string.Join(",", set); - - - } - } - BLL.HJGLPackagingmanageService.UpdateHJGL_PackagingManage(table); - var newDetailList = new List(); - foreach (var item in table.PipelineComponentId.Split(',')) - { - var ComponentModel = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(item); - if (ComponentModel != null) - { - var model = new Model.HJGL_PackagingManageDetail() - { - Id = SQLHelper.GetNewID(), - PackagingManageId = table.PackagingManageId, - PipelineId = ComponentModel.PipelineId, - PipelineComponentId = item, - CreateTime = DateTime.Now, - }; - newDetailList.Add(model); - } - } - HJGLPackagingmanagedetailService.DeleteByPackagingManageId(table.PackagingManageId); - HJGLPackagingmanagedetailService.AddBulk(newDetailList); - - } - } - /// - /// 新增或更新包装信息(Id为空则新增,否则更新),返回创建或更新后的Id。 - /// - public static string AddOrUpdatePackaging(Model.HJGL_PackagingManage model) - { - if (model == null) - throw new ArgumentNullException(nameof(model)); - - if (string.IsNullOrEmpty(model.PackagingManageId)) - { - // 新增 - model.PackagingManageId = SQLHelper.GetNewID(typeof(Model.HJGL_PackagingManage)); - HJGLPackagingmanageService.AddHJGL_PackagingManage(model); - return model.PackagingManageId; - } - else - { - // 修改 - var exist = HJGLPackagingmanageService.GetHJGL_PackagingManageById(model.PackagingManageId); - if (exist == null) - { - HJGLPackagingmanageService.AddHJGL_PackagingManage(model); - return model.PackagingManageId; - } - else - { - HJGLPackagingmanageService.UpdateHJGL_PackagingManage(model); - return model.PackagingManageId; - } - } - } - public static string GetNewPackagingCode(string projectId) - { - return HJGLPackagingmanageService.GetNewPackagingCode(projectId); - } - } -} diff --git a/SGGL/BLL/API/HJGL/APITrainNumberManagerService.cs b/SGGL/BLL/API/HJGL/APITrainNumberManagerService.cs index b0de9b18..900db876 100644 --- a/SGGL/BLL/API/HJGL/APITrainNumberManagerService.cs +++ b/SGGL/BLL/API/HJGL/APITrainNumberManagerService.cs @@ -16,6 +16,7 @@ namespace BLL if (model != null) { model.ReceiveDate = DateTime.Now; + model.State = ((int)TrainNumberManageService.StateInt.已验收); TrainNumberManageService.Update(model); } else @@ -25,7 +26,7 @@ namespace BLL var packManagerList = HJGLPackagingmanageService.GetPackagingManage(id); foreach (var item in packManagerList) { - BLL.APIPackagingManageService.GetPackingInfoConfirmArrival(item.PackagingManageId, PersonId); + BLL.HJGLPackagingmanageService.GetPackingInfoConfirmArrival(item.PackagingManageId, PersonId); } } @@ -89,8 +90,9 @@ namespace BLL if (string.IsNullOrEmpty(model.Id)) { // 新增 + model.Id = SQLHelper.GetNewID(typeof(Model.HJGL_TrainNumberManage)); - model.ReceiveDate = null; + model.ReceiveDate = null; TrainNumberManageService.Add(model); return model.Id; } diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj index 020661c5..c4a62083 100644 --- a/SGGL/BLL/BLL.csproj +++ b/SGGL/BLL/BLL.csproj @@ -201,7 +201,6 @@ - diff --git a/SGGL/BLL/HJGL/PreDesign/HJGLPackagingmanagedetailService.cs b/SGGL/BLL/HJGL/PreDesign/HJGLPackagingmanagedetailService.cs index 86749d7e..e0902722 100644 --- a/SGGL/BLL/HJGL/PreDesign/HJGLPackagingmanagedetailService.cs +++ b/SGGL/BLL/HJGL/PreDesign/HJGLPackagingmanagedetailService.cs @@ -19,11 +19,6 @@ namespace BLL get; set; } - public static List GetListByQueryModle(Model.HJGL_PackagingManageDetail table) - { - return GetByQueryModle(table).ToList(); - - } public static (List Data, int Total) GetListByQueryModle(Model.HJGL_PackagingManageDetail table, int pageIndex = 0, int pageSize = 20) { @@ -71,7 +66,7 @@ namespace BLL }; } - private static IQueryable GetByQueryModle(Model.HJGL_PackagingManageDetail table) + public static IQueryable GetByQueryModle(Model.HJGL_PackagingManageDetail table) { var q = from x in Funs.DB.HJGL_PackagingManageDetail select x; if (table == null) @@ -155,7 +150,17 @@ namespace BLL } } + public static void DeleteByPipelineComponentId(string pipelineComponentId) + { + Model.HJGL_PackagingManageDetail table = Funs.DB.HJGL_PackagingManageDetail.FirstOrDefault(x => x.PipelineComponentId == pipelineComponentId); + if (table != null) + { + Funs.DB.HJGL_PackagingManageDetail.DeleteOnSubmit(table); + Funs.DB.SubmitChanges(); + } + + } public static void DeleteByPackagingManageId(string packagingManageId) { diff --git a/SGGL/BLL/HJGL/PreDesign/PackagingManageService .cs b/SGGL/BLL/HJGL/PreDesign/PackagingManageService .cs index ef028fa0..a6908719 100644 --- a/SGGL/BLL/HJGL/PreDesign/PackagingManageService .cs +++ b/SGGL/BLL/HJGL/PreDesign/PackagingManageService .cs @@ -1,9 +1,11 @@ -using FineUIPro; - +using FastReport.DevComponents.DotNetBar; +using FineUIPro; +using Model; using System; using System.Collections.Generic; using System.Data; using System.Linq; +using WIA; namespace BLL { @@ -14,6 +16,13 @@ namespace BLL { #region Fields + public static Dictionary CategoryIntMap = new Dictionary + { + { "打捆" ,(int)CategoryInt.打捆}, + { "装箱" ,(int)CategoryInt.装箱}, + { "散装" ,(int)CategoryInt.散装}, + }; + /// /// 未到场 /// @@ -35,28 +44,24 @@ namespace BLL { "预制散件" ,(int)TypeInt.预制散件}, { "其他材料" ,(int)TypeInt.其他材料}, }; - public static Dictionary CategoryIntMap = new Dictionary - { - { "打捆" ,(int)CategoryInt.打捆}, - { "装箱" ,(int)CategoryInt.装箱}, - { "散装" ,(int)CategoryInt.散装}, - }; + #endregion Fields #region Enums + public enum CategoryInt : int + { + 打捆 = 10, + 装箱 = 20, + 散装 = 30, + } + public enum TypeInt : int { 预制组件 = 10, 预制散件 = 20, 其他材料 = 30, } - public enum CategoryInt : int - { - 打捆 = 10, - 装箱 = 20, - 散装 = 30, - } #endregion Enums @@ -93,6 +98,69 @@ namespace BLL db1.SubmitChanges(); } + /// + /// 新增或更新包装信息(Id为空则新增,否则更新),返回创建或更新后的Id。 + /// + /// 包装信息实体,包含包装编号、项目ID、状态等信息 + /// 创建或更新后的包装管理ID + /// 当model为null时抛出异常 + public static string AddOrUpdatePackaging(Model.HJGL_PackagingManage model) + { + if (model == null) + throw new ArgumentNullException(nameof(model)); + + if (string.IsNullOrEmpty(model.PackagingManageId)) + { + // 新增 + model.PackagingManageId = SQLHelper.GetNewID(typeof(Model.HJGL_PackagingManage)); + AddHJGL_PackagingManage(model); + return model.PackagingManageId; + } + else + { + // 修改 + var exist = GetHJGL_PackagingManageById(model.PackagingManageId); + if (exist == null) + { + AddHJGL_PackagingManage(model); + return model.PackagingManageId; + } + else + { + UpdateHJGL_PackagingManage(model); + return model.PackagingManageId; + } + } + } + + /// + /// 添加包装与预制组件关联关系 + /// + /// 包装管理ID + /// 管道组件ID + /// 当该预制组件已被包装时抛出异常 + public static void AddPipelineComponentToPackaging(string packagingManageId, string pipelineComponentId) + { + var ComponentModel = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(pipelineComponentId); + if (ComponentModel != null) + { + var model = new Model.HJGL_PackagingManageDetail() + { + Id = SQLHelper.GetNewID(), + PackagingManageId = packagingManageId, + PipelineId = ComponentModel.PipelineId, + PipelineComponentId = pipelineComponentId, + CreateTime = DateTime.Now, + CreateUser = null, + }; + HJGLPackagingmanagedetailService.Add(model); + } + } + + /// + /// 根据ID删除包装管理记录 + /// + /// 包装管理ID public static void DeleteHJGL_PackagingManageById(string PackagingManageId) { var db1 = Funs.DB; @@ -104,6 +172,30 @@ namespace BLL } } + /// + /// 删除包装与预制组件的关联关系 + /// + /// 管道组件ID + public static void DeletePipelineComponentFromPackaging(string pipelineComponentId) + { + HJGLPackagingmanagedetailService.DeleteByPipelineComponentId(pipelineComponentId); + } + + /// + /// 根据分类整数值获取分类字符串描述 + /// + /// 分类整数值(10:打捆, 20:装箱, 30:散装) + /// 分类字符串描述,如果未找到则返回空字符串 + public static string GetCategoryString(int? CategoryInt) + { + return CategoryIntMap.FirstOrDefault(c => c.Value == CategoryInt).Key; + } + + /// + /// 根据包装管理ID获取包装信息实体 + /// + /// 包装管理ID + /// 包装信息实体,如果未找到则返回null public static Model.HJGL_PackagingManage GetHJGL_PackagingManageById(string PackagingManageId) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) @@ -111,7 +203,11 @@ namespace BLL return db.HJGL_PackagingManage.FirstOrDefault(x => x.PackagingManageId == PackagingManageId); } } - + /// + /// 获取包装中所有组件的最早计划开始日期 + /// + /// 包装管理ID + /// 最早计划开始日期字符串,如果没有组件则返回空字符串 public static string GetMinPlanStartDate(string PackagingManageId) { string PlanStartDate = ""; @@ -124,6 +220,11 @@ namespace BLL return PlanStartDate; } + /// + /// 根据项目ID生成新的包装编号 + /// + /// 项目ID + /// 新包装编号,格式为:项目编号-日期-序号(如:PROJ20241029-001) public static string GetNewPackagingCode(string projectid) { string code = ProjectService.GetProjectCodeByProjectId(projectid) + "-" + string.Format("{0:yyyyMMdd}", DateTime.Now) + "-"; @@ -143,8 +244,8 @@ namespace BLL /// /// 根据项目号获取包装编号历史记录 /// - /// - /// + /// 项目ID + /// 该项目的所有包装编号列表(去重) public static List GetPackagingCode(string projectid) { Model.SGGLDB db = Funs.DB; @@ -155,25 +256,34 @@ namespace BLL } /// - /// 根据主键获取装箱明细 + /// 根据主键获取装箱明细,用于打印输出 /// - /// - /// + /// 包装管理ID + /// 包装打印输出列表,包含组件信息、单位工程、计划开始日期等 + /// + /// 根据包装类型返回不同的数据: + /// - 预制组件:从HJGL_PackagingManageDetail表获取关联的组件ID,查询详细的组件信息 + /// - 预制散件/其他材料:从HJGL_PackagingManageDetail表获取散装材料信息 + /// public static List GetPackagingDetailById(string PackagingManageId) { var model = GetHJGL_PackagingManageById(PackagingManageId); var result = new List(); if (model.TypeInt == (int)HJGLPackagingmanageService.TypeInt.预制组件) { - if (string.IsNullOrEmpty(model.PipelineComponentId)) + // 从子表HJGL_PackagingManageDetail中获取关联的组件ID + var PipelineComponentIdList = (from x in Funs.DB.HJGL_PackagingManageDetail + where x.PackagingManageId == PackagingManageId + select x.PipelineComponentId).ToList(); + if (PipelineComponentIdList == null || PipelineComponentIdList.Count == 0) return new List(); - var PipelineComponentIds = model?.PipelineComponentId.Split(','); + var query = from com in Funs.DB.HJGL_Pipeline_Component join pipe in Funs.DB.HJGL_Pipeline on com.PipelineId equals pipe.PipelineId into pipeGroup from pipe in pipeGroup.DefaultIfEmpty() join unitwork in Funs.DB.WBS_UnitWork on pipe.UnitWorkId equals unitwork.UnitWorkId into unitworkGroup from unitwork in unitworkGroup.DefaultIfEmpty() - where PipelineComponentIds.Contains(com.PipelineComponentId) + where PipelineComponentIdList.Contains(com.PipelineComponentId) orderby com.PipelineComponentCode select new Model.PackagingManagePrintOutput { @@ -183,7 +293,8 @@ namespace BLL UnitWorkName = unitwork != null ? unitwork.UnitWorkName : "", num = "1", CU = "个", - FlowingSection = pipe != null ? pipe.FlowingSection : "" + //FlowingSection = pipe != null ? pipe.FlowingSection : "" + FlowingSection = model.StackingPosition }; result = query.ToList(); } @@ -205,6 +316,88 @@ namespace BLL return result; } + /// + /// 根据ID获取包装信息(包含权限验证) + /// + /// 项目ID,用于权限验证 + /// 人员ID,用于权限验证 + /// 包装管理ID + /// 包含包装详情、组件明细和权限信息的包装管理项 + /// + /// 该方法会: + /// 1. 查询包装基本信息及关联的项目、接收人信息 + /// 2. 从子表HJGL_PackagingManageDetail中获取关联的组件ID列表 + /// 3. 根据组件ID查询详细的组件信息包括管道、单位工程等 + /// 4. 验证用户是否有操作权限(总包单位或质检工程师) + /// + public static Model.PackagingManageItem GetPackagingInformationById(string projectId, string personId, string packagingManageId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + PackagingManageItem packagingManageItem = new PackagingManageItem(); + List packagingPrepipeItem = new List(); + + var q = (from x in db.HJGL_PackagingManage + join n in db.Base_Project on x.ProjectId equals n.ProjectId + join m in db.Person_Persons on x.ReceiveMan equals m.PersonId into tt + from t in tt.DefaultIfEmpty() + where x.PackagingManageId == packagingManageId + select new PackagingManageDetailItem + { + PackagingManageId = x.PackagingManageId, + PackagingCode = x.PackagingCode, + ProjectName = n.ProjectName, + ProjectId = x.ProjectId, + ContactName = x.ContactName, + ContactPhone = x.ContactPhone, + StackingPosition = x.StackingPosition, + State = x.State, + ReceiveMan = t.PersonName, + ReceiveDate = string.Format("{0:g}", x.ReceiveDate), + TrainNumber = x.TrainNumber, + }).FirstOrDefault(); + + // 从子表HJGL_PackagingManageDetail中根据PackagingManageId获取关联的组件ID + var PipelineComponentIdList = (from x in db.HJGL_PackagingManageDetail + where x.PackagingManageId == packagingManageId + select x.PipelineComponentId).ToList(); + if (PipelineComponentIdList != null && PipelineComponentIdList.Count() > 0) + { + packagingPrepipeItem = (from x in db.HJGL_Pipeline_Component + join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId + join z in db.WBS_UnitWork on y.UnitWorkId equals z.UnitWorkId + where PipelineComponentIdList.Contains(x.PipelineComponentId) + select new PackagingPrepipeItem + { + PipelineComponentId = x.PipelineComponentId, + PipelineComponentCode = x.PipelineComponentCode, + PreUnit = "1/个", + UnitWorkName = z.UnitWorkName, + PlanStartDate = string.Format("{0:g}", y.PlanStartDate), + }).ToList(); + } + + bool isPower = Person_PersonsService.IsGeneralUnitByPersonId(personId, projectId); + if (!isPower) + { + var roleList = Person_PersonsService.GetRoleListByProjectIdPersonId(projectId, personId); + if (roleList.Contains(Const.CQEngineer)) + { + isPower = true; + } + } + packagingManageItem.packagingManageDetailItem = q; + packagingManageItem.packagingPrepipeItems = packagingPrepipeItem; + packagingManageItem.isPower = isPower; + return packagingManageItem; + } + } + + /// + /// 根据车次ID获取包装管理列表 + /// + /// 车次ID + /// 该车次关联的所有包装管理记录 public static List GetPackagingManage(string trainNumberId) { Model.SGGLDB db = Funs.DB; @@ -214,7 +407,7 @@ namespace BLL return q; } - public static (List Data, int Total) GetPackagingManageList(string projectId, string PackagingCode, int pageIndex = 0, int pageSize = 20) + public static (List Data, int Total) GetPackagingManageList(string projectId, string PackagingCode, int pageIndex = 0, int pageSize = 20) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { @@ -226,7 +419,7 @@ namespace BLL from train in trains.DefaultIfEmpty() where x.ProjectId == projectId && (string.IsNullOrEmpty(PackagingCode) || x.PackagingCode.Contains(PackagingCode)) - select new PackagingManageItem + select new PackagingManageOutput { PackagingManageId = x.PackagingManageId, PackagingCode = x.PackagingCode, @@ -262,6 +455,201 @@ namespace BLL } } + /// + /// 获取包装管理列表(带过滤条件) + /// + /// 过滤条件 + /// 页码 + /// 页大小 + /// 总记录数 + /// 包装管理列表 + public static List GetPackagingManageList(PackagingManageInput filter, int pageIndex, int pageSize, out int totalCount) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + // base join query to include project and receive person + var baseQuery = from x in db.HJGL_PackagingManage + join n in db.Base_Project on x.ProjectId equals n.ProjectId + join m in db.Person_Persons on x.ReceiveMan equals m.PersonId into tt + from t in tt.DefaultIfEmpty() + select new { x, n, t }; + + if (filter != null) + { + if (!string.IsNullOrEmpty(filter.PackagingManageId)) + { + baseQuery = baseQuery.Where(z => z.x.PackagingManageId == filter.PackagingManageId); + } + if (!string.IsNullOrEmpty(filter.PackagingCode)) + { + baseQuery = baseQuery.Where(z => z.x.PackagingCode.Contains(filter.PackagingCode)); + } + if (!string.IsNullOrEmpty(filter.ProjectId)) + { + baseQuery = baseQuery.Where(z => z.x.ProjectId == filter.ProjectId); + } + if (!string.IsNullOrEmpty(filter.ProjectName)) + { + baseQuery = baseQuery.Where(z => z.n.ProjectName.Contains(filter.ProjectName)); + } + if (!string.IsNullOrEmpty(filter.ContactName)) + { + baseQuery = baseQuery.Where(z => z.x.ContactName.Contains(filter.ContactName)); + } + if (!string.IsNullOrEmpty(filter.ContactPhone)) + { + baseQuery = baseQuery.Where(z => z.x.ContactPhone.Contains(filter.ContactPhone)); + } + if (!string.IsNullOrEmpty(filter.StackingPosition)) + { + baseQuery = baseQuery.Where(z => z.x.StackingPosition.Contains(filter.StackingPosition)); + } + if (filter.State != null) + { + baseQuery = baseQuery.Where(z => z.x.State == filter.State); + } + if (!string.IsNullOrEmpty(filter.ReceiveMan)) + { + baseQuery = baseQuery.Where(z => z.x.ReceiveMan == filter.ReceiveMan || (z.t != null && z.t.PersonName.Contains(filter.ReceiveMan))); + } + if (!string.IsNullOrEmpty(filter.ReceiveDate)) + { + DateTime dt; + if (DateTime.TryParse(filter.ReceiveDate, out dt)) + { + var start = dt.Date; + var end = start.AddDays(1); + baseQuery = baseQuery.Where(z => z.x.ReceiveDate != null && z.x.ReceiveDate >= start && z.x.ReceiveDate < end); + } + } + if (!string.IsNullOrEmpty(filter.TrainNumberId)) + { + baseQuery = baseQuery.Where(z => z.x.TrainNumber != null && z.x.TrainNumber.Contains(filter.TrainNumberId)); + } + } + + baseQuery = baseQuery.OrderByDescending(z => (z.x.ReceiveDate ?? DateTime.MinValue)).ThenBy(z => z.x.PackagingCode); + + var q = (from z in baseQuery + select new PackagingManageDetailItem + { + PackagingManageId = z.x.PackagingManageId, + PackagingCode = z.x.PackagingCode, + ProjectName = z.n.ProjectName, + ContactName = z.x.ContactName, + ContactPhone = z.x.ContactPhone, + StackingPosition = z.x.StackingPosition, + State = z.x.State, + ReceiveMan = z.t.PersonName, + ReceiveDate = string.Format("{0:g}", z.x.ReceiveDate), + TrainNumber = z.x.TrainNumber, + }).Distinct(); + + totalCount = q.Count(); + + if (pageIndex <= 0) pageIndex = 1; + if (pageSize <= 0) pageSize = 20; + + return q.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); + } + } + + /// + /// 包装到场验收,将包装状态更新为已到场并记录验收人和验收时间 + /// + /// 包装管理ID + /// 验收人员ID + /// + /// 该方法会将包装状态更新为已到场(state_2),并设置接收人和接收时间 + /// + public static void GetPackingInfoConfirmArrival(string packagingManageId, string PersonId) + { + var q = GetHJGL_PackagingManageById(packagingManageId); + if (q != null) + { + q.State = state_2; + q.ReceiveMan = PersonId; + q.ReceiveDate = DateTime.Now; + UpdateHJGL_PackagingManage(q); + } + } + + /// + /// 保存包装信息(组件明细),将组件关联到包装并更新明细表 + /// + /// 包装管理ID + /// 组件ID集合,多个ID用逗号分隔 + /// + /// 该方法会: + /// 1. 获取现有的包装明细记录中的组件ID + /// 2. 合并新旧组件ID(去重) + /// 3. 根据组件ID查询对应的管道信息 + /// 4. 删除原有的包装明细记录 + /// 5. 批量插入新的包装明细记录到HJGL_PackagingManageDetail表 + /// + public static void getSavePackagingInformationById(string packagingManageId, string PipelineComponentIds) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + // 获取现有的组件ID列表 + var existingComponentIds = (from x in db.HJGL_PackagingManageDetail + where x.PackagingManageId == packagingManageId + select x.PipelineComponentId).ToList(); + + // 合并新旧组件ID(去重) + HashSet allComponentIds = new HashSet(existingComponentIds); + if (!string.IsNullOrEmpty(PipelineComponentIds)) + { + string[] newIds = PipelineComponentIds.Split(','); + foreach (var id in newIds) + { + if (!string.IsNullOrEmpty(id)) + { + allComponentIds.Add(id); + } + } + } + + // 创建新的包装明细记录 + var newDetailList = new List(); + foreach (var item in allComponentIds) + { + var ComponentModel = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(item); + if (ComponentModel != null) + { + var model = new Model.HJGL_PackagingManageDetail() + { + Id = SQLHelper.GetNewID(), + PackagingManageId = packagingManageId, + PipelineId = ComponentModel.PipelineId, + PipelineComponentId = item, + CreateTime = DateTime.Now, + }; + newDetailList.Add(model); + } + } + + // 更新数据库:先删除旧记录,再插入新记录 + HJGLPackagingmanagedetailService.DeleteByPackagingManageId(packagingManageId); + if (newDetailList.Count > 0) + { + HJGLPackagingmanagedetailService.AddBulk(newDetailList); + } + + // 可选:同时更新主表的PipelineComponentId字段以保持兼容性 + var table = db.HJGL_PackagingManage.FirstOrDefault(x => x.PackagingManageId == packagingManageId); + if (table != null) + { + table.PipelineComponentId = string.Join(",", allComponentIds); + UpdateHJGL_PackagingManage(table); + } + } + } + + /// + /// 获取包装状态下拉框选项 + /// + /// 包装状态列表,包含状态文本和值的映射关系 public static ListItem[] GetState() { ListItem[] list = new ListItem[3]; @@ -271,19 +659,22 @@ namespace BLL return list; } + /// + /// 根据类型整数值获取类型字符串描述 + /// + /// 类型整数值(10:预制组件, 20:预制散件, 30:其他材料) + /// 类型字符串描述,如果未找到则返回空字符串 public static string GetTypeString(int? TypeInt) { return TypeIntMap.FirstOrDefault(c => c.Value == TypeInt).Key; } - public static string GetCategoryString(int? CategoryInt) - { - return CategoryIntMap.FirstOrDefault(c => c.Value == CategoryInt).Key; - } + /// - /// 管线下拉框 + /// 初始化包装编号下拉框 /// - /// 下拉框名字 - /// 是否显示请选择 + /// 下拉框控件名称 + /// 项目ID + /// 是否显示"请选择"选项 public static void InitPipelineDownList(FineUIPro.DropDownList dropName, string projectid, bool isShowPlease) { dropName.DataValueField = "string"; @@ -297,9 +688,10 @@ namespace BLL } /// - /// 形成出库单 + /// 形成出库单,将包装状态从未出库更新为已出库 /// - /// + /// 包装管理ID + /// 仅当包装状态为预出库(state_0)时才允许更新为已出库(state_1) public static void PutOutOrder(string PackagingManageId) { var model = GetHJGL_PackagingManageById(PackagingManageId); @@ -310,6 +702,10 @@ namespace BLL } } + /// + /// 更新包装管理信息 + /// + /// 包含更新后信息的包装管理实体 public static void UpdateHJGL_PackagingManage(Model.HJGL_PackagingManage newtable) { var db1 = Funs.DB; @@ -334,41 +730,6 @@ namespace BLL db1.SubmitChanges(); } } - #endregion Methods - - #region Classes - - public class PackagingManageItem - { - #region Properties - - public string Code { get; set; } - public string ContactName { get; set; } - public string ContactPhone { get; set; } - public string DriverName { get; set; } - public string DriverPhone { get; set; } - public string LicensePlateNumber { get; set; } - public string PackagingCode { get; set; } - public string PackagingManageId { get; set; } - public string PlanStartDate { get; set; } - public string ProjectId { get; set; } - public string ProjectName { get; set; } - public string ReceiveDate { get; set; } - public string ReceiveMan { get; set; } - public string StackingPosition { get; set; } - public int? State { get; set; } - public string TrainNumber { get; set; } - public string TrainNumberOld { get; set; } - public int? TypeInt { get; set; } - public string TypeString { get; set; } - public int? CategoryInt { get; set; } - public string CategoryString { get; set; } - - - #endregion Properties - } - - #endregion Classes } } \ No newline at end of file diff --git a/SGGL/BLL/HJGL/PreDesign/TrainNumberManageService.cs b/SGGL/BLL/HJGL/PreDesign/TrainNumberManageService.cs index 26e0edb0..7de5b25c 100644 --- a/SGGL/BLL/HJGL/PreDesign/TrainNumberManageService.cs +++ b/SGGL/BLL/HJGL/PreDesign/TrainNumberManageService.cs @@ -6,6 +6,14 @@ namespace BLL { public static class TrainNumberManageService { + public enum StateInt + { + 未发货 = 0, // 未发货 + 已发货 = 1, // 已发货,未验收 + 已验收 = 2, // 已验收 + + } + private static IQueryable GetByQueryModle(Model.HJGL_TrainNumberManage table) { var q = from x in Funs.DB.HJGL_TrainNumberManage select x; diff --git a/SGGL/FineUIPro.Web/File/Fastreport/装箱单.frx b/SGGL/FineUIPro.Web/File/Fastreport/装箱单.frx index b6bffbde..87887775 100644 --- a/SGGL/FineUIPro.Web/File/Fastreport/装箱单.frx +++ b/SGGL/FineUIPro.Web/File/Fastreport/装箱单.frx @@ -1,5 +1,5 @@  - + using System; using System.Collections; using System.Collections.Generic; @@ -42,7 +42,7 @@ namespace FastReport } - + diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx b/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx index 7ab340a6..5864550f 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx +++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx @@ -114,6 +114,10 @@ FieldType="String" HeaderText="流水段" HeaderTextAlign="Center" TextAlign="Left"> + + diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx.cs b/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx.cs index 0a4212f6..f77c6b58 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx.cs @@ -229,8 +229,7 @@ namespace FineUIPro.Web.HJGL.PreDesign private List BindData(int pageIndex, int pageSize, out int totalCount) { - var baseQuery=from x in Funs.DB.View_HJGL_InstallData - where x.ProjectId == this.CurrUser.LoginProjectId + var baseQuery=from x in Funs.DB.View_HJGL_InstallData select x; if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2) { diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/PackagingManageEdit.aspx.cs b/SGGL/FineUIPro.Web/HJGL/PreDesign/PackagingManageEdit.aspx.cs index 903e2f8b..c09e9289 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreDesign/PackagingManageEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/PackagingManageEdit.aspx.cs @@ -1,7 +1,9 @@ using BLL; +using Model; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; +using System.Linq; namespace FineUIPro.Web.HJGL.PreDesign { @@ -38,9 +40,15 @@ namespace FineUIPro.Web.HJGL.PreDesign if (!string.IsNullOrEmpty(PackagingManageId)) { var model = HJGLPackagingmanageService.GetHJGL_PackagingManageById(PackagingManageId); + HJGL_PackagingManageDetail filter = new HJGL_PackagingManageDetail + { + PackagingManageId = PackagingManageId + }; + var packagingDetails = HJGLPackagingmanagedetailService.GetByQueryModle(filter); + drpTypeInt.Enabled = false; txtPackagingCode.Text = model.PackagingCode; - dropPipelineComponentCode.Values = model.PipelineComponentId?.Split(','); + dropPipelineComponentCode.Values = packagingDetails.Select(x=>x.PipelineComponentId).ToArray(); txtStackingPosition.Text = model.StackingPosition; drpTrainNumber.SelectedValue = model.TrainNumberId; drpTypeInt.SelectedValue = model.TypeInt.ToString(); @@ -86,8 +94,8 @@ namespace FineUIPro.Web.HJGL.PreDesign if (string.IsNullOrEmpty(PackagingManageId)) { Model.HJGL_PackagingManage table = new Model.HJGL_PackagingManage(); - - table.PackagingManageId = SQLHelper.GetNewID(); + PackagingManageId = SQLHelper.GetNewID(); + table.PackagingManageId = PackagingManageId; table.PackagingCode = txtPackagingCode.Text; table.ProjectId = this.CurrUser.LoginProjectId; table.StackingPosition = txtStackingPosition.Text; @@ -102,10 +110,32 @@ namespace FineUIPro.Web.HJGL.PreDesign if (drpTypeInt.SelectedValue == ((int)HJGLPackagingmanageService.TypeInt.预制组件).ToString()) { table.PipelineComponentId = string.Join(",", dropPipelineComponentCode.Values); + + var newDetailList = new List(); + foreach (var item in dropPipelineComponentCode.Values) + { + var ComponentModel = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(item); + if (ComponentModel != null) + { + var model = new Model.HJGL_PackagingManageDetail() + { + Id = SQLHelper.GetNewID(), + PackagingManageId = this.PackagingManageId, + PipelineId = ComponentModel.PipelineId, + PipelineComponentId = item, + CreateTime = DateTime.Now, + CreateUser = this.CurrUser.PersonId, + }; + newDetailList.Add(model); + } + } + HJGLPackagingmanagedetailService.DeleteByPackagingManageId(this.PackagingManageId); + HJGLPackagingmanagedetailService.AddBulk(newDetailList); + } + BLL.HJGLPackagingmanageService.AddHJGL_PackagingManage(table); - PackagingManageId = table.PackagingManageId; } else { diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/PackagingManageView.aspx.cs b/SGGL/FineUIPro.Web/HJGL/PreDesign/PackagingManageView.aspx.cs index 53d9363c..5f5c87bb 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreDesign/PackagingManageView.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/PackagingManageView.aspx.cs @@ -43,37 +43,7 @@ namespace FineUIPro.Web.HJGL.PreDesign var detailList = HJGLPackagingmanageService.GetPackagingDetailById(PackagingManageId); Grid1.RecordCount = detailList.Count(); Grid1.DataSource = detailList; - Grid1.DataBind(); - - /* if (pack.TypeInt == (int)HJGL_PackagingmanageService.TypeInt.预制组件) - { - DataTable tb = BLL.HJGL_PackagingmanageService.GetPackagingDetailById(PackagingManageId); - - Grid1.RecordCount = tb.Rows.Count; - tb = GetFilteredTable(Grid1.FilteredData, tb); - var table = this.GetPagedDataTable(Grid1, tb); - Grid1.DataSource = table; - Grid1.DataBind(); - } - else - { - var result = HJGLPackagingmanagedetailService.GetPackagingData(PackagingManageId).ToList(); - var detailList = from x in result - select new - { - PipelineComponentId = x.Id, - PipelineComponentCode = x.MaterialCode, - num = x.Number, - CU = x.MaterialUnit, - UnitWorkName = x.UnitWorkId == null ? "" : UnitWorkService.GetNameById(x.UnitWorkId), - x.FlowingSection, - }; - Grid1.RecordCount = detailList.Count(); - Grid1.DataSource = detailList; - Grid1.DataBind(); - }*/ - - + Grid1.DataBind(); } #endregion diff --git a/SGGL/Model/HJGL/PreDesign/PackagingManage/PackagingManageOutput.cs b/SGGL/Model/HJGL/PreDesign/PackagingManage/PackagingManageOutput.cs new file mode 100644 index 00000000..e9a984ac --- /dev/null +++ b/SGGL/Model/HJGL/PreDesign/PackagingManage/PackagingManageOutput.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + public class PackagingManageOutput + { + #region Properties + + public string Code { get; set; } + public string ContactName { get; set; } + public string ContactPhone { get; set; } + public string DriverName { get; set; } + public string DriverPhone { get; set; } + public string LicensePlateNumber { get; set; } + public string PackagingCode { get; set; } + public string PackagingManageId { get; set; } + public string PlanStartDate { get; set; } + public string ProjectId { get; set; } + public string ProjectName { get; set; } + public string ReceiveDate { get; set; } + public string ReceiveMan { get; set; } + public string StackingPosition { get; set; } + public int? State { get; set; } + public string TrainNumber { get; set; } + public string TrainNumberOld { get; set; } + public int? TypeInt { get; set; } + public string TypeString { get; set; } + public int? CategoryInt { get; set; } + public string CategoryString { get; set; } + + + #endregion Properties + } + +} diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index ac4c0abe..2c4c0b2c 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -12267,7 +12267,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ApproveIdea", DbType="NVarChar(2000)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ApproveIdea", DbType="NVarChar(200)")] public string ApproveIdea { get @@ -97820,10 +97820,10 @@ namespace Model private string _TrainNumber; - private System.Nullable _TypeInt; - private string _TrainNumberId; + private System.Nullable _TypeInt; + private string _CompileMan; private System.Nullable _CompileDate; @@ -97858,10 +97858,10 @@ namespace Model partial void OnReceiveDateChanged(); partial void OnTrainNumberChanging(string value); partial void OnTrainNumberChanged(); - partial void OnTypeIntChanging(System.Nullable value); - partial void OnTypeIntChanged(); partial void OnTrainNumberIdChanging(string value); partial void OnTrainNumberIdChanged(); + partial void OnTypeIntChanging(System.Nullable value); + partial void OnTypeIntChanged(); partial void OnCompileManChanging(string value); partial void OnCompileManChanged(); partial void OnCompileDateChanging(System.Nullable value); @@ -98115,26 +98115,6 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TypeInt", DbType="Int")] - public System.Nullable TypeInt - { - get - { - return this._TypeInt; - } - set - { - if ((this._TypeInt != value)) - { - this.OnTypeIntChanging(value); - this.SendPropertyChanging(); - this._TypeInt = value; - this.SendPropertyChanged("TypeInt"); - this.OnTypeIntChanged(); - } - } - } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TrainNumberId", DbType="VarChar(50)")] public string TrainNumberId { @@ -98155,6 +98135,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TypeInt", DbType="Int")] + public System.Nullable TypeInt + { + get + { + return this._TypeInt; + } + set + { + if ((this._TypeInt != value)) + { + this.OnTypeIntChanging(value); + this.SendPropertyChanging(); + this._TypeInt = value; + this.SendPropertyChanged("TypeInt"); + this.OnTypeIntChanged(); + } + } + } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompileMan", DbType="NVarChar(50)")] public string CompileMan { @@ -109402,7 +109402,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Rectification", DbType="NVarChar(500)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Rectification", DbType="NVarChar(50)")] public string Rectification { get @@ -109528,7 +109528,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Measures", DbType="NVarChar(500)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Measures", DbType="NVarChar(50)")] public string Measures { get @@ -162243,7 +162243,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AttentPerson", DbType="NVarChar(3000)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AttentPerson", DbType="NVarChar(500)")] public string AttentPerson { get @@ -193226,7 +193226,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectDescription", DbType="VarChar(MAX)", UpdateCheck=UpdateCheck.Never)] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectDescription", DbType="VarChar(255)")] public string ProjectDescription { get @@ -193346,7 +193346,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CalculationRule", DbType="VarChar(MAX)", UpdateCheck=UpdateCheck.Never)] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CalculationRule", DbType="VarChar(255)")] public string CalculationRule { get @@ -193406,7 +193406,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ConstructionSubcontractor", DbType="VarChar(100)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ConstructionSubcontractor", DbType="VarChar(50)")] public string ConstructionSubcontractor { get @@ -193790,7 +193790,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPackageEstimate", DbType="Decimal(18,3)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPackageEstimate", DbType="Decimal(18,2)")] public System.Nullable WorkPackageEstimate { get @@ -194095,16 +194095,6 @@ namespace Model private string _ProjectId; - private string _ContractId; - - private string _OrderCode; - - private System.Nullable _OrderInDate; - - private System.Nullable _OrderOutDate; - - private string _MaterialRequisitionUnit; - private System.Nullable _State; private string _InvoiceCode; @@ -194133,6 +194123,16 @@ namespace Model private string _CreateUser; + private string _ContractId; + + private System.Nullable _OrderInDate; + + private string _OrderCode; + + private System.Nullable _OrderOutDate; + + private string _MaterialRequisitionUnit; + #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -194141,16 +194141,6 @@ namespace Model partial void OnInvoiceIdChanged(); partial void OnProjectIdChanging(string value); partial void OnProjectIdChanged(); - partial void OnContractIdChanging(string value); - partial void OnContractIdChanged(); - partial void OnOrderCodeChanging(string value); - partial void OnOrderCodeChanged(); - partial void OnOrderInDateChanging(System.Nullable value); - partial void OnOrderInDateChanged(); - partial void OnOrderOutDateChanging(System.Nullable value); - partial void OnOrderOutDateChanged(); - partial void OnMaterialRequisitionUnitChanging(string value); - partial void OnMaterialRequisitionUnitChanged(); partial void OnStateChanging(System.Nullable value); partial void OnStateChanged(); partial void OnInvoiceCodeChanging(string value); @@ -194179,6 +194169,16 @@ namespace Model partial void OnCreateDateChanged(); partial void OnCreateUserChanging(string value); partial void OnCreateUserChanged(); + partial void OnContractIdChanging(string value); + partial void OnContractIdChanged(); + partial void OnOrderInDateChanging(System.Nullable value); + partial void OnOrderInDateChanged(); + partial void OnOrderCodeChanging(string value); + partial void OnOrderCodeChanged(); + partial void OnOrderOutDateChanging(System.Nullable value); + partial void OnOrderOutDateChanged(); + partial void OnMaterialRequisitionUnitChanging(string value); + partial void OnMaterialRequisitionUnitChanged(); #endregion public PHTGL_Invoice() @@ -194226,106 +194226,6 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContractId", DbType="NVarChar(50)")] - public string ContractId - { - get - { - return this._ContractId; - } - set - { - if ((this._ContractId != value)) - { - this.OnContractIdChanging(value); - this.SendPropertyChanging(); - this._ContractId = value; - this.SendPropertyChanged("ContractId"); - this.OnContractIdChanged(); - } - } - } - - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderCode", DbType="NVarChar(50)")] - public string OrderCode - { - get - { - return this._OrderCode; - } - set - { - if ((this._OrderCode != value)) - { - this.OnOrderCodeChanging(value); - this.SendPropertyChanging(); - this._OrderCode = value; - this.SendPropertyChanged("OrderCode"); - this.OnOrderCodeChanged(); - } - } - } - - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderInDate", DbType="Date")] - public System.Nullable OrderInDate - { - get - { - return this._OrderInDate; - } - set - { - if ((this._OrderInDate != value)) - { - this.OnOrderInDateChanging(value); - this.SendPropertyChanging(); - this._OrderInDate = value; - this.SendPropertyChanged("OrderInDate"); - this.OnOrderInDateChanged(); - } - } - } - - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderOutDate", DbType="Date")] - public System.Nullable OrderOutDate - { - get - { - return this._OrderOutDate; - } - set - { - if ((this._OrderOutDate != value)) - { - this.OnOrderOutDateChanging(value); - this.SendPropertyChanging(); - this._OrderOutDate = value; - this.SendPropertyChanged("OrderOutDate"); - this.OnOrderOutDateChanged(); - } - } - } - - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialRequisitionUnit", DbType="NVarChar(100)")] - public string MaterialRequisitionUnit - { - get - { - return this._MaterialRequisitionUnit; - } - set - { - if ((this._MaterialRequisitionUnit != value)) - { - this.OnMaterialRequisitionUnitChanging(value); - this.SendPropertyChanging(); - this._MaterialRequisitionUnit = value; - this.SendPropertyChanged("MaterialRequisitionUnit"); - this.OnMaterialRequisitionUnitChanged(); - } - } - } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_State", DbType="Int")] public System.Nullable State { @@ -194606,6 +194506,106 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContractId", DbType="NVarChar(50)")] + public string ContractId + { + get + { + return this._ContractId; + } + set + { + if ((this._ContractId != value)) + { + this.OnContractIdChanging(value); + this.SendPropertyChanging(); + this._ContractId = value; + this.SendPropertyChanged("ContractId"); + this.OnContractIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderInDate", DbType="Date")] + public System.Nullable OrderInDate + { + get + { + return this._OrderInDate; + } + set + { + if ((this._OrderInDate != value)) + { + this.OnOrderInDateChanging(value); + this.SendPropertyChanging(); + this._OrderInDate = value; + this.SendPropertyChanged("OrderInDate"); + this.OnOrderInDateChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderCode", DbType="NVarChar(50)")] + public string OrderCode + { + get + { + return this._OrderCode; + } + set + { + if ((this._OrderCode != value)) + { + this.OnOrderCodeChanging(value); + this.SendPropertyChanging(); + this._OrderCode = value; + this.SendPropertyChanged("OrderCode"); + this.OnOrderCodeChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderOutDate", DbType="Date")] + public System.Nullable OrderOutDate + { + get + { + return this._OrderOutDate; + } + set + { + if ((this._OrderOutDate != value)) + { + this.OnOrderOutDateChanging(value); + this.SendPropertyChanging(); + this._OrderOutDate = value; + this.SendPropertyChanged("OrderOutDate"); + this.OnOrderOutDateChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialRequisitionUnit", DbType="NVarChar(100)")] + public string MaterialRequisitionUnit + { + get + { + return this._MaterialRequisitionUnit; + } + set + { + if ((this._MaterialRequisitionUnit != value)) + { + this.OnMaterialRequisitionUnitChanging(value); + this.SendPropertyChanging(); + this._MaterialRequisitionUnit = value; + this.SendPropertyChanged("MaterialRequisitionUnit"); + this.OnMaterialRequisitionUnitChanged(); + } + } + } + public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -290638,6 +290638,8 @@ namespace Model private string _ProjectId; + private string _StackingPosition; + public View_HJGL_InstallData() { } @@ -290817,6 +290819,22 @@ namespace Model } } } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StackingPosition", DbType="NVarChar(50)")] + public string StackingPosition + { + get + { + return this._StackingPosition; + } + set + { + if ((this._StackingPosition != value)) + { + this._StackingPosition = value; + } + } + } } [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.View_HJGL_JointInfoQuery")] @@ -314162,7 +314180,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="NVarChar(200)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="NVarChar(50)")] public string Name { get @@ -314739,7 +314757,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(200)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(50)")] public string PackageContent { get @@ -314930,7 +314948,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(200)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(50)")] public string PackageContent { get @@ -320269,7 +320287,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(200)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(50)")] public string PackageContent { get @@ -321741,7 +321759,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(200)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(50)")] public string PackageContent { get @@ -331292,7 +331310,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContractNo", DbType="NVarChar(1500)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContractNo", DbType="NVarChar(500)")] public string ContractNo { get @@ -331312,7 +331330,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitWorks", DbType="NVarChar(1500)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitWorks", DbType="NVarChar(500)")] public string UnitWorks { get diff --git a/SGGL/Model/Model.csproj b/SGGL/Model/Model.csproj index c0dcf251..016a5a9d 100644 --- a/SGGL/Model/Model.csproj +++ b/SGGL/Model/Model.csproj @@ -238,6 +238,7 @@ + diff --git a/SGGL/WebAPI/Controllers/HJGL/PreDesign/PackagingManageController.cs b/SGGL/WebAPI/Controllers/HJGL/PreDesign/PackagingManageController.cs index 8fce3d3a..ff4691c2 100644 --- a/SGGL/WebAPI/Controllers/HJGL/PreDesign/PackagingManageController.cs +++ b/SGGL/WebAPI/Controllers/HJGL/PreDesign/PackagingManageController.cs @@ -14,6 +14,29 @@ namespace WebAPI.Controllers /// public class PackagingManageController : ApiController { + #region Methods + + /// + /// 删除包装与预制组件的关联 + /// + /// + /// + [HttpGet] + public Model.ResponeData DeletePipelineComponentFromPackaging(string pipelineComponentId) + { + var responeData = new Model.ResponeData(); + try + { + HJGLPackagingmanageService.DeletePipelineComponentFromPackaging(pipelineComponentId); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + /// /// 获取指定包装信息 /// @@ -26,7 +49,32 @@ namespace WebAPI.Controllers var responeData = new Model.ResponeData(); try { - responeData.data = BLL.APIPackagingManageService.GetPackagingInformationById(projectId, personId, packagingManageId); + responeData.data = BLL.HJGLPackagingmanageService.GetPackagingInformationById(projectId, personId, packagingManageId); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + + /// + /// 获取包装信息列表 + /// + /// 过滤条件 + /// 每页数量 + /// 页码(从1开始) + /// 包装信息分页列表 + public Model.ResponeData GetPackagingInformationList([FromUri] PackagingManageInput filter, int pagesize, int pageindex) + { + var responeData = new Model.ResponeData(); + try + { + var getDataList = BLL.HJGLPackagingmanageService.GetPackagingManageList(filter, pageindex, pagesize, out int totalCount); + + responeData.data = new { totalCount, getDataList }; } catch (Exception ex) { @@ -47,7 +95,7 @@ namespace WebAPI.Controllers var responeData = new Model.ResponeData(); try { - responeData.data = BLL.APIPackagingManageService.GetNewPackagingCode(projectId); + responeData.data = BLL.HJGLPackagingmanageService.GetNewPackagingCode(projectId); } catch (Exception ex) { @@ -56,32 +104,6 @@ namespace WebAPI.Controllers } return responeData; } - - /// - /// 获取包装信息列表 - /// - /// 过滤条件 - /// 每页数量 - /// 页码(从1开始) - /// 包装信息分页列表 - public Model.ResponeData GetPackagingInformationList([FromUri]PackagingManageInput filter, int pagesize, int pageindex) - { - var responeData = new Model.ResponeData(); - try - { - var getDataList = BLL.APIPackagingManageService.GetPackagingManageList(filter, pageindex, pagesize, out int totalCount); - - responeData.data = new { totalCount, getDataList }; - - } - catch (Exception ex) - { - responeData.code = 0; - responeData.message = ex.Message; - } - - return responeData; - } /// /// 包装到场验收 /// @@ -93,7 +115,7 @@ namespace WebAPI.Controllers var responeData = new Model.ResponeData(); try { - BLL.APIPackagingManageService.GetPackingInfoConfirmArrival(packagingManageId, PersonId); + BLL.HJGLPackagingmanageService.GetPackingInfoConfirmArrival(packagingManageId, PersonId); } catch (Exception ex) { @@ -115,7 +137,7 @@ namespace WebAPI.Controllers var responeData = new Model.ResponeData(); try { - BLL.APIPackagingManageService.getSavePackagingInformationById(packagingManageId, PipelineComponentIds); + BLL.HJGLPackagingmanageService.getSavePackagingInformationById(packagingManageId, PipelineComponentIds); } catch (Exception ex) { @@ -125,6 +147,7 @@ namespace WebAPI.Controllers return responeData; } + /// /// 新增或更新包装信息(Id为空则新增,否则更新),返回创建或更新后的Id。 /// @@ -136,7 +159,7 @@ namespace WebAPI.Controllers var responeData = new Model.ResponeData(); try { - var id = APIPackagingManageService.AddOrUpdatePackaging(model); + var id = HJGLPackagingmanageService.AddOrUpdatePackaging(model); responeData.data = new { id }; } catch (Exception ex) @@ -155,6 +178,7 @@ namespace WebAPI.Controllers /// 操作结果 [HttpGet] public Model.ResponeData SavePackingInformation(string packagingManageId, string trainNumberId) + { var responeData = new Model.ResponeData(); try @@ -182,6 +206,29 @@ namespace WebAPI.Controllers } return responeData; } - + + /// + /// 添加包装与预制组件关联关系 + /// + /// + /// + /// + [HttpGet] + public Model.ResponeData SavePipelineComponentToPackaging(string packagingManageId, string pipelineComponentId) + { + var responeData = new Model.ResponeData(); + try + { + HJGLPackagingmanageService.AddPipelineComponentToPackaging(packagingManageId, pipelineComponentId); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + + #endregion Methods } } \ No newline at end of file