Exemplo n.º 1
0
 private void btn_addD_Click(object sender, EventArgs e)
 {
     G_datetime = DateAndTime.DateAdd(    //向時間欄位中新增一天
         DateInterval.Day, 1, G_datetime);
     lab_time.Text = G_datetime.ToString( //顯示時間訊息
         "時間:  yyyy年M月d日 H時m分s秒");
 }
Exemplo n.º 2
0
        public void tryToSellectAllLines()
        {
            var             timeout = DateAndTime.DateAdd(DateInterval.Second, 10, DateAndTime.Now);
            GuiTableControl myTable;
            GuiTableRow     firstRow;

            while (DateTime.Now < timeout)
            {
                // buggfix com objects late binding
                System.Threading.Thread.Sleep(2000);

                // buggfix - The data necessary to complete this operation is not yet available.
                try {
                    myTable  = (GuiTableControl)sap.findById(VA02ID.FIRST_ROW_OF_SALES_TAB_TABLE_ID.Where(x => sap.idExists(x)).First());
                    firstRow = (GuiTableRow)myTable.Rows.Item(1);
                    if (!firstRow.Selected)
                    {
                        sap.pressBtn(VA02ID.SELECT_ALL_BTN_ID.Where(x => sap.idExists(x)).First());
                    }
                    else
                    {
                        break;
                    }
                } catch (Exception) {
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///  使用DateAdd方法向指定日期添加一段时间间隔
        /// </summary>
        /// <param name="AddDateType">选择添加的类型[分,时,天]</param>
        /// <param name="Date_details">添加的具体时间</param>
        /// <param name="date">在指定的时间上添加【参数】</param>
        /// <param name="error">反馈错误</param>
        /// <returns></returns>
        public static DateTime DateAdd(string AddDateType, int Date_details, DateTime date, ref string error)
        {
            DateTime G_datetime = date;

            try {
                switch (AddDateType)
                {
                case "Minute":    //向时间字段中添加分钟
                    G_datetime = DateAndTime.DateAdd(DateInterval.Minute, Date_details, date);
                    break;

                case "Hour":    //添加小时
                    G_datetime = DateAndTime.DateAdd(DateInterval.Hour, Date_details, date);
                    break;

                case "Day":    //添加天数
                    G_datetime = DateAndTime.DateAdd(DateInterval.Day, Date_details, date);
                    break;

                default:
                    break;
                }
            } catch (Exception ex) {
                error = ex.ToString();
            }

            return(G_datetime);
        }
Exemplo n.º 4
0
 private static void TinhThoiHanVe(int LoaiVe, int ThangQui, int Nam, ref DateTime NgayApDung, ref DateTime NgayHetHan)
 {
     checked
     {
         if (LoaiVe == 2)
         {
             string   value    = "01/01/" + Conversions.ToString(Nam);
             DateTime dateTime = Conversions.ToDate(value);
             dateTime   = DateAndTime.DateAdd("m", (double)(ThangQui - 1), dateTime);
             NgayApDung = dateTime;
             dateTime   = DateAndTime.DateAdd("m", 1.0, dateTime);
             dateTime   = DateAndTime.DateAdd("d", -1.0, dateTime);
             NgayHetHan = dateTime;
         }
         else if (LoaiVe == 3)
         {
             string   value    = "01/01/" + Conversions.ToString(Nam);
             DateTime dateTime = Conversions.ToDate(value);
             int      num      = (ThangQui - 1) * 3;
             dateTime   = DateAndTime.DateAdd("m", (double)num, dateTime);
             NgayApDung = dateTime;
             dateTime   = DateAndTime.DateAdd("m", 3.0, dateTime);
             dateTime   = DateAndTime.DateAdd("d", -1.0, dateTime);
             NgayHetHan = dateTime;
         }
     }
 }
Exemplo n.º 5
0
        internal static void NewInspection(Guid sectionID)
        {
            string    str        = "SELECT * FROM Inspection_Data WHERE [INSP_DATA_INSP_DATE]>=#" + Conversions.ToString(DateAndTime.DateAdd(DateInterval.Day, (double)checked (-1 * Inspection.IInspectionWindow), DateAndTime.Today)) + "# AND [INSP_DATA_SEC_ID]={" + sectionID.ToString() + "}";
            DataTable dataTable1 = mdUtility.DB.GetDataTable(str);
            DataTable dataTable2 = mdUtility.DB.GetDataTable("SELECT * FROM [Section Info] WHERE [sec_id]={" + sectionID.ToString() + "}");
            DateTime  dateTime   = new frmDatePicker().ShowDialog(new DateTime?(DateAndTime.DateAdd(DateInterval.Day, (double)checked (-1 * Inspection.IInspectionWindow), DateAndTime.Today)), new DateTime?(DateAndTime.Today));
            Guid      guid;

            if (dataTable1.Rows.Count == 0)
            {
                DataRow row     = dataTable1.NewRow();
                DataRow dataRow = row;
                dataRow["INSP_DATA_SEC_ID"] = (object)sectionID;
                guid = Guid.Parse(mdUtility.GetUniqueID());
                dataRow["INSP_DATA_ID"]        = (object)guid;
                dataRow["inspectorlink"]       = (object)mdUtility.strCurrentInspector;
                dataRow["INSP_Source"]         = (object)nameof(Inspection);
                dataRow["INSP_DATA_INSP_DATE"] = (object)dateTime;
                dataRow["INSP_DATA_SAMP"]      = RuntimeHelpers.GetObjectValue(Interaction.IIf(Microsoft.VisualBasic.CompilerServices.Operators.CompareString(mdUtility.fMainForm.CurrentLocation, "", false) == 0, (object)false, (object)true));
                dataRow["bred_status"]         = (object)"N";
                dataRow["insp_data_type"]      = (object)2;
                dataTable1.Rows.Add(row);
                mdUtility.DB.SaveDataTable(ref dataTable1, str);
                Section.SectionMaterialLink(sectionID.ToString());
                mdUtility.fMainForm.m_bInspNew = true;
            }
            else
            {
                object obj = dataTable1.Rows[0]["INSP_DATA_ID"];
                guid = obj != null ? (Guid)obj : new Guid();
            }
            DataTable dataTable3  = mdUtility.DB.GetDataTable("SELECT SUM(SAMP_DATA_QTY) AS SAMP_QTY_SUM FROM Sample_Data WHERE [SAMP_DATA_INSP_DATA_ID]={" + guid.ToString() + "}");
            DataTable tableSchema = mdUtility.DB.GetTableSchema("Sample_Data");
            DataRow   row1        = tableSchema.NewRow();
            DataRow   dataRow1    = row1;

            dataRow1["BRED_Status"]            = (object)"N";
            dataRow1["samp_data_id"]           = (object)mdUtility.GetUniqueID();
            dataRow1["samp_data_insp_data_id"] = (object)guid;
            double num = Conversions.ToDouble(Microsoft.VisualBasic.CompilerServices.Operators.SubtractObject(dataTable2.Rows[0]["sec_qty"], UtilityFunctions.FixDBNull(RuntimeHelpers.GetObjectValue(dataTable3.Rows[0]["SAMP_QTY_SUM"]), (object)0)));

            dataRow1["samp_data_qty"]   = RuntimeHelpers.GetObjectValue(Interaction.IIf(num < 0.0, (object)0, (object)num));
            dataRow1["samp_data_paint"] = RuntimeHelpers.GetObjectValue(dataTable2.Rows[0]["sec_paint"]);
            if (mdUtility.fMainForm.tvInspection.Visible && Microsoft.VisualBasic.CompilerServices.Operators.CompareString(mdUtility.fMainForm.CurrentLocation, "", false) != 0)
            {
                dataRow1["samp_data_loc"] = (object)mdUtility.fMainForm.tvInspection.GetNodeByKey(mdUtility.fMainForm.CurrentLocation).Tag.ToString();
            }
            tableSchema.Rows.Add(row1);
            mdUtility.DB.SaveDataTable(ref tableSchema, "SELECT * FROM Sample_Data");
            mdUtility.fMainForm.m_bSampleNew  = true;
            mdUtility.fMainForm.m_bInspLoaded = false;
            Inspection.LoadInspectionDates(sectionID.ToString());
            mdUtility.fMainForm.m_bInspLoaded = true;
            mdUtility.fMainForm.SetInspChanged(true);
            if (!mdUtility.fMainForm.txtSQuantity.Visible)
            {
                return;
            }
            mdUtility.fMainForm.txtSQuantity.Focus();
        }
Exemplo n.º 6
0
    private void AzurirajDatumObracunaStaza(object sender, EventArgs e)
    {
        bool flag = false;

        if (Operators.ConditionalCompareObjectEqual(this.datumobracunastaza.Value, DateAndTime.DateSerial(0x7d0, 1, 1), false))
        {
            flag = true;
        }
        if (((decimal.Compare(DB.N20(RuntimeHelpers.GetObjectValue(this.godinaobracuna.Value)), decimal.Zero) > 0) & (decimal.Compare(DB.N20(RuntimeHelpers.GetObjectValue(this.mjesecobracuna.Value)), decimal.Zero) > 0)) && ((DateTime.Compare(DateTime.Parse(Conversions.ToString(this.datumobracunastaza.Value)), DateAndTime.DateSerial(Conversions.ToInteger(this.godinaobracuna.Value), Conversions.ToInteger(this.mjesecobracuna.Value), DateTime.DaysInMonth(Conversions.ToInteger(this.godinaobracuna.Value), 1))) < 0) | (DateTime.Compare(DateTime.Parse(Conversions.ToString(this.datumobracunastaza.Value)), DateAndTime.DateSerial(Conversions.ToInteger(this.godinaobracuna.Value), Conversions.ToInteger(this.mjesecobracuna.Value), DateTime.DaysInMonth(Conversions.ToInteger(this.godinaobracuna.Value), Conversions.ToInteger(this.mjesecobracuna.Value)))) > 0)))
        {
            flag = true;
        }
        if (flag)
        {
            try
            {
                this.datumobracunastaza.Value = DateAndTime.DateSerial(Conversions.ToInteger(this.godinaobracuna.Value), Conversions.ToInteger(this.mjesecobracuna.Value), 1);
                this.datumobracunastaza.Value = DateAndTime.DateAdd(DateInterval.Day, -1.0, Conversions.ToDate(this.datumobracunastaza.Value));
            }
            catch (System.Exception exception1)
            {
                throw exception1;
            }
        }
    }
Exemplo n.º 7
0
        public int CalculateUPH()
        {
            DateTime ProductDate       = default(DateTime);
            DateTime DateBeforeOneHour = default(DateTime);
            int      UphCounts         = 0;

            DateBeforeOneHour = DateAndTime.DateAdd("h", -1, DateTime.Now);
            for (int i = 0; i <= 500; i++)
            {
                ProductDate = PVar.tmpCpkData.ProTime[i];
                if (DateTime.Compare(ProductDate, DateBeforeOneHour) == 1)
                {
                    UphCounts++;
                }
            }
            if (UphCounts < 100)
            {
                this.UPH.BZ_Color = Color.FromArgb(253, 253, 191);
            }
            else
            {
                this.UPH.BZ_Color = PVar.BZColor_SelectedBtn;
            }

            return(UphCounts);
        }
Exemplo n.º 8
0
 private void cboContractTime_EditValueChanged(object sender, EventArgs e)
 {
     if (this.cboContractTime.SelectedIndex == 0)
     {
         this.dtToDate.DateTime = DateAndTime.DateAdd(DateInterval.Month, 2, this.dtFromDate.DateTime);
     }
     else if (this.cboContractTime.SelectedIndex == 1)
     {
         this.dtToDate.DateTime = DateAndTime.DateAdd(DateInterval.Month, 3, this.dtFromDate.DateTime);
     }
     else if (this.cboContractTime.SelectedIndex == 2)
     {
         this.dtToDate.DateTime = DateAndTime.DateAdd(DateInterval.Month, 6, this.dtFromDate.DateTime);
     }
     else if (this.cboContractTime.SelectedIndex == 3)
     {
         this.dtToDate.DateTime = DateAndTime.DateAdd(DateInterval.Month, 9, this.dtFromDate.DateTime);
     }
     else if (this.cboContractTime.SelectedIndex == 4)
     {
         this.dtToDate.DateTime = DateAndTime.DateAdd(DateInterval.Year, 1, this.dtFromDate.DateTime);
     }
     else if (this.cboContractTime.SelectedIndex == 5)
     {
         this.dtToDate.DateTime = DateAndTime.DateAdd(DateInterval.Year, 2, this.dtFromDate.DateTime);
     }
     else if (this.cboContractTime.SelectedIndex == 6)
     {
         this.dtToDate.DateTime = DateAndTime.DateAdd(DateInterval.Year, 3, this.dtFromDate.DateTime);
     }
 }
Exemplo n.º 9
0
        public OrderStatus isChangeNeeded()
        {
            var timeout = DateAndTime.DateAdd(DateInterval.Second, 10, DateAndTime.Now);

            string blockID        = VA02ID.DEL_BLOCK_ID.Where(x => sap.idExists(x)).First();
            string paymentTermsID = VA02ID.PAYMENT_TERMS_ID.Where(x => sap.idExists(x)).First();

            //default as available just in case code will not be able to get the real status
            OrderStatus tempStatus = OrderStatus.available;

            while (DateTime.Now < timeout)
            {
                System.Threading.Thread.Sleep(2000);

                try {
                    if (!(sap.findById(blockID) as dynamic).Changeable)
                    {
                        tempStatus = OrderStatus.realeasedOrRejected;
                        break;
                    }
                    else if ((sap.findById(paymentTermsID) as dynamic).text == "")
                    {
                        tempStatus = OrderStatus.orderMissingPaymentTerms;
                        break;
                    }
                    else
                    {
                        tempStatus = OrderStatus.available;
                        break;
                    }
                } catch (Exception) {
                }
            }
            return(tempStatus);
        }
Exemplo n.º 10
0
        //-- Play a note by number (0-127), specifying a velocity value (0-127)
        public void PlayNote(byte Note, byte Velocity)
        {
            byte  Msg     = 0;
            Int32 MidiMsg = default(Int32);

            if (_Engaged == false)
            {
                return;
            }
            Msg     = StuffByte(GetByte(MIDIStatusMessages.NoteOn), _OutputChannel);
            MidiMsg = StuffInt32(Msg, GetByte(Note + _Transpose), Velocity, 0);
            try
            {
                MIDI.midiOutShortMsg(hMidiOUT, MidiMsg);
                if (_NoteDuration > 0)
                {
                    NotesOff no = default(NotesOff);
                    no.Note        = GetByte(Note + _Transpose);
                    no.ShutoffTime = DateAndTime.DateAdd(DateInterval.Second, _NoteDuration, DateAndTime.Now);
                    lock (notesToTurnOff)
                    {
                        notesToTurnOff.Add(no);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 11
0
        public void LoadAlarmHistoryData(DateTime FirstDay, DateTime LastDay)
        {
            AlarmStatistics tmpSt     = new AlarmStatistics();
            string          tmpDate   = "";
            string          tmpString = "";
            int             tmpNum    = 0;

            m_AlarmHistoryDataList.Clear();
            for (int i = 0; i <= (LastDay - FirstDay).TotalDays; i++)
            {
                tmpDate = System.Convert.ToString(DateAndTime.DateAdd("d", System.Convert.ToDouble(-i), LastDay).ToString("yyyyMMdd"));
                tmpNum  = int.Parse(BVar.FileRorW.ReadINI(tmpDate, "TotalAlarmNum", "0", "D:\\BZ-Parameter\\BAM\\AlarmHistoryData.ini"));
                if (tmpNum <= 0)
                {
                    continue;
                }
                for (int j = tmpNum; j >= 1; j--)
                {
                    tmpString = BVar.FileRorW.ReadINI(tmpDate, "Alarm" + (j).ToString(), "00:00:00,00:00:00,F0000,Not Known", "D:\\BZ-Parameter\\BAM\\AlarmHistoryData.ini");
                    FormatAlarmHistoryString(tmpSt, tmpString);
                    tmpSt.dDate = DateAndTime.DateAdd("d", System.Convert.ToDouble(-i), LastDay);
                    m_AlarmHistoryDataList.Add(tmpSt);
                }
            }
            AlarmDataGridView_CellContentClick(null, null);

            for (var i = 30; i <= 50; i++)
            {
                BVar.FileRorW.DelIniSec(System.Convert.ToString(DateAndTime.DateAdd("d", System.Convert.ToDouble(-i), DateTime.Now.Date).ToString("yyyyMMdd")), "D:\\BZ-Parameter\\BAM\\AlarmHistoryData.ini");
            }
        }
Exemplo n.º 12
0
        private void specifficDeliveryDayAction(RddOutputBean rdd)
        {
            string deliveryDaysAccepted = Regex.Replace(rdd.deliveryDay, "[^a-zA-Z]", "");

            if (!string.IsNullOrEmpty(deliveryDaysAccepted))
            {
                while (!deliveryDaysAccepted.ToLower().Contains(Microsoft.VisualBasic.Strings.Format(tempDate, "dddd").ToLower()) || bankHolidayList.Where(x => x.nationalDate == tempDate).Count() > 0)
                {
                    tempDate = DateAndTime.DateAdd(DateInterval.Day, 1, tempDate);
                }
            }

            // changes block to hold order if the order is not short lead time
            if (tempDate != rdd.oldRdd)
            {
                if (!((tempDelBlock ?? "") == IDAConsts.DelBlocks.leadTimeBlock) && !rdd.isRddChangeAllowed)
                {
                    tempDelBlock = IDAConsts.DelBlocks.holdOrderBlock;
                    tempReason  += $"Holding order to contact the customer for changing RDD to recommended specific acceptance day - {Microsoft.VisualBasic.Strings.Format(tempDate, "dddd")}.{Constants.vbCr}";
                }
                else
                {
                    tempReason += $"Changing RDD to recommended specific acceptance day - {Microsoft.VisualBasic.Strings.Format(tempDate, "dddd")}.{Constants.vbCr}";
                }
            }
        }
Exemplo n.º 13
0
 private void btn_addD_Click(object sender, EventArgs e)
 {
     G_datetime = DateAndTime.DateAdd(    //向时间字段中添加一天
         DateInterval.Day, 1, G_datetime);
     lab_time.Text = G_datetime.ToString( //显示时间信息
         "时间:  yyyy年M月d日 H时m分s秒");
 }
Exemplo n.º 14
0
 public static string TimeToUnix(DateTime dteDate)
 {
     if (dteDate.IsDaylightSavingTime())
     {
         dteDate = DateAndTime.DateAdd(DateInterval.Hour, -1.0, dteDate);
     }
     return(Conversions.ToString(DateAndTime.DateDiff(DateInterval.Second, new DateTime(621355968000000000L), dteDate)));
 }
Exemplo n.º 15
0
        private void Frm_Production_Load(object sender, EventArgs e)
        {
            this.Location  = PVar.ChildFrmOffsetPoint;
            this.Size      = new Size(1020, 660);
            this.BackColor = Frm_Main.fMain.Main_Color;
            this.AlarmStatus.BZ_ShowMode    = true;
            this.AlarmStatus.ForeColor      = Color.Black;
            this.AlarmStatus.BZ_Color       = PVar.BZColor_SelectedBtn;
            this.AlarmStatus.Text           = "No Alarm";
            this.AlarmTime.ForeColor        = Color.Black;
            this.AlarmTime.BZ_Color         = PVar.BZColor_SelectedBtn;
            this.AlarmTime.BZ_SmallText     = "Alarm Time";
            this.AlarmTime.BZ_BigText       = "00:16:58";
            this.UPH.ForeColor              = Color.Black;
            this.UPH.BZ_Color               = Color.FromArgb(253, 253, 191);
            this.UPH.BZ_SmallText           = "UPH";
            this.UPH.BZ_BigText             = "230";
            this.MaterialLevel.ForeColor    = Color.Black;
            this.MaterialLevel.BZ_Color     = PVar.BZColor_SelectedBtn;
            this.MaterialLevel.BZ_SmallText = "Material";
            this.MaterialLevel.BZ_BigText   = "High";

            Lbl_StartTime.Text = System.Convert.ToString(DateAndTime.DateAdd("d", 0, DateTime.Now).ToString("MM/dd/yy"));
            Lbl_EndTime.Text   = System.Convert.ToString(DateAndTime.DateAdd("d", -29, DateTime.Now).ToString("MM/dd/yy"));
            int SelectNum;

            if (FileRw.IniGetNValue(PVar.UIChartCurveName, "CurveData", "TotalNum", 0) == 49)
            {
                SelectNum = 49;
            }
            else
            {
                SelectNum = (int)(FileRw.IniGetNValue(PVar.UIChartCurveName, "CurveData", "CurrentNum", 0));
            }

            Force_S3.BZ_BackColor = PVar.BZColor_SelectedBtn;
            Force_S2.BZ_BackColor = Color.LightGray;

            BTN_X.BZ_BackColor  = PVar.BZColor_SelectedBtn;
            BTN_Y.BZ_BackColor  = Color.LightGray;
            BTN_CC.BZ_BackColor = Color.LightGray;
            BTN_A.BZ_BackColor  = Color.LightGray;
            Cpk_X.BZ_BackColor  = PVar.BZColor_SelectedBtn;
            Cpk_Y.BZ_BackColor  = Color.LightGray;
            Cpk_CC.BZ_BackColor = Color.LightGray;
            Cpk_A.BZ_BackColor  = Color.LightGray;
            Btn_Yield_Click(sender, e); //显示Retest和NG率

            UPH.BZ_BigText = System.Convert.ToString(CalculateUPH());

            BTN_X_Click(BTN_X, e);
            Cpk_X_Click(Cpk_X, e);
            LoadYield();
            Frm_Engineering.fEngineering.SetChart(chartForce);
            this.Chart_Time.Elapsed += new System.Timers.ElapsedEventHandler(this.Chart_Time_Elapsed);
            Chart_Time.Enabled       = true;
        }
Exemplo n.º 16
0
        public static DateTime ToDate(byte[] data)
        {
            long     num3      = BytesToLong(data);
            int      num       = (int)(num3 / 60L);
            int      num2      = (int)(num3 % 60L);
            DateTime dateValue = new DateTime(0x7b2, 1, 1);

            return(DateAndTime.DateAdd(DateInterval.Minute, num, dateValue).AddSeconds(num2));
        }
Exemplo n.º 17
0
        private static ICollection <ActivityChangeDataItem> GetActivityChangeData(byte[] data, string dailyPresenceCounter)
        {
            List <ActivityChangeDataItem> result = new List <ActivityChangeDataItem>();

            int changeDataLength = data.Length / 2;

            int counter = changeDataLength - 1;

            for (int i = 0; i <= counter; i++)
            {
                ActivityChangeDataItem changeDataItem = new ActivityChangeDataItem();
                changeDataItem.DailyPresenceCounter = dailyPresenceCounter;
                changeDataItem.Slot       = RuntimeHelpers.GetObjectValue(Interaction.IIf((BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (2 * i) + 1, 1)) & 0x80L) == 0x80L, "Co-Driver", "Driver")).ToString();
                changeDataItem.CardStatus = RuntimeHelpers.GetObjectValue(Interaction.IIf((BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (2 * i) + 1, 1)) & 0x20L) == 0x20L, "Not Inserted", "Inserted")).ToString();

                if (changeDataItem.CardStatus == "Inserted")
                {
                    changeDataItem.DrivingStatus = RuntimeHelpers.GetObjectValue(Interaction.IIf((BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (2 * i) + 1, 1)) & 0x40L) == 0x40L, "Crew", "Single")).ToString();
                }
                else
                {
                    changeDataItem.DrivingStatus = RuntimeHelpers.GetObjectValue(Interaction.IIf((BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (2 * i) + 1, 1)) & 0x40L) == 0x40L, "Known", "Unknown")).ToString();
                }

                if (changeDataItem.DrivingStatus == "Not Inserted" || changeDataItem.DrivingStatus == "Unknown")
                {
                    changeDataItem.Activity = "";
                }
                else
                {
                    switch (((int)(BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (2 * i) + 1, 1)) & 0x18L)))
                    {
                    case 0:
                        changeDataItem.Activity = "Rest";
                        break;

                    case 8:
                        changeDataItem.Activity = "Available";
                        break;

                    case 0x10:
                        changeDataItem.Activity = "Work";
                        break;

                    case 0x18:
                        changeDataItem.Activity = "Drive";
                        break;
                    }
                }

                changeDataItem.Time = DateAndTime.DateAdd(DateInterval.Minute, BinaryHelper.BytesToLong(BinaryHelper.SubByte(data, (2 * i) + 1, 2)) & 0x7ffL, new DateTime(SqlDateTime.MinValue.Value.Year, SqlDateTime.MinValue.Value.Month, SqlDateTime.MinValue.Value.Day));
                result.Add(changeDataItem);
            }

            return(result);
        }
Exemplo n.º 18
0
        public void Add()
        {
            Csla.SmartDate d2 = new Csla.SmartDate();
            Csla.SmartDate d3;

            d2.Date = new DateTime(2005, 1, 1);
            d3      = new Csla.SmartDate(d2.Add(new TimeSpan(30, 0, 0, 0)));
            Assert.AreEqual(DateAndTime.DateAdd(DateInterval.Day, 30, d2.Date), d3.Date, "Dates should be equal");

            Assert.AreEqual(d3, d2 + new TimeSpan(30, 0, 0, 0, 0), "Dates should be equal");
        }
Exemplo n.º 19
0
        private void InitData()
        {
            DateTime dateTime = new DateTime(this.m_Year, this.m_Month, 1);

            this.teFromDate.EditValue = dateTime;
            this.teToDate.EditValue   = DateAndTime.DateAdd(DateInterval.Day, -1, DateAndTime.DateAdd(DateInterval.Month, 1, dateTime));
            this.calFromRow.EditValue = 1;
            this.calToRow.EditValue   = 1;
            this.clbShift.Items.Clear();
            (new DIC_SHIFT()).AddCheckedListBox(this.clbShift);
        }
Exemplo n.º 20
0
        private void Frm_AlarmHistoryInfo_Paint(object sender, PaintEventArgs e)
        {
            DateTime LastDay  = default(DateTime);
            DateTime FirstDay = default(DateTime);

            LastDay  = DateAndTime.DateAdd("d", -0, DateTime.Now.Date);
            FirstDay = DateAndTime.DateAdd("d", -30, DateTime.Now.Date);
            LoadAlarmHistoryData(FirstDay, LastDay);
            LoadAlarmHistoryToDataGrid();
            LoadAlarmHistoryToPieChart();
        }
Exemplo n.º 21
0
        /// <summary>
        /// Implements the DATEADD function
        /// </summary>
        /// <param name="datepart">The part of <paramref name="date"/> to which DATEADD adds an integer <paramref name="number"/></param>
        /// <param name="number">The value to add to the <paramref name="datepart"/> of the <paramref name="date"/></param>
        /// <param name="date">The date value to add to</param>
        /// <returns>The modified date</returns>
        /// <see href="https://docs.microsoft.com/en-us/sql/t-sql/functions/dateadd-transact-sql?view=sql-server-ver15"/>
        public static DateTime?DateAdd(string datepart, double?number, DateTime?date)
        {
            if (number == null || date == null)
            {
                return(null);
            }

            var interval = DatePartToInterval(datepart);

            return(DateAndTime.DateAdd(interval, number.Value, date.Value));
        }
Exemplo n.º 22
0
        public void Subtract()
        {
            Csla.SmartDate d2 = new Csla.SmartDate();
            Csla.SmartDate d3;

            d2.Date = new DateTime(2005, 1, 1);
            d3      = new Csla.SmartDate(d2.Subtract(new TimeSpan(30, 0, 0, 0)));
            Assert.AreEqual(DateAndTime.DateAdd(DateInterval.Day, -30, d2.Date), d3.Date, "Dates should be equal");

            Assert.AreEqual(30, ((TimeSpan)(d2 - d3)).Days, "Should be 30 days different");
            Assert.AreEqual(d3, d2 - new TimeSpan(30, 0, 0, 0, 0), "Should be equal");
        }
Exemplo n.º 23
0
        private static void ThreadStartDisplay()
        {
            frmSplash.f = new frmSplash();
            frmSplash.f.Show();
            DateTime now = DateAndTime.Now;

            while (DateTime.Compare(DateAndTime.Now, DateAndTime.DateAdd(DateInterval.Second, 2.0, now)) <= 0)
            {
                Thread.Sleep(100);
                Application.DoEvents();
            }
            frmSplash.FadeOut((Form)frmSplash.f);
        }
Exemplo n.º 24
0
        private void TrackBar_tossing_Scroll(object sender, EventArgs e)
        {
            string XDate      = "";
            int    SelectData = 0;

            SelectData = TrackBar_tossing.Value;
            for (var i = 0; i <= SelectData - 1; i++)
            {
                XDate = System.Convert.ToString(DateAndTime.DateAdd("d", System.Convert.ToDouble(-i), DateTime.Now.Date).ToString("yyyyMMdd"));
                PVar.StorXData[(int)i]   = System.Convert.ToString(DateAndTime.DateAdd("d", System.Convert.ToDouble(-i), DateTime.Now.Date).ToString("MM/dd"));
                PVar.StorTossing[(int)i] = double.Parse(FileRw.IniGetStringValue(PVar.UIChartYieldOverViewName, XDate, "Tossing", "0"));                  //当天抛料率
            }
            FileRw.Chart_Curve(Chart_Tossing, "Tossing(Unit:%)", "", "", "Tossing", PVar.StorXData, PVar.StorTossing, 0, 0, 0, false);
        }
Exemplo n.º 25
0
        public DateTime GetVersionDate()
        {
            string directoryPath = Class33.Class31_0.Info.DirectoryPath;
            string assemblyName  = Class33.Class31_0.Info.AssemblyName;

            byte[] rawAssembly = File.ReadAllBytes(directoryPath + "/" + assemblyName + ".dll");
            string text        = Assembly.Load(rawAssembly).GetName().Version.ToString();

            text = text.Split(new char[]
            {
                '.'
            })[2];
            return(DateAndTime.DateAdd("d", (double)Conversions.ToLong(text), new DateTime(630822816000000000L)));
        }
Exemplo n.º 26
0
        private static bool CanAddInspection(string SectionID)
        {
            DateTime  dateTime  = DateAndTime.DateAdd(DateInterval.Day, (double)checked (-1 * Inspection.IInspectionWindow), DateAndTime.Today);
            DataTable dataTable = mdUtility.DB.GetDataTable("SELECT [INSP_DATA_ID] FROM Inspection_Data WHERE [insp_data_sec_id]={" + SectionID + "} AND ([INSP_DATA_INSP_DATE]>=#" + Conversions.ToString(dateTime) + "# AND [INSP_Source] <> 'InstallDate') AND (BRED_Status <> 'D' OR BRED_Status IS NULL)");

            if (dataTable.Rows.Count == 0)
            {
                return(true);
            }
            if ((uint)Microsoft.VisualBasic.CompilerServices.Operators.CompareString(mdUtility.fMainForm.CurrentLocation.ToString(), "", false) <= 0U)
            {
                return(false);
            }
            return(Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(mdUtility.DB.GetDataTable("SELECT Count(SAMP_DATA_ID) FROM Sample_Data WHERE [SAMP_DATA_INSP_DATA_ID]={" + dataTable.Rows[0]["INSP_DATA_ID"].ToString() + "} AND SAMP_DATA_LOC={" + Strings.Replace(mdUtility.fMainForm.tvInspection.GetNodeByKey(mdUtility.fMainForm.CurrentLocation).Tag.ToString(), "'", "''", 1, -1, CompareMethod.Binary) + "}").Rows[0][0], (object)0, false));
        }
Exemplo n.º 27
0
        public void LoadYield()
        {
            PVar.NgCountOfDay        = int.Parse(BVar.FileRorW.ReadINI("ProductCount", "NgCountOfDay", System.Convert.ToString(0), PVar.BZ_YieldDataFileName));                                                        //当天NG数量
            PVar.NgCountOfMonth      = int.Parse(BVar.FileRorW.ReadINI("ProductCount", "NgCountOfMonth", System.Convert.ToString(0), PVar.BZ_YieldDataFileName));                                                      //当月NG数量
            PVar.ProductCountOfDay   = int.Parse(BVar.FileRorW.ReadINI("ProductCount", "ProductCountOfDay", System.Convert.ToString(0), PVar.BZ_YieldDataFileName));                                                   //当天总数量
            PVar.ProductCountOfMonth = int.Parse(BVar.FileRorW.ReadINI("ProductCount", "ProductCountOfMonth", System.Convert.ToString(0), PVar.BZ_YieldDataFileName));                                                 //当月总数量
            PVar.RecordTimeOfDate    = BVar.FileRorW.ReadINI("ProductTime", "RecordTimeOfDate", System.Convert.ToString(DateAndTime.DateAdd("d", -30, DateTime.Now).ToString("yyyyMMdd")), PVar.BZ_YieldDataFileName); //系统现在时间
            PVar.RecordTimeOfMonth   = BVar.FileRorW.ReadINI("ProductTime", "RecordTimeOfMonth", DateTime.Now.ToString("yyyyMMdd"), PVar.BZ_YieldDataFileName);                                                        //系统开始记录日期

            PVar.DayYieldOfNg = System.Convert.ToDouble(PVar.ProductCountOfDay == 0 ? 0 : (((double)PVar.NgCountOfDay / PVar.ProductCountOfDay) * 100));
            this.DRB_YieldRetest.BZ_NgRateDay = (int)PVar.DayYieldOfNg;                                                                      //日Ng率
            PVar.MonthYieldOfNg = System.Convert.ToDouble(PVar.ProductCountOfMonth == 0 ? 0 : (((double)PVar.NgCountOfMonth / PVar.ProductCountOfMonth) * 100));
            this.DRB_YieldRetest.BZ_NgRateMonth = (int)PVar.MonthYieldOfNg;                                                                  //月Ng率
            this.Lbl_StartTime.Text             = System.Convert.ToString(DateAndTime.DateAdd("d", -30, DateTime.Now).ToString("MM/dd/yy")); //开始日期为当前往前30天
            this.Lbl_EndTime.Text = DateTime.Now.ToString("MM/dd/yy");                                                                       //结束日期为当前日期
        }
Exemplo n.º 28
0
        private bool isPLAndCZExpection(int orderNumber, string id, string tableName, string salesOrg)
        {
            if (salesOrg == "PL01" || salesOrg == "CZ01")
            {
                var timeout = DateAndTime.DateAdd(DateInterval.Second, 10, DateAndTime.Now);

                // buggfix - The data necessary to complete this operation is not yet available.
                while (DateTime.Now < timeout)
                {
                    System.Threading.Thread.Sleep(2000);
                    try {
                        if (!sap.idExists(VA02ID.TOTAL_ORDER_CASES_FIELD_ID))
                        {
                            (sap.findById(VA02ID.ADDITIONAL_INFO_B_TAB_ID) as dynamic).Select();
                        }
                        else
                        {
                            break;
                        }
                    } catch (Exception) {
                    }
                }

                string orderQty     = (sap.findById(VA02ID.TOTAL_ORDER_CASES_FIELD_ID) as dynamic).Text();
                string confirmedQty = (sap.findById(VA02ID.TOTAL_CONFIRMED_CASES_FIELD_ID) as dynamic).Text();

                if (orderQty != confirmedQty)
                {
                    log.update(
                        tableName,
                        columnNames: new[] { "endTime", "status", "reason" },
                        values: new[] { Strings.Format(DateTime.Now, "yyyyMMdd HH:mm:ss"), "fail", "Could not change route codes as the CFR becomes lower than 100%" },
                        conditionName: new[] { "orderNumber", "id" },
                        conditionValue: new[] { orderNumber.ToString(), id, });
                    return(true);
                }
                else
                {
                    sap.goBack();
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 29
0
        public DateTime getNextWorkingDay(DateTime d, RddOutputBean rdd)
        {
            bool isUpdated = false;

            while (getIncreaseDayCondition(d, rdd))
            {
                d         = DateAndTime.DateAdd(DateInterval.Day, 1, d);
                isUpdated = true;
            }

            if (!isUpdated)
            {
                d = DateAndTime.DateAdd(DateInterval.Day, 1, d);
            }

            return(d);
        }
Exemplo n.º 30
0
        private void Frm_AlarmInfo_Load(object sender, EventArgs e)
        {
            this.Location  = PVar.ChildFrmOffsetPoint;
            this.Size      = new Size(1020, 660);
            this.BackColor = Frm_Main.fMain.Main_Color;

            AlarmDataViewInit();

            DateTime LastDay  = default(DateTime);
            DateTime FirstDay = default(DateTime);

            LastDay  = DateAndTime.DateAdd("d", -0, DateTime.Now.Date);
            FirstDay = DateAndTime.DateAdd("d", -30, DateTime.Now.Date);
            LoadAlarmHistoryData(FirstDay, LastDay);
            LoadAlarmHistoryToDataGrid();
            LoadAlarmHistoryToPieChart();
        }