Exemple #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) ? "请求成功" : "请求失败,请重试"));
        }
Exemple #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("外出失败"));
        }
Exemple #3
0
        //是否可以结案
        private static bool _45Finish(string formNo, string empNo, int item)
        {
            BaseServices <FormPath> pathService = new BaseServices <FormPath>();
            var model = pathService.LoadEntities(c => c.FormNo == formNo).First();


            //检查记录是否签核完成
            return(new BaseServices <FormNcrPart>().Count(
                       m =>
                       m.ParentFormNo == model.ParentFormNo && m.ReplyType == model.FormId &&
                       m.Form.FormStatus == (int)Form.StatusEnum.签核完成) > 0);
        }
Exemple #4
0
        private string _48Start(Dictionary <string, object> model)
        {
            BaseServices <BaseEmployee> employeeService = new BaseServices <BaseEmployee>();
            var firstOrDefault = employeeService.LoadEntities(c => c.EmpNo == _empNo).FirstOrDefault();

            if (firstOrDefault == null)
            {
                return(_formType.RouteOne);
            }

            var position = firstOrDefault.Position.Substring(0, 1);

            return(position == "M" ? _formType.RouteTwo : _formType.RouteOne);
        }
Exemple #5
0
        public string GetDrawLink(string partNo)
        {
            BaseServices <Published> pServices = new BaseServices <Published>();
            var model = pServices.LoadEntities(c => c.ProductNo == partNo && c.PublishType == 4).LastOrDefault();

            if (model == null)
            {
                return("javascript:alert('此款产品没有内部图纸')");
            }

            var files = new FilesFileGroupBll().GetFileListByGroupGuid(model.FileGroup);

            return($"/Pdm/PdfViews?publishKey={model.PubishedGuid}&md5={files[0].Md5}");
        }
Exemple #6
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));
        }
Exemple #7
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);
        }
Exemple #8
0
        public ActionResult CarInoutQuery(string extend)
        {
            var      date      = DateTime.Now;
            DateTime timestart = !string.IsNullOrEmpty(Request["timestart"]) ? DateTime.Parse(Request["timestart"]) :
                                 DateTime.Parse($"{date.Year}/{date.Month}/{date.Day} 00:00:00");
            DateTime timeend = !string.IsNullOrEmpty(Request["timeend"])
                ? DateTime.Parse($"{Request["timeend"]} 23:59:00")
                : DateTime.Parse($"{date.Year}/{date.Month}/{date.Day} 23:59:00");


            BaseServices <HrmsCarInOut> hrmscarinoutService = new BaseServices <HrmsCarInOut>();
            var models = hrmscarinoutService.LoadEntities(c => c.OutTime > timestart && c.OutTime < timeend).ToList();

            if (!string.IsNullOrEmpty(extend))
            {
                models =
                    models.Where(
                        c =>
                        c.FormNo.Contains(extend) || c.HrmsCar.Nameplate.Contains(extend) ||
                        c.BaseEmployee.RealName.Contains(extend)).ToList();
            }

            return(View(models));
        }
        public string GetJsonInvolvingTag(Guid guid)
        {
            BaseServices <FormInvolvingUser> formInvolvingUserService = new BaseServices <FormInvolvingUser>();

            return(string.Join(",", formInvolvingUserService.LoadEntities(c => c.Guid == guid).ToList().Select(c => string.Format("{0}:{1}", c.EmpNo, c.BaseEmployee.RealName))));
        }
Exemple #10
0
        public ActionResult InOut(string user = "")
        {
            var      date      = DateTime.Now;
            DateTime timestart = !string.IsNullOrEmpty(Request["timestart"]) ? DateTime.Parse(Request["timestart"]) :
                                 DateTime.Parse($"{date.Year}/{date.Month}/{date.Day} 00:00:00");
            DateTime timeend = !string.IsNullOrEmpty(Request["timeend"])
                ? DateTime.Parse($"{Request["timeend"]} 23:59:00")
                : DateTime.Parse($"{date.Year}/{date.Month}/{date.Day} 23:59:00");



            var         reports    = new List <DoorInoutReport>();
            EmployeeBll hrEmployee = new EmployeeBll();


            var list = _doorInoutService.LoadEntities(c => c.EventTime > timestart && c.EventTime < timeend).GroupBy(c => c.CardNo).ToList();



            list.ForEach(c =>
            {
                //if (c.Key == "0009200775")
                //    Console.Write("s");

                //个人进出记录
                var data = c.ToList().OrderBy(m => m.EventTime).ToList();

                //个人进出次数统计
                int row = 0;
                data.ForEach(k =>
                {
                    var outdoor = data.ToList().FirstOrDefault(d => d.RowId > row && d.Forward == 1);
                    if (outdoor != null)
                    {
                        row = outdoor.RowId;
                    }
                    var indoor = data.ToList().FirstOrDefault(d => d.RowId > row && d.Forward == 0);
                    if (indoor != null)
                    {
                        row = indoor.RowId;
                    }

                    if (outdoor == null)
                    {
                        return;
                    }
                    var employee = ContextFactory.ContextHelper.BaseEmployees.Single(s => s.IsDimission != 0 && s.CardNo == outdoor.CardNo);

                    if (indoor != null)
                    {
                        TimeSpan ts = indoor.EventTime - outdoor.EventTime;
                        reports.Add(new DoorInoutReport
                        {
                            Name       = employee.RealName,
                            Department = employee.BaseDepartment.FullName,
                            CardNo     = indoor.CardNo,
                            OutTime    = outdoor.EventTime.ToString("yyyy-MM-dd HH:mm:ss"),
                            InTime     = indoor.EventTime.ToString("yyyy-MM-dd HH:mm:ss"),
                            SumTime    = $"{ts.Hours}小时{ts.Minutes}分"
                        });
                    }
                    else
                    {
                        reports.Add(new DoorInoutReport()
                        {
                            Name       = employee.RealName,
                            Department = employee.BaseDepartment.FullName,
                            CardNo     = outdoor.CardNo,
                            OutTime    = outdoor.EventTime.ToString("yyyy-MM-dd HH:mm:ss"),
                            InTime     = "",
                            SumTime    = "",
                        });
                    }
                });
            });
            var model = reports.Where(c => c.Name.Contains(user)).OrderBy(c => c.OutTime).ThenBy(c => c.InTime);

            return(View(model));
        }