Ejemplo n.º 1
0
        public C_SEQNO GetDataObject()
        {
            C_SEQNO DataObject = new C_SEQNO();

            DataObject.SEQ_NAME  = this.SEQ_NAME;
            DataObject.SEQ_NO    = this.SEQ_NO;
            DataObject.DIGITS    = this.DIGITS;
            DataObject.BASE_CODE = this.BASE_CODE;
            DataObject.MINIMUM   = this.MINIMUM;
            DataObject.MAXIMUM   = this.MAXIMUM;
            DataObject.PREFIX    = this.PREFIX;
            DataObject.FIXED     = this.FIXED;
            DataObject.SEQ_FORM  = this.SEQ_FORM;
            DataObject.RESET     = this.RESET;
            DataObject.USE_TIME  = this.USE_TIME;
            DataObject.EDIT_EMP  = this.EDIT_EMP;
            DataObject.EDIT_TIME = this.EDIT_TIME;
            DataObject.ID        = this.ID;
            return(DataObject);
        }
Ejemplo n.º 2
0
        public string GetLotno(string SeqName, OleExec DB)
        {
            string   StrLot    = "";
            string   Result    = "";
            string   DateCode  = "";
            string   WeekNo    = "";
            double   NextSeqno = 0;
            Int16    Digits    = 0;
            double   Minimum   = 0;
            double   Maxmum    = 0;
            string   Prefix    = "";
            string   Fixedstr  = "";
            string   SeqForm   = "";
            string   Reset     = "";
            DateTime UseTime   = new DateTime();

            T_C_SEQNO T_C_Seqno = new T_C_SEQNO(DB, DB_TYPE_ENUM.Oracle);

            C_SEQNO C_SEQNO = T_C_Seqno.GetSeqnoObj(SeqName, DB);

            NextSeqno = Int64.Parse(C_SEQNO.SEQ_NO.ToString());
            Digits    = (Int16)C_SEQNO.DIGITS;
            Minimum   = Int64.Parse(C_SEQNO.MINIMUM.ToString());
            Maxmum    = Int64.Parse(C_SEQNO.MAXIMUM.ToString());
            Prefix    = C_SEQNO.PREFIX;
            Fixedstr  = C_SEQNO.FIXED;
            SeqForm   = C_SEQNO.SEQ_FORM;
            Reset     = C_SEQNO.RESET;
            UseTime   = (DateTime)C_SEQNO.USE_TIME;

            Result = NextSeqno.ToString();//默认为取下一个值

            //edit by lc 20180330
            if (NextSeqno == Maxmum)
            {
                Result = Minimum.ToString();
            }
            if (!string.IsNullOrEmpty(SeqForm))
            {
                if ("YYYYMMDD".Equals(SeqForm) && "1".Equals(Reset) && GetFormatDate(DB, UseTime, "YYYYMMDD") != GetFormatSYSDate(DB, System.DateTime.Now, "YYYYMMDD"))
                {
                    Result = Minimum.ToString();
                }
                else if ("YYMMDD".Equals(SeqForm) && "1".Equals(Reset) && GetFormatDate(DB, UseTime, "YYMMDD") != GetFormatSYSDate(DB, System.DateTime.Now, "YYMMDD"))
                {
                    Result = Minimum.ToString();
                }
                else if ("YY-WK".Equals(SeqForm) && "1".Equals(Reset) && GetFormatDate(DB, UseTime, "YY-IW") != GetFormatSYSDate(DB, System.DateTime.Now, "YY-IW"))
                {
                    Result = Minimum.ToString();
                }
                else if ("YY-MM".Equals(SeqForm) && "1".Equals(Reset))
                {
                    Result = Minimum.ToString();
                }
                //else if (NextSeqno == Maxmum)
                //{
                //    Result = Minimum.ToString();
                //}

                if ((SeqForm).IndexOf("YYYY") != -1)
                {
                    DateCode = DateCode + GetFormatSYSDate(DB, System.DateTime.Now, "YYYY");
                }
                else if ((SeqForm).IndexOf("YY") != -1)
                {
                    DateCode = DateCode + GetFormatSYSDate(DB, System.DateTime.Now, "YY");
                }
                else if ((SeqForm).IndexOf("Y") != -1)
                {
                    DateCode = DateCode + GetFormatSYSDate(DB, System.DateTime.Now, "Y");
                }

                if ((SeqForm).IndexOf("MM") != -1)
                {
                    DateCode = DateCode + GetFormatSYSDate(DB, System.DateTime.Now, "MM");
                }
                else if ((SeqForm).IndexOf("M") != -1)
                {
                    DateCode = DateCode + GetFormatSYSDate(DB, System.DateTime.Now, "M");
                }

                if ((SeqForm).IndexOf("WK") != -1)
                {
                    DateCode = DateCode + GetFormatSYSDate(DB, System.DateTime.Now, "IW");
                }

                if ((SeqForm).IndexOf("DD") != -1)
                {
                    DateCode = DateCode + GetFormatSYSDate(DB, System.DateTime.Now, "DD");
                }


                //if ("YYYY".IndexOf(SeqForm) != -1)
                //{
                //    DateCode = DateCode + GetFormatSYSDate(DB, System.DateTime.Now, "YYYY");
                //}
                //else if ("YY".IndexOf(SeqForm) != -1)
                //{
                //    DateCode = DateCode + GetFormatSYSDate(DB, System.DateTime.Now, "YY");
                //}
                //else if ("Y".IndexOf(SeqForm) != -1)
                //{
                //    DateCode = DateCode + GetFormatSYSDate(DB, System.DateTime.Now, "Y");
                //}

                //if ("MM".IndexOf(SeqForm) != -1)
                //{
                //    DateCode = DateCode + GetFormatSYSDate(DB, System.DateTime.Now, "MM");
                //}
                //else if ("M".IndexOf(SeqForm) != -1)
                //{
                //    DateCode = DateCode + GetFormatSYSDate(DB, System.DateTime.Now, "M");
                //}

                //if ("WK".IndexOf(SeqForm) != -1)
                //{
                //    DateCode = DateCode + GetFormatSYSDate(DB, System.DateTime.Now, "IW");
                //}

                //if ("DD".IndexOf(SeqForm) != -1)
                //{
                //    DateCode = DateCode + GetFormatSYSDate(DB, System.DateTime.Now, "DD");
                //}
            }


            T_C_Seqno.UpdateSeqno(SeqName, (int.Parse(Result) + 1).ToString(), DB);

            StrLot = Prefix + DateCode + Fixedstr + Result.ToString().PadLeft(Digits, '0');

            return(StrLot);
        }