Пример #1
0
        internal static string getDocNumber(DBSource dbsource, string RootProjectCode, string docType, string strSendCompany, string strRecCompany)
        {
            try
            {
                //string RootProjectCode = proj.GetValueByKeyWord("DESIGNPROJECT_CODE");

                //获取文档前缀
                string sendCompanyCode = strSendCompany.IndexOf("__") >= 0 ? strSendCompany.Substring(0, strSendCompany.IndexOf("__")) : strSendCompany;

                string recCompanyCode = strRecCompany.IndexOf("__") >= 0 ? strRecCompany.Substring(0, strRecCompany.IndexOf("__")) : strRecCompany;


                //编码前缀
                string strPrefix = "";
                if (!string.IsNullOrEmpty(RootProjectCode))
                {
                    //项目管理类
                    //strPrefix = RootProjectCode + "-" + sendCompanyCode + "-" + recCompanyCode + "-LET-" + "SLET";
                    strPrefix = RootProjectCode + "-" + sendCompanyCode + "-" + recCompanyCode + "-" + docType + "-";
                }
                else
                {
                    //运营管理类
                    //strPrefix = sendCompanyCode + "-" + recCompanyCode + "-LET-" + "SLET";
                    strPrefix = sendCompanyCode + "-" + recCompanyCode + "-" + docType + "-";
                }

                List <Doc> docList = dbsource.SelectDoc(string.Format(
                                                            "select * from CDMS_Doc where o_itemname like '%{0}[0-9]%' and o_dmsstatus !=10 order by o_itemname",
                                                            strPrefix));
                if (docList == null || docList.Count == 0)
                {
                    //return "SLET"+"00001"; "-" + docType + "-" + commType + docType;
                    return("001");
                }
                else
                {
                    Doc doc = docList[docList.Count - 1];

                    int tempNum = Convert.ToInt32(doc.O_itemname.Substring(strPrefix.Length, 3));
                    //3位数,不够位数补零
                    //return "SLET" + (tempNum + 1).ToString("d5");
                    return((tempNum + 1).ToString("d3"));
                }
            }
            catch
            {
                //return "SLET" + "00001";
                return("001");
            }
        }
Пример #2
0
        //获取文档最大编号
        private static string getDocTempNumber(DBSource dbsource, string RootProjectCode, string strSendCompany, string strRecCompany)
        {
            try
            {
                //string RootProjectCode = proj.GetValueByKeyWord("DESIGNPROJECT_CODE");

                //获取文档前缀
                string sendCompanyCode = strSendCompany.IndexOf("__") >= 0 ? strSendCompany.Substring(0, strSendCompany.IndexOf("__")) : strSendCompany;

                string recCompanyCode = strRecCompany.IndexOf("__") >= 0 ? strRecCompany.Substring(0, strRecCompany.IndexOf("__")) : strRecCompany;


                //编码前缀
                // string strPrefix = RootProjectCode + "-" + sendCompanyCode + "-" + recCompanyCode + "-TRA-"+ "STRA";
                string strPrefix = "";
                if (!string.IsNullOrEmpty(RootProjectCode))
                {
                    //项目管理类
                    strPrefix = RootProjectCode + "-" + sendCompanyCode + "-" + recCompanyCode + "-TRA-" + "STRA";
                }
                else
                {
                    //运营管理类
                    strPrefix = sendCompanyCode + "-" + recCompanyCode + "-TRA-" + "STRA";
                }

                List <Doc> docList = dbsource.SelectDoc(string.Format("select * from CDMS_Doc where o_itemname like '%{0}%' and o_dmsstatus !=10 order by o_itemname", strPrefix));
                if (docList == null || docList.Count == 0)
                {
                    return("STRA" + "00001");
                }
                else
                {
                    Doc doc = docList[docList.Count - 1];
                    //int docCodeLength = 0;
                    //docCodeLength = strPrefix.IndexOf("-LET-");
                    //docCodeLength = docCodeLength > 0 ? 0 : docCodeLength + 3 + 1;
                    //int tempNum = Convert.ToInt32(doc.O_itemname.Substring(docCodeLength, 3));

                    int tempNum = Convert.ToInt32(doc.O_itemname.Substring(strPrefix.Length, 5));
                    //3位数,不够位数补零
                    return((tempNum + 1).ToString("d5"));
                }
            }
            catch
            {
                return("00001");
            }
        }