Exemple #1
0
        private async Task search()
        {
            try
            {
                if (SCUtility.isEmpty(m_StartDTCbx.Value.ToString()))
                {
                    TipMessage_Type_Light.Show("Failure", String.Format("Please select start time."), BCAppConstants.WARN_MSG);
                    return;
                }
                if (SCUtility.isEmpty(m_EndDTCbx.Value.ToString()))
                {
                    TipMessage_Type_Light.Show("Failure", String.Format("Please select end time."), BCAppConstants.WARN_MSG);
                    return;
                }
                if (DateTime.Compare(System.Convert.ToDateTime(m_StartDTCbx.Value), System.Convert.ToDateTime(m_EndDTCbx.Value)) == 1)
                {
                    TipMessage_Type_Light.Show("Failure", String.Format("Start time must occur earlier than end time. Please re-enter start time and end time."), BCAppConstants.WARN_MSG);
                    return;
                }
                if (DateTime.Compare(System.Convert.ToDateTime(m_StartDTCbx.Value), System.Convert.ToDateTime(m_EndDTCbx.Value)) < 0)
                {
                    btn_Search.IsEnabled = false;
                    DateTime dateTimeFrom = System.Convert.ToDateTime(m_StartDTCbx.Value);
                    DateTime dateTimeTo   = System.Convert.ToDateTime(m_EndDTCbx.Value);
                    string   keyword      = string.Empty;
                    if (SCUtility.isMatche(McsCmdLog_CstID.Text, ""))
                    {
                        keyword = string.Empty;
                    }
                    else
                    {
                        keyword = McsCmdLog_CstID.Text.Trim();
                    }

                    dateTimeFrom = new DateTime(dateTimeFrom.Year, dateTimeFrom.Month, dateTimeFrom.Day, dateTimeFrom.Hour, dateTimeFrom.Minute, dateTimeFrom.Second, DateTimeKind.Local);
                    dateTimeTo   = new DateTime(dateTimeTo.Year, dateTimeTo.Month, dateTimeTo.Day, dateTimeTo.Hour, dateTimeTo.Minute, dateTimeTo.Second, DateTimeKind.Local);
                    List <ASYSEXCUTEQUALITY> system_qualitys = null;
                    await Task.Run(() => system_qualitys = sysExcuteQualityQueryService.loadSysexcutequalities(dateTimeFrom, dateTimeTo));

                    if (system_qualitys.Count <= 0)
                    {
                        TipMessage_Type_Light.Show("Warning", "There is no matching data for your query.", BCAppConstants.WARN_MSG);
                    }
                    else
                    {
                        system_qualitys = system_qualitys.OrderBy(info => info.CMD_INSERT_TIME).ToList();
                        uctl_ElasticQuery_CMDExcute_1.setDataItemsSource(system_qualitys);
                    }
                    btn_Search.IsEnabled = true;
                    return;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception");
            }
        }
        private async void btn_search_mcs_cmd_query_Click(object sender, EventArgs e)
        {
            DateTime dateTimeFrom = m_MCS_Cmd_Query_StartDTCbx.Value;
            DateTime dateTimeTo   = m_MCS_Cmd_Query_EndDTCbx.Value;

            dateTimeFrom = new DateTime(dateTimeFrom.Year, dateTimeFrom.Month, dateTimeFrom.Day, dateTimeFrom.Hour, dateTimeFrom.Minute, dateTimeFrom.Second, DateTimeKind.Local);
            dateTimeTo   = new DateTime(dateTimeTo.Year, dateTimeTo.Month, dateTimeTo.Day, dateTimeTo.Hour, dateTimeTo.Minute, dateTimeTo.Second, DateTimeKind.Local);

            List <ASYSEXCUTEQUALITY> system_qualitys = null;
            await Task.Run(() => system_qualitys = sysExcuteQualityQueryService.loadSysexcutequalities(dateTimeFrom, dateTimeTo));

            system_qualitys = system_qualitys.OrderBy(info => info.CMD_INSERT_TIME).ToList();

            uctl_ElasticQuery_CMDExcute_1.setDataItemsSource(system_qualitys);
        }
        private async Task search()
        {
            //try
            //{
            //    btn_Search.Enabled = false;
            //    List<ASYSEXCUTEQUALITY> McsCmdLog = new List<ASYSEXCUTEQUALITY>();

            //    bool result = false;

            //    //從MES要帳
            //    List<ASYSEXCUTEQUALITY> workorderList_ByMES = new List<ASYSEXCUTEQUALITY>();
            //    MESDefaultMapAction mesDefaultMapAction =
            //        scApp.getEQObjCacheManager().getLine().getMapActionByIdentityKey(typeof(MESDefaultMapAction).Name) as MESDefaultMapAction;
            //    await Task.Run(() => result = mesDefaultMapAction.sendAPLSGRQY_RequestWorkorderList(out workorderList_ByMES));

            //    //檢查送出結果
            //    if (!result)
            //    {
            //        TipMessage_Type.Show("The result of send Job List request to MES is [" + result.ToString() + " ].", BCAppConstants.WARN_MSG);
            //        return;
            //    }

            //    //檢查MES來的資料是否為空
            //    if (workorderList_ByMES.Count == 0)
            //    {
            //        TipMessage_Type.Show("No Job ID List from MES", BCAppConstants.WARN_MSG);
            //        return;
            //    }

            //    List<WorkOrder> tmpfromDB = null;
            //    //檢查由MES來的資料是否存在於DB中,並更新Unassigned Job ID的Grid顯示
            //    foreach (WorkOrder wo in workorderList_ByMES)
            //    {

            //        await Task.Run(() => tmpfromDB = scApp.SheetBLL.getWorkOrderListByID(wo.WorkOrder_ID));

            //        if (tmpfromDB.Count == 0)
            //        {
            //            workorderTemp.Add(wo);
            //        }
            //    }
            //    dgv_unAssignWorkOrder.DataSource = workorderTemp;
            //    //JobListToShowOnUnassignJobIDDGV = workorderTemp.ToList();
            //}

            try
            {
                DateTime dateTimeFrom = m_StartDTCbx.Value;
                DateTime dateTimeTo   = m_EndDTCbx.Value;
                string   keyword      = string.Empty;
                if (SCUtility.isMatche(McsCmdLog_CstID.Text, ""))
                {
                    keyword = string.Empty;
                }
                else
                {
                    keyword = McsCmdLog_CstID.Text.Trim();
                }

                dateTimeFrom = new DateTime(dateTimeFrom.Year, dateTimeFrom.Month, dateTimeFrom.Day, dateTimeFrom.Hour, dateTimeFrom.Minute, dateTimeFrom.Second, DateTimeKind.Local);
                dateTimeTo   = new DateTime(dateTimeTo.Year, dateTimeTo.Month, dateTimeTo.Day, dateTimeTo.Hour, dateTimeTo.Minute, dateTimeTo.Second, DateTimeKind.Local);
                //string cst_id = McsCmdLog_CstID.Text;
                List <ASYSEXCUTEQUALITY> system_qualitys = null;
                await Task.Run(() => system_qualitys = sysExcuteQualityQueryService.loadSysexcutequalities(dateTimeFrom, dateTimeTo));

                //await Task.Run(() => system_qualitys = sysExcuteQualityQueryService.loadSysexcutequalities(dateTimeFrom, dateTimeTo, keyword));
                system_qualitys = system_qualitys.OrderBy(info => info.CMD_INSERT_TIME).ToList();
                uctl_ElasticQuery_CMDExcute_1.setDataItemsSource(system_qualitys);
                //catch (Exception ex)
                //{
                //    logger.Error(ex, "Exception");
                //}
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception");
            }
        }