/// <summary> /// Diagnosis /// </summary> /// <param name="entity"></param> /// <returns></returns> public static async Task<LG.Data.Models.Doctors.ConsultWizard.Diagnosis> AddDiagnosis(LG.Data.Models.Doctors.ConsultWizard.Diagnosis entity) { var client = ClientConnection.GetCDMS_Connection(); try { client.Open(); var response = await client.AddDiagnosisToConsultationAsync(new AddDiagnosisToConsultationRequest() { PropBag = PropBag, MessageGuid = Guid.NewGuid(), Diagnosis = entity.Input }); entity.ID = response.ID; entity.IsError = response.ReturnStatus.IsError; entity.Message = response.ReturnStatus.IsError ? response.ReturnStatus.ErrorMessage : response.ReturnStatus.GeneralMessage; } catch (Exception ex) { client.Abort(); entity.IsError = true; entity.Message = ex.ToString(); } finally { if (client.State != CommunicationState.Closed) { client.Close(); } } return entity; }
public static async Task<LG.Data.Models.Doctors.ConsultWizard.DiagnosisList> GetDiagnosis( LG.Data.Models.Doctors.ConsultWizard.DiagnosisList entity) { var client = ClientConnection.GetCDMS_Connection(); try { client.Open(); var response = await client.GetDiagnosisRecordsAsync(new GetDiagnosisRecordsRequest() { MessageGuid = Guid.NewGuid(), ConsultationID = entity.ConsultationID }); entity.Result = response.ListOfDiagnosisRecords; entity.IsError = response.ReturnStatus.IsError; } catch (Exception ex) { client.Abort(); entity.IsError = true; entity.Message = ex.ToString(); } finally { if (client.State != CommunicationState.Closed) { client.Close(); } } return entity; }
public static async Task<LG.Data.Models.Clinical.ActiveConsultation> GetInfo(LG.Data.Models.Clinical.ActiveConsultation entity) { try { var response = GetOrderProcessingData(entity); await response; if (response.IsCompleted) { return await GetEncounterlInfo(response.Result); } if (response.IsFaulted) { response.Result.IsError = true; response.Result.Message = response.Result.Message + "|@|response.IsFaulted"; return response.Result; } if (response.IsCanceled) { response.Result.IsError = true; response.Result.Message = response.Result.Message + "|@|response.IsFaulted"; return response.Result; } } catch (Exception ex) { entity.IsError = true; entity.Message = ex.Message + "|@|Exception ex"; return entity; } return null; }
public static async Task<LG.Data.Models.Clients.GroupSearch> SearchGroupTask(LG.Data.Models.Clients.GroupSearch entity) { var client = ClientConnection.GetGmsConnection(); try { client.Open(); var response = await client.SearchGroupAsync( new SearchGroupRequest() { MessageGuid = Guid.NewGuid(), SearchInput = entity.SearchText, IsIncludeContains = entity.IsIncludeContains, IsIncludeStartsWith = entity.IsIncludeStartsWith }); client.Close(); entity.Results = response.Groups.ToList(); } catch (Exception ex) { client.Close(); entity.IsError = true; entity.Message = ex.ToString(); } return entity; }
Store(LG.Data.Models.Enums.BusinessLevel level,LG.Data.Models.Clients.BusinessSettings entity) { switch (level) { case BusinessLevel.Client: return await StoreClientLevel(entity); case BusinessLevel.Group: return await StoreGroupLevel(entity); case BusinessLevel.Membership: return await StoreMembershipPlanLevel(entity); case BusinessLevel.All: var response = StoreClientLevel(entity);await response; var response2 = StoreGroupLevel(entity);await response2; var response3 = StoreMembershipPlanLevel(entity);await response3; if (response.IsCompleted && response2.IsCompleted && response3.IsCompleted) { return await LoadMembershipLevel(entity); } else { return null; } } return null; }
public static async Task<LG.Data.Models.Orders.FilesAssociatedWithConsultation> GetFiles(LG.Data.Models.Orders.FilesAssociatedWithConsultation entity) { var client = ClientConnection.GetCDMS_Connection(); try { client.Open(); var response = await client.GetFilesAssociatedWithConsultationAsync(new GetFilesAssociatedWithConsultationRequest() { MessageGuid = Guid.NewGuid(), ConsultationID = entity.ConsultationID }); entity.IsError = response.ReturnStatus.IsError; entity.Files = response.ListOfFilesAssociatedWithConsultation; } catch (Exception ex) { client.Abort(); entity.IsError = true; entity.Message = ex.ToString(); } finally { if (client.State != CommunicationState.Closed) { client.Close(); } } return entity; }
public static async Task<LG.Data.Models.Users.UserModel> Update(LG.Data.Models.Shared.Contact contact) { var phones = new List<PhoneBase>(); var user = new UserModel() { CorporationRID = 10, ClientRID = contact.ContactForRID, EventAction = Action.Update, GeneralInfo = new PersonInfo() { FName = contact.PersonInfo.FName, MName = contact.PersonInfo.MName, LName = contact.PersonInfo.LName } }; user.EventAction = Models.Enums.Action.Update; contact.EventAction = ContactAction.Update; for (var i = 0; i < contact.Phones.Count; i++) { await LG.Data.Shared.ContactInfoService.SavePhone(contact, i); } var r3 = LG.Data.Shared.ContactInfoService.SavePersonInfo(user); await r3; if (r3.IsCompleted) { return user; } return null; }
public static async Task<LG.Data.Models.Doctors.OperationResponses> Save( LG.Data.Models.Doctors.Inputs eInputs) { switch (eInputs.EventAction) { case DoctorActions.DoctorAdd: return await SavePractioner(eInputs); break; case DoctorActions.DoctorUpdate: return await SavePractioner(eInputs); break; case DoctorActions.DoctorUpdatePrintedName: return await SavePractioner(eInputs); break; case DoctorActions.DoctorUpdateMedicalInformation: return await SavePractioner(eInputs); break; case DoctorActions.LicenseAdd: return await SaveLicense(eInputs); break; case DoctorActions.LicenseUpdate: return await SaveLicense(eInputs); break; default: return null; } }
static async Task<CreateClientWithDefaultGroupResponse> ClientWithGroupTask( LG.Services.CMS.ClientInfoInput entity) { var client = ClientConnection.GetCmsConnection(); return await client.CreateClientWithDefaultGroupAsync( new CreateClientWithDefaultGroupRequest() { MessageGuid = Guid.NewGuid(), CorporationRID = ClientConnection.CorporationId, Client = new ClientInfoInput() { Name = entity.Name, WebsiteURL = entity.WebsiteURL, Addresses = entity.Addresses, ClientContacts = entity.ClientContacts, Phones = new List<Services.CMS.PhoneInput>(), EmailAddresses = new List<Services.CMS.EmailAddressInput>(), IsActive = entity.IsActive, IsTesting = entity.IsTesting, EligibilityDataConfiguration = entity.EligibilityDataConfiguration, }, PropBag = Helpers.Settings.PropBag }); }
public static async Task<LG.Data.Models.Members.Entity> AccountLoadTask(LG.Data.Models.Members.Entity entity) { var client = ClientConnection.GetAcsConnection(); try { client.Open(); switch (entity.Events.AccountAction) { case AccountAction.LoadCreditCard: #region [@ Method @] var response = await client.GetCreditCardsOnTheAccountAsync(new GetCreditCardsOnTheAccountRequest() { AccountID = entity.AccountInfo.AccountID, MessageGuid = Guid.NewGuid() }); client.Close(); entity.IsError = false; entity.Events.AccountActionResult = ActionResult.Success; entity.CreditCards = response.CreditCards; return entity; #endregion break; case AccountAction.LoadDependents: #region [@ Method @] var response2 = await client.GetPrimaryAndDependentAccountsAsync(new GetPrimaryAndDependentAccountsRequest() { AccountID = entity.AccountInfo.AccountID, MessageGuid = Guid.NewGuid() }); client.Close(); entity.IsError = false; entity.Events.AccountActionResult = ActionResult.Success; entity.Accounts = response2.Accounts; return entity; #endregion break; default: client.Close(); entity.IsError = true; entity.Message = "Failed to Declare AccountAction"; entity.Events.AccountActionResult = ActionResult.Failed; return entity; } } catch (Exception ex) { client.Close(); entity.IsError = true; entity.Message = ex.ToString(); entity.Events.EventActionResult = ActionResult.Failed; return entity; } }
public async static Task<LG.Data.Models.Clinical.AudioRecording>EnsureLocalCopyOfIVRCallRecording(LG.Data.Models.Clinical.AudioRecording entityAudioRecording) { var client = ClientConnection.GetIVRAudio_Connection(); try { client.Open(); var response = await client.EnsureLocalCopyOfIVRAudioRecordingAsync(new EnsureLocalCopyOfIVRAudioRecordingRequest() { MessageGuid = Guid.NewGuid(), CallSid = entityAudioRecording.CallSid, IVRProvider = IVRProvidersEnum.Twilio }); entityAudioRecording.IsError = response.ReturnStatus.IsError; } catch (Exception ex) { client.Abort(); entityAudioRecording.IsError = true; entityAudioRecording.Message = ex.ToString(); } finally { if (client.State != CommunicationState.Closed) { client.Close(); } } return entityAudioRecording; }
UpdateEligibilityInfo(LG.Data.Models.Clients.EligibilitySettings entity) { var client = ClientConnection.GetCmsConnection(); try { client.Open(); var response = await client.UpdateEligibilityDataConfigurationAsync( new UpdateEligibilityDataConfigurationRequest() { MessageGuid = entity.MessageGuid, HavingFMEN = entity.HavingFMEN, HavingPMEN = entity.HavingPMEN, ClientRID = entity.ClientRID, IsSendingFMData = entity.IsSendingFMData, PropBag = entity.PropBag }); client.Close(); entity.IsError = false; entity.Message = response.ReturnStatus.GeneralMessage; return entity; } catch (Exception ex) { client.Close(); entity.IsError = false; entity.Message = ex.Message; return entity; } }
public static async Task<LG.Data.Models.Clients.BusinessSettings> Store( LG.Data.Models.Clients.BusinessSettings entity) { var client = LG.Services.ClientConnection.GetBscsConnection(); var response = await client.StoreBusinessSettingAsync(new StoreBusinessSettingRequest() { MessageGuid = new Guid(), ClientRID = entity.ClientRID, PropBag = entity.ProgBag, IsActive = entity.IsActive, FMPM = entity.FMPM, PMPM = entity.PMPM, BillingType = entity.BillingType, CorporationRID = entity.CorporationRID, GroupRID = entity.GroupRID, MembershipPlanID = entity.MembershipPlanID }); return new LG.Data.Models.Clients.BusinessSettings() { ClientRID = entity.ClientRID, GroupRID = entity.GroupRID, MembershipPlanID = entity.MembershipPlanID, CorporationRID = entity.CorporationRID, BillingType = entity.BillingType, FMPM = entity.FMPM, PMPM = entity.PMPM, IsActive = entity.IsActive, IsError = response.ReturnStatus.IsError, Message = response.ReturnStatus.GeneralMessage }; }
public async static Task<LG.Data.Models.Users.UserListModel> AddCorporationUser(LG.Data.Models.Users.UserModel entity) { var result = LG.Data.Core.Users.UsersDataService.CreateAsync(entity); await result; if (result.IsCompleted) { var result2 = LG.Data.Core.Users.UsersDataService.UpdateAsync( entity, result.Result.UserRID, LG.Data.Models.Enums.Action.Add); await result2; entity.UserRID = result.Result.UserRID; if (result2.IsCompleted) { return await LG.Data.Core.Users.UsersDataService.AddUserToCorporation( entity); } if (result2.IsFaulted) { return await LG.Data.Core.Users.UsersDataService.GetCorporationListAsync(); } } if (result.IsFaulted) { return null; } return null; }
Login(LG.Data.Models.Auth.SecurityInfo eInput) { var client = LG.Services.ClientConnection.GetAmsConnection(); var response = client.AuthenticateUserAsync(new AuthenticateUserRequest() { MessageGuid = Guid.NewGuid(), UserName = eInput.UserName, Password = eInput.PlainPassword }); try { await response; if (response.IsCompleted) { return response.Result; } } catch (Exception ex) { return response.Result; } return null; }
public static async Task<Results> Search(LG.Data.Models.Shared.ValueItem item) { var client = ClientConnection.GetCmsConnection(); try { client.Open(); var response = await client.SearchClientAsync(new SearchClientRequest() { SearchInput = item.Value, IsIncludeStartsWith = true, IsIncludeContains = true, MessageGuid = Guid.NewGuid() }); client.Close(); var results = new Results(); response.Clients.ForEach(record => results.List.Add( ParseClient(record))); return results; } catch (Exception ex) { client.Close(); return new LG.Data.Models.Clients.Results { IsError = true, Message = ex.Message.ToString(CultureInfo.InvariantCulture) }; } }
public static async Task<LG.Data.Models.Doctors.Schedule.Entity> PractitionerSchedule(LG.Data.Models.Doctors.Schedule.Entity entity) { var client = ClientConnection.GetMpmsSMConnection(); try { client.Open(); var response = await client.GetPractitionerScheduleAsync(new GetPractitionerScheduleRequest() { MSPRID = entity.MSPRID, MessageGuid = entity.InstanceGuid, MedicalPractitionerRID = entity.MedicalPractitionerRID, D_From = entity.D_From, D_To = entity.D_To }); client.Close(); entity.AvailabilityBlocks = response.AvailabilityList; return entity; } catch (Exception ex) { client.Close(); entity.IsError = true; entity.Message = ex.ToString(); } return null; }
internal static StoreBusinessSettingRequest CreateRequest(LG.Data.Models.Clients.BusinessSettings entity, LG.Data.Models.Enums.BusinessLevel level) { switch (level) { case BusinessLevel.Client: return new StoreBusinessSettingRequest() { MessageGuid = Guid.NewGuid(), ClientRID = entity.ClientRID, PropBag = entity.ProgBag, IsActive = entity.IsActive, FMPM = entity.FMPM, PMPM = entity.PMPM, BillingType =entity.BillingType, CorporationRID = entity.CorporationRID, }; case BusinessLevel.Group: return new StoreBusinessSettingRequest() { MessageGuid = Guid.NewGuid(), ClientRID = entity.ClientRID, PropBag = entity.ProgBag, IsActive = entity.IsActive, FMPM = entity.FMPM, PMPM = entity.PMPM, BillingType = entity.BillingType, CorporationRID = entity.CorporationRID, GroupRID = entity.GroupRID }; case BusinessLevel.Membership: return new StoreBusinessSettingRequest() { MessageGuid = Guid.NewGuid(), ClientRID = entity.ClientRID, PropBag = entity.ProgBag, IsActive = entity.IsActive, FMPM = entity.FMPM, PMPM = entity.PMPM, BillingType = entity.BillingType, CorporationRID = entity.CorporationRID, GroupRID = entity.GroupRID, MembershipPlanID = entity.MembershipPlanID }; default: return new StoreBusinessSettingRequest() { MessageGuid = Guid.NewGuid(), ClientRID = entity.ClientRID, PropBag = entity.ProgBag, IsActive = entity.IsActive, FMPM = entity.FMPM, PMPM = entity.PMPM, BillingType = entity.BillingType, CorporationRID = entity.CorporationRID, GroupRID = entity.GroupRID, MembershipPlanID = entity.MembershipPlanID }; } }
private void GetName(LG.Data.Models.Orders.ConsultationStatusFoundExpanded item) { if (item.AssignedToRID == 0) return; foreach (var dr in mdList.Where(dr => dr.MedicalPractitioner.RID == item.AssignedToRID)) { item.DrName = dr.MedicalPractitioner.PrintedName; } }
public static async Task<LG.Data.Models.Shared.Contact> Save(LG.Data.Models.Shared.Contact contact) { switch (contact.EventAction) { case ContactAction.Add: var client = LG.Services.ClientConnection.GetEmsConnection(); try { client.Open(); var response = await client.AddNewBEntityAsContactAsync(new AddNewBEntityAsContactRequest() { MessageGuid = Guid.NewGuid(), Contact = new ContactInput() { IsActive = contact.IsActive, ContactForRID = contact.ContactForRID, ContactUsages = contact.ContactUsages, EmailAddresses = contact.NewEmailAddresses, Addresses = new List<AddressInput>(), Phones = contact.NewPhones, PersonInfo = new PersonInfoInput() { FName = contact.PersonInfo.FName, MName = contact.PersonInfo.MName, LName = contact.PersonInfo.LName }, }, PropBag = "<PropBag>LG.Data.Core.Clients.ContactDataService.Save(LG.Data.Models.Shared.Contact contact)</PropBag>" }); client.Close(); contact.RID = response.ContactRID; } catch (Exception ex) { contact.IsError = true; contact.Message = ex.ToString(); } break; case ContactAction.Update: var userModel = new LG.Data.Models.Users.UserModel() { CorporationRID = 10, ClientRID = contact.ContactForRID, GeneralInfo = new LG.Data.Models.Shared.PersonInfo() { FName = contact.PersonInfo.FName, MName = contact.PersonInfo.MName, LName = contact.PersonInfo.LName }, UserRID = contact.RID, }; break; } return contact; }
public System.Boolean Populate(LG.Data.Models.Identity.Application applicationInstance) { this.NavList = new MenuItemList(); var defaultMenu = LG.Data.Models.Applications.MenuItemListData.DefaultMenuItemList(); foreach (var area in applicationInstance.Areas) { this.NavList.Items.Add(defaultMenu.Find(x => x.Area == area.Name)); } return true; }
LoadClientLevel(LG.Data.Models.Clients.BusinessSettings entity) { var response = LG.Data.Core.Clients.BusinessSettings.Load( new LG.Data.Models.Clients.BusinessSettings() { ClientRID = entity.ClientRID, CorporationRID = entity.CorporationRID }); await response; return response.Result; }
internal static LG.Data.Models.Shared.EmailAddress ReturnEmailAddress(LG.Services.EMS.BEntity entity) { return entity.EmailAddresses.Any() ? new LG.Data.Models.Shared.EmailAddress() { Email = entity.EmailAddresses.First().Email, Id = entity.EmailAddresses.First().ID.HasValue ? entity.EmailAddresses.First().ID.Value : 0, EmailUsageEnum =entity.EmailAddresses.First().EmailAddressUsages.First().EmailAddressUsageEnum, IsPrimary = entity.EmailAddresses.First().EmailAddressUsages.First().IsPrimary } : new LG.Data.Models.Shared.EmailAddress(); }
LoadMembershipLevel(LG.Data.Models.Clients.BusinessSettings entity) { var response = LG.Data.Core.Clients.BusinessSettings.Load( new LG.Data.Models.Clients.BusinessSettings() { MembershipPlanID = entity.MembershipPlanID, ClientRID = entity.ClientRID, GroupRID = entity.GroupRID, CorporationRID = entity.CorporationRID }); await response; return response.Result; }
InitializeBussinsessSettingsPerGroup(LG.Data.Models.Clients.Group group) { return new LG.Data.Models.Clients.BusinessSettings() { FMPM = 0M, PMPM = 0M, IsActive = group.IsActive, ClientRID = group.ClientRID, GroupRID = group.GroupRID, CorporationRID = group.CorporationRID, MembershipPlanID = 0 }; }
public static async Task<LG.Data.Models.Members.Entity> InjectIntoEligibiltiyEntityTask(LG.Data.Models.Members.Entity entity) { var client = ClientConnection.GetImsConnection(); try { client.Open(); var response = await client.StoreMemberEligibilityAsync(new StoreMemberEligibilityRequest() { MessageGuid = Guid.NewGuid(), ClientRID = entity.ClientRID, EventGUID = Guid.NewGuid(), RequestedByRID = entity.RID, MemberEligibilityDataInput = new MemberEligibilityData_Input() { DTUTC_EffectiveDate = entity.EffectiveDate, CoverageCode = entity.CoverageCode, GroupNumber = entity.GroupNumber, DOB = entity.PersonInfo.Dob, FName = entity.PersonInfo.FName, LName = entity.PersonInfo.LName, Gender = entity.PersonInfo.Gender, MemberNumber = entity.MemberNumber, DTUTC_TerminationDate = entity.EffectiveDate.AddYears(1).ToUniversalTime(), PhoneNumber = entity.Phone, EmailAddress = entity.Email, AddressLine1 = entity.Address.AddressLine1, AddressLine2 = entity.Address.AddressLine2, City = entity.Address.City, State = entity.Address.State, ZipCode = entity.Address.ZipCode, CountryCode = entity.Address.CountryCode, }, PropBag = EntityDataService.PropBag }); client.Close(); entity.IsError = false; entity.Events.EventActionResult = ActionResult.Success; return entity; } catch (Exception ex) { client.Close(); entity.IsError = true; entity.Message = ex.ToString(); entity.Events.EventActionResult = ActionResult.Failed; return entity; } }
Load(LG.Data.Models.Auth.SecurityInfo eInput) { var client = LG.Services.ClientConnection.GetAmsConnection(); try { //var response = client. } catch (Exception ex) { } return null; }
internal static LG.Data.Models.Shared.PhoneBase ReturnPhone(LG.Services.EMS.BEntity entity) { return entity.Phones.Any() ? new LG.Data.Models.Shared.PhoneBase() { PhoneId = (!(!entity.Phones.First().ID.HasValue || entity.Phones.First().ID == null) ? entity.Phones.First().ID.Value : 0), PhoneNumber = entity.Phones.First().PhoneNumber, CountryCode = entity.Phones.First().PhoneCountryCode, PhoneExtension = entity.Phones.First().PhoneExtension, PhoneUsageEnum = entity.Phones.First().PhoneUsages.First().PhoneUsageEnum, IsPrimary = entity.Phones.First().PhoneUsages.First().IsPrimary } : new LG.Data.Models.Shared.PhoneBase(); }
public static System.String GetLabel(LG.Data.Models.Enums.CoverageCode value) { switch (value) { case CoverageCode.EE: return "Employee Basic"; case CoverageCode.ES: return "Employee and Spouse"; case CoverageCode.EC: return "Employee and Children"; case CoverageCode.FAM: return "Family"; } return String.Empty; }
Load( LG.Data.Models.Enums.BusinessLevel level, LG.Data.Models.Clients.BusinessSettings entity) { switch (level) { case BusinessLevel.Client: return await LoadClientLevel(entity); case BusinessLevel.Group: return await LoadGroupLevel(entity); case BusinessLevel.Membership: return await LoadMembershipLevel(entity); default: return await LoadClientLevel(entity); } }
/// <summary> /// 运行任务 /// </summary> public virtual void Start() { LG.Start(); }
protected override void LogicImpl() { var para = ProjectData.Instance.SaveData.PolishPlatform[ID]; switch (LG.Step) { case 1: //平台到位 stick1SpendTime.Restart(); if (Axis.PolishPlatFormIsHave[ID].value && ProjectData.Instance.SaveData.processdata.PlatformData[1].IsHave || TaskManager.Default.FSM.MODE == 1) { LG.ImmediateStepNext(2); } else { string mes = ID.ToString() + "平台无料"; MachineAlarm.SetAlarm(AlarmLevelEnum.Level2, mes); LG.StepNext(2, FSMStaDef.RUN); } break; case 2: //开始打磨拍照 if (DeviceRsDef.I_CylLocked.value || TaskManager.Default.FSM.MODE == 1) { PolishCT.Start(); LG.ImmediateStepNext(3); } break; case 3: //开始打磨 if (PolishCT.Status && PolishClean.Status) { Polish.Start(); LG.ImmediateStepNext(4); } break; case 4: //打磨结束 if (Polish.Status && ProjectData.Instance.SaveData.PolishData[ID].PolishNum % para.PerTtimesClean == 0 && ProjectData.Instance.SaveData.processdata.PolishList[ID].Count() > 0) { ProjectData.Instance.SaveData.PolishData[ID].PolishNum = 0; PolishClean.Start(); LG.ImmediateStepNext(3); para.PolishSum++; } else if (Polish.Status && ProjectData.Instance.SaveData.processdata.PolishList[ID].Count() > 0) { LG.ImmediateStepNext(3); para.PolishSum++; } else if (Polish.Status && ProjectData.Instance.SaveData.processdata.PolishList[ID].Count() == 0) { LG.ImmediateStepNext(5); } break; case 5: //打磨结束RZ回零 if (Axis.PolishZ[ID].status == 0 && Axis.PolishR[ID].status == 0) { Axis.PolishZ[ID].MC_MoveAbs(para.EndPos.Z); Axis.PolishR[ID].MC_MoveAbs(para.EndPos.R); LG.ImmediateStepNext(6); } break; case 6: //打磨结束XY回零 if (Axis.PolishZ[ID].status == 0 && Axis.PolishR[ID].status == 0) { Axis.PolishX[ID].MC_MoveAbs(para.EndPos.X); Axis.PolishY[ID].MC_MoveAbs(para.EndPos.Y); if (TaskManager.Default.FSM.MODE == 1) //老化模式 { LG.ImmediateStepNext(7); } else { LG.ImmediateStepNext(0xef); } } break; case 7: if (Axis.PolishX[ID].status == 0 && Axis.PolishY[ID].status == 0) { stick1SpendTime.Stop(); para.PolishSpendTime = stick1SpendTime.ElapsedMilliseconds; LG.End(); //老化模式下不进行平台数据的传递 } break; case 0xef: if (Axis.PolishX[ID].status == 0 && Axis.PolishY[ID].status == 0) { stick1SpendTime.Stop(); para.PolishSpendTime = stick1SpendTime.ElapsedMilliseconds; LG.End(); ProjectData.Instance.SaveData.processdata.PlatformData[ID * 4 + 1].IsPolished = true; } break; } }
/// <summary> /// 打开一个新线程 /// </summary> /// <returns></returns> public static LinyeeState LinyeeNewState(ly_Alloc f, object ud) { int i; LinyeeState L; GlobalState g; //object l = f(ud, null, 0, (uint)state_size(typeof(LG))); var lg = new LG(); if (lg == null) { return(null); } L = lg.l; // tostate(l); g = lg.g; // (L as LG).g; L.next = null; L.tt = LINYEE_TTHREAD; g.currentwhite = (ly_byte)Bit2Mask(WHITE0BIT, FIXEDBIT); L.marked = LinyeeCWhite(g); ly_byte marked = L.marked; // can't pass properties in as ref Set2Bits(ref marked, FIXEDBIT, SFIXEDBIT); L.marked = marked; preinit_state(L, g); g.frealloc = f; g.ud = ud; g.mainthread = L; g.uvhead.u.l.prev = g.uvhead; g.uvhead.u.l.next = g.uvhead; g.GCthreshold = 0; /* mark it as unfinished state */ g.strt.size = 0; g.strt.nuse = 0; g.strt.hash = null; SetNilValue(Registry(L)); luaZ_initbuffer(L, g.buff); g.panic = null; g.gcstate = GCSpause; g.rootgc = obj2gco(L); g.sweepstrgc = 0; g.sweepgc = new RootGCRef(g); g.gray = null; g.grayagain = null; g.weak = null; g.tmudata = null; g.totalbytes = (uint)GetUnmanagedSize(typeof(LG)); g.gcpause = LUAI_GCPAUSE; g.gcstepmul = LUAI_GCMUL; g.gcdept = 0; for (i = 0; i < NUMTAGS; i++) { g.mt[i] = null; } if (LinyeeDRawRunProtected(L, f_luaopen, null) != 0) { /* memory allocation error: free partial state */ close_state(L); L = null; } else { luai_userstateopen(L); } return(L); }
protected override void LogicImpl() { var Para = Product.Inst; switch (LG.Step) { case 1: if (TaskMain.sticklogic.feeder.GetBusy) { return; } TakeCount = 0; //取料个数 whichNuzzle = 0; //哪个吸嘴 LG.StepNext(2); break; case 2: //Z轴抬起到安全高度 for (int i = 0; i < CTRCard.Axis_Z.Count; i++) { CTRCard.Axis_Z[i].MC_MoveAbs(Para.Stickdata.ZSafePos); //Z到安全位置 CTRCard.Axis_R[i].MC_MoveAbs(0); } LG.StepNext(3); break; case 3: if (CTRCard.ZArrive && CTRCard.RArrive) { bool isCanTake = false; if ( Para.Stickdata.NuzzleForbit[whichNuzzle] == false && Para.ProcessData.NuzzlePara[whichNuzzle].isHave == false) //吸嘴没被禁用且没有料 { isCanTake = true; } else { if (Para.Stickdata.NuzzleForbit[whichNuzzle] == true) //吸嘴禁用取料加1 { TakeCount++; } } if (isCanTake) { if (TakeCount == 1 && whichNuzzle == 1) { LG.StepNext(7); //如果左吸嘴取过一次且目前可以取料的是右吸嘴 } else { LG.StepNext(4); //可以取料 去取料位置 } } else { LG.StepNext(14); //去 判断 } } break; case 4: if (whichNuzzle == 0) { Ltime.Stop(); Lsticktime = (int)Ltime.ElapsedMilliseconds; Ltime.Restart(); } else { Rtime.Stop(); Rsticktime = (int)Rtime.ElapsedMilliseconds; Rtime.Restart(); } CTRCard.Axis_X.MC_MoveAbs(Para.Stickdata.FeederPara.TakePos.X); CTRCard.Axis_Y.MC_MoveAbs(Para.Stickdata.FeederPara.TakePos.Y); //到拍照位置 DeviceRsDef.Q_UpLighSource.ON(); //上光源打开 LG.StepNext(5); break; case 5: if (CTRCard.XYArrive) { //VisionProject.Instance.visionApi.TrigRun(0, 2);//触发拍照 LG.StepNext(6); } break; case 6: if (Product.Inst.IsAging) { if (LG.Delay(200)) { CCDresult.X = 0; CCDresult.Y = 0; CCDresult.R = 0; LG.StepNext(7); } } else { //if (VisionProject.Instance.visionApi.Trig == false)//相机触发的值 //{ // if (VisionProject.Instance.visionApi.Error == 0)//相机接口错误码 // { // LG.StepNext(7);//xy到取标位置 // DeviceRsDef.Q_UpLighSource.OFF();//上相机光源关闭 // } // else // { // LG.StepNext(101);//重新送料 // CTCount++;//拍照识别次数 // if (CTCount > 2)//大于2就视觉NG // { // CTCount = 0;//重新置零 // Alarm.SetAlarm(AlarmLevelEnum.Level2, "Feeder视觉NG");//报警 // } // } //} } break; case 7: CTRCard.Q_Blow[whichNuzzle].OFF(); //吹气关闭 if (Product.Inst.IsAging) { if (LG.Delay(500)) { CCDresult.X = 0; CCDresult.Y = 0; CCDresult.R = 0; } } //else if (VisionProject.Instance.visionApi.Result.Length == 2) //{ // CCDresult.X = (float)VisionProject.Instance.visionApi.Result[TakeCount].X;//ccd的x值[改为链表形式] // CCDresult.Y = (float)VisionProject.Instance.visionApi.Result[TakeCount].Y;//ccd的y值 // CCDresult.R = -(float)VisionProject.Instance.visionApi.Result[TakeCount].R;//ccd的r值 //} //else //{ // CCDresult.X = (float)VisionProject.Instance.visionApi.Result[0].X;//ccd的x值[改为链表形式] // CCDresult.Y = (float)VisionProject.Instance.visionApi.Result[0].Y;//ccd的y值 // CCDresult.R = -(float)VisionProject.Instance.visionApi.Result[0].R;//ccd的r值 //} CTRCard.Axis_X.MC_MoveAbs(TakePos(whichNuzzle).X + (float)CCDresult.X); CTRCard.Axis_Y.MC_MoveAbs(TakePos(whichNuzzle).Y + (float)CCDresult.Y); CTRCard.Axis_R[whichNuzzle].MC_MoveAbs((float)CCDresult.R); LG.StepNext(8); break; case 8: //XY到位后判断缓取,开始下压时打开吸嘴 if (CTRCard.RArrive && CTRCard.XYArrive) { if (whichNuzzle == 0) { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(Para.Stickdata.TakeLabelPara.LiftTakePos_Z); } else { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(Para.Stickdata.TakeLabelPara.RightTakePos_Z); } LG.StepNext(9); } break; case 9: if (CTRCard.ZArrive) { CTRCard.Q_Nuzzle[whichNuzzle].ON(); //真空打开 CTRCard.Q_Blow[whichNuzzle].OFF(); //吹气关闭 LG.StepNext(10); } break; case 10: if (whichNuzzle == 0) { Para.Stickdata.TakeLabelPara.TakeLableWholeLNum++; } else { Para.Stickdata.TakeLabelPara.TakeLableWholeRNum++; } LG.StepNext(11); break; case 11: //取标延时后Z轴抬起(缓抬) if (whichNuzzle == 0 && LG.Delay(Para.Stickdata.TakeLabelPara.LiftTakeDelay)) { LG.StepNext(201); } else if (whichNuzzle == 1 && LG.Delay(Para.Stickdata.TakeLabelPara.RightTakeDelay)) { LG.StepNext(201); } break; case 201: if (Para.Stickdata.FeederPara.FeederMode[1]) { //剥标板回退 LG.StepNext(202); } else { LG.StepNext(12); } break; case 202: if (Para.Stickdata.FeederPara.FeederMode[1]) //拨标板回退停止 { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(Para.Stickdata.ZSafePos); //Z轴抬起 LG.StepNext(13); } break; case 12: //取标延时后Z轴抬起 if (CTRCard.ZArrive) { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(Para.Stickdata.ZSafePos); LG.StepNext(13); } break; case 13: //检测真空//add if (CTRCard.ZArrive) //所有轴都到达 { if (!Product.Inst.IsAging && CTRCard.I_Vacuum[whichNuzzle].Value == false) { TakeNum++; if (TakeNum >= 2) { TakeNum = 0; LG.StepNext(101); //运行状态下进入14 重新剥标 CTRCard.Q_Nuzzle[whichNuzzle].Value = false; //吸真空电磁阀 Alarm.SetAlarm(AlarmLevelEnum.Level2, "取料失败,请检查真空和真空感应"); Para.ProcessData.NuzzlePara[whichNuzzle].isHave = false; //是否有料 } else { LG.StepNext(4); //到拍照位 } } else { if (whichNuzzle == 0) { Para.Stickdata.TakeLabelPara.TakeLableLNum++; } else { Para.Stickdata.TakeLabelPara.TakeLableRNum++; } LG.StepNext(14); //结束 Para.ProcessData.NuzzlePara[whichNuzzle].isHave = true; //有料 } } break; case 101: if (CTRCard.ZArrive) { LG.StepNext(4); } break; case 14: //结束 if (CTRCard.ZArrive) { whichNuzzle++; //吸嘴换成另一个吸嘴 TakeCount++; if (whichNuzzle >= 2) { LG.StepNext(15); } else { LG.StepNext(2); } } break; case 15: if (TakeCount >= 2) { LG.StepNext(0xef); } //else if (VisionProject.Instance.visionApi.Result.Length == 1) //{ // TakeCount = 0; // LG.StepNext(0xef); //} else if (Para.ProcessData.NuzzlePara[0].isHave == true && Para.ProcessData.NuzzlePara[1].isHave == true) { TakeCount = 0; LG.StepNext(0xef); } else { LG.StepNext(2); } break; case 0xef: LG.End(); break; } }
protected override void LogicImpl() { //放晶时循环处理提前控制真空和吹气 if (LG.Execute == true) { if (Tr.TrigOne(System.Math.Abs(DeviceRsDef.Ax_PickZ.currPos - Pos_Put.Z) <= Pos_Ahead, 0)) //当Z位置进入到提前范围内时,执行一次 { DeviceRsDef.Q_PickVacuo.OFF(); //关真空 DeviceRsDef.Q_PickBlow.ON(); //开吹气 } } switch (LG.Step) { case 1: if (!DeviceRsDef.Q_PickVacuo.Value || !DeviceRsDef.I_PickVacuo.value) //如果没取好片 { TaskMain.PickTake.Start(); //执行取片 } LG.StepNext(2); break; case 2: if (DeviceRsDef.Q_PickVacuo.Value && DeviceRsDef.I_PickVacuo.value) //如果取好片了 { FPointXYZR p = Pos_Put.Clone(); //取放晶点位置 p.Z = Pos_Put.Z - Pos_Slow; //Z修改为慢速点 TaskMain.PickJump.Start(p, true, TaskMain.PickJump.Pos_PreInpZ); //跳跃到放晶点的慢速高度,检测真空,Z带提前量 LG.StepNext(3); } else //如果没取好片 { LG.End(); //结束流程 } break; case 3: if (TaskMain.PickJump.GetSta() == 0) //跳跃结束 { if (TaskMain.PickJump.VacuoResult) //真空检测OK { DeviceRsDef.Ax_PickZ.MC_MoveAbs(Spd_Slow, Pos_Put.Z); //Z慢速到放晶位 LG.StepNext(4); } else //真空异常 { //要报警 PutOk = false; //标志放晶失败 LG.End(); } } break; case 4: if (!DeviceRsDef.Ax_PickZ.busy) //等待Z到位 { //DeviceRsDef.Q_PickVacuo.OFF();//由提前量控制吹气和真空 //DeviceRsDef.Q_PickBlow.ON(); Tm.Restart(); //到位开始计时 LG.StepNext(5); } break; case 5: if (Tm.ElapsedMilliseconds >= Tim_Put) //放晶时间到 { DeviceRsDef.Q_PickBlow.OFF(); //关闭吹气 TaskMain.PickTake.Start(); //取晶 TaskMain.TrayDesk.Start(Pos_Check); //相机移动到该点 LG.StepNext(6); } break; case 6: if (TaskMain.TrayDesk.GetSta() == 0 && DeviceRsDef.Ax_PickY.currPos < TaskMain.PickJump.Ready.Y + 1) { VisionSot = true; //触发视觉 LG.StepNext(7); } break; case 7: if (!VisionSot) //等待视觉结束 { PutOk = VisionRet; //标志放晶结果 LG.End(); } break; } }
protected override void LogicImpl() { var Para = Product.Inst.Stickdata; LG.Start(); switch (LG.Step) { case 1: whichProduct = 0; LG.StepNext(2); break; case 2: for (int i = 0; i < CTRCard.Axis_Z.Count; i++) { CTRCard.Axis_Z[i].MC_MoveAbs(0); } LG.StepNext(3); break; case 3: if (CTRCard.ZArrive) { if (Product.Inst.Stickdata.TrayData.ProductList.Count > 0) { LG.StepNext(4); } else { LG.StepNext(0xef); } } break; case 4: if (Para.CanBackCT) { CTRCard.Axis_X.MC_MoveAbs(TrayData.ProductList[whichProduct].BackCT.X); CTRCard.Axis_Y.MC_MoveAbs(TrayData.ProductList[whichProduct].BackCT.Y); LG.StepNext(5); } else { LG.StepNext(0xef); } break; case 5: if (CTRCard.XYArrive) { LG.StepNext(6); } break; case 6: if (CTRCard.XYArrive) { LG.StepNext(7); DeviceRsDef.Q_HoldLightCtrl.ON(); DeviceRsDef.Q_Light.OFF(); } break; case 7: if (LG.Delay(Para.CTDelay)) { //VisionProject.Instance.visionApi.TrigRun(3, 0); LG.StepNext(8); } break; case 8: if (Product.Inst.IsAging) { //老化模式下,不判断拍照结果 if (LG.TCnt(100)) { LG.StepNext(0xA0); } } else { //正常模式下 //if (VisionProject.Instance.visionApi.Trig == false) //{ // VisionProject.Instance.SaveBackCTFunImage(); // if (VisionProject.Instance.visionApi.Error == 0) // { // LG.StepNext(0xA0); // } // else // { // LG.StepNext(9); // } //} } break; case 0xA0: if (Product.Inst.IsAging) { LG.StepNext(9); } else { //ShowMessge.SendStartMsg(string.Format("产品{0}上物料精度 X:{1}Y:{2}R:{3}", whichProduct, VisionProject.Instance.visionApi.CheckStick[0].X, VisionProject.Instance.visionApi.CheckStick[0].Y, VisionProject.Instance.visionApi.CheckStick[0].R)); //ShowMessge.SendStartMsg(string.Format("产品{0}上物料精度 X:{1}Y:{2}R:{3}", whichProduct, VisionProject.Instance.visionApi.CheckStick[1].X, VisionProject.Instance.visionApi.CheckStick[1].Y, VisionProject.Instance.visionApi.CheckStick[1].R)); //ShowMessge.SendStartMsg(string.Format("产品{0}上物料精度 X:{1}Y:{2}R:{3}", whichProduct, VisionProject.Instance.visionApi.CheckStick[2].X, VisionProject.Instance.visionApi.CheckStick[2].Y, VisionProject.Instance.visionApi.CheckStick[2].R)); //ShowMessge.SendStartMsg(string.Format("产品{0}上物料精度 X:{1}Y:{2}R:{3}", whichProduct, VisionProject.Instance.visionApi.CheckStick[3].X, VisionProject.Instance.visionApi.CheckStick[3].Y, VisionProject.Instance.visionApi.CheckStick[3].R)); LG.StepNext(9); } break; case 9: whichProduct++; if (whichProduct >= TrayData.ProductList.Count) { LG.StepNext(0xef); } else { LG.StepNext(3); } break; case 0xef: LG.End(); break; } }
protected override void LogicImpl() { var Para = Product.Inst; switch (LG.Step) { case 1: whichNuzzle = 0; LG.StepNext(2); break; case 2: if (Para.ProcessData.NuzzlePara[whichNuzzle].isHave) //吸嘴有料 { if (CTRCard.ZArrive) { for (int i = 0; i < CTRCard.Axis_Z.Count; i++) { CTRCard.Axis_Z[i].MC_MoveAbs(Para.Stickdata.ZSafePos); //到安全位置拍照 } LG.StepNext(3); } } else { LG.StepNext(6); //没有料换另一个吸嘴 } break; case 3: if (CTRCard.ZArrive) //到相应的吸嘴拍照位置 { if (Para.ProcessData.NuzzlePara[whichNuzzle].isHave && whichNuzzle == 0) { CTRCard.Axis_X.MC_MoveAbs(Para.Stickdata.StickSysData.LiftDownCCDPos.X); CTRCard.Axis_Y.MC_MoveAbs(Para.Stickdata.StickSysData.LiftDownCCDPos.Y); DeviceRsDef.Q_DownLighSource.ON(); LG.StepNext(4); } else if (Para.ProcessData.NuzzlePara[whichNuzzle].isHave && whichNuzzle == 1) { CTRCard.Axis_X.MC_MoveAbs(Para.Stickdata.StickSysData.RightDownCCDPos.X); CTRCard.Axis_Y.MC_MoveAbs(Para.Stickdata.StickSysData.RightDownCCDPos.Y); DeviceRsDef.Q_DownLighSource.ON(); LG.StepNext(4); } else { LG.StepNext(6); } } break; case 4: if (CTRCard.XYArrive && LG.Delay(Para.Stickdata.CTDelay)) { //VisionProject.Instance.visionApi.TrigRun(1, whichNuzzle);//触发拍照 LG.StepNext(5); } break; case 5: if (Product.Inst.IsAging) { if (LG.Delay(100)) { Para.ProcessData.NuzzlePara[whichNuzzle].isOk = 1; Para.ProcessData.NuzzlePara[whichNuzzle].CCDPos.X = 0; Para.ProcessData.NuzzlePara[whichNuzzle].CCDPos.Y = 0; Para.ProcessData.NuzzlePara[whichNuzzle].CCDPos.R = 0; LG.StepNext(6); } DeviceRsDef.Q_DownLighSource.OFF(); } else { //if (VisionProject.Instance.visionApi.TrigComplete() == true) //{ // var va = VisionProject.Instance.visionApi; // //判断拍照结果 // if (VisionProject.Instance.visionApi.Error == 0) // { // Para.ProcessData.NuzzlePara[whichNuzzle].isOk = 1; // Para.ProcessData.NuzzlePara[whichNuzzle].isHave = true; // Para.ProcessData.NuzzlePara[whichNuzzle].CCDPos.X = (float)VisionProject.Instance.visionApi.Result[0].X; // Para.ProcessData.NuzzlePara[whichNuzzle].CCDPos.Y = (float)VisionProject.Instance.visionApi.Result[0].Y; // Para.ProcessData.NuzzlePara[whichNuzzle].CCDPos.R = -(float)VisionProject.Instance.visionApi.Result[0].R; // DeviceRsDef.Q_DownLighSource.OFF(); // } // else // { // Para.ProcessData.NuzzlePara[whichNuzzle].isOk = 2; // } // LG.StepNext(6); //} } break; case 6: if (CTRCard.RArrive) { whichNuzzle++; if (whichNuzzle >= 2) { LG.StepNext(0xef); } else { LG.StepNext(2); } } break; case 0xef: LG.End(); break; } }
protected override void LogicImpl() { var Para = Product.Inst; LG.Start(); switch (LG.Step) { case 1: NuzzleParaInit(); LG.StepNext(2); CanMarkscan = true; break; case 2: feeder.Start(); if (Para.Stickdata.StickSysData.stright) { LG.StepNext(0xef); } else { Para.ProcessData.StickPosList.Clear(); Para.ProcessData.currWhichPoint = 0; Para.ProcessData.currWhichProduct = 0; for (int i = 0; i < Product.Inst.Stickdata.TrayData.ProductList.Count; i++) { Para.ProcessData.StickPosList.Add(Product.Inst.Stickdata.TrayData.ProductList[i].Clone()); } LG.StepNext(3); } break; case 3: if (feeder.GetDone) { takelabel.Start(); //取料 LG.StepNext(4); } break; case 4: if (takelabel.GetDone) { downCCD.Start(); //下相机拍照 LG.StepNext(5); } break; case 5: if (downCCD.GetDone) { bool isGiveUp = false; for (int i = 0; i < 2; i++) { //根据吸嘴上是否有料,并且下相机拍照NG,则满足弃料条件 if (Para.ProcessData.NuzzlePara[i].isOk != 1 && Para.ProcessData.NuzzlePara[i].isHave) { isGiveUp = true; } } if (isGiveUp) { giveup.Start(); feeder.Start(); LG.StepNext(101); break; } else { LG.StepNext(6); } feeder.Start(); } break; case 101: if (giveup.GetDone && feeder.GetDone) { LG.StepNext(3); } break; case 6: if (TaskMain.feed.GetDone && //暂时替代皮带流程 DeviceRsDef.I_BeltFeedIn.Value && TaskManager.Default.FSM.Status.ID == FSMStaDef.RUN || Product.Inst.IsAging ) { if (CanMarkscan) { markscan.Start(); LG.StepNext(7); CanMarkscan = false; } else { LG.StepNext(7); } } break; case 7: if (markscan.GetDone) { stick.Start(); LG.StepNext(8); } break; case 8: if (stick.GetDone) { if (Para.ProcessData.currWhichProduct >= Para.ProcessData.StickPosList.Count) { CanMarkscan = true; LG.StepNext(9); } else { LG.StepNext(102); } } break; case 102: LG.StepNext(3); break; case 9: scancode.Start(); LG.StepNext(10); break; case 10: if (scancode.GetDone) { LG.StepNext(11); } break; case 11: backCT.Start(); LG.StepNext(12); break; case 12: if (backCT.GetDone) { LG.StepNext(0xef); } break; case 0xef: if (Product.Inst.IsAging) { LG.StepNext(1); } else { LG.End(); } break; } }
protected override void LogicImpl() { var Para = Product.Inst; LG.Start(); switch (LG.Step) { case 1: //Z轴抬起到安全高度 if (CTRCard.ZArrive) { for (int i = 0; i < 2; i++) { CTRCard.Axis_Z[i].MC_MoveAbs(Para.Stickdata.GiveUpPara.SafePos_Z); } LG.StepNext(2); } whichNuzzle = 0; break; case 2: //判断轴到达 if (CTRCard.ZArrive) { LG.StepNext(3); } break; case 3: if (Para.ProcessData.NuzzlePara[whichNuzzle].isOk != 1 && Para.ProcessData.NuzzlePara[whichNuzzle].isHave == true) { LG.StepNext(4); } else { LG.StepNext(8); } break; case 4: //XY到弃标位 if (CTRCard.ZArrive) { if (whichNuzzle == 0) { CTRCard.Axis_X.MC_MoveAbs(Para.Stickdata.GiveUpPara.LiftGiveUpPos.X); CTRCard.Axis_Y.MC_MoveAbs(Para.Stickdata.GiveUpPara.LiftGiveUpPos.Y); LG.StepNext(5); } else { CTRCard.Axis_X.MC_MoveAbs(Para.Stickdata.GiveUpPara.RightGiveUpPos.X); CTRCard.Axis_Y.MC_MoveAbs(Para.Stickdata.GiveUpPara.RightGiveUpPos.Y); LG.StepNext(5); } } break; case 5: //Z到弃标高度 if (CTRCard.XYArrive) { if (whichNuzzle == 0) { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(Para.Stickdata.GiveUpPara.LiftGiveUp_Z); LG.StepNext(6); } else { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(Para.Stickdata.GiveUpPara.RightGiveUp_Z); LG.StepNext(6); } } break; case 6: //破真空,吹气 if (CTRCard.ZArrive) { CTRCard.Q_Nuzzle[whichNuzzle].OFF(); CTRCard.Q_Blow[whichNuzzle].ON(); Para.Stickdata.GiveUpPara.giveUpNum++; LG.StepNext(7); } break; case 7: if (LG.Delay(Para.Stickdata.GiveUpPara.GiveUpDelay)) /*弃料延时*/ { LG.StepNext(8); Para.ProcessData.NuzzlePara[whichNuzzle].isHave = false; CTRCard.Q_Blow[whichNuzzle].Value = false; CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(Para.Stickdata.GiveUpPara.SafePos_Z); } break; case 8: //Z轴回到安全位 if (CTRCard.ZArrive) { whichNuzzle++; if (whichNuzzle < CTRCard.Axis_Z.Count) { LG.StepNext(2); } else { LG.StepNext(0xef); } } break; case 0xef: LG.End(); break; } }
protected override void LogicImpl() { var Para = Product.Inst; switch (LG.Step) { case 1: //Z轴抬起到安全高度 if (Para.ProcessData.currWhichProduct >= Para.ProcessData.StickPosList.Count) { Para.ProcessData.currWhichProduct = 0; } else { if (Para.ProcessData.currWhichPoint >= Para.ProcessData.CurrStickWhichProduct().SiteList.Count) { Para.ProcessData.currWhichPoint = 0; } } if (Para.ProcessData.StickPosList.Count == 0) { Alarm.SetAlarm(AlarmLevelEnum.Level2, "没扫Mark点,不允许贴附"); LG.StepNext(0xef); } else { if (CTRCard.ZArrive) { for (int i = 0; i < 2; i++) { CTRCard.Axis_Z[i].MC_MoveAbs(Para.Stickdata.ZSafePos); } LG.StepNext(2); } } break; case 2: bool isCanStick = false; for (int i = 0; i < 2; i++) //扫描吸嘴个数 { if (Para.ProcessData.NuzzlePara[i].isOk == 1 && Para.ProcessData.NuzzlePara[i].isHave) { whichNuzzle = i; isCanStick = true; break; } } if (isCanStick) { StickPos(whichNuzzle); Para.ProcessData.NuzzlePara[whichNuzzle].isHave = false; Para.ProcessData.NuzzlePara[whichNuzzle].isOk = 0; LG.StepNext(3); } else { LG.StepNext(0xef); } break; case 3: //xy到贴标位置 if (CTRCard.ZArrive) { CTRCard.Axis_X.MC_MoveAbs(stickPos.X); CTRCard.Axis_Y.MC_MoveAbs(stickPos.Y); CTRCard.Axis_R[whichNuzzle].MC_MoveAbs(stickPos.R); LG.StepNext(4); } break; case 4: //系统稳定时间+第一段快速下降 if (CTRCard.XYArrive && CTRCard.RArrive && LG.TCnt(10)) { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(stickPos.Z - 5); LG.StepNext(5); } break; case 5: //第二段慢速下降 if (CTRCard.ZArrive) { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(30, stickPos.Z); LG.StepNext(6); } break; case 6: //到达贴标高度吸真空打开,吹气关闭 if (CTRCard.ZArrive) { CTRCard.Q_Nuzzle[whichNuzzle].ON(); CTRCard.Q_Blow[whichNuzzle].OFF(); LG.StepNext(7); } break; case 7: //真空延时后,很空关闭,吹气打开 if (LG.Delay(Para.Stickdata.StickPara.SuckOffDelay)) { CTRCard.Q_Nuzzle[whichNuzzle].OFF(); CTRCard.Q_Blow[whichNuzzle].ON(); LG.StepNext(8); } break; case 8: //吹气延时后吹气关闭 if (LG.Delay(Para.Stickdata.StickPara.SuckBlowDelay)) { CTRCard.Q_Blow[whichNuzzle].OFF(); Product.Inst.ProductYield.ProductCount(); //产量+1用于计算UPH LG.StepNext(9); } break; case 9: //Z轴回到安全位 if (CTRCard.ZArrive) { CTRCard.Axis_Z[whichNuzzle].MC_MoveAbs(Para.Stickdata.ZSafePos); LG.StepNext(10); } break; case 10: //Z轴到位后 if (CTRCard.Axis_Z[whichNuzzle].status == AxState.AXSTA_READY) { CTRCard.Axis_R[whichNuzzle].MC_MoveAbs(0); LG.StepNext(11); } break; case 11: Para.ProcessData.currWhichPoint++; //点位++ if (Para.ProcessData.currWhichPoint >= Para.ProcessData.StickPosList[Para.ProcessData.currWhichProduct].SiteList.Count) { Para.ProcessData.currWhichPoint = 0; //点位置0 Para.ProcessData.currWhichProduct++; //产品加1 if (Para.ProcessData.currWhichProduct >= Para.ProcessData.StickPosList.Count) { //Para.ProcessData.currWhichPoint = 0;//点位置0 //Para.ProcessData.currWhichProduct = 0;//产品置0 LG.StepNext(0xef); break; } } LG.StepNext(2); if (!Para.ProcessData.NuzzlePara[0].isHave && !Para.ProcessData.NuzzlePara[1].isHave) { LG.StepNext(0xef); //两个吸嘴都没有料就结束 } break; case 0xef: LG.End(); break; } }
public static lua_State lua_newstate(lua_Alloc f, object ud) { int i; lua_State L; global_State g; LG l = (LG)f(typeof(LG)); //FIXME:(LG)(f(ud, null, LUA_TTHREAD, (uint)(GetUnmanagedSize(typeof(LG))))); //FIXME:???not sync, LUA_TTHREAD if (l == null) { return(null); } L = l.l.l; g = l.g; L.next = null; L.tt = LUA_TTHREAD; g.currentwhite = (lu_byte)bit2mask(WHITE0BIT, FIXEDBIT); L.marked = luaC_white(g); g.gckind = KGC_NORMAL; lu_byte marked = L.marked; // can't pass properties in as ref ???//FIXME:??? //FIXME:added L.marked = marked; //remove this //FIXME:??? //FIXME:added preinit_state(L, g); g.frealloc = f; g.ud = ud; g.mainthread = L; g.seed = makeseed(L); g.uvhead.u.l.prev = g.uvhead; g.uvhead.u.l.next = g.uvhead; g.gcrunning = 0; /* no GC while building state */ g.GCestimate = 0; g.strt.size = 0; g.strt.nuse = 0; g.strt.hash = null; setnilvalue(g.l_registry); luaZ_initbuffer(L, g.buff); g.panic = null; g.version = null; g.gcstate = GCSpause; g.allgc = null; g.finobj = null; g.tobefnz = null; g.sweepgc = g.sweepfin = null; g.gray = g.grayagain = null; g.weak = g.ephemeron = g.allweak = null; g.totalbytes = (uint)GetUnmanagedSize(typeof(LG)); g.GCdebt = 0; g.gcpause = LUAI_GCPAUSE; g.gcmajorinc = LUAI_GCMAJOR; g.gcstepmul = LUAI_GCMUL; for (i = 0; i < LUA_NUMTAGS; i++) { g.mt[i] = null; } if (luaD_rawrunprotected(L, f_luaopen, null) != LUA_OK) { /* memory allocation error: free partial state */ close_state(L); L = null; } return(L); }
/// <summary> /// 停止任务 /// </summary> public virtual void Stop() { LG.Stop(); }