예제 #1
0
        public int Save(BO.p45TaskOperReal rec)
        {
            if (rec.p41ID == 0)
            {
                _mother.CurrentUser.AddMessage("Chybí p41ID.");
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p45ID);

            p.AddInt("p41ID", rec.p41ID, true);
            p.AddInt("p18ID", rec.p18ID, true);
            p.AddInt("p19ID", rec.p19ID, true);

            p.AddString("p45Name", rec.p45Name);
            p.AddString("p45MaterialCode", rec.p45MaterialCode);
            p.AddString("p45MaterialBatch", rec.p45MaterialBatch);
            p.AddString("p45MaterialName", rec.p45MaterialName);


            p.AddInt("p45RowNum", rec.p45RowNum);
            p.AddString("p45OperCode", rec.p45OperCode);
            p.AddInt("p45OperNum", rec.p45OperNum);
            p.AddDouble("p45OperParam", rec.p45OperParam);
            p.AddString("p45OperStatus", rec.p45OperStatus);
            p.AddDateTime("p45Start", rec.p45Start);
            p.AddDateTime("p45End", rec.p45End);
            p.AddInt("p45EndFlag", rec.p45EndFlag);
            p.AddDouble("p45MaterialUnitsCount", rec.p45MaterialUnitsCount);
            p.AddDouble("p45TotalDurationOperMin", rec.p45TotalDurationOperMin);
            p.AddString("p45Operator", rec.p45Operator);

            int intP45ID = _db.SaveRecord("p45TaskOperReal", p.getDynamicDapperPars(), rec);

            var pars = new Dapper.DynamicParameters();

            pars.Add("userid", _db.CurrentUser.pid);
            pars.Add("pid", rec.p41ID, System.Data.DbType.Int32);
            pars.Add("err_ret", "", System.Data.DbType.String, System.Data.ParameterDirection.Output);
            _db.RunSp("p41_after_p45save", ref pars);


            return(intP45ID);
        }
예제 #2
0
        public int Save(BO.p19Material rec)
        {
            if (rec.p20ID == 0)
            {
                _db.CurrentUser.AddMessage("Chybí vyplnit měrná jednotka."); return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p19ID);
            p.AddInt("p20ID", rec.p20ID, true);
            if (rec.j02ID_Owner == 0)
            {
                rec.j02ID_Owner = _db.CurrentUser.j02ID;
            }
            p.AddInt("j02ID_Owner", rec.j02ID_Owner, true);
            p.AddInt("p28ID", rec.p28ID, true);
            if (_db.CurrentUser.j03EnvironmentFlag == 2 && rec.p28ID != _db.CurrentUser.p28ID)
            {
                _db.CurrentUser.AddMessage("V klientském režimu se pořizuje materiál na míru klienta. Musíte záznam svázat s klientem s vazbou na váš profil.");
                return(0);
            }
            p.AddEnumInt("p19TypeFlag", rec.p19TypeFlag);
            p.AddInt("p10ID_Master", rec.p10ID_Master, true);
            p.AddString("p19Name", rec.p19Name);
            p.AddString("p19Code", rec.p19Code);
            p.AddString("p19Memo", rec.p19Memo);

            p.AddString("p19Supplier", rec.p19Supplier);
            p.AddString("p19Intrastat", rec.p19Intrastat);
            p.AddString("p19NameAlias", rec.p19NameAlias);
            p.AddString("p19ITSINC", rec.p19ITSINC);
            p.AddString("p19ITSCAS", rec.p19ITSCAS);
            p.AddString("p19ITSEINECS", rec.p19ITSEINECS);

            p.AddString("p19Lang1", rec.p19Lang1);
            p.AddString("p19Lang2", rec.p19Lang2);
            p.AddString("p19Lang3", rec.p19Lang3);
            p.AddString("p19Lang4", rec.p19Lang4);

            p.AddDouble("p19StockActual", rec.p19StockActual);
            p.AddDouble("p19StockReserve", rec.p19StockReserve);
            p.AddDateTime("p19StockDate", rec.p19StockDate);

            return(_db.SaveRecord("p19Material", p.getDynamicDapperPars(), rec));
        }
예제 #3
0
        public int Save(BO.p41Task rec)
        {
            if (ValidateBeforeSave(rec) == false)
            {
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p41ID);
            if (rec.j02ID_Owner == 0)
            {
                rec.j02ID_Owner = _db.CurrentUser.j02ID;
            }
            p.AddInt("j02ID_Owner", rec.j02ID_Owner, true);
            p.AddInt("p27ID", rec.p27ID, true);
            p.AddInt("p52ID", rec.p52ID, true);
            if (rec.pid == 0)
            {
                rec.b02ID = _mother.b02StatusBL.LoadStartStatusPID("p41", rec.b02ID);  //startovací workflow stav
            }
            p.AddInt("b02ID", rec.b02ID, true);
            p.AddInt("p41MasterID", rec.p41MasterID, true);         //ID master zakázky
            p.AddInt("p41SuccessorID", rec.p41SuccessorID, true);   //ID následníka
            p.AddBool("p41IsDraft", rec.p41IsDraft);
            p.AddString("p41Name", rec.p41Name);
            p.AddString("p41Code", rec.p41Code);
            p.AddString("p41Memo", rec.p41Memo);
            p.AddString("p41StockCode", rec.p41StockCode);

            if (rec.p41PlanStart.Year > 1900)
            {
                p.AddDateTime("p41PlanStart", rec.p41PlanStart);
            }


            p.AddDouble("p41PlanUnitsCount", rec.p41PlanUnitsCount);

            int intPID = _db.SaveRecord("p41Task", p.getDynamicDapperPars(), rec);

            run_p41_after_save(intPID);

            return(intPID);
        }
예제 #4
0
        public int Save(BO.p18OperCode rec)
        {
            if (LoadByCode(rec.p18Code, rec.p25ID, rec.p18ID) != null)
            {
                _mother.CurrentUser.AddMessage("Kód operace nesmí být duplicitní v rámci jednoho typu zařízení.");
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p18ID);
            p.AddInt("p25ID", rec.p25ID, true);
            p.AddInt("p19ID", rec.p19ID, true);
            p.AddInt("p18Flag", rec.p18Flag);
            p.AddString("p18Name", rec.p18Name);
            p.AddString("p18Code", rec.p18Code);
            p.AddString("p18Memo", rec.p18Memo);
            p.AddDouble("p18UnitsCount", rec.p18UnitsCount);
            p.AddDouble("p18DurationPreOper", rec.p18DurationPreOper);
            p.AddDouble("p18DurOperUnits", rec.p18DurOperUnits);
            p.AddDouble("p18DurOperMinutes", rec.p18DurOperMinutes);
            if (rec.p18DurOperMinutes > 0 && rec.p18DurOperUnits > 0)
            {
                p.AddDouble("p18DurationOper", rec.p18DurOperMinutes / rec.p18DurOperUnits);
            }
            else
            {
                p.AddDouble("p18DurationOper", rec.p18DurationOper);
            }

            p.AddDouble("p18DurationPostOper", rec.p18DurationPostOper);
            p.AddDouble("p18OperParam", rec.p18OperParam);
            p.AddString("p18Lang1", rec.p18Lang1);
            p.AddString("p18Lang2", rec.p18Lang2);
            p.AddString("p18Lang3", rec.p18Lang3);
            p.AddString("p18Lang4", rec.p18Lang4);
            p.AddBool("p18IsRepeatable", rec.p18IsRepeatable);
            p.AddBool("p18IsManualAmount", rec.p18IsManualAmount);

            return(_db.SaveRecord("p18OperCode", p.getDynamicDapperPars(), rec));
        }
예제 #5
0
        public int Save(BO.p14MasterOper rec)
        {
            if (rec.p18ID == 0)
            {
                _mother.CurrentUser.AddMessage("Chybí vazba na číselník [Kód operace].");
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p14ID);
            p.AddInt("p13ID", rec.p13ID, true);
            p.AddInt("p19ID", rec.p19ID, true);
            p.AddInt("p18ID", rec.p18ID, true);

            p.AddInt("p14RowNum", -1 + rec.p14RowNum * 100);
            p.AddInt("p14OperNum", rec.p14OperNum);
            p.AddDouble("p14OperParam", rec.p14OperParam);
            p.AddDouble("p14UnitsCount", rec.p14UnitsCount);
            p.AddDouble("p14DurationPreOper", rec.p14DurationPreOper);
            p.AddDouble("p14DurationPostOper", rec.p14DurationPostOper);
            p.AddDouble("p14DurOperUnits", rec.p14DurOperUnits);
            p.AddDouble("p14DurOperMinutes", rec.p14DurOperMinutes);
            if (rec.p14DurOperMinutes > 0 && rec.p14DurOperUnits > 0)
            {
                p.AddDouble("p14DurationOper", rec.p14DurOperMinutes / rec.p14DurOperUnits);
            }
            else
            {
                p.AddDouble("p14DurationOper", rec.p14DurationOper);
            }

            var intPID = _db.SaveRecord("p14MasterOper", p.getDynamicDapperPars(), rec);

            _db.RunSql("UPDATE p14MasterOper SET p14RowNum=p14RowNum*100 WHERE p13ID=@p13id AND p14ID<>@pid", new { p13id = rec.p13ID, pid = intPID });
            _db.RunSql("update a set p14RowNum=RowID from (SELECT ROW_NUMBER() OVER(ORDER BY p14RowNum ASC) AS RowID,* FROM p14MasterOper WHERE p13ID=@p13id) a", new { p13id = rec.p13ID });

            _db.RunSql("UPDATE p13MasterTpv SET p13TotalDuration=(SELECT sum(isnull(p14DurationPreOper,0)+isnull(p14DurationOper,0)+isnull(p14DurationPostOper,0)) FROM p14MasterOper WHERE p13ID=@pid) WHERE p13ID=@pid", new { pid = rec.p13ID });

            return(intPID);
        }
예제 #6
0
        public int Save(BO.p27MszUnit rec)
        {
            if (rec.p25ID_HW == 0)
            {
                _mother.CurrentUser.AddMessage("Chybí vyplnit Kmenový typ zařízení.");
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p27ID);

            p.AddInt("p31ID", rec.p31ID, true);
            p.AddInt("p25ID_HW", rec.p25ID_HW, true);
            p.AddString("p27Name", rec.p27Name);
            p.AddString("p27Code", rec.p27Code);
            p.AddDouble("p27Capacity", rec.p27Capacity);


            return(_db.SaveRecord("p27MszUnit", p.getDynamicDapperPars(), rec));
        }
예제 #7
0
        public int Save(BO.p15ClientOper rec)
        {
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p15ID);
            p.AddInt("p12ID", rec.p12ID, true);
            p.AddInt("p19ID", rec.p19ID, true);
            p.AddInt("p18ID", rec.p18ID, true);

            p.AddInt("p15RowNum", -1 + rec.p15RowNum * 100);
            p.AddInt("p15OperNum", rec.p15OperNum);
            p.AddDouble("p15OperParam", rec.p15OperParam);
            p.AddDouble("p15UnitsCount", rec.p15UnitsCount);
            p.AddDouble("p15DurationPreOper", rec.p15DurationPreOper);
            p.AddDouble("p15DurationPostOper", rec.p15DurationPostOper);

            p.AddDouble("p15DurOperUnits", rec.p15DurOperUnits);
            p.AddDouble("p15DurOperMinutes", rec.p15DurOperMinutes);
            if (rec.p15DurOperMinutes > 0 && rec.p15DurOperUnits > 0)
            {
                p.AddDouble("p15DurationOper", rec.p15DurOperMinutes / rec.p15DurOperUnits);
            }
            else
            {
                p.AddDouble("p15DurationOper", rec.p15DurationOper);
            }

            int intPID = _db.SaveRecord("p15ClientOper", p.getDynamicDapperPars(), rec);

            _db.RunSql("UPDATE p15ClientOper SET p15RowNum=p15RowNum*100 WHERE p12ID=@p12id AND p15ID<>@pid", new { p12ID = rec.p12ID, pid = intPID });
            _db.RunSql("update a set p15RowNum=RowID from (SELECT ROW_NUMBER() OVER(ORDER BY p15RowNum ASC) AS RowID,* FROM p15ClientOper WHERE p12ID=@p12id) a", new { p12ID = rec.p12ID });

            _db.RunSql("UPDATE p12ClientTpv SET p12TotalDuration=(SELECT sum(isnull(p15DurationPreOper,0)+isnull(p15DurationOper,0)+isnull(p15DurationPostOper,0)) FROM p15ClientOper WHERE p12ID=@pid) WHERE p12ID=@pid", new { pid = rec.p12ID });

            return(intPID);
        }
예제 #8
0
        public int Save(BO.p52OrderItem rec)
        {
            if (rec.p51ID == 0)
            {
                _mother.CurrentUser.AddMessage("Chybí hlavička objednávky."); return(0);
            }
            if (rec.p11ID == 0)
            {
                _mother.CurrentUser.AddMessage("Chybí vyplnit produkt."); return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p52ID);
            p.AddInt("p51ID", rec.p51ID, true);
            if (rec.j02ID_Owner == 0)
            {
                rec.j02ID_Owner = _db.CurrentUser.j02ID;
            }
            p.AddInt("j02ID_Owner", rec.j02ID_Owner, true);
            p.AddInt("p11ID", rec.p11ID, true);
            p.AddDouble("p52UnitsCount", rec.p52UnitsCount);
            p.AddDateTime("p52DateNeeded", rec.p52DateNeeded);

            int intP52ID = _db.SaveRecord("p52OrderItem", p.getDynamicDapperPars(), rec);

            var pars = new Dapper.DynamicParameters();

            pars.Add("userid", _db.CurrentUser.pid);
            pars.Add("pid", intP52ID, System.Data.DbType.Int32);
            pars.Add("err_ret", "", System.Data.DbType.String, System.Data.ParameterDirection.Output);
            _db.RunSp("p52_after_save", ref pars);

            //_mother.p51OrderBL.AdjustItemsCode(_mother.p51OrderBL.Load(rec.p51ID));


            return(intP52ID);
        }
예제 #9
0
        public int Save(BO.p21License rec)
        {
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p21ID);
            if (rec.pid == 0)
            {
                rec.b02ID = _mother.b02StatusBL.LoadStartStatusPID("p21", rec.b02ID);  //startovací workflow stav
            }
            p.AddInt("b02ID", rec.b02ID, true);
            p.AddInt("p28ID", rec.p28ID, true);

            p.AddEnumInt("p21PermissionFlag", rec.p21PermissionFlag);
            p.AddString("p21Name", rec.p21Name);
            p.AddString("p21Code", rec.p21Code);
            p.AddString("p21Memo", rec.p21Memo);
            p.AddDouble("p21Price", rec.p21Price);
            p.AddDateTime("ValidFrom", rec.ValidFrom);
            p.AddDateTime("ValidUntil", rec.ValidUntil);

            int intPID = _db.SaveRecord("p21License", p.getDynamicDapperPars(), rec);

            return(intPID);
        }
예제 #10
0
        public int Save(BO.p85Tempbox rec)
        {
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p85ID);
            p.AddString("p85GUID", rec.p85GUID);
            p.AddString("p85Prefix", rec.p85Prefix);
            p.AddInt("p85RecordPid", rec.p85RecordPid, true);
            p.AddInt("p85ClonePid", rec.p85ClonePid);
            p.AddBool("p85IsDeleted", rec.p85IsDeleted);

            p.AddInt("p85OtherKey1", rec.p85OtherKey1, true);
            p.AddInt("p85OtherKey2", rec.p85OtherKey2, true);
            p.AddInt("p85OtherKey3", rec.p85OtherKey3, true);
            p.AddInt("p85OtherKey4", rec.p85OtherKey4, true);
            p.AddInt("p85OtherKey5", rec.p85OtherKey5, true);

            p.AddString("p85FreeText01", rec.p85FreeText01);
            p.AddString("p85FreeText02", rec.p85FreeText02);
            p.AddString("p85FreeText03", rec.p85FreeText03);
            p.AddString("p85FreeText04", rec.p85FreeText04);
            p.AddString("p85FreeText05", rec.p85FreeText05);
            p.AddString("p85FreeText06", rec.p85FreeText06);

            p.AddBool("p85FreeBoolean01", rec.p85FreeBoolean01);
            p.AddBool("p85FreeBoolean02", rec.p85FreeBoolean02);
            p.AddBool("p85FreeBoolean03", rec.p85FreeBoolean03);
            p.AddBool("p85FreeBoolean04", rec.p85FreeBoolean04);

            p.AddDouble("p85FreeNumber01", rec.p85FreeNumber01);
            p.AddDouble("p85FreeNumber02", rec.p85FreeNumber02);
            p.AddDouble("p85FreeNumber03", rec.p85FreeNumber03);
            p.AddDouble("p85FreeNumber04", rec.p85FreeNumber04);
            p.AddDouble("p85FreeNumber05", rec.p85FreeNumber05);
            p.AddDouble("p85FreeNumber06", rec.p85FreeNumber06);

            p.AddDateTime("p85FreeDate01", rec.p85FreeDate01);
            p.AddDateTime("p85FreeDate02", rec.p85FreeDate02);
            p.AddDateTime("p85FreeDate03", rec.p85FreeDate03);
            p.AddDateTime("p85FreeDate04", rec.p85FreeDate04);

            return(_db.SaveRecord("p85Tempbox", p.getDynamicDapperPars(), rec));
        }
예제 #11
0
        public int Save(BO.p11ClientProduct rec)
        {
            if (rec.p12ID > 0)
            {
                rec.p21ID = _mother.p12ClientTpvBL.Load(rec.p12ID).p21ID;   //licenci produktu zjistit z receptury
            }
            if (ValidateBeforeSave(rec) == false)
            {
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p11ID);
            p.AddInt("p12ID", rec.p12ID, true);
            p.AddInt("p10ID_Master", rec.p10ID_Master, true);
            p.AddInt("b02ID", rec.b02ID, true);
            p.AddInt("p20ID", rec.p20ID, true);
            p.AddInt("p20ID_Pro", rec.p20ID_Pro, true);
            p.AddInt("p21ID", rec.p21ID, true);
            p.AddString("p11Name", rec.p11Name);
            p.AddString("p11Code", rec.p11Code);
            p.AddString("p11Memo", rec.p11Memo);
            p.AddDouble("p11UnitPrice", rec.p11UnitPrice);
            p.AddDouble("p11RecalcUnit2Kg", rec.p11RecalcUnit2Kg);
            p.AddEnumInt("p11TypeFlag", rec.p11TypeFlag);
            p.AddString("p11PackagingCode", rec.p11PackagingCode);
            p.AddDouble("p11Davka", rec.p11Davka);
            p.AddDouble("p11DavkaMin", rec.p11DavkaMin);
            p.AddDouble("p11DavkaMax", rec.p11DavkaMax);
            p.AddDouble("p11SalesPerMonth", rec.p11SalesPerMonth);
            p.AddDouble("p11UnitsPerPalette", rec.p11UnitsPerPalette);

            int intPID = _db.SaveRecord("p11ClientProduct", p.getDynamicDapperPars(), rec);

            return(intPID);
        }
예제 #12
0
        public int AppendPos(BO.p41Task recP41, List <BO.AppendPostPreP44Oper> lisDestP44, int p18flag, bool bolRunSpAfter)   //uložit do plánu PO operace p18flag>1
        {
            if (recP41 == null)
            {
                _mother.CurrentUser.AddMessage("Chybí vazba na zakázku.");
                return(0);
            }
            if (lisDestP44.Where(p => p.p18Flag <= 1).Count() > 0)
            {
                _mother.CurrentUser.AddMessage("Do plánu lze vkládat pouze [PO] operace.");
                return(0);
            }

            _db.RunSql("DELETE FROM p44TaskOperPlan WHERE p41ID=@p41id AND p18ID IN (select p18ID FROM p18OperCode WHERE p18flag=@p18flag)", new { p41id = recP41.pid, p18flag = p18flag });

            int x = 0;

            if (p18flag == 3)
            {   //u POST operace zjistit poslední použité OperNum z TO operací a poté ho navyšovat o 10
                x = _db.Load <BO.COM.GetInteger>("SELECT MAX(p44OperNum) as Value FROM p44TaskOperPlan WHERE p41ID=@p41id AND p18ID IN (select p18ID FROM p18OperCode WHERE p18flag=1)", new { p41id = recP41.pid }).Value;
            }
            int rets = 0;

            foreach (var c in lisDestP44.Where(p => p.p18Flag == p18flag).OrderBy(p => p.p18Code))
            {
                var recP18 = _mother.p18OperCodeBL.Load(c.p18ID);
                var rec    = new BO.p44TaskOperPlan()
                {
                    p18ID = recP18.pid, p19ID = recP18.p19ID, p41ID = recP41.pid
                };

                var p = new DL.Params4Dapper();
                p.AddInt("p41ID", recP41.pid, true);
                p.AddInt("p19ID", rec.p19ID, true);
                p.AddInt("p18ID", rec.p18ID, true);
                p.AddDouble("p44DurationPreOper", recP18.p18DurationPreOper);
                p.AddDouble("p44DurationOper", recP18.p18DurationOper);
                p.AddDouble("p44DurationPostOper", recP18.p18DurationPostOper);
                if (recP18.p18IsManualAmount)
                {
                    p.AddDouble("p44MaterialUnitsCount", c.p44MaterialUnitsCount);
                }
                if (p18flag == 2)
                {   //u PRE operace je 1-9 použitelných pozic
                    rec.p44RowNum  = -1000 + x;
                    rec.p44OperNum = x + 1;
                    x += 1;
                }
                if (p18flag == 3)
                {   //u POST operace navyšovat stále o 10
                    rec.p44RowNum  = x + 900;
                    rec.p44OperNum = x + 10;
                    x += 10;
                }
                p.AddInt("p44RowNum", rec.p44RowNum);
                p.AddInt("p44OperNum", rec.p44OperNum);

                if (_db.SaveRecord("p44TaskOperPlan", p.getDynamicDapperPars(), rec) > 0)
                {
                    rets += 1;
                }
            }
            if (lisDestP44.Count() == 0)
            {
                rets = 1;   //pouze vyčištění
            }
            _db.RunSql("update a set p44RowNum=RowID from (SELECT ROW_NUMBER() OVER(ORDER BY p44RowNum ASC) AS RowID,* FROM p44TaskOperPlan WHERE p41ID=@p41id) a", new { p41id = recP41.pid });

            if (bolRunSpAfter)
            {
                run_p41_after_save(recP41.pid);
            }



            return(rets);
        }
예제 #13
0
        public int Save(BO.j72TheGridTemplate rec, List <BO.j73TheGridQuery> lisJ73, List <int> j04ids, List <int> j11ids)
        {
            if (ValidateBeforeSave(rec, lisJ73) == false)
            {
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.j72ID);
            p.AddString("j72Name", rec.j72Name);
            p.AddBool("j72IsSystem", rec.j72IsSystem);
            p.AddInt("j03ID", rec.j03ID, true);

            p.AddString("j72Entity", rec.j72Entity);
            p.AddString("j72MasterEntity", rec.j72MasterEntity);
            p.AddString("j72Columns", rec.j72Columns);
            p.AddInt("j72SplitterFlag", rec.j72SplitterFlag);
            p.AddBool("j72IsMainMenu", rec.j72IsMainMenu);

            p.AddBool("j72IsNoWrap", rec.j72IsNoWrap);
            p.AddInt("j72SelectableFlag", rec.j72SelectableFlag);
            p.AddBool("j72IsPublic", rec.j72IsPublic);


            if (lisJ73 != null)
            {
                p.AddBool("j72HashJ73Query", false);
            }

            int intJ72ID = _db.SaveRecord("j72TheGridTemplate", p.getDynamicDapperPars(), rec);

            if (j04ids != null && j11ids != null)
            {
                if (rec.pid > 0)
                {
                    _db.RunSql("if EXISTS(select j74ID FROM j74TheGridReceiver WHERE j72ID=@pid) DELETE FROM j74TheGridReceiver WHERE j72ID=@pid", new { pid = intJ72ID });
                }
                if (j04ids.Count > 0)
                {
                    _db.RunSql("INSERT INTO j74TheGridReceiver(j72ID,j04ID) SELECT @pid,j04ID FROM j04UserRole WHERE j04ID IN (" + string.Join(",", j04ids) + ")", new { pid = intJ72ID });
                }
                if (j11ids.Count > 0)
                {
                    _db.RunSql("INSERT INTO j74TheGridReceiver(j72ID,j04ID) SELECT @pid,j11ID FROM j11Team WHERE j11ID IN (" + string.Join(",", j11ids) + ")", new { pid = intJ72ID });
                }
            }
            if (lisJ73 != null)
            {
                if (rec.pid > 0)
                {
                    _db.RunSql("if EXISTS(select j73ID FROM j73TheGridQuery WHERE j72ID=@pid) DELETE FROM j73TheGridQuery WHERE j72ID=@pid", new { pid = intJ72ID });
                }
                foreach (var c in lisJ73)
                {
                    if (c.IsTempDeleted == true && c.j73ID > 0)
                    {
                        _db.RunSql("DELETE FROM j73TheGridQuery WHERE j73ID=@pid", new { pid = c.j73ID });
                    }
                    else
                    {
                        p = new DL.Params4Dapper();
                        p.AddInt("pid", c.j73ID, true);
                        p.AddInt("j72ID", intJ72ID, true);
                        p.AddString("j73Column", c.j73Column);
                        p.AddString("j73Operator", c.j73Operator);
                        p.AddInt("j73ComboValue", c.j73ComboValue);
                        p.AddInt("j73DatePeriodFlag", c.j73DatePeriodFlag);
                        if (c.j73DatePeriodFlag > 0)
                        {
                            c.j73Date1 = null; c.j73Date2 = null;
                        }
                        p.AddDateTime("j73Date1", c.j73Date1);
                        p.AddDateTime("j73Date2", c.j73Date2);
                        p.AddDouble("j73Num1", c.j73Num1);
                        p.AddDouble("j73Num2", c.j73Num2);
                        p.AddString("j73Value", c.j73Value);
                        p.AddString("j73ValueAlias", c.j73ValueAlias);
                        p.AddInt("j73Ordinal", c.j73Ordinal);
                        p.AddString("j73Op", c.j73Op);
                        p.AddString("j73BracketLeft", c.j73BracketLeft);
                        p.AddString("j73BracketRight", c.j73BracketRight);
                        _db.SaveRecord("j73TheGridQuery", p.getDynamicDapperPars(), c, false, true);
                    }
                }
                if (GetList_j73(intJ72ID, rec.j72Entity.Substring(0, 3)).Count() > 0)
                {
                    _db.RunSql("UPDATE j72TheGridTemplate set j72HashJ73Query=1 WHERE j72ID=@pid", new { pid = intJ72ID });
                }
            }

            return(intJ72ID);
        }
예제 #14
0
        public int Save(BO.p10MasterProduct rec)
        {
            if (ValidateBeforeSave(rec) == false)
            {
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p10ID);
            p.AddInt("p13ID", rec.p13ID, true);
            if (rec.pid == 0)
            {
                rec.b02ID = _mother.b02StatusBL.LoadStartStatusPID("p10", rec.b02ID);  //startovací workflow stav
            }
            p.AddInt("b02ID", rec.b02ID, true);

            p.AddInt("p20ID", rec.p20ID, true);
            p.AddInt("p20ID_Pro", rec.p20ID_Pro, true);
            p.AddString("p10Name", rec.p10Name);
            p.AddString("p10Code", rec.p10Code);
            p.AddString("p10Memo", rec.p10Memo);

            p.AddDouble("p10RecalcUnit2Kg", rec.p10RecalcUnit2Kg);
            p.AddEnumInt("p10TypeFlag", rec.p10TypeFlag);
            p.AddString("p10PackagingCode", rec.p10PackagingCode);
            p.AddDouble("p10Davka", rec.p10Davka);
            p.AddDouble("p10DavkaMin", rec.p10DavkaMin);
            p.AddDouble("p10DavkaMax", rec.p10DavkaMax);
            p.AddDouble("p10SalesPerMonth", rec.p10SalesPerMonth);
            p.AddDouble("p10UnitsPerPalette", rec.p10UnitsPerPalette);

            int intPID = _db.SaveRecord("p10MasterProduct", p.getDynamicDapperPars(), rec);
            var recP19 = _mother.p19MaterialBL.LoadByMasterP10ID(intPID);

            if (rec.p10TypeFlag == BO.ProductTypeEnum.Polotovar || rec.p10TypeFlag == BO.ProductTypeEnum.Vyrobek)    //zkopírovat polotovar nebo výrobek do surovin p19
            {
                if (recP19 == null)
                {
                    recP19 = new BO.p19Material();
                }
                recP19.p10ID_Master = intPID;
                recP19.p19Name      = rec.p10Name;
                recP19.p19Code      = rec.p10Code;
                recP19.p20ID        = rec.p20ID;
                recP19.p19Memo      = rec.p10Memo;
                if (rec.p10TypeFlag == BO.ProductTypeEnum.Polotovar)
                {
                    recP19.p19TypeFlag = BO.p19TypeFlagEnum.Polotovar;
                }
                if (rec.p10TypeFlag == BO.ProductTypeEnum.Vyrobek)
                {
                    recP19.p19TypeFlag = BO.p19TypeFlagEnum.Vyrobek;
                }
                _mother.p19MaterialBL.Save(recP19);
            }
            else
            {
                if (recP19 != null)
                {
                    _mother.CBL.DeleteRecord("p19", recP19.pid);
                }
            }
            return(intPID);
        }