Example #1
0
       /// <summary>
       /// 
       /// </summary>
       /// <param name="model"></param>
       /// <param name="editor"></param>
       /// <param name="firstLine"></param>
        public static void CreateModelProcess(Model model, string editor, string firstLine)
        {
            if (model == null)
            {
                throw new FisException("CHK038", new string[] { string.Empty });
            }

            if (string.IsNullOrEmpty(firstLine))
            {
                throw new FisException("CQCHK50001", new string[] {});
            }

            string modelName = model.ModelName;

            //IProcessRepository processRep = RepositoryFactory.GetInstance().GetRepository<IProcessRepository>();
            IList<ProcessRuleSet> ruleSetList= processRep.GetAllProcessRuleset();
            if (ruleSetList == null || ruleSetList.Count == 0)
            {
                throw new FisException("CHK112",new string[] { modelName });
            }

            IList<int> ruleSetIDList = processRep.GetAllRuleSetIDInProcessRule();
            if (ruleSetIDList == null || ruleSetIDList.Count == 0)
            {
                throw new FisException("CHK112", new string[] { modelName });
            }

            ruleSetList = ruleSetList.Where(x=>ruleSetIDList.Contains(x.ID)).ToList();
            if (ruleSetList == null || ruleSetList.Count == 0)
            {
                throw new FisException("CHK112", new string[] { modelName });
            }

            setProcessConditionValue(model, firstLine, ruleSetList);
            ruleSetList = ruleSetList.OrderByDescending(x => x.Priority).ToList();
            ProcessRule processRule = null;
            foreach (ProcessRuleSet item in ruleSetList)
            {
                var processRuleList = processRep.GetAllRuleByRuleSetID(item.ID).OrderByDescending(x=>x.Udt).ToList();
                processRule = compareProcessRule(processRuleList, item);
                if (processRule != null)
                {
                    break;
                }
            }

            if (processRule == null)
            {
                throw new FisException("CHK112", new string[] { modelName });
            }

            IList<ModelProcess> modelProcessList= processRep.GetModelProcessByModelLine(modelName, firstLine);
            if (modelProcessList == null || modelProcessList.Count == 0)
            {
                processRep.AddModelProcess(modelName, processRule.Process, firstLine, editor);
            }

        }
Example #2
0
        static void setProcessConditionValue(Model model, string firstLine,  IList<ProcessRuleSet>  ruleSetList)
        {
            foreach (ProcessRuleSet item in ruleSetList)
            {
                IList<string> valueList = new List<string>();
                if (!string.IsNullOrEmpty(item.Condition1))
                {
                    valueList.Add(getConditionValue(model, firstLine, item.Condition1));
                }
                else
                {
                    item.ConditiionValueList = valueList;
                    continue;
                }

                if (!string.IsNullOrEmpty(item.Condition2))
                {
                    valueList.Add(getConditionValue(model, firstLine, item.Condition2));
                }
                else
                {
                    item.ConditiionValueList = valueList;
                    continue;
                }

                if (!string.IsNullOrEmpty(item.Condition3))
                {
                   valueList.Add( getConditionValue(model, firstLine, item.Condition3));
                }
                else
                {
                    item.ConditiionValueList = valueList;
                    continue;
                }

                if (!string.IsNullOrEmpty(item.Condition4))
                {
                    valueList.Add( getConditionValue(model, firstLine, item.Condition4));
                }
                else
                {
                    item.ConditiionValueList = valueList;
                    continue;
                }

                if (!string.IsNullOrEmpty(item.Condition5))
                {
                    valueList.Add(getConditionValue(model, firstLine, item.Condition5));
                }
                else
                {
                    item.ConditiionValueList = valueList;
                    continue;
                }

                if (!string.IsNullOrEmpty(item.Condition6))
                {
                  valueList.Add( getConditionValue(model, firstLine, item.Condition6));
                }
                else
                {
                    item.ConditiionValueList = valueList;
                    continue;
                }

              
            }
        }
Example #3
0
 static string getConditionValue(Model model, string firstLine, string name)
 {
     string ret = string.Empty;
     switch (name)
     {
         case "Model":
             ret=model.ModelName;
             break;
         case "Line":
             ret = firstLine;
             break;
         case "Family":
             ret = model.FamilyName;
             break;
         case "Customer":
             ret = model.Family.Customer;
             break;
         case "CustPN":
             ret = model.CustPN;
             break;
         case "Region":
             ret = model.Region;
             break;
         case "ShipType":
             ret = model.ShipType;
             break;
         case "OSCode":
             ret = model.OSCode;
             break;
         case "OSDesc":
             ret = model.OSDesc;
             break; 
         default:
             ret =model.GetAttribute(name);
             break;
     }
     return ret??string.Empty;
 }
Example #4
0
        /// <summary>
        /// </summary>        
        public IList<string> GetPdLinePass(string pdline, string station, string editor, string customer)
        {
            IList<string> result = new List<string>();

            try
            {
                var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
                IModelRepository modelRepository = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>();
                DateTime today = DateTime.Now;
                DateTime yestoday = DateTime.Now.AddDays(-1);
                DateTime begin;
                DateTime end;

                DateTime fixTodayTime = new DateTime(today.Year, today.Month, today.Day, 7, 50, 0);
                DateTime fixYestodayTime = new DateTime(yestoday.Year, yestoday.Month, yestoday.Day, 7, 50, 0);

                if (today.Ticks > fixTodayTime.Ticks)
                {
                    begin = fixTodayTime;
                    end = today;
                }
                else
                {
                    begin = fixYestodayTime;
                    end = fixTodayTime;
                }

                //result.Add(begin.ToString());
                //result.Add(end.ToString());

                //TODO:
                //IList<ProductLog> infos = new List<ProductLog>();
                IList<ModelStatistics> infos = new List<ModelStatistics>();

                infos = productRepository.GetByModelStatisticsFromProductLog(1, "67", begin, end, pdline);

                foreach (ModelStatistics temp in infos)
                {
                    Model model = new Model() ;
                    model = (Model)modelRepository.Find(temp.Model);
                    if (model != null)
                    {
                        result.Add(temp.Model);
                        result.Add(temp.Qty.ToString());
                    }
                }

                return result;
            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("Call ITCNDCheck->GetPdLinePass Success!");
            }
        }
Example #5
0
        /// <summary>
        /// constructure
        /// </summary>
        /// <param name="session">session object</param>       
        /// <param name="modelName"> model name</param>
        /// <param name="moNo">MO Id</param>
        /// <param name="dnNo">Delivery No</param>
        /// <param name="partNo">Part No</param>
        /// <param name="customer">Customer</param>
        public PrintUtility(Session session, 
                                  string modelName, string moNo,
                                  string dnNo, string partNo, 
                                  string customer)
        {
            _session = session;
            _product =session.GetValue(Session.SessionKeys.Product) as Product;
            _mb = session.GetValue(Session.SessionKeys.MB) as MB;

            if (_product != null)
            {
                _customer = _product.Customer;
                if (string.IsNullOrEmpty(modelName) ||
                   modelName == _product.Model)
                {
                    modelName = _product.Model;
                    _model = _product.ModelObj;
                }               

                if (string.IsNullOrEmpty(moNo))
                {
                    moNo = _product.MO;
                }

                if (string.IsNullOrEmpty(dnNo))
                {
                    dnNo = _product.DeliveryNo;
                }

                //if (!string.IsNullOrEmpty(dnNo))
                //    _delivery = dnRep.Find(dnNo);
            }
            else if (_mb != null)
            {
                _customer = _mb.Customer;
                if (string.IsNullOrEmpty(modelName) &&
                    !string.IsNullOrEmpty(_mb.MB1397))
                {
                    modelName = _mb.MB1397;
                    _model = _mb.Model1397Obj;
                }

                if (string.IsNullOrEmpty(moNo))
                {
                    moNo = _mb.SMTMO;
                }
               

                if (string.IsNullOrEmpty(dnNo))
                {
                    dnNo = _mb.DeliveryNo;
                }

                //if (!string.IsNullOrEmpty(dnNo))
                //    _delivery = dnRep.Find(dnNo);

                if (string.IsNullOrEmpty(partNo))
                {
                    partNo = _mb.Model;
                }
            }

            _moNo = moNo;
            _modelName= modelName;
            _dnNo = dnNo;
            _partNo = partNo;

            if(string.IsNullOrEmpty(_customer))
            {
                _customer = customer;
            }            

            if(!string.IsNullOrEmpty(partNo))
            {
                _part =partRep.Find(partNo);
            }

            if (_model == null && !string.IsNullOrEmpty(_modelName))
            {
               _model= modelRep.Find(_modelName);
            }

            if (_delivery == null && !string.IsNullOrEmpty(_dnNo))
            {
                _delivery = dnRep.Find(_dnNo);
            }

        }
Example #6
0
 private  bool checkModel(Model model, string name, string value)
 {
     bool ret = false;
     switch (name.ToUpper())
     {
         case "FAMILY":
             ret = Regex.IsMatch(model.FamilyName, value);
             break;
         case "MODEL":
             ret = Regex.IsMatch(model.ModelName, value);
             break;
         case "CUSTPN":
             ret = Regex.IsMatch(model.CustPN, value);
             break;
         case "REGION":
             ret = Regex.IsMatch(model.Region, value);
             break;
         case "SHIPTYPE":
             ret = Regex.IsMatch(model.ShipType, value);
             break;
         default:
             break;
     }
     return ret;
 }
Example #7
0
 public IList<string> GetModelMBCode(Model model)
 {
     string mbCode = null;
     IList<string> ret = new List<string>();
     if (model != null)
     {
         mbCode = model.GetAttribute(MBCodeAttributeName);
     }
     if (!string.IsNullOrEmpty(mbCode))
     {
         ret.Add(mbCode);
     }
     for (int i = 1; i < 4; i++)
     {
         mbCode = model.GetAttribute(string.Format("{0}{1}", MBCodeAttributeName, i));
         if (!string.IsNullOrEmpty(mbCode))
         {
             ret.Add(mbCode);
         }
     }
     return ret;
 }
Example #8
0
        private Model convertToModelObjFromModelMaintainInfo(ModelMaintainInfo temp)
        {
            Model model = new Model();

            model.ModelName = temp.Model;
            model.CustPN = temp.CustPN;
            model.Region = temp.Region;
            model.ShipType = temp.ShipType;
            model.Status = temp.Status;
            model.OSCode = temp.OsCode;
            model.OSDesc = temp.OSDesc;
            model.Price = temp.Price;
            model.BOMApproveDate = temp.BomApproveDate;
            model.Editor = temp.Editor;
            model.Cdt = temp.Cdt;
            model.Udt = temp.Udt;
            model.FamilyName = temp.Family;

            return model;
        }