예제 #1
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);
        }
예제 #2
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);
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
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);
            }
        }
예제 #6
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);
        }
예제 #7
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;
            }
        }
예제 #8
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);
        }
예제 #9
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);
        }
예제 #10
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;
            }
        }
예제 #11
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);
                }
            }
        }