Exemple #1
0
        public ActionResult SaveQita1(int QuotationId, int?SeqNo, string QuotationType, int ProjectId, int SupplierId)
        {
            if (QuotationId == 0)
            {//新增确认单
                QuotationId = SaveQuotationMst(QuotationType, ProjectId, SupplierId);
                int seqNo  = 1;
                var maxOne = db.Quotation_Qita1_Dtl.Where(x => x.QuotationId == QuotationId)
                             .OrderByDescending(x => x.SeqNO).Select(x => x.SeqNO).FirstOrDefault();
                if (maxOne > 0)
                {
                    seqNo = maxOne + 1;
                }
                Quotation_Qita1_Dtl dtl = new Quotation_Qita1_Dtl();
                TryUpdateModel <Quotation_Qita1_Dtl>(dtl);
                dtl.SeqNO       = seqNo;
                dtl.QuotationId = QuotationId;
                dtl.InDateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                db.Quotation_Qita1_Dtl.Add(dtl);
            }
            else
            {
                Quotation_Qita1_Dtl dtl = new Quotation_Qita1_Dtl();
                dtl = db.Quotation_Qita1_Dtl.Find(QuotationId, SeqNo);
                TryUpdateModel <Quotation_Qita1_Dtl>(dtl);
            }

            db.SaveChanges();
            return(Json(new { QuotationId = QuotationId }));;
        }
Exemple #2
0
        public ActionResult FindQita1(int QuotationId, int?SeqNo)
        {
            Quotation_Qita1_Dtl dtl = new Quotation_Qita1_Dtl();

            if (QuotationId > 0)
            {
                dtl = db.Quotation_Qita1_Dtl.Find(QuotationId, SeqNo);
            }
            return(Json(dtl, JsonRequestBehavior.AllowGet));
        }
Exemple #3
0
        public ActionResult SaveQita1(string jsonArr, string ProjectId, string SupplierId, string GroupId)
        {
            //List<Quotation_Qita1_Dtl> lst = JsonConvert.DeserializeObject<List<Quotation_Qita1_Dtl>>(jsonArr);
            List <Quotation_QiTa1Dto> lstDto = JsonConvert.DeserializeObject <List <Quotation_QiTa1Dto> >(jsonArr);

            foreach (Quotation_QiTa1Dto dtl_dto in lstDto)
            {
                Quotation_Qita1_Dtl dtl = AutoMapperHelper.MapTo <Quotation_Qita1_Dtl>(dtl_dto);
                int QuotationId         = SaveQuotationMst(GroupId, ProjectId, dtl_dto.SupplierId, "Qita1");
                if (dtl.QuotationId == 0 && dtl.SeqNO == 0)
                {
                    int seqNo  = 1;
                    var maxOne = db.Quotation_Qita1_Dtl.Where(x => x.QuotationId == QuotationId)
                                 .OrderByDescending(x => x.SeqNO).Select(x => x.SeqNO).FirstOrDefault();
                    if (maxOne > 0)
                    {
                        seqNo = maxOne + 1;
                    }

                    dtl.QuotationId = QuotationId;
                    dtl.SeqNO       = seqNo;
                    dtl.InDateTime  = DateTime.Now;
                    dtl.InUserId    = UserInfo.UserId;
                    db.Quotation_Qita1_Dtl.Add(dtl);

                    db.SaveChanges();
                }
                else
                {
                    Quotation_Qita1_Dtl findOne = db.Quotation_Qita1_Dtl.Find(dtl.QuotationId, dtl.SeqNO);
                    if (findOne != null)
                    {
                        findOne.shuliang = dtl.shuliang;
                        findOne.danjia   = dtl.danjia;
                        findOne.beizhu   = dtl.beizhu;
                    }
                    db.SaveChanges();
                }
            }

            return(Json(""));
        }
Exemple #4
0
        public ActionResult QuotationGroupCopy(string SourceGroupId, string TargetGroupId, string ProjectId)
        {
            int seqNo = 0;
            //Biancheng
            List <Quotation_BianChengDto> bianchengList = quotationService.Quotation_BianChengCopySearch(TargetGroupId, SourceGroupId);

            foreach (Quotation_BianChengDto dto in bianchengList)
            {
                Quotation_Biancheng_Dtl dtl = AutoMapperHelper.MapTo <Quotation_Biancheng_Dtl>(dto);
                seqNo++;
                dtl.SeqNO       = seqNo;
                dtl.InDateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                dtl.QuotationId = SaveQuotationMst("Biancheng", ProjectId, dto.SupplierId, TargetGroupId);
                db.Quotation_Biancheng_Dtl.Add(dtl);
            }
            //ZhiXing
            seqNo = 0;
            List <Quotation_ZhiXingDto> zhixingList = quotationService.Quotation_ZhiXingCopySearch(TargetGroupId, SourceGroupId);

            foreach (Quotation_ZhiXingDto dto in zhixingList)
            {
                Quotation_Zhixing_Dtl dtl = AutoMapperHelper.MapTo <Quotation_Zhixing_Dtl>(dto);
                seqNo++;
                dtl.SeqNO       = seqNo;
                dtl.InDateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                dtl.QuotationId = SaveQuotationMst("Zhixing", ProjectId, dto.SupplierId, TargetGroupId);
                db.Quotation_Zhixing_Dtl.Add(dtl);
            }
            //Fuhe
            seqNo = 0;
            List <Quotation_FuHeDto> fuheList = quotationService.Quotation_FuHeCopySearch(TargetGroupId, SourceGroupId);

            foreach (Quotation_FuHeDto dto in fuheList)
            {
                Quotation_Fuhe_Dtl dtl = AutoMapperHelper.MapTo <Quotation_Fuhe_Dtl>(dto);
                seqNo++;
                dtl.SeqNO       = seqNo;
                dtl.InDateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                dtl.QuotationId = SaveQuotationMst("Fuhe", ProjectId, dto.SupplierId, TargetGroupId);
                db.Quotation_Fuhe_Dtl.Add(dtl);
            }
            //Yanjiu
            seqNo = 0;
            List <Quotation_YanJiuDto> yanjiuList = quotationService.Quotation_YanJiuCopySearch(TargetGroupId, SourceGroupId);

            foreach (Quotation_YanJiuDto dto in yanjiuList)
            {
                Quotation_Yanjiu_Dtl dtl = AutoMapperHelper.MapTo <Quotation_Yanjiu_Dtl>(dto);
                seqNo++;
                dtl.SeqNO       = seqNo;
                dtl.InDateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                dtl.QuotationId = SaveQuotationMst("Yanjiu", ProjectId, dto.SupplierId, TargetGroupId);
                db.Quotation_Yanjiu_Dtl.Add(dtl);
            }
            //Qita1
            seqNo = 0;
            List <Quotation_QiTa1Dto> qita1List = quotationService.Quotation_QiTa1CopySearch(TargetGroupId, SourceGroupId);

            foreach (Quotation_QiTa1Dto dto in qita1List)
            {
                Quotation_Qita1_Dtl dtl = AutoMapperHelper.MapTo <Quotation_Qita1_Dtl>(dto);
                seqNo++;
                dtl.SeqNO       = seqNo;
                dtl.InDateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                dtl.QuotationId = SaveQuotationMst("Qita1", ProjectId, dto.SupplierId, TargetGroupId);
                db.Quotation_Qita1_Dtl.Add(dtl);
            }
            //Qita2
            seqNo = 0;
            List <Quotation_QiTa2Dto> qita2List = quotationService.Quotation_QiTa2CopySearch(TargetGroupId, SourceGroupId);

            foreach (Quotation_QiTa2Dto dto in qita2List)
            {
                Quotation_Qita2_Dtl dtl = AutoMapperHelper.MapTo <Quotation_Qita2_Dtl>(dto);
                seqNo++;
                dtl.SeqNO       = seqNo;
                dtl.InDateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                dtl.QuotationId = SaveQuotationMst("Qita2", ProjectId, dto.SupplierId, TargetGroupId);
                db.Quotation_Qita2_Dtl.Add(dtl);
            }
            //Chezhan
            seqNo = 0;
            List <Quotation_CheZhanDto> chezhanList = quotationService.Quotation_ChezhanCopySearch(TargetGroupId, SourceGroupId);

            foreach (Quotation_CheZhanDto dto in chezhanList)
            {
                Quotation_Chezhan_Dtl dtl = AutoMapperHelper.MapTo <Quotation_Chezhan_Dtl>(dto);
                seqNo++;
                dtl.SeqNO       = seqNo;
                dtl.IndateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                dtl.QuotationId = SaveQuotationMst("Chezhan", ProjectId, dto.SupplierId, TargetGroupId);
                db.Quotation_Chezhan_Dtl.Add(dtl);
            }
            //Zhichi
            seqNo = 0;
            List <ZhiChi01Dto> zhichiList = quotationService.Quotation_ZhichiCopySearch(TargetGroupId, SourceGroupId);

            foreach (ZhiChi01Dto dto in zhichiList)
            {
                Quotation_Zhichi_Dtl dtl = AutoMapperHelper.MapTo <Quotation_Zhichi_Dtl>(dto);
                seqNo++;
                dtl.SeqNO       = seqNo;
                dtl.InDateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                dtl.QuotationId = SaveQuotationMst("Zhichi", ProjectId, dto.SupplierId, TargetGroupId);
                db.Quotation_Zhichi_Dtl.Add(dtl);
            }
            db.SaveChanges();

            return(Json(""));
        }