/// <summary> /// REPAIR_CHECK_OUT權限檢查 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void RepairOutEmpChecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { if (Paras.Count != 2) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000050")); } string type = Paras[0].VALUE.ToString().ToUpper(); if (type == "") { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE })); } MESStationSession sessionEmp = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (sessionEmp == null || sessionEmp.Value == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE })); } //Vertiv SE&RE黃克喜要求只有指定人員才能掃入和接收REPAIR_CHECK_IN T_c_user t_c_uer = new T_c_user(Station.SFCDB, Station.DBType); Row_c_user rowUser = t_c_uer.getC_Userbyempno(sessionEmp.Value.ToString(), Station.SFCDB, Station.DBType); T_C_CONTROL t_c_control = new T_C_CONTROL(Station.SFCDB, Station.DBType); string[] inEmp = t_c_control.GetControlByName("REPAIR_CHECK_OUT_SEND", Station.SFCDB).CONTROL_VALUE.Split(','); string[] receiveEmp = t_c_control.GetControlByName("REPAIR_CHECK_OUT_RECEIVE", Station.SFCDB).CONTROL_VALUE.Split(','); List <string> inEmpList = new List <string>(inEmp); List <string> receiveList = new List <string>(receiveEmp); if (rowUser == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180620163103", new string[] { sessionEmp.Value.ToString() })); } if (type == "SEND") { if (inEmpList.Find(s => s == rowUser.EMP_NO) == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180619155133", new string[] { rowUser.EMP_NO })); } } else if (type == "RECEIVE") { if (receiveList.Find(s => s == rowUser.EMP_NO) == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180619154947", new string[] { rowUser.EMP_NO })); } } else { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180607163531", new string[] { "Input" })); } }
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); }