public void DoDeleteSystemConfig(ContextInfo contextInfo, List<MESParameterInfo> lstParameters) { contextInfo.Action = MES_ActionType.Delete; SystemConfigBll bll = new SystemConfigBll(contextInfo); bll.CallAccessControl(); bll.DoDelete<tsyssystemconfig>(lstParameters); Parameter.CURRENT_SYSTEM_CONFIG = null; GC.Collect(); }
public DataSet GetSystemConfigRecords(ContextInfo contextInfo, List<MESParameterInfo> lstParameters) { contextInfo.Action = MES_ActionType.Query; SystemConfigBll bll = new SystemConfigBll(contextInfo); bll.CallAccessControl(); DataSet rs = bll.GetSelectedRecords<tsyssystemconfig>(lstParameters); GC.Collect(); return rs; }
public List<tsyssystemconfig> GetSystemConfigList(ContextInfo contextInfo, List<MESParameterInfo> lstParameters) { contextInfo.Action = MES_ActionType.Query; SystemConfigBll bll = new SystemConfigBll(contextInfo); bll.CallAccessControl(); List<tsyssystemconfig> rs = bll.GetSelectedObjects<tsyssystemconfig>(lstParameters); GC.Collect(); return rs; }
public List<tsyssystemconfig> GetAllSystemConfigValue() { SystemConfigBll bll = new SystemConfigBll(); List<tsyssystemconfig> rs = bll.GetAllSystemConfigValue(); GC.Collect(); return rs; }
public void DoUpdateSystemConfig(ContextInfo contextInfo, tsyssystemconfig systemConfig) { contextInfo.Action = MES_ActionType.Update; SystemConfigBll bll = new SystemConfigBll(contextInfo); bll.CallAccessControl(); bll.DoUpdate(systemConfig); Parameter.CURRENT_SYSTEM_CONFIG = null; GC.Collect(); }
public List<string> SubGetBillNoBatch(string bcrid, int batchNum, string lockRefId, string baseValue, List<MESParameterInfo> lstVariablesParameters) { #region prepare List<string> lstBillNo = new List<string>(); if (bcrid.Trim() == string.Empty) { return lstBillNo; } decimal prevseqvalue = 0; #endregion try { //get system config string sysConfig = new SystemConfigBll(CurrentContextInfo).GetSystemConfigValue("SYS_CONTBILLNO"); #region get objects List<MESParameterInfo> lstParameters = new List<MESParameterInfo>(); lstParameters.Add(new MESParameterInfo() { ParamName = "bcrid", ParamValue = bcrid, ParamType = "string" }); //get rule object tsysbillcoderule rule = GetSingleObject<tsysbillcoderule>(lstParameters); if (rule == null) return lstBillNo; //get time format string timeformat = rule.timeformat; if (timeformat == null || timeformat.Trim() == string.Empty) timeformat = "yyyyMMdd";//default string currentTimeValue = Function.GetCurrentTime().ToString(timeformat); currentTimeValue = ConvertSpecialTimeFormat(currentTimeValue, timeformat); if (rule.basevalue == MES_BillCodeRule_BCRBaseValue.TimeFormat.ToString()) { lstParameters.Add(new MESParameterInfo() { ParamName = "basevalue", ParamValue = currentTimeValue, ParamType = "string" }); } else if(rule.basevalue == MES_BillCodeRule_BCRBaseValue.Parameter.ToString()) { lstParameters.Add(new MESParameterInfo() { ParamName = "basevalue", ParamValue = baseValue, ParamType = "string" }); } else { lstParameters.Add(new MESParameterInfo() { ParamName = "basevalue", ParamValue = baseValue, ParamType = "string" }); lstParameters.Add(new MESParameterInfo() { ParamName = "timevalue", ParamValue = currentTimeValue, ParamType = "string" }); } //get bill code object tsysbillcode billCode = localDal.GetSingleObject<tsysbillcode>(lstParameters, string.Empty, false); #endregion if (billCode != null) { #region if exists,update if (sysConfig == MES_Misc.Y.ToString()) { //check lock flag first if (billCode.islocked == MES_Misc.Y.ToString()) { if (billCode.lockrefid != null && billCode.lockrefid == lockRefId) { } else { throw new UtilException("-200015"); } } } prevseqvalue = billCode.currentseqvalue; for (int i = 0; i < batchNum; i++) { #region check max & min value & iscycle if (billCode.currentseqvalue < rule.maxvalue && billCode.currentseqvalue >= rule.minvalue) { billCode.currentseqvalue = billCode.currentseqvalue + (rule.incrementby == null ? 1 : (rule.incrementby <= 0 ? 1 : rule.incrementby)); billCode.lastmodifiedtime = Function.GetCurrentTime(); billCode.lastmodifieduser = CurrentContextInfo.CurrentUser; if (rule.billformat==null || rule.billformat.Trim()==string.Empty) { billCode.fullbillnotext = rule.ffchars + currentTimeValue + billCode.currentseqvalue.ToString().PadLeft(Int16.Parse(rule.seqvaluelength.ToString()), '0'); } else { billCode.fullbillnotext = ParseVariables(rule, currentTimeValue, billCode.currentseqvalue.ToString().PadLeft(Int16.Parse(rule.seqvaluelength.ToString()), '0'), lstVariablesParameters); } } else { if (rule.iscycle == MES_Misc.Y.ToString()) { //reset billCode.currentseqvalue = rule.startwith.HasValue ? 1 : (rule.startwith.Value < 0 ? 1 : rule.startwith.Value); billCode.lastmodifiedtime = Function.GetCurrentTime(); billCode.lastmodifieduser = CurrentContextInfo.CurrentUser; //billCode.fullbillnotext = rule.ffchars + currentTimeValue + billCode.currentseqvalue.ToString().PadLeft(Int16.Parse(rule.seqvaluelength.ToString()), '0'); if (rule.billformat == null || rule.billformat.Trim() == string.Empty) { billCode.fullbillnotext = rule.ffchars + currentTimeValue + billCode.currentseqvalue.ToString().PadLeft(Int16.Parse(rule.seqvaluelength.ToString()), '0'); } else { billCode.fullbillnotext = ParseVariables(rule, currentTimeValue, billCode.currentseqvalue.ToString().PadLeft(Int16.Parse(rule.seqvaluelength.ToString()), '0'), lstVariablesParameters); } } else { //error //billCode.fullbillnotext = "-1"; throw new Exception("-200028"); } } #endregion lstBillNo.Add(billCode.fullbillnotext); } if (sysConfig == MES_Misc.Y.ToString() && lockRefId!=string.Empty) { billCode.islocked = MES_Misc.Y.ToString(); } billCode.lockrefid = lockRefId; billCode.prevseqvalue = prevseqvalue; localDal.DoUpdate<tsysbillcode>(billCode); #endregion } else { if (rule.basevalue == MES_BillCodeRule_BCRBaseValue.TimeFormat.ToString()) { //close the last one first ClosePrevBill(bcrid); } #region if new, insert billCode = new tsysbillcode(); billCode.bcrid = bcrid; prevseqvalue = billCode.currentseqvalue; for (int i = 0; i < batchNum; i++) { if (rule.basevalue == MES_BillCodeRule_BCRBaseValue.TimeFormat.ToString()) { billCode.basevalue = currentTimeValue; } else { billCode.basevalue = baseValue; } billCode.timevalue = currentTimeValue; if (i == 0) { //first one billCode.currentseqvalue = rule.startwith.HasValue ? 1 : (rule.startwith.Value < 0 ? 1 : rule.startwith.Value); } else { #region check max & min value & iscycle if (billCode.currentseqvalue < rule.maxvalue && billCode.currentseqvalue >= rule.minvalue) { billCode.currentseqvalue = billCode.currentseqvalue + (rule.incrementby == null ? 1 : (rule.incrementby <= 0 ? 1 : rule.incrementby)); billCode.lastmodifiedtime = Function.GetCurrentTime(); billCode.lastmodifieduser = CurrentContextInfo.CurrentUser; //billCode.fullbillnotext = rule.ffchars + currentTimeValue + billCode.currentseqvalue.ToString().PadLeft(Int16.Parse(rule.seqvaluelength.ToString()), '0'); if (rule.billformat == null || rule.billformat.Trim() == string.Empty) { billCode.fullbillnotext = rule.ffchars + currentTimeValue + billCode.currentseqvalue.ToString().PadLeft(Int16.Parse(rule.seqvaluelength.ToString()), '0'); } else { billCode.fullbillnotext = ParseVariables(rule, currentTimeValue, billCode.currentseqvalue.ToString().PadLeft(Int16.Parse(rule.seqvaluelength.ToString()), '0'), lstVariablesParameters); } } else { if (rule.iscycle == MES_Misc.Y.ToString()) { //reset billCode.currentseqvalue = rule.startwith.HasValue ? 1 : (rule.startwith.Value < 0 ? 1 : rule.startwith.Value); billCode.lastmodifiedtime = Function.GetCurrentTime(); billCode.lastmodifieduser = CurrentContextInfo.CurrentUser; //billCode.fullbillnotext = rule.ffchars + currentTimeValue + billCode.currentseqvalue.ToString().PadLeft(Int16.Parse(rule.seqvaluelength.ToString()), '0'); if (rule.billformat == null || rule.billformat.Trim() == string.Empty) { billCode.fullbillnotext = rule.ffchars + currentTimeValue + billCode.currentseqvalue.ToString().PadLeft(Int16.Parse(rule.seqvaluelength.ToString()), '0'); } else { billCode.fullbillnotext = ParseVariables(rule, currentTimeValue, billCode.currentseqvalue.ToString().PadLeft(Int16.Parse(rule.seqvaluelength.ToString()), '0'), lstVariablesParameters); } } else { //error //billCode.fullbillnotext = "-1"; throw new Exception("-200028"); } } #endregion } billCode.lastmodifiedtime = Function.GetCurrentTime(); billCode.lastmodifieduser = CurrentContextInfo.CurrentUser; //billCode.fullbillnotext = rule.ffchars + currentTimeValue + billCode.currentseqvalue.ToString().PadLeft(Int16.Parse(rule.seqvaluelength.ToString()), '0'); if (rule.billformat == null || rule.billformat.Trim() == string.Empty) { billCode.fullbillnotext = rule.ffchars + currentTimeValue + billCode.currentseqvalue.ToString().PadLeft(Int16.Parse(rule.seqvaluelength.ToString()), '0'); } else { billCode.fullbillnotext = ParseVariables(rule, currentTimeValue, billCode.currentseqvalue.ToString().PadLeft(Int16.Parse(rule.seqvaluelength.ToString()), '0'), lstVariablesParameters); } lstBillNo.Add(billCode.fullbillnotext); } billCode.prevseqvalue = prevseqvalue; if (sysConfig == MES_Misc.Y.ToString() && lockRefId != string.Empty) { billCode.islocked = MES_Misc.Y.ToString(); billCode.isclosed = MES_Misc.N.ToString(); } billCode.lockrefid = lockRefId; localDal.DoInsert<tsysbillcode>(billCode); #endregion } #region update rule's status if (rule.bcrstatus == MES_BillCodeRule_BCRStatus.Unused.ToString()) { //update rule status to used rule.bcrstatus = MES_BillCodeRule_BCRStatus.Used.ToString(); rule.lastmodifiedtime = Function.GetCurrentTime(); rule.lastmodifieduser = CurrentContextInfo.CurrentUser; localDal.DoUpdate<tsysbillcoderule>(rule); } #endregion } catch (Exception ex) { throw ex; } return lstBillNo; }