/// <summary> /// 初始化 /// </summary> /// <param name="machineID"></param> public ProfileDataBLL() { m_SQLProfileDataDAL = new DAL.SqlDAL.HBIMSN.ProfileDataDAL(); //m_SQLiteProfileDataDAL = new DAL.SQLiteDAL.HBIMSN.ProfileDataDAL(); m_ProfileData = null; m_ProfileDataBackUp = null; m_ProfileDataSQLite = null; }
/// <summary> /// 從服務器DownLoad主檔數據 /// </summary> private void GetProfileDataFromServer(string machineID) { string machineType = string.Empty; string areaID = string.Empty; try { Model.ProfileData profileData = new Model.ProfileData(); // 機台主檔 profileData.MachineMaster = m_SQLProfileDataDAL.GetMachineMaster(); if (profileData.MachineMaster != null && profileData.MachineMaster.Count > 0) { MachineMaster_mmt_Info machineInfo = profileData.MachineMaster.Where(t => t.mmt_cMachineID.Trim() == machineID.Trim()).FirstOrDefault(); if (machineInfo != null && machineInfo.mmt_cModel.Trim().Length > 0) { int speed = 0; int.TryParse(machineInfo.mmt_cModel, out speed); profileData.MachineSpeed = speed; } } //獲取機台所屬類型 if (profileData.MachineMaster != null && profileData.MachineMaster.Count > 0) { MachineMaster_mmt_Info machineMasterInfo = null; machineMasterInfo = profileData.MachineMaster.FirstOrDefault(f => f.mmt_cMachineID == machineID); if (machineMasterInfo != null) { machineType = machineMasterInfo.mmt_cMachineType; areaID = machineMasterInfo.mmt_cAreaID.ToString().Trim(); } } /// 區域主檔 profileData.AreaMaster = m_SQLProfileDataDAL.GetAreaMaster(); /// 字碼主檔 profileData.CodeMaster = m_SQLProfileDataDAL.GetCodeMaster(); /// 就餐主檔 profileData.DinnerMaster = m_SQLProfileDataDAL.GetDinnerMaster(areaID, machineID); /// 菜單主檔 profileData.FormMaster = m_SQLProfileDataDAL.GetFormMaster(); /// 空閒狀態主檔 profileData.IdleStateMaster = m_SQLProfileDataDAL.GetIdleStateMaster(); /// 機台準備項主檔 profileData.MachinePrepareItemMapping = m_SQLProfileDataDAL.GetMachinePrepareItemMapping(machineID); /// 停機原因主檔 profileData.MachineStopReasonMapping = m_SQLProfileDataDAL.GetMachineStopReasonMapping(machineID); /// 保養動作主檔 profileData.MaintainOperationMaster = m_SQLProfileDataDAL.GetMaintainOperationMaster(machineType); /// 保養計劃主檔 profileData.MaintainPlanMaster = m_SQLProfileDataDAL.GetMaintainPlanMaster(machineType); ///獲取保養動作所對應的部件 profileData.MaintainOperationEquipments = m_SQLProfileDataDAL.GetMaintainOperationEquipment(); /// 物料群組明細主檔 profileData.MixMaterialDetailMaster = m_SQLProfileDataDAL.GetMixMaterialDetailMaster(); /// 物料群組主檔 profileData.MixMaterialGroupMaster = m_SQLProfileDataDAL.GetMixMaterialGroupMaster(); /// 物料主檔 profileData.MaterialMaster = m_SQLProfileDataDAL.GetMaterialMaster(); /// 機台準備工作主檔 profileData.PrepareProjectMaster = m_SQLProfileDataDAL.GetPrepareProjectMaster(machineID); /// 班次信息 profileData.ShiftInfo = m_SQLProfileDataDAL.GetShiftInfo(machineID); /// 班次類型主檔 profileData.ShiftTypeMaster = m_SQLProfileDataDAL.GetShiftTypeMaster(machineID); /// 特殊班次類型主檔 profileData.SpecialShiftTypeMaster = m_SQLProfileDataDAL.GetSpecialShiftTypeMaster(machineID); /// 工程狀態信號控制主檔 profileData.SignalLightsStatusMaster = m_SQLProfileDataDAL.GetSignalLightsStatusMaster(machineID); /// 人員主檔 profileData.StaffInfoMaster = m_SQLProfileDataDAL.GetStaffInfoMaster(); /// 停機原因主檔 profileData.StopReasonMaster = m_SQLProfileDataDAL.GetStopReasonMaster(machineID); /// 結構主檔 profileData.StructureMaster = m_SQLProfileDataDAL.GetStructureMaster(); /// 假期主檔 profileData.VacationMaster = m_SQLProfileDataDAL.GetVacationMaster(); /// 工作組 profileData.WorkGroupTypeMaster = m_SQLProfileDataDAL.GetWorkGroupTypeMaster(); ///QC問題 profileData.QualityProblemMaster = m_SQLProfileDataDAL.GetQualityProblemMaster(machineType); //班次中的工程列表,用於補錄歷史記錄 if (profileData.ShiftInfo != null && profileData.ShiftInfo.Count > 0) { profileData.ShiftProjList = m_SQLProfileDataDAL.GetShiftProjList(profileData.ShiftInfo.Select(s => s.sifo_RecordID.ToString()).ToList()); } if (m_ProfileData != null) m_ProfileDataBackUp = m_ProfileData; m_ProfileData = profileData; } catch (Exception ex) { throw ex; } }