コード例 #1
0
        //public ActivityExecutionStatus DoExecuteO()
        //{
        //    return DoExecute(null);
        //}

        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            SNTemplateManager snTemplatesManager = SNTemplateManager.GetInstance();

            //this.AddTemplatesOfAType("VirtualCarton", new IConverter[] {    new YearConverterNormal(2,'0',Session.SessionKeys.presentTime),
            //                                                                new MonthConverter(2,'0',Session.SessionKeys.presentTime),
            //                                                                new DayConverterNormal(2,'0',Session.SessionKeys.presentTime),
            //                                                                new SequenceConverterNormal("0123456789",4,"9999","0000",'0')
            //                                                                });

            InitTemplates(executionContext, GetClass(), "GEN_" + GetClass(), GetClass());

            IConverter[] cvts = null;

            string TypeOfSNRule = GetClass();//(string)CurrentSession.GetValue(Session.SessionKeys.TypeOfSNRule);

            SNComposer resSnC = new SNComposer();

            try
            {
                cvts = snTemplatesManager.Gets(GetKey(TypeOfSNRule));
                if (cvts != null && cvts.Length < 1)
                    throw new KeyNotFoundException();
            }
            catch (KeyNotFoundException)
            {
                List<string> param = new List<string>();
                param.Add(GetClass());
                param.Add(TypeOfSNRule);
                throw new FisException("GEN023", param);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            DateTime dt = DateTime.Now;
            CurrentSession.AddValue(Session.SessionKeys.presentTime, dt);

            ISequenceConverter seqCvt = null;

            foreach (IConverter cvt in cvts)
            {
                if (cvt is ISequenceConverter)
                {
                    resSnC.Add(new NumberElement(cvt, "{0}"));
                    seqCvt = (ISequenceConverter)cvt;
                }
                else
                    resSnC.Add(new NumberElement(cvt, CurrentSession));
            }

            string preSeqStr = resSnC.Calculate();

            int qty = 1;//(int)CurrentSession.GetValue(Session.SessionKeys.Qty);

            SequencialNumberRanges snrs = getSequence(CurrentSession, preSeqStr, qty, false, seqCvt);

            CurrentSession.AddValue(Session.SessionKeys.SerialNumbersGenerated, snrs);

            CurrentSession.AddValue(Session.SessionKeys.VirtualCartonNoList, this.GetAllNumbersInRange(snrs, seqCvt, qty, preSeqStr));

            return base.DoExecute(executionContext);//default(ActivityExecutionStatus);
        }
コード例 #2
0
        /// <summary>
        /// </summary>		
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            SNTemplateManager snTemplatesManager = SNTemplateManager.GetInstance();

            string cityType = (string)CurrentSession.GetValue("CityType");
            if (string.IsNullOrEmpty(cityType))
            {
                List<string> param = new List<string>();
                param.Add("Input City Code!");
                throw new FisException("GEN023", param);
            }
            else if(cityType == "sh")
            {
                this.AddTemplatesOfAType("ProdId", new IConverter[] { new LineConverter(1,'0',Session.SessionKeys.LineCode),
                                                                  new YearConverterNormal(1,'0',Session.SessionKeys.presentTime),
                                                                  new MonthConverterOneBitCode(Session.SessionKeys.presentTime),                                                                  
                                                                  new SequenceConverterNormal("0123456789",6,"499999","000000",'0')
                                                                });
            }
            else if (cityType == "cq")
            {
                //Vincent2012-12-04 set min number 700000
                //Vincent 2014-06-09 recovery number
                this.AddTemplatesOfAType("ProdId", new IConverter[] { new LineConverter(1,'0',Session.SessionKeys.LineCode),
                                                                  new YearConverterNormal(1,'0',Session.SessionKeys.presentTime),
                                                                  new MonthConverterOneBitCode(Session.SessionKeys.presentTime),                                                                  
                                                                  new SequenceConverterNormal("0123456789",6,"999999","500000",'0')
                                                                });
            }
            else
            {
                List<string> param = new List<string>();
                param.Add("City Code Invaild!");                
                throw new FisException("GEN023", param);
            }
            
            //InitTemplates(executionContext, GetClass(), "GEN_" + GetClass(), GetClass());

            IConverter[] cvts = null;

            string TypeOfSNRule = GetClass();//(string)CurrentSession.GetValue(Session.SessionKeys.TypeOfSNRule);

            SNComposer resSnC = new SNComposer();

            try
            {
                cvts = snTemplatesManager.Gets(GetKey(TypeOfSNRule));
                if (cvts != null && cvts.Length < 1)
                    throw new KeyNotFoundException();
            }
            catch (KeyNotFoundException)
            {
                List<string> param = new List<string>();
                param.Add(GetClass());
                param.Add(TypeOfSNRule);
                throw new FisException("GEN023", param);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            CurrentSession.AddValue(Session.SessionKeys.LineCode, Line);

            DateTime dt = DateTime.Now;
            bool isNextMonth = (bool)CurrentSession.GetValue(Session.SessionKeys.IsNextMonth);
            CurrentSession.AddValue(Session.SessionKeys.presentTime, isNextMonth ? dt.AddMonths(1) : dt);

            ISequenceConverter seqCvt = null;

            foreach (IConverter cvt in cvts)
            {
                if (cvt is ISequenceConverter)
                {
                    resSnC.Add(new NumberElement(cvt, "{0}"));
                    seqCvt = (ISequenceConverter)cvt;
                }
                else
                    resSnC.Add(new NumberElement(cvt, CurrentSession));
            }

            string preSeqStr = resSnC.Calculate();
            //preSeqStr = preSeqStr;

            int qty = (int)CurrentSession.GetValue(Session.SessionKeys.Qty);

            SequencialNumberRanges snrs = getSequence(CurrentSession, preSeqStr, qty, false, seqCvt);

            CurrentSession.AddValue(Session.SessionKeys.SerialNumbersGenerated, snrs);

            CurrentSession.AddValue(Session.SessionKeys.ProdNoList, this.GetAllNumbersInRange(snrs, seqCvt, qty, preSeqStr));

            return base.DoExecute(executionContext);
        }
コード例 #3
0
ファイル: AcquireMBSnSection.cs プロジェクト: wra222/testgit
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {

            SNTemplateManager snTemplatesManager = SNTemplateManager.GetInstance();

            //this.AddTemplatesOfAType("MBSn", new IConverter[] { new MBCodeConverter(2,'0',Session.SessionKeys.MBCode),
            //                                                    new YearConverterNormal(1,'0',Session.SessionKeys.presentTime),
            //                                                    new MonthConverterOneBitCode(Session.SessionKeys.presentTime),
            //                                                    new BoardTypeConverter(1,'0',Session.SessionKeys.MBType),
            //                                                    new MotherOrKidBoard(1,'0',Session.SessionKeys.motherOrChild),
            //                                                    new SequenceConverterNormal("0123456789ABCDEFGHJKLMNPRSTVWXYZ",4,"ZZZZ","0000",'0')}
            //                                                    );

            InitTemplates(executionContext, GetClass(), "GEN_" + GetClass(), GetClass());

            IConverter[] cvts = null;

            string TypeOfSNRule = GetClass();//(string)CurrentSession.GetValue(Session.SessionKeys.TypeOfSNRule);

            SNComposer resSnC = new SNComposer();

            try
            {
                cvts = snTemplatesManager.Gets(GetKey(TypeOfSNRule));
                if (cvts != null && cvts.Length < 1)
                    throw new KeyNotFoundException();
            }
            catch (KeyNotFoundException)
            {
                List<string> param = new List<string>();
                param.Add(GetClass());
                param.Add(TypeOfSNRule);
                throw new FisException("GEN023", param);
            }
            catch (Exception ex) 
            {
                throw ex;
            }

            DateTime dt = DateTime.Now;
            bool isNextMonth = (bool)CurrentSession.GetValue(Session.SessionKeys.IsNextMonth);// 2010-01-07 Liu Dong(eB1-4)         Modify ITC-1103-0062
            CurrentSession.AddValue(Session.SessionKeys.presentTime, isNextMonth ? dt.AddMonths(1) : dt);

            ISequenceConverter seqCvt = null;

            foreach (IConverter cvt in cvts)
            {
                if (cvt is ISequenceConverter)
                {
                    resSnC.Add(new NumberElement(cvt, "{0}"));
                    seqCvt = (ISequenceConverter)cvt;
                }
                else
                    resSnC.Add(new NumberElement(cvt, CurrentSession));
            }

            string preSeqStr = resSnC.Calculate();

            int qty = (int)CurrentSession.GetValue(Session.SessionKeys.Qty);

            SequencialNumberRanges snrs = getSequence(CurrentSession, preSeqStr, qty, false, seqCvt);

            CurrentSession.AddValue(Session.SessionKeys.SerialNumbersGenerated, snrs);

            CurrentSession.AddValue(Session.SessionKeys.MBNOList, this.GetAllNumbersInRange(snrs, seqCvt, qty, preSeqStr));// 2010-01-07 Liu Dong(eB1-4)         Modify ITC-1103-0058

            return base.DoExecute(executionContext);//default(ActivityExecutionStatus);
        }
コード例 #4
0
ファイル: AcquireSMTMOSection.cs プロジェクト: wra222/testgit
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {

            SNTemplateManager snTemplatesManager = SNTemplateManager.GetInstance();

            //this.AddTemplatesOfAType("SMTMO", new IConverter[] { new ManufactoryModeConverter(1,'0',Session.SessionKeys.IsExperiment), 
            //                                                     new YearConverterNormal(2,'0',Session.SessionKeys.presentTime),
            //                                                     new MonthConverterOneBitCode(Session.SessionKeys.presentTime),
            //                                                     new DayConverterNormal(2,'0',Session.SessionKeys.presentTime),
            //                                                     new SequenceConverterNormal("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",2,"ZZ","00",'0') }
            //                                                     );

            InitTemplates(executionContext, GetClass(), "GEN_" + GetClass(), GetClass());

            IConverter[] cvts = null;

            string TypeOfSNRule = GetClass();// (string)CurrentSession.GetValue(Session.SessionKeys.TypeOfSNRule);

            SNComposer resSnC = new SNComposer();

            try
            {
                cvts = snTemplatesManager.Gets(GetKey(TypeOfSNRule));
                if (cvts != null && cvts.Length < 1)
                    throw new KeyNotFoundException();
            }
            catch (KeyNotFoundException)
            {
                List<string> param = new List<string>();
                param.Add(GetClass());
                param.Add(TypeOfSNRule);
                throw new FisException("GEN023", param);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            CurrentSession.AddValue(Session.SessionKeys.presentTime, DateTime.Now);

            ISequenceConverter seqCvt = null;

            foreach (IConverter cvt in cvts)
            {
                if (cvt is ISequenceConverter)
                {
                    resSnC.Add(new NumberElement(cvt, "{0}"));
                    seqCvt = (ISequenceConverter)cvt;
                }
                else
                    resSnC.Add(new NumberElement(cvt, CurrentSession));
            }

            string preSeqStr = resSnC.Calculate();

            // 2010-01-07 Liu Dong(eB1-4)         Modify ITC-1103-0048
            //SequencialNumberRanges snrs = getSequence(CurrentSession, preSeqStr, (int)CurrentSession.GetValue(Session.SessionKeys.Qty), false, seqCvt);
            SequencialNumberRanges snrs = getSequence(CurrentSession, preSeqStr, 1, false, seqCvt);
            // 2010-01-07 Liu Dong(eB1-4)         Modify ITC-1103-0048

            CurrentSession.AddValue(Session.SessionKeys.SerialNumbersGenerated, snrs);

            CurrentSession.AddValue(Session.SessionKeys.MBMONO, snrs.Ranges[0].NumberBegin);

            return base.DoExecute(executionContext);//default(ActivityExecutionStatus);
         }
コード例 #5
0
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {

       
            if (CurrentSession.GetValue(Session.SessionKeys.ModelObj) == null)
            { GetModelObjectByProduct(); }
            Model modelObj = null;
        
            modelObj = (Model)CurrentSession.GetValue(Session.SessionKeys.ModelObj);
            bool IsPilotRun = false;
            string strIsTestBuild = modelObj.GetAttribute("IsTestBuild");
            if (!string.IsNullOrEmpty(strIsTestBuild) && strIsTestBuild.Trim() == "Y")
            {
                IsPilotRun = true;
            }
            
            string stStartCustSnNo ="000001";
            string strEndCustSnNo = "999999";

            string strCfg = modelObj.GetAttribute("CfgCode");
            if (string.IsNullOrEmpty(strCfg))
            {
                List<string> param = new List<string>();
                param.Add(modelObj.ModelName);
                throw new FisException("GEN044", param); 

            } 
           //  if (CheckRange) //SN需要 by  Model 定義Range -- marked at 2011/0909
           if(IsPilotRun) // Midify at 2011/09/09
            {
                 stStartCustSnNo = modelObj.GetAttribute("StartUnitID");
                 strEndCustSnNo = modelObj.GetAttribute("EndUnitID");
                 if (string.IsNullOrEmpty(stStartCustSnNo) | string.IsNullOrEmpty(strEndCustSnNo))
                 {
                     List<string> param = new List<string>();
                     param.Add(modelObj.ModelName);
                     throw new FisException("GEN045", param);
                 }
            }

            CurrentSession.AddValue(ExtendSession.SessionKeys.PlantCode, "20");
            CurrentSession.AddValue(ExtendSession.SessionKeys.CfgCode, strCfg);
            CurrentSession.AddValue(Session.SessionKeys.presentTime, DateTime.Now);
        

            IConverter[] cvts = null;
            SNComposer resSnC = new SNComposer();
            
             
         
            if (IsPilotRun)
            {
                CurrentSession.AddValue(ExtendSession.SessionKeys.TestBuild, "TestBuild");
                cvts = new IConverter[]
                     { 
                     new CommonConverter(9,'0',ExtendSession.SessionKeys.TestBuild), 
                     new SequenceConverterNormal("0123456789",6,strEndCustSnNo,stStartCustSnNo,'0') ,
                   //   new ProductionSiteConverter  (3,'0',ExtendSession.SessionKeys.CfgCode)
                   };
           }
            else
            {
                 cvts = new IConverter[]
                     { 
                      new ProductionSiteConverter(2,'0',ExtendSession.SessionKeys.PlantCode), 
                      new YearConverterNormal(1,'0',Session.SessionKeys.presentTime),
                      new WeekConverter(2,'0',Session.SessionKeys.presentTime,DayOfWeek.Monday),
                      new DayOfWeekConverter(Session.SessionKeys.presentTime),
                      new SequenceConverterNormal("0123456789",6,strEndCustSnNo,stStartCustSnNo,'0') ,
                      new ProductionSiteConverter  (3,'0',ExtendSession.SessionKeys.CfgCode)
                   };
            
            }
          
       
        
            ISequenceConverter seqCvt = null;

         
            foreach (IConverter cvt in cvts)
            { 
                if (cvt is ISequenceConverter)
                {
                    resSnC.Add(new NumberElement(cvt, "{0}"));
                    seqCvt = (ISequenceConverter)cvt;
                }
                else
                    resSnC.Add(new NumberElement(cvt, CurrentSession));
            }
            
            string preSeqStr = "";
            if (IsPilotRun) // -- Modify this area at 2011/09/09
            {
                preSeqStr = strCfg + "-" + resSnC.Calculate(); //save "200-xxxxxxxxxxxxx"  in NumControl 

            }
            else
            {
               preSeqStr=  resSnC.Calculate();
            }
           
            //if (CheckRange) -- Marked this area at 2011/09/09
            //{
            //    preSeqStr=modelObj.ModelName + "-" + resSnC.Calculate();
           
            //}
            //else
            //{
            //   preSeqStr=  resSnC.Calculate();
            
            //}
      

            SequencialNumberRanges snrs = getSequence(CurrentSession, preSeqStr, 1, false, seqCvt);
            string[] strTempNo = null;
            string strCUSTSN = null;
            string strTemp = "";
            string strPrifix = CurrentSession.GetValue(ExtendSession.SessionKeys.PlantCode) + DateTime.Now.Year.ToString().Substring(3, 1)
                                     + GetWeek() + GetDayOfWeek();
           //******************* Add this area at 2011/0909 ***********************
            if (IsPilotRun)
            {
                strTempNo = snrs.Ranges[0].NumberBegin.Split('-');
                strTemp = strTempNo[1].Replace("TestBuild", strPrifix);
                strTemp = strTemp + CurrentSession.GetValue(ExtendSession.SessionKeys.CfgCode);
                strCUSTSN = strTemp + CalculateCheckSum(strTemp);

            }
            else
            {
                strCUSTSN = snrs.Ranges[0].NumberBegin + CalculateCheckSum(snrs.Ranges[0].NumberBegin);
            
            }
            //******************* Add this area at 2011/0909 ***********************
            
            
            
           /*********** Marked this Area at 2011/09/09
            if (CheckRange)
            {
                 strTempNo = snrs.Ranges[0].NumberBegin.Split('-');
                if (IsPilotRun)
                {
                    strTemp = strTempNo[1].Replace("TestBuild", strPrifix);
                    strTemp = strTemp + CurrentSession.GetValue(ExtendSession.SessionKeys.CfgCode);
                     strCUSTSN = strTemp + CalculateCheckSum(strTemp); 
                }
                else
                {
                    
                    strCUSTSN = strTempNo[1] + CalculateCheckSum(strTempNo[1]); //strTempNo[0]: Model Name ; strTempNo[0] : SN
                }

               
            }
            else
            {
                if (IsPilotRun)
                {

                      strTemp = snrs.Ranges[0].NumberBegin.Replace("TestBuild", strPrifix);
                      strTemp = strTemp + CurrentSession.GetValue(ExtendSession.SessionKeys.CfgCode);
                      strCUSTSN = strTemp + CalculateCheckSum(strTemp);
                }
                else
                {
                         strCUSTSN= snrs.Ranges[0].NumberBegin + CalculateCheckSum(snrs.Ranges[0].NumberBegin);
                 }
          
            } */ //*******************************Marked this Area at 2011/09/09
            if (CheckIsExistingSN(strCUSTSN)>0)
            {
                List<string> param = new List<string>();
                param.Add(strCUSTSN);
                throw new FisException("GEN046", param);
            }
            CurrentSession.AddValue(Session.SessionKeys.CustSN, strCUSTSN);
            return base.DoExecute(executionContext);//default(ActivityExecutionStatus);
         }
コード例 #6
0
        private string GetNumString()
        {
            IConverter[] cvts = null;
            SNComposer resSnC = new SNComposer();

            cvts = new IConverter[]
                     { 
                      new ProductionSiteConverter(2,'0',ExtendSession.SessionKeys.PlantCode), 
                      new YearConverterNormal(1,'0',Session.SessionKeys.presentTime),
                      new WeekConverter(2,'0',Session.SessionKeys.presentTime,DayOfWeek.Monday),
                      new DayOfWeekConverter(Session.SessionKeys.presentTime),
                     };
            foreach (IConverter cvt in cvts)
            {
              resSnC.Add(new NumberElement(cvt, CurrentSession));
            }
            string r=resSnC.Calculate();
            return r;
        }
コード例 #7
0
ファイル: AcquireCTSection.cs プロジェクト: wra222/testgit
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            SNTemplateManager snTemplatesManager = SNTemplateManager.GetInstance();

            //this.AddTemplatesOfAType("CT", new IConverter[] { new AssemblyCodeConverter(6,'0',Session.SessionKeys.AssemblyCode),
            //                                                  new DateCodeConverter(1,'0', Session.SessionKeys.DateCode),
            //                                                  new CustomerCodeConverter(1,'0',Session.SessionKeys.CustomerCode),
            //                                                  new YearConverterNormal(1,'0',Session.SessionKeys.presentTime),
            //                                                  new MonthConverterOneBitCode(Session.SessionKeys.presentTime),
            //                                                  new SequenceConverterNormal("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",4,"ZZZZ","0000",'0')
            //                                                });

            InitTemplates(executionContext, GetClass(), "GEN_" + GetClass(), GetClass());

            IConverter[] cvts = null;

            string TypeOfSNRule = GetClass();

            SNComposer resSnC = new SNComposer();

            try
            {
                cvts = snTemplatesManager.Gets(GetKey(TypeOfSNRule));
                if (cvts != null && cvts.Length < 1)
                    throw new KeyNotFoundException();
            }
            catch (KeyNotFoundException)
            {
                List<string> param = new List<string>();
                param.Add(GetClass());
                param.Add(TypeOfSNRule);
                throw new FisException("GEN023", param);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            CurrentSession.AddValue(Session.SessionKeys.presentTime, DateTime.Now);

            IMiscRepository miscRpst = RepositoryFactory.GetInstance().GetRepository<IMiscRepository>();
            CustomerInfo custi = miscRpst.GetCustomerInfo(this.Customer);
            //????此处需要判断有无的异常信息.
            CurrentSession.AddValue(Session.SessionKeys.CustomerCode, custi.Code);//"8");

            ISequenceConverter seqCvt = null;

            foreach (IConverter cvt in cvts)
            {
                if (cvt is ISequenceConverter)
                {
                    resSnC.Add(new NumberElement(cvt, "{0}"));
                    seqCvt = (ISequenceConverter)cvt;
                }
                else
                    resSnC.Add(new NumberElement(cvt, CurrentSession));
            }

            string preSeqStr = resSnC.Calculate();

            int qty = (int)CurrentSession.GetValue(Session.SessionKeys.Qty);

            SequencialNumberRanges snrs = getSequence(CurrentSession, preSeqStr, qty, false, seqCvt);

            CurrentSession.AddValue(Session.SessionKeys.SerialNumbersGenerated, snrs);

            CurrentSession.AddValue(Session.SessionKeys.CTList, this.GetAllNumbersInRange(snrs, seqCvt, qty, preSeqStr));

            return base.DoExecute(executionContext);//default(ActivityExecutionStatus);
        }