Ejemplo n.º 1
0
        public List<ProStatusMonitoring> SearchRecords(ProStatusMonitoring objInfo)
        {
            List<ProStatusMonitoring> proStatusMonitoring = new List<ProStatusMonitoring>();

            using (MainDBDataContext db = new MainDBDataContext())
            {

                string sqlString = string.Empty;

                sqlString += "select" + Environment.NewLine;
                sqlString += "ISNULL( mmt_cMachineID,0) as MachineID," + Environment.NewLine;
                sqlString += "case when swl_cProjStatus is not null then ISNULL( swl_cProjStatus,'空閒') else ISNULL( sst_cStatusName,'空閒') end as MacStatus," + Environment.NewLine;
                sqlString += "case when swl_cProjStatus is not null then ISNULL( datediff(minute,swl_dStatusChange,getdate()),0) else ISNULL(  datediff (minute,sst_dBeginTime,sst_dEndTime),0) end as holdTime," + Environment.NewLine;

                sqlString += "ISNULL( swl_cSONO ,'') as SONO ," + Environment.NewLine;
                sqlString += "ISNULL( sim_cStaffName,'') as MachineCaption," + Environment.NewLine;
                sqlString += "ISNULL(ppj_iProjRunTime,0) as RunTime" + Environment.NewLine;
                sqlString += "from MachineMaster_mmt" + Environment.NewLine;
                sqlString += "left join ScheduleProjList_swl" + Environment.NewLine;
                sqlString += "on swl_cMachineNO=mmt_cMachineID and ISNULL( swl_cProjStatus,'') not in ('','SCHEDULE','FINISH','STOP')" + Environment.NewLine;
                sqlString += "left join dbo.SpareStatus_sst" + Environment.NewLine;
                sqlString += "on sst_cMachineNO=mmt_cMachineID" + Environment.NewLine;
                sqlString += "left join PrintProject_ppj" + Environment.NewLine;
                sqlString += "on swl_RecordID=ppj_SWLID and ppj_lActiveRecord=1" + Environment.NewLine;
                sqlString += "left join ShiftProjList_spl" + Environment.NewLine;
                sqlString += "on spl_PPJID=ppj_RecordID" + Environment.NewLine;
                sqlString += "left join ShiftInfo_sifo" + Environment.NewLine;
                sqlString += "on spl_SIFOID=sifo_RecordID" + Environment.NewLine;
                sqlString += "left join StaffInfoMaster_sim" + Environment.NewLine;
                sqlString += "on sim_iRecordID=sifo_DutyCaptainID" + Environment.NewLine;
                sqlString += "where 1=1" + Environment.NewLine;
                if (objInfo.MachineID != "" && objInfo.MachineID != Guid.Empty.ToString())
                {
                    sqlString += "and mmt_cMachineID='" + objInfo.MachineID + "'" + Environment.NewLine;
                }
                else
                {
                    if (objInfo.MachineType != "")
                    {
                        sqlString += "and mmt_cMachineType='" + objInfo.MachineType + "'" + Environment.NewLine;
                    }

                    if (objInfo.MacStatus != "")
                    {
                        sqlString += "and swl_cProjStatus='" + objInfo.MacStatus + "'" + Environment.NewLine;
                    }
                }

                IEnumerable<ProStatusMonitoring> infos = null;
                try
                {

                    infos = db.ExecuteQuery<ProStatusMonitoring>(sqlString, new object[] { });
                    if (infos != null)
                    {
                        foreach (ProStatusMonitoring item in infos)
                        {
                            proStatusMonitoring.Add(item);
                        }
                    }

                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }

            return proStatusMonitoring;
        }
Ejemplo n.º 2
0
 public List<ProStatusMonitoring> SearchRecords(ProStatusMonitoring objInfo)
 {
     return this._IProStatusMontoringDA.SearchRecords(objInfo);
 }
Ejemplo n.º 3
0
        void GetMonitoringRecordsDetail()
        {
            ProStatusMonitoring objSearch = new ProStatusMonitoring();

            //MachineMaster_mmt_Info machine = new MachineMaster_mmt_Info();
            //if (machine != null && machine.mmt_cBrandName.ToString() != "全部")
            //{
            //    // objSearch.OperatorID = machine.
            //}
            //if (this.cbxProdStatus.SelectedValue != null && this.cbxProdStatus.SelectedValue.ToString() != "All")
            //{
            //    objSearch.MachineStatcName = this.cbxProdStatus.SelectedValue.ToString();
            //}
            if (cobMacType.SelectedValue != null && cobMacType.SelectedValue.ToString() != "")
            {
                //machine.mmt_cMachineType = cbxMacType.SelectedValue.ToString();

                objSearch.MachineType = cobMacType.SelectedValue.ToString();
            }

            if (cobMachine.SelectedValue != null && cobMachine.SelectedValue.ToString() != "")
            {
                //machine.mmt_cMachineID = cbxProdType.SelectedValue.ToString();

                objSearch.MachineID = cobMachine.SelectedValue.ToString();
            }

            if (cbxProdStatus.SelectedValue != null && cbxProdStatus.SelectedValue.ToString() != "")
            {
                objSearch.MacStatus = cbxProdStatus.SelectedValue.ToString();
            }

            this.m_AllStatusMonitoring = this._IProStatusMontoringBL.SearchRecords(objSearch);

            foreach (ProStatusMonitoring item in m_AllStatusMonitoring)
            {
                item.ProjectNO = "MO:";

                item.SONO = "SO:" + item.SONO;

                item.MacStatus = "狀態:" + item.MacStatus;

                item.MachineCaption = "機長:" + item.MachineCaption;

                item.cRunTime = "運作:" + HandelDataFormatMin(item.RunTime);

                item.choldTime = "持續:" + HandelDataFormatMin(item.holdTime);
            }

            if (this.m_AllStatusMonitoring.Count != 0)
            {
                this.m_iRemainder = this.m_AllStatusMonitoring.Count % Convert.ToInt32(labLvMaxCount.Text);
                this.m_iAliquot = this.m_AllStatusMonitoring.Count / Convert.ToInt32(labLvMaxCount.Text);
                if (this.m_iRemainder > 0)
                {
                    this.labSum.Text = (this.m_iAliquot + 1).ToString();
                }
                else
                {
                    this.labSum.Text = this.m_iAliquot.ToString();
                }
                this.m_iNowPage = 1;
                this.btnFirst.Enabled = false;
                this.btnUp.Enabled = false;
                this.btnDown.Enabled = true;
                this.btnLast.Enabled = true;
                this.btnGo.Enabled = true;
            }
            else
            {
                this.m_iNowPage = 0;
                this.btnFirst.Enabled = false;
                this.btnUp.Enabled = false;
                this.btnDown.Enabled = false;
                this.btnLast.Enabled = false;
                this.btnGo.Enabled = false;
            }
        }