Esempio n. 1
0
        public static cashUnit.wfsCmdCimCashIn parseCmdCimCashInObject(Form1.spLogBuff spLogLine)
        {
            cashUnit.wfsCmdCimCashIn      wfsCmdCimCashInObject   = new cashUnit.wfsCmdCimCashIn();
            cashUnit.lppNoteNumber        lppNoteNumberObject     = new cashUnit.lppNoteNumber();
            List <cashUnit.lppNoteNumber> lppNoteNumberObjectList = new List <cashUnit.lppNoteNumber>();

            cashUnit.lppNoteNumberList lppNoteNumberList = new cashUnit.lppNoteNumberList();

            string[] stringSeparators = new string[] { "\r\n" };
            char[]   charSeperators   = new char[] { ':', ',', '\t', '[', ']' };
            string[] cuParsedArray    = spLogLine.csInfo.Split(stringSeparators, StringSplitOptions.None);
            int      index            = 0;

            foreach (string str in cuParsedArray)
            {
                if (str.Contains("usNumOfNoteNumbers = ["))
                {
                    lppNoteNumberList.usNumOfNoteNumbers = Convert.ToInt16(str.Split(charSeperators)[1]);
                }
                else if (str.Contains("lppNoteNumber["))
                {
                    lppNoteNumberObject.usNoteID = cuParsedArray[index + 2].Split(charSeperators)[1];
                    lppNoteNumberObject.ulCount  = Convert.ToInt16(cuParsedArray[index + 3].Split(charSeperators)[1]);

                    lppNoteNumberObjectList.Add(lppNoteNumberObject);
                }
                index++;
            }

            cashUnit.lppNoteNumber[] lppNoteMuberArray = lppNoteNumberObjectList.ToArray();

            lppNoteNumberList.lppNoteNumberStructArray = lppNoteMuberArray;

            wfsCmdCimCashInObject.lppNoteNumberListStruct = lppNoteNumberList;
            return(wfsCmdCimCashInObject);
        }
Esempio n. 2
0
        public static List <cashUnit.lppCashIn> parseStringCashInEnd(Form1.spLogBuff cdmCULine)
        {
            List <cashUnit.lppCashIn> lppCashInObjectArray = new List <cashUnit.lppCashIn>();

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

            string[] cuParsedArray = cdmCULine.csInfo.Split(stringSeparators, StringSplitOptions.None);

            //usCount - kaç tane lppCashIn objesi olduğu, kaç tane kasetin sayacı değişti
            string usNumberFromcdmCULine = parseOperations.extractFromCdmCuLine(cuParsedArray, "usCount");
            short  usCountValue          = Convert.ToInt16(splitString(usNumberFromcdmCULine));

            //lppCashIn

            cashUnit.lppCashIn lppCashInObject = new cashUnit.lppCashIn();
            int        lppCashInIndex          = 0;
            List <int> indexLppCashIn          = new List <int>();

            foreach (string str in cuParsedArray)
            {
                if (str.Contains("lppCashIn["))
                {
                    indexLppCashIn.Add(lppCashInIndex + 2);
                }
                else
                {
                }
                lppCashInIndex++;
            }

            //cashUnitCIM.lppPhysical lppPhysicalObject = new cashUnitCIM.lppPhysical();
            //List<cashUnitCIM.lppPhysical> lppPhysicalObjectList = new List<cashUnitCIM.lppPhysical>();

            //foreach (string str in cuParsedArray)
            //{
            //    if (str.Contains("lppCashIn["))
            //    {

            //        indexLppCashIn.Add(lppCashInIndex + 2);
            //    }
            //    lppCashInIndex++;
            //}



            //how many lppNoteNumber are there, and create a lppNoteNumberArray with length
            List <string> usNumberListcdmCULine = parseOperations.extractFromCdmCuLineArray(cuParsedArray, "usNumOfNoteNumbers = [");

            List <int> usNumberListValue = new List <int>();

            foreach (string str in usNumberListcdmCULine)
            {
                usNumberListValue.Add(Convert.ToInt16(splitString(str)));
            }

            int usNumOfNotesTotal = 0;

            foreach (int i in usNumberListValue)
            {
                usNumOfNotesTotal += i;
            }

            cashUnit.lppNoteNumber[] lppNoteNumberArray = new cashUnit.lppNoteNumber[usNumOfNotesTotal];


            int usNumOfNoteNumbersIndex = 0;

            List <int> indexUsNumOfNoteNumbers = new List <int>();

            foreach (string str in cuParsedArray)
            {
                if (str.Contains("lppNoteNumber["))
                {
                    indexUsNumOfNoteNumbers.Add(usNumOfNoteNumbersIndex + 2);
                }
                usNumOfNoteNumbersIndex++;
            }



            for (int i = 0; i < indexLppCashIn.Count; i++)
            {
                int      index        = indexLppCashIn[i];
                string[] croppedArray = new string[17];
                Array.Copy(cuParsedArray, index, croppedArray, 0, 17);
                lppCashInObject.usNumber       = Convert.ToInt16(splitString(croppedArray[0]));
                lppCashInObject.fwType         = splitString(croppedArray[1]);
                lppCashInObject.fwItemType     = splitString(croppedArray[2]);
                lppCashInObject.cUnitID        = splitString(croppedArray[3]);
                lppCashInObject.cUnitIDHex     = splitStringHexArray(croppedArray[4]);
                lppCashInObject.cCurrencyID    = splitString(croppedArray[5]);
                lppCashInObject.cCurrencyIDHex = splitStringHexArray(croppedArray[6]);
                lppCashInObject.ulValues       = Convert.ToUInt16(splitString(croppedArray[7]));
                lppCashInObject.ulCashInCount  = Convert.ToUInt16(splitString(croppedArray[8]));
                lppCashInObject.ulCount        = Convert.ToUInt16(splitString(croppedArray[9]));
                lppCashInObject.ulMaximum      = Convert.ToUInt16(splitString(croppedArray[10]));
                lppCashInObject.usStatus       = splitString(croppedArray[11]);
                lppCashInObject.bAppLock       = Convert.ToBoolean(splitString(croppedArray[12]));
                lppCashInObject.requestId      = requestIdOperations.findRequestID(cdmCULine);
                lppCashInObject.lppNoteNumberListStruct.usNumOfNoteNumbers = Convert.ToInt16(splitString(croppedArray[15]));
                lppCashInObject.lppCashInDateTime = parseOperations.extractDateTimeFromSpLogLine(cdmCULine);

                //for (int numOfNotesIndexValue = 0; numOfNotesIndexValue < lppCashInObject.lppNoteNumberListStruct.usNumOfNoteNumbers; numOfNotesIndexValue++)
                //{
                //lppNoteNumber[] noteDetail = returnNoteDetails(index + 21, lppCashInObject.lppNoteNumberListStruct.usNumOfNoteNumbers, cuParsedArray, indexUsNumOfNoteNumbers);
                lppCashInObject.lppNoteNumberListStruct.lppNoteNumberStructArray = cashUnit.returnNoteDetails(index + 21, lppCashInObject.lppNoteNumberListStruct.usNumOfNoteNumbers, cuParsedArray, indexUsNumOfNoteNumbers);
                //}

                lppCashInObjectArray.Add(lppCashInObject);
            }
            return(lppCashInObjectArray);
        }