示例#1
0
 public RouteBase(string RouteId, OleExec sfcdb)
 {
     try
     {
         T_C_ROUTE             TC_ROUTE        = new T_C_ROUTE(sfcdb, MESDataObject.DB_TYPE_ENUM.Oracle);
         T_C_ROUTE_DETAIL      TC_ROUTE_DETAIL = new T_C_ROUTE_DETAIL(sfcdb, MESDataObject.DB_TYPE_ENUM.Oracle);
         C_ROUTE               getRoute        = new C_ROUTE();
         List <C_ROUTE_DETAIL> getRouteDetail  = new List <C_ROUTE_DETAIL>();
         getRoute = TC_ROUTE.GetById(RouteId, sfcdb);
         if (getRoute != null)
         {
             this._ID            = getRoute.ID;
             this._ROUTE_NAME    = getRoute.ROUTE_NAME;
             this._DEFAULT_SKUNO = getRoute.DEFAULT_SKUNO;
             this._ROUTE_TYPE    = getRoute.ROUTE_TYPE;
             getRouteDetail      = TC_ROUTE_DETAIL.GetByRouteIdOrderBySEQASC(getRoute.ID, sfcdb);
             if (getRouteDetail != null && getRouteDetail.Count > 0)
             {
                 this._DETAIL = new List <RouteDetail>();
                 for (int i = 0; i < getRouteDetail.Count; i++)
                 {
                     RouteDetail newRouteDetail = new RouteDetail(getRouteDetail[i].ID, sfcdb, MESDataObject.DB_TYPE_ENUM.Oracle);
                     this._DETAIL.Add(newRouteDetail);
                 }
             }
             else
             {
                 throw new Exception(RouteId + " 工站不存在");
             }
         }
         else
         {
             throw new Exception(RouteId + " 不存在");
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#2
0
        private void getByIdOrRouteName(string parametName, string parametValue, OleExec sfcdb, MESDataObject.DB_TYPE_ENUM dbtype)
        {
            try
            {
                T_C_ROUTE             TC_ROUTE        = new T_C_ROUTE(sfcdb, dbtype);
                T_C_ROUTE_DETAIL      TC_ROUTE_DETAIL = new T_C_ROUTE_DETAIL(sfcdb, dbtype);
                C_ROUTE               getRoute        = new C_ROUTE();
                List <C_ROUTE_DETAIL> getRouteDetail  = new List <C_ROUTE_DETAIL>();
                // List<RouteDetail> RouteDetailList = new List<RouteDetail>();
                //T_C_ROUTE_DETAIL_DIRECTLINK TC_ROUTE_DETAIL_DIRECTLINK = new T_C_ROUTE_DETAIL_DIRECTLINK(sfcdb, dbtype);
                //T_C_ROUTE_DETAIL_RETURN TC_ROUTE_DETAIL_RETURN = new T_C_ROUTE_DETAIL_RETURN(sfcdb, dbtype);
                //List<C_ROUTE_DETAIL_RETURN> getDetailReturn = new List<C_ROUTE_DETAIL_RETURN>();
                //List<C_ROUTE_DETAIL_DIRECTLINK> getDetailDirectLink = new List<C_ROUTE_DETAIL_DIRECTLINK>();

                if (parametName.Trim() == "ID")
                {
                    getRoute = TC_ROUTE.GetById(parametValue.Trim(), sfcdb);
                }
                else if (parametName.Trim() == "ROUTENAME")
                {
                    getRoute = TC_ROUTE.GetByRouteName(parametValue.Trim(), sfcdb);
                }
                else
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000007", new string[] { "getByIdOrRouteName:" + parametName }));
                }
                if (getRoute != null)
                {
                    this._ID            = getRoute.ID;
                    this._ROUTE_NAME    = getRoute.ROUTE_NAME;
                    this._DEFAULT_SKUNO = getRoute.DEFAULT_SKUNO;
                    this._ROUTE_TYPE    = getRoute.ROUTE_TYPE;
                    getRouteDetail      = TC_ROUTE_DETAIL.GetByRouteIdOrderBySEQASC(getRoute.ID, sfcdb);
                    if (getRouteDetail != null && getRouteDetail.Count > 0)
                    {
                        this._DETAIL = new List <RouteDetail>();
                        for (int i = 0; i < getRouteDetail.Count; i++)
                        {
                            RouteDetail newRouteDetail = new RouteDetail(getRouteDetail[i].ID, sfcdb, dbtype);
                            #region 寫法一

                            /*
                             * RouteDetail newRouteDetail = new RouteDetail();
                             * newRouteDetail.ID = getRouteDetail[i].ID;
                             * newRouteDetail.SEQ_NO = getRouteDetail[i].SEQ_NO;
                             * newRouteDetail.ROUTE_ID = getRouteDetail[i].ROUTE_ID;
                             * newRouteDetail.STATION_NAME = getRouteDetail[i].STATION_NAME;
                             * newRouteDetail.STATION_TYPE = getRouteDetail[i].STATION_TYPE;
                             * newRouteDetail.RETURN_FLAG = getRouteDetail[i].RETURN_FLAG;
                             * if (getRouteDetail[i].RETURN_FLAG == "Y")
                             * {
                             *   getDetailReturn = TC_ROUTE_DETAIL_RETURN.GetByRoute_DetailId(newRouteDetail.ID, sfcdb);
                             *   if (getDetailReturn != null && getDetailReturn.Count > 0)
                             *   {
                             *       List<C_ROUTE_DETAIL> newReturnList = new List<C_ROUTE_DETAIL>();
                             *       for (int j = 0; j < getDetailReturn.Count; j++)
                             *       {
                             *           newReturnList.Add(TC_ROUTE_DETAIL.GetById(getDetailReturn[j].RETURN_ROUTE_DETAIL_ID, sfcdb));
                             *       }
                             *       newRouteDetail.RETURNLIST = newReturnList;
                             *   }
                             * }
                             * else
                             * {
                             *   newRouteDetail.RETURNLIST = null;
                             * }
                             * getDetailDirectLink = TC_ROUTE_DETAIL_DIRECTLINK.GetByDetailId(newRouteDetail.ID, sfcdb);
                             * if (getDetailDirectLink != null && getDetailDirectLink.Count > 0)
                             * {
                             *   List<C_ROUTE_DETAIL> newDirectLinkList = new List<C_ROUTE_DETAIL>();
                             *   for (int n = 0; n < getDetailDirectLink.Count; n++)
                             *   {
                             *       newDirectLinkList.Add(TC_ROUTE_DETAIL.GetById(getDetailDirectLink[n].DIRECTLINK_ROUTE_DETAIL_ID, sfcdb));
                             *   }
                             *   newRouteDetail.DIRECTLINKLIST = newDirectLinkList;
                             * }
                             * else
                             * {
                             *   newRouteDetail.DIRECTLINKLIST = null;
                             * }
                             * if (this.DETAIL == null)
                             * {
                             *   this.DETAIL = new List<RouteDetail>();
                             * }*/
                            #endregion 寫法一 end
                            this._DETAIL.Add(newRouteDetail);
                        }
                    }
                    else
                    {
                        this._DETAIL = null;
                    }
                }
                else
                {
                    this._ID            = "";
                    this._ROUTE_NAME    = "";
                    this._DEFAULT_SKUNO = "";
                    this._ROUTE_TYPE    = "";
                    this._DETAIL        = null;
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000007", new string[] { "Route_" + parametName + ":" + parametValue }));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }