コード例 #1
0
 protected void cmdQuery_ServerClick(object sender, System.EventArgs e)
 {
     if (ValidateInput())
     {
         //判断必输条件
         string mocode    = this.txtMOCodeWhere.Text.Trim();
         string sscode    = this.txtSSCodeWhere.Text.Trim();
         string shiftcode = this.ddlShiftCodeWhere.SelectedValue;
         int    begindate = FormatHelper.TODateInt(this.dateStartDateQuery.Text == string.Empty ? "0" : this.dateStartDateQuery.Text);
         int    enddate   = FormatHelper.TODateInt(this.dateEndDateQuery.Text == string.Empty ? "99999999" : this.dateEndDateQuery.Text);
         //this.UltraGauge1.RefreshInterval = -1;
         //按照工单,产线和时间等条件查询投入和产出数量,班次和时段可以为空
         if (KPIFacade == null)
         {
             KPIFacade = new KPIQueryFacade(base.DataProvider);
         }
         string strrate = KPIFacade.GetRealRate(mocode, sscode, begindate, enddate, shiftcode);
         string rate    = strrate.Remove(strrate.Length - 1, 1);
         if (rate.Equals(""))
         {
             rate = "0";
         }
         decimal intrate = Convert.ToDecimal(rate);
         ResultValue = intrate;
         UltraGauge1.RefreshInterval = 1;
         RefreshTimes = 0;
     }
 }
コード例 #2
0
        protected void cmdQuery_ServerClick(object sender, System.EventArgs e)
        {
            if (ValidateInput())
            {
                //判断必输条件
                string mocode    = this.txtMOCodeWhere.Text.Trim();
                string sscode    = this.txtSSCodeWhere.Text.Trim();
                string shiftcode = this.ddlShiftCodeWhere.SelectedValue;
                string tpcode    = this.ddlMoTypeQuery.SelectedValue;

                int begindate = FormatHelper.TODateInt(this.dateStartDateQuery.Text == string.Empty ? "0" : this.dateStartDateQuery.Text);
                int enddate   = FormatHelper.TODateInt(this.dateEndDateQuery.Text == string.Empty ? "99999999" : this.dateEndDateQuery.Text);
                //this.UltraGauge1.RefreshInterval = -1;
                //按照工单,产线和时间等条件查询投入和产出数量,班次和时段可以为空
                if (KPIFacade == null)
                {
                    KPIFacade = new KPIQueryFacade(base.DataProvider);
                }
                string  inandout = KPIFacade.GetInOut(mocode, sscode, begindate, enddate, shiftcode, tpcode);
                decimal douInOut = Convert.ToDecimal(inandout);
                ResultValue = douInOut * 100;
                UltraGauge1.RefreshInterval = 1;
                RefreshTimes = 0;
            }
        }
コード例 #3
0
        private object[] LoadDataSource(int inclusive, int exclusive)
        {
            bool   ssCodeChecked   = UCGroupConditions1.SSChecked;
            bool   itemCodeChecked = UCGroupConditions1.ItemCodeChecked;
            string groupFields     = string.Empty;

            if (ssCodeChecked || itemCodeChecked)
            {
                groupFields = (ssCodeChecked == true ? "**.SSCODE," : "") + (itemCodeChecked == true ? "**.ITEMCODE," : "");
            }
            if (KPIFacade == null)
            {
                KPIFacade = new KPIQueryFacade(base.DataProvider);
            }
            dateSource = KPIFacade.QueryPerCapita(((SelectableTextBox)UCWhereConditions1.PanelItemCodeWhere.Controls[3]).Text.Trim(), ((SelectableTextBox4SS)UCWhereConditions1.PanelSSCodeWhere.Controls[3]).Text.Trim(), ((DropDownList)UCWhereConditions1.PanelShiftCodeWhere.Controls[3]).SelectedValue,
                                                  ((HtmlInputText)UCWhereConditions1.PanelStartDateWhere.Controls[3]).Value.Replace("-", ""),
                                                  ((HtmlInputText)UCWhereConditions1.PanelEndDateWhere.Controls[3]).Value.Replace("-", ""),
                                                  groupFields
                                                  );
            return(dateSource);
        }
コード例 #4
0
 protected void cmdQuery_ServerClick(object sender, System.EventArgs e)
 {
     if (ValidateInput())
     {
         //判断必输条件
         string mocode    = this.txtMOCodeWhere.Text.Trim();
         string sscode    = this.txtSSCodeWhere.Text.Trim();
         string shiftcode = this.ddlShiftCodeWhere.SelectedValue;
         int    begindate = FormatHelper.TODateInt(this.dateStartDateQuery.Text == string.Empty ? "0" : this.dateStartDateQuery.Text);
         int    enddate   = FormatHelper.TODateInt(this.dateEndDateQuery.Text == string.Empty ? "99999999" : this.dateEndDateQuery.Text);
         //this.UltraGauge1.RefreshInterval = -1;
         //根据工单和产线得到当前生产的所有资源
         if (KPIFacade == null)
         {
             KPIFacade = new KPIQueryFacade(base.DataProvider);
         }
         object[]       Res = KPIFacade.GetKPIRes(mocode, sscode);
         List <decimal> cts = new List <decimal>();
         if (Res != null)
         {
             foreach (Resource item in Res)
             {
                 object outputs = KPIFacade.GetOutPutTimes(item.ResourceCode, mocode, shiftcode, begindate, enddate);
                 if (outputs != null)
                 {
                     int output = ((BenQGuru.eMES.Domain.Report.ReportOPQty)outputs).OutputTimes;
                     if (output > 0)
                     {
                         object serial = KPIFacade.GetMaxMiniSerial(item.ResourceCode, mocode, shiftcode, begindate, enddate);
                         if (serial != null)
                         {
                             int     maxserial = ((BenQGuru.eMES.Domain.Report.ReportOPQty)serial).InputTimes;
                             int     minserial = ((BenQGuru.eMES.Domain.Report.ReportOPQty)serial).OutputTimes;
                             int     time      = KPIFacade.GetMaxMinTime(maxserial, minserial);
                             decimal CT        = Math.Round(Convert.ToDecimal(time) / (output - 1), 2);
                             cts.Add(CT);
                         }
                     }
                 }
             }
         }
         if (cts.Count > 0)
         {
             decimal sum = 0;
             decimal max = 0;
             foreach (var ct in cts)
             {
                 sum += ct;
                 max  = max > ct ? max : ct;
             }
             decimal          result = Math.Round(sum / (max * cts.Count), 4) * 100;
             RadialGaugeScale scale1 = ((RadialGauge)this.UltraGauge1.Gauges[0]).Scales[0];
             scale1.Markers[0].Value = result;
             (this.UltraGauge1.Gauges.FromKey("digital") as SegmentedDigitalGauge).Text = Math.Round(result, 2).ToString();
             UltraGauge1.RefreshInterval = 15;
             ResultValue  = 1;
             RefreshTimes = 0;
         }
         else
         {
             RadialGaugeScale scale1 = ((RadialGauge)this.UltraGauge1.Gauges[0]).Scales[0];
             scale1.Markers[0].Value = 0;
             (this.UltraGauge1.Gauges.FromKey("digital") as SegmentedDigitalGauge).Text = "0";
             UltraGauge1.RefreshInterval = 15;
             ResultValue  = 1;
             RefreshTimes = 0;
         }
     }
 }
コード例 #5
0
        protected void cmdQuery_ServerClick(object sender, System.EventArgs e)
        {
            if (ValidateInput())
            {
                //判断必输条件
                string  mocode    = this.txtMOCodeWhere.Text.Trim();
                string  sscode    = this.txtSSCodeWhere.Text.Trim();
                string  shiftcode = this.ddlShiftCodeWhere.SelectedValue;
                string  tpcode    = this.ddlMoTypeQuery.SelectedValue;
                string  rating    = this.ddlRating.SelectedValue;
                decimal drate     = 0.00M;
                if (rating.Equals("很快"))
                {
                    drate = 1.25M;
                }
                else if (rating.Equals("快"))
                {
                    drate = 1.00M;
                }
                else if (rating.Equals("一般"))
                {
                    drate = 0.85M;
                }
                else if (rating.Equals("慢"))
                {
                    drate = 0.60M;
                }
                int begindate = FormatHelper.TODateInt(this.dateStartDateQuery.Text == string.Empty ? "0" : this.dateStartDateQuery.Text);
                int enddate   = FormatHelper.TODateInt(this.dateEndDateQuery.Text == string.Empty ? "99999999" : this.dateEndDateQuery.Text);
                //this.UltraGauge1.RefreshInterval = -1;
                //根据工单和产线得到当前生产的所有资源
                if (KPIFacade == null)
                {
                    KPIFacade = new KPIQueryFacade(base.DataProvider);
                }

                object[]       Res = KPIFacade.GetKPIRes(mocode, sscode);
                List <decimal> cts = new List <decimal>();
                if (Res != null)
                {
                    firstDate = KPIFacade.GetInputTime(((Resource)Res[0]).ResourceCode, shiftcode, tpcode, begindate, enddate, mocode);
                    if (firstDate == null)
                    {
                        return;
                    }
                    foreach (Resource item in Res)
                    {
                        object outputs = KPIFacade.GetOutPutTimes(item.ResourceCode, mocode, shiftcode, begindate, enddate);
                        if (outputs != null)
                        {
                            int output = ((BenQGuru.eMES.Domain.Report.ReportOPQty)outputs).OutputTimes;

                            if (output > 0)
                            {
                                object serial = KPIFacade.GetMaxMiniSerial(item.ResourceCode, mocode, shiftcode, begindate, enddate);
                                if (serial != null)
                                {
                                    int     maxserial = ((BenQGuru.eMES.Domain.Report.ReportOPQty)serial).InputTimes;
                                    int     minserial = ((BenQGuru.eMES.Domain.Report.ReportOPQty)serial).OutputTimes;
                                    int     time      = KPIFacade.GetMaxMinTime(maxserial, minserial);
                                    decimal CT        = Math.Round(Convert.ToDecimal(time) / (output - 1), 2);
                                    cts.Add(CT);
                                }
                            }
                        }
                    }
                }

                //根据查询条件得出生产途程的最后一道工序的资源
                object[] LastRes = KPIFacade.GetKpiLastRes(sscode, mocode);
                if (LastRes != null)
                {
                    Resource resouce   = (Resource)LastRes[0];
                    int      outputsum = KPIFacade.GetOutputSum(begindate, enddate, resouce.ResourceCode, shiftcode, tpcode);
                    if (outputsum > 0)
                    {
                        DateTime lastDate = KPIFacade.GetLastProTime(resouce.ResourceCode, shiftcode, tpcode, begindate, enddate, mocode);

                        TimeSpan timeSpan = lastDate.Subtract(firstDate.Value);
                        decimal  subTime  = Convert.ToDecimal(timeSpan.Days.ToString()) * 3600 * 24 + Convert.ToDecimal(timeSpan.Hours.ToString()) * 3600 +
                                            Convert.ToDecimal(timeSpan.Minutes.ToString()) * 60 + Convert.ToDecimal(timeSpan.Seconds);
                        decimal avgrating = Convert.ToDecimal(subTime) / outputsum;
                        if (cts.Count > 0)
                        {
                            decimal sum = 0;
                            decimal max = 0;
                            foreach (var ct in cts)
                            {
                                sum += ct;
                                max  = max > ct ? max : ct;
                            }

                            decimal result = Math.Round(sum * drate / avgrating, 4) * 100;
                            ResultValue = result;
                            UltraGauge1.RefreshInterval = 1;
                            RefreshTimes = 0;
                        }
                    }
                }
            }
        }