示例#1
0
 public JsonResult UpdateOTK(int id, DateTime?appDate, string appDescription)
 {
     using (PortalKATEKEntities db = new PortalKATEKEntities())
     {
         string login = HttpContext.User.Identity.Name;
         db.Configuration.ProxyCreationEnabled = false;
         db.Configuration.LazyLoadingEnabled   = false;
         PlanVerificationItems planVerificationItems = db.PlanVerificationItems.Find(id);
         if (appDate != null)
         {
             planVerificationItems.appDate = appDate.Value;
         }
         if (appDescription != null)
         {
             planVerificationItems.appDescription = appDescription;
         }
         db.Entry(planVerificationItems).State = EntityState.Modified;
         db.SaveChanges();
         EmailVerifPlan           dataMail = new EmailVerifPlan(planVerificationItems, login, 3);
         PlanVerificationItemsLog planVerificationItemsLog = new PlanVerificationItemsLog();
         planVerificationItemsLog.action = "Начата приемка изделия на проверку: " + planVerificationItems.appDate.Value.ToShortDateString();
         planVerificationItemsLog.date   = DateTime.Now;
         planVerificationItemsLog.id_PlanVerificationItems = planVerificationItems.id;
         planVerificationItemsLog.id_AspNetUsers           = db.AspNetUsers.First(d => d.CiliricalName == "Погадо Евгений Владимирович").Id;
         db.PlanVerificationItemsLog.Add(planVerificationItemsLog);
         db.SaveChanges();
         return(Json(1, JsonRequestBehavior.AllowGet));
     }
 }
示例#2
0
 public JsonResult UpdateTE(int id, DateTime?planDate, string planDescription)
 {
     using (PortalKATEKEntities db = new PortalKATEKEntities())
     {
         string login = HttpContext.User.Identity.Name;
         db.Configuration.ProxyCreationEnabled = false;
         db.Configuration.LazyLoadingEnabled   = false;
         PlanVerificationItems planVerificationItems = db.PlanVerificationItems.Find(id);
         if (planDate != null)
         {
             planVerificationItems.planDate = planDate.Value;
             planVerificationItems.@fixed   = true;
         }
         if (planDescription != null)
         {
             planVerificationItems.planDescription = planDescription;
         }
         db.Entry(planVerificationItems).State = EntityState.Modified;
         db.SaveChanges();
         EmailVerifPlan dataMail = new EmailVerifPlan(planVerificationItems, login, 1);
         ProjectServer_UpdateMustStartOnCRUD projectServer_UpdateMustStartOnCRUD = new ProjectServer_UpdateMustStartOnCRUD(planVerificationItems.id_PZ_PlanZakaz, "ПП", planVerificationItems.planDate.Value);
         PlanVerificationItemsLog            planVerificationItemsLog            = new PlanVerificationItemsLog();
         planVerificationItemsLog.action = "Установлен плановый срок проверки изделия: " + planVerificationItems.planDate.Value.ToShortDateString();
         planVerificationItemsLog.date   = DateTime.Now;
         planVerificationItemsLog.id_PlanVerificationItems = planVerificationItems.id;
         planVerificationItemsLog.id_AspNetUsers           = db.AspNetUsers.First(d => d.CiliricalName == "Брель Андрей Викторович").Id;
         db.PlanVerificationItemsLog.Add(planVerificationItemsLog);
         db.SaveChanges();
         return(Json(1, JsonRequestBehavior.AllowGet));
     }
 }
示例#3
0
        string GetState(PlanVerificationItems planVerificationItems)
        {
            string state = "";

            if (planVerificationItems.appDate != null)
            {
                state = "Приемка ОТК";
            }
            else if (planVerificationItems.factDate != null)
            {
                state = "Сдан ПО";
            }
            else if (planVerificationItems.planDate != null)
            {
                state = "Срок зафиксирован";
            }
            else if (planVerificationItems.@fixed == true)
            {
                state = "Срок не зафиксирован";
            }
            else
            {
                state = "Срок не зафиксирован";
            }
            return(state);
        }
示例#4
0
 public JsonResult UpdateTM(int id, DateTime?factDate, string factDescription, DateTime?fixedDateForKO)
 {
     using (PortalKATEKEntities db = new PortalKATEKEntities())
     {
         string login = HttpContext.User.Identity.Name;
         db.Configuration.ProxyCreationEnabled = false;
         db.Configuration.LazyLoadingEnabled   = false;
         PlanVerificationItems planVerificationItems = db.PlanVerificationItems.Find(id);
         if (factDate != null)
         {
             planVerificationItems.factDate = factDate.Value;
             EmailVerifPlan           dataMail = new EmailVerifPlan(planVerificationItems, login, 2);
             PlanVerificationItemsLog planVerificationItemsLog = new PlanVerificationItemsLog();
             planVerificationItemsLog.action = "ПО передало изделие на проверку ОТК: " + planVerificationItems.factDate.Value.ToShortDateString();
             planVerificationItemsLog.date   = DateTime.Now;
             planVerificationItemsLog.id_PlanVerificationItems = planVerificationItems.id;
             planVerificationItemsLog.id_AspNetUsers           = db.AspNetUsers.First(d => d.CiliricalName == "Медведев Андрей").Id;
             db.PlanVerificationItemsLog.Add(planVerificationItemsLog);
             db.SaveChanges();
         }
         if (factDescription != null)
         {
             planVerificationItems.factDescription = factDescription;
         }
         if (fixedDateForKO != null)
         {
             planVerificationItems.fixedDateForKO = fixedDateForKO.Value;
             if (planVerificationItems.fixedDateForKO < planVerificationItems.planDate)
             {
                 EmailVerifPlan dataMail = new EmailVerifPlan(planVerificationItems, login, 5);
             }
             else
             {
                 EmailVerifPlan dataMail = new EmailVerifPlan(planVerificationItems, login, 4);
             }
             PlanVerificationItemsLog planVerificationItemsLog = new PlanVerificationItemsLog();
             planVerificationItemsLog.action = "Указан прогнозируемый срок передачи изделия на проверку: " + planVerificationItems.fixedDateForKO.Value.ToShortDateString();
             planVerificationItemsLog.date   = DateTime.Now;
             planVerificationItemsLog.id_PlanVerificationItems = planVerificationItems.id;
             planVerificationItemsLog.id_AspNetUsers           = db.AspNetUsers.First(d => d.CiliricalName == "Медведев Андрей").Id;
             db.PlanVerificationItemsLog.Add(planVerificationItemsLog);
             db.SaveChanges();
         }
         db.Entry(planVerificationItems).State = EntityState.Modified;
         db.SaveChanges();
         return(Json(1, JsonRequestBehavior.AllowGet));
     }
 }
示例#5
0
 public EmailVerifPlan(PlanVerificationItems order, string login, int stepNumber)
 {
     mailToList = new List <string>();
     try
     {
         this.login      = login;
         this.stepNumber = stepNumber;
         this.order      = db.PlanVerificationItems.Find(order.id);
         mail.From       = new MailAddress(login);
         GetMailListCreate();
         GetSubject();
         GetBody();
         SendEmail();
         logger.Debug("EmailVerifPlan: " + order.id);
     }
     catch
     {
     }
 }
示例#6
0
 private DateTime GetDateMilestone(PlanVerificationItems planVerificationItems)
 {
     if (planVerificationItems.planDate != null)
     {
         return(planVerificationItems.planDate.Value);
     }
     else if (planVerificationItems.verificationDateInPrj != null)
     {
         return(planVerificationItems.verificationDateInPrj.Value);
     }
     else
     {
         using (PortalKATEKEntities db = new PortalKATEKEntities())
         {
             db.Configuration.ProxyCreationEnabled = false;
             db.Configuration.LazyLoadingEnabled   = false;
             return(db.PZ_PlanZakaz.First(d => d.Id == planVerificationItems.id_PZ_PlanZakaz).dataOtgruzkiBP);
         }
     }
 }
示例#7
0
        public NewPlanZakaz(PZ_PlanZakaz pZ_PlanZakaz, bool addDebitWork)
        {
            int          numberPZ        = db.PZ_PlanZakaz.Where(d => d.PlanZakaz < 9000).Max(d => d.PlanZakaz) + 1;
            PZ_PlanZakaz newPZ_PlanZakaz = new PZ_PlanZakaz()
            {
                PZ_SMRId                       = pZ_PlanZakaz.PZ_SMRId,
                id_CountryName                 = pZ_PlanZakaz.id_CountryName,
                id_Provider                    = pZ_PlanZakaz.id_Provider,
                PlanZakaz                      = numberPZ,
                DateCreate                     = DateTime.Now,
                MTR                            = pZ_PlanZakaz.MTR,
                Name                           = pZ_PlanZakaz.Name,
                OL                             = pZ_PlanZakaz.OL,
                Zapros                         = pZ_PlanZakaz.Zapros,
                DateSupply                     = pZ_PlanZakaz.DateSupply,
                DateShipping                   = pZ_PlanZakaz.DateShipping,
                Cost                           = pZ_PlanZakaz.Cost,
                Description                    = pZ_PlanZakaz.Description,
                ProductType                    = pZ_PlanZakaz.ProductType,
                Dostavka                       = pZ_PlanZakaz.Dostavka,
                Manager                        = pZ_PlanZakaz.Manager,
                Client                         = pZ_PlanZakaz.Client,
                Gruzopoluchatel                = pZ_PlanZakaz.Gruzopoluchatel,
                PostAdresGruzopoluchatel       = pZ_PlanZakaz.PostAdresGruzopoluchatel,
                INNGruzopoluchatel             = pZ_PlanZakaz.INNGruzopoluchatel,
                OKPOGruzopoluchatelya          = pZ_PlanZakaz.OKPOGruzopoluchatelya,
                KodGruzopoluchatela            = pZ_PlanZakaz.KodGruzopoluchatela,
                StantionGruzopoluchatel        = pZ_PlanZakaz.StantionGruzopoluchatel,
                KodStanciiGruzopoluchatelya    = pZ_PlanZakaz.KodStanciiGruzopoluchatelya,
                OsobieOtmetkiGruzopoluchatelya = pZ_PlanZakaz.OsobieOtmetkiGruzopoluchatelya,
                DescriptionGruzopoluchatel     = pZ_PlanZakaz.DescriptionGruzopoluchatel,
                Folder                         = pZ_PlanZakaz.Folder,
                Modul                          = pZ_PlanZakaz.Modul,
                massa                          = 0,
                timeContract                   = pZ_PlanZakaz.timeContract,
                timeContractDate               = pZ_PlanZakaz.timeContractDate,
                timeArr                        = pZ_PlanZakaz.timeArr,
                timeArrDate                    = pZ_PlanZakaz.timeArrDate,
                id_PZ_FIO                      = pZ_PlanZakaz.id_PZ_FIO,
                numZakupki                     = pZ_PlanZakaz.numZakupki,
                numLota                        = pZ_PlanZakaz.numLota,
                dataOtgruzkiBP                 = pZ_PlanZakaz.dataOtgruzkiBP,
                ProjectUID                     = pZ_PlanZakaz.ProjectUID,
                nameTU                         = pZ_PlanZakaz.nameTU,
                TypeShip                       = pZ_PlanZakaz.TypeShip,
                criticalDateShip               = pZ_PlanZakaz.criticalDateShip,
                nomenklaturNumber              = pZ_PlanZakaz.nomenklaturNumber,
                costSMR                        = pZ_PlanZakaz.costSMR,
                costPNR                        = pZ_PlanZakaz.costPNR,
                id_PZ_OperatorDogovora         = pZ_PlanZakaz.id_PZ_OperatorDogovora,
                PowerST                        = pZ_PlanZakaz.PowerST,
                VN_NN                          = pZ_PlanZakaz.VN_NN,
                objectOfExploitation           = pZ_PlanZakaz.objectOfExploitation,
                counterText                    = pZ_PlanZakaz.counterText,
                coefM                          = 3.5,
                coefE                          = 3.5
            };

            db.PZ_PlanZakaz.Add(newPZ_PlanZakaz);
            db.SaveChanges();
            Reclamation_CloseOrder reclamation_CloseOrder = new Reclamation_CloseOrder
            {
                close           = false,
                dateTimeClose   = DateTime.Now,
                description     = "",
                id_PZ_PlanZakaz = newPZ_PlanZakaz.Id,
                userClose       = newPZ_PlanZakaz.Manager
            };

            db.Reclamation_CloseOrder.Add(reclamation_CloseOrder);
            db.SaveChanges();
            PZ_TEO pZ_TEO = new PZ_TEO
            {
                Currency          = 1,
                NDS               = 0,
                Rate              = 0,
                SSM               = 0,
                SSR               = 0,
                IzdKom            = 0,
                IzdPPKredit       = 0,
                PI                = 0,
                NOP               = 0,
                KI_S              = 0,
                KI_prochee        = 0,
                Id_PlanZakaz      = newPZ_PlanZakaz.Id,
                OtpuskChena       = 0,
                KursValuti        = 0,
                SSRFact           = 0,
                percentYear       = 0,
                percentPI         = 0,
                durationBeforePay = 0,
                SSMToBYN          = 0,
                SSMProduct        = 0,
                importDuty        = 0,
                importDutyPlan    = 0
            };

            db.PZ_TEO.Add(pZ_TEO);
            db.SaveChanges();
            PZ_Setup pZ_Setup = new PZ_Setup
            {
                KolVoDneyNaPrijemku         = 0,
                PunktDogovoraOSrokahPriemki = "",
                RassmotrenieRKD             = 0,
                SrokZamechanieRKD           = 0,
                TimeNaRKD         = 0,
                UslovieOplatyInt  = 0,
                UslovieOplatyText = "",
                id_PZ_PlanZakaz   = newPZ_PlanZakaz.Id
            };

            db.PZ_Setup.Add(pZ_Setup);
            db.SaveChanges();
            Debit_Platform debit_Platform = new Debit_Platform
            {
                id_PlanZakaz  = newPZ_PlanZakaz.Id,
                countPlatform = 0,
                gabar         = "",
                massa         = 0,
                numPlatform   = "",
                numPlomb      = ""
            };

            db.Debit_Platform.Add(debit_Platform);
            db.SaveChanges();
            PlanVerificationItems planVerificationItems = new PlanVerificationItems
            {
                id_PZ_PlanZakaz       = newPZ_PlanZakaz.Id,
                @fixed                = false,
                appDescription        = "",
                factDescription       = "",
                fixetFirstDate        = false,
                planDescription       = "",
                verificationDateInPrj = newPZ_PlanZakaz.dataOtgruzkiBP
            };

            db.PlanVerificationItems.Add(planVerificationItems);
            db.SaveChanges();
            ApproveCDOrders approveCDOrders = new ApproveCDOrders
            {
                id_PZ_PlanZakaz = newPZ_PlanZakaz.Id,
                id_AspNetUsersM = "4f91324a-1918-4e62-b664-d8cd89a19d95",
                id_AspNetUsersE = "8363828f-bba2-4a89-8ed8-d7f5623b4fa8",
                description     = "",
                remove          = false,
                gHand           = false,
                isOpening       = false
            };

            db.ApproveCDOrders.Add(approveCDOrders);
            db.SaveChanges();
            if (addDebitWork == true)
            {
                List <TaskForPZ> dateTaskWork = db.TaskForPZ.Where(w => w.step == 1).Where(z => z.id_TypeTaskForPZ == 1).ToList();
                foreach (var data in dateTaskWork)
                {
                    Debit_WorkBit newDebit_WorkBit = new Debit_WorkBit();
                    newDebit_WorkBit.dateCreate    = DateTime.Now;
                    newDebit_WorkBit.close         = false;
                    newDebit_WorkBit.id_PlanZakaz  = newPZ_PlanZakaz.Id;
                    newDebit_WorkBit.id_TaskForPZ  = (int)data.id;
                    newDebit_WorkBit.datePlanFirst = DateTime.Now.AddDays((double)data.time);
                    newDebit_WorkBit.datePlan      = DateTime.Now.AddDays((double)data.time);
                    if (newDebit_WorkBit.id_TaskForPZ == 1)
                    {
                        newDebit_WorkBit.dateClose = DateTime.Now;
                    }
                    db.Debit_WorkBit.Add(new Debit_WorkBit()
                    {
                        close         = false,
                        dateCreate    = DateTime.Now,
                        datePlan      = newDebit_WorkBit.datePlan,
                        datePlanFirst = newDebit_WorkBit.datePlanFirst,
                        id_PlanZakaz  = newDebit_WorkBit.id_PlanZakaz,
                        id_TaskForPZ  = newDebit_WorkBit.id_TaskForPZ,
                        dateClose     = newDebit_WorkBit.dateClose
                    });
                    db.SaveChanges();
                }
            }
        }