Example #1
0
        /// <summary>
        /// Для удаленного создания заявки на ЗИП из системы планирования (ДСУ)
        /// </summary>
        /// <param name="idServiceCame"></param>
        /// <param name="creatorSid"></param>
        /// <returns></returns>
        public static int SaveFromServicePlan4ZipClaim(int idServiceCame)
        {
            var came = new PlanServiceCame(idServiceCame);
            if (!came.NeedZip.HasValue || !came.NeedZip.Value) return 0;
            var claim = new Claim();
            claim.CurUserAdSid = came.CreatorSid;
            claim.IdDevice = came.IdDevice;
            claim.IdContract = came.IdContract;
            claim.IdContractor = came.IdContractor;
            claim.CurUserAdSid = came.CreatorSid;
            claim.IdServiceCame = idServiceCame;
            claim.IdWorkType = Service.WorkType.GetWorkTypeForZipClaim().Id;
            claim.CurAdminSid = came.CreatorSid;
            claim.CurEngeneerSid = came.ServiceEngeneerSid;
            //claim.Descr = came.ZipDescr;

            var sheet = new ServiceSheet();
            sheet.CounterDescr = came.Descr;
            sheet.Descr = came.ZipDescr;
            sheet.AdminSid = came.CreatorSid;
            sheet.EngeneerSid = came.ServiceEngeneerSid;
            sheet.CounterMono = came.Counter;
            sheet.CounterColor = came.CounterColor;
            sheet.ProcessEnabled = came.ProcessEnabled.HasValue ? came.ProcessEnabled.Value : false;
            sheet.DeviceEnabled = came.DeviceEnabled.HasValue ? came.DeviceEnabled.Value : false;
            sheet.ZipClaim = came.NeedZip;
            sheet.NoCounter = came.NoCounter;
            sheet.CounterUnavailable = came.CounterAvailable;
            sheet.IdServiceIssue = -999;

            claim.ServiceSheet4Save = sheet;

            var firstState = new ClaimState("SRVENGWORK");
            int id = claim.Save(firstState);
            claim.Go();
            return id;
        }
Example #2
0
        public static void ServiceSheetIsPayWraped(int serviceSheetId, string creatorSid)
        {
            var ss = new ServiceSheet(serviceSheetId);
            if (ss.IsPayed.HasValue)
            {
                string text;
                string subject;

                if (ss.IsPayed.Value)
                {
                    text = $"Принят сервисный лист №{serviceSheetId} по заявке №%ID% %LINK%";
                    subject = $"[Заявка №%ID%] Принят сервисный лист №{serviceSheetId}";
                    
                }
                else
                {
                    text = $"Не принят сервисный лист №{serviceSheetId} по заявке №%ID%<br />Причина: {ss.NotPayedComment} %LINK%";
                    subject = $"[Заявка №%ID%] Не принят сервисный лист №{serviceSheetId}";
                }
                var cl = new Claim(ss.IdClaim);
                cl.CurUserAdSid = creatorSid;
                cl.SendNote(subject, text, serviceSheetId, ServiceRole.ServiceSheetEngeneer);
                cl.Go();
            }
        }
        public IHttpActionResult RemoteStateChange(int? idClaim, string stateSysName, string creatorSid, string descr = null, int? idZipClaim = null)
        {
            if (!idClaim.HasValue || String.IsNullOrEmpty(stateSysName)) return NotFound();

            Claim.RemoteStateChange(idClaim.Value, stateSysName, creatorSid, descr, idZipClaim);

            var claim = new Claim(idClaim.Value);
            claim.CurUserAdSid = creatorSid;
            //claim.Descr = descr;
            claim.Go();
            return Ok();
        }
        public HttpResponseMessage GoBack(Claim model)
        {
            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.Created);

            try
            {
                model.CurUserAdSid = GetCurUser().Sid;
                //model.Save(SetNextState.Back);
                model.Go(false);
                //model.Go2State(SetNextState.Back);
                response.Content = new StringContent(String.Format("{{\"id\":{0},\"sid\":\"{1}\"}}", model.Id, model.Sid));
            }
            catch (Exception ex)
            {
                response = new HttpResponseMessage(HttpStatusCode.OK);
                response.Content = new StringContent(MessageHelper.ConfigureExceptionMessage(ex));

            }
            return response;
        }
        public HttpResponseMessage Go(Claim model)
        {
            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.Created);

            try
            {
                model.CurUserAdSid = GetCurUser().Sid;
                model.Go();
                response.Content = new StringContent($"{{\"id\":{model.Id},\"sid\":\"{model.Sid}\"}}");
            }
            catch (Exception ex)
            {
                response = new HttpResponseMessage(HttpStatusCode.OK);
                response.Content = new StringContent(MessageHelper.ConfigureExceptionMessage(ex));

            }
            return response;
        }