/// <summary>
        /// 創建班次人員工作時間信息
        /// </summary>
        /// <param name="staffInfo">班次人員工作信息</param>
        /// <param name="isCaptain">是否為機長</param>
        /// <returns></returns>
        ShiftStaffWorkTimeInfo GetShiftStaffWorkTimeInfo(MachineStaffInfo staffInfo, bool isCaptain)
        {
            ShiftStaffWorkTimeInfo staffWorkTimeInfo = null;

            if (staffInfo != null && staffInfo.Code.Trim().Length > 0)
            {
                ShiftStaff oldStaffWorkTimeInfo = null;

                if (this.CurrentMachineShiftInfo.StaffInfos != null && this.CurrentMachineShiftInfo.StaffInfos.Count > 0)
                {
                    Guid staffID = new Guid(staffInfo.Code);
                    oldStaffWorkTimeInfo = this.CurrentMachineShiftInfo.StaffInfos.SingleOrDefault(t => t.ssta_SIMID == staffID);
                }

                staffWorkTimeInfo = new ShiftStaffWorkTimeInfo();
                staffWorkTimeInfo.Code = staffInfo.Code;
                staffWorkTimeInfo.Name = staffInfo.StaffNameNo;
                staffWorkTimeInfo.IsCaptain = isCaptain;

                if (this.CurrentMachineShiftInfo != null)
                {
                    if (oldStaffWorkTimeInfo != null && oldStaffWorkTimeInfo.StartTime != null)
                    {
                        staffWorkTimeInfo.StartTime = oldStaffWorkTimeInfo.StartTime;
                    }
                    else
                    {
                        staffWorkTimeInfo.StartTime = this.CurrentMachineShiftInfo.sifo_dBeginTime;
                    }

                    if (oldStaffWorkTimeInfo != null && oldStaffWorkTimeInfo.EndTime != null)
                    {
                        staffWorkTimeInfo.EndTime = oldStaffWorkTimeInfo.EndTime;
                    }
                    else
                    {
                        staffWorkTimeInfo.EndTime = this.CurrentMachineShiftInfo.sifo_dEndTime;
                    }
                }
            }

            return staffWorkTimeInfo;
        }
        /// <summary>
        /// 驗證人員的工作時間合理性
        /// </summary>
        /// <param name="staff">人員信息</param>
        /// <returns></returns>
        ReturnValueInfo CheckShiftStaffWorkTimeInformation(MachineStaffInfo staff)
        {
            ReturnValueInfo returnInfo = new ReturnValueInfo();

            returnInfo.boolValue = true;

            if (staff != null)
            {
                if (staff.StartTime != null && staff.EndTime != null)
                {
                    if (staff.StartTime >= staff.EndTime)
                    {
                        returnInfo.boolValue = false;
                        returnInfo.messageText = staff.StaffNameNo + "  工作開始時間不能大於工作結束時間!";
                        return returnInfo;
                    }

                    if (staff.StartTime < this.CurrentMachineShiftInfo.sifo_dBeginTime || staff.StartTime > this.CurrentMachineShiftInfo.sifo_dEndTime)
                    {
                        returnInfo.boolValue = false;
                        returnInfo.messageText = staff.StaffNameNo + "  工作開始時間不能超出本班次的時間範圍!";
                        return returnInfo;
                    }

                    if (staff.EndTime < this.CurrentMachineShiftInfo.sifo_dBeginTime || staff.EndTime > this.CurrentMachineShiftInfo.sifo_dEndTime)
                    {
                        returnInfo.boolValue = false;
                        returnInfo.messageText = staff.StaffNameNo + "  工作開始時間不能超出本班次的時間範圍!";
                        return returnInfo;
                    }
                }
            }

            return returnInfo;
        }
        /// <summary>
        /// 創建班次人員信息
        /// </summary>
        /// <param name="currentShiftID">班次ID</param>
        /// <param name="staffID">人員ID</param>
        /// <param name="isCaptain">是否為機長</param>
        /// <returns></returns>
        ShiftStaff CreateShiftStaffInfo(Guid currentShiftID, MachineStaffInfo staff, bool isCaptain)
        {
            ShiftStaff staffInfo = new ShiftStaff();

            staffInfo.RecordID = Guid.NewGuid();
            staffInfo.RecordEditStatus = 1;
            staffInfo.ssta_SIFOID = currentShiftID;
            staffInfo.ssta_SIMID = new Guid(staff.Code);
            staffInfo.StaffName = this.GetStaffName(staffInfo.ssta_SIMID);
            staffInfo.StartTime = staff.StartTime;
            staffInfo.EndTime = staff.EndTime;
            staffInfo.IsCaptain = isCaptain;

            return staffInfo;
        }
        /// <summary>
        /// 保存班次記錄的人員信息
        /// </summary>
        /// <param name="gCaptainID">機長ID</param>
        /// <param name="listSelectedStaffs">機組人員列表</param>
        public override ReturnValueInfo SaveShiftStaffInfos(MachineStaffInfo captain, List<MachineStaffInfo> listSelectedStaffs)
        {
            ReturnValueInfo returnInfo = null;

            returnInfo = this.CheckAllShiftStaffWorkTimeInformation(captain, listSelectedStaffs);

            if (returnInfo != null)
            {
                if (!returnInfo.boolValue)
                {
                    return returnInfo;
                }
            }

            MachineShiftData currentShiftData = base.CurrentMachineShiftInfo;

            currentShiftData.StaffInfos = new List<ShiftStaff>();

            currentShiftData.sifo_DutyCaptainID = Guid.Empty;
            currentShiftData.DutyCaptain = "";

            if (captain != null)
            {
                currentShiftData.sifo_DutyCaptainID = new Guid(captain.Code);
                currentShiftData.DutyCaptain = this.GetStaffName(currentShiftData.sifo_DutyCaptainID);

                ShiftStaff shiftStaffInfo = CreateShiftStaffInfo(currentShiftData.RecordID, captain, true);
                currentShiftData.StaffInfos.Add(shiftStaffInfo);
            }

            currentShiftData.AddDate = Convert.ToDateTime(DateTime.Now.ToString());
            currentShiftData.LastDate = Convert.ToDateTime(DateTime.Now.ToString());

            if (listSelectedStaffs != null && listSelectedStaffs.Count > 0)
            {
                foreach (MachineStaffInfo item in listSelectedStaffs)
                {
                    if (item != null)
                    {
                        ShiftStaff shiftStaffInfo = CreateShiftStaffInfo(currentShiftData.RecordID, item, false);
                        currentShiftData.StaffInfos.Add(shiftStaffInfo);
                    }
                }
            }

            currentShiftData.RecordEditStatus = 2;
            base.OnProductionChanged(currentShiftData);
            base.OnCloseShiftInformationForm();

            return returnInfo;
        }
        /// <summary>
        /// 驗證所有班次人員的工作時間合理性
        /// </summary>
        /// <param name="captain">機長信息</param>
        /// <param name="listSelectedStaffs">副手人員列表</param>
        /// <returns></returns>
        ReturnValueInfo CheckAllShiftStaffWorkTimeInformation(MachineStaffInfo captain, List<MachineStaffInfo> listSelectedStaffs)
        {
            ReturnValueInfo returnInfo = null;

            returnInfo = this.CheckShiftStaffWorkTimeInformation(captain);
            if (returnInfo != null)
            {
                if (!returnInfo.boolValue)
                {
                    return returnInfo;
                }
            }

            if (listSelectedStaffs != null && listSelectedStaffs.Count > 0)
            {
                returnInfo = null;
                for (int i = 0; i < listSelectedStaffs.Count; i++)
                {
                    returnInfo = this.CheckShiftStaffWorkTimeInformation(listSelectedStaffs[i]);
                    if (returnInfo != null)
                    {
                        if (!returnInfo.boolValue)
                        {
                            return returnInfo;
                        }
                    }
                }
            }

            return returnInfo;
        }
        /// <summary>
        /// 獲取班次的機長及機組人員情況描述
        /// </summary>
        /// <param name="strCaptainName">機長名稱</param>
        /// <param name="listSelectedStaffs">機組人員信息列表</param>
        /// <returns>情況描述</returns>
        public override List<ShiftStaffWorkTimeInfo> GetShiftStaffWorkTimeInfos(MachineStaffInfo captainInfo, List<MachineStaffInfo> listSelectedStaffs)
        {
            if (captainInfo == null && listSelectedStaffs == null)
            {
                return null;
            }

            List<ShiftStaffWorkTimeInfo> staffWorkTimeInfos = new List<ShiftStaffWorkTimeInfo>();
            ShiftStaffWorkTimeInfo staffWorkTimeInfo = null;

            staffWorkTimeInfo = GetShiftStaffWorkTimeInfo(captainInfo, true);

            if (staffWorkTimeInfo != null)
            {
                staffWorkTimeInfos.Add(staffWorkTimeInfo);
            }

            if (listSelectedStaffs != null && listSelectedStaffs.Count > 0)
            {
                for (int i = 0; i < listSelectedStaffs.Count; i++)
                {
                    staffWorkTimeInfo = GetShiftStaffWorkTimeInfo(listSelectedStaffs[i], false);

                    if (staffWorkTimeInfo != null)
                    {
                        staffWorkTimeInfos.Add(staffWorkTimeInfo);
                    }
                }
            }

            return staffWorkTimeInfos;
        }
Esempio n. 7
0
        /// <summary>
        /// 獲取機台資料MachineBaseData
        /// </summary>
        /// <returns></returns>
        public MachineBaseData GetMachineBaseData()
        {
            if (m_ProfileData == null)
            {
                throw new Exception("不存在機台所需要的基本資料!");
            }

            Model.ProfileData profileData = m_ProfileData;

            string dFormat;
            CodeMaster_cmt_Info code;
            List<CodeMaster_cmt_Info> codes;
            MachineBaseData data = new MachineBaseData();
            List<ShiftInformationHistoryRecord> shiftHistory = new List<ShiftInformationHistoryRecord>();
            List<MachineAreaInfo> areaList = new List<MachineAreaInfo>();
            List<MachineInformation> machineList = new List<MachineInformation>();
            List<MachineStaffInfo> machineStaffInfoList = new List<MachineStaffInfo>();
            List<ShiftTypeInfo> shiftTypeInfoList = new List<ShiftTypeInfo>();
            List<ShiftTypeInfo> specialShiftTypeInfoList = new List<ShiftTypeInfo>();
            List<MachineMaintainPlanInfo> maintainPlanList = new List<MachineMaintainPlanInfo>();
            List<MachineMaintainOperationEquipment> maintainOperationEquipmentList = new List<MachineMaintainOperationEquipment>();
            List<MachineMaintainOperation> machineMaintainOperations = new List<MachineMaintainOperation>();
            List<BaseModel> machineMaintainOperationList = new List<BaseModel>();
            List<MachineRepairRequestStructure> machineRepairRequestStructureList = new List<MachineRepairRequestStructure>();

            List<BaseModel> machineRepairRequestItemList = new List<BaseModel>();
            List<BaseModel> machineRepairRequestGradeList = new List<BaseModel>();
            List<BaseModel> departmentList = new List<BaseModel>();

            List<VacationInfo> vacationInfoList = new List<VacationInfo>();
            List<BaseModel> vacationOTReasonList = new List<BaseModel>();
            List<MachineIdleStateName> machineIdleStateNameList = new List<MachineIdleStateName>();
            List<BaseModel> machineStatuList = new List<BaseModel>();
            List<SignalLightsStatusInfo> signalLightsStatusInfoList = new List<SignalLightsStatusInfo>();
            List<DinnerPlanInfo> dinnerPlanInfoList = new List<DinnerPlanInfo>();
            List<BaseModel> plcBaudRateList = new List<BaseModel>();

            data.ShiftHistory = shiftHistory;
            data.MachineAreas = areaList;
            data.MachineInformations = machineList;
            data.MachineStaffInfos = machineStaffInfoList;
            data.ShiftTypeInfos = shiftTypeInfoList;
            data.SpecialShiftTypeInfos = specialShiftTypeInfoList;
            data.MachineMaintainPlanInfos = maintainPlanList;
            data.MachineMaintainOperations = machineMaintainOperationList;
            data.MachineMaintainOperationList = machineMaintainOperations;
            data.MachineRepairRequestStructures = machineRepairRequestStructureList;
            data.MachineRepairRequestItems = machineRepairRequestItemList;
            data.MachineRepairRequestGrades = machineRepairRequestGradeList;
            data.Departments = departmentList;
            data.VacationInfos = vacationInfoList;
            data.VacationOTReasons = vacationOTReasonList;
            data.MachineIdleStateNames = machineIdleStateNameList;
            data.MachineStatus = machineStatuList;
            data.SignalLightsStatusInfos = signalLightsStatusInfoList;
            data.DinnerPlanInfos = dinnerPlanInfoList;
            data.PLCBaudRates = plcBaudRateList;
            data.MachineMaintainOperationEquipments = maintainOperationEquipmentList;

            try
            {
                code = GetCodeMasters(profileData, DefineConstantValue.CodeMasterDefine.KEY1_SYSTEM, DefineConstantValue.CodeMasterDefine.KEY2_SETTING, DefineConstantValue.CodeMasterDefine.VALUE_DFormat);
                if (code != null)
                {
                    dFormat = code.cmt_cRemark;
                }
                else
                {
                    dFormat = "yyyy/MM/dd";
                }

                //班次歷史記錄列表

                foreach (ShiftInfo_sifo_Info item in profileData.ShiftInfo)
                {
                    ShiftInformationHistoryRecord obj = new ShiftInformationHistoryRecord();
                    obj.Code = item.sifo_RecordID.ToString();
                    obj.Description = item.sifo_dBeginTime.Value.ToString(dFormat);
                    ShiftTypeMaster_stm_Info shiftType = profileData.ShiftTypeMaster.FirstOrDefault(f => f.stm_iRecordID == item.sifo_iSTMID);
                    if (shiftType != null)
                    {
                        obj.Description += " " + shiftType.stm_cShiftName;
                    }
                    if (profileData.ShiftProjList != null && profileData.ShiftProjList.Count > 0)
                    {
                        obj.HistoryShiftProjects = profileData.ShiftProjList.Where(w => w.spl_SIFOID.ToString() == obj.Code)
                            .Select(s => new BaseModel() { Code = s.spl_RecordID.ToString(), Description = "" })
                            .ToList();
                    }
                    shiftHistory.Add(obj);
                }

                //機台區域列表
                foreach (AreaMaster_amr_Info item in profileData.AreaMaster)
                {
                    MachineAreaInfo obj = new MachineAreaInfo()
                    {
                        Code = item.amr_cRecordID.ToString(),
                        Description = item.amr_cAreaName,
                        MachineInformations = profileData.MachineMaster.Where(s => s.mmt_cAreaID == item.amr_cRecordID && s.mmt_iIsPublic == false || s.mmt_iIsPublic == true)
                        .Select(s => new MachineInformation
                        {
                            AreaCode = item.amr_cRecordID.ToString(),
                            Description = s.mmt_cMachineID,
                            Code = s.mmt_cMachineID
                        }).ToList(),
                        MachineStaffInfos = profileData.StaffInfoMaster.Where(w => w.sim_amrID == item.amr_cRecordID)
                        .Select(s => new MachineStaffInfo
                        {
                            AreaCode = s.sim_amrID.ToString(),
                            Code = s.sim_iRecordID.ToString(),
                            Description = s.sim_cStaffName,
                            IsCaptain = s.sim_lIsCaptain
                        }).ToList(),
                    };
                    areaList.Add(obj);
                }

                //機台列表
                foreach (MachineMaster_mmt_Info item in profileData.MachineMaster)
                {
                    MachineInformation obj = new MachineInformation();

                    obj.Code = item.mmt_cMachineID;
                    obj.Description = item.mmt_cMachineID;
                    obj.AreaCode = item.mmt_cAreaID.ToString();
                    obj.MachineType = item.mmt_cMachineType;

                    if (item.mmt_cModel.Trim().Length > 0)
                    {
                        int speed = 0;
                        int.TryParse(item.mmt_cModel, out speed);

                        obj.MachineSpeed = speed;
                    }

                    machineList.Add(obj);
                }
                //機組人員列表
                foreach (StaffInfoMaster_sim_Info item in profileData.StaffInfoMaster)
                {
                    string stattInfoDesc = string.Empty;

                    if (!string.IsNullOrEmpty(item.sim_cStaffName))
                    {
                        stattInfoDesc += item.sim_cStaffName;
                    }

                    if (!string.IsNullOrEmpty(item.sim_cStaffNo))
                    {
                        stattInfoDesc += "(" + item.sim_cStaffNo.Trim() + ")";
                    }

                    MachineStaffInfo obj = new MachineStaffInfo()
                    {
                        AreaCode = item.sim_amrID.ToString(),
                        IsCaptain = item.sim_lIsCaptain,
                        Code = item.sim_iRecordID.ToString(),
                        Description = item.sim_cStaffName,
                        StaffNameNo = stattInfoDesc,
                        StaffNo = item.sim_cStaffNo
                    };
                    machineStaffInfoList.Add(obj);
                }

                //班次類型信息列表
                foreach (ShiftTypeMaster_stm_Info item in profileData.ShiftTypeMaster)
                {
                    if (item != null && item.stm_lIsAtive == true)
                    {
                        ShiftTypeInfo obj = new ShiftTypeInfo()
                        {
                            Code = item.stm_iRecordID.ToString(),
                            BeginTime = item.stm_cBeginTime,
                            EndTime = item.stm_cEndTime,
                            Description = item.stm_cShiftName
                        };
                        shiftTypeInfoList.Add(obj);
                    }
                }

                //特殊班次類型信息列表
                foreach (ShiftTypeMaster_stm_Info item in profileData.SpecialShiftTypeMaster)
                {
                    if (item != null && item.stm_lIsAtive == true)
                    {
                        ShiftTypeInfo obj = new ShiftTypeInfo()
                        {
                            Code = item.stm_iRecordID.ToString(),
                            SpecialShiftDate = item.ShiftDate,
                            BeginTime = item.stm_cBeginTime,
                            EndTime = item.stm_cEndTime,
                            Description = item.stm_cShiftName
                        };
                        specialShiftTypeInfoList.Add(obj);
                    }
                }

                //機台保養計劃設置列表
                foreach (MaintainPlan_mtp_Info item in profileData.MaintainPlanMaster)
                {
                    MachineMaintainPlanInfo obj = new MachineMaintainPlanInfo()
                    {
                        Code = item.mtp_iRecordID.ToString(),
                        BeginDate = item.mtp_dBeginDate,
                        WorkTime = item.mtp_dWorkTime,
                        ExpireTime = item.mtp_dExpireTime,
                        Description = "",
                        DateIndex = item.mtp_cDateIndex,
                        PeriodType = item.mtp_iPeriodType,
                        MaintainOperationID = item.mtp_iMOMID.Value
                    };

                    maintainPlanList.Add(obj);
                }
                //機台保養動作名稱列表
                foreach (MaintainOperationMaster_mom_Info item in profileData.MaintainOperationMaster)
                {
                    BaseModel obj = new BaseModel()
                    {
                        Code = item.mom_iRecordID.ToString(),
                        Description = item.mom_cOperationName,
                    };
                    machineMaintainOperationList.Add(obj);

                    MachineMaintainOperation operation = new MachineMaintainOperation()
                    {
                        Code = item.mom_cOperationCode,
                        RecordID=item.mom_iRecordID,
                        Description = item.mom_cOperationName,
                        OperationType = item.mom_cOperationType,
                        CompleteTime=item.mom_iCompleteTime,
                        StandardFilePath=item.mom_cStandardFilePath,
                    };

                    machineMaintainOperations.Add(operation);
                }

                //保養動作部件列表列表
                if (profileData.MaintainOperationEquipments != null && profileData.MaintainOperationEquipments.Count > 0)
                {
                    foreach (MaintainPlanEquipmentMapping_mpe_Info item in profileData.MaintainOperationEquipments)
                    {
                        if (item != null)
                        {
                            MachineMaintainOperationEquipment obj = new MachineMaintainOperationEquipment()
                            {
                                mpe_cRecordID = item.mpe_cRecordID,
                                mpe_iMOMID = item.mpe_iMOMID,
                                mpe_cEquipmentNum = item.mpe_cEquipmentNum,
                                mpe_cEquipmentName = item.mpe_cEquipmentName,
                                mpe_cPreEquipmentNum = item.mpe_cPreEquipmentNum,
                                mpe_cRootEquipmentNum = item.mpe_cRootEquipmentNum,
                                mpe_cFullName = item.mpe_cFullName,
                                mpe_cFullNum = item.mpe_cFullNum,
                                mpe_dLastDate = item.mpe_dLastDate
                            };
                            maintainOperationEquipmentList.Add(obj);
                        }
                    }
                }

                // 機台維修請求結構列表
                List<StructureMaster_stt_Info> level1 = profileData.StructureMaster.Where(w => w.stt_cKey2 == Guid.Empty && w.stt_cKey3 == Guid.Empty).ToList();
                List<StructureMaster_stt_Info> level2 = profileData.StructureMaster.Where(w => w.stt_cKey1 != Guid.Empty && w.stt_cKey2 != Guid.Empty && w.stt_cKey3 == Guid.Empty).ToList();
                List<StructureMaster_stt_Info> level3 = profileData.StructureMaster.Where(w => w.stt_cKey1 != Guid.Empty && w.stt_cKey2 != Guid.Empty && w.stt_cKey3 != Guid.Empty).ToList();

                foreach (StructureMaster_stt_Info item in level1)
                {
                    MachineRepairRequestStructure obj = new MachineRepairRequestStructure()
                    {
                        Code = item.stt_iRecordID.ToString(),
                        Description = item.stt_cDesc,
                        SubStructures = new List<MachineRepairRequestStructure>()
                    };
                    obj.SubStructures = level2.Where(w => w.stt_cKey1 == item.stt_cKey1)
                            .Select(s => new MachineRepairRequestStructure()
                            {
                                Code = s.stt_iRecordID.ToString(),
                                Description = s.stt_cDesc,
                                SubStructures = new List<MachineRepairRequestStructure>()
                            }).ToList();

                    foreach (MachineRepairRequestStructure lv2 in obj.SubStructures)
                    {
                        StructureMaster_stt_Info sourceLV2 = level2.FirstOrDefault(s => s.stt_iRecordID.ToString() == lv2.Code);
                        if (sourceLV2 != null)
                        {
                            lv2.SubStructures = level3.Where(w => w.stt_cKey1 == sourceLV2.stt_cKey1 && w.stt_cKey2 == sourceLV2.stt_cKey2)
                                   .Select(s => new MachineRepairRequestStructure()
                                   {
                                       Code = s.stt_iRecordID.ToString(),
                                       Description = s.stt_cDesc,
                                       SubStructures = new List<MachineRepairRequestStructure>()
                                   }).ToList();
                        }
                    }
                    machineRepairRequestStructureList.Add(obj);
                }

                //機台維修請求維修項目列表

                codes = GetCodeMasters(profileData, DefineConstantValue.CodeMasterDefine.KEY1_PPCFORMITEM, DefineConstantValue.CodeMasterDefine.KEY2_PPCFORMITEM_MAINTENANCEITEM);
                foreach (CodeMaster_cmt_Info item in codes)
                {
                    BaseModel obj = new BaseModel()
                    {
                        Code = item.cmt_cValue,
                        Description = item.cmt_cRemark

                    };
                    machineRepairRequestItemList.Add(obj);
                }

                //機台維修請求維修級別列表

                codes = GetCodeMasters(profileData, DefineConstantValue.CodeMasterDefine.KEY1_PPCFORMITEM, DefineConstantValue.CodeMasterDefine.KEY2_PPCFORMITEM_MAINTENANCELEVEL);
                foreach (CodeMaster_cmt_Info item in codes)
                {
                    BaseModel obj = new BaseModel()
                    {
                        Code = item.cmt_cValue,
                        Description = item.cmt_cRemark

                    };
                    machineRepairRequestGradeList.Add(obj);
                }
                //科組列表
                codes = GetCodeMasters(profileData, DefineConstantValue.CodeMasterDefine.KEY1_TYPEVALUE, DefineConstantValue.CodeMasterDefine.KEY2_DEPARTMENT);
                foreach (CodeMaster_cmt_Info item in codes)
                {
                    BaseModel obj = new BaseModel()
                    {
                        Code = item.cmt_cValue,
                        Description = item.cmt_cRemark

                    };
                    departmentList.Add(obj);
                }

                //PLC波特率列表
                codes = GetCodeMasters(profileData, DefineConstantValue.CodeMasterDefine.KEY1_PLCPARAMETER, DefineConstantValue.CodeMasterDefine.KEY2_PLCPARAMETER_BAUDRATE);
                foreach (CodeMaster_cmt_Info item in codes)
                {
                    if (item != null && item.cmt_cValue.Trim().Length > 0)
                    {
                        BaseModel obj = new BaseModel()
                        {
                            Code = item.cmt_cValue,
                            Description = item.cmt_cValue

                        };
                        plcBaudRateList.Add(obj);
                    }
                }

                //假期管理設置信息列表
                foreach (VacationMaster_vcm_Info item in profileData.VacationMaster)
                {
                    VacationInfo obj = new VacationInfo()
                    {
                        AreaCode = item.vcm_TargetID.ToString(),
                        Code = item.vcm_RecordID.ToString(),
                        WeekDate = item.vcm_cWeekDate,
                        StartDate = item.vcm_dStartDate,
                        EndDate = item.vcm_dEndDate,
                        Type = item.vcm_cType,
                        Description = item.vcm_cHolidayName
                    };
                    vacationInfoList.Add(obj);
                }

                //假期上班原因列表
                codes = GetCodeMasters(profileData, DefineConstantValue.CodeMasterDefine.KEY1_TYPEVALUE, DefineConstantValue.CodeMasterDefine.KEY2_VACATIONWORKREASON);
                foreach (CodeMaster_cmt_Info item in codes)
                {
                    BaseModel obj = new BaseModel()
                    {
                        Code = item.cmt_cValue,
                        Description = item.cmt_cRemark

                    };
                    vacationOTReasonList.Add(obj);
                }

                //機台空閒狀態名稱列表
                foreach (IdleState_ism_Info item in profileData.IdleStateMaster)
                {
                    MachineIdleStateName obj = new MachineIdleStateName()
                    {
                        Code = item.ism_RecordID.ToString(),
                        Description = item.ism_cStateName,
                        IsBuildin = item.ism_lIsBuildin
                    };
                    machineIdleStateNameList.Add(obj);
                }

                //機台狀態
                codes = GetCodeMasters(profileData, DefineConstantValue.CodeMasterDefine.KEY1_STATUS, DefineConstantValue.CodeMasterDefine.KEY2_TYPEVALUE_MACHINE);
                foreach (CodeMaster_cmt_Info item in codes)
                {
                    BaseModel obj = new BaseModel()
                    {
                        Code = item.cmt_cValue,
                        Description = item.cmt_cRemark

                    };
                    machineStatuList.Add(obj);
                }

                //生產信號燈設置信息列表
                foreach (SignalLightsStatus_sls_Info item in profileData.SignalLightsStatusMaster)
                {
                    SignalLightsStatusInfo obj = new SignalLightsStatusInfo()
                    {
                        AlertRing = item.sls_cAlertRing,
                        DurationTime = item.sls_iDurationTime,
                        GreenLight = item.sls_cGreenLight,
                        IntervalTime = item.sls_iIntervalTime,
                        RedLight = item.sls_cRedLight,
                        Status = item.sls_cStatus,
                        YellowLight = item.sls_cYellowLight,
                    };
                    signalLightsStatusInfoList.Add(obj);
                }
                //用餐計劃設置信息列表
                foreach (DinnerScheduleMaster_dsm_Info item in profileData.DinnerMaster)
                {
                    DinnerPlanInfo obj = new DinnerPlanInfo
                    {
                        BeginTime = item.dsm_cBeginTime,
                        Code = item.dsm_RecordID.ToString(),
                        EndTime = item.dsm_cEndTime,
                        Description = item.dsm_cScheduleName
                    };
                    dinnerPlanInfoList.Add(obj);
                }

                //窗口菜單列表
                if (profileData.FormMaster != null)
                {
                    List<Sys_FormMaster_fom_Info> forms = profileData.FormMaster.Where(d => d.fom_cSysCode == CustEnum.System.PPC.ToString() && d.fom_lVaild).ToList();

                    if (forms != null)
                    {
                        data.MenuForms = TreeNodeUtil.CreateMenuTree(forms, 1);
                    }
                }

                //系統支援信息
                code = GetCodeMasters(profileData, DefineConstantValue.CodeMasterDefine.KEY1_TYPEVALUE, DefineConstantValue.CodeMasterDefine.KEY2_SYSTEMSUPPORTINFORMATION, DefineConstantValue.CodeMasterDefine.VALUE_SYSTEMSUPPORTINFORMATION);
                if (code != null)
                {
                    data.SystemSupportInformation = code.cmt_cRemark;
                }

                return data;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 設置人員工作時間信息
        /// </summary>
        /// <param name="staffInfo">人員信息</param>
        /// <param name="shiftStaffWorkTimeInfos">人員時間信息列表</param>
        void SetStaffWorkTime(MachineStaffInfo staffInfo, List<ShiftStaffWorkTimeInfo> shiftStaffWorkTimeInfos)
        {
            if (staffInfo != null)
            {
                if (staffInfo.Code.Trim().Length > 0)
                {
                    ShiftStaffWorkTimeInfo info = shiftStaffWorkTimeInfos.SingleOrDefault(t => t.Code.Trim() == staffInfo.Code.Trim());

                    if (info != null)
                    {
                        staffInfo.StartTime = info.StartTime;
                        staffInfo.EndTime = info.EndTime;
                    }
                }
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 設置班次內人員工作時間信息
        /// </summary>
        /// <param name="captain">機長信息</param>
        /// <param name="staffs">人員列表</param>
        void SetShiftStaffWorkTimeInfo(MachineStaffInfo captain, List<MachineStaffInfo> staffs)
        {
            List<ShiftStaffWorkTimeInfo> shiftStaffWorkTimeInfos = null;

            shiftStaffWorkTimeInfos = this._shiftStaffWorkInfoControl.ShiftStaffWorkTimeInfos;
            if (shiftStaffWorkTimeInfos == null || shiftStaffWorkTimeInfos.Count < 1)
            {
                return;
            }

            this.SetStaffWorkTime(captain, shiftStaffWorkTimeInfos);

            if (staffs != null && staffs.Count > 0)
            {
                for (int i = 0; i < staffs.Count; i++)
                {
                    this.SetStaffWorkTime(staffs[i], shiftStaffWorkTimeInfos);
                }
            }
        }
Esempio n. 10
0
        /// <summary>
        ///  綁定已選定機組人員信息選擇框
        /// </summary>
        /// <param name="listSelectedStaffs">數據源</param>
        void BindData_SelectedStaffs(ListBox lbTarget, List<MachineStaffInfo> listSelectedStaffs)
        {
            List<MachineStaffInfo> staffs = null;

            if (listSelectedStaffs != null && listSelectedStaffs.Count > 0)
            {
                staffs = new List<MachineStaffInfo>();

                for (int i = 0; i < listSelectedStaffs.Count; i++)
                {
                    if (listSelectedStaffs[i] != null)
                    {
                        MachineStaffInfo staff = new MachineStaffInfo();

                        staff.AreaCode = listSelectedStaffs[i].AreaCode;
                        staff.Code = listSelectedStaffs[i].Code;
                        staff.Description = listSelectedStaffs[i].Description;
                        staff.EndTime = listSelectedStaffs[i].EndTime;
                        staff.IsCaptain = listSelectedStaffs[i].IsCaptain;
                        staff.StaffNameNo = listSelectedStaffs[i].StaffNameNo;
                        staff.StaffNo = listSelectedStaffs[i].StaffNo;
                        staff.StartTime = listSelectedStaffs[i].StartTime;

                        staffs.Add(staff);
                    }
                }
            }

            lbTarget.DataSource = staffs;
            lbTarget.DisplayMember = "StaffNameNo";
            lbTarget.ValueMember = "Code";
        }