示例#1
0
        private string getFileName(CArticleCommitData acData)
        {
            string dtString = System.DateTime.Now.ToString();

            dtString = dtString.Replace("-", "");
            dtString = dtString.Replace(":", "");
            dtString = dtString.Replace(".", "");
            dtString = dtString.Replace(" ", "");
            string fileName    = acData.orderNumber + "_" + dtString + extens;
            string fileNameTry = fileName;
            int    version     = 0;

            while (File.Exists(fileNameTry + ".txt"))
            {
                version++;
                fileName   += version.ToString();
                fileNameTry = fileName;
            }
            return(fileNameTry + ".txt");
        }
示例#2
0
        private ErrorCL checkOutIfNeeded(string ident, ReservdelCL res)
        {
            ErrorCL err = new ErrorCL();

            err.ErrCode    = 0;
            err.ErrMessage = "";
            Decimal onOrder    = 0;
            Decimal outChecked = 0;

            if (isDotArticle(res.Artnr))
            {
                return(err);
            }
            string errStr   = "";
            int    kategori = getArtKat(res.Artnr, ref errStr);

            if (kategori != 1)
            {
                return(err);
            }
            if (errStr == "")
            {
                onOrder = countArtOnOrder(res, ref errStr);
            }
            if (errStr == "")
            {
                outChecked = countOutchecked(res, ref errStr);
            }
            if (errStr != "")
            {
                err.ErrMessage = errStr;
                if (err.ErrMessage != "")
                {
                    err.ErrCode = 13101;
                }
                return(err);
            }
            if (onOrder > outChecked)
            {
                OrderArtCL oaCL = checkoutOrderArt(ident, res, onOrder - outChecked);
                if (oaCL.ErrCode != 0)
                {
                    err.ErrMessage = oaCL.ErrMessage;
                    err.ErrCode    = oaCL.ErrCode;
                    return(err);
                }


                // Added 2018-08-27. Reservdel shall now be confirmed in Pyramid
                if (!res.getFromCS)
                {
                    List <ArticleCommit.CArticleCommitData> acList = new List <ArticleCommit.CArticleCommitData>();
                    ArticleCommit.CArticleCommitData        ac     = new ArticleCommit.CArticleCommitData();
                    ac.articleNumber = res.Artnr;
                    ac.orderNumber   = res.VartOrdernr;
                    ac.quantity      = onOrder - outChecked;
                    ac.orderArtID    = oaCL.OrderArtId;
                    acList.Add(ac);
                    ArticleCommit.CArticleCommit acCommit = new ArticleCommit.CArticleCommit();
                    err = acCommit.generateFile(acList, "1");
                    //ac.sav
                }

                // Removed 2018-08-27 and replaced by the code above.

                //if (!res.getFromCS)
                //{
                //    CompactStore.updateOAStorageData data = new CompactStore.updateOAStorageData();
                //    data.orderArtId = oaCL.OrderArtId;
                //    //data.stockToSend = Convert.ToInt32(oaCL.OrdAntal);
                //    data.stockToSend = res.Antal;
                //    data.error = "";
                //    CompactStore.CCompactStore cs = new CompactStore.CCompactStore();
                //    string result = cs.updateDbWithoutSend(data, "x");
                //}
            }
            return(err);
        }