public override void SetAccess(FormM form, DFDictionary entity)
        {
            var ds         = new DataSet();
            var InstanceId = entity["InstanceId"];

            var count = 0;

            var dtHeader = new DataTable();

            dtHeader = base.GetList(entity, ref count, 0, Int32.MaxValue, "select * from sm_t_process  where InstanceId=@InstanceId", "order by InstanceId", new { InstanceId = entity["InstanceId"] });


            dtHeader.TableName = "SM_T_PROCESS";
            ds.Tables.Add(dtHeader);


            var dtProduct = new DataTable();

            dtProduct           = base.GetList(entity, ref count, 0, Int32.MaxValue, "select * from sm_t_process_product p where p.InstanceId=@InstanceId", "order by LinePosition", new { InstanceId = entity["InstanceId"] });
            dtProduct.TableName = "SM_T_PROCESS_PRODUCT";
            ds.Tables.Add(dtProduct);


            var dtCY = new DataTable();

            dtCY           = base.GetList(entity, ref count, 0, Int32.MaxValue, "select * from sm_t_process_cy p where p.InstanceId=@InstanceId", "order by InstanceId", new { InstanceId = entity["InstanceId"] });
            dtCY.TableName = "SM_T_PROCESS_CY";
            ds.Tables.Add(dtCY);

            var dtYC = new DataTable();

            dtYC           = base.GetList(entity, ref count, 0, Int32.MaxValue, "select * from sm_t_process_yc p where p.InstanceId=@InstanceId", "order by InstanceId", new { InstanceId = entity["InstanceId"] });
            dtYC.TableName = "SM_T_PROCESS_YC";
            ds.Tables.Add(dtYC);

            //var dtLY = new DataTable();
            //dtLY = base.GetList(entity, ref count, 0, Int32.MaxValue, "select * from v_sm_t_process_ly p where p.InstanceId=@InstanceId", "order by InstanceId", new { InstanceId = entity["InstanceId"] });
            //dtLY.TableName = "v_sm_t_process_ly";
            //ds.Tables.Add(dtLY);

            var dtQuality = new DataTable();

            dtQuality           = base.GetList(entity, ref count, 0, Int32.MaxValue, "select * from v_sm_t_process_quality p where p.InstanceId=@InstanceId", "order by InstanceId", new { InstanceId = entity["InstanceId"] });
            dtQuality.TableName = "v_sm_t_process_quality";
            ds.Tables.Add(dtQuality);

            //var dtAQ = new DataTable();
            //dtAQ = base.GetList(entity, ref count, 0, Int32.MaxValue, "select * from SM_T_PROCESS_AQ p where p.InstanceId=@InstanceId", "order by InstanceId", new { InstanceId = entity["InstanceId"] });
            //dtAQ.TableName = "SM_T_PROCESS_AQ";
            //ds.Tables.Add(dtAQ);



            this.ReportDataSource = ds;
            this.ReportPath       = Path.Combine(new DirectoryInfo(CurrentFolderHelper.GetCurrentFolder()).Parent.FullName, "Reports", "Process.frx");
            base.SetAccess(form, entity);
        }
        public override int Update(FormM form, DFDictionary entity, ref string message)
        {
            DataTable dt;

            using (var db = Pub.DB)
            {
                var currentUser     = Util.GetCurrentUser();
                var category        = "";
                var SenderCompany   = "";
                var ReceiverCompany = "";
                var sql             = @"select * from sm_t_devicedowntime d where 1=1 
                            ";
                if (!string.IsNullOrWhiteSpace(entity["ProductDateFrom"]))
                {
                    sql += " and d.ProductDate>=@ProductDateFrom";
                }
                if (!string.IsNullOrWhiteSpace(entity["ProductDateTo"]))
                {
                    sql += " and d.ProductDate<=@ProductDateTo";
                }

                if (!string.IsNullOrWhiteSpace(entity["LineName"]))
                {
                    sql += " and d.LineName like @LineName";
                }
                //var sql = string.Format("exec sp_Report_Recycle @CompanyName,@PalletType,@CMonth,@Category,@SenderCompany,@ReceiverCompany");

                var p = new
                {
                    ProductDateFrom = entity["ProductDateFrom"],
                    ProductDateTo   = entity["ProductDateTo"],
                    LineName        = string.Format("%{0}%", entity["LineName"])
                };


                dt = db.ExecuteDataTable(sql, p);
                if (dt.Rows.Count == 0)
                {
                    message = "没有数据".GetRes();
                    return(DFPub.EXECUTE_ERROR);
                }
                dt.TableName = "SM_T_DEVICEDOWNTIME";
                var ds = new DataSet();
                ds.Tables.Add(dt);
                this.ReportDataSource = ds;
                this.ReportPath       = Path.Combine(new DirectoryInfo(CurrentFolderHelper.GetCurrentFolder()).Parent.FullName, "Reports", "DownTime.frx");
            }

            return(DFPub.EXECUTE_SUCCESS);
        }
        public override void SetAccess(FormM form, DFDictionary entity)
        {
            var ds         = new DataSet();
            var InstanceId = entity["InstanceId"];

            var count = 0;

            var dtHeader = new DataTable();

            dtHeader = base.GetList(entity, ref count, 0, Int32.MaxValue, "select * from sm_t_process  where InstanceId=@InstanceId", "order by InstanceId", new { InstanceId = entity["InstanceId"] });


            dtHeader.TableName = "SM_T_PROCESS";
            ds.Tables.Add(dtHeader);



            var dtLY = new DataTable();

            dtLY           = base.GetList(entity, ref count, 0, Int32.MaxValue, "select * from sm_t_process_ly p where p.InstanceId=@InstanceId", "order by InstanceId", new { InstanceId = entity["InstanceId"] });
            dtLY.TableName = "SM_T_PROCESS_LY";
            ds.Tables.Add(dtLY);

            var dtLW = new DataTable();

            dtLY           = base.GetList(entity, ref count, 0, Int32.MaxValue, "select * from SM_T_PROCESS_LW p where p.InstanceId=@InstanceId", "order by InstanceId", new { InstanceId = entity["InstanceId"] });
            dtLY.TableName = "SM_T_PROCESS_LW";
            ds.Tables.Add(dtLY);

            var dtLQF = new DataTable();

            dtLY           = base.GetList(entity, ref count, 0, Int32.MaxValue, "select * from SM_T_PROCESS_LQF p where p.InstanceId=@InstanceId", "order by InstanceId", new { InstanceId = entity["InstanceId"] });
            dtLY.TableName = "SM_T_PROCESS_LQF";
            ds.Tables.Add(dtLY);



            var dtAQ = new DataTable();

            dtAQ           = base.GetList(entity, ref count, 0, Int32.MaxValue, "select * from SM_T_PROCESS_AQ p where p.InstanceId=@InstanceId", "order by InstanceId", new { InstanceId = entity["InstanceId"] });
            dtAQ.TableName = "SM_T_PROCESS_AQ";
            ds.Tables.Add(dtAQ);



            this.ReportDataSource = ds;
            this.ReportPath       = Path.Combine(new DirectoryInfo(CurrentFolderHelper.GetCurrentFolder()).Parent.FullName, "Reports", "Process_FX.frx");
            base.SetAccess(form, entity);
        }
示例#4
0
        public override int Update(FormM form, DFDictionary entity, ref string message)
        {
            if (string.IsNullOrWhiteSpace(entity["TableName"]))
            {
                throw new WFException("请选择流程".GetRes());
            }


            DataTable dt;

            using (var db = Pub.DB)
            {
                var sql = string.Format("SELECT * FROM {0} WHERE 1=1", entity["TableName"]);
                //if (!string.IsNullOrWhiteSpace(entity["Requestor"]))
                //{
                //    sql += " and (申请人姓名 like @Requestor or 申请人中文姓名 like @Requestor)";
                //}
                var p = new
                {
                    //DeptId = QueryBuilder.In(ref sql, entity, "部门", "DeptId"),
                    //InstanceStatus = QueryBuilder.In(ref sql, entity, "流程状态", "InstanceStatus"),
                    RequestTime_From = QueryBuilder.DateFrom(ref sql, entity, "申请时间", "RequestTime_From"),
                    RequestTime_To   = QueryBuilder.DateTo(ref sql, entity, "申请时间", "RequestTime_To"),
                    //Requestor = string.Format("%{0}%", entity["Requestor"])
                };

                sql += " order by 流水号 desc";
                dt   = db.ExecuteDataTable(sql, p);
                if (dt.Rows.Count == 0)
                {
                    message = "没有数据".GetRes();
                    return(DFPub.EXECUTE_ERROR);
                }
                dt.TableName = "T1";
                var ds = new DataSet();
                ds.Tables.Add(dt);
                this.ReportDataSource = ds;
                this.ReportPath       = Path.Combine(new DirectoryInfo(CurrentFolderHelper.GetCurrentFolder()).Parent.FullName, "Reports", "WFDataReport.frx");
            }

            return(DFPub.EXECUTE_SUCCESS);
        }