예제 #1
0
        /// <summary>
        /// 객체 생성
        /// </summary>
        /// <param name="readerName"></param>
        public reader(string readerName)
        {
            ReaderName = readerName;
            string path = string.Format(@"{0}\LOG_NL_RFID1000\{1}", System.Windows.Forms.Application.StartupPath, readerName);

            Log = new Util.Log(path, readerName, 30, true);

            Log.WLog(string.Format("NL RFID 1000 관리 객체를 생성합니다. [ReaderName]{0}", ReaderName));
        }
예제 #2
0
        public static bool Insert_Order(OracleDB.strConnect strConn, System.Windows.Forms.ListView lv, string strOrderType, Util.Log clsLog, string strStationID, string strUser)
        {
            OracleDB clsDB = new OracleDB(strConn.strTNS, strConn.strID, strConn.strPass);

            OracleParameter[] param = new OracleParameter[] {
                new OracleParameter("ps_ORDERDATE", OracleDbType.Varchar2, 8),
                new OracleParameter("PS_ORDERTYPE", OracleDbType.Varchar2, 8),
                new OracleParameter("PS_STATIONID", OracleDbType.Varchar2, 10),
                new OracleParameter("PS_CARTYPE", OracleDbType.Varchar2, 15),
                new OracleParameter("PS_PARTCODE", OracleDbType.Varchar2, 15),
                new OracleParameter("PS_COLOR", OracleDbType.Varchar2, 10),
                new OracleParameter("PI_TARGET_CNT", OracleDbType.Int32, 8),
                new OracleParameter("ps_USER", OracleDbType.Varchar2, 50),
                new OracleParameter("PS_ALARM", OracleDbType.Varchar2, 2),
                new OracleParameter("PS_ALARMMSG", OracleDbType.Varchar2, 500)
            };



            param[8].Direction = ParameterDirection.Output;
            param[9].Direction = ParameterDirection.Output;


            string strLog = string.Empty;

            try
            {
                clsDB.BeginTransaction();

                strLog = "ORDER를저장을 시작 합니다.\r\n";

                foreach (System.Windows.Forms.ListViewItem li in lv.Items)
                {
                    string strField = string.Empty;

                    param[0].Value = li.SubItems[1].Text.ToString();
                    param[1].Value = strOrderType;
                    param[2].Value = strStationID;
                    param[3].Value = li.SubItems[3].Text.ToString();
                    if (strOrderType == "I")
                    {                                                    //사출 오더
                        param[4].Value = li.SubItems[5].Text.ToString(); //Partcode
                        param[5].Value = DBNull.Value;                   //color
                        strField       = "PARTCODE";
                    }
                    else
                    {                                                    //도장 오더
                        param[4].Value = DBNull.Value;                   //Partcode
                        param[5].Value = li.SubItems[5].Text.ToString(); //color
                        strField       = "COLOR";
                    }

                    int intV = int.Parse(li.SubItems[6].Text.ToString());

                    param[6].Value = intV;
                    param[7].Value = strUser;

                    strLog += string.Format("\t\t ORDERDATE [{0}] ORDERTYPE[{4}] STATIONID[{6}] CARTYPE [{1}] {5} [{2}] TARGET_CNT [{3}]"
                                            , param[0].Value, param[1].Value, param[3].Value, param[3].Value, strOrderType, strField, strStationID);

                    clsDB.intExcute_StoredProcedure("SP_ORDER_INSERT", param);



                    if (param[8].Value.ToString() != "00")
                    {
                        strLog += "\t==>저장실패 :" + param[9].Value.ToString() + "\r\n======>Rollback처리를 합니다.";
                        clsDB.RollBackTransaction();
                        throw new Exception(param[9].Value.ToString());
                    }

                    strLog += "\t==>저장성공\r\n";
                }

                strLog += "======>Commit처리를 합니다.";
                clsDB.CommitTransaction();

                return(true);
            }
            catch
            {
                throw;
            }
            finally
            {
                clsLog.WLog(strLog);
            }
        }