Exemple #1
0
        public void UpdateStockLotNo()
        {
            GENumberingsController objNumberingsController = new GENumberingsController();
            GENumberingsInfo       objNumberingsInfo       = (GENumberingsInfo)objNumberingsController.GetObjectByName("ProductLotNo");

            if (objNumberingsInfo == null)
            {
                return;
            }

            objNumberingsInfo.GENumberingNumber++;
            objNumberingsController.UpdateObject(objNumberingsInfo);
        }
Exemple #2
0
        public string GetStockLotNo()
        {
            GENumberingsController objNumberingsController = new GENumberingsController();
            GENumberingsInfo       objNumberingsInfo       = (GENumberingsInfo)objNumberingsController.GetObjectByName("ProductLotNo");

            if (objNumberingsInfo == null)
            {
                return(string.Empty);
            }

            return(string.Format("{0}{1}{2}", objNumberingsInfo.GENumberingPrefix
                                 , objNumberingsInfo.GENumberingPrefixHaveYear ? DateTime.Now.Year.ToString("YY") + "." : string.Empty
                                 , objNumberingsInfo.GENumberingNumber.ToString().PadLeft(objNumberingsInfo.GENumberingLength, '0')));
        }
Exemple #3
0
        public virtual String GetMainObjectNo(ref int numberingStart)
        {
            String strMainObjectNo = String.Empty;
            GENumberingsController objGENumberingController = new GENumberingsController();
            GENumberingsInfo       objGENumberingInfo       = (GENumberingsInfo)objGENumberingController.GetObjectByName(Module.CurrentModuleName);

            if (objGENumberingInfo != null)
            {
                String mainTableName = VinaUtil.GetTableNameFromBusinessObject(MainObject);
                BaseBusinessController objMainObjectController = BusinessControllerFactory.GetBusinessController(mainTableName + "Controller");
                if (objMainObjectController != null)
                {
                    VinaDbUtil    dbUtil              = new VinaDbUtil();
                    string        strPrefixHaveYear   = DateTime.Now.Year.ToString().Substring(2, 2);
                    List <string> subMainObjectNoList = new List <string>();
                    subMainObjectNoList.Add(objGENumberingInfo.GENumberingPrefix);
                    if (objGENumberingInfo.GENumberingPrefixHaveYear)
                    {
                        subMainObjectNoList.Add(strPrefixHaveYear);
                    }
                    subMainObjectNoList.Add(objGENumberingInfo.GENumberingNumber.ToString().PadLeft(objGENumberingInfo.GENumberingLength, '0'));

                    strMainObjectNo = string.Join(".", subMainObjectNoList.ToArray());

                    numberingStart = objGENumberingInfo.GENumberingNumber;
                    while (objMainObjectController.IsExist(strMainObjectNo))
                    {
                        objGENumberingInfo.GENumberingNumber++;

                        subMainObjectNoList.Clear();
                        subMainObjectNoList.Add(objGENumberingInfo.GENumberingPrefix);
                        if (objGENumberingInfo.GENumberingPrefixHaveYear)
                        {
                            subMainObjectNoList.Add(strPrefixHaveYear);
                        }
                        subMainObjectNoList.Add(objGENumberingInfo.GENumberingNumber.ToString().PadLeft(objGENumberingInfo.GENumberingLength, '0'));

                        strMainObjectNo = string.Join(".", subMainObjectNoList.ToArray());
                        numberingStart  = objGENumberingInfo.GENumberingNumber;
                    }
                }
            }
            return(strMainObjectNo);
        }