public void Updateline(PM_BPM_LINE definitions)
        {
            definitions.CreatedOn = DateTime.Now;
            try
            {
                if (string.IsNullOrEmpty(definitions.PlantID))
                {
                    definitions.PlantID = "H006";
                }
                definitions.UpdatedOn = DateTime.Now;
                if (string.IsNullOrEmpty(definitions.UpdatedBy))
                {
                    definitions.UpdatedBy = definitions.CreatedBy;
                }
                if (string.IsNullOrEmpty(definitions.WorkshopGuid.ToString()))
                {
                    IPM_BPM_WORKSHOPBO         WorkShopBO = ObjectContainer.BuildUp <IPM_BPM_WORKSHOPBO>();
                    PM_BPM_WORKSHOP_QueryParam pm         = new PM_BPM_WORKSHOP_QueryParam();
                    pm.WorkshopID = definitions.DepartID;
                    IList <PM_BPM_WORKSHOP> nn = WorkShopBO.GetEntities(pm);

                    if (nn.Count > 0)
                    {
                        definitions.WorkshopGuid = nn[0].WorkshopGuid;
                    }
                }
                //definitions.WorkshopGuid = definitions.CreatedBy;
                linebo.Update(definitions);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public HttpResponseMessage Addline(PM_BPM_LINE definitions)
        {
            definitions.CreatedOn = DateTime.Now;
            CV_BPM_LINE_QueryParam lineQueray = new CV_BPM_LINE_QueryParam();

            lineQueray.LineID = definitions.LineID;

            IList <CV_BPM_LINE> list = lineBO.GetEntities(lineQueray);

            if (list.Count != 0)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "该产线已经存在"));
            }
            else
            {
                definitions.CreatedOn = DateTime.Now;
                definitions.LineGuid  = Guid.NewGuid();
                if (string.IsNullOrEmpty(definitions.PlantID))
                {
                    definitions.PlantID = "H006";
                }
                definitions.UpdatedOn = DateTime.Now;
                if (string.IsNullOrEmpty(definitions.UpdatedBy))
                {
                    definitions.UpdatedBy = definitions.CreatedBy;
                }
                if (string.IsNullOrEmpty(definitions.WorkshopGuid.ToString()))
                {
                    IPM_BPM_WORKSHOPBO         WorkShopBO = ObjectContainer.BuildUp <IPM_BPM_WORKSHOPBO>();
                    PM_BPM_WORKSHOP_QueryParam pm         = new PM_BPM_WORKSHOP_QueryParam();
                    pm.WorkshopID = definitions.DepartID;
                    IList <PM_BPM_WORKSHOP> nn = WorkShopBO.GetEntities(pm);

                    if (nn.Count > 0)
                    {
                        definitions.WorkshopGuid = nn[0].WorkshopGuid;
                    }
                }

                PM_BPM_LINE mmExt = linebo.Insert(definitions);
                if (mmExt != null)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, "新增成功"));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.InternalServerError, "新增失败"));
                }
            }
        }
 public string SetLineSecurityTime(CV_BPM_LINE line)
 {
     try
     {
         PM_BPM_LINE lineModel = new PM_BPM_LINE();
         lineModel.LineGuid     = line.LineGuid;
         lineModel.LineID       = line.LineName;
         lineModel.MaxStockTime = line.MaxStockTime;
         lineModel.MinStockTime = line.MinStockTime;
         LineBO.UpdateSome(lineModel);
         return("设置成功!");
     }
     catch (Exception ex)
     {
         return("设置失败" + ex.Message);
     }
 }
        public IList <PM_BPM_LINE> GetAllLine()
        {
            IList <PM_BPM_LINE> list = new List <PM_BPM_LINE>();
            //list = LineBO.GetAll();
            string     sql        = @"SELECT [LineID], [LineName], [LineType], [LineDesc] FROM dbo.PM_BPM_LINE  WHERE RowDeleted = '0' OR RowDeleted is null ";
            ICO_BSC_BO _CO_BSC_BO = ObjectContainer.BuildUp <ICO_BSC_BO>();
            DataTable  dt         = _CO_BSC_BO.GetDataTableBySql(sql);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                PM_BPM_LINE line = new PM_BPM_LINE();
                line.LineID   = dt.Rows[i]["LineID"].ToString();
                line.LineName = dt.Rows[i]["LineName"].ToString();
                line.LineType = dt.Rows[i]["LineType"].ToString();
                line.LineDesc = dt.Rows[i]["LineDesc"].ToString();
                list.Add(line);
            }
            //log.Debug(JsonConvert.SerializeObject(list));
            return(list);
        }