Exemplo n.º 1
0
        public Wps GenWps(Wps input)
        {
            Context db  = new Context();
            var     wps = db.Wpses
                          .Include(x => x.ParamList)
                          .Where(o => o.JointForm == input.JointForm &&
                                 o.ApprovalState == ApprovalState.审核通过 &&
                                 o.WeldMethod == input.WeldMethod &&
                                 o.ProcName == input.ProcName &&
                                 ((o.Material1 == input.Material1 &&
                                   o.Material2 == input.Material2 &&
                                   o.Thick1 == input.Thick1 &&
                                   o.Thick2 == input.Thick2) ||
                                  (o.Material1 == input.Material2 &&
                                   o.Material2 == input.Material1 &&
                                   o.Thick1 == input.Thick2 &&
                                   o.Thick2 == input.Thick1)))
                          .FirstOrDefault();

            if (wps != null)
            {
                input.CloneFrom = wps.Id;
                input.ParamList = wps.ParamList;
            }

            return(input);
        }
Exemplo n.º 2
0
        public void CreateWps(string userId, Wps wps)
        {
            Context db = new Context();

            wps.MakeTime      = DateTime.Now;
            wps.CurrTestSeqNo = null;
            wps.Tests         = null;
            wps.TestState     = TestState.尚未进行;
            if (wps.CloneFrom != null)
            {
                var w = new Context().Wpses
                        .Include(x => x.ParamList)
                        .SingleOrDefault(x => x.Id == wps.CloneFrom);

                if (w == null)
                {
                    throw new Exception("用于复制的源工艺规程不存在");
                }

                wps.ParamList = w.CloneParams();
            }

            db.Wpses.Add(wps);
            db.SaveChanges();
        }
Exemplo n.º 3
0
 public void PdmCreateWps(string pdmToken, string pdmUserId, Wps wps)
 {
     if (pdmToken != GlobalData.Token)
     {
         throw new Exception("没有PDM权限");
     }
     CreateWps(pdmUserId, wps);
 }
Exemplo n.º 4
0
 public Wps PdmGenWps(string pdmToken, Wps input)
 {
     if (pdmToken != GlobalData.Token)
     {
         throw new Exception("没有PDM权限");
     }
     return(GenWps(input));
 }
Exemplo n.º 5
0
 public Wps GenWps(Wps input)
 {
     return(new Deduction().GenWps(input));
 }