コード例 #1
0
        static private void PrintSlip(string Slip)
        {
            if (iniFile.CreditCardSlipPrintPreCheck)
            {
                try
                {
                    // string[] stringSeparators = new string[] { "\n\r", "\n\n", Environment.NewLine};

                    string[] stringSeparators = new string[] { "\n" };

                    string sres = Slip.Replace("\r", "");

                    AlohaTSClass.PrintCardSlip(sres.Split(stringSeparators, StringSplitOptions.None).ToList());
                }
                catch (Exception e)
                {
                    Utils.ToCardLog("Ошибка печати слипа " + e.Message);
                }
            }
            else
            {
                Slip += Convert.ToChar(31);
                ToShtrih.PrintCardCheck(Slip);
            }
        }
コード例 #2
0
 static void MainClass2_OnReplenish(int Summ)
 {
     if (Summ > 0)
     {
         ToShtrih.CashIncome(Summ / 100);
     }
 }
コード例 #3
0
 internal static void PrintCurentPrecheckOnFR()
 {
     try
     {
         Utils.ToCardLog("PrintCurentPrecheckOnFR ");
         int    chId = (int)AlohaTSClass.GetCurentCheckId();
         string s    = AlohaTSClass.GetFRPredcheck(chId);
         ToShtrih.PrintCardCheck(s, false);
     }
     catch (Exception e)
     {
         Utils.ToCardLog("Error PrintCurentPrecheckOnFR " + e.Message);
     }
 }
コード例 #4
0
        static private void PrintSlip(string Slip)
        {
            if (iniFile.CreditCardSlipPrintPreCheck)
            {
                Utils.ToLog("PrintSlip CreditCardSlipPrintPreCheck ");
                try
                {
                    // string[] stringSeparators = new string[] { "\n\r", "\n\n", Environment.NewLine};

                    string[] stringSeparators = new string[] { "\n" };
                    string   sres             = Slip.Replace("\r", "");
                    Convert.ToChar(31);
                    List <string> LSlip  = sres.Split(stringSeparators, StringSplitOptions.None).ToList();
                    List <string> LSlip1 = new List <string>();
                    foreach (string str in LSlip)
                    {
                        if (str.Contains(Convert.ToChar(31)) && str.Length < 3)
                        {
                            Utils.ToLog("PrintSlip Split and send");
                            if (LSlip1.Count() > 0)
                            {
                                AlohaTSClass.PrintCardSlip(LSlip1);
                                LSlip1.Clear();
                            }
                        }
                        else
                        {
                            LSlip1.Add(str);
                        }
                    }
                    if (LSlip1.Count() > 0)
                    {
                        AlohaTSClass.PrintCardSlip(LSlip1);
                        LSlip1.Clear();
                    }


                    //AlohaTSClass.PrintCardSlip(sres.Split(stringSeparators, StringSplitOptions.None).ToList());
                }
                catch (Exception e)
                {
                    Utils.ToCardLog("Ошибка печати слипа " + e.Message);
                }
            }
            else
            {
                Slip += Convert.ToChar(31);
                ToShtrih.PrintCardCheck(Slip);
            }
        }
コード例 #5
0
 static void MainClass2_OnEndChange(int Change, FCCIntegration.FCCCheck Chk)
 {
     CCustomerDisplay.EndChange(Change);
     try
     {
         if (iniFile.FCCNoChangeCashIncome)
         {
             if (Change > 0)
             {
                 ToShtrih.CashIncome(Change / 100);
             }
         }
     }
     catch (Exception e)
     {
         Utils.ToLog("FCC.MainClass2_OnEndChange Error " + e.Message);
     }
 }
コード例 #6
0
        static internal bool CheckUnClosedChecks()
        {
            DirectoryInfo Di = new DirectoryInfo(ChecksPath);

            if (!Di.Exists)
            {
                Di.Create();
            }
            if (Di.GetFiles("*.1").Count() == 0)
            {
                return(true);
            }

            Utils.ToCardLog("CheckUnClosedChecks");
            frmAllertMessage Mf = new frmAllertMessage("Существуют незакрытые чеки. Будет произведена попытка закрытия чеков. После этого снова запустите отчет.");

            Mf.ShowDialog();


            if (!Shtrih2.QuereIsEmpty())
            {
                frmAllertMessage Mf2 = new frmAllertMessage("Очередь чеков содержит незакрытые чеки. Это говорит о неполадках ФР. Убедитесь в исправности ФР и перезапустите отчет.");
                Mf2.ShowDialog();
                return(false);
            }

            foreach (FileInfo fi in Di.GetFiles("*.1"))
            {
                Utils.ToCardLog("CheckUnClosedChecks " + fi.Name);
                try
                {
                    Check Ch = ReadCheckFromTmp(fi.FullName);
                    Ch.FiskalFileName = fi.FullName;
                    ToShtrih.CloseCheck2(Ch);
                }
                catch (Exception e)
                {
                    Utils.ToCardLog("[Error] CheckUnClosedChecks " + e.Message);
                }
            }
            return(false);
        }
コード例 #7
0
        static public void MainClass2_OnOutCasseta(int Summ, bool Casseta)
        {
            //ToShtrih.PrintOutKassetaReport(Summ, Casseta);

            if (iniFile.FCCZZRepCassetRemove)
            {
                if (Casseta)
                {
                    Utils.ToLog("CurentShtrihCash OutCasseta S");
                    decimal CurentShtrihCash = Shtrih2.GetCashReg(241);
                    Utils.ToLog("CurentShtrihCash OutCasseta E");
                    ToShtrih.ZReportWithCashIncome(CurentShtrihCash - Summ / 100);
                }
                else
                {
                    ToShtrih.CashOutCome(Summ / 100);
                    ToShtrih.PrintOutKassetaReport(Summ / 100, Casseta);
                }
            }
            else
            {
                ToShtrih.PrintOutKassetaReport(Summ / 100, Casseta);
            }
        }
コード例 #8
0
 void ctrlDigitalKeyBoard1_OnOk(object sender, double Value)
 {
     ToShtrih.CashIncome(Convert.ToDecimal(Value));
     FCC.WriteIncomeInfoToFccMoneyLog(Convert.ToDecimal(Value));
     this.Close();
 }
コード例 #9
0
        static void CloseCheckQuere()
        {
            try
            {
                DirectoryInfo Di = new DirectoryInfo(ChecksPath);
                if (!Di.Exists)
                {
                    Di.Create();
                }

                while (!mExitCloseCheckThread)
                {
                    try
                    {
                        //  CreateCloseCheckFileEventWaitHandle.WaitOne();
                        try
                        {
                            foreach (FileInfo fi in Di.GetFiles("*.0"))
                            {
                                try
                                {
                                    Utils.ToCardLog("Очередь на фискальник. Файл " + fi.Name);
                                    String State1FileName = fi.FullName.Substring(0, fi.FullName.Length - 1) + "1";
                                    String State2FileName = fi.FullName.Substring(0, fi.FullName.Length - 1) + "2";
                                    Check  Ch             = ReadCheckFromTmp(fi.FullName);

                                    if (iniFile.FRSEnabled)
                                    {
                                        continue;

                                        /*
                                         * try
                                         * {
                                         *  Utils.ToCardLog("FRSEnabled");
                                         *  if (Ch.GuidId == null) { Ch.GuidId = Guid.NewGuid(); }
                                         *
                                         *  String State5FileName = fi.FullName.Substring(0, fi.FullName.Length - 2) + Ch.GuidId.ToString() + ".5"; //FRS
                                         *  Utils.ToCardLog("State5FileName: " + State5FileName);
                                         *  if (File.Exists(State5FileName))
                                         *  {
                                         *      Utils.ToCardLog("Exist. Delete: ");
                                         *      File.Delete(State5FileName);
                                         *  }
                                         *  fi.CopyTo(State5FileName);
                                         *
                                         *  try
                                         *  {
                                         *      Utils.ToCardLog("fi.MoveTo(State2FileName): " + State2FileName);
                                         *      fi.MoveTo(State2FileName);
                                         *  }
                                         *  catch (Exception e)
                                         *  {
                                         *      Utils.ToCardLog("Error fi.MoveTo(State2FileName):  " + e.Message);
                                         *  }
                                         *  continue;
                                         * }
                                         * catch (Exception e)
                                         * {
                                         *  Utils.ToCardLog("Error FRSEnabled " + e.Message);
                                         * }
                                         * try
                                         * {
                                         *  Utils.ToCardLog("Переименовываю в  " + State2FileName);
                                         *  fi.MoveTo(State2FileName); //Нужен грамотный lock
                                         * }
                                         * catch (Exception ee)
                                         * {
                                         *  Utils.ToCardLog("Error Переименовываю в  " + State2FileName + " " + ee.Message);
                                         * }
                                         */
                                    }
                                    else
                                    {
                                        if (File.Exists(State1FileName))
                                        {
                                            Utils.ToCardLog("Существует " + State1FileName + " переношу в папку багов");
                                            if (!Directory.Exists(BugChecksPath))
                                            {
                                                Directory.CreateDirectory(BugChecksPath);
                                            }
                                            fi.MoveTo(BugChecksPath + fi.Name);
                                            continue;
                                        }

                                        Utils.ToCardLog("Переименовываю в  " + State1FileName);
                                        fi.MoveTo(State1FileName); //Нужен грамотный lock
                                    }

                                    if (Ch != null)
                                    {
                                        if (myAllChecks.Checks.Where(a => a.CheckNum == Ch.CheckNum && a.Summ == Ch.Summ && a.SystemDateOfOpen == Ch.SystemDateOfOpen).Count() > 0)
                                        {
                                            Utils.ToCardLog("Чек присутствует в myAllChecks " + Ch.CheckNum);
                                            fi.Delete();
                                            continue;
                                        }


                                        if (Shtrih2.QuereContainsChk(Ch))
                                        {
                                            Utils.ToCardLog("Чек уже присутствует в очереди закрытия " + Ch.CheckNum);
                                            continue;
                                        }


                                        if ((Ch.HasFiskalPayment() && Ch.Summ != 0) && (!iniFile.NOLocalFR) && (!iniFile.FRSEnabled))
                                        {
                                            Utils.ToCardLog("Отправляю в фискальную очередь  ");
                                            if (!iniFile.FiskalDriverNonShtrih)
                                            {
                                                Ch.FiskalFileName = State1FileName;
                                                ToShtrih.CloseCheck2(Ch);
                                            }
                                            else
                                            {
                                                Utils.ToCardLog("iniFile.FiskalDriverNonShtrih");
                                                if (FiskalDrivers.FiskalDriver.CloseCheck(Utils.GetFiskalCheck(Ch)))
                                                {
                                                    fi.MoveTo(State2FileName);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            Utils.ToCardLog("Нет фискальных платежей либо локального ФР");
                                            fi.MoveTo(State2FileName);
                                        }
                                    }
                                }
                                catch (Exception e)
                                {
                                    Utils.ToCardLog("[Error] Очередь на фискальник. Файл " + fi.Name + " Err " + e.Message);
                                }
                            }
                        }
                        catch
                        { }
                        //  CreateCloseCheckFileEventWaitHandle.Set();

                        WriteCheck2FileEventWaitHandle.WaitOne();
                        try
                        {
                            foreach (FileInfo fi in Di.GetFiles("*.2"))
                            {
                                try
                                {
                                    Utils.ToCardLog("*.2 Find " + fi.FullName);
                                    String State3FileName = fi.FullName.Substring(0, fi.FullName.Length - 1) + "3";
                                    Check  Ch             = ReadCheckFromTmp(fi.FullName);
                                    if (File.Exists(Ch.FiskalFileName))
                                    {
                                        File.Delete(Ch.FiskalFileName);
                                    }

                                    if (Ch != null)
                                    {
                                        if (iniFile.SpoolEnabled)
                                        {
                                            //if (Ch.ConSolidateSpoolDishez.Count > 0)
                                            {
                                                Spool.SpoolCreator.AddToSpoolFile(Ch);
                                            }
                                        }
                                        if (iniFile.JMSEnable)
                                        {
                                            //if (Ch.ConSolidateSpoolDishez.Count > 0)
                                            {
                                                JMSSendQuereChecks.Add(Ch);
                                                //Thread th = new Thread(SendJms);
                                                //th.Start(Ch);
                                            }
                                        }

                                        if (iniFile.AlohaFlyExportEnabled)
                                        {
                                            AlohaFlyExport.AlohaFlyExportHelper exp = new AlohaFlyExport.AlohaFlyExportHelper();
                                            exp.SendOrderFlightAsync(Ch);
                                        }
                                    }
                                    if (iniFile.FRSEnabled)
                                    {
                                        String State6FileName = fi.FullName.Substring(0, fi.FullName.Length - 2) + Ch.GuidId.ToString() + ".6"; //FRS
                                        fi.MoveTo(State6FileName);
                                    }
                                    else
                                    {
                                        fi.MoveTo(State3FileName);
                                    }
                                }
                                catch (Exception e)
                                {
                                    Utils.ToCardLog("Error2  *.2 Find " + fi.FullName);
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            Utils.ToCardLog("Error *.2 Find " + e.Message);
                        }
                        WriteCheck2FileEventWaitHandle.Set();

                        foreach (FileInfo fi in Di.GetFiles("*.3"))
                        {
                            //if ()

                            if (!iniFile.HamsterDisabled)
                            {
                                Check Ch = ReadCheckFromTmp(fi.FullName);
                                try
                                {
                                    AllChecks myAllChecks2 = ReadAllChecks(ChecksPath + @"\hamster.xml");
                                    if ((myAllChecks2.Checks.Count == 0) && File.Exists(ChecksPath + @"\hamster.xml"))
                                    {
                                        File.Copy(ChecksPath + @"\hamster.xml", ChecksPath + @"\hamster" + Guid.NewGuid() + ".xml");
                                    }
                                    myAllChecks2.Checks.Add(Ch);
                                    WriteAllChecks(myAllChecks2);
                                    fi.Delete();
                                }
                                catch (Exception ee)
                                {
                                    Utils.ToCardLog("[Error] CloseCheckQuere state 3 " + ee.Message);
                                }
                                myAllChecks.AddChk(Ch);
                            }
                            else
                            {
                                fi.Delete();
                            }
                        }

                        foreach (FileInfo fi in Di.GetFiles("*.6"))
                        {
                            try
                            {
                                //Check Ch = ReadCheckFromTmp(fi.FullName);
                                Hamster.HamsterWorker.SendHamsterChk(fi.FullName);
                            }
                            catch (Exception ee)
                            {
                                Utils.ToCardLog("[Error] CloseCheckQuere state 6 " + ee.Message);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Utils.ToCardLog("[Error] CloseCheckQuere " + e.Message);
                    }
                    Thread.Sleep(200);
                }
            }
            catch (Exception ee)
            {
                Utils.ToCardLog("[Error] CloseCheckQuere2 " + ee.Message);
            }
        }