public ActionResult DeleteConfirmed(int id) { BindCode bindcode = sdb.BindCodes.Find(id); sdb.BindCodes.Remove(bindcode); sdb.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "Id,CompanyId,ConnectionString,StaffNumber,RealName,BindingCode,Phone,BindTag,LastTime,IsAvail")] BindCode bindcode) { if (ModelState.IsValid) { sdb.BindCodes.Add(bindcode); sdb.SaveChanges(); return(RedirectToAction("Index")); } return(View(bindcode)); }
// GET: /AppManage/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BindCode bindcode = sdb.BindCodes.Find(id); if (bindcode == null) { return(HttpNotFound()); } return(View(bindcode)); }
public ActionResult Reset(int id) { string temp; int i = 0; do { temp = GetRandomCode(8); var count = (from s in sdb.BindCodes where s.BindingCode == temp select s).ToList(); i = count.Count; } while (i != 0); BindCode code = sdb.BindCodes.Find(id); code.BindTag = false; code.BindingCode = temp; sdb.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(int id) { string temp; int i = 0; do { temp = GetRandomCode(8); var count = (from s in sdb.BindCodes where s.BindingCode == temp select s).ToList(); i = count.Count; } while (i != 0); BindCode code = sdb.BindCodes.Find(id); code.BindTag = false; code.BindingCode = temp; sdb.SaveChanges(); var friends = (from u in sdb.Users where u.CompanyId == this.CompanyId && u.StaffNumber != code.StaffNumber select u).ToList(); UserModels user = (from u in sdb.Users where u.StaffNumber == code.StaffNumber select u).FirstOrDefault(); //在环信中注册 EaseMobDemo myEaseMobDemo = new EaseMobDemo(appClientID, appClientSecret, appName, orgName); foreach (var temp1 in friends) //取出每个字段 { myEaseMobDemo.AccountDelFriend(user.UserName, temp1.UserName); //删除原来账户的环信好友。 } user.CompanyFullName = "GeneralStaff"; //model.CompanyFullName, user.Name = ""; //用户注册的时候写入该名称 user.IsProved = false; //是否审核的标志 user.IsAvailable = false; //是否是可用的管理员 user.IsRoot = false; //注册企业号的人默认就是企业的超级管理员 user.CompanyId = "app-id"; user.ConnectionString = "app-ConnectionString"; user.HuanTag = true; user.BindTag = false;//找回密码后就没有绑定公司 user.StaffNumber = null; user.BindingCode = null; sdb.SaveChanges(); return(RedirectToAction("Index")); }
// GET: /AppManage/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BindCode bind = (from b in sdb.BindCodes where b.Id == id select b).FirstOrDefault(); Staff staff = (from s in db.Staffs where s.StaffNumber == bind.StaffNumber select s).FirstOrDefault(); Department department = (from d in db.Departments where d.DepartmentId == staff.Department select d).FirstOrDefault(); BindCodeViewModel bindModel = new BindCodeViewModel(); bindModel.Id = bind.Id; bindModel.StaffNumber = bind.StaffNumber; bindModel.RealName = bind.RealName; bindModel.BindingCode = bind.BindingCode; bindModel.Phone = bind.Phone; bindModel.LastTime = bind.LastTime; bindModel.BindTag = bind.BindTag; bindModel.Department = department.Name; bindModel.Position = staff.Position; return(View(bindModel)); }
public BindCode Bind(InputAction action, bool deleteOldBindings = true) { BindCode bindCode = BindCode.SUCCESS; if (action == null) { DebugManager.WarningMessage($"There was an issue attempting to bind input, Error Code: {BindCode.INVALID_ACTION.ToString()}"); return(BindCode.INVALID_ACTION); } // If the InputAction was successfully obtained continue if (InputAction != null && deleteOldBindings) { UnbindAll(); otherBoundInputs.Clear(); bindCode = BindCode.RE_BIND_SUCCEEDED; } else if (InputAction != null && !deleteOldBindings) { // If we don't want to delete the old bindings, this will add an alternate binding otherBoundInputs.Add(InputAction); bindCode = BindCode.RE_BIND_SUCCEEDED; } InputAction = action; if (InputAction != null) { InputAction.performed += PerformedActions; InputAction.canceled += CancelledActions; } return(bindCode); }
/// <summary> /// Bind an action to an InputAction on the passed in PlayerInput with the name 'actionName', remember to bind actions to "PerformedActions" and "CancelledActions" before calling this /// </summary> /// <param name="playerInput">The PlayerInput to get input for</param> /// <param name="actionName">The name of the action in the control map</param> /// <param name="deleteOldBindings">Whether or not to keep previous bindings for this action</param> /// <returns></returns> public BindCode Bind(PlayerInput playerInput, string actionName, bool deleteOldBindings = true) { BindCode bindCode = BindCode.SUCCESS; if (playerInput == null) { return(BindCode.INVALID_MAP); } else { // Get the InputAction of name 'actionName' from the playerInput InputAction tempAction = playerInput.currentActionMap.FindAction(actionName, false); bindCode = Bind(tempAction, deleteOldBindings); } if (bindCode != BindCode.SUCCESS && bindCode != BindCode.RE_BIND_SUCCEEDED) { DebugManager.WarningMessage($"There was an error attempting to rebind action '{actionName}', error code: {bindCode}"); } return(bindCode); }
public static void ReturnStatus(int auditProcessAId, byte status, string userName) { UserModels user = (from u in sdb.Users where u.UserName == userName select u).FirstOrDefault(); BonsaiiDbContext db = new BonsaiiDbContext(user.ConnectionString); AuditApplication application = db.AuditApplications.Find(auditProcessAId);//修改Application的状态 application.State = status; string btype = application.BType.Substring(0, 2); switch (btype) { case "21": { //员工 Staff someone = (from p in db.Staffs where (p.BillNumber == application.BNumber) && (p.BillTypeNumber == application.BType) select p).ToList().SingleOrDefault(); if (someone != null) { someone.AuditStatus = status; //已审 SystemDbContext sysdb = new SystemDbContext(); /*BindCodes*/ var Ucount = (from p in sysdb.BindCodes where (p.CompanyId == user.CompanyId && p.StaffNumber == someone.StaffNumber) select p).ToList(); if (Ucount.Count == 0) { //木有该员工 BindCode user1 = new BindCode(); string CompanyDbName = "Bonsaii" + user1.CompanyId; user1.ConnectionString = ConfigurationManager.AppSettings["UserDbConnectionString"] + CompanyDbName + ";"; //"Data Source = localhost,1433;Network Library = DBMSSOCN;Initial Catalog = " + CompanyDbName + ";User ID = test;Password = admin;"; user1.CompanyId = user1.CompanyId; user1.StaffNumber = someone.StaffNumber; user1.RealName = someone.Name; user1.BindingCode = someone.BindingCode; user1.Phone = someone.IndividualTelNumber; user1.BindTag = false; user1.LastTime = DateTime.Now; user1.IsAvail = true; sysdb.BindCodes.Add(user1); sysdb.SaveChanges(); } db.SaveChanges(); Push(someone.StaffNumber, user.CompanyId, status); } } break; case "22": { //变更 StaffChange someone = (from p in db.StaffChanges where (p.BillNumber == application.BNumber) && (p.BillTypeNumber == application.BType) select p).ToList().SingleOrDefault(); if (someone != null) { someone.AuditStatus = status; if (someone.AuditStatus == 3) { var staffId = (from p in db.Staffs where p.StaffNumber == someone.StaffNumber && p.ArchiveTag != true select p.Number).ToList().FirstOrDefault(); Staff staff = db.Staffs.Find(staffId); staff.Name = someone.Name; staff.Gender = someone.Gender; staff.Department = someone.Department; staff.WorkType = someone.WorkType; staff.Position = someone.Position; staff.IdentificationNumber = someone.IdentificationNumber; staff.Nationality = someone.Nationality; staff.IdentificationNumber = someone.IdentificationNumber; staff.Entrydate = someone.Entrydate; staff.ClassOrder = someone.ClassOrder; staff.ApplyOvertimeSwitch = staff.ApplyOvertimeSwitch; staff.JobState = someone.JobState; staff.AbnormalChange = someone.AbnormalChange; staff.FreeCard = someone.FreeCard; staff.WorkProperty = someone.WorkProperty; staff.WorkType = someone.WorkType; staff.Source = someone.Source; staff.QualifyingPeriodFull = someone.QualifyingPeriodFull; staff.MaritalStatus = someone.MaritalStatus; staff.BirthDate = someone.BirthDate; staff.NativePlace = someone.NativePlace; staff.HealthCondition = someone.HealthCondition; staff.Nation = someone.Nation; staff.Address = someone.Address; staff.VisaOffice = someone.VisaOffice; staff.HomeTelNumber = someone.HomeTelNumber; staff.EducationBackground = someone.EducationBackground; staff.GraduationSchool = someone.GraduationSchool; staff.SchoolMajor = someone.SchoolMajor; staff.Degree = someone.SchoolMajor; staff.Introducer = someone.Introducer; staff.IndividualTelNumber = someone.IndividualTelNumber; staff.BankCardNumber = someone.BankCardNumber; staff.UrgencyContactMan = someone.UrgencyContactMan; staff.UrgencyContactAddress = someone.UrgencyContactAddress; staff.UrgencyContactPhoneNumber = someone.UrgencyContactPhoneNumber; staff.PhysicalCardNumber = someone.PhysicalCardNumber; staff.LeaveDate = someone.LeaveDate; staff.LeaveType = someone.LeaveType; staff.LeaveReason = someone.LeaveReason; staff.AuditStatus = someone.AuditStatus; staff.HealthCondition = someone.HealthCondition; staff.ChangeTime = someone.RecordTime; staff.ChangePerson = someone.RecordPerson; staff.AuditTime = DateTime.Now; staff.AuditPerson = userName; staff.Head = someone.Head; staff.LogicCardNumber = someone.LogicCardNumber; staff.HeadType = someone.HeadType; staff.IDCardNumber = someone.IDCardNumber; staff.DeadlineDate = someone.DeadlineDate; } db.SaveChanges(); Push(someone.StaffNumber, user.CompanyId, status); } } break; case "23": { //离职 StaffApplication someone = (from p in db.StaffApplications where (p.BillNumber == application.BNumber) && (p.BillTypeNumber == application.BType) select p).ToList().SingleOrDefault(); if (someone != null) { someone.AuditStatus = status; if (someone.AuditStatus == 3) { //审核通过就在Staff里面把标志置为1 var staffId = (from p in db.Staffs where p.StaffNumber == someone.StaffNumber && p.ArchiveTag != true select p.Number).ToList().FirstOrDefault(); Staff staff = db.Staffs.Find(staffId); staff.ArchiveTag = true; //true 代表离职 staff.BindingCode = null; //要把信息写到离职档案中 StaffArchive staffArchive = new StaffArchive(); staffArchive.BillTypeNumber = someone.BillTypeNumber; staffArchive.BillTypeName = someone.BillTypeName; staffArchive.BillNumber = someone.BillNumber; staffArchive.StaffNumber = staff.StaffNumber; staffArchive.StaffName = staff.Name; staffArchive.LeaveDate = someone.HopeLeaveDate; staffArchive.Department = (from p in db.Departments where p.DepartmentId == staff.Department select p.Name).ToList().FirstOrDefault(); staffArchive.IdenticationNumber = staff.IdentificationNumber; staffArchive.RecordPerson = staff.RecordPerson; staffArchive.RecordTime = staff.RecordTime; staffArchive.BlackList = false; staffArchive.WorkPlus = false; staff.ArchiveTag = true; //true 代表离职 db.StaffArchives.Add(staffArchive); //Users表中离职; //修改系统表 SystemDbContext sysdb = new SystemDbContext(); var Ucount = (from p in sysdb.BindCodes where (p.CompanyId == user.CompanyId && p.StaffNumber == someone.StaffNumber) select p).SingleOrDefault(); if (Ucount != null) { sysdb.BindCodes.Remove(Ucount); sysdb.SaveChanges(); } db.SaveChanges(); Push(someone.StaffNumber, user.CompanyId, status); } } } break; case "24": { //技能 StaffSkill someone = (from p in db.StaffSkills where (p.BillNumber == application.BNumber) && (p.BillTypeNumber == application.BType) select p).ToList().SingleOrDefault(); if (someone != null) { someone.AuditStatus = status; } Push(someone.StaffNumber, user.CompanyId, status); } break; case "25": { //招聘 Recruitments someone = (from p in db.Recruitments where (p.BillCode == application.BNumber) && (p.BillType == application.BType) select p).ToList().SingleOrDefault(); if (someone != null) { someone.AuditStatus = status; } } break; case "26": { //培训 TrainStart someone = (from p in db.TrainStarts where (p.BillNumber == application.BNumber) && (p.BillTypeNumber == application.BType) select p).ToList().SingleOrDefault(); if (someone != null) { someone.AuditStatus = status; } } break; case "27": { //合同 Contract someone = (from p in db.Contracts where (p.BillNumber == application.BNumber) && (p.BillTypeNumber == application.BType) select p).ToList().SingleOrDefault(); if (someone != null) { someone.AuditStatus = status; //已审 } } break; case "31": { //出差 EvectionApplies someone = (from p in db.EvectionApplies where (p.BillNumber == application.BNumber) && (p.BillType == application.BType) select p).SingleOrDefault(); if (someone != null) { someone.AuditStatus = status; } Push(someone.StaffNumber, user.CompanyId, status); } break; case "32": { //请假 VacateApplies someone = (from p in db.VacateApplies where (p.BillNumber == application.BNumber) && (p.BillType == application.BType) select p).ToList().SingleOrDefault(); if (someone != null) { someone.AuditStatus = status; } Push(someone.StaffNumber, user.CompanyId, status); } break; case "33": { //加班 OvertimeApplies someone = (from p in db.OvertimeApplies where (p.BillNumber == application.BNumber) && (p.BillType == application.BType) select p).ToList().SingleOrDefault(); if (someone != null) { OvertimeApplies correct = db.OvertimeApplies.Find(someone.Id); correct.AuditPerson = someone.AuditPerson; correct.AuditStatus = status; correct.AuditStatusName = someone.AuditStatusName; correct.AuditTime = someone.AuditTime; correct.BillNumber = someone.BillNumber; correct.BillType = someone.BillType; correct.Date = someone.Date; correct.EndDateTime = someone.EndDateTime; correct.Hours = someone.Hours; correct.IsRead = someone.IsRead; correct.Reason = someone.Reason; correct.Remark = someone.Remark; correct.StaffNumber = someone.StaffNumber; correct.StartDateTime = someone.StartDateTime; db.SaveChanges(); } Push(someone.StaffNumber, user.CompanyId, status); } break; case "34": { //签卡 ChargeCardApplies someone = (from p in db.ChargeCardApplies where (p.BillNumber == application.BNumber) && (p.BillType == p.BillType) select p).ToList().SingleOrDefault(); if (someone != null) { someone.AuditStatus = status; } Push(someone.StaffNumber, user.CompanyId, status); } break; case "35": { //调休 DaysOffApplies someone = (from p in db.DaysOffApplies where (p.BillNumber == application.BNumber) && (p.BillType == application.BType) select p).ToList().SingleOrDefault(); if (someone != null) { someone.AuditStatus = status; } Push(someone.StaffNumber, user.CompanyId, status); } break; case "36": { //异地 VacateApplies someone = (from p in db.VacateApplies where (p.BillNumber == application.BNumber) && (p.BillType == application.BType) select p).ToList().SingleOrDefault(); if (someone != null) { someone.AuditStatus = status; } Push(someone.StaffNumber, user.CompanyId, status); } break; case "37": { //值班 OnDutyApplies someone = (from p in db.OnDutyApplies where (p.BillNumber == application.BNumber) && (p.BillType == application.BType) select p).ToList().SingleOrDefault(); if (someone != null) { someone.AuditStatus = status; } Push(someone.StaffNumber, user.CompanyId, status); } break; default: break; } switch (btype) { case "27": { //合同 Contract someone = (from p in db.Contracts where p.BillNumber == application.BNumber select p).ToList().SingleOrDefault(); someone.AuditStatus = status; //已审 } break; case "21": { //员工 Staff someone = (from p in db.Staffs where p.BillNumber == application.BNumber select p).ToList().SingleOrDefault(); someone.AuditStatus = status; //已审 } break; case "24": { //技能 StaffSkill someone = (from p in db.StaffSkills where p.BillNumber == application.BNumber select p).ToList().SingleOrDefault(); someone.AuditStatus = status; } break; case "26": { //培训 TrainStart someone = (from p in db.TrainStarts where p.BillNumber == application.BNumber select p).ToList().SingleOrDefault(); someone.AuditStatus = status; } break; case "23": { //离职 StaffApplication someone = (from p in db.StaffApplications where p.BillNumber == application.BNumber select p).ToList().SingleOrDefault(); someone.AuditStatus = status; if (someone.AuditStatus == 3) { //审核通过就在Staff里面把标志置为1 var staffId = (from p in db.Staffs where p.StaffNumber == someone.StaffNumber && p.ArchiveTag != true select p.Number).ToList().FirstOrDefault(); Staff staff = db.Staffs.Find(staffId); staff.ArchiveTag = true; //true 代表离职 //要把信息写到离职档案中 StaffArchive staffArchive = new StaffArchive(); staffArchive.BillTypeNumber = someone.BillTypeNumber; staffArchive.BillTypeName = someone.BillTypeName; staffArchive.StaffNumber = staff.StaffNumber; staffArchive.StaffName = staff.Name; staffArchive.Department = staff.Department; staffArchive.IdenticationNumber = staff.IdentificationNumber; staffArchive.RecordPerson = staff.RecordPerson; staffArchive.RecordTime = staff.RecordTime; staffArchive.BillNumber = Generate.GenerateBillNumber(staffArchive.BillTypeNumber, user.ConnectionString); db.StaffArchives.Add(staffArchive); db.SaveChanges(); } } break; case "22": { //变更 StaffChange someone = (from p in db.StaffChanges where p.BillNumber == application.BNumber select p).ToList().SingleOrDefault(); someone.AuditStatus = status; if (someone.AuditStatus == 3) { var staffId = (from p in db.Staffs where p.StaffNumber == someone.StaffNumber && p.ArchiveTag != true select p.Number).ToList().FirstOrDefault(); Staff staff = db.Staffs.Find(staffId); staff.Name = someone.Name; staff.Gender = someone.Gender; staff.Department = someone.Department; staff.WorkType = someone.WorkType; staff.Position = someone.Position; staff.IdentificationNumber = someone.IdentificationNumber; staff.Nationality = someone.Nationality; staff.IdentificationNumber = someone.IdentificationNumber; staff.Entrydate = someone.Entrydate; staff.ClassOrder = someone.ClassOrder; staff.ApplyOvertimeSwitch = staff.ApplyOvertimeSwitch; staff.JobState = someone.JobState; staff.AbnormalChange = someone.AbnormalChange; staff.FreeCard = someone.FreeCard; staff.WorkProperty = someone.WorkProperty; staff.WorkType = someone.WorkType; staff.Source = someone.Source; staff.QualifyingPeriodFull = someone.QualifyingPeriodFull; staff.MaritalStatus = someone.MaritalStatus; staff.BirthDate = someone.BirthDate; staff.NativePlace = someone.NativePlace; staff.HealthCondition = someone.HealthCondition; staff.Nation = someone.Nation; staff.Address = someone.Address; staff.VisaOffice = someone.VisaOffice; staff.HomeTelNumber = someone.HomeTelNumber; staff.EducationBackground = someone.EducationBackground; staff.GraduationSchool = someone.GraduationSchool; staff.SchoolMajor = someone.SchoolMajor; staff.Degree = someone.SchoolMajor; staff.Introducer = someone.Introducer; staff.IndividualTelNumber = someone.IndividualTelNumber; staff.BankCardNumber = someone.BankCardNumber; staff.UrgencyContactMan = someone.UrgencyContactMan; staff.UrgencyContactAddress = someone.UrgencyContactAddress; staff.UrgencyContactPhoneNumber = someone.UrgencyContactPhoneNumber; staff.PhysicalCardNumber = someone.PhysicalCardNumber; staff.LeaveDate = someone.LeaveDate; staff.LeaveType = someone.LeaveType; staff.LeaveReason = someone.LeaveReason; staff.AuditStatus = someone.AuditStatus; staff.HealthCondition = someone.HealthCondition; staff.ChangeTime = someone.RecordTime; staff.ChangePerson = someone.RecordPerson; staff.AuditTime = DateTime.Now; staff.AuditPerson = user.Name; staff.Head = someone.Head; staff.LogicCardNumber = someone.LogicCardNumber; staff.HeadType = someone.HeadType; staff.IDCardNumber = someone.IDCardNumber; staff.DeadlineDate = someone.DeadlineDate; } db.SaveChanges(); } break; case "33": { //加班 OvertimeApplies someone = (from p in db.OvertimeApplies where p.BillNumber == application.BNumber select p).ToList().SingleOrDefault(); someone.AuditStatus = status; Push(someone.StaffNumber, user.CompanyId, status); } break; case "32": { //请假 VacateApplies someone = (from p in db.VacateApplies where p.BillNumber == application.BNumber select p).ToList().SingleOrDefault(); someone.AuditStatus = status; Push(someone.StaffNumber, user.CompanyId, status); } break; case "34": { //请假 ChargeCardApplies someone = (from p in db.ChargeCardApplies where p.BillNumber == application.BNumber select p).ToList().SingleOrDefault(); someone.AuditStatus = status; Push(someone.StaffNumber, user.CompanyId, status); } break; case "31": { //出差 EvectionApplies someone = (from p in db.EvectionApplies where p.BillNumber == application.BNumber select p).SingleOrDefault(); someone.AuditStatus = status; Push(someone.StaffNumber, user.CompanyId, status); } break; case "35": { //出差 DaysOffApplies someone = (from p in db.DaysOffApplies where p.BillNumber == application.BNumber select p).SingleOrDefault(); someone.AuditStatus = status; Push(someone.StaffNumber, user.CompanyId, status); } break; case "36": { //出差 OffSiteApplies someone = (from p in db.OffSiteApplies where p.BillNumber == application.BNumber select p).SingleOrDefault(); someone.AuditStatus = status; Push(someone.StaffNumber, user.CompanyId, status); } break; case "37": { //出差 OnDutyApplies someone = (from p in db.OnDutyApplies where p.BillNumber == application.BNumber select p).SingleOrDefault(); someone.AuditStatus = status; Push(someone.StaffNumber, user.CompanyId, status); } break; default: break; } db.SaveChanges(); }
public static void GetShareDataExec(object obj) { if (!IsRunning) { return; } if (Arthur.App.Current.Option.RemainingMinutes <= 0) { return; } if (!Current.Option.IsGetShareDataExecting) { Current.Option.IsGetShareDataExecting = true; if (Current.ShareDatas.Count > 0) { if (Current.Option.Tray12_Id > 0) { var chargeData = Current.ShareDatas.First(o => o.Key == "chargeCodes"); var bindCode = JsonHelper.DeserializeJsonToObject <BindCode>(chargeData.Value); var procTray = GetObject.GetById <ProcTray>(Current.Option.Tray12_Id); if (procTray.Id > 0 && chargeData.Status == 2) { if (procTray.Id == chargeData.ProcTrayId) { } else { //充电位条码绑定信息传给BTS客户端 var batteries = procTray.GetBatteries(); var codes = new List <string>(); for (var i = 1; i <= Common.TRAY_BATTERY_COUNT; i++) { var code = ""; var battery = batteries.FirstOrDefault(o => o.GetChargeOrder() == i); if (battery != null) { code = battery.Code; } codes.Add(code); } var value = new BindCode { TrayCode = procTray.Code, BatteryCodes = string.Join(",", codes.ToArray()) }; chargeData.Value = JsonHelper.SerializeObject(value); chargeData.Status = 1; chargeData.ProcTrayId = procTray.Id; chargeData.UpdateTime = DateTime.Now; LogHelper.WriteInfo(string.Format("--------成功发送充电位条码绑定信息给BTS【流程托盘ID:{0},条码:{1}】---------", procTray.Id, procTray.Code)); } } } if (Current.Option.Tray22_Id > 0) { var dischargeData = Current.ShareDatas.First(o => o.Key == "dischargeCodes"); var bindCode = JsonHelper.DeserializeJsonToObject <BindCode>(dischargeData.Value); var procTray = GetObject.GetById <ProcTray>(Current.Option.Tray22_Id); if (procTray.Id > 0 && dischargeData.Status == 2) { if (procTray.Id == dischargeData.ProcTrayId) { } else { //放电位条码绑定信息传给BTS客户端 var batteries = procTray.GetBatteries(); var codes = new List <string>(); for (var i = 1; i <= Common.TRAY_BATTERY_COUNT; i++) { var code = ""; var battery = batteries.FirstOrDefault(o => o.GetChargeOrder() == i); if (battery != null) { code = battery.Code; } codes.Add(code); } var value = new BindCode { TrayCode = procTray.Code, BatteryCodes = string.Join(",", codes.ToArray()) }; dischargeData.Value = JsonHelper.SerializeObject(value); dischargeData.Status = 1; dischargeData.ProcTrayId = procTray.Id; dischargeData.UpdateTime = DateTime.Now; LogHelper.WriteInfo(string.Format("--------成功发送放电位条码绑定信息给BTS【流程托盘ID:{0},条码:{1}】---------", procTray.Id, procTray.Code)); } } } if (Current.Option.Tray23_Id > 0) { var procTray = GetObject.GetById <ProcTray>(Current.Option.Tray23_Id); var sortingResults = Current.ShareDatas.First(o => o.Key == "sortingResults"); var capResults = Current.ShareDatas.First(o => o.Key == "capResults"); var esrResults = Current.ShareDatas.First(o => o.Key == "esrResults"); if (sortingResults.Status == 1 && capResults.Status == 1 && esrResults.Status == 1) { var sortingResult_sort = JsonHelper.DeserializeJsonToObject <SortingResult>(sortingResults.Value); var sortingResult_cap = JsonHelper.DeserializeJsonToObject <SortingResult>(capResults.Value); var sortingResult_esr = JsonHelper.DeserializeJsonToObject <SortingResult>(esrResults.Value); if (sortingResult_sort.TrayCode == procTray.Code) { try { var sortList = sortingResult_sort.Results.Split(','); var capList = sortingResult_cap.Results.Split(','); var esrList = sortingResult_esr.Results.Split(','); for (int i = 0; i < sortList.Length; i++) { //i:绑盘序号 Current.MainMachine.Commor.Write(string.Format("D{0:D3}", 401 + i), ushort.Parse(sortList[OrderManage.GetChargeOrderBySortOrder(i + 1) - 1])); } LogHelper.WriteInfo(string.Format("--------成功发送分选结果数据给PLC【流程托盘ID:{0},条码:{1}】---------", procTray.Id, procTray.Code)); var batteries = procTray.GetBatteries(); var batteryViewModels = ContextToViewModel.Convert(batteries); for (int i = 0; i < sortList.Length; i++) { //i:通道序号 var sort = int.Parse(sortList[i]); var cap = decimal.Parse(capList[i]); var esr = decimal.Parse(esrList[i]); if (sort > 0) { var battery = batteryViewModels.FirstOrDefault(o => o.Pos == OrderManage.GetBindOrderByChargeOrder(i + 1)); if (battery != null) { battery.SortResult = (SortResult)sort; battery.CAP = cap; battery.ESR = esr; } } } sortingResults.Status = 2; sortingResults.ProcTrayId = procTray.Id; sortingResults.UpdateTime = DateTime.Now; capResults.Status = 2; capResults.ProcTrayId = procTray.Id; capResults.UpdateTime = DateTime.Now; esrResults.Status = 2; esrResults.ProcTrayId = procTray.Id; esrResults.UpdateTime = DateTime.Now; } catch (Exception ex) { Running.StopRunAndShowMsg(ex); } } } } } Current.Option.IsGetShareDataExecting = false; } }