public string Updatesection(PM_BPM_SECTION definitions)
 {
     try
     {
         //根据LineID获取LineName
         PM_BPM_LINE_QueryParam param = new PM_BPM_LINE_QueryParam();
         param.LineID = definitions.LineID;
         IList <PM_BPM_LINE> lineList = lineBO.GetEntities(param);
         if (lineList.Count != 0)
         {
             definitions.LineName  = lineList[0].LineName;
             definitions.UpdatedBy = definitions.UpdatedBy;
             definitions.UpdatedOn = SSGlobalConfig.Now;
             sectionBO.UpdateSome(definitions);
             return("更新成功!");
         }
         else
         {
             return("更新失败,未找到对应的产线");
         }
     }
     catch (Exception ex)
     {
         return("系统错误:" + ex.Message);
     }
 }
 public IList <PM_BPM_TERMINAL> GetLineTermByLineID(PM_BPM_SECTION param)
 {
     try
     {
         //根据LineID查询LineGuid
         PM_BPM_LINE_QueryParam qryModel = new PM_BPM_LINE_QueryParam();
         qryModel.LineID = param.LineID;
         IList <PM_BPM_LINE> lineList = lineBO.GetEntities(qryModel);
         if (lineList.Count != 0)
         {
             PM_BPM_TERMINAL_QueryParam qrypmModel = new PM_BPM_TERMINAL_QueryParam();
             qrypmModel.LineGuid = lineList[0].LineGuid;
             IList <PM_BPM_TERMINAL> termList  = termialBO.GetEntities(qrypmModel);
             List <PM_BPM_TERMINAL>  finalList = (from l in termList
                                                  orderby l.TerminalID
                                                  select l).ToList();
             return(finalList);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
        public IList <PM_BPM_LINE> GetLine(PM_BPM_LINE_QueryParam line) //传入的参数是对象,用Post,不能用Get
        {
            IList <PM_BPM_LINE> list = new List <PM_BPM_LINE>();

            if (line != null)
            {
                list = LineBO.GetEntities(line);
                return(list);
            }
            return(list);
        }
        public HttpResponseMessage Addsection(PM_BPM_SECTION definitions)
        {
            try
            {
                definitions.CreatedOn = DateTime.Now;
                PM_BPM_SECTION_QueryParam sectionQueray = new PM_BPM_SECTION_QueryParam();
                sectionQueray.SectionID = definitions.SectionID;
                IList <PM_BPM_SECTION> list = sectionBO.GetEntities(sectionQueray);
                if (list.Count != 0)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, "该工段已经存在"));
                }
                else
                {
                    //根据LineID获取LineName
                    PM_BPM_LINE_QueryParam param = new PM_BPM_LINE_QueryParam();
                    param.LineID = definitions.LineID;
                    IList <PM_BPM_LINE> lineList = lineBO.GetEntities(param);
                    if (lineList.Count != 0)
                    {
                        definitions.LineName    = lineList[0].LineName;
                        definitions.SectionGuid = Guid.NewGuid();
                        definitions.UpdatedBy   = definitions.CreatedBy;
                        definitions.UpdatedOn   = definitions.CreatedOn;
                        definitions.IsDefect    = false;

                        PM_BPM_SECTION mmExt = sectionBO.Insert(definitions);
                        if (mmExt != null)
                        {
                            return(Request.CreateResponse(HttpStatusCode.OK, "新增成功"));
                        }
                        else
                        {
                            return(Request.CreateResponse(HttpStatusCode.InternalServerError, "新增失败"));
                        }
                    }
                    else
                    {
                        return(Request.CreateResponse(HttpStatusCode.InternalServerError, "新增失败,未找到对应的产线"));
                    }
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, "系统错误:" + ex.Message));
            }
        }