Beispiel #1
0
        public void ShowAllData(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            OleExec sfcdb = this.DBPools["SFCDB"].Borrow();

            try
            {
                T_R_WO_BASE      rWo  = new T_R_WO_BASE(sfcdb, DB_TYPE_ENUM.Oracle);
                List <R_WO_BASE> list = new List <R_WO_BASE>();
                list = rWo.ShowAllData(sfcdb);
                if (list.Count > 0)
                {
                    StationReturn.Data        = list;
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000001";
                }
                else
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000034";
                    StationReturn.Data        = "";
                }
                this.DBPools["SFCDB"].Return(sfcdb);
            }
            catch (Exception e)
            {
                this.DBPools["SFCDB"].Return(sfcdb);
                throw e;
            }
        }
Beispiel #2
0
        public void GetWoInfo(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JToken Data, MESStationReturn StationReturn)
        {
            OleExec sfcdb = null;

            try
            {
                sfcdb = this.DBPools["SFCDB"].Borrow();
                sfcdb.ThrowSqlExeception = true;
                T_R_WO_BASE t_r_wo_base = new T_R_WO_BASE(sfcdb, DBTYPE);
                R_WO_BASE   r_wo_base   = t_r_wo_base.GetWoByWoNo(Data["WO"].ToString().ToUpper().Trim(), sfcdb);
                if (r_wo_base == null)
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000164", new string[] { Data["WO"].ToString().ToUpper().Trim() }));
                }
                this.DBPools["SFCDB"].Return(sfcdb);
                StationReturn.Data        = r_wo_base;
                StationReturn.Status      = StationReturnStatusValue.Pass;
                StationReturn.MessageCode = "MES00000001";
            }
            catch (Exception exception)
            {
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000037";
                StationReturn.MessagePara.Add(exception.Message);
                StationReturn.Data = exception.Message;
                if (sfcdb != null)
                {
                    this.DBPools["SFCDB"].Return(sfcdb);
                }
            }
        }
Beispiel #3
0
        public void SetWoReplaceKpWithSku(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string            Wo = Data["WO"].ToString().Trim(), PartNo = Data["PARTNO"].ToString().Trim(), ReplacePartno = Data["REPLACEPARTNO"].ToString().Trim(), Sku = Data["SKUNO"].ToString().Trim();
            OleExec           oleDB        = null;
            T_R_WO_KP_Repalce rWoKpReplace = null;
            T_C_SKU           cSku         = null;
            T_R_WO_BASE       rWoBase      = null;

            try
            {
                oleDB        = this.DBPools["SFCDB"].Borrow();
                rWoKpReplace = new T_R_WO_KP_Repalce(oleDB, DBTYPE);
                cSku         = new T_C_SKU(oleDB, DBTYPE);
                rWoBase      = new T_R_WO_BASE(oleDB, DBTYPE);
                if (!cSku.SkuIsExist(Sku, oleDB))
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000245";
                    StationReturn.MessagePara = new List <object>()
                    {
                        Sku
                    };
                }
                else if (rWoBase.CheckDataExist(Wo, Sku, oleDB))
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000245";
                    StationReturn.Data        = "";
                }
                else if (rWoKpReplace.CheckDataExist(Wo, PartNo, ReplacePartno, oleDB))
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000005";
                    StationReturn.Data        = "";
                }
                else
                {
                    Row_R_WO_KP_Repalce rowRWoKpReplace = (Row_R_WO_KP_Repalce)rWoKpReplace.NewRow();
                    rowRWoKpReplace.ID            = rWoKpReplace.GetNewID(this.BU, oleDB, DBTYPE);
                    rowRWoKpReplace.WO            = Wo;
                    rowRWoKpReplace.PARTNO        = PartNo;
                    rowRWoKpReplace.REPALCEPARTNO = ReplacePartno;
                    rowRWoKpReplace.EDIT_EMP      = this.LoginUser.EMP_NO;
                    rowRWoKpReplace.EDIT_TIME     = GetDBDateTime();;
                    oleDB.ThrowSqlExeception      = true;
                    oleDB.ExecSQL(rowRWoKpReplace.GetInsertString(DBTYPE));
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000002";
                    StationReturn.Data        = "";
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                this.DBPools["SFCDB"].Return(oleDB);
            }
        }
Beispiel #4
0
        public Row_R_WO_BASE GetWoMode(string strWo, MESDBHelper.OleExec SFCDB, MESDataObject.DB_TYPE_ENUM _DBType)
        {
            DBType = _DBType;
            T_R_WO_BASE TRWB = new T_R_WO_BASE(SFCDB, DBType);

            RBaseWo = TRWB.GetWo(strWo, SFCDB);
            return(RBaseWo);
        }
Beispiel #5
0
        //WorkOrder wo = new WorkOrder();

        public void Init(string strWo, MESDBHelper.OleExec SFCDB, MESDataObject.DB_TYPE_ENUM _DBType)
        {
            DBType = _DBType;
            T_R_WO_BASE TRWB = new T_R_WO_BASE(SFCDB, DBType);

            //T_R_SN TSN = new T_R_SN(SFCDB, DBType);
            //_SNNO = TSN.GETSN(strWo, SFCDB);
            RBaseWo = TRWB.GetWo(strWo, SFCDB);
            BaseWo  = RBaseWo.GetDataObject();
            _Route  = new Route(RBaseWo.ROUTE_ID, GetRouteType.ROUTEID, SFCDB, DBType);
        }
Beispiel #6
0
        public WorkOrder Initwo(string strWo, MESDBHelper.OleExec SFCDB, MESDataObject.DB_TYPE_ENUM _DBType)
        {
            WorkOrder wo = new WorkOrder();

            DBType = _DBType;
            T_R_WO_BASE TRWB = new T_R_WO_BASE(SFCDB, DBType);

            RBaseWo           = TRWB.GetWo(strWo, SFCDB);
            this.BaseWo       = wo.BaseWo;
            this.ProcessingWo = new List <string>();
            this.LabelPaths   = new Dictionary <string, string>();
            this.SkuRoutes    = new List <Route>();
            return(this);
        }
Beispiel #7
0
 public override void init()
 {
     try
     {
         //從Ini檔中獲取BU/Plant/DB/Cust/Count/ConvertWo/DownloadWO
         BU    = ConfigGet("BU");
         Plant = ConfigGet("PLANT");
         DB    = ConfigGet("DB");//與App.config中配置的匹配
         CUST  = ConfigGet("CUST");
         COUNT = ConfigGet("COUNT");
         //可以依工單前綴來確定哪種類型的工單需要自動轉,哪種需手動轉
         arrayConvertWO = ConfigGet("CONVERTWO").Split(',');
         _downloadWO    = ConfigGet("DOWNLOADWO");
         List <System.Net.IPAddress> temp = HWDNNSFCBase.HostInfo.IP.Where(ipv4 => ipv4.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).ToList();
         ip = temp[0].ToString();
         //創建DownloadWO_UI,并附值給輸入對象Output.UI
         Output.UI = new DownLoadWO_UI(this);
         //依據Ini檔配置的DB從ConnectionManager中獲取數據庫連接
         SFCDB = new OleExec(DB, false);
         //程序運行狀態表
         synLock = new T_R_SYNC_LOCK(SFCDB, DB_TYPE_ENUM.Oracle);
         //工單欄位對照表
         C_TAB_COLUMN_MAP = new T_C_TAB_COLUMN_MAP(SFCDB, DB_TYPE_ENUM.Oracle);
         //從SAP Download下來后分別存儲在以下三張表
         R_WO_HEADER = new T_R_WO_HEADER(SFCDB, DB_TYPE_ENUM.Oracle);
         R_WO_ITEM   = new T_R_WO_ITEM(SFCDB, DB_TYPE_ENUM.Oracle);
         R_WO_TEXT   = new T_R_WO_TEXT(SFCDB, DB_TYPE_ENUM.Oracle);
         //獲取料號/Route
         C_SKU       = new T_C_SKU(SFCDB, DB_TYPE_ENUM.Oracle);
         RouteDetail = new T_C_ROUTE_DETAIL(SFCDB, DB_TYPE_ENUM.Oracle);
         C_ROUTE     = new T_C_ROUTE(SFCDB, DB_TYPE_ENUM.Oracle);
         T_Series    = new T_C_SERIES(SFCDB, DB_TYPE_ENUM.Oracle);
         //工單類型及前綴信息
         WOType      = new T_R_WO_TYPE(SFCDB, DB_TYPE_ENUM.Oracle);
         Keypart     = new T_C_KEYPART(SFCDB, DB_TYPE_ENUM.Oracle);
         R_WO_BASE   = new T_R_WO_BASE(SFCDB, DB_TYPE_ENUM.Oracle);
         t_c_kp_list = new T_C_KP_LIST(SFCDB, DB_TYPE_ENUM.Oracle);
         //創建RFC類:建立SAP連接,建立RFC輸入輸出參數
         ZRFC_SFC_NSG_0001B = new ZRFC_SFC_NSG_0001B(BU);
     }
     catch (Exception e)
     {
         throw new Exception("Init DownLoadWO Fail" + e.Message);
     }
     //取得RFC的輸出參數Table對象,并附值給Output.Tables
     Output.Tables.Add(ZRFC_SFC_NSG_0001B.GetTableValue("ITAB"));
     Output.Tables.Add(ZRFC_SFC_NSG_0001B.GetTableValue("WO_HEADER"));
     Output.Tables.Add(ZRFC_SFC_NSG_0001B.GetTableValue("WO_ITEM"));
     Output.Tables.Add(ZRFC_SFC_NSG_0001B.GetTableValue("WO_TEXT"));
 }
Beispiel #8
0
        private void getByWO(string wo, OleExec sfcdb, MESDataObject.DB_TYPE_ENUM dbtype)
        {
            //get wo route_id
            Row_R_WO_BASE RBaseWo;
            string        routeid = "";
            T_R_WO_BASE   TRWB    = new T_R_WO_BASE(sfcdb, dbtype);

            RBaseWo = TRWB.GetWo(wo, sfcdb);
            if (RBaseWo != null && RBaseWo.ROUTE_ID != null)
            {
                routeid = RBaseWo.ROUTE_ID.Trim();
            }
            getByIdOrRouteName("ID", routeid, sfcdb, dbtype);
        }
Beispiel #9
0
        public void CheckToUpload(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            OleExec          oleDB       = null;
            T_R_WO_BASE      sec         = null;
            string           WORKORDERNO = string.Empty;
            string           SKUNO       = string.Empty;
            int              QTY         = 0;
            List <R_WO_BASE> list        = new List <R_WO_BASE>();

            try
            {
                oleDB       = this.DBPools["SFCDB"].Borrow();
                sec         = new T_R_WO_BASE(oleDB, DBTYPE);
                WORKORDERNO = Data["WORKORDERNO"].ToString().Trim();
                SKUNO       = Data["SKUNO"].ToString().Trim();
                QTY         = int.Parse(Data["QTY"].ToString());
                list        = sec.GetQtyByWOSkuno(WORKORDERNO, SKUNO, QTY, oleDB);
                if (list.Count > 0)
                {
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000033";
                    StationReturn.MessagePara.Add(list.Count);
                    StationReturn.Data = list;
                }
                else
                {
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000043";
                    StationReturn.Data        = new object();
                }
                if (oleDB != null)
                {
                    this.DBPools["SFCDB"].Return(oleDB);
                }
            }
            catch (Exception exception)
            {
                this.DBPools["SFCDB"].Return(oleDB);
                StationReturn.Status  = StationReturnStatusValue.Fail;
                StationReturn.Message = exception.Message;
                StationReturn.Data    = "";
                if (oleDB != null)
                {
                    this.DBPools["SFCDB"].Return(oleDB);
                }
            }
        }
Beispiel #10
0
        public void AutoConvert()
        {
            T_R_WO_HEADER R_WO_HEADER;
            T_R_WO_BASE   R_WO_BASE;
            T_C_SKU       C_SKU;
            T_C_ROUTE     C_ROUTE;
            OleExec       Sfcdb;
            string        Rows_ID = "";

            Sfcdb       = this.DBPools["SFCDB"].Borrow();
            R_WO_HEADER = new T_R_WO_HEADER(Sfcdb, DB_TYPE_ENUM.Oracle);
            DataTable dt = R_WO_HEADER.GetConvertWoList(Sfcdb, DB_TYPE_ENUM.Oracle);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    R_WO_BASE = new T_R_WO_BASE(Sfcdb, DB_TYPE_ENUM.Oracle);
                    Rows_ID   = R_WO_BASE.GetNewID(BU, Sfcdb);
                    Row_R_WO_BASE Rows = (Row_R_WO_BASE)R_WO_BASE.NewRow();

                    C_SKU = new T_C_SKU(Sfcdb, DB_TYPE_ENUM.Oracle);
                    Row_C_SKU Rows_SKU = (Row_C_SKU)C_SKU.GetSku(dr["MATNR"].ToString(), Sfcdb, DB_TYPE_ENUM.Oracle);

                    C_ROUTE = new T_C_ROUTE(Sfcdb, DB_TYPE_ENUM.Oracle);
                    Row_C_ROUTE Rows_Route = (Row_C_ROUTE)C_ROUTE.GetRouteBySkuno(dr["MATNR"].ToString(), Sfcdb, DB_TYPE_ENUM.Oracle);

                    if (Rows != null && Rows_SKU != null && Rows_Route != null)
                    {
                        Rows.ID            = Rows_ID;
                        Rows.WORKORDERNO   = dr["AUFNR"].ToString();
                        Rows.SKUNO         = dr["MATNR"].ToString();
                        Rows.CUSTOMER_NAME = Rows_SKU.CUST_SKU_CODE;
                        Rows.CUST_PN       = Rows_SKU.CUST_PARTNO;
                        Rows.WORKORDER_QTY = Convert.ToDouble(dr["GAMNG"]);
                        Rows.SKU_VER       = dr["REVLV"].ToString();
                        Rows.SKU_NAME      = Rows_SKU.SKU_NAME;
                        Rows.SKU_DESC      = Rows_SKU.DESCRIPTION;
                        Rows.ROHS          = dr["ROHS_VALUE"].ToString();
                        Rows.ROUTE_ID      = Rows_Route.ID; //路由應該加版本//Rows.KP_LIST_ID
                        Rows.CLOSED_FLAG   = "0";
                        Rows.EDIT_EMP      = "LLF";
                        string str = Sfcdb.ExecSQL(Rows.GetInsertString(DB_TYPE_ENUM.Oracle));
                    }
                }
            }
        }
Beispiel #11
0
        /// <summary>
        /// 檢查工單數據是否存在
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">1個參數,WO保存的位置</param>
        public static void WoDataCheck(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            string ErrMessage = "";

            if (Paras.Count != 1)
            {
                throw new Exception("參數數量不正確!");
            }
            MESStationSession s = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (s == null)
            {
                s = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(s);
            }
            //CHECK  Workorder是否存在
            T_R_WO_BASE   TRWO = new T_R_WO_BASE(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            Row_R_WO_BASE ROWWO;
            string        WO = Input.Value.ToString();

            try
            {
                ROWWO        = TRWO.GetWo(WO, Station.SFCDB);
                s.Value      = WO;
                s.InputValue = Input.Value.ToString();
                s.ResetInput = Input;

                //modify by LLF 2018-02-02
                //Station.AddMessage("MES00000029", new string[] { "Workorder", WO}, MESReturnView.Station.StationMessageState.Message);
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000029", new string[] { "Workorder", WO });
                throw new MESReturnMessage(ErrMessage);
            }
            catch (Exception ex)
            {
                //modify by LLF 2018-02-02
                //ex.InnerException.Message;
                //string msgCode = ex.Message;
                //Station.AddMessage(msgCode, new string[] { "Workorder:" + WO }, StationMessageState.Fail);
                throw new MESReturnMessage(ex.Message);
            }
        }
Beispiel #12
0
        public static void UpdateWOKeypartID(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession sessionWO = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (sessionWO == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE }));
            }
            try
            {
                int       result;
                WorkOrder objWorkorder = new WorkOrder();
                objWorkorder = (WorkOrder)sessionWO.Value;
                T_C_KP_LIST   t_c_kp_list = new T_C_KP_LIST(Station.SFCDB, Station.DBType);
                T_R_WO_BASE   t_r_wo_base = new T_R_WO_BASE(Station.SFCDB, Station.DBType);
                Row_R_WO_BASE rowWOBase;
                List <string> kpList = t_c_kp_list.GetListIDBySkuno(objWorkorder.SkuNO, Station.SFCDB);
                if (kpList.Count == 0)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000255", new string[] { objWorkorder.SkuNO }));
                }
                rowWOBase            = (Row_R_WO_BASE)t_r_wo_base.GetObjByID(objWorkorder.ID, Station.SFCDB);
                rowWOBase.KP_LIST_ID = kpList[0].ToString();
                result = Station.SFCDB.ExecSqlNoReturn(rowWOBase.GetUpdateString(Station.DBType), null);
                if (result <= 0)
                {
                    //報錯信息待改
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { objWorkorder.WorkorderNo }));
                }
                Station.AddMessage("MES00000063", new string[] { objWorkorder.WorkorderNo }, StationMessageState.Pass);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #13
0
 public override void init()
 {
     try
     {
         BU             = ConfigGet("BU");
         Plant          = ConfigGet("PLANT");
         DB             = ConfigGet("DB");
         CUST           = ConfigGet("CUST");
         COUNT          = ConfigGet("COUNT");
         arrayConvertWO = ConfigGet("CONVERTWO").Split(',');
         _downloadWO    = ConfigGet("DOWNLOADWO");
         List <System.Net.IPAddress> temp = HWDNNSFCBase.HostInfo.IP.Where(ipv4 => ipv4.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).ToList();
         ip                 = temp[0].ToString();
         Output.UI          = new DownLoadWO_UI(this);
         SFCDB              = new OleExec(DB, false);
         synLock            = new T_R_SYNC_LOCK(SFCDB, DB_TYPE_ENUM.Oracle);
         C_TAB_COLUMN_MAP   = new T_C_TAB_COLUMN_MAP(SFCDB, DB_TYPE_ENUM.Oracle);
         C_SKU              = new T_C_SKU(SFCDB, DB_TYPE_ENUM.Oracle);
         R_WO_HEADER        = new T_R_WO_HEADER(SFCDB, DB_TYPE_ENUM.Oracle);
         R_WO_ITEM          = new T_R_WO_ITEM(SFCDB, DB_TYPE_ENUM.Oracle);
         R_WO_TEXT          = new T_R_WO_TEXT(SFCDB, DB_TYPE_ENUM.Oracle);
         RouteDetail        = new T_C_ROUTE_DETAIL(SFCDB, DB_TYPE_ENUM.Oracle);
         WOType             = new T_R_WO_TYPE(SFCDB, DB_TYPE_ENUM.Oracle);
         Keypart            = new T_C_KEYPART(SFCDB, DB_TYPE_ENUM.Oracle);
         C_ROUTE            = new T_C_ROUTE(SFCDB, DB_TYPE_ENUM.Oracle);
         R_WO_BASE          = new T_R_WO_BASE(SFCDB, DB_TYPE_ENUM.Oracle);
         T_Series           = new T_C_SERIES(SFCDB, DB_TYPE_ENUM.Oracle);
         t_c_kp_list        = new T_C_KP_LIST(SFCDB, DB_TYPE_ENUM.Oracle);
         ZRFC_SFC_NSG_0001B = new ZRFC_SFC_NSG_0001B(BU);
     }
     catch (Exception e)
     {
         throw new Exception("Init DownLoadWO Fail" + e.Message);
     }
     Output.Tables.Add(ZRFC_SFC_NSG_0001B.GetTableValue("ITAB"));
     Output.Tables.Add(ZRFC_SFC_NSG_0001B.GetTableValue("WO_HEADER"));
     Output.Tables.Add(ZRFC_SFC_NSG_0001B.GetTableValue("WO_ITEM"));
     Output.Tables.Add(ZRFC_SFC_NSG_0001B.GetTableValue("WO_TEXT"));
 }
Beispiel #14
0
        public void GetSNStationKPList(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            MESDBHelper.OleExec SFCDB = this.DBPools["SFCDB"].Borrow();
            try
            {
                string strSN      = Data["SN"].ToString();
                string strSTATION = Data["STATION"].ToString();
                string strWO      = null;
                try
                {
                    strWO = Data["WO"].ToString();
                }
                catch
                { }

                LogicObject.SN SN = new LogicObject.SN();
                SN.Load(strSN, SFCDB, DB_TYPE_ENUM.Oracle);

                MESDataObject.Module.T_R_WO_BASE TWO = new T_R_WO_BASE(SFCDB, DB_TYPE_ENUM.Oracle);
                Row_R_WO_BASE RWO  = TWO.GetWo(SN.WorkorderNo, SFCDB);
                T_R_SN_KP     TRKP = new T_R_SN_KP(SFCDB, DB_TYPE_ENUM.Oracle);

                List <R_SN_KP> snkp = TRKP.GetKPRecordBySnIDStation(SN.ID, strSTATION, SFCDB);

                SN_KP ret = new SN_KP(snkp, SN.WorkorderNo, SN.SkuNo, SFCDB);


                StationReturn.Data   = ret;
                StationReturn.Status = StationReturnStatusValue.Pass;
            }
            catch (Exception ee)
            {
                //this.DBPools["SFCDB"].Return(SFCDB);
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000037";
                StationReturn.MessagePara.Add(ee.Message);
            }
            this.DBPools["SFCDB"].Return(SFCDB);
        }
Beispiel #15
0
        public WOBase(string wo, OleExec sfcdb)
        {
            T_R_WO_BASE TR_WO_BASE = new T_R_WO_BASE(sfcdb, MESDataObject.DB_TYPE_ENUM.Oracle);

            WO = TR_WO_BASE.GetWoByWoNo(wo, sfcdb);
            if (WO == null)
            {
                throw new Exception("工單 " + wo + " 不存在!");
            }
            else
            {
                if (WO.SKUNO == null || WO.SKUNO.Trim().Length <= 0)
                {
                    throw new Exception("工單 " + wo + " 未配置機種!");
                }
                _SAPMapping = new SAPMappingBase(WO.SKUNO, sfcdb);
                if (WO.ROUTE_ID == null || WO.ROUTE_ID.Trim().Length <= 0)
                {
                    throw new Exception("工單 " + wo + " 未配置路由ID!");
                }
                _Route = new RouteBase(WO.ROUTE_ID.Trim(), sfcdb);
            }
        }
Beispiel #16
0
        public void GetSNDetailByWo(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JToken Data, MESStationReturn StationReturn)
        {
            OleExec sfcdb = null;

            try
            {
                sfcdb = this.DBPools["SFCDB"].Borrow();
                sfcdb.ThrowSqlExeception = true;
                T_R_WO_BASE t_r_wo_base = new T_R_WO_BASE(sfcdb, DBTYPE);
                R_WO_BASE   r_wo_base   = t_r_wo_base.GetWoByWoNo(Data["WO"].ToString().ToUpper().Trim(), sfcdb);
                if (r_wo_base == null)
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000164", new string[] { Data["WO"].ToString().ToUpper().Trim() }));
                }
                T_R_SN      t_r_sn = new T_R_SN(sfcdb, DBTYPE);
                List <R_SN> snList = t_r_sn.GetRSNbyWo(Data["WO"].ToString().ToUpper().Trim(), sfcdb).FindAll(sn => sn.CURRENT_STATION.IndexOf("LOADING") >= 0);
                if (snList.Count == 0)
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180731133844", new string[] { Data["WO"].ToString().ToUpper().Trim() }));
                }
                this.DBPools["SFCDB"].Return(sfcdb);
                StationReturn.Data        = snList;
                StationReturn.Status      = StationReturnStatusValue.Pass;
                StationReturn.MessageCode = "MES00000001";
            }
            catch (Exception exception)
            {
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000037";
                StationReturn.MessagePara.Add(exception.Message);
                StationReturn.Data = exception.Message;
                if (sfcdb != null)
                {
                    this.DBPools["SFCDB"].Return(sfcdb);
                }
            }
        }
Beispiel #17
0
        public void GetWoReplaceKpWithSku(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string            PartNo = Data["PARTNO"].ToString().Trim(), ReplacePartno = Data["REPLACEPARTNO"].ToString().Trim(), Sku = Data["SKUNO"].ToString().Trim();
            OleExec           oleDB        = oleDB = this.DBPools["SFCDB"].Borrow();;
            T_R_WO_KP_Repalce rWoKpReplace = null;
            T_R_WO_BASE       rWoBase      = null;

            try
            {
                rWoKpReplace = new T_R_WO_KP_Repalce(oleDB, DBTYPE);
                List <R_WO_KP_Repalce> rWoKpRepalceList = rWoKpReplace.GetWoRepalceKpBySkuPartno(Sku, PartNo, ReplacePartno, oleDB);
                StationReturn.Status      = StationReturnStatusValue.Pass;
                StationReturn.MessageCode = "MES00000002";
                StationReturn.Data        = rWoKpRepalceList;
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                this.DBPools["SFCDB"].Return(oleDB);
            }
        }
Beispiel #18
0
        /// <summary>
        /// JOBSTOCK STATION PASS ACTION
        /// </summary>
        /// <param name="objWorkorder">wo obj</param>
        /// <param name="objSN">sn obj</param>
        /// <param name="Station">Station</param>
        /// <param name="confirmed_flag">confirmed_flag</param>
        public void JobStockPass(WorkOrder objWorkorder, SN objSN, MESPubLab.MESStation.MESStationBase Station, string confirmed_flag)
        {
            T_R_STOCK           t_r_stock           = new T_R_STOCK(Station.SFCDB, Station.DBType);
            T_R_SN              t_r_sn              = new T_R_SN(Station.SFCDB, Station.DBType);
            T_R_WO_BASE         t_r_wo_base         = new T_R_WO_BASE(Station.SFCDB, Station.DBType);
            T_R_STOCK_GT        t_r_stock_gt        = new T_R_STOCK_GT(Station.SFCDB, Station.DBType);
            T_C_SAP_STATION_MAP t_c_sap_station_map = new T_C_SAP_STATION_MAP(Station.SFCDB, Station.DBType);
            string              gt_id = "";

            #region  write r_stock,r_stock_gt

            List <C_SAP_STATION_MAP> sapCodeList = t_c_sap_station_map.GetSAPStationMapBySkuOrderBySAPCodeASC(objWorkorder.SkuNO, Station.SFCDB);
            if (sapCodeList.Count == 0)
            {
                throw new MESDataObject.MESReturnMessage(MESDataObject.MESReturnMessage.GetMESReturnMessage("MES00000224", new string[] { objWorkorder.SkuNO }));
            }
            Row_R_STOCK_GT rowStockGT;
            R_STOCK_GT     objGT = t_r_stock_gt.GetNotGTbjByWO(objWorkorder.WorkorderNo, confirmed_flag, Station.SFCDB);
            if (objGT == null)
            {
                gt_id                       = t_r_stock_gt.GetNewID(Station.BU, Station.SFCDB);
                rowStockGT                  = (Row_R_STOCK_GT)t_r_stock_gt.NewRow();
                rowStockGT.ID               = gt_id;
                rowStockGT.WORKORDERNO      = objWorkorder.WorkorderNo;
                rowStockGT.SKUNO            = objWorkorder.SkuNO;
                rowStockGT.TOTAL_QTY        = 1;
                rowStockGT.FROM_STORAGE     = objWorkorder.WorkorderNo;
                rowStockGT.TO_STORAGE       = objWorkorder.STOCK_LOCATION;
                rowStockGT.SAP_FLAG         = "0";
                rowStockGT.CONFIRMED_FLAG   = confirmed_flag;
                rowStockGT.SAP_STATION_CODE = sapCodeList.Last().SAP_STATION_CODE;
                rowStockGT.EDIT_EMP         = Station.LoginUser.EMP_NO;
                rowStockGT.EDIT_TIME        = Station.GetDBDateTime();
                Station.SFCDB.ExecSQL(rowStockGT.GetInsertString(Station.DBType));
            }
            else
            {
                rowStockGT           = (Row_R_STOCK_GT)t_r_stock_gt.GetObjByID(objGT.ID, Station.SFCDB);
                gt_id                = rowStockGT.ID;
                rowStockGT.TOTAL_QTY = rowStockGT.TOTAL_QTY + 1;
                rowStockGT.EDIT_EMP  = Station.LoginUser.EMP_NO;
                rowStockGT.EDIT_TIME = Station.GetDBDateTime();
                Station.SFCDB.ExecSQL(rowStockGT.GetUpdateString(Station.DBType));
            }

            Row_R_STOCK rowStock = (Row_R_STOCK)t_r_stock.NewRow();
            rowStock.ID             = t_r_stock.GetNewID(Station.BU, Station.SFCDB);
            rowStock.SN             = objSN.SerialNo;
            rowStock.WORKORDERNO    = objWorkorder.WorkorderNo;
            rowStock.SKUNO          = objWorkorder.SkuNO;
            rowStock.NEXT_STATION   = objSN.NextStation;
            rowStock.FROM_STORAGE   = objWorkorder.WorkorderNo;
            rowStock.TO_STORAGE     = objWorkorder.STOCK_LOCATION;
            rowStock.CONFIRMED_FLAG = confirmed_flag;
            rowStock.SAP_FLAG       = "0";
            rowStock.EDIT_EMP       = Station.LoginUser.EMP_NO;
            rowStock.EDIT_TIME      = Station.GetDBDateTime();
            rowStock.GT_ID          = gt_id;
            Station.SFCDB.ExecSQL(rowStock.GetInsertString(Station.DBType));
            #endregion

            #region update status
            Row_R_SN rowSN = (Row_R_SN)t_r_sn.GetObjByID(objSN.ID, Station.SFCDB);
            rowSN.NEXT_STATION   = "JOBFINISH";
            rowSN.STOCK_STATUS   = "1";
            rowSN.COMPLETED_FLAG = "1";
            rowSN.COMPLETED_TIME = Station.GetDBDateTime();
            rowSN.STOCK_IN_TIME  = Station.GetDBDateTime();
            rowSN.EDIT_EMP       = Station.LoginUser.EMP_NO;
            rowSN.EDIT_TIME      = Station.GetDBDateTime();
            Station.SFCDB.ExecSQL(rowSN.GetUpdateString(Station.DBType));

            t_r_sn.RecordPassStationDetail(rowSN.SN, Station.Line, Station.StationName, Station.StationName, Station.BU, Station.SFCDB);
            t_r_wo_base.UpdateFinishQty(objWorkorder.WorkorderNo, 1, Station.SFCDB);
            #endregion
        }
Beispiel #19
0
        public static void SNLinkPassAction(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string                SubSn                = "";
            SN                    SubSNObj             = new SN();
            SN                    SnObj                = new SN();
            WorkOrder             WO                   = new WorkOrder();
            T_R_SN                Table_R_SN           = new T_R_SN(Station.SFCDB, Station.DBType);
            T_R_SN_STATION_DETAIL Table_SnDetail       = new T_R_SN_STATION_DETAIL(Station.SFCDB, Station.DBType);
            T_R_SN_KEYPART_DETAIL Table_R_Keypart      = new T_R_SN_KEYPART_DETAIL(Station.SFCDB, Station.DBType);
            string                ErrMessage           = string.Empty;
            List <C_KEYPART>      SubKPList            = new List <C_KEYPART>();
            List <C_KEYPART>      MainKPList           = new List <C_KEYPART>();
            string                StrNextStation       = "";
            string                Status               = "";
            R_SN                  R_Sn                 = null;
            T_R_WO_BASE           WoTable              = null; //add by LLF
            List <Dictionary <string, string> > KPList = new List <Dictionary <string, string> >();
            string result = "";

            if (Paras.Count == 0)
            {
                throw new Exception("參數數量不正確!");
            }

            MESStationSession SubSNSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (SubSNSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }

            MESStationSession SubKPSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (SubKPSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }));
            }

            MESStationSession MainKPSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY);

            if (MainKPSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE + Paras[2].SESSION_KEY }));
            }

            MESStationSession KPListSession = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY);

            if (KPListSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[3].SESSION_TYPE + Paras[3].SESSION_KEY }));
            }

            MESStationSession WOSession = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY);

            if (WOSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[4].SESSION_TYPE + Paras[4].SESSION_KEY }));
            }

            MESStationSession NextStationSession = Station.StationSession.Find(t => t.MESDataType == Paras[5].SESSION_TYPE && t.SessionKey == Paras[5].SESSION_KEY);

            if (NextStationSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[5].SESSION_TYPE + Paras[5].SESSION_KEY }));
            }

            MESStationSession StatusSession = Station.StationSession.Find(t => t.MESDataType == Paras[6].SESSION_TYPE && t.SessionKey == Paras[6].SESSION_KEY);

            if (StatusSession == null)
            {
                StatusSession = new MESStationSession()
                {
                    MESDataType = Paras[6].SESSION_TYPE, SessionKey = Paras[6].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(StatusSession);
                if (string.IsNullOrEmpty(Paras[0].VALUE))
                {
                    StatusSession.Value = "PASS";
                }
            }
            Status = StatusSession.Value.ToString();

            MESStationSession ClearFlagGSession = Station.StationSession.Find(t => t.MESDataType == Paras[7].SESSION_TYPE && t.SessionKey == Paras[7].SESSION_KEY);

            if (ClearFlagGSession == null)
            {
                ClearFlagGSession = new MESStationSession()
                {
                    MESDataType = Paras[7].SESSION_TYPE, SessionKey = Paras[7].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(ClearFlagGSession);
            }
            ClearFlagGSession.Value = "false";

            StrNextStation = SnObj.StringListToString((List <string>)NextStationSession.Value);
            //StrNextStation = NextStationSession.Value.ToString();
            SubKPList  = (List <C_KEYPART>)SubKPSession.Value;
            MainKPList = (List <C_KEYPART>)MainKPSession.Value;
            KPList     = (List <Dictionary <string, string> >)KPListSession.Value;
            SubSNObj   = (SN)SubSNSession.Value;
            WO         = (WorkOrder)WOSession.Value;
            SubSn      = SubSNObj.SerialNo;
            R_Sn       = Table_R_SN.GetById(SubSNObj.ID, Station.SFCDB);
            if (SubKPList.Count + MainKPList.Count == KPList.Count)
            {
                Table_R_SN.UpdateSNKeyparStatus(SubSNObj.ID, Station.LoginUser.EMP_NO, "0", Station.SFCDB);
                Table_R_SN.InsertLinkSN(SubSn, WO.WorkorderNo, WO.SkuNO, WO.RouteID, WO.KP_LIST_ID, Station.StationName, StrNextStation, Station.LoginUser.EMP_NO, Station.BU, Station.SFCDB, SubSNObj.Plant);
                //更新Main KP SN
                foreach (Dictionary <string, string> DicMainKP in KPList)
                {
                    int SeqNo = Convert.ToInt16(DicMainKP["SEQ_NO"]);
                    if (DicMainKP["KP_TYPE"] == "MAIN_SN")
                    {
                        Table_R_SN.UpdateSNKeyparStatus(DicMainKP["KP_SN_ID"], Station.LoginUser.EMP_NO, "1", Station.SFCDB);
                    }
                    //写KP
                    Table_R_Keypart.INSN_KEYPART_DETAIL(Station.SFCDB, Station.BU, SubSNObj.ID, DicMainKP["SN"], DicMainKP["KEYPART_SN"], Station.StationName, DicMainKP["PART_NO"], SeqNo, DicMainKP["CATEGORY_NAME"], DicMainKP["CATEGORY"], Station.LoginUser.EMP_NO);
                }

                //寫過站記錄
                result = Table_R_SN.LinkPassStationDetail(R_Sn, WO.WorkorderNo, WO.SkuNO, WO.RouteID, Station.Line, Station.StationName, Station.StationName, Station.LoginUser.EMP_NO, Station.BU, Station.SFCDB);
                if (Convert.ToInt32(result) <= 0)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000021", new string[] { "STATION DETAIL" }));
                }
                //add by LLF
                WoTable = new T_R_WO_BASE(Station.SFCDB, Station.DBType);
                result  = WoTable.AddCountToWo(WO.WorkorderNo, 1, Station.SFCDB); // 更新 R_WO_BASE 中的數據
                if (Convert.ToInt32(result) <= 0)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000025", new string[] { "WO QTY" }));
                }
                //寫良率,UPH
                result = Table_R_SN.RecordUPH(WO.WorkorderNo, 1, SubSn, Status, Station.Line, Station.StationName, Station.LoginUser.EMP_NO, Station.BU, Station.SFCDB);
                if (Convert.ToInt32(result) <= 0)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000021", new string[] { "UPH" }));
                }
                result = Table_R_SN.RecordYieldRate(WO.WorkorderNo, 1, SubSn, Status, Station.Line, Station.StationName, Station.LoginUser.EMP_NO, Station.BU, Station.SFCDB);
                if (Convert.ToInt32(result) <= 0)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000021", new string[] { "YIELD" }));
                }
                KPListSession.Value     = null;
                ClearFlagGSession.Value = "true";
                Station.AddMessage("MES00000195", new string[] { SubSn, StrNextStation }, StationMessageState.Pass);
            }
        }
Beispiel #20
0
        public void Download(string ItemName, string Date)
        {
            string                      StrSql = "";
            OleExec                     sfcdb;
            DataTable                   RFC_Table = new DataTable();
            T_C_TAB_COLUMN_MAP          C_TAB_COLUMN_MAP;
            DataObjectBase              Row;
            T_R_WO_HEADER               R_WO_HEADER;
            T_R_WO_ITEM                 R_WO_ITEM;
            T_R_WO_TEXT                 R_WO_TEXT;
            T_R_WO_BASE                 R_WO_BASE;
            T_C_SKU                     C_SKU;
            T_C_PARAMETER               C_PARAMETER;
            Row_C_PARAMETER             Row_PARAMETER;
            Dictionary <string, string> DicPara   = new Dictionary <string, string>();
            string                      StrColumn = "";
            string                      StrValue  = "";

            string[] StrColumn_Name;
            string[] StrColumn_Value;
            string   StrWo              = "";
            bool     Exist_WO_Flag      = false;
            bool     Exist_WO_Base_Flag = false;
            bool     Exist_SKU_Flag     = false;
            bool     DownLoad_Auto      = false;

            if (string.IsNullOrEmpty(StrWo))
            {
                DownLoad_Auto = true;
            }

            sfcdb       = this.DBPools["SFCDB"].Borrow();
            C_PARAMETER = new T_C_PARAMETER(sfcdb, DB_TYPE_ENUM.Oracle);
            DicPara     = C_PARAMETER.Get_Interface_Parameter_2(ItemName, sfcdb, DB_TYPE_ENUM.Oracle);
            this.DBPools["SFCDB"].Return(sfcdb);

            ZRFC_SFC_NSG_0001B Zrfc_SFC_NSG_001B = new ZRFC_SFC_NSG_0001B(StrWo);

            Zrfc_SFC_NSG_001B.SetValue("PLANT", DicPara["PLANT"]);//NHGZ,WDN1//WDN1,WSL3
            Zrfc_SFC_NSG_001B.SetValue("SCHEDULED_DATE", Date);
            Zrfc_SFC_NSG_001B.SetValue("RLDATE", Date);
            Zrfc_SFC_NSG_001B.SetValue("COUNT", DicPara["COUNT"]);
            Zrfc_SFC_NSG_001B.SetValue("CUST", DicPara["CUST"]);
            Zrfc_SFC_NSG_001B.SetValue("IN_CNF", DicPara["IN_CNF"]);  //IN_CNF=0,Download WO not Confirmed
            Zrfc_SFC_NSG_001B.CallRFC();

            for (int i = 0; i < Zrfc_SFC_NSG_001B.ReturnDatatableByIndex.Count; i++)
            {
                string ErrorMessage = "";
                switch (Zrfc_SFC_NSG_001B.ReturnDatatableByIndex[i].TableName.ToString().ToUpper())
                {
                case "ITAB":
                    if (Zrfc_SFC_NSG_001B.ReturnDatatableByIndex[0].Rows.Count > 0)
                    {
                        ErrorMessage = Zrfc_SFC_NSG_001B.ReturnDatatableByIndex[0].Rows[0][1].ToString();
                        throw new Exception(ErrorMessage);
                    }
                    break;

                case "WO_HEADER":
                    sfcdb = this.DBPools["SFCDB"].Borrow();

                    C_TAB_COLUMN_MAP = new T_C_TAB_COLUMN_MAP(sfcdb, DB_TYPE_ENUM.Oracle);
                    Row = C_TAB_COLUMN_MAP.GetTableColumnMap("R_WO_HEADER", sfcdb, DB_TYPE_ENUM.Oracle);

                    StrColumn       = Row["TAB_COLUMN"].ToString();
                    StrValue        = "";
                    StrColumn_Name  = StrColumn.Split(',');
                    StrColumn_Value = new string[StrColumn_Name.Count()];

                    RFC_Table = (DataTable)Zrfc_SFC_NSG_001B.ReturnDatatableByIndex[i];

                    for (int m = 0; m < RFC_Table.Rows.Count; m++)
                    {
                        R_WO_BASE          = new T_R_WO_BASE(sfcdb, DB_TYPE_ENUM.Oracle);
                        Exist_WO_Base_Flag = R_WO_BASE.CheckDataExist(RFC_Table.Rows[m]["AUFNR"].ToString(), sfcdb);

                        R_WO_HEADER   = new T_R_WO_HEADER(sfcdb, DB_TYPE_ENUM.Oracle);
                        Exist_WO_Flag = R_WO_HEADER.CheckWoHeadByWo(RFC_Table.Rows[m]["AUFNR"].ToString(), DownLoad_Auto, StrColumn, sfcdb, DB_TYPE_ENUM.Oracle);

                        C_SKU          = new T_C_SKU(sfcdb, DB_TYPE_ENUM.Oracle);
                        Exist_SKU_Flag = C_SKU.CheckSku(RFC_Table.Rows[m][3].ToString(), sfcdb);

                        if (!Exist_WO_Flag && Exist_SKU_Flag && !Exist_WO_Base_Flag)
                        {
                            string StrID = C_TAB_COLUMN_MAP.GetNewID(BU, sfcdb);
                            for (int j = 0; j < StrColumn_Name.Count(); j++)
                            {
                                //StrColumn_Value[j] = ReplaceSpecialChar(RFC_Table.Rows[m][StrColumn_Name[j]].ToString());
                                StrColumn_Value[j] = RFC_Table.Rows[m][StrColumn_Name[j]].ToString();
                                if (j == 0)
                                {
                                    StrValue = "'" + StrColumn_Value[j].ToString() + "'";
                                }
                                else
                                {
                                    StrValue = StrValue + ",'" + StrColumn_Value[j].ToString() + "'";
                                }
                            }
                            StrSql = " insert into R_WO_HEADER(" + StrColumn + ",ID " + ") values(" + StrValue + ",'" + StrID + "'" + ");";

                            R_WO_HEADER = new T_R_WO_HEADER(sfcdb, DB_TYPE_ENUM.Oracle);
                            R_WO_HEADER.EditWoHead(StrSql, sfcdb, DB_TYPE_ENUM.Oracle);
                        }
                    }
                    this.DBPools["SFCDB"].Return(sfcdb);

                    break;

                case "WO_ITEM":
                    StrSql           = "";
                    sfcdb            = this.DBPools["SFCDB"].Borrow();
                    C_TAB_COLUMN_MAP = new T_C_TAB_COLUMN_MAP(sfcdb, DB_TYPE_ENUM.Oracle);
                    Row = C_TAB_COLUMN_MAP.GetTableColumnMap("R_WO_ITEM", sfcdb, DB_TYPE_ENUM.Oracle);

                    StrColumn       = Row["TAB_COLUMN"].ToString();
                    StrValue        = "";
                    StrColumn_Name  = StrColumn.Split(',');
                    StrColumn_Value = new string[StrColumn_Name.Count()];

                    RFC_Table = (DataTable)Zrfc_SFC_NSG_001B.ReturnDatatableByIndex[i];

                    for (int m = 0; m < RFC_Table.Rows.Count; m++)
                    {
                        R_WO_BASE          = new T_R_WO_BASE(sfcdb, DB_TYPE_ENUM.Oracle);
                        Exist_WO_Base_Flag = R_WO_BASE.CheckDataExist(RFC_Table.Rows[m]["AUFNR"].ToString(), sfcdb);

                        R_WO_ITEM     = new T_R_WO_ITEM(sfcdb, DB_TYPE_ENUM.Oracle);
                        Exist_WO_Flag = R_WO_ITEM.CheckWoItemByWo(RFC_Table.Rows[m]["AUFNR"].ToString(), RFC_Table.Rows[m]["MATNR"].ToString(), DownLoad_Auto, StrColumn, sfcdb, DB_TYPE_ENUM.Oracle);

                        C_SKU          = new T_C_SKU(sfcdb, DB_TYPE_ENUM.Oracle);
                        Exist_SKU_Flag = C_SKU.CheckSku(RFC_Table.Rows[m][8].ToString(), sfcdb);

                        if (!Exist_WO_Flag && Exist_SKU_Flag && !Exist_WO_Base_Flag)
                        {
                            string StrID = C_TAB_COLUMN_MAP.GetNewID(BU, sfcdb);
                            for (int j = 0; j < StrColumn_Name.Count(); j++)
                            {
                                //StrColumn_Value[j] = ReplaceSpecialChar(RFC_Table.Rows[m][StrColumn_Name[j]].ToString());
                                StrColumn_Value[j] = RFC_Table.Rows[m][StrColumn_Name[j]].ToString();
                                if (j == 0)
                                {
                                    StrValue = "'" + StrColumn_Value[j].ToString() + "'";
                                }
                                else
                                {
                                    StrValue = StrValue + ",'" + StrColumn_Value[j].ToString() + "'";
                                }
                            }

                            StrSql = "insert into R_WO_ITEM(" + StrColumn + ",ID " + ") values(" + StrValue + ",'" + StrID + "'" + ");\n";

                            R_WO_ITEM = new T_R_WO_ITEM(sfcdb, DB_TYPE_ENUM.Oracle);
                            R_WO_ITEM.EditWoItem(StrSql, sfcdb, DB_TYPE_ENUM.Oracle);
                        }
                    }
                    this.DBPools["SFCDB"].Return(sfcdb);
                    break;

                case "WO_TEXT":
                    StrSql           = "";
                    sfcdb            = this.DBPools["SFCDB"].Borrow();
                    C_TAB_COLUMN_MAP = new T_C_TAB_COLUMN_MAP(sfcdb, DB_TYPE_ENUM.Oracle);
                    Row = C_TAB_COLUMN_MAP.GetTableColumnMap("R_WO_TEXT", sfcdb, DB_TYPE_ENUM.Oracle);

                    StrColumn       = Row["TAB_COLUMN"].ToString();
                    StrValue        = "";
                    StrColumn_Name  = StrColumn.Split(',');
                    StrColumn_Value = new string[StrColumn_Name.Count()];

                    RFC_Table = (DataTable)Zrfc_SFC_NSG_001B.ReturnDatatableByIndex[i];

                    for (int m = 0; m < RFC_Table.Rows.Count; m++)
                    {
                        R_WO_BASE          = new T_R_WO_BASE(sfcdb, DB_TYPE_ENUM.Oracle);
                        Exist_WO_Base_Flag = R_WO_BASE.CheckDataExist(RFC_Table.Rows[m]["AUFNR"].ToString(), sfcdb);

                        R_WO_TEXT     = new T_R_WO_TEXT(sfcdb, DB_TYPE_ENUM.Oracle);
                        Exist_WO_Flag = R_WO_TEXT.CheckWoTextByWo(RFC_Table.Rows[m]["AUFNR"].ToString(), DownLoad_Auto, StrColumn, sfcdb, DB_TYPE_ENUM.Oracle);

                        R_WO_HEADER    = new T_R_WO_HEADER(sfcdb, DB_TYPE_ENUM.Oracle);
                        Exist_SKU_Flag = R_WO_HEADER.CheckWoHeadByWo(RFC_Table.Rows[m]["AUFNR"].ToString(), true, StrColumn, sfcdb, DB_TYPE_ENUM.Oracle);

                        if (!Exist_WO_Flag && !Exist_WO_Base_Flag && Exist_SKU_Flag)
                        {
                            string StrID = C_TAB_COLUMN_MAP.GetNewID(BU, sfcdb);
                            for (int j = 0; j < StrColumn_Name.Count(); j++)
                            {
                                StrColumn_Value[j] = RFC_Table.Rows[m][StrColumn_Name[j]].ToString();
                                if (j == 0)
                                {
                                    StrValue = "'" + StrColumn_Value[j].ToString() + "'";
                                }
                                else
                                {
                                    StrValue = StrValue + ",'" + StrColumn_Value[j].ToString() + "'";
                                }
                            }
                            StrSql = "insert into R_WO_TEXT(" + StrColumn + ",ID " + ") values(" + StrValue + ",'" + StrID + "'" + ");";

                            R_WO_TEXT = new T_R_WO_TEXT(sfcdb, DB_TYPE_ENUM.Oracle);
                            R_WO_TEXT.EditWoText(StrSql, sfcdb, DB_TYPE_ENUM.Oracle);
                        }
                    }
                    this.DBPools["SFCDB"].Return(sfcdb);
                    break;
                }
            }
        }
Beispiel #21
0
        //工單狀態檢查
        public static void WoStateDatachecker(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            ////ADD BY  SDL  20180316
            if (Paras.Count != 1)
            {
                throw new Exception("參數數量不正確!");
            }
            MESStationSession WoLoadPoint = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (WoLoadPoint == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            WorkOrder ObjWO = (WorkOrder)WoLoadPoint.Value;

            ////ADD BY  SDL  20180316
            //CHECK  Workorder是否存在
            string ErrMessage = "";

            T_R_WO_BASE   TRWO = new T_R_WO_BASE(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            Row_R_WO_BASE ROWWO;
            T_R_SN        rSn = new T_R_SN(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            // string WO = Input.Value.ToString();   by sdl  20180316
            string WO = ObjWO.WorkorderNo;

            try
            {
                //List<R_SN> snList = rSn.GetRSNbyWo(WO, Station.SFCDB);
                ROWWO = TRWO.GetWo(WO, Station.SFCDB);
                R_WO_BASE woBase       = ROWWO.GetDataObject();
                WorkOrder ObjWorkorder = new WorkOrder();
                //if (snList!=null)
                //{
                //    foreach (var item in snList)
                //    {
                //        if (woBase.ROUTE_ID != item.ROUTE_ID)
                //        {
                //            //throw new Exception("SN RouteID不唯一!");
                //            ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000167", new string[] { item.SN });
                //            throw new MESReturnMessage(ErrMessage);
                //        }
                //    }
                //}

                if (woBase.CLOSED_FLAG == 1.ToString())
                {
                    // throw new Exception("ClosedFlag=1!");
                    ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000168", new string[] { woBase.WORKORDERNO });
                    throw new MESReturnMessage(ErrMessage);
                }

                if ((woBase.START_STATION == null || woBase.START_STATION == "N/A") && woBase.WO_TYPE == "REWORK")
                {
                    ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000203", new string[] { woBase.WORKORDERNO });
                    throw new MESReturnMessage(ErrMessage);
                }

                if (woBase.FINISHED_QTY > woBase.WORKORDER_QTY)
                {
                    //  throw new Exception("FinishQty>WorkOrderQty!");
                    ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000169", new string[] { woBase.WORKORDERNO });
                    throw new MESReturnMessage(ErrMessage);
                }
                Station.StationSession.Add(WoLoadPoint);
                ObjWorkorder.Init(WO, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
                WoLoadPoint.Value       = ObjWorkorder;
                WoLoadPoint.InputValue  = Input.Value.ToString();
                WoLoadPoint.ResetInput  = Input;
                WoLoadPoint.SessionKey  = "1";
                WoLoadPoint.MESDataType = "WO";
                Station.AddMessage("MES00000029", new string[] { "Workorder", WO }, MESReturnView.Station.StationMessageState.Message);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #22
0
        public void SubmitWoInfo(JObject requestValue, JObject Data, MESStationReturn StationReturn)
        {
            //wo
            string wo = Data["wo"].ToString();

            if (string.IsNullOrEmpty(wo))
            {
                //StationReturn.Status = StationReturnStatusValue.Fail;
                //StationReturn.MessageCode = "MES00000006";
                //StationReturn.MessagePara = new List<object>() { "Skuno" };
                //StationReturn.Data = "";
                //return;
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000006", new string[] { "WO" }));
            }

            OleExec     sfcdb = DBPools["SFCDB"].Borrow();
            T_R_WO_BASE t_wo  = new T_R_WO_BASE(sfcdb, DB_TYPE_ENUM.Oracle);

            if (!t_wo.CheckDataExist(wo, sfcdb))
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000008", new string[] { wo }));
            }

            R_WO_HEADER wo_header = new T_R_WO_HEADER(sfcdb, DB_TYPE_ENUM.Oracle).GetDetailByWo(sfcdb, wo);

            //sku info
            string skuno = Data["skuno"].ToString();//wo_header.MATNR

            if (string.IsNullOrEmpty(skuno))
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000006", new string[] { "SKUNO" }));
            }
            string skuver = Data["sku_ver"].ToString();//wo_header.REVLV

            C_SKU c_sku = new T_C_SKU(sfcdb, DB_TYPE_ENUM.Oracle).GetSku(skuno, sfcdb, DB_TYPE_ENUM.Oracle).GetDataObject();

            if (c_sku == null)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000007", new string[] { skuno }));
            }


            //route exchange from name
            string route_name = Data["route_name"].ToString();

            if (string.IsNullOrEmpty(route_name))
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000006", new string[] { "ROUTE" }));
            }
            C_ROUTE c_route = new T_C_ROUTE(sfcdb, DB_TYPE_ENUM.Oracle).GetByRouteName(route_name, sfcdb);

            if (c_route == null)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000007", new string[] { route_name }));
            }

            //station route check
            string station_name = Data["station"].ToString();

            if (string.IsNullOrEmpty(station_name))
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000006", new string[] { "STATION" }));
            }
            List <C_ROUTE_DETAIL> c_route_detail = new T_C_ROUTE_DETAIL(sfcdb, DB_TYPE_ENUM.Oracle).GetByRouteIdOrderBySEQASC(c_route.ID, sfcdb);

            if (c_route_detail != null && c_route_detail.Count > 0)
            {
                C_ROUTE_DETAIL check = c_route_detail.Find(t => t.STATION_NAME == station_name);
                if (check == null)
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000007", new string[] { station_name }));
                }
            }
            else
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000007", new string[] { route_name }));
            }

            //data record
            Row_R_WO_BASE row_wobase = (Row_R_WO_BASE)t_wo.NewRow();

            row_wobase.ID              = t_wo.GetNewID(this.BU, sfcdb);
            row_wobase.WORKORDERNO     = wo;
            row_wobase.PLANT           = Data["factory"].ToString();
            row_wobase.RELEASE_DATE    = DateTime.Now;
            row_wobase.DOWNLOAD_DATE   = Convert.ToDateTime(Data["date"].ToString());
            row_wobase.PRODUCTION_TYPE = "BTO";
            row_wobase.WO_TYPE         = Data["wo_type"].ToString();
            row_wobase.SKUNO           = skuno;
            row_wobase.SKU_VER         = skuver;
            row_wobase.SKU_NAME        = c_sku.SKU_NAME;
            //row_wobase.SKU_SERIES = null;
            //row_wobase.SKU_DESC = null;
            row_wobase.CUST_PN        = c_sku.CUST_PARTNO;
            row_wobase.ROUTE_ID       = c_route.ID;
            row_wobase.START_STATION  = station_name;
            row_wobase.KP_LIST_ID     = Data["kp_list_id"].ToString();
            row_wobase.CLOSED_FLAG    = "0";
            row_wobase.WORKORDER_QTY  = Convert.ToDouble(Data["qty"].ToString());
            row_wobase.STOCK_LOCATION = wo_header.LGORT;
            row_wobase.CUST_ORDER_NO  = wo_header.ABLAD;
            row_wobase.EDIT_EMP       = this.LoginUser.EMP_NO;
            row_wobase.EDIT_TIME      = DateTime.Now;

            string sql = row_wobase.GetInsertString(DB_TYPE_ENUM.Oracle);

            try
            {
                int res = sfcdb.ExecSqlNoReturn(sql, null);
                if (res == 0)
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000021", new string[] { wo }));
                }
                if (sfcdb != null)
                {
                    DBPools["SFCDB"].Return(sfcdb);
                }
            }
            catch (Exception ex)
            {
                if (sfcdb != null)
                {
                    DBPools["SFCDB"].Return(sfcdb);
                }
                throw ex;
            }
        }
Beispiel #23
0
        public void ScanKPItem(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            MESDBHelper.OleExec SFCDB = this.DBPools["SFCDB"].Borrow();
            SFCDB.BeginTrain();
            try
            {
                /*
                 * new APIInputInfo() {InputName = "SN", InputType = "STRING", DefaultValue = ""},
                 * new APIInputInfo() {InputName = "STATION", InputType = "STRING", DefaultValue = ""},
                 * new APIInputInfo() {InputName = "KPITEM", InputType = "STRING", DefaultValue = ""}
                 */
                string    strSN     = Data["SN"].ToString();
                string    station   = Data["STATION"].ToString();
                JToken    _ItemData = Data["KPITEM"];
                T_R_SN_KP TRKP      = new T_R_SN_KP(SFCDB, DB_TYPE_ENUM.Oracle);
                T_R_SN    t_r_sn    = new T_R_SN(SFCDB, DB_TYPE_ENUM.Oracle);

                List <R_SN_KP> ItemData = new List <R_SN_KP>();
                for (int i = 0; i < _ItemData.Count(); i++)
                {
                    //已被綁定的就不能重複綁定
                    if (TRKP.CheckLinkByValue(_ItemData[i]["VALUE"].ToString(), SFCDB))
                    {
                        throw new Exception(_ItemData[i]["VALUE"].ToString() + " has been link on other sn!");
                    }
                    R_SN r_sn = new R_SN();
                    r_sn = t_r_sn.LoadSN(_ItemData[i]["VALUE"].ToString(), SFCDB);
                    //如果KEYPART是本廠做的條碼則必須是完工狀態
                    if (r_sn != null && r_sn.COMPLETED_FLAG != "1")
                    {
                        throw new Exception(_ItemData[i]["VALUE"].ToString() + " is on " + r_sn.NEXT_STATION + ",can't completed!");
                    }
                    R_SN_KP I = new R_SN_KP();
                    I.ID        = _ItemData[i]["ID"].ToString();
                    I.VALUE     = _ItemData[i]["VALUE"].ToString();
                    I.MPN       = _ItemData[i]["MPN"].ToString();
                    I.PARTNO    = _ItemData[i]["PARTNO"].ToString();
                    I.SCANTYPE  = _ItemData[i]["SCANTYPE"].ToString();
                    I.ITEMSEQ   = double.Parse(_ItemData[i]["ITEMSEQ"].ToString());
                    I.SCANSEQ   = double.Parse(_ItemData[i]["SCANSEQ"].ToString());
                    I.DETAILSEQ = double.Parse(_ItemData[i]["DETAILSEQ"].ToString());

                    ItemData.Add(I);
                }
                if (ItemData.Count == 0)
                {
                    StationReturn.Status = StationReturnStatusValue.Pass;
                }

                LogicObject.SN SN = new LogicObject.SN();
                SN.Load(strSN, SFCDB, DB_TYPE_ENUM.Oracle);
                MESDataObject.Module.T_R_WO_BASE TWO = new T_R_WO_BASE(SFCDB, DB_TYPE_ENUM.Oracle);
                Row_R_WO_BASE RWO = TWO.GetWo(SN.WorkorderNo, SFCDB);

                List <R_SN_KP> snkp     = TRKP.GetKPRecordBySnIDStation(SN.ID, station, SFCDB);
                SN_KP          KPCONFIG = new SN_KP(snkp, SN.WorkorderNo, SN.SkuNo, SFCDB);

                R_SN_KP kpItem = KPCONFIG.KPS.Find(T => T.ID == ItemData[0].ID);
                if (kpItem == null)
                {
                    throw new Exception("Data Error!");
                }

                List <R_SN_KP> ConfigItem = KPCONFIG.KPS.FindAll(T => T.PARTNO == kpItem.PARTNO &&
                                                                 T.ITEMSEQ == kpItem.ITEMSEQ &&
                                                                 T.SCANSEQ == kpItem.SCANSEQ
                                                                 );

                if (ConfigItem.Count != ItemData.Count)
                {
                    throw new Exception("Data Error! ConfigItem.Count != ItemData.Count");
                }

                List <Row_R_SN_KP> items = new List <Row_R_SN_KP>();
                for (int i = 0; i < ItemData.Count; i++)
                {
                    Row_R_SN_KP item = (Row_R_SN_KP)TRKP.GetObjByID(ItemData[i].ID, SFCDB);
                    if (item.ITEMSEQ == ItemData[i].ITEMSEQ &&
                        item.SCANSEQ == ItemData[i].SCANSEQ &&
                        item.DETAILSEQ == ItemData[i].DETAILSEQ)
                    {
                        item.VALUE     = ItemData[i].VALUE;
                        item.MPN       = ItemData[i].MPN;
                        item.PARTNO    = ItemData[i].PARTNO;
                        item.EDIT_TIME = DateTime.Now;
                        item.EDIT_EMP  = LoginUser.EMP_NO;
                        SFCDB.ExecSQL(item.GetUpdateString(DB_TYPE_ENUM.Oracle));
                        item.AcceptChange();
                        items.Add(item);
                    }
                    else
                    {
                        throw new Exception("Data Error! 1");
                    }
                }

                for (int i = 0; i < items.Count; i++)
                {
                    var ScanTypes = SFCDB.ORM.Queryable <C_KP_Check>().Where(t => t.TYPENAME == items[i].SCANTYPE).ToList();
                    if (ScanTypes.Count > 0)
                    {
                        Assembly assembly  = Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory + ScanTypes[0].DLL);
                        Type     APIType   = assembly.GetType(ScanTypes[0].CLASS);
                        object   API_CLASS = assembly.CreateInstance(ScanTypes[0].CLASS);
                        var      Methods   = APIType.GetMethods();
                        var      Funs      = Methods.Where <MethodInfo>(t => t.Name == ScanTypes[0].FUNCTION);
                        if (Funs.Count() > 0)
                        {
                            Funs.ElementAt(0).Invoke(API_CLASS, new object[] { KPCONFIG, SN, items[i], items, this, SFCDB });
                        }
                    }
                }



                StationReturn.Status = StationReturnStatusValue.Pass;
                SFCDB.CommitTrain();
            }
            catch (Exception ee)
            {
                SFCDB.RollbackTrain();
                //this.DBPools["SFCDB"].Return(SFCDB);
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000037";
                if (ee.InnerException != null)
                {
                    StationReturn.MessagePara.Add(ee.InnerException.Message);
                }
                else
                {
                    StationReturn.MessagePara.Add(ee.Message);
                }
            }
            this.DBPools["SFCDB"].Return(SFCDB);
        }
Beispiel #24
0
        public void CutWoByNum(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JToken Data, MESStationReturn StationReturn)
        {
            string  wo        = Data["WO"].ToString().ToUpper().Trim();
            string  closeFlag = Data["CLOSEFLAG"].ToString().ToUpper().Trim();
            double  num       = 0;
            OleExec sfcdb     = null;

            try
            {
                sfcdb = this.DBPools["SFCDB"].Borrow();
                sfcdb.ThrowSqlExeception = true;
                T_R_WO_BASE t_r_wo_base = new T_R_WO_BASE(sfcdb, DBTYPE);
                R_WO_BASE   r_wo_base   = t_r_wo_base.GetWoByWoNo(wo, sfcdb);
                if (r_wo_base == null)
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000164", new string[] { wo }));
                }
                try
                {
                    num = Convert.ToDouble(Data["NUM"].ToString().ToUpper().Trim());
                }
                catch
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180731151259", new string[] { Data["NUM"].ToString().ToUpper().Trim() }));
                }
                if (num <= 0)
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180731151259", new string[] { Data["NUM"].ToString().ToUpper().Trim() }));
                }

                if (r_wo_base.WORKORDER_QTY - r_wo_base.INPUT_QTY < num)
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000208", new string[] { wo, num.ToString(), (r_wo_base.WORKORDER_QTY - r_wo_base.INPUT_QTY).ToString() }));
                }

                Row_R_WO_BASE rowWoBase = (Row_R_WO_BASE)t_r_wo_base.GetObjByID(r_wo_base.ID, sfcdb);
                rowWoBase.WORKORDER_QTY = r_wo_base.WORKORDER_QTY - Convert.ToDouble(num);
                if (closeFlag == "1")
                {
                    rowWoBase.CLOSED_FLAG = closeFlag;
                    rowWoBase.CLOSE_DATE  = GetDBDateTime();
                }
                rowWoBase.EDIT_EMP  = LoginUser.EMP_NO;
                rowWoBase.EDIT_TIME = GetDBDateTime();
                sfcdb.ExecSQL(rowWoBase.GetUpdateString(DBTYPE));

                this.DBPools["SFCDB"].Return(sfcdb);
                StationReturn.Data        = r_wo_base;
                StationReturn.Status      = StationReturnStatusValue.Pass;
                StationReturn.MessageCode = "MES00000210";
                StationReturn.MessagePara.Add(wo);
                StationReturn.MessagePara.Add(num);
            }
            catch (Exception exception)
            {
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000037";
                StationReturn.MessagePara.Add(exception.Message);
                StationReturn.Data = exception.Message;
                if (sfcdb != null)
                {
                    this.DBPools["SFCDB"].Return(sfcdb);
                }
            }
        }
Beispiel #25
0
        public void ScanKPItem(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            MESDBHelper.OleExec SFCDB = this.DBPools["SFCDB"].Borrow();
            SFCDB.BeginTrain();
            try
            {
                /*
                 * new APIInputInfo() {InputName = "SN", InputType = "STRING", DefaultValue = ""},
                 * new APIInputInfo() {InputName = "STATION", InputType = "STRING", DefaultValue = ""},
                 * new APIInputInfo() {InputName = "KPITEM", InputType = "STRING", DefaultValue = ""}
                 */
                string         strSN     = Data["SN"].ToString();
                string         station   = Data["STATION"].ToString();
                JToken         _ItemData = Data["KPITEM"];
                T_R_SN_KP      TRKP      = new T_R_SN_KP(SFCDB, DB_TYPE_ENUM.Oracle);
                List <R_SN_KP> ItemData  = new List <R_SN_KP>();
                for (int i = 0; i < _ItemData.Count(); i++)
                {
                    if (TRKP.CheckLinkByValue(_ItemData[i]["VALUE"].ToString(), SFCDB))
                    {
                        throw new Exception(_ItemData[i]["VALUE"].ToString() + " has been link on other sn!");
                    }
                    R_SN_KP I = new R_SN_KP();
                    I.ID        = _ItemData[i]["ID"].ToString();
                    I.VALUE     = _ItemData[i]["VALUE"].ToString();
                    I.MPN       = _ItemData[i]["MPN"].ToString();
                    I.PARTNO    = _ItemData[i]["PARTNO"].ToString();
                    I.SCANTYPE  = _ItemData[i]["SCANTYPE"].ToString();
                    I.ITEMSEQ   = double.Parse(_ItemData[i]["ITEMSEQ"].ToString());
                    I.SCANSEQ   = double.Parse(_ItemData[i]["SCANSEQ"].ToString());
                    I.DETAILSEQ = double.Parse(_ItemData[i]["DETAILSEQ"].ToString());

                    ItemData.Add(I);
                }
                if (ItemData.Count == 0)
                {
                    StationReturn.Status = StationReturnStatusValue.Pass;
                }

                LogicObject.SN SN = new LogicObject.SN();
                SN.Load(strSN, SFCDB, DB_TYPE_ENUM.Oracle);
                MESDataObject.Module.T_R_WO_BASE TWO = new T_R_WO_BASE(SFCDB, DB_TYPE_ENUM.Oracle);
                Row_R_WO_BASE RWO = TWO.GetWo(SN.WorkorderNo, SFCDB);

                List <R_SN_KP> snkp     = TRKP.GetKPRecordBySnIDStation(SN.ID, station, SFCDB);
                SN_KP          KPCONFIG = new SN_KP(snkp, SN.WorkorderNo, SN.SkuNo, SFCDB);

                R_SN_KP kpItem = KPCONFIG.KPS.Find(T => T.ID == ItemData[0].ID);
                if (kpItem == null)
                {
                    throw new Exception("Data Error!");
                }

                List <R_SN_KP> ConfigItem = KPCONFIG.KPS.FindAll(T => T.PARTNO == kpItem.PARTNO &&
                                                                 T.ITEMSEQ == kpItem.ITEMSEQ &&
                                                                 T.SCANSEQ == kpItem.SCANSEQ
                                                                 );

                if (ConfigItem.Count != ItemData.Count)
                {
                    throw new Exception("Data Error! ConfigItem.Count != ItemData.Count");
                }


                for (int i = 0; i < ItemData.Count; i++)
                {
                    Row_R_SN_KP item = (Row_R_SN_KP)TRKP.GetObjByID(ItemData[i].ID, SFCDB);
                    if (item.ITEMSEQ == ItemData[i].ITEMSEQ &&
                        item.SCANSEQ == ItemData[i].SCANSEQ &&
                        item.DETAILSEQ == ItemData[i].DETAILSEQ)
                    {
                        item.VALUE     = ItemData[i].VALUE;
                        item.MPN       = ItemData[i].MPN;
                        item.PARTNO    = ItemData[i].PARTNO;
                        item.EDIT_TIME = DateTime.Now;
                        item.EDIT_EMP  = LoginUser.EMP_NO;
                        SFCDB.ExecSQL(item.GetUpdateString(DB_TYPE_ENUM.Oracle));
                    }
                    else
                    {
                        throw new Exception("Data Error! 1");
                    }
                }



                StationReturn.Status = StationReturnStatusValue.Pass;
                SFCDB.CommitTrain();
            }
            catch (Exception ee)
            {
                SFCDB.RollbackTrain();
                //this.DBPools["SFCDB"].Return(SFCDB);
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000037";
                StationReturn.MessagePara.Add(ee.Message);
            }
            this.DBPools["SFCDB"].Return(SFCDB);
        }
Beispiel #26
0
        public void startWO(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            OleExec Sfcdb  = this.DBPools["SFCDB"].Borrow();
            string  WO     = Data["WO"].ToString();
            T_R_SN  t_r_sn = new T_R_SN(Sfcdb, this.DBTYPE);
            string  id     = t_r_sn.findOneSNByWO(WO, Sfcdb);

            if (!string.IsNullOrEmpty(id))
            {
                StationReturn.Status  = StationReturnStatusValue.Fail;
                StationReturn.Message = "工单已展开,不能重复展开";
                return;
            }
            T_R_WO_HEADER_TJ   t_R_WO_HEADER_TJ = new T_R_WO_HEADER_TJ(Sfcdb, this.DBTYPE);
            Row_R_WO_HEADER_TJ row_R_WO_HEADER  = t_R_WO_HEADER_TJ.GetWo(WO, Sfcdb);
            T_C_SKU            table_sku        = new T_C_SKU(Sfcdb, this.DBTYPE);
            string             user             = this.LoginUser.EMP_NO;

            MESDataObject.Module.SkuObject SkuObject = table_sku.GetSkuBySkuno(row_R_WO_HEADER.MATNR, Sfcdb);
            float qty = float.Parse(row_R_WO_HEADER.GAMNG);

            qty = 5;
            //获取路由id
            T_R_SKU_ROUTE t_R_SKU_ROUTE = new T_R_SKU_ROUTE(Sfcdb, this.DBTYPE);
            string        routeid       = t_R_SKU_ROUTE.getRouteIdBySkuName(row_R_WO_HEADER.MATNR, Sfcdb);
            //获取keypartlistid
            T_C_KP_LIST   t_C_KP_LIST    = new T_C_KP_LIST(Sfcdb, this.DBTYPE);
            List <string> keypartlistids = t_C_KP_LIST.GetListIDBySkuno(row_R_WO_HEADER.MATNR, Sfcdb);

            if (keypartlistids.Count == 0)
            {
                StationReturn.Status  = StationReturnStatusValue.Fail;
                StationReturn.Message = "未配置keypartlistid";
                return;
            }
            //生成工单基础表
            T_R_WO_BASE t_R_WO_BASE = new T_R_WO_BASE(Sfcdb, this.DBTYPE);

            t_R_WO_BASE.deleteWOByWo(WO, Sfcdb);
            t_R_WO_BASE.addWOByWOHeader(BU, user, routeid, row_R_WO_HEADER, Sfcdb);

            WorkOrder objWorkorder = new WorkOrder();

            objWorkorder.Init(WO, Sfcdb);
            objWorkorder.WorkorderNo = WO;
            objWorkorder.KP_LIST_ID  = keypartlistids[0].ToString();
            objWorkorder.SkuNO       = row_R_WO_HEADER.MATNR;

            //生成SN
            for (int i = 0; i < qty; i++)
            {
                String nextSN = SNmaker.GetNextSN(SkuObject.SnRule, Sfcdb, WO);
                Console.Out.WriteLine(nextSN);
                t_r_sn.addStartSNRecords(BU, user, WO, routeid, row_R_WO_HEADER, nextSN, Sfcdb);
            }
            //生成keypartlistid

            List <R_SN> r_sns = t_r_sn.GETSN(WO, Sfcdb);

            for (int i = 0; i < r_sns.Count; i++)
            {
                T_C_KP_LIST c_kp_list = new T_C_KP_LIST(Sfcdb, this.DBTYPE);
                if (objWorkorder.KP_LIST_ID != "" && c_kp_list.KpIDIsExist(objWorkorder.KP_LIST_ID, Sfcdb))
                {
                    SN             snObject = new SN();
                    MESStationBase Station  = new MESStationBase();
                    Station.BU        = this.LoginUser.BU;
                    Station.LoginUser = this.LoginUser;
                    Station.SFCDB     = Sfcdb;
                    snObject.InsertR_SN_KP(objWorkorder, r_sns[i], Sfcdb, Station, this.DBTYPE);
                }
            }


            StationReturn.Data    = qty;
            StationReturn.Status  = StationReturnStatusValue.Pass;
            StationReturn.Message = MESReturnMessage.GetMESReturnMessage("MSGCODE20180801141046");
        }
Beispiel #27
0
        public static void CutWOAction(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string      ErrMessage = "";
            int         WoQty      = 0;
            int         WoInputQty = 0;
            int         CutQty     = 0;
            string      StrWO      = "";
            WorkOrder   WO         = new WorkOrder();
            T_R_WO_BASE R_Wo_Base  = new T_R_WO_BASE(Station.SFCDB, Station.DBType);

            if (Paras.Count != 5)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000051", new string[] { "3", Paras.Count.ToString() });
                throw new MESReturnMessage(ErrMessage);
            }

            MESStationSession WoSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (WoSession == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            WorkOrder WoObj = (WorkOrder)WoSession.Value;

            StrWO = WoObj.WorkorderNo;

            MESStationSession WoQtySession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (WoQtySession == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            WoQty = Convert.ToInt16(WoQtySession.Value);


            MESStationSession CutQtySession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY);

            if (CutQtySession == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE + Paras[2].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            CutQty = Convert.ToInt16(CutQtySession.Value);

            MESStationSession WoInputQtySession = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY);

            if (WoInputQtySession == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[3].SESSION_TYPE + Paras[3].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            WoInputQty = Convert.ToInt16(WoInputQtySession.Value);

            MESStationSession WoFinishQtySession = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY);

            if (WoFinishQtySession == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[4].SESSION_TYPE + Paras[4].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            WoInputQty = Convert.ToInt16(WoInputQtySession.Value);

            if (WoQty - WoInputQty < CutQty)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000208", new string[] { StrWO, CutQty.ToString(), (WoQty - WoInputQty).ToString() });
                throw new MESReturnMessage(ErrMessage);
            }

            int Result = R_Wo_Base.UpdateWoQty(StrWO, CutQty, Station.LoginUser.EMP_NO, Station.SFCDB);

            if (Result > 0)
            {
                WO.Init(StrWO, Station.SFCDB, Station.DBType);

                WoInputQtySession.Value  = WO.INPUT_QTY;
                WoFinishQtySession.Value = WO.FINISHED_QTY;
                WoQtySession.Value       = WO.WORKORDER_QTY;

                Station.AddMessage("MES00000210", new string[] { StrWO, CutQty.ToString() }, StationMessageState.Pass); //回饋消息到前台
            }
            else
            {
                Station.AddMessage("MES00000209", new string[] { StrWO, CutQty.ToString() }, StationMessageState.Fail);//回饋消息到前台
            }
        }
Beispiel #28
0
        public void CutWoBySNId(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JToken Data, MESStationReturn StationReturn)
        {
            OleExec sfcdb = null;

            try
            {
                string wo        = Data["WO"].ToString().ToUpper().Trim();
                string closeFlag = Data["CLOSEFLAG"].ToString().ToUpper().Trim();
                Newtonsoft.Json.Linq.JArray arrayId = (Newtonsoft.Json.Linq.JArray)Data["ID"];

                sfcdb = this.DBPools["SFCDB"].Borrow();
                sfcdb.ThrowSqlExeception = true;
                T_R_WO_BASE t_r_wo_base = new T_R_WO_BASE(sfcdb, DBTYPE);
                R_WO_BASE   r_wo_base   = t_r_wo_base.GetWoByWoNo(wo, sfcdb);
                if (r_wo_base == null)
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000164", new string[] { wo }));
                }

                T_R_SN   t_r_sn = new T_R_SN(sfcdb, DBTYPE);
                Row_R_SN rowSN;
                for (int i = 0; i < arrayId.Count; i++)
                {
                    rowSN             = (Row_R_SN)t_r_sn.GetObjByID(arrayId[i].ToString(), sfcdb);
                    rowSN.SN          = "CUT_" + rowSN.SN;
                    rowSN.WORKORDERNO = "CUT_" + rowSN.WORKORDERNO;
                    rowSN.SKUNO       = "CUT_" + rowSN.SKUNO;
                    rowSN.EDIT_EMP    = LoginUser.EMP_NO;
                    rowSN.EDIT_TIME   = GetDBDateTime();
                    sfcdb.ExecSQL(rowSN.GetUpdateString(DBTYPE));
                }

                Row_R_WO_BASE rowWoBase = (Row_R_WO_BASE)t_r_wo_base.GetObjByID(r_wo_base.ID, sfcdb);
                rowWoBase.WORKORDER_QTY = r_wo_base.WORKORDER_QTY - Convert.ToDouble(arrayId.Count);
                rowWoBase.INPUT_QTY     = r_wo_base.INPUT_QTY - Convert.ToDouble(arrayId.Count);
                rowWoBase.EDIT_EMP      = LoginUser.EMP_NO;
                rowWoBase.EDIT_TIME     = GetDBDateTime();
                if (closeFlag == "1")
                {
                    rowWoBase.CLOSED_FLAG = closeFlag;
                    rowWoBase.CLOSE_DATE  = GetDBDateTime();
                }
                sfcdb.ExecSQL(rowWoBase.GetUpdateString(DBTYPE));

                this.DBPools["SFCDB"].Return(sfcdb);
                StationReturn.Data        = r_wo_base;
                StationReturn.Status      = StationReturnStatusValue.Pass;
                StationReturn.MessageCode = "MES00000210";
                StationReturn.MessagePara.Add(wo);
                StationReturn.MessagePara.Add(arrayId.Count);
            }
            catch (Exception exception)
            {
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000037";
                StationReturn.MessagePara.Add(exception.Message);
                StationReturn.Data = exception.Message;
                if (sfcdb != null)
                {
                    this.DBPools["SFCDB"].Return(sfcdb);
                }
            }
        }
Beispiel #29
0
        public void ModifyWORange(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            T_R_WO_REGION rWo   = null;
            OleExec       sfcdb = null;

            try
            {
                sfcdb = this.DBPools["SFCDB"].Borrow();
                rWo   = new T_R_WO_REGION(sfcdb, DB_TYPE_ENUM.Oracle);
                Row_R_WO_REGION r         = (Row_R_WO_REGION)rWo.NewRow();
                T_R_WO_BASE     StWoBase  = new T_R_WO_BASE(sfcdb, DB_TYPE_ENUM.Oracle);
                T_C_SKU         t_c_sku   = new T_C_SKU(sfcdb, DB_TYPE_ENUM.Oracle);
                Row_R_WO_BASE   RowWoBase = null;
                RowWoBase = StWoBase.GetWo((Data["WORKORDERNO"].ToString()).Trim(), sfcdb);

                string minSN    = (Data["MIN_SN"].ToString()).Trim();
                string maxSN    = (Data["MAX_SN"].ToString()).Trim();
                string checkOut = "";
                if (!rWo.InputIsStringOrNum(minSN, out checkOut))
                {
                    StationReturn.MessageCode = "MES00000258";
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.Data        = "";
                    return;
                }
                if (!rWo.InputIsStringOrNum(maxSN, out checkOut))
                {
                    StationReturn.MessageCode = "MES00000258";
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.Data        = "";
                    return;
                }
                C_SKU objectSku = t_c_sku.GetSku(RowWoBase.SKUNO, sfcdb, DB_TYPE_ENUM.Oracle).GetDataObject();
                if (!rWo.InputIsMatchSkuRule(minSN, objectSku))
                {
                    StationReturn.MessageCode = "MES00000259";
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.Data        = "";
                    return;
                }
                if (!rWo.InputIsMatchSkuRule(maxSN, objectSku))
                {
                    StationReturn.MessageCode = "MES00000259";
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.Data        = "";
                    return;
                }

                r             = (Row_R_WO_REGION)rWo.GetObjByID(Data["ID"].ToString(), sfcdb, DB_TYPE_ENUM.Oracle);
                r.ID          = (Data["ID"].ToString()).Trim();
                r.WORKORDERNO = (Data["WORKORDERNO"].ToString()).Trim();
                r.SKUNO       = RowWoBase.SKUNO;
                r.QTY         = RowWoBase.WORKORDER_QTY;
                //r.SKUNO = (Data["SKUNO"].ToString()).Trim();
                //r.QTY = int.Parse(Data["QTY"].ToString());
                r.MIN_SN    = minSN;
                r.MAX_SN    = maxSN;
                r.EDIT_EMP  = LoginUser.EMP_NO;
                r.EDIT_TIME = GetDBDateTime();
                string strRet = sfcdb.ExecSQL(r.GetUpdateString(DB_TYPE_ENUM.Oracle));
                if (Convert.ToInt32(strRet) > 0)
                {
                    StationReturn.MessageCode = "MES00000003";
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.Data        = "";
                }
                else
                {
                    StationReturn.MessageCode = "MES00000036";
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.Data        = "";
                }
                this.DBPools["SFCDB"].Return(sfcdb);
            }
            catch (Exception e)
            {
                this.DBPools["SFCDB"].Return(sfcdb);
                throw e;
            }
        }
Beispiel #30
0
        public void GetLockStation(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JToken Data, MESStationReturn StationReturn)
        {
            string        lockType    = Data["LockType"].ToString().Trim();
            string        lockData    = Data["LockData"].ToString().Trim();
            DataTable     routeTable  = new DataTable();
            List <string> stationList = new List <string>();
            OleExec       sfcdb       = null;

            try
            {
                sfcdb = this.DBPools["SFCDB"].Borrow();
                T_C_ROUTE_DETAIL t_c_route_detail = new T_C_ROUTE_DETAIL(sfcdb, DBTYPE);
                if (lockType == "LockByWo")
                {
                    T_R_WO_BASE t_r_wo_base = new T_R_WO_BASE(sfcdb, DBTYPE);
                    R_WO_BASE   r_wo_base   = t_r_wo_base.GetWo(lockData, sfcdb).GetDataObject();
                    stationList = t_c_route_detail.GetByRouteIdOrderBySEQASC(r_wo_base.ROUTE_ID, sfcdb).Select(route => route.STATION_NAME).ToList();
                }
                else if (lockType == "LockByLot")
                {
                    T_R_LOT_STATUS   t_r_lot_status = new T_R_LOT_STATUS(sfcdb, DBTYPE);
                    Row_R_LOT_STATUS rowLotStatus   = t_r_lot_status.GetByLotNo(lockData, sfcdb);
                    if (rowLotStatus.ID == null)
                    {
                        throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000161", new string[] { }));
                    }
                    R_LOT_STATUS       r_lot_status     = rowLotStatus.GetDataObject();
                    T_C_SKU            t_c_sku          = new T_C_SKU(sfcdb, DBTYPE);
                    C_SKU              c_sku            = t_c_sku.GetSku(r_lot_status.SKUNO, sfcdb, DBTYPE).GetDataObject();
                    T_R_SKU_ROUTE      t_r_sku_route    = new T_R_SKU_ROUTE(sfcdb, DBTYPE);
                    List <R_SKU_ROUTE> r_sku_route_list = t_r_sku_route.GetMappingBySkuId(c_sku.ID, sfcdb);
                    if (r_sku_route_list.Count > 0)
                    {
                        //t_c_route_detail.GetByRouteIdOrderBySEQASC(r_sku_route_list[0].ROUTE_ID, sfcdb);
                        stationList = t_c_route_detail.GetByRouteIdOrderBySEQASC(r_sku_route_list[0].ROUTE_ID, sfcdb).Select(route => route.STATION_NAME).ToList();
                    }
                    else
                    {
                        throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000179", new string[] {  }));
                    }
                }
                else
                {
                    routeTable = t_c_route_detail.GetALLStation(sfcdb);
                    foreach (DataRow row in routeTable.Rows)
                    {
                        stationList.Add(row["station_name"].ToString());
                    }
                    stationList.Sort();
                }

                this.DBPools["SFCDB"].Return(sfcdb);
                StationReturn.Data        = stationList;
                StationReturn.Status      = StationReturnStatusValue.Pass;
                StationReturn.MessageCode = "MES00000001";
            }
            catch (Exception exception)
            {
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000037";
                StationReturn.MessagePara.Add(exception.Message);
                StationReturn.Data = exception.Message;
                if (sfcdb != null)
                {
                    this.DBPools["SFCDB"].Return(sfcdb);
                }
            }
        }