diff --git a/.vs/SGGL_SeDin_New/v17/.wsuo b/.vs/SGGL_SeDin_New/v17/.wsuo index 96fcf830..9980bd21 100644 Binary files a/.vs/SGGL_SeDin_New/v17/.wsuo and b/.vs/SGGL_SeDin_New/v17/.wsuo differ diff --git a/DataBase/版本日志/SGGLDB_V2024-09-24.sql b/DataBase/版本日志/SGGLDB_V2024-09-24.sql new file mode 100644 index 00000000..c502077a --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2024-09-24.sql @@ -0,0 +1,98 @@ + +INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES (N'FD1ED6C2-93BD-412F-A0B6-661F44339CA8', N'BCCA4D81-410C-4746-B1E4-F882BC3A25F4', N'޸', 4); +go +alter table dbo.Tw_InOutPlanMaster + add AuditMan nvarchar(50) +go + +exec sp_addextendedproperty 'MS_Description', N'', 'SCHEMA', 'dbo', 'TABLE', 'Tw_InOutPlanMaster', 'COLUMN', + 'AuditMan' +go + +alter table dbo.Tw_InOutPlanMaster + add AuditDate datetime +go + +exec sp_addextendedproperty 'MS_Description', N'ʱ', 'SCHEMA', 'dbo', 'TABLE', 'Tw_InOutPlanMaster', 'COLUMN', + 'AuditDate' +go +alter table dbo.Tw_InputMaster + add AuditMan nvarchar(50) +go + +exec sp_addextendedproperty 'MS_Description', N'', 'SCHEMA', 'dbo', 'TABLE', 'Tw_InputMaster', 'COLUMN', + 'AuditMan' +go + +alter table dbo.Tw_InputMaster + add AuditDate datetime +go + +exec sp_addextendedproperty 'MS_Description', N'ʱ', 'SCHEMA', 'dbo', 'TABLE', 'Tw_InputMaster', 'COLUMN', + 'AuditDate' +go +alter table dbo.Tw_OutputMaster + add AuditMan nvarchar(50) +go + +exec sp_addextendedproperty 'MS_Description', N'', 'SCHEMA', 'dbo', 'TABLE', 'Tw_OutputMaster', 'COLUMN', + 'AuditMan' +go + +alter table dbo.Tw_OutputMaster + add AuditDate datetime +go + +exec sp_addextendedproperty 'MS_Description', N'ʱ', 'SCHEMA', 'dbo', 'TABLE', 'Tw_OutputMaster', 'COLUMN', + 'AuditDate' +go +alter table dbo.Tw_InOutPlanMaster + add Remark nvarchar(200) +go +alter table dbo.Tw_InputMaster + add Remark nvarchar(200) +go +alter table dbo.Tw_InOutPlanMaster + add AuditMan2 nvarchar(50) +go + +exec sp_addextendedproperty 'MS_Description', N'ר', 'SCHEMA', 'dbo', 'TABLE', 'Tw_InOutPlanMaster', 'COLUMN', + 'AuditMan2' +go + +alter table dbo.Tw_InOutPlanMaster + add AuditDate2 datetime +go + +exec sp_addextendedproperty 'MS_Description', N'רʱ', 'SCHEMA', 'dbo', 'TABLE', 'Tw_InOutPlanMaster', 'COLUMN', + 'AuditDate2' +go + + + +alter table dbo.HJGL_PipeLineMat + add IsLooseParts BIT +go + +exec sp_addextendedproperty 'MS_Description', N'Ƿɢ', 'SCHEMA', 'dbo', 'TABLE', 'HJGL_PipeLineMat', 'COLUMN', + 'IsLooseParts' +go + + + + + + +-- auto-generated definition +create table dbo.Tw_InOutPlanDetail_Relation +( + Id nvarchar(50) not null + constraint Tw_InOutPlanDetail_Relation_pk + primary key, + PipelineId nvarchar(50), + InOutPlanMasterId nvarchar(50), + MaterialCode nvarchar(50), + PrefabricatedComponents nvarchar(100), + Number decimal(9, 2), +) +go \ No newline at end of file diff --git a/DataBase/菜单初始化脚本/1-5焊接管理(Menu_HJGL).sql b/DataBase/菜单初始化脚本/1-5焊接管理(Menu_HJGL).sql index a72dea5c..1d2fb0b4 100644 --- a/DataBase/菜单初始化脚本/1-5焊接管理(Menu_HJGL).sql +++ b/DataBase/菜单初始化脚本/1-5焊接管理(Menu_HJGL).sql @@ -568,6 +568,69 @@ GO --INSERT INTO Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) VALUES('A1BF9B3A-A9FB-4442-A68C-489C48139EC7','6324E66A-4760-4D10-9EA6-88B792EEAEAF','鿴',1) --GO + + INSERT INTO dbo.Sys_Menu (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed) +VALUES (N'9B828E92-733B-4AF9-9DD0-55ECD8B64AB8', N'Ϲ', null, N'', 16, N'0', N'Menu_HJGL', 0, 0, 1); +go + INSERT INTO dbo.Sys_Menu (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed) + VALUES (N'E29C1839-3530-45EC-A752-B26A0027E2CD', N'', null, N'', 20, N'9B828E92-733B-4AF9-9DD0-55ECD8B64AB8', N'Menu_HJGL', 0, 0, 1); + go + INSERT INTO dbo.Sys_Menu (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed) + VALUES (N'324C72AF-447A-4308-AFB7-ABF788C58240', N'', null, N'CLGL/InPlanMaster.aspx', 10, N'E29C1839-3530-45EC-A752-B26A0027E2CD', N'Menu_HJGL', 0, 1, 1); + go + INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES (N'E752513A-55FA-4001-9126-C236905AA1FD', N'324C72AF-447A-4308-AFB7-ABF788C58240', N'', 1); + go + INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES (N'1EC8735B-0726-4340-9312-27C5A05BE4AD', N'324C72AF-447A-4308-AFB7-ABF788C58240', N'', 2); + go + INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES (N'63A38163-DCA0-4444-8A50-40507D48EB4A', N'324C72AF-447A-4308-AFB7-ABF788C58240', N'ɾ', 3); + go + INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES (N'8F3CD189-C233-40C0-A096-6CDB820A6CA8', N'324C72AF-447A-4308-AFB7-ABF788C58240', N'޸', 4); + go + INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES (N'F06E072B-73F5-473E-B03E-8DA392E68BAC', N'324C72AF-447A-4308-AFB7-ABF788C58240', N'', 4); + go + INSERT INTO dbo.Sys_Menu (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed) + VALUES (N'4A55351A-2440-4A2D-8509-3FFEE5FC8861', N'ⵥ', null, N'CLGL/InputMaster.aspx', 20, N'E29C1839-3530-45EC-A752-B26A0027E2CD', N'Menu_HJGL', 0, 1, 1); + + go + INSERT INTO dbo.Sys_Menu (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed) + VALUES (N'16A22282-4966-4946-B0F8-855E1300AE2B', N'', null, N'', 30, N'9B828E92-733B-4AF9-9DD0-55ECD8B64AB8', N'Menu_HJGL', 0, 0, 1); + go + INSERT INTO dbo.Sys_Menu (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed) + VALUES (N'E910F410-07FB-41C3-AA80-8E30D1563BC1', N'', null, N'CLGL/OutPlanMaster.aspx', 10, N'16A22282-4966-4946-B0F8-855E1300AE2B', N'Menu_HJGL', 0, 1, 1); + go + INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES (N'3B78F59D-AB75-42DD-B07D-AC952672D317', N'E910F410-07FB-41C3-AA80-8E30D1563BC1', N'', 1); + go + INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES (N'4EC606B1-5315-4779-8B53-C51EF94127E9', N'E910F410-07FB-41C3-AA80-8E30D1563BC1', N'', 2); + go + INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES (N'E41A9D51-C215-49DE-B5B1-7415FF85D910', N'E910F410-07FB-41C3-AA80-8E30D1563BC1', N'ɾ', 3); + go + INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES (N'79344E58-A7F2-4583-A1CD-058E4C7DD882', N'E910F410-07FB-41C3-AA80-8E30D1563BC1', N'޸', 4); + go + INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES (N'052CA576-108B-4FBC-966B-2B228509E570', N'E910F410-07FB-41C3-AA80-8E30D1563BC1', N'', 4); + go + INSERT INTO dbo.Sys_Menu (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed) + VALUES (N'BCCA4D81-410C-4746-B1E4-F882BC3A25F4', N'ⵥ', null, N'CLGL/OutputMaster.aspx', 20, N'16A22282-4966-4946-B0F8-855E1300AE2B', N'Menu_HJGL', 0, 1, 1); + go + INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES (N'FD1ED6C2-93BD-412F-A0B6-661F44339CA8', N'BCCA4D81-410C-4746-B1E4-F882BC3A25F4', N'޸', 4); + go + + go + INSERT INTO dbo.Sys_Menu (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed) + VALUES (N'9579C717-769E-4CC0-9E54-EE03D87C15A5', N'', null, N'', 40, N'9B828E92-733B-4AF9-9DD0-55ECD8B64AB8', N'Menu_HJGL', 0, 0, 1); + go + INSERT INTO dbo.Sys_Menu (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed) + VALUES (N'803F9828-52FA-4EF7-99C7-ADA99DADE9FB', N'', null, N'CLGL/MaterialStock.aspx', 10, N'9579C717-769E-4CC0-9E54-EE03D87C15A5', N'Menu_HJGL', 0, 1, 1); + go + INSERT INTO dbo.Sys_Menu (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed) + VALUES (N'D15E534F-98F3-4B8A-8656-EAF165DE917F', N'̵', null, N'CLGL/MaterialStock.aspx', 20, N'9579C717-769E-4CC0-9E54-EE03D87C15A5', N'Menu_HJGL', 0, 1, 1); +go + INSERT INTO dbo.Sys_Menu (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed) + VALUES (N'C05EF3BE-AB13-4852-B2AA-1095BE4EEB2F', N'', null, N'CLGL/ArrivalStatistics.aspx', 30, N'9579C717-769E-4CC0-9E54-EE03D87C15A5', N'Menu_HJGL', 0, 1, 1); + + go + /* INSERT INTO dbo.Sys_Menu (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed) + VALUES (N'818B8FAE-6939-44F0-B911-14FD717AF03C', N'鵵', null, N'', 50, N'9B828E92-733B-4AF9-9DD0-55ECD8B64AB8', N'Menu_HJGL', 0, 0, 1); +*/ diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj index 5d2e5ebd..fa1294ee 100644 --- a/SGGL/BLL/BLL.csproj +++ b/SGGL/BLL/BLL.csproj @@ -56,8 +56,9 @@ ..\packages\EmitMapper.1.0.0\lib\EmitMapper.dll - - ..\FineUIPro\Reference BLL\FineUIPro.dll + + False + ..\FineUIPro\FineUIPro.dll ..\packages\SharpZipLib.1.3.3\lib\net45\ICSharpCode.SharpZipLib.dll @@ -264,6 +265,7 @@ + diff --git a/SGGL/BLL/CLGL/TwConst.cs b/SGGL/BLL/CLGL/TwConst.cs index 4c4bd62a..2f56b6d0 100644 --- a/SGGL/BLL/CLGL/TwConst.cs +++ b/SGGL/BLL/CLGL/TwConst.cs @@ -1,38 +1,38 @@ using System.Collections.Generic; -namespace BLL; - -public class TwConst +namespace BLL { - public enum InOutType : int + public class TwConst { - 入库 = 1, - 出库 = 2, - } - public enum TypeInt : int - { - 采购入库 = 10, - 退料入库 = 20, - 其他入库 = 30, - 领料出库 = 40, - 补料出库 = 50, - 其他出库 = 60, - } - public enum Category : int - { - 全部 = 0, - 管件 = 1, - 管段 = 2, - } - public enum State : int - { - 审核被拒 = -1, - 待提交 = 0, - 待审核 = 1, - 已审核 = 2, - 已完成 = 3, - } - public static Dictionary TypeIntMap = new Dictionary + public enum InOutType : int + { + 入库 = 1, + 出库 = 2, + } + public enum TypeInt : int + { + 采购入库 = 10, + 退料入库 = 20, + 其他入库 = 30, + 领料出库 = 40, + 补料出库 = 50, + 其他出库 = 60, + } + public enum Category : int + { + 全部 = 0, + 管件 = 1, + 管段 = 2, + } + public enum State : int + { + 审核被拒 = -1, + 待提交 = 0, + 待审核 = 1, + 已审核 = 2, + 已完成 = 3, + } + public static Dictionary TypeIntMap = new Dictionary { { "采购入库" ,(int)TypeInt.采购入库}, { "退料入库" ,(int)TypeInt.退料入库}, @@ -41,7 +41,7 @@ public class TwConst { "补料出库" ,(int)TypeInt.补料出库}, { "其他出库" ,(int)TypeInt.其他出库} }; - public static Dictionary StateMap = new Dictionary + public static Dictionary StateMap = new Dictionary { { "待提交" ,(int)State.待提交}, { "待审核" ,(int)State.待审核}, @@ -49,9 +49,10 @@ public class TwConst { "已完成" ,(int)State.已完成}, { "审核被拒" ,(int)State.审核被拒}, }; - public static Dictionary CategoryMap = new Dictionary + public static Dictionary CategoryMap = new Dictionary { { "管件" ,(int)Category.管件}, - { "管段" ,(int)Category.管段}, + { "管段" ,(int)Category.管段}, }; + } } \ No newline at end of file diff --git a/SGGL/BLL/CLGL/TwInOutplandetailRelationService.cs b/SGGL/BLL/CLGL/TwInOutplandetailRelationService.cs new file mode 100644 index 00000000..4dedfa16 --- /dev/null +++ b/SGGL/BLL/CLGL/TwInOutplandetailRelationService.cs @@ -0,0 +1,200 @@ +using FineUIPro; +using Model; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; + + +namespace BLL +{ + + public static class TwInoutplandetailRelationService + { + + + + #region 获取列表 + /// + /// 记录数 + /// + public static int Count + { + get; + set; + } + public static IQueryable GetTw_InOutPlanDetail_RelationByModle(Model.Tw_InOutPlanDetail_Relation table) + { + var q = from x in Funs.DB.Tw_InOutPlanDetail_Relation + where + (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && + (string.IsNullOrEmpty(table.PipelineId) || x.PipelineId.Contains(table.PipelineId)) && + (string.IsNullOrEmpty(table.InOutPlanMasterId) || x.InOutPlanMasterId.Contains(table.InOutPlanMasterId)) && + (string.IsNullOrEmpty(table.MaterialCode) || x.MaterialCode.Contains(table.MaterialCode)) && + (string.IsNullOrEmpty(table.PrefabricatedComponents) || x.PrefabricatedComponents.Contains(table.PrefabricatedComponents)) + select x + ; + + return q; + } + + /// + /// 获取分页列表 + /// + /// + /// + /// + public static IEnumerable GetListData(Model.Tw_InOutPlanDetail_Relation table, Grid grid1) + { + var q = GetTw_InOutPlanDetail_RelationByModle(table); + Count = q.Count(); + if (Count == 0) + { + return null; + } + q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize); + // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); + return from x in q + join y in Funs.DB.HJGL_Pipeline on x.PipelineId equals y.PipelineId + join mat in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals mat.MaterialCode into mm + from mat in mm.DefaultIfEmpty() + orderby x.PipelineId, x.PrefabricatedComponents + select new + { + x.Id, + x.PipelineId, + y.PipelineCode, + x.InOutPlanMasterId, + x.MaterialCode, + x.PrefabricatedComponents, + x.Number, + mat.MaterialName, + + }; + } + #endregion + + public static Model.Tw_InOutPlanDetail_Relation GetById(string Id) + { + return Funs.DB.Tw_InOutPlanDetail_Relation.FirstOrDefault(x => x.Id == Id); + } + + + public static void Add(Model.Tw_InOutPlanDetail_Relation newtable) + { + + Model.Tw_InOutPlanDetail_Relation table = new Model.Tw_InOutPlanDetail_Relation + { + Id = newtable.Id, + PipelineId = newtable.PipelineId, + InOutPlanMasterId = newtable.InOutPlanMasterId, + MaterialCode = newtable.MaterialCode, + PrefabricatedComponents = newtable.PrefabricatedComponents, + Number = newtable.Number, + }; + Funs.DB.Tw_InOutPlanDetail_Relation.InsertOnSubmit(table); + Funs.DB.SubmitChanges(); + } + /// + /// 批量添加计划明细 + /// + /// + /// + public static void AddList(IEnumerable list, string inoutPlanMasterId) + { + foreach (var item in list) + { + item.Id = SQLHelper.GetNewID(); + item.InOutPlanMasterId = inoutPlanMasterId; + Add(item); + } + } + + public static void Update(Model.Tw_InOutPlanDetail_Relation newtable) + { + + Model.Tw_InOutPlanDetail_Relation table = Funs.DB.Tw_InOutPlanDetail_Relation.FirstOrDefault(x => x.Id == newtable.Id); + if (table != null) + { + table.Id = newtable.Id; + table.PipelineId = newtable.PipelineId; + table.InOutPlanMasterId = newtable.InOutPlanMasterId; + table.MaterialCode = newtable.MaterialCode; + table.PrefabricatedComponents = newtable.PrefabricatedComponents; + table.Number = newtable.Number; + Funs.DB.SubmitChanges(); + } + + } + public static void DeleteById(string Id) + { + + Model.Tw_InOutPlanDetail_Relation table = Funs.DB.Tw_InOutPlanDetail_Relation.FirstOrDefault(x => x.Id == Id); + if (table != null) + { + Funs.DB.Tw_InOutPlanDetail_Relation.DeleteOnSubmit(table); + Funs.DB.SubmitChanges(); + } + + } + public static void DeleteByInOutPlanMasterId(string inoutPlanMasterId) + { + var list = Funs.DB.Tw_InOutPlanDetail_Relation.Where(x => x.InOutPlanMasterId == inoutPlanMasterId); + if (list != null) + { + Funs.DB.Tw_InOutPlanDetail_Relation.DeleteAllOnSubmit(list); + Funs.DB.SubmitChanges(); + } + } + + public static void InsertByPipeLineMat(string inOutPlanMasterId, List tw_PipeLineMats) + { + var master =TwInOutplanmasterService.GetById(inOutPlanMasterId); + if (master == null) + { + return; + } + var outMateriaList = from x in tw_PipeLineMats + group x by new { x.MaterialCode, x.MaterialUnit } + into g + select new + { + g.Key.MaterialCode, + planNum = g.Sum(x => x.Number) ?? 0, + MaterialName = g.Key.MaterialUnit, + }; + + switch (master.Category) + { + case (int)TwConst.Category.管段: + outMateriaList.Where(x => x.MaterialName.Contains("米"));//管段 + break; + case (int)TwConst.Category.管件: + outMateriaList.Where(x => x.MaterialName.Contains("个"));//管件 + break; + } + + foreach (var item in outMateriaList) + { + Model.Tw_InOutPlanDetail detail = new Model.Tw_InOutPlanDetail + { + Id = Guid.NewGuid().ToString(), + InOutPlanMasterId = inOutPlanMasterId, + MaterialCode = item.MaterialCode, + PlanNum = item.planNum, + }; + TwInOutplandetailService.Add(detail); + } + var twinoutplandetailRelationList = tw_PipeLineMats.Select(x => new Tw_InOutPlanDetail_Relation + { + PipelineId = x.PipelineId, + MaterialCode = x.MaterialCode, + Number = x.Number, + PrefabricatedComponents = x.PrefabricatedComponents, + }).ToList(); + TwInoutplandetailRelationService.AddList(twinoutplandetailRelationList, inOutPlanMasterId); + + } + } +} \ No newline at end of file diff --git a/SGGL/BLL/CLGL/TwInOutplandetailService.cs b/SGGL/BLL/CLGL/TwInOutplandetailService.cs index 60c2338a..3719d426 100644 --- a/SGGL/BLL/CLGL/TwInOutplandetailService.cs +++ b/SGGL/BLL/CLGL/TwInOutplandetailService.cs @@ -74,8 +74,6 @@ namespace BLL { return Funs.DB.Tw_InOutPlanDetail.FirstOrDefault(x => x.Id == Id); } - - public static void Add(Model.Tw_InOutPlanDetail newtable) { if (string.IsNullOrEmpty(newtable.Id)) @@ -136,7 +134,6 @@ namespace BLL } } - public static void DeleteByInOutPlanMasterId (string inoutPlanMasterId) { var list = Funs.DB.Tw_InOutPlanDetail.Where(x => x.InOutPlanMasterId == inoutPlanMasterId); @@ -147,5 +144,30 @@ namespace BLL } } + public static void GenInOutPlanDetailByInoutPlanMasterId(string inOutPlanMasterId) + { + var list = Funs.DB.Tw_InOutPlanDetail_Relation.Where(x => x.InOutPlanMasterId == inOutPlanMasterId).ToList(); + var outMateriaList = from x in list + group x by x.MaterialCode + into g + select new + { + g.Key, + planNum = g.Sum(x => x.Number) ?? 0 + }; + TwInOutplandetailService.DeleteByInOutPlanMasterId(inOutPlanMasterId); + foreach (var item in outMateriaList) + { + Model.Tw_InOutPlanDetail detail = new Model.Tw_InOutPlanDetail + { + Id = Guid.NewGuid().ToString(), + InOutPlanMasterId = inOutPlanMasterId, + MaterialCode = item.Key, + PlanNum = item.planNum, + }; + TwInOutplandetailService.Add(detail); + } + + } } } \ No newline at end of file diff --git a/SGGL/BLL/CLGL/TwInOutplanmasterService.cs b/SGGL/BLL/CLGL/TwInOutplanmasterService.cs index bc5c6677..00310faf 100644 --- a/SGGL/BLL/CLGL/TwInOutplanmasterService.cs +++ b/SGGL/BLL/CLGL/TwInOutplanmasterService.cs @@ -35,6 +35,10 @@ namespace BLL from y in yy.DefaultIfEmpty() join person in Funs.DB.Person_Persons on x.CreateMan equals person.PersonId into persons from person in persons.DefaultIfEmpty() + join auditperson in Funs.DB.Person_Persons on x.AuditMan equals auditperson.PersonId into auditpersons + from auditperson in auditpersons.DefaultIfEmpty() + join auditperson2 in Funs.DB.Person_Persons on x.AuditMan2 equals auditperson2.PersonId into auditpersons2 + from auditperson2 in auditpersons2.DefaultIfEmpty() join unit in Funs.DB.Base_Unit on x.ReqUnitId equals unit.UnitId into units from unit in units.DefaultIfEmpty() where @@ -69,7 +73,13 @@ namespace BLL ReqUnitId = x.ReqUnitId, ReqUnitName = unit.UnitName, UnitWorkId = y.UnitWorkId, - WeldTaskCode = y.TaskCode + WeldTaskCode = y.TaskCode, + AuditMan = x.AuditMan, + AuditManName = auditperson.PersonName, + AuditDate = x.AuditDate, + Remark = x.Remark, + AuditManName2 = auditperson2.PersonName, + AuditDate2 = x.AuditDate2, } ; @@ -82,43 +92,6 @@ namespace BLL /// /// /// - public static IEnumerable GetListData(Model.Tw_InOutMasterOutput table, Grid grid1) - { - - var q = GetModle(table); - Count = q.Count(); - if (Count == 0) - { - return null; - } - var result = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize).ToList(); - // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); - return from x in result - select new Model.Tw_InOutMasterOutput - { - Id = x.Id, - ProjectId = x.ProjectId, - CusBillCode = x.CusBillCode, - WarehouseCode = x.WarehouseCode, - Source = x.Source, - InOutType = x.InOutType, - TypeInt = x.TypeInt, - Category = x.Category, - State = x.State, - CreateMan = x.CreateMan, - CreateManName = x.CreateManName, - CreateDate = x.CreateDate, - OutputMasterId = x.OutputMasterId, - WeldTaskId = x.WeldTaskId, - ReqUnitId = x.ReqUnitId, - ReqUnitName = x.ReqUnitName, - UnitWorkId = x.UnitWorkId, - WeldTaskCode= x.WeldTaskId!=null? x.WeldTaskId.Contains('|')? Funs.DB.HJGL_WeldTask.FirstOrDefault(e => e.UnitWorkId == x.WeldTaskId.Split('|')[0].ToString() && e.UnitId == x.WeldTaskId.Split('|')[1].ToString() && e.TaskDate.Value.Date == Convert.ToDateTime(x.WeldTaskId.Split('|')[2].ToString()).Date)?.TaskCode :"":"", - CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key, - TypeString = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key, - StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key - }; - } public static List GetListData(Model.Tw_InOutMasterOutput table) { @@ -154,10 +127,61 @@ namespace BLL WeldTaskCode = x.WeldTaskId != null ? x.WeldTaskId.Contains('|') ? Funs.DB.HJGL_WeldTask.FirstOrDefault(e => e.UnitWorkId == x.WeldTaskId.Split('|')[0].ToString() && e.UnitId == x.WeldTaskId.Split('|')[1].ToString() && e.TaskDate.Value.Date == Convert.ToDateTime(x.WeldTaskId.Split('|')[2].ToString()).Date)?.TaskCode : "" : "", CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key, TypeString = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key, - StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key + StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key, + AuditMan = x.AuditMan, + AuditManName = x.AuditManName, + AuditDate = x.AuditDate, + Remark = x.Remark, + AuditManName2 = x.AuditManName2, + AuditDate2 = x.AuditDate2, }).ToList(); } + public static IEnumerable GetListData(Model.Tw_InOutMasterOutput table, Grid grid1) + { + + var q = GetModle(table); + Count = q.Count(); + if (Count == 0) + { + return null; + } + var result = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize).ToList(); + // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); + return from x in result + select new Model.Tw_InOutMasterOutput + { + Id = x.Id, + ProjectId = x.ProjectId, + CusBillCode = x.CusBillCode, + WarehouseCode = x.WarehouseCode, + Source = x.Source, + InOutType = x.InOutType, + TypeInt = x.TypeInt, + Category = x.Category, + State = x.State, + CreateMan = x.CreateMan, + CreateManName = x.CreateManName, + CreateDate = x.CreateDate, + OutputMasterId = x.OutputMasterId, + WeldTaskId = x.WeldTaskId, + ReqUnitId = x.ReqUnitId, + ReqUnitName = x.ReqUnitName, + UnitWorkId = x.UnitWorkId, + WeldTaskCode = x.WeldTaskId != null ? x.WeldTaskId.Contains('|') ? Funs.DB.HJGL_WeldTask.FirstOrDefault(e => e.UnitWorkId == x.WeldTaskId.Split('|')[0].ToString() && e.UnitId == x.WeldTaskId.Split('|')[1].ToString() && e.TaskDate.Value.Date == Convert.ToDateTime(x.WeldTaskId.Split('|')[2].ToString()).Date)?.TaskCode : "" : "", + CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key, + TypeString = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key, + StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key, + AuditMan = x.AuditMan, + AuditManName = x.AuditManName, + AuditDate = x.AuditDate, + Remark = x.Remark, + AuditManName2 = x.AuditManName2, + AuditDate2 = x.AuditDate2, + }; + } + + #endregion /// @@ -167,7 +191,7 @@ namespace BLL /// /// /// - public static ResponeData ImportData(string path, string projectid, string creatUserId) + public static ResponeData ImportData(string OriFileName,string path, string projectid, string creatUserId) { var responeData = new ResponeData(); List temeplateDtoIns; @@ -259,6 +283,7 @@ namespace BLL twInOutPlanMaster.ProjectId = projectid; twInOutPlanMaster.CreateMan = creatUserId; twInOutPlanMaster.CreateDate = DateTime.Now; + twInOutPlanMaster.Remark = OriFileName; Add(twInOutPlanMaster); TwInOutplandetailService.AddList(twInOutPlanDetails, twInOutPlanMaster.Id); //插入入库明细 @@ -290,6 +315,11 @@ namespace BLL OutputMasterId = newtable.OutputMasterId, WeldTaskId = newtable.WeldTaskId, ReqUnitId = newtable.ReqUnitId, + AuditMan = newtable.AuditMan, + AuditDate = newtable.AuditDate, + Remark = newtable.Remark, + AuditMan2=newtable.AuditMan2, + AuditDate2=newtable.AuditDate2, }; Funs.DB.Tw_InOutPlanMaster.InsertOnSubmit(table); Funs.DB.SubmitChanges(); @@ -314,6 +344,11 @@ namespace BLL table.OutputMasterId = newtable.OutputMasterId; table.WeldTaskId = newtable.WeldTaskId; table.ReqUnitId = newtable.ReqUnitId; + table.AuditMan = newtable.AuditMan; + table.AuditDate = newtable.AuditDate; + table.Remark = newtable.Remark; + table.AuditMan2 = newtable.AuditMan2; + table.AuditDate2 = newtable.AuditDate2; Funs.DB.SubmitChanges(); } @@ -325,6 +360,7 @@ namespace BLL if (table != null) { TwInOutplandetailService.DeleteByInOutPlanMasterId(table.Id); + TwInoutplandetailRelationService.DeleteByInOutPlanMasterId(table.Id); Funs.DB.Tw_InOutPlanMaster.DeleteOnSubmit(table); Funs.DB.SubmitChanges(); @@ -405,7 +441,7 @@ namespace BLL Source = 2, Category = outMaster.Category, TypeInt = outMaster.TypeInt, - State = (int)TwConst.State.待审核, + State = (int)TwConst.State.已审核, CreateMan = outMaster.CreateMan, CreateDate = DateTime.Now, ReqUnitId = outMaster.ReqUnitId, @@ -473,5 +509,151 @@ namespace BLL } return cusBillCode; } + + /// + /// 根据任务单生成出库计划单 + /// + /// + /// + /// + /// + public static void GenOutPlanmasterByWeldTaskId(string unitworkid,string unitid,DateTime date,string Personid) + { + Model.SGGLDB db = Funs.DB; + Model.View_HJGL_WeldingTask weldTask = db.View_HJGL_WeldingTask.FirstOrDefault(e => e.UnitWorkId==unitworkid && e.UnitId==unitid&& e.TaskDate.Value.Date==date.Date); + if (weldTask==null) + { + return; + } + string WeldTaskId= unitworkid+"|"+unitid+ "|" + string.Format("{0:yyyyMMMMdd}", date); + //判断是否已经生成过出库计划单 + var queryIsExitInMaster = new Tw_InOutMasterOutput(); + queryIsExitInMaster.WeldTaskId = WeldTaskId; + queryIsExitInMaster.InOutType=(int)TwConst.InOutType.出库; + queryIsExitInMaster.TypeInt = (int)TwConst.TypeInt.领料出库; + var IsExitInMaster = TwInOutplanmasterService.GetModle(queryIsExitInMaster).FirstOrDefault(); + if (IsExitInMaster != null) + { + return; + } + var pipelineList = db.View_HJGL_WeldingTask.Where(e => e.UnitWorkId == unitworkid && e.UnitId == unitid && e.TaskDate.Value.Date == date.Date).Select(x=>x.PipelineId).Distinct().ToList(); + + var MaterDatial= from x in db.HJGL_PipeLineMat + join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode + where pipelineList.Contains(x.PipelineId) + select new + { + x.PipelineId, + x.PrefabricatedComponents, + x.MaterialCode, + x.Number, + y.MaterialUnit, + }; + //var outMateriaList = from x in db.HJGL_PipeLineMat + // join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode + // where pipelineList.Contains(x.PipelineId) + // group x by new { x.MaterialCode, y.MaterialUnit } + // into g + // select new + // { + // g.Key.MaterialCode, + // planNum = g.Sum(x => x.Number) ?? 0, + // MaterialName = g.Key.MaterialUnit, + // }; + var outMateriaList = from x in MaterDatial + group x by new { x.MaterialCode, x.MaterialUnit } + into g + select new + { + g.Key.MaterialCode, + planNum = g.Sum(x => x.Number) ?? 0, + MaterialName = g.Key.MaterialUnit, + }; + + var outPlanDetailListPiece = outMateriaList.Where(x => x.MaterialName.Contains("个"));//管件 + var outPlanDetailListOthere = outMateriaList.Where(x => x.MaterialName.Contains("米"));//管段 + var weldTaskCode = WeldTaskService.GetWeldTaskById(weldTask.WeldTaskId)?.TaskCode; + if (outPlanDetailListPiece.Any()) + { + Model.Tw_InOutPlanMaster table = new Model.Tw_InOutPlanMaster + { + Id = Guid.NewGuid().ToString(), + ProjectId = weldTask.ProjectId, + // CusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + UnitService.GetUnitCodeByUnitId(weldTask.UnitId) + "-" + UnitWorkService.getUnitWorkByUnitWorkId(weldTask.UnitWorkId)?.UnitWorkCode + "AP-PF01", + CusBillCode=TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode,TwConst.TypeInt.领料出库,TwConst.Category.管件), + WarehouseCode = PipelineService.GetPipeArea().Where(x => x.Value == PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).PipeArea).Select(x => x.Text).FirstOrDefault(), + Source = 1, + InOutType = (int)TwConst.InOutType.出库, + TypeInt = (int)TwConst.TypeInt.领料出库, + State = (int)TwConst.State.待审核, + Category = (int)TwConst.Category.管件, + CreateMan = Personid, + CreateDate = DateTime.Now, + WeldTaskId = WeldTaskId, + ReqUnitId = weldTask.UnitId, + }; + TwInOutplanmasterService.Add(table); + foreach (var item in outPlanDetailListPiece) + { + Model.Tw_InOutPlanDetail detail = new Model.Tw_InOutPlanDetail + { + Id = Guid.NewGuid().ToString(), + InOutPlanMasterId = table.Id, + MaterialCode = item.MaterialCode, + PlanNum = item.planNum, + }; + TwInOutplandetailService.Add(detail); + } + var twinoutplandetailRelationList = MaterDatial.ToList().Select(x => new Tw_InOutPlanDetail_Relation + { + PipelineId = x.PipelineId, + MaterialCode = x.MaterialCode, + Number = x.Number, + PrefabricatedComponents = x.PrefabricatedComponents, + }).ToList(); + TwInoutplandetailRelationService.AddList(twinoutplandetailRelationList, table.Id); + } + if (outPlanDetailListOthere.Any()) + { + Model.Tw_InOutPlanMaster table = new Model.Tw_InOutPlanMaster + { + Id = Guid.NewGuid().ToString(), + ProjectId = weldTask.ProjectId, + CusBillCode =TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt.领料出库, TwConst.Category.管段), + WarehouseCode = PipelineService.GetPipeArea().Where(x => x.Value == PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).PipeArea).Select(x => x.Text).FirstOrDefault(), + Source = 1, + InOutType = (int)TwConst.InOutType.出库, + TypeInt = (int)TwConst.TypeInt.领料出库, + State = (int)TwConst.State.待审核, + Category = (int)TwConst.Category.管段, + CreateMan = Personid, + CreateDate = DateTime.Now, + WeldTaskId = WeldTaskId, + ReqUnitId = weldTask.UnitId, + }; + TwInOutplanmasterService.Add(table); + foreach (var item in outPlanDetailListOthere) + { + Model.Tw_InOutPlanDetail detail = new Model.Tw_InOutPlanDetail + { + Id = Guid.NewGuid().ToString(), + InOutPlanMasterId = table.Id, + MaterialCode = item.MaterialCode, + PlanNum = item.planNum, + }; + TwInOutplandetailService.Add(detail); + } + var twinoutplandetailRelationList = MaterDatial.ToList().Select(x => new Tw_InOutPlanDetail_Relation + { + PipelineId = x.PipelineId, + MaterialCode = x.MaterialCode, + Number = x.Number, + PrefabricatedComponents = x.PrefabricatedComponents, + }).ToList(); + TwInoutplandetailRelationService.AddList(twinoutplandetailRelationList, table.Id); + } + + + } } } \ No newline at end of file diff --git a/SGGL/BLL/CLGL/TwInputmasterService.cs b/SGGL/BLL/CLGL/TwInputmasterService.cs index 3f199d99..0edabf36 100644 --- a/SGGL/BLL/CLGL/TwInputmasterService.cs +++ b/SGGL/BLL/CLGL/TwInputmasterService.cs @@ -26,10 +26,13 @@ namespace BLL var q = from x in Funs.DB.Tw_InputMaster join person in Funs.DB.Person_Persons on x.CreateMan equals person.PersonId into persons from person in persons.DefaultIfEmpty() + join auditperson in Funs.DB.Person_Persons on x.AuditMan equals auditperson.PersonId into auditpersons + from auditperson in auditpersons.DefaultIfEmpty() join unit in Funs.DB.Base_Unit on x.ReqUnitId equals unit.UnitId into units from unit in units.DefaultIfEmpty() where (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && + (string.IsNullOrEmpty(table.InOutPlanMasterId) || x.InOutPlanMasterId.Contains(table.InOutPlanMasterId)) && (string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) && (string.IsNullOrEmpty(table.CusBillCode) || x.CusBillCode.Contains(table.CusBillCode)) && (string.IsNullOrEmpty(table.WarehouseCode) || x.WarehouseCode.Contains(table.WarehouseCode)) && @@ -53,7 +56,11 @@ namespace BLL CreateManName = person.PersonName, CreateDate = x.CreateDate, ReqUnitId = x.ReqUnitId, - ReqUnitName = unit.UnitName, + ReqUnitName = unit.UnitName, + AuditMan = x.AuditMan, + AuditManName = auditperson.PersonName, + AuditDate = x.AuditDate, + Remark = x.Remark }; return q; @@ -94,7 +101,11 @@ namespace BLL Category = x.Category, CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key, TypeString = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key, - StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key + StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key, + AuditMan = x.AuditMan, + AuditManName = x.AuditManName, + AuditDate = x.AuditDate, + Remark=x.Remark }; } @@ -127,7 +138,11 @@ namespace BLL Category = x.Category, CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key, TypeString = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key, - StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key + StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key, + AuditMan = x.AuditMan, + AuditManName = x.AuditManName, + AuditDate = x.AuditDate, + Remark = x.Remark }).ToList(); } #endregion @@ -155,6 +170,9 @@ namespace BLL CreateMan = newtable.CreateMan, CreateDate = newtable.CreateDate, ReqUnitId = newtable.ReqUnitId, + AuditMan= newtable.AuditMan, + AuditDate = newtable.AuditDate, + Remark = newtable.Remark }; Funs.DB.Tw_InputMaster.InsertOnSubmit(table); Funs.DB.SubmitChanges(); @@ -178,6 +196,9 @@ namespace BLL table.CreateMan = newtable.CreateMan; table.CreateDate = newtable.CreateDate; table.ReqUnitId = newtable.ReqUnitId; + table.AuditMan = newtable.AuditMan; + table.AuditDate = newtable.AuditDate; + table.Remark = newtable.Remark; Funs.DB.SubmitChanges(); } @@ -197,7 +218,7 @@ namespace BLL /// /// 根据计划单生成入库单 /// - public static void GenInMasterByPlanId(string planId) + public static void GenInMasterByPlanId(string planId, List detailLists) { //获取计划单 var planQueryModel = new Tw_InOutMasterOutput(); @@ -231,6 +252,9 @@ namespace BLL CreateMan = plan.CreateMan, CreateDate = DateTime.Now, ReqUnitId = plan.ReqUnitId, + AuditMan = plan.CreateMan, + AuditDate = plan.AuditDate, + Remark=plan.Remark }; if ((TwConst.TypeInt)plan.TypeInt!= TwConst.TypeInt.采购入库) { @@ -238,24 +262,25 @@ namespace BLL (BLL.TwConst.Category)plan.Category); } + else + { + master.CusBillCode= plan.CusBillCode.Replace("-AP", ""); + } Add(master); //生成明细 - Tw_InOutDetailOutput query = new Tw_InOutDetailOutput(); - query.InOutPlanMasterId= planId; - var details = TwInOutplandetailService.GetByModle(query).ToList(); - foreach (var detail in details) + foreach (var detail in detailLists) { var detailTable = new Model.Tw_InputDetail() { Id = Guid.NewGuid().ToString(), InputMasterId = master.Id, MaterialCode = detail.MaterialCode, - PlanNum = detail.PlanNum, - ActNum = detail.PlanNum, + PlanNum = detail.PlanNum, + ActNum = detail.ActNum, }; - TwInputdetailService.Add(detailTable); - TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseCode, TwConst.InOutType.入库, detailTable.ActNum); - + TwInputdetailService.Add(detailTable); + TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseCode, TwConst.InOutType.入库, detailTable.ActNum); + } plan.State= (int)TwConst.State.已完成; TwInOutplanmasterService.Update(plan); diff --git a/SGGL/BLL/CLGL/TwOutputdetailService..cs b/SGGL/BLL/CLGL/TwOutputdetailService..cs index 7918960b..efa150b2 100644 --- a/SGGL/BLL/CLGL/TwOutputdetailService..cs +++ b/SGGL/BLL/CLGL/TwOutputdetailService..cs @@ -1,4 +1,5 @@ using FineUIPro; +using NPOI.OpenXmlFormats.Wordprocessing; using System; using System.Collections; using System.Collections.Generic; @@ -28,6 +29,8 @@ namespace BLL 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() + join stock in Funs.DB.Tw_MaterialStock on x.MaterialCode equals stock.PipeLineMatCode into st + from stock in st.DefaultIfEmpty() where (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && (string.IsNullOrEmpty(table.OutputMasterId) || x.OutputMasterId.Contains(table.OutputMasterId)) && @@ -43,7 +46,9 @@ namespace BLL ActNum = x.ActNum, PipelineComponentCode = y.PipelineComponentCode, MaterialName = mat.MaterialName, - } + StockNum = stock.StockNum ?? 0, + DiffNum = (x.ActNum??0) - (x.PlanNum??0), + } ; return q; diff --git a/SGGL/BLL/CLGL/TwOutputmasterService.cs b/SGGL/BLL/CLGL/TwOutputmasterService.cs index cc1edff1..7195ff87 100644 --- a/SGGL/BLL/CLGL/TwOutputmasterService.cs +++ b/SGGL/BLL/CLGL/TwOutputmasterService.cs @@ -32,7 +32,9 @@ namespace BLL //from z in zz.DefaultIfEmpty() join person in Funs.DB.Person_Persons on x.CreateMan equals person.PersonId into persons from person in persons.DefaultIfEmpty() - join unit in Funs.DB.Base_Unit on x.ReqUnitId equals unit.UnitId into units + join auditperson in Funs.DB.Person_Persons on x.AuditMan equals auditperson.PersonId into auditpersons + from auditperson in auditpersons.DefaultIfEmpty() + join unit in Funs.DB.Base_Unit on x.ReqUnitId equals unit.UnitId into units from unit in units.DefaultIfEmpty() where (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && @@ -62,7 +64,10 @@ namespace BLL CreateDate = x.CreateDate, ReqUnitId = x.ReqUnitId, ReqUnitName = unit.UnitName, - WeldTaskId = y.WeldTaskId, + WeldTaskId = y.WeldTaskId, + AuditMan = x.AuditMan, + AuditManName = auditperson.PersonName, + AuditDate = x.AuditDate, }; return q; @@ -105,6 +110,9 @@ namespace BLL CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key, WeldTaskId = x.WeldTaskId, WeldTaskCode = x.WeldTaskId != null ? x.WeldTaskId.Contains('|') ? Funs.DB.HJGL_WeldTask.FirstOrDefault(e => e.UnitWorkId == x.WeldTaskId.Split('|')[0].ToString() && e.UnitId == x.WeldTaskId.Split('|')[1].ToString() && e.TaskDate.Value.Date == Convert.ToDateTime(x.WeldTaskId.Split('|')[2].ToString()).Date)?.TaskCode : "" : "", + AuditMan = x.AuditMan, + AuditManName = x.AuditManName, + AuditDate = x.AuditDate }; } @@ -140,6 +148,9 @@ namespace BLL CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key, WeldTaskId = x.WeldTaskId, WeldTaskCode = x.WeldTaskId != null ? x.WeldTaskId.Contains('|') ? Funs.DB.HJGL_WeldTask.FirstOrDefault(e => e.UnitWorkId == x.WeldTaskId.Split('|')[0].ToString() && e.UnitId == x.WeldTaskId.Split('|')[1].ToString() && e.TaskDate.Value.Date == Convert.ToDateTime(x.WeldTaskId.Split('|')[2].ToString()).Date)?.TaskCode : "" : "", + AuditMan = x.AuditMan, + AuditManName = x.AuditManName, + AuditDate = x.AuditDate }).ToList(); } @@ -167,7 +178,9 @@ namespace BLL State = newtable.State, CreateMan = newtable.CreateMan, CreateDate = newtable.CreateDate, - ReqUnitId = newtable.ReqUnitId, + ReqUnitId = newtable.ReqUnitId, + AuditMan = newtable.AuditMan, + AuditDate = newtable.AuditDate }; Funs.DB.Tw_OutputMaster.InsertOnSubmit(table); Funs.DB.SubmitChanges(); @@ -191,6 +204,8 @@ namespace BLL table.CreateMan = newtable.CreateMan; table.CreateDate = newtable.CreateDate; table.ReqUnitId = newtable.ReqUnitId; + table.AuditMan = newtable.AuditMan; + table.AuditDate = newtable.AuditDate; Funs.DB.SubmitChanges(); } @@ -244,6 +259,8 @@ namespace BLL CreateMan = plan.CreateMan, CreateDate = DateTime.Now, ReqUnitId = plan.ReqUnitId, + AuditMan = plan.CreateMan, + AuditDate = plan.AuditDate }; Add(master); //生成出库单明细 @@ -268,14 +285,16 @@ namespace BLL /// 根据计划单撤销出库单 /// /// - public static void RevokeGenOutMasterByPlanId(string planId) + public static string RevokeGenOutMasterByPlanId(string planId) { + string result = ""; Tw_InOutMasterOutput query = new Tw_InOutMasterOutput(); query.InOutPlanMasterId = planId; var master = GetModle(query).FirstOrDefault(); if (master == null) { - return; + result = "未找到对应的出库单"; + return result; } DeleteById(master.Id); //删除出库单 //删除明细 @@ -288,8 +307,10 @@ namespace BLL //撤销出库,即增加库存 TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseCode, TwConst.InOutType.入库, detail.ActNum); } - - + var planModel= TwInOutplanmasterService.GetById(planId); + planModel.State= (int)TwConst.State.已审核; + TwInOutplanmasterService.Update(planModel); + return result; } public static string GetCusBillCodeByTaskCode(string taskCode, TwConst.TypeInt typeInt, TwConst.Category category) diff --git a/SGGL/BLL/HJGL/WeldingManage/PipelineMatService.cs b/SGGL/BLL/HJGL/WeldingManage/PipelineMatService.cs index 40fce0bb..5a1b7b27 100644 --- a/SGGL/BLL/HJGL/WeldingManage/PipelineMatService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/PipelineMatService.cs @@ -1,7 +1,9 @@ -namespace BLL +using Model; +using System.Collections.Generic; +using System.Linq; +namespace BLL { - using Model; - using System.Linq; + public static class PipelineMatService { /// @@ -13,6 +15,11 @@ return Funs.DB.HJGL_PipeLineMat.FirstOrDefault(e => e.PipeLineMatId == pipelineMatId); } + public static List GetPipeLineMatsByPipelineId(string pipelineId) + { + return Funs.DB.HJGL_PipeLineMat.Where(e => e.PipelineId == pipelineId).ToList(); + } + /// /// 增加管线材料 /// diff --git a/SGGL/BLL/HJGL/WeldingManage/WeldTaskService.cs b/SGGL/BLL/HJGL/WeldingManage/WeldTaskService.cs index 2015b8dd..023cc34d 100644 --- a/SGGL/BLL/HJGL/WeldingManage/WeldTaskService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/WeldTaskService.cs @@ -308,114 +308,5 @@ namespace BLL db.SubmitChanges(); } } - - public static void GenOutPlanmasterByWeldTaskId(string unitworkid,string unitid,DateTime date,string Personid) - { - Model.SGGLDB db = Funs.DB; - Model.View_HJGL_WeldingTask weldTask = db.View_HJGL_WeldingTask.FirstOrDefault(e => e.UnitWorkId==unitworkid && e.UnitId==unitid&& e.TaskDate.Value.Date==date.Date); - if (weldTask==null) - { - return; - } - string WeldTaskId= unitworkid+"|"+unitid+ "|" + string.Format("{0:yyyyMMMMdd}", date); - //判断是否已经生成过出库计划单 - var queryIsExitInMaster = new Tw_InOutMasterOutput(); - queryIsExitInMaster.WeldTaskId = WeldTaskId; - queryIsExitInMaster.InOutType=(int)TwConst.InOutType.出库; - queryIsExitInMaster.TypeInt = (int)TwConst.TypeInt.领料出库; - var IsExitInMaster = TwInOutplanmasterService.GetModle(queryIsExitInMaster).FirstOrDefault(); - if (IsExitInMaster != null) - { - return; - } - var pipelineList = db.View_HJGL_WeldingTask.Where(e => e.UnitWorkId == unitworkid && e.UnitId == unitid && e.TaskDate.Value.Date == date.Date).Select(x=>x.PipelineId).Distinct().ToList(); - - //var outMateriaList = db.HJGL_PipeLineMat.Where(x => pipelineList.Contains(x.PipelineId)) - // .GroupBy(x => x.MaterialCode).Select(x => new - // { - // x.Key, - // planNum = x.Sum(y => y.Number)??0, - // }).ToList(); - var outMateriaList = from x in db.HJGL_PipeLineMat - join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode - where pipelineList.Contains(x.PipelineId) - group x by new { x.MaterialCode, y.MaterialUnit } - into g - select new - { - g.Key.MaterialCode, - planNum = g.Sum(x => x.Number) ?? 0, - MaterialName = g.Key.MaterialUnit, - }; - - var outPlanDetailListPiece = outMateriaList.Where(x => x.MaterialName.Contains("个"));//管件 - var outPlanDetailListOthere = outMateriaList.Where(x => x.MaterialName.Contains("米"));//管段 - var weldTaskCode = GetWeldTaskById(weldTask.WeldTaskId)?.TaskCode; - if (outPlanDetailListPiece.Any()) - { - Model.Tw_InOutPlanMaster table = new Model.Tw_InOutPlanMaster - { - Id = Guid.NewGuid().ToString(), - ProjectId = weldTask.ProjectId, - // CusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + UnitService.GetUnitCodeByUnitId(weldTask.UnitId) + "-" + UnitWorkService.getUnitWorkByUnitWorkId(weldTask.UnitWorkId)?.UnitWorkCode + "AP-PF01", - CusBillCode=TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode,TwConst.TypeInt.领料出库,TwConst.Category.管件), - WarehouseCode = PipelineService.GetPipeArea().Where(x => x.Value == PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).PipeArea).Select(x => x.Text).FirstOrDefault(), - Source = 1, - InOutType = (int)TwConst.InOutType.出库, - TypeInt = (int)TwConst.TypeInt.领料出库, - State = (int)TwConst.State.待审核, - Category = (int)TwConst.Category.管件, - CreateMan = Personid, - CreateDate = DateTime.Now, - WeldTaskId = WeldTaskId, - ReqUnitId = weldTask.UnitId, - }; - TwInOutplanmasterService.Add(table); - foreach (var item in outPlanDetailListPiece) - { - Model.Tw_InOutPlanDetail detail = new Model.Tw_InOutPlanDetail - { - Id = Guid.NewGuid().ToString(), - InOutPlanMasterId = table.Id, - MaterialCode = item.MaterialCode, - PlanNum = item.planNum, - }; - TwInOutplandetailService.Add(detail); - } - } - if (outPlanDetailListOthere.Any()) - { - Model.Tw_InOutPlanMaster table = new Model.Tw_InOutPlanMaster - { - Id = Guid.NewGuid().ToString(), - ProjectId = weldTask.ProjectId, - CusBillCode =TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt.领料出库, TwConst.Category.管段), - WarehouseCode = PipelineService.GetPipeArea().Where(x => x.Value == PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).PipeArea).Select(x => x.Text).FirstOrDefault(), - Source = 1, - InOutType = (int)TwConst.InOutType.出库, - TypeInt = (int)TwConst.TypeInt.领料出库, - State = (int)TwConst.State.待审核, - Category = (int)TwConst.Category.管段, - CreateMan = Personid, - CreateDate = DateTime.Now, - WeldTaskId = WeldTaskId, - ReqUnitId = weldTask.UnitId, - }; - TwInOutplanmasterService.Add(table); - foreach (var item in outPlanDetailListOthere) - { - Model.Tw_InOutPlanDetail detail = new Model.Tw_InOutPlanDetail - { - Id = Guid.NewGuid().ToString(), - InOutPlanMasterId = table.Id, - MaterialCode = item.MaterialCode, - PlanNum = item.planNum, - }; - TwInOutplandetailService.Add(detail); - } - } - - - } } } diff --git a/SGGL/FineUIPro.Mobile/res/css/common.css b/SGGL/FineUIPro.Mobile/res/css/common.css index 83ef5cd7..c8404246 100644 --- a/SGGL/FineUIPro.Mobile/res/css/common.css +++ b/SGGL/FineUIPro.Mobile/res/css/common.css @@ -64,4 +64,7 @@ table.result { .f-grid-row .f-grid-cell-inner { white-space: normal; word-break: break-all; -} \ No newline at end of file +} +.f-grid-row .f-grid-rowgroup .f-expanded .f-grid-row-unselectable { + height: 56.67px; +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx b/SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx index e34da2f2..0c681e14 100644 --- a/SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx +++ b/SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx @@ -58,7 +58,7 @@ -