public FlowChartBomGet QueryBomEditByFlowChartUID(int PC_MH_UID) { var mhItem = flowChartPCMHRelationshipRepository.GetById(PC_MH_UID); var detailItem = flowChartDetailRepository.GetById(mhItem.FlowChart_Detail_UID); FlowChartBomGet bomItem = new FlowChartBomGet(); bomItem.FlowChart_Detail_UID = detailItem.FlowChart_Detail_UID; bomItem.PC_MH_UID = PC_MH_UID; bomItem.Process_Seq = detailItem.Process_Seq; bomItem.Process = detailItem.Process; bomItem.Place = mhItem.Place; bomItem.Color = detailItem.Color; bomItem.User_NTID = mhItem.System_Users1.User_NTID; return(bomItem); }
public string EditFLPCBomInfoAPI(FlowChartBomGet bomItem, int CurrUser) { var result = flowChartPCMHService.EditFLPCBomInfo(bomItem, CurrUser); return(result); }
public string EditFLPCBomInfo(FlowChartBomGet bomItem, int currUser) { string result = string.Empty; FlowChart_PC_MH_Relationship pcItem = new FlowChart_PC_MH_Relationship(); pcItem.FlowChart_Detail_UID = bomItem.FlowChart_Detail_UID; pcItem.Place = bomItem.Place; pcItem.Modified_UID = currUser; pcItem.Modified_Date = DateTime.Now; //检查用户表中是否存在 try { using (var trans = new TransactionScope()) { //删除以前的那条数据 var deleteItem = flowChartPCMHRelationshipRepository.GetById(bomItem.PC_MH_UID); flowChartPCMHRelationshipRepository.Delete(deleteItem); var hasUserItem = systemUserRepository.GetMany(m => m.User_NTID.ToUpper().Equals(bomItem.User_NTID.ToUpper())).FirstOrDefault(); if (hasUserItem != null) { if (!hasUserItem.MH_Flag) { result = "该账号已经存在,并且不是物料员所属的帐号"; return(result); } else //用户表已经存在,直接新增该账户 { pcItem.MH_UID = hasUserItem.Account_UID; flowChartPCMHRelationshipRepository.Add(pcItem); } } else //新增用户表和关系表 { //获取maxAccountUID int maxAccountID = flowChartPCMHRelationshipRepository.InsertBomUserInfo(null); System_Users newUserItem = new System_Users(); newUserItem.Account_UID = maxAccountID + 1; newUserItem.User_NTID = bomItem.User_NTID; newUserItem.User_Name = bomItem.User_NTID; newUserItem.System_Language_UID = StructConstants.SystemLanguageUID.Chinese_CN; newUserItem.Enable_Flag = true; newUserItem.Email = ""; newUserItem.Modified_UID = currUser; newUserItem.Modified_Date = pcItem.Modified_Date; newUserItem.MH_Flag = true; newUserItem.EmployeePassword = JGP.Common.PasswordUtil.EncryptionHelper.Encrypt("123456", ""); systemUserRepository.Add(newUserItem); //新增关系表 newUserItem.FlowChart_PC_MH_Relationship1.Add(pcItem); } unitOfWork.Commit(); trans.Complete(); } } catch (Exception ex) { result = "数据修改错误"; } return(result); }