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()); }
//执行订单号的独立检查过程 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"; }
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(); }
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); }
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"; }
/// <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); } }
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()); }
/// <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); }