Пример #1
0
        /// <summary>
        /// 获取产品批次列表
        /// </summary>
        /// <param name="condition">条件</param>
        /// <param name="page">数据页</param>
        /// <returns>数据页</returns>
        public DataPage GetList(ProducePlan condition, DataPage page)
        {
            string sql = null;
            List <DataParameter> parameters = new List <DataParameter>();

            try
            {
                sql = this.GetQuerySql(condition, ref parameters);
                //分页关键字段及排序
                page.KeyName = "PID";
                if (string.IsNullOrEmpty(page.SortExpression))
                {
                    page.SortExpression = "UPDATETIME DESC";
                }
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    page = session.GetDataPage <ProducePlan>(sql, parameters.ToArray(), page);
                }
                return(page);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        private void BindData()
        {
            string         id   = Request.QueryString["id"];
            ProducePlanBLL bll  = null;
            ProducePlan    info = new ProducePlan();

            try
            {
                bll = BLLFactory.CreateBLL <ProducePlanBLL>();
                if (string.IsNullOrEmpty(id) == false)
                {
                    info.PID = id;
                    info     = bll.Get(info);

                    UIBindHelper.BindForm(this.Page, info);
                    this.PLANDATE.Text      = info.PLANDATE.ToString("yyyy-MM-dd");
                    this.hiID.Value         = info.PID;
                    this.HiCREATEUSER.Value = info.CREATEUSER;
                    this.HiCREATETIME.Value = info.CREATETIME.ToString();
                }
                else
                {
                    info = new ProducePlan();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
        private void BindData()
        {
            DataPage       dp        = new DataPage();
            ProducePlan    condition = new ProducePlan();
            ProducePlanBLL bll       = null;

            try
            {
                bll = BLLFactory.CreateBLL <ProducePlanBLL>();
                condition.FACTORYPID   = this.FACTORYPID.SelectedValue;
                condition.PRID         = this.PRID.SelectedValue;
                condition.PRODUCTIONID = this.PRODUCTIONID.SelectedValue;
                PagerHelper.InitPageControl(this.AspNetPager1, dp, true);
                dp = bll.GetList(condition, dp);
                List <ProducePlan> list = dp.Result as List <ProducePlan>;
                this.GvList.DataSource = list;
                this.GvList.DataBind();

                for (int i = 0; i < this.GvList.Rows.Count; i++)
                {
                    string click = string.Format("return edit('{0}');", this.GvList.DataKeys[i]["PID"].ToString());

                    (this.GvList.Rows[i].Cells[7].Controls[0] as WebControl).Attributes.Add("onclick", click);
                }
                PagerHelper.SetPageControl(AspNetPager1, dp, true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #4
0
        protected void btSave_Click(object sender, EventArgs e)
        {
            ProducePlan    info = new ProducePlan();
            ProducePlanBLL bll  = null;

            try
            {
                UIBindHelper.BindModelByControls(this.Page, info);

                bll = BLLFactory.CreateBLL <ProducePlanBLL>();

                if (this.hiID.Value == "")
                {
                    bll.Insert(info);
                }
                else
                {
                    info.CREATEUSER = this.HiCREATEUSER.Value;
                    info.CREATETIME = DateTime.Parse(this.HiCREATETIME.Value);
                    info.PID        = this.hiID.Value;
                    bll.Update(info);
                }

                ClientScript.RegisterStartupScript(this.GetType(), "myjs", "parent.refreshData();parent.closeAppWindow1();", true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #5
0
 /// <summary>
 /// 删除信息
 /// </summary>
 /// <param name="">信息</param>
 /// <returns>删除个数</returns>
 public int DeleteProducePlan(ProducePlan model)
 {
     try
     {
         return(new ProducePlanDAL().Delete(model));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #6
0
 /// <summary>
 /// 获取信息
 /// </summary>
 /// <param name="">条件</param>
 /// <returns>信息</returns>
 public ProducePlan Get(ProducePlan model)
 {
     try
     {
         return(new ProducePlanDAL().Get(model));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #7
0
 /// <summary>
 /// 获取列表
 /// </summary>
 /// <param name="condition">条件</param>
 /// <param name="page">数据页</param>
 /// <returns>数据页</returns>
 public DataPage GetList(ProducePlan condition, DataPage page)
 {
     try
     {
         return(new ProducePlanDAL().GetList(condition, page));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #8
0
        /// <summary>
        /// 创建生产计划
        /// </summary>
        /// <param name="cPlan"></param>
        void CreateProducePlan(CustomerPlan cPlan)
        {
            var service = new ServiceBase <ProducePlan>(this.m_UnitOfWork);

            var plan = new ProducePlan
            {
                TaskID   = cPlan.TaskID,
                PlanCube = cPlan.PlanCube,
                PlanDate = cPlan.PlanDate
            };

            service.Add(plan);
        }
Пример #9
0
        /// <summary>
        /// 通过生产批次号获取生产计划
        /// </summary>
        /// <param name="batchNumber">生产批次号</param>
        /// <returns>生产计划</returns>
        public ProducePlan GetByBatchNumber(string batchNumber)
        {
            ProducePlan plan = null;
            string      sql  = "select * from T_FP_ProducePlan where BatchNumber = @BatchNumber";

            using (IDataSession session = AppDataFactory.CreateMainSession())
            {
                //获取信息
                plan = session.Get <ProducePlan>(sql, new DataParameter("BatchNumber", batchNumber));
            }

            return(plan);
        }
Пример #10
0
        /// <summary>
        /// 获取未完成生产计划
        /// </summary>
        /// <param name="condition">条件</param>
        /// <returns>仓库列表</returns>
        public List <ProducePlan> GetUnFinishedPlans(ProducePlan condition)
        {
            List <ProducePlan> list = new ProducePlanDAL().GetUnFinishedPlans(condition);

            foreach (ProducePlan plan in list)
            {
                //获取物料组成
                List <TraceMaterial> materials = new QualityTraceQueryBLL().GetTraceMaterial(new TraceGood {
                    BatchNumber = plan.BATCHNUMBER
                });
                plan.Materials = "";

                foreach (TraceMaterial m in materials)
                {
                    plan.Materials += "," + m.MatName;
                }

                if (string.IsNullOrEmpty(plan.Materials) == false)
                {
                    plan.Materials = plan.Materials.Substring(1);
                }

                //获取工序信息

                //获取已完成工序信息
                List <TraceProcess> processList = new QualityTraceQueryBLL().GetTraceProcess(new TraceGood {
                    BatchNumber = plan.BATCHNUMBER
                });
                foreach (TraceProcess p in processList)
                {
                    plan.FinishedProcess += "," + p.ProcessName;
                }

                if (string.IsNullOrEmpty(plan.FinishedProcess) == false)
                {
                    plan.FinishedProcess = plan.FinishedProcess.Substring(1);
                }

                if (processList.Count > 0)
                {
                    plan.StartTime = processList[0].WorkingStartTime;
                }

                //生成未完成工序信息
            }

            return(list);
        }
Пример #11
0
        /// <summary>
        /// 获取未完成生产计划
        /// </summary>
        /// <param name="condition">条件</param>
        /// <returns>生产计划</returns>
        public List <ProducePlan> GetUnFinishedPlans(ProducePlan condition)
        {
            List <ProducePlan> list = null;
            string             sql  = null;

            using (IDataSession session = AppDataFactory.CreateMainSession())
            {
                sql  = @"SELECT DISTINCT pp.PID,pp.BATCHNUMBER,pi.PNAME AS PDNAME,pp.PLANAMOUNT,pp.FACTAMOUNT
                    FROM T_FP_PRODUCEPLAN  pp
                    INNER JOIN T_FP_PRODUCTINFO pi on pp.PRODUCTIONID = pi.PID
                    WHERE pp.Status='0' ORDER BY pp.BATCHNUMBER";
                list = session.GetList <ProducePlan>(sql, new List <DataParameter>().ToArray()).ToList <ProducePlan>();
            }

            return(list);
        }
Пример #12
0
 /// <summary>
 /// 获取信息
 /// </summary>
 /// <param name="">条件</param>
 /// <returns>*信息</returns>
 public ProducePlan Get(ProducePlan model)
 {
     try
     {
         using (IDataSession session = AppDataFactory.CreateMainSession())
         {
             //获取信息
             model = session.Get <ProducePlan>(model);
         }
         return(model);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #13
0
        /// <summary>
        /// 更新信息
        /// </summary>
        /// <param name="">信息</param>
        /// <returns>更新行数</returns>
        public DataResult <int> Update(ProducePlan model)
        {
            DataResult <int> result = new DataResult <int>();

            try
            {
                model.UPDATEUSER = this.LoginUser.UserID;
                model.UPDATETIME = DateTime.Now;
                result.Result    = new ProducePlanDAL().Update(model);
                result.IsSuccess = true;
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #14
0
        /// <summary>
        /// 删除信息
        /// </summary>
        /// <param name=""></param>
        /// <returns>删除个数</returns>
        public int Delete(ProducePlan model)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    //删除基本信息
                    count = session.Delete <ProducePlan>(model);
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #15
0
        public void SignPlanFinished(ProducePlan plan)
        {
            string sql = null;
            List <DataParameter> parameters = new List <DataParameter>();

            try
            {
                sql = "update T_FP_PRODUCEPLAN set STATUS = '1' where PID = @PID";
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.ExecuteSql(sql, new DataParameter("PID", plan.PID));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #16
0
        /// <summary>
        /// 获取查询语句
        /// </summary>
        /// <param name="user">查询条件</param>
        /// <param name="parameters">参数</param>
        /// <returns>查询语句</returns>
        private string GetQuerySql(ProducePlan condition, ref List <DataParameter> parameters)
        {
            StringBuilder sqlBuilder   = new StringBuilder();
            StringBuilder whereBuilder = new StringBuilder();

            try
            {
                //构成查询语句
                sqlBuilder.Append(@"SELECT t1.*,t2.PNAME as FNAME,t3.PLNAME as PLNAME,t4.PNAME AS PDNAME FROM T_FP_PRODUCEPLAN t1 
                                  LEFT OUTER JOIN T_FP_FACTORYINFO t2 on t1.FACTORYPID = t2.PID 
                                  LEFT OUTER JOIN T_FP_PRODUCTLINE t3 on t1.PRID = t3.PID
                                  LEFT OUTER JOIN T_FP_PRODUCTINFO t4 on t1.ProductionID = t4.PID ");

                if (!string.IsNullOrEmpty(condition.FACTORYPID))
                {
                    whereBuilder.Append(" AND t1.FACTORYPID = @FACTORYPID");
                    parameters.Add(new DataParameter("FACTORYPID", condition.FACTORYPID));
                }

                if (!string.IsNullOrEmpty(condition.PRID))
                {
                    whereBuilder.Append(" AND t1.PRID = @PRID");
                    parameters.Add(new DataParameter("PRID", condition.PRID));
                }

                if (!string.IsNullOrEmpty(condition.PRODUCTIONID))
                {
                    whereBuilder.Append(" AND t1.PRODUCTIONID = @PRODUCTIONID");
                    parameters.Add(new DataParameter("PRODUCTIONID", condition.PRODUCTIONID));
                }

                //查询条件
                if (whereBuilder.Length > 0)
                {
                    sqlBuilder.Append(" WHERE " + whereBuilder.ToString().Substring(4));
                }
                return(sqlBuilder.ToString());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #17
0
        public bool CancelAuditing(CustomerPlan plan)
        {
            // var plan = this.Get(id);
            if (plan != null)
            {
                ProduceTask task = new ProduceTask();
                task = this.m_UnitOfWork.GetRepositoryBase <ProduceTask>().Get(plan.TaskID);
                if (task.IsFormulaSend)
                {
                    throw new Exception("单据已下发配比,不能取消审核!");
                }
                else
                {
                    //更新CustomerPlan表记录
                    plan.AuditTime = null;
                    plan.Auditor   = string.Empty;
                    string TaskID = plan.TaskID;
                    plan.TaskID = null;
                    this.Update(plan, null);

                    PublicService ps = new PublicService();
                    if (TaskID != "")
                    {
                        //删除ProducePlan表记录
                        ProducePlan pplan = new ProducePlan();
                        pplan = this.m_UnitOfWork.GetRepositoryBase <ProducePlan>().Query().Where(p => p.TaskID.Contains(TaskID)).OrderByDescending(p => p.ID).FirstOrDefault();
                        if (pplan != null)
                        {
                            ps.GetGenericService <ProducePlan>().Delete(pplan);
                        }
                        //删除ProduceTask表记录
                        if (task != null)
                        {
                            ps.GetGenericService <ProduceTask>().Delete(task);
                        }
                    }

                    return(true);
                }
            }
            return(false);
        }
Пример #18
0
        /// <summary>
        /// 插入信息(单表)
        /// </summary>
        /// <param name="">信息</param>
        /// <returns>插入行数</returns>
        public DataResult <int> Insert(ProducePlan model)
        {
            DataResult <int> result = new DataResult <int>();

            try
            {
                //基本信息
                model.PID        = Guid.NewGuid().ToString();
                model.FACTAMOUNT = "0";
                model.CREATEUSER = this.LoginUser.UserID;
                model.CREATETIME = DateTime.Now;
                model.UPDATEUSER = model.CREATEUSER;
                model.UPDATETIME = model.CREATETIME;
                result.Result    = new ProducePlanDAL().Insert(model);
                result.IsSuccess = true;
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #19
0
        /// <summary>
        /// 获取导出的数据
        /// </summary>
        /// <param name="user">查询条件</param>
        /// <returns>数据</returns>
        public DataTable GetExportData(ProducePlan model)
        {
            DataTable            dt         = null;
            string               sql        = null;
            List <DataParameter> parameters = new List <DataParameter>();

            try
            {
                //构成查询语句
                sql = this.GetQuerySql(model, ref parameters);
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    dt           = session.GetTable(sql, parameters.ToArray());
                    dt.TableName = "FactoryInfo";
                }
                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #20
0
 public void SignPlanFinished(ProducePlan plan)
 {
     new ProducePlanDAL().SignPlanFinished(plan);
 }