Exemplo n.º 1
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            PersonnelFile.Id = _pinhuaContext.CreatePersonnelFileId("PF", 4);

            var rcId    = _pinhuaContext.GetNewRcId();
            var rtId    = _pinhuaContext.GetRtId("人员档案");
            var repCase = new EsRepCase
            {
                RcId          = rcId,
                RtId          = rtId,
                LstFiller     = 2,
                LstFillerName = User.Identity.Name,
                LstFillDate   = DateTime.Now,
                FillDate      = DateTime.Now,
            };

            PersonnelFile.ExcelServerRcid = rcId;
            PersonnelFile.ExcelServerRtid = rtId;
            PersonnelFile.SignedDate      = DateTime.Now;

            _pinhuaContext.EsRepCase.Add(repCase);
            _pinhuaContext.人员档案.Add(_mapper.Map <PersonnelFilesDTO, 人员档案>(PersonnelFile));
            _pinhuaContext.SaveChanges();

            return(RedirectToPage("Index"));
        }
Exemplo n.º 2
0
        public IActionResult OnPost()
        {
            if (ModelState.IsValid)
            {
                var Rcid    = _pinhuaContext.GetNewRcId();
                var rtId    = "165.1";
                var repCase = new EsRepCase
                {
                    RcId          = Rcid,
                    RtId          = rtId,
                    LstFiller     = 2,
                    LstFillerName = User.Identity.Name,
                    LstFillDate   = DateTime.Now,
                    //fillDate = DateTime.Now,
                    //wiId = "",
                    //state = 1,
                };

                var main = _mapper.Map <WarehouseDTO, Data.Entities.Pinhua.Warehouse>(WarehouseInfo.Main);
                main.ExcelServerRcid = Rcid;
                main.ExcelServerRtid = rtId;

                _pinhuaContext.EsRepCase.Add(repCase);
                _pinhuaContext.Warehouse.Add(main);
                _pinhuaContext.SaveChanges();

                return(RedirectToPage("Index"));
            }
            else
            {
                return(Page());
            }
        }
Exemplo n.º 3
0
        public IActionResult OnPost()
        {
            if (ModelState.IsValid)
            {
                var Rcid    = _pinhuaContext.GetNewRcId();
                var rtId    = "178.1";
                var repCase = new EsRepCase
                {
                    RcId          = Rcid,
                    RtId          = rtId,
                    LstFiller     = 2,
                    LstFillerName = User.Identity.Name,
                    LstFillDate   = DateTime.Now,
                    //fillDate = DateTime.Now,
                    //wiId = "",
                    //state = 1,
                };

                var main = _mapper.Map <ProductRegistrationDTO, ProductRegistrationMain>(ProductRegistrationInfo);
                main.ExcelServerRcid = Rcid;
                main.ExcelServerRtid = rtId;

                _pinhuaContext.EsRepCase.Add(repCase);
                _pinhuaContext.ProductRegistrationMain.Add(main);
                _pinhuaContext.SaveChanges();

                return(RedirectToPage("Index"));
            }
            else
            {
                return(Page());
            }
        }
Exemplo n.º 4
0
        public IActionResult OnPost()
        {
            if (ModelState.IsValid)
            {
                var Rcid    = _pinhuaContext.GetNewRcId();
                var rtId    = "157.1";
                var repCase = new EsRepCase
                {
                    RcId          = Rcid,
                    RtId          = rtId,
                    LstFiller     = 2,
                    LstFillerName = User.Identity.Name,
                    LstFillDate   = DateTime.Now,
                    //fillDate = DateTime.Now,
                    //wiId = "",
                    //state = 1,
                };

                var main = _mapper.Map <Gi2MainDTO, Gi2Main>(Order.Main);
                main.ExcelServerRcid = Rcid;
                main.ExcelServerRtid = rtId;
                main.CustomerName    = _pinhuaContext.往来单位.AsNoTracking().FirstOrDefault(p => p.单位编号 == Order.Main.CustomerId).单位名称;

                var details = _mapper.Map <List <Gi2DetaislDTO>, List <Gi2Details> >(Order.Details);
                details.ForEach(i =>
                {
                    i.ExcelServerRcid = Rcid;
                    i.ExcelServerRtid = rtId;
                    i.DeliveryId      = main.DeliveryId;
                });

                if (details.Count == 0)
                {
                    ModelState.AddModelError("", "出库清单不可为空");
                    DeliveryTypes      = BuildTypes();
                    CustomerSelectList = _pinhuaContext.GetCustomerSelectList();
                    ContactsSelectList = _pinhuaContext.GetContactsSelectList();
                    return(Page());
                }
                _pinhuaContext.EsRepCase.Add(repCase);
                _pinhuaContext.Gi2Main.Add(main);
                _pinhuaContext.Gi2Details.AddRange(details);
                _pinhuaContext.SaveChanges();

                return(RedirectToPage("Index"));
            }
            else
            {
                DeliveryTypes      = BuildTypes();
                CustomerSelectList = _pinhuaContext.GetCustomerSelectList();
                ContactsSelectList = _pinhuaContext.GetContactsSelectList();
                return(Page());
            }
        }
Exemplo n.º 5
0
        public IActionResult OnPost()
        {
            if (ModelState.IsValid)
            {
                var Rcid    = _pinhuaContext.GetNewRcId();
                var rtId    = "175.1";
                var repCase = new EsRepCase
                {
                    RcId          = Rcid,
                    RtId          = rtId,
                    LstFiller     = 2,
                    LstFillerName = User.Identity.Name,
                    LstFillDate   = DateTime.Now,
                    //fillDate = DateTime.Now,
                    //wiId = "",
                    //state = 1,
                };

                var main = _mapper.Map <ProductionStockInMainDTO, StockInMain>(Order.Main);
                main.ExcelServerRcid = Rcid;
                main.ExcelServerRtid = rtId;
                main.MovementType    = "131";

                var details = _mapper.Map <List <ProductionStockInDetailsDTO>, List <StockInDetails> >(Order.Details);
                details.ForEach(i =>
                {
                    i.ExcelServerRcid = Rcid;
                    i.ExcelServerRtid = rtId;
                    i.OrderId         = main.OrderId;
                });

                if (details.Count == 0)
                {
                    ModelState.AddModelError("", "清单不可为空");
                    Order.MovementTypeList = BuildTypes();
                    Order.CustomerList     = _pinhuaContext.GetCustomerSelectList();
                    Order.WarehouseList    = _pinhuaContext.GetWarehouseSelectList();
                    return(Page());
                }
                _pinhuaContext.EsRepCase.Add(repCase);
                _pinhuaContext.StockInMain.Add(main);
                _pinhuaContext.StockInDetails.AddRange(details);
                _pinhuaContext.SaveChanges();

                return(RedirectToPage("Index"));
            }
            else
            {
                Order.MovementTypeList = BuildTypes();
                Order.CustomerList     = _pinhuaContext.GetCustomerSelectList();
                Order.WarehouseList    = _pinhuaContext.GetWarehouseSelectList();
                return(Page());
            }
        }
Exemplo n.º 6
0
        public IActionResult OnPost()
        {
            if (ModelState.IsValid)
            {
                var Rcid    = _pinhuaContext.GetNewRcId();
                var rtId    = _pinhuaContext.GetRtId("入库简易版");
                var repCase = new EsRepCase
                {
                    RcId          = Rcid,
                    RtId          = rtId,
                    LstFiller     = 2,
                    LstFillerName = User.Identity.Name,
                    LstFillDate   = DateTime.Now,
                    //fillDate = DateTime.Now,
                    //wiId = "",
                    //state = 1,
                };
                var main = _mapper.Map <Gr2MainDto, Gr2Main>(Purchasing.Main);
                main.ExcelServerRcid = Rcid;
                main.ExcelServerRtid = rtId;
                main.SupplierName    = _pinhuaContext.往来单位.AsNoTracking().FirstOrDefault(p => p.单位编号 == main.Supplier).单位名称;

                var details = _mapper.Map <List <Gr2DetailsDto>, List <Gr2Details> >(Purchasing.Details);
                details.ForEach(i =>
                {
                    i.ExcelServerRcid = Rcid;
                    i.ExcelServerRtid = rtId;
                    i.PurchasingId    = main.PurchasingId;
                });

                if (Purchasing.Details.Count == 0)
                {
                    ModelState.AddModelError("", "采购清单不可为空");
                    PurchasingTypes = buildPurchasingTypes();
                    SupplierList    = _pinhuaContext.GetCustomerSelectList();
                    return(Page());
                }
                _pinhuaContext.EsRepCase.Add(repCase);
                _pinhuaContext.Gr2Main.Add(main);
                _pinhuaContext.Gr2Details.AddRange(details);
                _pinhuaContext.SaveChanges();

                return(RedirectToPage("Index"));
            }
            else
            {
                PurchasingTypes = buildPurchasingTypes();
                SupplierList    = _pinhuaContext.GetCustomerSelectList();
                return(Page());
            }
        }
Exemplo n.º 7
0
        public IActionResult OnPost()
        {
            var year = DateTime.Now.ToString("yy");

            var exsistedIds = (from p in _pinhuaContext.收款单
                               where p.收款单号.Substring(0, 4) == "SK" + year
                               orderby p.收款单号 descending
                               select p.收款单号)
                              .ToList();
            var orderIndex = int.Parse(exsistedIds.Count() == 0 ? "0" : exsistedIds.First().Substring(4, 6)) + 1;

            var name = _pinhuaContext.往来单位.FirstOrDefault(x => x.单位编号 == Collection.单位编号)?.单位名称;

            Collection.收款单号 = "SK" + year + orderIndex.ToString("D6");
            Collection.收款单位 = name;

            var rcId    = _pinhuaContext.GetNewRcId();
            var rtId    = _pinhuaContext.GetRtId("收款单");
            var repCase = new EsRepCase
            {
                RcId          = rcId,
                RtId          = rtId,
                LstFiller     = 2,
                LstFillerName = User.Identity.Name,
                LstFillDate   = DateTime.Now,
                FillDate      = DateTime.Now,
            };

            Collection.ExcelServerRcid = rcId;
            Collection.ExcelServerRtid = rtId;

            _pinhuaContext.EsRepCase.Add(repCase);
            _pinhuaContext.收款单.Add(Collection);
            _pinhuaContext.SaveChanges();

            return(RedirectToPage("Index"));
        }
Exemplo n.º 8
0
        public IActionResult OnPost(int yyyy, int mm, string jsonStr)
        {
            if (string.IsNullOrEmpty(jsonStr))
            {
                return(Page());
            }
            var Payrolls = Newtonsoft.Json.JsonConvert.DeserializeObject <IList <PayrollDetailsDTO> >(jsonStr);

            if (Payrolls == null)
            {
                return(Page());
            }

            var Rcid    = _pinhuaContext.GetNewRcId();
            var rtId    = _pinhuaContext.GetRtId("工资单");
            var repCase = new EsRepCase
            {
                RcId          = Rcid,
                RtId          = rtId,
                LstFiller     = 2,
                LstFillerName = User.Identity.Name,
                LstFillDate   = DateTime.Now,
            };

            var payrollMain = new PayrollMain
            {
                ExcelServerRcid = Rcid,
                ExcelServerRtid = rtId,
                Y = yyyy,
                M = mm
            };

            var payrollDetails = new List <PayrollDetails>();

            foreach (var payroll in Payrolls)
            {
                var pd = new PayrollDetails
                {
                    ExcelServerRcid = Rcid,
                    ExcelServerRtid = rtId,
                    Y = yyyy,
                    M = mm,
                };
                _mapper.Map <PayrollDetailsDTO, PayrollDetails>(payroll, pd);
                payrollDetails.Add(pd);
            }

            _pinhuaContext.EsRepCase.Add(repCase);
            _pinhuaContext.PayrollMain.Add(payrollMain);
            _pinhuaContext.PayrollDetails.AddRange(payrollDetails);
            try
            {
                _pinhuaContext.SaveChanges();
            }
            catch (DbUpdateException e)
            {
                ModelState.AddModelError("", e.InnerException.Message);
                return(Page());
            }

            return(RedirectToPage("Index"));
        }
Exemplo n.º 9
0
        public IActionResult OnPost(string jsonStr)
        {
            if (string.IsNullOrEmpty(jsonStr))
            {
                return(Page());
            }
            var data = Newtonsoft.Json.JsonConvert.DeserializeObject <AttendanceServiceDTO>(jsonStr);

            if (data == null)
            {
                return(Page());
            }


            var Rcid    = _pinhuaContext.GetNewRcId();
            var rtId    = _pinhuaContext.GetRtId("AttendanceReport");
            var repCase = new EsRepCase
            {
                RcId          = Rcid,
                RtId          = rtId,
                LstFiller     = 2,
                LstFillerName = User.Identity.Name,
                LstFillDate   = DateTime.Now,
            };

            var reportMain = new AttendanceReport
            {
                ExcelServerRcid = Rcid,
                ExcelServerRtid = rtId,
                Y = data.Y.Value,
                M = data.M.Value
            };

            var reportDetails = new List <AttendanceReportResults>();

            foreach (var person in data.PersonList)
            {
                var detail = new AttendanceReportResults
                {
                    ExcelServerRcid = Rcid,
                    ExcelServerRtid = rtId,
                    Y    = data.Y.Value,
                    M    = data.M.Value,
                    编号   = person.Id,
                    姓名   = person.Name,
                    是否全勤 = person.IsFullAttendance ? "是" : "否",
                    正班   = person.DaytimeHours,
                    加班   = person.OvertimeHours,
                    总工时  = person.TotalHours,
                    缺勤   = person.TimesOfAbsent,
                    迟到   = person.TimesOfLate,
                    早退   = person.TimesOfLeaveEarly,
                    请假   = person.TimesOfAskForLeave,
                    用餐   = person.TimesOfDinner,
                };
                reportDetails.Add(detail);
            }
            // 保存明细
            var abc = new List <AttendanceReportDetails>();

            foreach (var person in data.PersonList)
            {
                foreach (var detail in person.Results)
                {
                    foreach (var range in detail.Details)
                    {
                        var o = new AttendanceReportDetails
                        {
                            编号              = person.Id,
                            姓名              = person.Name,
                            日期              = detail.Date,
                            班段              = range.RangeId,
                            班段描述            = range.Range,
                            班               = range.Time1Fix,
                            班               = range.Time2Fix,
                            工时              = range.Hours,
                            考勤结果            = range.State,
                            ExcelServerRcid = Rcid,
                            ExcelServerRtid = rtId,
                        };
                        abc.Add(o);
                    }
                }
            }

            _pinhuaContext.EsRepCase.Add(repCase);
            _pinhuaContext.AttendanceReport.Add(reportMain);
            _pinhuaContext.AttendanceReportResults.AddRange(reportDetails);
            _pinhuaContext.AttendanceReportDetails.AddRange(abc);
            _pinhuaContext.SaveChanges();

            return(RedirectToPage("Index"));
        }
Exemplo n.º 10
0
        public IActionResult OnPost()
        {
            if (ModelState.IsValid)
            {
                var Rcid    = _pinhuaContext.GetNewRcId();
                var rtId    = "179.1";
                var repCase = new EsRepCase
                {
                    RcId          = Rcid,
                    RtId          = rtId,
                    LstFiller     = 2,
                    LstFillerName = "*****@*****.**",
                    LstFillDate   = DateTime.Now,
                    //fillDate = DateTime.Now,
                    //wiId = "",
                    //state = 1,
                };

                var main = _mapper.Map <dto生产单M, 生产单>(Order.M);
                main.单号 = _pinhuaContext.GetZkyAutoId(181);
                main.ExcelServerRcid = Rcid;
                main.ExcelServerRtid = rtId;
                main.客户名             = _pinhuaContext.往来单位.AsNoTracking().FirstOrDefault(p => p.单位编号 == Order.M.客户号).单位名称;

                if (Order?.D?.Count == 0)
                {
                    ModelState.AddModelError("", "产品清单不可为空");
                    PartnerSelectList = _pinhuaContext.GetCustomerSelectList();
                    return(Page());
                }

                foreach (var d in Order.D)
                {
                    var newRecord = new 生产单d
                    {
                        ExcelServerRcid = Rcid,
                        ExcelServerRtid = rtId,
                        长      = d.长,
                        宽      = d.宽,
                        高      = d.高,
                        片数     = d.片数,
                        刻线要求   = d.刻线要求,
                        拉丝要求   = d.拉丝要求,
                        开槽要求   = d.开槽要求,
                        油漆要求   = d.油漆要求,
                        描述     = d.描述,
                        其他要求   = d.其他要求,
                        是否刻线   = d.是否刻线,
                        是否拉丝   = d.是否拉丝,
                        是否开槽   = d.是否开槽,
                        是否油漆   = d.是否油漆,
                        图片name = d.图片name,
                        图片type = d.图片type,
                    };
                    if (!string.IsNullOrEmpty(d.图片base64))   // base64非空,插入图片
                    {
                        var picNo     = _pinhuaContext.GetNewPicNo();
                        var newBase64 = d.图片base64.Substring(d.图片base64.IndexOf(',') + 1);
                        _pinhuaContext.EsCasePic.Add(new EsCasePic
                        {
                            RcId        = Rcid,
                            PicNo       = picNo,
                            Img         = Convert.FromBase64String(newBase64),
                            FileType    = string.IsNullOrEmpty(d.图片name) ? ".jpg" : d.图片name.Substring(d.图片name.LastIndexOf(".")),
                            RtfId       = 2573,
                            Sh          = 2,
                            R           = 21,
                            C           = 51,
                            IsNew       = 0,
                            Rng         = null,
                            SaveInto    = 0,
                            NfsfolderId = 0,
                            Nfsfolder   = "",
                            PhyFileName = "",
                            RelaFolder  = ""
                        });
                        newRecord.图片 = picNo;
                    }
                    _pinhuaContext.生产单d.Add(newRecord);
                }
                _pinhuaContext.EsRepCase.Add(repCase);
                _pinhuaContext.生产单.Add(main);
                _pinhuaContext.SaveChanges();

                return(RedirectToPage("Index"));
            }
            else
            {
                PartnerSelectList = _pinhuaContext.GetCustomerSelectList();
                return(Page());
            }
        }