Esempio n. 1
0
        public DataSet GettMatchPlateDtl()
        {
            ValidateUser();
            QueryObject query1 = GetQueryObject("RF_OldTrayNOGoods");

            if (query1 == null)
            {
                throw new RFException("查询对象[RF_OldTrayNOGoods]不存在");
            }
            DataSet ds = Bss_Helper.GetDataSet_SQL(query1.Sql, paras.Values.ToArray());

            ds.Tables[0].TableName = "Master";
            QueryObject query2 = GetQueryObject("RF_NewTrayGoods");

            if (query2 == null)
            {
                throw new RFException("查询对象[RF_NewTrayGoods]不存在");
            }
            DataSet   ds2 = Bss_Helper.GetDataSet_SQL(query2.Sql, paras.Values.ToArray());
            DataTable dt  = ds2.Tables[0];

            dt.TableName = "Detail";
            ds.Tables.Add(dt.Copy());
            return(ds);
        }
Esempio n. 2
0
        public void Delete()
        {
            this.BusinessID = "RF_StockBYDtlDel";
            //验证每一项
            ValidateUser();
            CheckObject[] objs = GetCheckObjects("*");
            foreach (CheckObject obj in objs)
            {
                obj.DoValidate(paras);
            }

            BusinessObject[] bos = GetBusinessObjects(BusinessID);
            Bss_Helper.BeginTrans();
            foreach (BusinessObject obj in bos)
            {
                try
                {
                    obj.DoValidate(paras, this);
                }
                catch (Exception ex)
                {
                    Bss_Helper.RollBack();
                    Loger.Error(ex);
                    this.BusinessID = "RF_BYDModify";
                    throw;
                }
            }
            Bss_Helper.Commit();
            this.BusinessID = "RF_BYDModify";
        }
Esempio n. 3
0
        public string PickGoods(bool tryagain = true)
        {
            object ParamValue = null;

            this.BusinessID = "RF_PickGoods";
            //验证每一项
            ValidateUser();
            CheckObject[] objs = GetCheckObjects("*");
            foreach (CheckObject obj in objs)
            {
                obj.DoValidate(paras);
            }

            BusinessObject[] bos = GetBusinessObjects(BusinessID);
            Bss_Helper.BeginTrans();
            foreach (BusinessObject obj in bos)
            {
                try
                {
                    obj.DoValidate(paras, this);
                }
                catch (Exception ex)
                {
                    //Bss_Helper.RollBack();
                    //Loger.Error(ex);
                    //throw;

                    Bss_Helper.RollBack();
                    if (ex.Message.Contains("请重新运行该事务") && tryagain == true)
                    {
                        System.Threading.Thread.Sleep(300); //毫秒
                                                            //ValidateQty(model, false);
                        PickGoods(false);

                        break;
                    }
                    else
                    {
                        Loger.Error(ex);
                        if (ex.Message.Contains("请重新运行该事务"))
                        {
                            throw new Exception("操作异常请重试!", ex);
                        }
                        throw;
                    }
                }
            }
            try
            {
                ParamValue = GetParameter("Complete");
            }
            catch (Exception ex)
            {
                Bss_Helper.RollBack();
                Loger.Error(ex);
                throw;
            }
            Bss_Helper.Commit();
            return(ParamValue.ToString());
        }
Esempio n. 4
0
        //执行订单号的独立检查过程
        public void ValidateOrderCode()
        {
            this.BusinessID = "RF_CheckReceiptOrder";
            ValidateUser();
            CheckObject[] objs = GetCheckObjects("OrderNO");
            foreach (CheckObject obj in objs)
            {
                obj.DoValidate(paras);
            }

            BusinessObject[] bos = GetBusinessObjects(BusinessID);
            Bss_Helper.BeginTrans();
            foreach (BusinessObject obj in bos)
            {
                try
                {
                    obj.DoValidate(paras, this);
                }
                catch (Exception ex)
                {
                    Bss_Helper.RollBack();
                    Loger.Error(ex);
                    throw;
                }
            }
            Bss_Helper.Commit();
            this.BusinessID = "RF_DcAcptModify";
        }
Esempio n. 5
0
        public void Over()
        {
            //验证每一项
            this.BusinessID = "RF_DcGetAcptNO";
            ValidateUser();
            CheckObject[] objs = GetCheckObjects("*");
            foreach (CheckObject obj in objs)
            {
                obj.DoValidate(paras);
            }

            BusinessObject[] bos = GetBusinessObjects(BusinessID);
            Bss_Helper.BeginTrans();
            foreach (BusinessObject obj in bos)
            {
                try
                {
                    obj.DoValidate(paras, this);
                }
                catch (Exception ex)
                {
                    Bss_Helper.RollBack();
                    Loger.Error(ex);
                    throw;
                }
            }
            Bss_Helper.Commit();
        }
Esempio n. 6
0
        public string GetNextShelvesLocationNO()
        {
            this.BusinessID = "RF_GetNextShelvesLoc";
            string ToLocationNO = "";

            ValidateUser();

            BusinessObject[] bos = GetBusinessObjects(BusinessID);
            Bss_Helper.BeginTrans();
            foreach (BusinessObject obj in bos)
            {
                try
                {
                    obj.DoValidate(paras, this);
                }
                catch (Exception ex)
                {
                    Bss_Helper.RollBack();
                    Loger.Error(ex);
                    throw;
                }
            }
            try
            {
                ToLocationNO = GetParameter("ToLocationNO").ToString();
            }
            catch (Exception ex)
            {
                Bss_Helper.RollBack();
                Loger.Error(ex);
                throw;
            }
            Bss_Helper.Commit();
            return(ToLocationNO);
        }
Esempio n. 7
0
        public int ExcuteSQL(string QueryName)
        {
            QueryObject query = GetQueryObject(QueryName);

            if (query == null)
            {
                throw new RFException("查询对象[" + QueryName + "]不存在");
            }
            return(Bss_Helper.ExcuteSQL(query.Sql));
        }
Esempio n. 8
0
        /// <summary>
        /// 执行Business业务 通过参数赋值,执行
        /// </summary>
        /// <returns></returns>
        public void ExecuteForParam(SmartDbParams dbParams = null)
        {
            CurrentValidateParam = string.Empty;
            if (!DBHelper.CheckBusinessPower(BusinessName, this.Operator))
            {
                throw new RFException(AlertMessage.Business_NoPower);
            }
            if (!Loaded)
            {
                Load();
            }
            ValidateUser();
            if (dbParams != null)
            {
                foreach (var par in dbParams.paras)
                {
                    SetParameter(par.Key.ToString(), par.Value.Value);
                }
            }
            ExecBusinessCheckForParams();//执行业务检查

            object val = GetParameter("LastUpdateTime");

            SetParameter("Old_LastUpdateTime", val.ToString() == string.Empty ? null : val);
            SetParameter("LastUpdateTime", GetServerDateTime());

            string Summary = string.Empty;

            if (NeedTranscation)
            {
                Bss_Helper.BeginTrans();//开始事务
            }
            try
            {
                foreach (BusinessObject bis in ProcessObjects)
                {
                    Summary = bis.Summary;
                    bis.DoValidate(paras, this);
                }
                if (NeedTranscation)
                {
                    Bss_Helper.Commit();//事务提交
                }
            }
            catch (Exception ex)
            {
                if (NeedTranscation)
                {
                    Bss_Helper.RollBack();
                }
                throw new RFException("执行【" + FormatSummary(Summary) + "】错误:<br/><br/>" + ex.Message);
            }
        }
Esempio n. 9
0
        public DataTable GetUserInvTask()
        {
            QueryObject query = GetQueryObject("RF_StockSearch");

            if (query == null)
            {
                throw new RFException("查询对象[RF_StockSearch]不存在");
            }
            DataSet ds = Bss_Helper.GetDataSet_SQL(query.Sql, paras.Values.ToArray());

            return(ds.Tables[0]);
        }
Esempio n. 10
0
        public DataTable QueryStore()
        {
            QueryObject query = GetQueryObject("SelPostion1");

            if (query == null)
            {
                throw new RFException("查询对象[SelPostion1]不存在");
            }
            DataSet ds = Bss_Helper.GetDataSet_SQL(query.Sql, paras.Values.ToArray());

            return(ds.Tables[0]);
        }
Esempio n. 11
0
        /// <summary>
        /// 查询模块列表
        /// </summary>
        /// <returns></returns>
        public DataTable GetModuleList()
        {
            QueryObject query = GetQueryObject("RF_Menu");

            if (query == null)
            {
                throw new RFException("查询对象[RF_Menu]不存在");
            }
            DataSet ds = Bss_Helper.GetDataSet_SQL(query.Sql, paras.Values.ToArray());

            return(ds.Tables[0]);
        }
Esempio n. 12
0
        public DataTable ValidatPaperNO()
        {
            ValidateUser();
            QueryObject query = GetQueryObject("RF_TPShelvesVerify");

            if (query == null)
            {
                throw new RFException("查询对象[RF_TPShelvesVerify]不存在");
            }
            DataSet ds = Bss_Helper.GetDataSet_SQL(query.Sql, paras.Values.ToArray());

            return(ds.Tables[0]);
        }
Esempio n. 13
0
        public DataTable QueryGoods()
        {
            ValidateUser();
            QueryObject query = GetQueryObject("RF_LocationGoods");

            if (query == null)
            {
                throw new RFException("查询对象[RF_LocationGoods]不存在");
            }
            DataSet ds = Bss_Helper.GetDataSet_SQL(query.Sql, paras.Values.ToArray());

            return(ds.Tables[0]);
        }
Esempio n. 14
0
        public DataTable Execute(string StdQueryName)
        {
            ValidateUser();
            QueryObject query = GetQueryObject(StdQueryName);

            if (query == null)
            {
                throw new RFException("查询对象[" + StdQueryName + "]不存在");
            }
            DataSet ds = Bss_Helper.GetDataSet_SQL(query.Sql, paras.Values.ToArray());

            return(ds.Tables[0]);
        }
Esempio n. 15
0
        public DataTable QueryCS2AcptQty2()
        {
            //ValidateUser();
            QueryObject query = GetQueryObject("RF_SelCS2AcptGoods2");

            if (query == null)
            {
                throw new RFException("查询对象[RF_SelCS2AcptGoods2]不存在");
            }
            DataSet ds = Bss_Helper.GetDataSet_SQL(query.Sql, paras.Values.ToArray());

            return(ds.Tables[0]);
        }
Esempio n. 16
0
        public DataTable RF_CS2TrayType()
        {
            //ValidateUser();
            QueryObject query = GetQueryObject("RF_CS2TrayType");

            if (query == null)
            {
                throw new RFException("查询对象[RF_CS2TrayType]不存在");
            }
            DataSet ds = Bss_Helper.GetDataSet_SQL(query.Sql, paras.Values.ToArray());

            return(ds.Tables[0]);
        }
Esempio n. 17
0
        public DataTable GetPaperInfo()
        {
            ValidateUser();
            QueryObject query = GetQueryObject("GetStorebyPaperNO");

            if (query == null)
            {
                throw new RFException("查询对象[GetStorebyPaperNO]不存在");
            }
            DataSet ds = Bss_Helper.GetDataSet_SQL(query.Sql, paras.Values.ToArray());

            return(ds.Tables[0]);
        }
Esempio n. 18
0
        public DataTable RFGoodsQuery(string RFGoodsQuery)
        {
            ValidateUser();
            QueryObject query = GetQueryObject(RFGoodsQuery);

            if (query == null)
            {
                throw new RFException("查询对象[" + RFGoodsQuery + "]不存在");
            }
            DataSet ds = Bss_Helper.GetDataSet_SQL(query.Sql, paras.Values.ToArray());

            return(ds.Tables[0]);
        }
Esempio n. 19
0
        public DataTable GetRF_Assignment()
        {
            ValidateUser();
            QueryObject query = GetQueryObject("RF_Assignment");

            if (query == null)
            {
                throw new RFException("查询对象[RF_Assignment]不存在");
            }
            DataSet ds = Bss_Helper.GetDataSet_SQL(query.Sql, paras.Values.ToArray());

            if (ds != null && ds.Tables.Count > 0)
            {
                return(ds.Tables[0]);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 20
0
        public string GetBatchBuildTypeID()
        {
            //ValidateUser();
            QueryObject query = GetQueryObject("RF_GetBatchBuildType");

            if (query == null)
            {
                throw new RFException("查询对象[RF_GetBatchBuildType]不存在");
            }
            DataSet ds = Bss_Helper.GetDataSet_SQL(query.Sql, paras.Values.ToArray());

            if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
            {
                return(ds.Tables[0].Rows[0][0].ToString());
            }
            else
            {
                return("1");
            }
        }
Esempio n. 21
0
        public string PickRelease()
        {
            object ParamValue = null;

            this.BusinessID = "RF_PickRelease";
            //验证每一项
            ValidateUser();
            CheckObject[] objs = GetCheckObjects("*");
            foreach (CheckObject obj in objs)
            {
                obj.DoValidate(paras);
            }

            BusinessObject[] bos = GetBusinessObjects(BusinessID);
            Bss_Helper.BeginTrans();
            foreach (BusinessObject obj in bos)
            {
                try
                {
                    obj.DoValidate(paras, this);
                }
                catch (Exception ex)
                {
                    Bss_Helper.RollBack();
                    Loger.Error(ex);
                    throw;
                }
            }
            try
            {
                ParamValue = GetParameter("Complete");
            }
            catch (Exception ex)
            {
                Bss_Helper.RollBack();
                Loger.Error(ex);
                throw;
            }
            Bss_Helper.Commit();
            return(ParamValue.ToString());
        }
Esempio n. 22
0
        public string GetOldTrayNO()
        {
            ValidateUser();
            QueryObject query = GetQueryObject("RF_MatchSearch");

            if (query == null)
            {
                throw new RFException("查询对象[RF_MatchSearch]不存在");
            }
            object obj = Bss_Helper.GetValue(query.Sql, CommandType.Text);

            if (obj == null)
            {
                //tSystemCtrl
                throw new RFException("系统中没有设定退配托盘条码!");
            }
            else
            {
                return(obj.ToString());
            }
        }
Esempio n. 23
0
        public string GetDefaultShipper()
        {
            ValidateUser();
            QueryObject query = GetQueryObject("RF_GetDefaultShipper");

            if (query == null)
            {
                throw new RFException("查询对象[RF_GetDefaultShipper]不存在");
            }
            object obj = Bss_Helper.GetValue(query.Sql, CommandType.Text);

            if (obj == null)
            {
                //tSystemCtrl
                throw new RFException("没有货主!");
            }
            else
            {
                return(obj.ToString());
            }
        }
Esempio n. 24
0
        /// <summary>
        /// 登录验证
        /// </summary>
        /// <param name="user_id"></param>
        /// <param name="password"></param>
        /// <param name="user_name"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public bool Login(string user_id, string password, ref string user_name, ref string token)
        {
            SetParameter("UserNO", user_id);
            //SetParameter("Password", EncryptPwd(password));
            SetParameter("Password", password);
            QueryObject query = GetQueryObject("RF_Login");

            if (query == null)
            {
                throw new RFException("查询对象[RF_Login]不存在");
            }
            paras.Remove("LocalStoreNO");
            DataSet ds = Bss_Helper.GetDataSet_SQL(query.Sql, paras.Values.ToArray());

            if (ds.Tables[0].Rows.Count == 0)
            {
                return(false);
            }

            user_name           = ds.Tables[0].Rows[0]["OperName"].ToString();
            RFBase.LocalStoreNO = ds.Tables[0].Rows[0]["LocalStoreNO"].ToString();
            token = RFService.Instance.UserRegist(user_id);
            return(true);
        }
Esempio n. 25
0
        /// <summary>
        /// 执行业务过程处理
        /// </summary>
        /// <returns></returns>
        private bool ExecBusinessProcess()
        {
            InitMasterParams();//初始主表参数
            //SetParameter("LastUpdateTime", "datetime", GetServerDateTime());//重取一次LastUpdateTime
            if (NeedTranscation)
            {
                Bss_Helper.BeginTrans();//开始事务
            }

            foreach (BusinessObject bis in ProcessObjects)
            {
                try
                {
                    if (!bis.Repeated)                                           //不是循环执行,直接提交
                    {
                        bis.DoValidate(paras, this);                             //执行语句提交
                        continue;                                                //直接进入下一个业务语句
                    }
                    DataTable dtDetail = null;                                   //当前处理循环的从表
                    int       rowItem  = 0;                                      //当前从表循环的记录
                    do                                                           //进入循环执行从表数据提交
                    {
                        string[] sqlParams = DBHelper.GetSqlTextParams(bis.Sql); //取出当前语句的参数
                        if (sqlParams != null && sqlParams.Count() > 0)          //语句有参数,需要参数赋值
                        {
                            foreach (string ParamName in sqlParams)
                            {
                                if (SysParams2.Contains <string>(ParamName))
                                {
                                    continue;//系统参数不处理
                                }
                                if (dtDetail == null)
                                {
                                    dtDetail = GetDataObjectTable(ParamName, dsDataObject);//按第一个参数从表
                                }
                                if (dtDetail == null || dtDetail.TableName == "Master")
                                {
                                    dtDetail = null;
                                    continue;                             //没有到参数赋值,直接进入下一个参数;主表参数无需重新赋值
                                }
                                if (dtDetail.Rows.Count == 0)             //当前从表没有数据,跳出执行,返回到下一个业务处理
                                {
                                    break;                                //foreach
                                }
                                if (dtDetail.Columns.Contains(ParamName)) //表存在参数值
                                {
                                    if (ParamName.IndexOf("UpdateFlag") != -1)
                                    {
                                        string val = string.Empty;
                                        if (dtDetail.Rows[rowItem].RowState == DataRowState.Added)
                                        {
                                            val = "I";
                                        }
                                        else if (dtDetail.Rows[rowItem].RowState == DataRowState.Modified)
                                        {
                                            val = "U";
                                        }
                                        else if (dtDetail.Rows[rowItem].RowState == DataRowState.Deleted)
                                        {
                                            val = "D";
                                        }
                                        SetParameter(ParamName, "string", val);
                                    }
                                    else
                                    {
                                        //SetParameter(ParamName, dtDetail.Rows[rowItem][ParamName]);
                                        if (dtDetail.Rows[rowItem].RowState == DataRowState.Deleted)
                                        {
                                            SetParameter(ParamName, dtDetail.Rows[rowItem][ParamName, DataRowVersion.Original]);
                                        }
                                        else
                                        {
                                            SetParameter(ParamName, dtDetail.Rows[rowItem][ParamName]);
                                        }
                                    }
                                }
                            }
                        }

                        if (dtDetail != null && dtDetail.Rows.Count > 0) //当前从表有数据才处理
                        {
                            bis.DoValidate(paras, this);                 //执行语句提交
                        }
                        rowItem++;
                        //doWhile:;
                    } while (dtDetail != null && rowItem < dtDetail.Rows.Count);//循环完毕后继续下一个业务语句处理
                }
                catch (Exception ex)
                {
                    if (NeedTranscation)
                    {
                        Bss_Helper.RollBack();
                    }
                    throw new RFException("执行【" + FormatSummary(bis.Summary) + "】错误:" + ex.Message);
                }
            }
            if (NeedTranscation)
            {
                Bss_Helper.Commit();//事务提交
            }
            //主表LastUpdateTime更新
            if (dsDataObject.Tables.IndexOf("Master") != -1)
            {
                DataTable dtMaster = dsDataObject.Tables["Master"];
                if (dtMaster != null && dtMaster.Columns.Contains("LastUpdateTime"))
                {
                    dtMaster.Rows[dtMaster.Rows.Count - 1].BeginEdit();
                    dtMaster.Rows[dtMaster.Rows.Count - 1]["LastUpdateTime"] = GetParameter("LastUpdateTime");
                    dtMaster.Rows[dtMaster.Rows.Count - 1].EndEdit();
                }
            }
            //提交内存表所有数据
            for (int n = 0; n < dsDataObject.Tables.Count; n++)
            {
                dsDataObject.Tables[n].AcceptChanges();
            }

            return(true);
        }