Пример #1
0
        public ContentResult CarIn(HrmsCarInOut hrmsCarInOut)
        {
            BaseServices <HrmsCar>      hrmscarService      = new BaseServices <HrmsCar>();
            BaseServices <HrmsCarInOut> hrmsCarInOutService = new BaseServices <HrmsCarInOut>();

            var carmodel = hrmscarService.LoadEntities(c => c.No == hrmsCarInOut.CarNo).FirstOrDefault();

            if (carmodel == null)
            {
                return(Content("车辆不存在"));
            }

            carmodel.CurrentKilometers = hrmsCarInOut.InKilometers;
            carmodel.Location          = 0;

            if (!hrmscarService.UpdateEntity(carmodel))
            {
                return(Content("系统异常"));
            }
            var inoutmodel =
                hrmsCarInOutService.LoadEntities(c => c.FormNo == carmodel.FormNo && c.CarNo == carmodel.No)
                .FirstOrDefault();

            if (inoutmodel == null)
            {
                return(Content("车辆回来失败"));
            }
            inoutmodel.InTime       = DateTime.Now;
            inoutmodel.InKilometers = hrmsCarInOut.InKilometers;
            inoutmodel.Oil          = hrmsCarInOut.Oil;


            return(Content(hrmsCarInOutService.UpdateEntity(inoutmodel) ? "请求成功" : "请求失败,请重试"));
        }
Пример #2
0
        //Car
        #region Car



        public ContentResult CarOut(HrmsCarInOut hrmsCarInOut)
        {
            BaseServices <HrmsCar> hrmsCarService = new BaseServices <HrmsCar>();
            var carmodel = hrmsCarService.LoadEntities(c => c.No == hrmsCarInOut.CarNo).First();

            carmodel.Location          = 1;
            carmodel.FormNo            = hrmsCarInOut.FormNo;
            carmodel.CurrentKilometers = hrmsCarInOut.OutKilometers;
            if (!hrmsCarService.UpdateEntity(carmodel))
            {
                return(Content("车辆状态更新失败"));
            }

            hrmsCarInOut.OutTime      = DateTime.Now;
            hrmsCarInOut.InTime       = DateTime.MaxValue;
            hrmsCarInOut.Oil          = 0;
            hrmsCarInOut.InKilometers = 0;
            if (new BaseServices <HrmsCarInOut>().IsAddEntity(hrmsCarInOut))
            {
                return
                    (Content(new Signing().Agree(hrmsCarInOut.FormNo, 0, "1000000")
                        ? "请求成功"
                        : "表单签核失败!!!"));
            }
            return(Content("外出失败"));
        }
Пример #3
0
        public ActionResult SavePart(FormNcrPart part, string abnormalImage, string abnormalAttribution)
        {
            if (!string.IsNullOrEmpty(abnormalImage) || !string.IsNullOrEmpty(abnormalAttribution))
            {
                var upNcrMain = new BaseServices <FormNcr>();
                //保存描述
                var ncrMain = upNcrMain.Single(c => c.FormNo == part.ParentFormNo);
                ncrMain.AbnormalImage       = abnormalImage;
                ncrMain.AbnormalAttribution = abnormalAttribution;
                upNcrMain.UpdateEntity(ncrMain);
            }


            //return Content("111");
            string empNo = ManageProvider.Provider.Current().UserId;
            Dictionary <string, object> dictionary = Request.Form.Cast <object>().ToDictionary <object, string, object>(para => para.ToString(), para => Request.Form[para.ToString()]);

            var formId    = int.Parse(dictionary["formid"].ToString());
            var employees = new Applying().GetSignListByFormId(dictionary, formId, empNo);
            var form      = new Form
            {
                FormNo      = new Applying().CreateFormNo(new object()),
                FormId      = formId,
                CreateEmpNo = empNo,
                CreateTime  = DateTime.Now,
                SignPath    = string.Join(",", employees.Select(c => c.EmpNo)) + ",",
                FormStatus  = 0,
                IsEmergents = true,
            };



            FormNcrPart partA = new FormNcrPart()
            {
                Mark = part.Mark, ReplyType = formId, ParentFormNo = part.ParentFormNo, Reviewer = empNo, ReviewTime = DateTime.Now
            };
            var result = new F <FormNcrPart>().SaveData(new List <FormNcrPart>()
            {
                partA
            }, form);


            //送签
            if (!result)
            {
                return(Link.ErrorBy(new Exception("数据更新失败,请检查填写是否完整"), this.GetType()));
            }
            new Applying().Send(form.FormNo, empNo);


            var daiqian = new BaseServices <FormSign>().LoadEntities(c => c.FormNo == form.FormNo).Last();
            var signed  = new Signing().Agree(daiqian.FormNo, daiqian.RowId, daiqian.SignEmpNo);

            Console.Write(signed);

            return(Content("success"));
        }
Пример #4
0
        /// <summary>
        /// 更新插队结果
        /// </summary>
        /// <param name="formNo"></param>
        /// <param name="empNo"></param>
        /// <param name="item"></param>
        /// <returns></returns>
        private static bool _53Finish(string formNo, string empNo, int item)
        {
            BaseServices <FormWorkshopInspection> wService = new BaseServices <FormWorkshopInspection>();

            var jumformNo = ContextFactory.ContextHelper.FormJumpTheQueues.First(c => c.FormNo == formNo).JumpForm;
            var jumpform  = wService.LoadEntities(c => c.FormNo == jumformNo).First();


            //生成当前最大时间
            DateTime oldTime      = new DateTime(2016, 1, 1);
            double   milliseconds = (DateTime.Now - oldTime).TotalMilliseconds;

            jumpform.Order = milliseconds;


            return(wService.UpdateEntity(jumpform));
        }
Пример #5
0
        private static bool _50Finish(string formNo, string empNo, int item)
        {
            var current = ContextFactory.ContextHelper.FormDrawingsSopDewells.First(c => c.FormNo == formNo);


            BaseServices <FormDrawingsSopDewell> database = new BaseServices <FormDrawingsSopDewell>();
            var updates = database.LoadEntities(c => c.DrawPartNo == current.DrawPartNo && c.Tag == current.Tag && c.CustomerNo == current.CustomerNo).OrderByDescending(c => c.RowId).ToList();

            if (updates.Count <= 1)
            {
                return(true);
            }

            for (int i = 1; i < updates.Count; i++)
            {
                var update = updates[i];
                update.IsDel = true;
                return(database.UpdateEntity(update));
            }


            return(false);
        }