2026年6月8日 星期一

V1060305A – 結案 – 流水號.前面補 ‘0’ – GET_NEXT_SERNO - String.PadLeft(5, '0')

 目的:V1060305A – 結案 流水號 前面補 ‘0’ – GET_NEXT_SERNO  

處理說明: 1> 流水號 5 碼 - 前面補 '0'
                        Tmp_NEXT_SERNO_Str = Tmp_NEXT_SERNO.ToString().PadLeft(5, '0'); 



1>*.cs
//取得  AMM_CHKCHG_ASN_BAK.MAX(BAK_SERNO)   最大值+1
public string GET_NEXT_SERNO(string par_PROJID,string par_TYPE,string par_ITEM,string par_ASN)
        {
            string Tmp_Sql;
            string Tmp_MAX_SERNO_STR;
            Int32 Tmp_MAX_SERNO, Tmp_NEXT_SERNO;
            string Tmp_NEXT_SERNO_Str;
            Tmp_Sql = " SELECT   MAX(CAST(BAK_SERNO as integer ))  "
                            + "  FROM    AMM_CHKCHG_ASN_BAK   "
                            +"   WHERE  PROJID="+myfunc.AA(par_PROJID)
                            +"   AND        TYPE=" + myfunc.AA(par_TYPE)
                            +"   AND        ITEM= " + myfunc.AA(par_ITEM)
                            + "   AND        ASN=" + myfunc.AA(par_ASN)
                            ;
            Tmp_MAX_SERNO_STR = myfunc.SqlValue(Tmp_Sql);
            Tmp_MAX_SERNO = myfunc.str2int(Tmp_MAX_SERNO_STR);
            if (myfunc.checkisnull(Tmp_MAX_SERNO.ToString()))
            {
                Tmp_NEXT_SERNO = 1;
            }
            else
            {
                Tmp_NEXT_SERNO = Tmp_MAX_SERNO + 1;
            };
            Tmp_NEXT_SERNO_Str = Tmp_NEXT_SERNO.ToString().PadLeft(5, '0'); ;
            return Tmp_NEXT_SERNO_Str;
        }  // end of  GET_NEXT_SERNO

沒有留言:

張貼留言