public void GetBackFlustData() { SFCDB.BeginTrain(); try { C_CONTROL control = t_c_control.GetControlByName("HWD_STOCKIN_TIME", SFCDB); if (control.CONTROL_VALUE == "" && string.IsNullOrEmpty(control.CONTROL_VALUE)) { throw new Exception("Get last run time fail "); } startTime = Convert.ToDateTime(control.CONTROL_VALUE); endTime = InterfacePublicValues.GetDBDateTime(SFCDB, DB_TYPE_ENUM.Oracle); stockInTable = t_r_sn_station_detail.GetStockInQtyByTime(startTime, endTime, SFCDB); if (stockInTable != null) { foreach (DataRow dr in stockInTable.Rows) { r_sap_temp = (Row_R_SAP_TEMP)t_r_sap_temp.NewRow(); r_sap_temp.ID = t_r_sap_temp.GetNewID(BU, SFCDB); r_sap_temp.SKUNO = dr["skuno"].ToString(); r_sap_temp.TYPE = "011G To 016G"; r_sap_temp.QTY = double.Parse(dr["qty"].ToString()); r_sap_temp.FROM_STORAGE = "011G"; r_sap_temp.TO_STORAGE = "016G"; r_sap_temp.SAP_FLAG = "0"; r_sap_temp.FAIL_COUNT = 0; r_sap_temp.EDIT_EMP = "interface"; r_sap_temp.EDIT_TIME = endTime; SFCDB.ExecSQL(r_sap_temp.GetInsertString(DB_TYPE_ENUM.Oracle)); } } Row_C_CONTROL rowControl = (Row_C_CONTROL)t_c_control.GetObjByID(control.ID, SFCDB); rowControl.CONTROL_VALUE = endTime.ToString("yyyy/MM/dd HH: mm: ss"); rowControl.EDIT_EMP = "intrerface"; rowControl.EDIT_TIME = endTime; SFCDB.ExecSQL(rowControl.GetUpdateString(DB_TYPE_ENUM.Oracle)); SFCDB.CommitTrain(); } catch (Exception exception) { SFCDB.RollbackTrain(); WriteLog.WriteIntoMESLog(SFCDB, BU, "MESInterface", "MESInterface.HWD.StockInBackFlush", "GetBackFlustData", ip + ";" + exception.Message, "", "interface"); StockInBackFlush_UI.OutPutMessage("", exception.Message, false); } }
/// <summary> /// 是否月結 /// </summary> /// <param name="DB">OleExec</param> /// <param name="dbType">DB_TYPE_ENUM</param> /// <returns></returns> public static bool IsMonthly(OleExec DB, DB_TYPE_ENUM dbType) { bool isMonthly = false; string[] times; string sql = string.Empty; T_C_CONTROL controlObject = new T_C_CONTROL(DB, DB_TYPE_ENUM.Oracle); C_CONTROL control = controlObject.GetControlByName("BACKFLUSH", DB); if (control != null && dbType == DB_TYPE_ENUM.Oracle) { times = control.CONTROL_VALUE.Split(new char[] { '~' }); sql = $@"select 1 from dual where sysdate between to_date('{times[0]}' ,'yyyy-mm-dd hh24:mi:ss') and to_date('{times[1]}' ,'yyyy-mm-dd hh24:mi:ss')"; DataSet temp = DB.RunSelect(sql); if (temp.Tables[0].Rows.Count > 0) { isMonthly = true; } } return(isMonthly); }