public void CloseTest() {
     XWZKXMIA lprm = new XWZKXMIA();
     lprm.CMD = "OPEN";
     lprm.OGCODE = ogcode;
     lprm.ZKCODE = "TEST1234";
     lprm.ZKSUBJECTCODE = "SUBJ1234";
     XWZKXMOA lres = SyncService.XWZKXM0N(lprm);
     Assert.AreEqual(lres.ZKISCLOSED, false);
     lprm = new XWZKXMIA();
     lprm.CMD = "CLOSE";
     lprm.OGCODE = ogcode;
     lprm.ZKCODE = "TEST1234";
     lres = SyncService.XWZKXM0N(lprm);
     Assert.AreEqual(lres.ZKISCLOSED, true);
 }
 public void SetTest() {
     XWZKXMIA lprm = new XWZKXMIA();
     lprm.CMD = "OPEN";
     lprm.OGCODE = ogcode;
     lprm.ZKCODE = "TEST1234";
     lprm.ZKSUBJECTCODE = "SUBJ1234";
     XWZKXMOA lres = SyncService.XWZKXM0N(lprm);
     lprm = new XWZKXMIA();
     lprm.CMD = "GET";
     lprm.OGCODE = ogcode;
     lprm.ZKCODE = "TEST1234";
     lres = SyncService.XWZKXM0N(lprm);
     Assert.AreEqual(lres.OGCODE, ogcode);
     Assert.AreEqual(lres.ZKCODE, "TEST1234");
     Assert.AreEqual(lres.ZKISCLOSED, false);
     Assert.AreEqual(lres.ZKSUBJECTCODE, "SUBJ1234");
     lprm.CMD = "SET";
     lprm.OGCODE = ogcode;
     lprm.ZKCODE = "TEST1234";
     lprm.ZKSUBJECTCODE = "SUBJ12345";
     lres = SyncService.XWZKXM0N(lprm);
     Assert.AreEqual(lres.ZKSUBJECTCODE, "SUBJ12345");
 }
 public void OpenCloseTest() {
     XWZKXMIA lprm = new XWZKXMIA();
     lprm.CMD = "OPEN";
     lprm.OGCODE = ogcode;
     lprm.ZKCODE = "TEST1234";
     lprm.ZKSUBJECTCODE = "SUBJ1234";
     lprm.ZKACBUHCODE = 2000;
     lprm.ZKBUHTYPE = "0";
     lprm.ZKDTOPEN = new DateTime(2013,01,01);
     lprm.ZKDTCLOSE = new DateTime(2015,12,31);
     XWZKXMOA lres = SyncService.XWZKXM0N(lprm);
     Assert.AreEqual(lres.ZKISCLOSED, false);
     Assert.AreNotEqual(lres.ZKINTNUM, 0);
     lprm = new XWZKXMIA();
     lprm.CMD = "CLOSE";
     lprm.OGCODE = ogcode;
     lprm.ZKINTNUM = lres.ZKINTNUM;
     lprm.ZKCODE = "TEST1234";
     lprm.ZKDTOPEN = new DateTime(2013, 01, 01);
     lprm.ZKDTCLOSE = new DateTime(2014, 12, 31);
     lres = SyncService.XWZKXM0N(lprm);
     Assert.AreEqual(lres.ZKDTCLOSE, new DateTime(2014,12,31));
     Assert.AreEqual(lres.ZKISCLOSED, true);
 }
Esempio n. 4
0
        public override void Send(IObjectSpace os, fmCOrderExt order)
        {
            XWZKXMIA msg_in = new XWZKXMIA();
//            throw new NotImplementedException();
            XWZKXMOA msg_out;

            msg_in.UUID       = order.Oid.ToString();
            msg_in.OGCODE     = 1000;
            msg_in.ZKINTNUM   = order.BuhIntNum;
            msg_in.ZKCODE     = order.Code;
            msg_in.ZKDTOPEN   = order.DateBegin;
            msg_in.ZKDTCLOSE  = order.DateEnd;
            msg_in.ZKISCLOSED = order.IsClosed;
            if (order.AnalitycAccouterType != null)
            {
                msg_in.ZKBUHTYPE = order.AnalitycAccouterType.BuhCode;
            }
            //
            if (order.AnalitycRegion.IsSNG)
            {
                if (order.AnalitycRegion.IsVED)
                {
                    msg_in.ERMANCOUNTRY = "СНГ";
                }
                else
                {
                    msg_in.ERMANCOUNTRY = "РФ";
                }
            }
            else if (order.AnalitycRegion.IsVED)
            {
                msg_in.ERMANCOUNTRY = "ВЭД";
            }
            else
            {
                msg_in.ERMANCOUNTRY = "";
            }
            //
            msg_in.ERMANGOZCODE    = order.AnalitycOrderSource.Code;
            msg_in.ERMANGOZOID     = order.AnalitycOrderSource.Oid.ToString();
            msg_in.ERMANPRODCODE   = order.AnalitycMilitary.Code;
            msg_in.ERMANPRODOID    = order.AnalitycMilitary.Oid.ToString();
            msg_in.ERMANTARGETCODE = order.AnalitycFinanceSource.Code;
            msg_in.ERMANTARGETOID  = order.AnalitycFinanceSource.Oid.ToString();
            msg_in.ERMANWORKCODE   = order.AnalitycWorkType.Code;
            msg_in.ERMANWORKOID    = order.AnalitycWorkType.Oid.ToString();
            msg_in.ERMOID          = order.Oid.ToString();
            msg_in.ERMSUBJECTOID   = order.Subject.Oid.ToString();
            if (String.IsNullOrEmpty(msg_in.ZKBUHTYPE))
            {
                msg_in.ZKBUHTYPE = "0";
            }
            if (order.Status == fmIOrderStatus.Opened)
            {
                msg_in.CMD = "OPEN";
                msg_in.ZKIBSSYSTEMPROTECT = order.IBSSystemsProtectString != null ? order.IBSSystemsProtectString : "     ";
                msg_in.ZKSUBJECTCODE      = order.Subject.Code;
                msg_in.ZKSHORTNAME        = order.Name;
                msg_in.ZKFULLNAME         = order.NameFull;
                msg_in.ZKDESCRIPTION      = order.Description;
                msg_in.ZKSOURCE           = order.SourceName;
                Decimal acccode = 0;
                Decimal.TryParse(order.BuhAccount.BuhCode, out acccode);
                msg_in.ZKNDSMODE   = order.AnalitycAVT.Code;
                msg_in.ZKACBUHCODE = acccode;
                if (order.BuhOverheadType == fmIOrderOverheadValueType.FIX_NPO)
                {
                    msg_in.ZKKOEFFKB  = order.FixKoeff;
                    msg_in.ZKKOEFFOZM = order.FixKoeffOZM;
                }
                else if (order.BuhOverheadType == fmIOrderOverheadValueType.FIX_SINGLE)
                {
                    msg_in.ZKKOEFFKB  = -1;
                    msg_in.ZKKOEFFOZM = order.FixKoeff;
                }
                else if (order.BuhOverheadType == fmIOrderOverheadValueType.NO_OVERHEAD)
                {
                    msg_in.ZKKOEFFKB  = -1;
                    msg_in.ZKKOEFFOZM = -1;
                }
                else if (order.BuhOverheadType == fmIOrderOverheadValueType.VARIABLE)
                {
                    msg_in.ZKKOEFFKB  = 0;
                    msg_in.ZKKOEFFOZM = 0;
                }
                msg_out         = SyncService.XWZKXM0N(msg_in);
                order.BuhIntNum = msg_out.ZKINTNUM;
            }
            if (order.Status == fmIOrderStatus.Closed)
            {
                msg_in.CMD = "CLOSE";
                msg_out    = SyncService.XWZKXM0N(msg_in);
            }
            if (order.Status == fmIOrderStatus.Blocked)
            {
                msg_in.CMD = "BLOCK";
                msg_out    = SyncService.XWZKXM0N(msg_in);
            }
        }
        public void ListTest([Range(1, 1, 1)]  int counter) {
            XWZKXMIA lset = new XWZKXMIA();
            XWZKXMOA rset;
            for (int i = 0; i < 10; i++) {
                lset.CMD = "SET";
                lset.OGCODE = ogcode;
                lset.ZKCODE = "TEST-" + i.ToString();
                lset.ZKSUBJECTCODE = "SUBJ-" + i.ToString();
                rset = SyncService.XWZKXM0N(lset);
            }
            //
            XWZKXCIA lprm = new XWZKXCIA();
            lprm.CMD = "CATALOG";
            lprm.OGCODE = ogcode;
            XWZKXCOA lres = SyncService.XWZKXC0N(lprm);
//            Assert.AreEqual(lres.VOLIST.Count, 20);
            int count = 0;
            foreach (XWZKXCOAZKLIST  item in lres.ZKLIST) {
                count++;
                Debug.WriteLine(count.ToString() + " - " + item.ZKSUBJECTCODE + " - " +  item.ZKCODE);
            }
            Assert.AreEqual(count, 10);
        }