/// <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" }));
            }
        }
Beispiel #2
0
        /// <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);
        }
 public override void init()
 {
     try
     {
         BU    = ConfigGet("BU");
         Plant = ConfigGet("PLANT");
         DB    = ConfigGet("DB");
         List <System.Net.IPAddress> temp = HWDNNSFCBase.HostInfo.IP.Where(ipv4 => ipv4.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).ToList();
         ip                    = temp[0].ToString();
         SFCDB                 = new OleExec(DB, false);
         zcmm_nsbg_0051        = new ZCMM_NSBG_0051(BU);
         synLock               = new T_R_SYNC_LOCK(SFCDB, DB_TYPE_ENUM.Oracle);
         t_r_sap_temp          = new T_R_SAP_TEMP(SFCDB, DB_TYPE_ENUM.Oracle);
         t_r_saplog            = new T_R_SAPLOG(SFCDB, DB_TYPE_ENUM.Oracle);
         t_c_control           = new T_C_CONTROL(SFCDB, DB_TYPE_ENUM.Oracle);
         t_r_sn_station_detail = new T_R_SN_STATION_DETAIL(SFCDB, DB_TYPE_ENUM.Oracle);
         Output.UI             = new StockInBackFlush_UI(this);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }