优化Api数据库缓存模块,增加MES岗位缓存跟不良代码缓存
| | |
| | | using Rhea.Common; |
| | | using Tiger.IBusiness; |
| | | using System.ServiceProcess; |
| | | using Tiger.Api.DbCache; |
| | | |
| | | namespace Tiger.Api |
| | | { |
| | |
| | | //å
³éæå¡æ»çº¿ |
| | | DI.Resolve<IServicesBus>().StopServices(); |
| | | //å
³éDBç¼åèªå¨æ´æ° |
| | | DI.Resolve<IDbCacheBus>().StopAutoUpdate(); |
| | | //DI.Resolve<IDbCacheBus>().StopAutoUpdate(); |
| | | DbCacheBus.StopAutoUpdate(); |
| | | //MQTTHelper.MQTTConn?.Close(); |
| | | base.OnStopping(); |
| | | } |
| | |
| | | "injectProperties": true, |
| | | "instanceScope": "SingleInstance" //çå½å¨æ |
| | | }, |
| | | //{ |
| | | // "type": "Tiger.Business.DbCacheBus,Tiger.Business", |
| | | // "services": [ { "type": "Tiger.IBusiness.IDbCacheBus,Tiger.IBusiness" } ], |
| | | // "autoActivate": true, |
| | | // "injectProperties": true, |
| | | // "instanceScope": "SingleInstance" //çå½å¨æ |
| | | //}, |
| | | { |
| | | "type": "Tiger.Business.DbCacheBus,Tiger.Business", |
| | | "services": [ { "type": "Tiger.IBusiness.IDbCacheBus,Tiger.IBusiness" } ], |
| | | "type": "Tiger.Business.DbCache.CodeRuleCache,Tiger.Business", |
| | | "services": [ { "type": "Tiger.IBusiness.ICodeRuleCache,Tiger.IBusiness" } ], |
| | | "autoActivate": true, |
| | | "injectProperties": true, |
| | | "instanceScope": "SingleInstance" //çå½å¨æ |
| | | }, |
| | | { |
| | | "type": "Tiger.Business.DbCache.SysParamCache,Tiger.Business", |
| | | "services": [ { "type": "Tiger.IBusiness.ISysParamCache,Tiger.IBusiness" } ], |
| | | "autoActivate": true, |
| | | "injectProperties": true, |
| | | "instanceScope": "SingleInstance" //çå½å¨æ |
| | | }, |
| | | { |
| | | "type": "Tiger.Business.DbCache.MesDefectCache,Tiger.Business.MES", |
| | | "services": [ { "type": "Tiger.IBusiness.IMesDefectCache,Tiger.IBusiness" } ], |
| | | "autoActivate": true, |
| | | "injectProperties": true, |
| | | "instanceScope": "SingleInstance" //çå½å¨æ |
| | | }, |
| | | { |
| | | "type": "Tiger.Business.DbCache.MesPositionCache,Tiger.Business.MES", |
| | | "services": [ { "type": "Tiger.IBusiness.IMesPositionCache,Tiger.IBusiness" } ], |
| | | "autoActivate": true, |
| | | "injectProperties": true, |
| | | "instanceScope": "SingleInstance" //çå½å¨æ |
| | |
| | | public async Task<IActionResult> GetAsync(string param) |
| | | { |
| | | //var data = await Biz.Db.Queryable<SYS_PARAM>().Where(q => q.PARAM_CODE == param).FirstAsync(); |
| | | //var data = Biz.SysParam["Blue"]; |
| | | //var data = Biz.SysParam.Groups; |
| | | //var data = Biz.CodeRule["X0001"]; |
| | | //var data = Cache.SysParam["Blue"]; |
| | | //var data = Cache.SysParam.Groups; |
| | | //var data = Cache.CodeRule["X0001"]; |
| | | //åå·æµè¯ |
| | | //var data = Biz.Db.Queryable<BAS_CODE_RULE>().Where(q => q.RULE_CODE == "X0001").IncludesAllFirstLayer().First(); |
| | | //var key = string.Join("|", data.Details.Where(q => q.DATA_TYPE == BAS_CODE_DTL.DATA_TYPEs.DbCheck.GetValue()).Select(q => q.GenerateValue)); |
| | |
| | | // try |
| | | // { |
| | | // var dtl = data.Details.First(q => q.RULE_SEQ == 6); |
| | | // var sn = Biz.CodeRule.FetchSerialNo(key, dtl, index.ToString(), false); |
| | | // var sn = Cache.CodeRule.FetchSerialNo(key, dtl, index.ToString(), false); |
| | | // Console.WriteLine($"{index}: {DateTime.Now:HH:mm:ss.fff} > åå·å®æ[{sn}]"); |
| | | // } |
| | | // catch (Exception ex) |
| | |
| | | // } |
| | | // }); |
| | | //} |
| | | //var data = Biz.CodeRule["X0001"].Generate("PDFG", 5); |
| | | //var data1 = Biz.CodeRule["X0001"].TryGenerate("PDFG", 6); |
| | | //var data = Cache.CodeRule["X0001"].Generate("PDFG", 5); |
| | | //var data1 = Cache.CodeRule["X0001"].TryGenerate("PDFG", 6); |
| | | //æ¡ç è§åéªè¯ |
| | | //Expression<Func<BAS_CODE_RULE, bool>> predicate = q => true; |
| | | ////predicate = predicate.And(q => q.RULE_CODE == "X0002" || q.RULE_CODE == "X0001"); |
| | | //predicate = predicate.And(q => q.RULE_TYPE == 0); |
| | | ////var data = Biz.CodeRule.Rules.Where(predicate.Compile()); |
| | | //var data = Biz.CodeRule.Verify("AB23#7930000002010", predicate.Compile()); |
| | | ////var data = Cache.CodeRule.Rules.Where(predicate.Compile()); |
| | | //var data = Cache.CodeRule.Verify("AB23#7930000002010", predicate.Compile()); |
| | | return Ok(""); |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Rhea.Common; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using Tiger.IBusiness; |
| | | |
| | | namespace Tiger.Api.DbCache |
| | | { |
| | | public partial class Cache |
| | | { |
| | | /// <summary> |
| | | /// è·åæ¡ç è§åç¼å |
| | | /// </summary> |
| | | public static ICodeRuleCache CodeRule => DI.Resolve<ICodeRuleCache>(); |
| | | /// <summary> |
| | | /// è·åç³»ç»åæ°ç¼å |
| | | /// </summary> |
| | | public static ISysParamCache SysParam => DI.Resolve<ISysParamCache>(); |
| | | /// <summary> |
| | | /// è·åä¸è¯ä»£ç ç¼å |
| | | /// </summary> |
| | | public static IMesDefectCache MesDefect => DI.Resolve<IMesDefectCache>(); |
| | | /// <summary> |
| | | /// è·åå²ä½ç¼å |
| | | /// </summary> |
| | | public static IMesPositionCache MesPosition => DI.Resolve<IMesPositionCache>(); |
| | | }//endClass |
| | | |
| | | /// <summary> |
| | | /// çæ§æ»æ§ |
| | | /// </summary> |
| | | public class DbCacheBus |
| | | { |
| | | |
| | | #region Functions |
| | | public static void StartAutoUpdate() |
| | | { |
| | | if (BizConfig.Configuration["IsUseDbCache"]?.ToLower() == "true") |
| | | { |
| | | //å¼å¯ç³»ç»åæ°ç¼å |
| | | Cache.SysParam.Start(); |
| | | ConsoleExt.WriteLine("Start SysParam Cache Auto Update Thread..........", ConsoleColor.Yellow); |
| | | //å¼å¯ç³»ç»åæ°ç¼å |
| | | Cache.CodeRule.Start(); |
| | | ConsoleExt.WriteLine("Start CodeRule Cache Auto Update Thread..........", ConsoleColor.Yellow); |
| | | //å¼å¯ä¸è¯ä»£ç ç¼å |
| | | Cache.MesDefect.Start(); |
| | | ConsoleExt.WriteLine("Start MesDefect Cache Auto Update Thread..........", ConsoleColor.Yellow); |
| | | //å¼å¯å²ä½ç¼å |
| | | Cache.MesPosition.Start(); |
| | | ConsoleExt.WriteLine("Start MesPosition Cache Auto Update Thread..........", ConsoleColor.Yellow); |
| | | } |
| | | } |
| | | |
| | | public static void StopAutoUpdate() |
| | | { |
| | | if (BizConfig.Configuration["IsUseDbCache"]?.ToLower() == "true") |
| | | { |
| | | //å
³éç³»ç»åæ°ç¼å |
| | | Cache.SysParam.Stop(); |
| | | //å
³éç³»ç»åæ°ç¼å |
| | | Cache.CodeRule.Stop(); |
| | | //å
³éä¸è¯ä»£ç ç¼å |
| | | Cache.MesDefect.Stop(); |
| | | //å
³éå²ä½ç¼å |
| | | Cache.MesPosition.Stop(); |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | using System.Linq; |
| | | using System.Reflection; |
| | | using Tiger.Api.Controllers; |
| | | using Tiger.Api.DbCache; |
| | | using Tiger.IBusiness; |
| | | using Tiger.IBusiness.Utility; |
| | | |
| | |
| | | //å¼å¯æå¡æ»çº¿ |
| | | DI.Resolve<IServicesBus>().StartServices(app.ApplicationServices.GetService<ISchedulerFactory>()); |
| | | //å¼å¯DBç¼åèªå¨æ´æ° |
| | | DI.Resolve<IDbCacheBus>().StartAutoUpdate(); |
| | | //DI.Resolve<IDbCacheBus>().StartAutoUpdate(); |
| | | DbCacheBus.StartAutoUpdate(); |
| | | //å¼å¯MQTTæå¡ |
| | | MQTTHelper.Start(); |
| | | } |
| | |
| | | var result = new ApiAction(); |
| | | try |
| | | { |
| | | result.Data = input.IsTry == "Y" ? Biz.CodeRule[input.Code]?.TryGenerate(input.Prefix, $"{input.BatchNo}-{input.Qty}-").Data.ToString() ?? "" : Biz.CodeRule[input.Code]?.Generate(input.Prefix, $"{input.BatchNo}-{input.Qty}-").Data.ToString() ?? ""; |
| | | result.Data = input.IsTry == "Y" ? Cache.CodeRule[input.Code]?.TryGenerate(input.Prefix, $"{input.BatchNo}-{input.Qty}-").Data.ToString() ?? "" : Cache.CodeRule[input.Code]?.Generate(input.Prefix, $"{input.BatchNo}-{input.Qty}-").Data.ToString() ?? ""; |
| | | } |
| | | catch (Exception ex) |
| | | { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Tiger.Model; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq.Expressions; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Rhea.Common; |
| | | using System.Net; |
| | | using System.Linq; |
| | | using Newtonsoft.Json; |
| | | using Tiger.Business.DbCache; |
| | | using Tiger.IBusiness; |
| | | |
| | | namespace Tiger.Business.DbCache |
| | | { |
| | | public partial class Cache |
| | | { |
| | | /// <summary> |
| | | /// è·åä¸è¯ä»£ç ç¼å |
| | | /// </summary> |
| | | public static IMesDefectCache Defect => DI.Resolve<IMesDefectCache>(); |
| | | /// <summary> |
| | | /// è·åå²ä½ç¼å |
| | | /// </summary> |
| | | public static IMesPositionCache Position => DI.Resolve<IMesPositionCache>(); |
| | | }//endClass |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Rhea.Common; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data.Entity; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using Tiger.IBusiness; |
| | | using Tiger.Model; |
| | | |
| | | namespace Tiger.Business.DbCache |
| | | { |
| | | /// <summary> |
| | | /// ä¸è¯ä»£ç æ°æ®åºæ°æ®ç¼å |
| | | /// </summary> |
| | | public class MesDefectCache : IMesDefectCache |
| | | { |
| | | #region Variables |
| | | private WhileThread AutoUpdateThread; |
| | | private DateTime LastUpdateTime = DateTime.MinValue; |
| | | #endregion |
| | | |
| | | #region Propertys |
| | | public string Id { get; set; } = Guid.NewGuid().ToString("N"); |
| | | public string Tag { get; set; } = "MesDefectCache"; |
| | | public string Name { get; set; } = "MesDefectCache"; |
| | | public bool IsRunning { get; set; } |
| | | private List<BAS_DEFECT_GRP> _groups = new(); |
| | | public List<BAS_DEFECT_GRP> Groups { get { Update(); return _groups; } set => _groups = value; } |
| | | private List<BAS_DEFECT> _defects = new(); |
| | | public List<BAS_DEFECT> Defects { get { Update(); return _defects; } set => _defects = value; } |
| | | public BAS_DEFECT this[string code, string group = null] { get { Update(); return _defects.FirstOrDefault(q => q.DFT_CODE == code && (group.IsNullOrEmpty() || q.DFTG_CODE == group)); } } |
| | | #endregion |
| | | |
| | | #region Functions |
| | | /// <summary> |
| | | /// å¯å¨èªå¨æ´æ°ç¼å |
| | | /// </summary> |
| | | public void Start() |
| | | { |
| | | try |
| | | { |
| | | AutoUpdateThread = new(AutoUpdate); |
| | | AutoUpdateThread.Start(); |
| | | Logger.Default.Info("Start MesDefect Cache Auto Update Thread"); |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | Logger.Default.Fatal(ex, "Start MesDefect Cache Auto Update Thread Exception"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å
³éèªå¨æ´æ°ç¼å |
| | | /// </summary> |
| | | public void Stop() |
| | | { |
| | | try |
| | | { |
| | | AutoUpdateThread?.Stop(); |
| | | Logger.Console.Info("Stop MesDefect Cache Auto Update Thread"); |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | Logger.Console.Fatal(ex, "Stop MesDefect Cache Auto Update Thread Exception"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°æ°æ®ç¼å |
| | | /// </summary> |
| | | public void Update() |
| | | { |
| | | var lastUpdate = Biz.Db.Queryable<BAS_DEFECT>().Max(q => q.UPDATE_TIME); |
| | | if (LastUpdateTime < lastUpdate) |
| | | { |
| | | _groups = Biz.Db.Queryable<BAS_DEFECT_GRP>().IncludesAllFirstLayer().ToList(); |
| | | var defectList = new List<BAS_DEFECT>(); |
| | | foreach (var group in _groups) |
| | | { |
| | | defectList.AddRange(group.Defects); |
| | | } |
| | | _defects = defectList; |
| | | LastUpdateTime = defectList.Max(q => q.UPDATE_TIME); |
| | | Logger.Console.Info($"Get MesDefect successful, total {Defects.Count} params in {Groups.Count} groups, last update time is {LastUpdateTime:yyyy-MM-dd HH:mm:ss}"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// èªå¨æ´æ° |
| | | /// </summary> |
| | | private void AutoUpdate() |
| | | { |
| | | try |
| | | { |
| | | Update(); |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | Logger.Console.Fatal(ex, "MesDefect Cache Auto Update Exception"); |
| | | LastUpdateTime = DateTime.MinValue; |
| | | } |
| | | |
| | | //ä¼ç 30åé |
| | | Thread.Sleep(30 * 60 * 1000);// |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Newtonsoft.Json.Linq; |
| | | using Rhea.Common; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using System.Data; |
| | | using System.Data.Entity; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using Tiger.Business.MES.Transaction; |
| | | using Tiger.IBusiness; |
| | | using Tiger.Model; |
| | | |
| | | namespace Tiger.Business.DbCache |
| | | { |
| | | /// <summary> |
| | | /// å²ä½æ°æ®åºæ°æ®ç¼å |
| | | /// </summary> |
| | | public class MesPositionCache : IMesPositionCache |
| | | { |
| | | #region Variables |
| | | private WhileThread AutoUpdateThread; |
| | | private DateTime LastUpdateTime = DateTime.MinValue; |
| | | #endregion |
| | | |
| | | #region Propertys |
| | | public string Id { get; set; } = Guid.NewGuid().ToString("N"); |
| | | public string Tag { get; set; } = "MesPositionCache"; |
| | | public string Name { get; set; } = "MesPositionCache"; |
| | | public bool IsRunning { get; set; } |
| | | private List<MES_POSITION> _Positions = new(); |
| | | public List<MES_POSITION> Positions { get { Update(); return _Positions; } set => _Positions = value; } |
| | | public MES_POSITION this[string code] { get { Update(); return _Positions.FirstOrDefault(q => q.POST_CODE == code); } } |
| | | #endregion |
| | | |
| | | #region Functions |
| | | /// <summary> |
| | | /// å¯å¨èªå¨æ´æ°ç¼å |
| | | /// </summary> |
| | | public void Start() |
| | | { |
| | | try |
| | | { |
| | | AutoUpdateThread = new(AutoUpdate); |
| | | AutoUpdateThread.Start(); |
| | | Logger.Default.Info("Start MesPosition Cache Auto Update Thread"); |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | Logger.Default.Fatal(ex, "Start MesPosition Cache Auto Update Thread Exception"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å
³éèªå¨æ´æ°ç¼å |
| | | /// </summary> |
| | | public void Stop() |
| | | { |
| | | try |
| | | { |
| | | AutoUpdateThread?.Stop(); |
| | | Logger.Console.Info("Stop MesPosition Cache Auto Update Thread"); |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | Logger.Console.Fatal(ex, "Stop MesPosition Cache Auto Update Thread Exception"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°æ°æ®ç¼å |
| | | /// </summary> |
| | | public void Update() |
| | | { |
| | | var lastUpdate = Biz.Db.Queryable<MES_POSITION>().Max(q => q.UPDATE_TIME); |
| | | if (LastUpdateTime < lastUpdate) |
| | | { |
| | | _Positions = Biz.Db.Queryable<MES_POSITION>().IncludesAllFirstLayer().ToList(); |
| | | LastUpdateTime = lastUpdate; |
| | | Logger.Console.Info($"Get MesPosition successful, total {Positions.Count}, last update time is {LastUpdateTime:yyyy-MM-dd HH:mm:ss}"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// èªå¨æ´æ° |
| | | /// </summary> |
| | | private void AutoUpdate() |
| | | { |
| | | try |
| | | { |
| | | Update(); |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | Logger.Console.Fatal(ex, "MesPosition Cache Auto Update Exception"); |
| | | LastUpdateTime = DateTime.MinValue; |
| | | } |
| | | |
| | | //ä¼ç 30åé |
| | | Thread.Sleep(30 * 60 * 1000);// |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | Logger.Scheduler.Info(context.Trigger.ConvertToMonitor()); |
| | | try |
| | | { |
| | | var _lastRunTime = Biz.SysParam["GetWo_LastRun", "Interface_LastRun"].PARAM_VALUE; |
| | | var _lastRunTime = Cache.SysParam["GetWo_LastRun", "Interface_LastRun"].PARAM_VALUE; |
| | | var LastRunTime = string.IsNullOrEmpty(_lastRunTime) ? DateTime.Now.AddMinutes(-10) : Convert.ToDateTime(_lastRunTime); |
| | | if ((DateTime.Now - LastRunTime).TotalMinutes > 10) |
| | | { |
| | |
| | | { |
| | | string msg = ""; |
| | | string status = "Successed"; |
| | | var _lastRunTime = Biz.SysParam["GetWo_LastRun", "Interface_LastRun"].PARAM_VALUE; |
| | | var _lastRunTime = Cache.SysParam["GetWo_LastRun", "Interface_LastRun"].PARAM_VALUE; |
| | | var LastRunTime = string.IsNullOrEmpty(_lastRunTime) ? DateTime.Now.AddMinutes(-10) : Convert.ToDateTime(_lastRunTime); |
| | | StartTime = DateTime.Now; |
| | | //if ((DateTime.Now - LastRunTime).TotalMinutes > 10) |
| | |
| | | switch (pv.VAR_METHOD) |
| | | { |
| | | case "GetCartonGenerate": |
| | | return Biz.CodeRule[lv.BARCODE_RULE ?? ""]?.Generate("B", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? ""; |
| | | return Cache.CodeRule[lv.BARCODE_RULE ?? ""]?.Generate("B", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? ""; |
| | | case "GetHW21SNGenerate": |
| | | return Biz.CodeRule[lv.BARCODE_RULE ?? ""]?.Generate("SN:", "05").Data.ToString() ?? ""; |
| | | return Cache.CodeRule[lv.BARCODE_RULE ?? ""]?.Generate("SN:", "05").Data.ToString() ?? ""; |
| | | default: |
| | | return ""; |
| | | } |
| | |
| | | /// <returns></returns> |
| | | private string GetBoxCode() |
| | | { |
| | | return Biz.CodeRule["WhiteBoxNo"]?.Generate("W", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? ""; |
| | | return Cache.CodeRule["WhiteBoxNo"]?.Generate("W", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? ""; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | private string GetCardCode() |
| | | { |
| | | return Biz.CodeRule["CartonNo"]?.Generate("B", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? ""; |
| | | return Cache.CodeRule["CartonNo"]?.Generate("B", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? ""; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | public string GenerateSN(string ruleCode, IWorkAction curAction) |
| | | { |
| | | var rule = Biz.CodeRule[ruleCode ?? ""]; |
| | | var rule = Cache.CodeRule[ruleCode ?? ""]; |
| | | if (!rule.IsNullOrEmpty()) |
| | | { |
| | | switch (rule.RULE_CODE) |
| | |
| | | //æ ¹æ®æ¡ç è§åéªè¯ä¸ææ¯å¦æ£ç¡® |
| | | if (!item.RuleCode.IsNullOrEmpty()) |
| | | { |
| | | if (!Biz.CodeRule[item.RuleCode].IsNullOrEmpty()) |
| | | if (!Cache.CodeRule[item.RuleCode].IsNullOrEmpty()) |
| | | { |
| | | var result = Biz.CodeRule[item.RuleCode].Verify(input.SN); |
| | | var result = Cache.CodeRule[item.RuleCode].Verify(input.SN); |
| | | if (!result.IsSuccessed) |
| | | { |
| | | isOK = false; |
| | |
| | | { |
| | | if (!subItem.RULE_CODE.IsNullOrEmpty()) |
| | | { |
| | | if (!Biz.CodeRule[subItem.RULE_CODE].IsNullOrEmpty()) |
| | | if (!Cache.CodeRule[subItem.RULE_CODE].IsNullOrEmpty()) |
| | | { |
| | | var result = Biz.CodeRule[item.RuleCode].Verify(input.SN); |
| | | var result = Cache.CodeRule[item.RuleCode].Verify(input.SN); |
| | | //åªè¦æä¸ä¸ªæ¿ä»£æéè¿éªè¯åå¯ä»¥ä¸æ |
| | | if (result.IsSuccessed) |
| | | { |
| | |
| | | action.LocaleMsg = new("MES.WorkAction.ThreeInOne.NotSameCustomer", CustCSN.CUST_SN, CustCSN.CUST_CODE, CurPosition.WorkBatch.WO.CUST_CODE); |
| | | } |
| | | //éªè¯äº§åå®¢æ·æ ç¾æ¡ç è§å |
| | | if (isOK && !CustInfo.IsNullOrEmpty() && !CustInfo.RULE_CODE.IsNullOrEmpty() && !Biz.CodeRule[CustInfo.RULE_CODE].IsNullOrEmpty()) |
| | | if (isOK && !CustInfo.IsNullOrEmpty() && !CustInfo.RULE_CODE.IsNullOrEmpty() && !Cache.CodeRule[CustInfo.RULE_CODE].IsNullOrEmpty()) |
| | | { |
| | | var result = Biz.CodeRule[CustInfo.RULE_CODE].Verify(CustCSN.CUST_SN); |
| | | var result = Cache.CodeRule[CustInfo.RULE_CODE].Verify(CustCSN.CUST_SN); |
| | | if (!result.IsSuccessed) |
| | | { |
| | | CurStep.SetStatusMessage(StepStatus.Error, Biz.L("è¯·æ«ææ£ç¡®çå®¢æ·æ ç¾")); |
| | |
| | | { |
| | | var isOK = true; |
| | | //éªè¯é»è¾ |
| | | if (!CustInfo.RULE_CODE.IsNullOrEmpty() && !Biz.CodeRule[CustInfo.RULE_CODE].IsNullOrEmpty()) |
| | | if (!CustInfo.RULE_CODE.IsNullOrEmpty() && !Cache.CodeRule[CustInfo.RULE_CODE].IsNullOrEmpty()) |
| | | { |
| | | var result = Biz.CodeRule[CustInfo.RULE_CODE].Verify(CurPosition.CurSN); |
| | | var result = Cache.CodeRule[CustInfo.RULE_CODE].Verify(CurPosition.CurSN); |
| | | if (!result.IsSuccessed) |
| | | { |
| | | CurStep.SetStatusMessage(StepStatus.Error, Biz.L("å®¢æ·æ ç¾éªè¯å¤±è´¥")); |
| | |
| | | //æ ¹æ®æ¡ç è§åéªè¯ä¸ææ¯å¦æ£ç¡® |
| | | if (!item.RuleCode.IsNullOrEmpty()) |
| | | { |
| | | if (!Biz.CodeRule[item.RuleCode].IsNullOrEmpty()) |
| | | if (!Cache.CodeRule[item.RuleCode].IsNullOrEmpty()) |
| | | { |
| | | var result = Biz.CodeRule[item.RuleCode].Verify(input.SN); |
| | | var result = Cache.CodeRule[item.RuleCode].Verify(input.SN); |
| | | if (!result.IsSuccessed) |
| | | { |
| | | isOK = false; |
| | |
| | | { |
| | | if (!subItem.RULE_CODE.IsNullOrEmpty()) |
| | | { |
| | | if (!Biz.CodeRule[subItem.RULE_CODE].IsNullOrEmpty()) |
| | | if (!Cache.CodeRule[subItem.RULE_CODE].IsNullOrEmpty()) |
| | | { |
| | | var result = Biz.CodeRule[item.RuleCode].Verify(input.SN); |
| | | var result = Cache.CodeRule[item.RuleCode].Verify(input.SN); |
| | | //åªè¦æä¸ä¸ªæ¿ä»£æéè¿éªè¯åå¯ä»¥ä¸æ |
| | | if (result.IsSuccessed) |
| | | { |
| | |
| | | { |
| | | public partial class MES_U9C : IMES_U9C |
| | | { |
| | | public static string U9CAuthLoginUrl { get; set; } = Biz.SysParam["U9CAuthLoginUrl_Test", "U9CUrl"].PARAM_VALUE; // "http://172.16.80.20/U9C/webapi/OAuth2/AuthLogin?"; æµè¯ |
| | | //public static string U9CAuthLoginUrl { get; set; } = Biz.SysParam["U9CAuthLoginUrl", "U9CUrl"].PARAM_VALUE; //æ£å¼ |
| | | public static string U9CAuthLoginUrl { get; set; } = Cache.SysParam["U9CAuthLoginUrl_Test", "U9CUrl"].PARAM_VALUE; // "http://172.16.80.20/U9C/webapi/OAuth2/AuthLogin?"; æµè¯ |
| | | //public static string U9CAuthLoginUrl { get; set; } = Cache.SysParam["U9CAuthLoginUrl", "U9CUrl"].PARAM_VALUE; //æ£å¼ |
| | | public static string secret = "&entcode=02&orgcode=101&clientid=mes&clientsecret=12c8ee7e9bb74ad2a6a0fb3315c8af20"; |
| | | public static string RcvRptDocCreateUrl |
| | | { get; set; } = Biz.SysParam["RcvRptDocCreateUrl_Test", "U9CUrl"].PARAM_VALUE; //"http://172.16.80.20/u9C/webapi/RcvRptDoc/Create"; æµè¯ |
| | | { get; set; } = Cache.SysParam["RcvRptDocCreateUrl_Test", "U9CUrl"].PARAM_VALUE; //"http://172.16.80.20/u9C/webapi/RcvRptDoc/Create"; æµè¯ |
| | | //public static string RcvRptDocCreateUrl |
| | | //{ get; set; } = Biz.SysParam["RcvRptDocCreateUrl", "U9CUrl"].PARAM_VALUE; //æ£å¼ |
| | | //{ get; set; } = Cache.SysParam["RcvRptDocCreateUrl", "U9CUrl"].PARAM_VALUE; //æ£å¼ |
| | | |
| | | /// <summary> |
| | | /// å
¥åºåæ¥å£ |
| | |
| | | /// <summary> |
| | | /// AGVæ¥å£URL |
| | | /// </summary> |
| | | public static string agvurl { get; set; } = @$"{Biz.SysParam["agvUrl", "AgvApiAddress"].PARAM_VALUE}"; //@"http://10.12.16.249:10007/rcs/order/"; |
| | | public static string agvurl { get; set; } = @$"{Cache.SysParam["agvUrl", "AgvApiAddress"].PARAM_VALUE}"; //@"http://10.12.16.249:10007/rcs/order/"; |
| | | |
| | | /// <summary> |
| | | /// 夿宿éç¥ |
| | |
| | | { |
| | | var action = new ApiAction(); |
| | | |
| | | Result ruleResult = Biz.CodeRule["PD001"].Generate("PD"); //iWMS.GetBillNoByType("CI"); |
| | | Result ruleResult = Cache.CodeRule["PD001"].Generate("PD"); //iWMS.GetBillNoByType("CI"); |
| | | if (!ruleResult.IsSuccessed) |
| | | { |
| | | throw new Exception(ruleResult.ExceptionMsg.Message); |
| | |
| | | { |
| | | var action = new ApiAction(); |
| | | |
| | | Result ruleResult = Biz.CodeRule["TF001"].Generate("TF"); //iWMS.GetBillNoByType("CI"); |
| | | Result ruleResult = Cache.CodeRule["TF001"].Generate("TF"); //iWMS.GetBillNoByType("CI"); |
| | | if (!ruleResult.IsSuccessed) |
| | | { |
| | | throw new Exception(ruleResult.ExceptionMsg.Message); |
| | |
| | | /// </summary> |
| | | public class Api |
| | | { |
| | | private static int WaitingTime = Biz.SysParam["Shelf_OperationWaitingTime"].PARAM_VALUE.ToInt32(30); |
| | | private static int WaitingTime = Cache.SysParam["Shelf_OperationWaitingTime"].PARAM_VALUE.ToInt32(30); |
| | | private static async Task<ShelfApiResult> RunAsync(string url, object obj = null) |
| | | { |
| | | try |
| | |
| | | MailTextBody = $"Hi Allï¼<br/><br/> {orderType}[{model.payload.std_data.parameter.indc008}]è°æ¨ä¸»å¨è¿è´¦å¤±è´¥ï¼<br/> T100è¿åæ¶æ¯ï¼{result.payload.std_data.execution.description}", |
| | | MailBodyType = "Html", |
| | | MailFilePath = null, |
| | | Recipients = Biz.SysParam.Params.Where(q => q.PRMG_CODE == "PickingEmailGroup").Select(q => q.PARAM_VALUE).ToList(), // new List<string> { "ben.lin@tigerclouds.com", "dyfang@sharetronic.com", "dianzicang@sharetronic.com" }, |
| | | Recipients = Cache.SysParam.Params.Where(q => q.PRMG_CODE == "PickingEmailGroup").Select(q => q.PARAM_VALUE).ToList(), // new List<string> { "ben.lin@tigerclouds.com", "dyfang@sharetronic.com", "dianzicang@sharetronic.com" }, |
| | | Cc = new List<string>(), |
| | | Sender = "WMS Email Admin", |
| | | SenderAddress = "xcerp@sharetronic.com", |
| | |
| | | MailTextBody = "以ä¸ç©æé¢è¶
æï¼è¯·åæ¶å¤çï¼<br/><br/>" + string.Join(" ", msg), |
| | | MailBodyType = "Html", |
| | | MailFilePath = null, |
| | | Recipients = Biz.SysParam.Params.Where(q => q.PRMG_CODE == "MaterialExtended").Select(q => q.PARAM_VALUE).ToList(), |
| | | Recipients = Cache.SysParam.Params.Where(q => q.PRMG_CODE == "MaterialExtended").Select(q => q.PARAM_VALUE).ToList(), |
| | | Cc = new List<string>(), |
| | | Sender = "WMS Email Admin", |
| | | SenderAddress = "xcerp@sharetronic.com", |
| | |
| | | Logger.Scheduler.Info(context.Trigger.ConvertToMonitor()); |
| | | try |
| | | { |
| | | var _lastRunTime = Biz.SysParam["Vender_LastTime"].PARAM_VALUE; |
| | | var _lastRunTime = Cache.SysParam["Vender_LastTime"].PARAM_VALUE; |
| | | var LastRunTime = string.IsNullOrEmpty(_lastRunTime) ? DateTime.Now.AddDays(-1) : Convert.ToDateTime(_lastRunTime); |
| | | if ((DateTime.Now - LastRunTime).TotalDays >= 1) |
| | | { |
| | |
| | | Logger.Scheduler.Info(context.Trigger.ConvertToMonitor()); |
| | | try |
| | | { |
| | | var _lastRunTime = Biz.SysParam["LastRun"].PARAM_VALUE; |
| | | var _lastRunTime = Cache.SysParam["LastRun"].PARAM_VALUE; |
| | | var LastRunTime = string.IsNullOrEmpty(_lastRunTime) ? DateTime.Now.AddMinutes(-30) : Convert.ToDateTime(_lastRunTime); |
| | | if ((DateTime.Now - LastRunTime).TotalMinutes > 30) |
| | | { |
| | |
| | | //var nWarehouseCodes = nScannedBarcodes.Select(x => x.WarehouseCode).Distinct().ToList(); |
| | | |
| | | //æ°å»ºå
¶ä»å
¥åºåæ®å¤´ OtherInstockHeader |
| | | Result ruleResult = Biz.CodeRule["CI001"].Generate("CI"); //iWMS.GetBillNoByType("CI"); |
| | | Result ruleResult = Cache.CodeRule["CI001"].Generate("CI"); //iWMS.GetBillNoByType("CI"); |
| | | if (!ruleResult.IsSuccessed) |
| | | { |
| | | throw new Exception(ruleResult.ExceptionMsg.Message); |
| | |
| | | pmdtud011 = "0" |
| | | }); |
| | | |
| | | Result iqcResult = Biz.CodeRule["IQC001"].Generate("IQC"); |
| | | Result iqcResult = Cache.CodeRule["IQC001"].Generate("IQC"); |
| | | if (!iqcResult.IsSuccessed) |
| | | { |
| | | throw new Exception(iqcResult.ExceptionMsg.Message); |
| | |
| | | //var nWarehouseCodes = nScannedBarcodes.Select(x => x.WarehouseCode).Distinct().ToList(); |
| | | |
| | | ////æ°å»ºåæ® |
| | | //Result ruleResult = Biz.CodeRule["R001"].Generate("RE"); |
| | | //Result ruleResult = Cache.CodeRule["R001"].Generate("RE"); |
| | | //if (!ruleResult.IsSuccessed) |
| | | //{ |
| | | // throw new Exception(ruleResult.ExceptionMsg.Message); |
| | |
| | | foreach (var resDtl in res) |
| | | { |
| | | //æ°å»ºåæ® |
| | | Result ruleResult = Biz.CodeRule["R001"].Generate("RE"); |
| | | Result ruleResult = Cache.CodeRule["R001"].Generate("RE"); |
| | | if (!ruleResult.IsSuccessed) |
| | | { |
| | | throw new Exception(ruleResult.ExceptionMsg.Message); |
| | |
| | | QTY = item.QTY |
| | | }); |
| | | |
| | | Result iqcResult = Biz.CodeRule["IQC001"].Generate("IQC"); |
| | | Result iqcResult = Cache.CodeRule["IQC001"].Generate("IQC"); |
| | | if (!iqcResult.IsSuccessed) |
| | | { |
| | | throw new Exception(iqcResult.ExceptionMsg.Message); |
| | |
| | | //var nWarehouseCodes = nScannedBarcodes.Select(x => x.WarehouseCode).Distinct().ToList(); |
| | | |
| | | //æ°å»ºå
¶ä»å
¥åºåæ®å¤´ OtherInstockHeader |
| | | Result ruleResult = Biz.CodeRule["OI001"].Generate("OI"); //iWMS.GetBillNoByType("CI"); |
| | | Result ruleResult = Cache.CodeRule["OI001"].Generate("OI"); //iWMS.GetBillNoByType("CI"); |
| | | if (!ruleResult.IsSuccessed) |
| | | { |
| | | throw new Exception(ruleResult.ExceptionMsg.Message); |
| | |
| | | UserCode = userCode; |
| | | ApiHost = apiHost; |
| | | OrgCode = orgCode; |
| | | Result ruleResult = Biz.CodeRule["NB001"].Generate("NB"); //iWMS.GetBillNoByType("CI"); |
| | | Result ruleResult = Cache.CodeRule["NB001"].Generate("NB"); //iWMS.GetBillNoByType("CI"); |
| | | if (!ruleResult.IsSuccessed) |
| | | { |
| | | throw new Exception(ruleResult.ExceptionMsg.Message); |
| | |
| | | //} |
| | | var MaxDC = CurPoolList.Any(x => x.ITEM_CODE == CurInv.ItemInfo.ITEM_CODE) ? CurPoolList.Where(x => x.ITEM_CODE == CurInv.ItemInfo.ITEM_CODE).Max(t => t.PROD_DATE) : DateTime.MinValue; |
| | | //å¤æç³»ç»åæ°æ¯å¦è®¾ç½®å
è¿å
åº |
| | | if (Biz.SysParam["YesOrNo"].PARAM_VALUE == "Y") |
| | | if (Cache.SysParam["YesOrNo"].PARAM_VALUE == "Y") |
| | | { |
| | | if (CurInv.Items.Max(x => x.PROD_DATE).Date > MaxDC.Date) |
| | | { |
| | |
| | | //} |
| | | var MaxDC = CurPoolList.Any(x => x.ITEM_CODE == CurInv.ItemInfo.ITEM_CODE) ? CurPoolList.Where(x => x.ITEM_CODE == CurInv.ItemInfo.ITEM_CODE).Max(t => t.PROD_DATE) : DateTime.MinValue; |
| | | //å¤æç³»ç»åæ°æ¯å¦è®¾ç½®å
è¿å
åº |
| | | if (Biz.SysParam["YesOrNo"].PARAM_VALUE == "Y") |
| | | if (Cache.SysParam["YesOrNo"].PARAM_VALUE == "Y") |
| | | { |
| | | if (CurInv.Items.Max(x => x.PROD_DATE).Date > MaxDC.Date) |
| | | { |
| | |
| | | .Where(x => x.FTY_CODE == FTY_CODE) |
| | | .First(); |
| | | //åéå°MES |
| | | if (Biz.SysParam["IsSend", "SendToMES"].PARAM_VALUE.ToString() == "Y" && !ReqNo.IsNullOrEmpty() && Biz.Db.Queryable<BIZ_ERP_PROD_OUT>().Where(x => x.BILLCODE == ReqNo).Any()) |
| | | if (Cache.SysParam["IsSend", "SendToMES"].PARAM_VALUE.ToString() == "Y" && !ReqNo.IsNullOrEmpty() && Biz.Db.Queryable<BIZ_ERP_PROD_OUT>().Where(x => x.BILLCODE == ReqNo).Any()) |
| | | { |
| | | var dtl = Biz.Db.Queryable<BIZ_ERP_PROD_OUT_DTL>().Where(x => x.BILLCODE == ReqNo).First(); |
| | | var sourcecode = dtl != null ? dtl.SOURCECODE : ""; |
| | |
| | | erpBillCode = ReqNo, //MESæ¥å£å¢å åæ®µï¼è¿å夿宿çå½å颿åå· 2023/05/17 Ben Lin |
| | | taskid = "" |
| | | }; |
| | | var mesApi = _factory != null ? _factory.MES_API : Biz.SysParam["apiUrl", "SendToMES"].PARAM_VALUE.ToString(); |
| | | var mesApi = _factory != null ? _factory.MES_API : Cache.SysParam["apiUrl", "SendToMES"].PARAM_VALUE.ToString(); |
| | | var res = HttpHelper.PostAsync(mesApi, JsonConvert.SerializeObject(toMes)).Result; |
| | | var _action = JsonConvert.DeserializeObject<ApiAction>(res.Message); |
| | | Logger.Interface.Info($"çäº§é¢æ-èªå¨æåç©æ =>æåç©æåæåéMES宿ï¼åå·ï¼[{ReqNo}]ï¼MESä¼ å
¥Json:{JsonConvert.SerializeObject(toMes)}ï¼MESè¿åï¼{res.Message}"); |
| | |
| | | //} |
| | | var MaxDC = CurPoolList.Any(x => x.ITEM_CODE == CurInv.ItemInfo.ITEM_CODE) ? CurPoolList.Where(x => x.ITEM_CODE == CurInv.ItemInfo.ITEM_CODE).Max(t => t.PROD_DATE) : DateTime.MinValue; |
| | | //å¤æç³»ç»åæ°æ¯å¦è®¾ç½®å
è¿å
åº |
| | | if (Biz.SysParam["YesOrNo"].PARAM_VALUE == "Y") |
| | | if (Cache.SysParam["YesOrNo"].PARAM_VALUE == "Y") |
| | | { |
| | | if (CurInv.Items.Max(x => x.PROD_DATE).Date > MaxDC.Date) |
| | | { |
| | |
| | | //} |
| | | var MaxDC = CurPoolList.Any(x => x.ITEM_CODE == CurInv.ItemInfo.ITEM_CODE) ? CurPoolList.Where(x => x.ITEM_CODE == CurInv.ItemInfo.ITEM_CODE).Max(t => t.PROD_DATE) : DateTime.MinValue; |
| | | //å¤æç³»ç»åæ°æ¯å¦è®¾ç½®å
è¿å
åº |
| | | if (Biz.SysParam["YesOrNo"].PARAM_VALUE == "Y") |
| | | if (Cache.SysParam["YesOrNo"].PARAM_VALUE == "Y") |
| | | { |
| | | if (CurInv.Items.Max(x => x.PROD_DATE).Date > MaxDC.Date) |
| | | { |
| | |
| | | } |
| | | |
| | | //åéå°MES |
| | | var isSend = Biz.SysParam["IsSend", "SendToMES"].PARAM_VALUE.ToString() == "Y"; |
| | | var isSend = Cache.SysParam["IsSend", "SendToMES"].PARAM_VALUE.ToString() == "Y"; |
| | | if (isSend && !isCutting) |
| | | { |
| | | var mesApi = _factory != null ? _factory.MES_API : Biz.SysParam["apiUrl", "SendToMES"].PARAM_VALUE.ToString(); |
| | | var mesApi = _factory != null ? _factory.MES_API : Cache.SysParam["apiUrl", "SendToMES"].PARAM_VALUE.ToString(); |
| | | var response = HttpHelper.PostAsync(mesApi, JsonConvert.SerializeObject(toMes)).Result; |
| | | var _action = JsonConvert.DeserializeObject<ApiAction>(response.Message); |
| | | Logger.Interface.Info($"å·¥å颿 =>åæå®æï¼åå·[{req.BILLCODE}]ï¼æ¡ç [{CurInv.SN}]ï¼ç¶æ[{req.STATUS.GetEnumDesc<BIZ_ERP_PROD_OUT.STATUSs>()}]ï¼MESè¿åï¼{response.Message}"); |
| | |
| | | //} |
| | | var MaxDC = CurPoolList.Any(x => x.ITEM_CODE == CurInv.ItemInfo.ITEM_CODE) ? CurPoolList.Where(x => x.ITEM_CODE == CurInv.ItemInfo.ITEM_CODE).Max(t => t.PROD_DATE) : DateTime.MinValue; |
| | | //å¤æç³»ç»åæ°æ¯å¦è®¾ç½®å
è¿å
åº |
| | | if (Biz.SysParam["YesOrNo"].PARAM_VALUE == "Y") |
| | | if (Cache.SysParam["YesOrNo"].PARAM_VALUE == "Y") |
| | | { |
| | | if (CurInv.Items.Max(x => x.PROD_DATE).Date > MaxDC.Date) |
| | | { |
| | |
| | | type = "done" |
| | | }; |
| | | //JObject resp = PostMesApi(@"http://172.18.8.56:9533/api/WMS/Agv/materialPreparation", JsonConvert.SerializeObject(agvMPInput)); |
| | | var agvurl = _factory != null ? _factory.AGV_API : @$"{Biz.SysParam["agvUrl", "AgvApiAddress"].PARAM_VALUE}"; ; |
| | | var agvurl = _factory != null ? _factory.AGV_API : @$"{Cache.SysParam["agvUrl", "AgvApiAddress"].PARAM_VALUE}"; ; |
| | | var agvResult = DI.Resolve<IAGV>().materialPreparation(agvMPInput, agvurl); |
| | | |
| | | req.STATUS = BIZ_ERP_PROD_OUT.STATUSs.COMPLETE.GetValue(); |
| | |
| | | } |
| | | |
| | | //åéå°MES |
| | | var isSend = Biz.SysParam["IsSend", "SendToMES"].PARAM_VALUE.ToString() == "Y"; |
| | | var isSend = Cache.SysParam["IsSend", "SendToMES"].PARAM_VALUE.ToString() == "Y"; |
| | | if (isSend && !isCutting) |
| | | { |
| | | var mesApi = _factory != null ? _factory.MES_API : Biz.SysParam["apiUrl", "SendToMES"].PARAM_VALUE.ToString(); |
| | | var mesApi = _factory != null ? _factory.MES_API : Cache.SysParam["apiUrl", "SendToMES"].PARAM_VALUE.ToString(); |
| | | var response = HttpHelper.PostAsync(mesApi, JsonConvert.SerializeObject(toMes)).Result; |
| | | var _action = JsonConvert.DeserializeObject<ApiAction>(response.Message); |
| | | Logger.Interface.Info($"çäº§é¢æ =>åæå®æï¼åå·[{req.BILLCODE}]ï¼æ¡ç [{CurInv.SN}]ï¼ç¶æ[{req.STATUS.GetEnumDesc<BIZ_ERP_PROD_OUT.STATUSs>()}]ï¼MESä¼ å
¥Json:{JsonConvert.SerializeObject(toMes)}ï¼ MESè¿åï¼{response.Message}"); |
| | |
| | | |
| | | // çææ¶æå |
| | | //æ°å»ºåæ® |
| | | Result ruleResult = Biz.CodeRule["R001"].Generate("RE"); |
| | | Result ruleResult = Cache.CodeRule["R001"].Generate("RE"); |
| | | if (!ruleResult.IsSuccessed) |
| | | { |
| | | throw new Exception(ruleResult.ExceptionMsg.Message); |
| | |
| | | QTY = item.QTY |
| | | }); |
| | | |
| | | Result iqcResult = Biz.CodeRule["IQC001"].Generate("IQC"); |
| | | Result iqcResult = Cache.CodeRule["IQC001"].Generate("IQC"); |
| | | if (!iqcResult.IsSuccessed) |
| | | { |
| | | throw new Exception(iqcResult.ExceptionMsg.Message); |
| | |
| | | MailTextBody = $"Hi Allï¼<br/><br/> 颿å[{entity_h.BILLCODE}]è¿è´¦å¤±è´¥ï¼<br/> T100è¿åæ¶æ¯ï¼{ret.payload.std_data.execution.description}", |
| | | MailBodyType = "Html", |
| | | MailFilePath = null, |
| | | Recipients = Biz.SysParam.Params.Where(q => q.PRMG_CODE == "PickingEmailGroup").Select(q => q.PARAM_VALUE).ToList(), // new List<string> { "ben.lin@tigerclouds.com", "dyfang@sharetronic.com", "dianzicang@sharetronic.com" }, |
| | | Recipients = Cache.SysParam.Params.Where(q => q.PRMG_CODE == "PickingEmailGroup").Select(q => q.PARAM_VALUE).ToList(), // new List<string> { "ben.lin@tigerclouds.com", "dyfang@sharetronic.com", "dianzicang@sharetronic.com" }, |
| | | Cc = new List<string>(), |
| | | Sender = "WMS Email Admin", |
| | | SenderAddress = "xcerp@sharetronic.com", |
| | |
| | | MailTextBody = $"Hi Allï¼<br/><br/> 颿å[{entity_h.BILLCODE}]è¿è´¦å¤±è´¥ï¼<br/> T100è¿åæ¶æ¯ï¼{ret.payload.std_data.execution.description}", |
| | | MailBodyType = "Html", |
| | | MailFilePath = null, |
| | | Recipients = Biz.SysParam.Params.Where(q => q.PRMG_CODE == "PickingEmailGroup").Select(q => q.PARAM_VALUE).ToList(), // new List<string> { "ben.lin@tigerclouds.com", "dyfang@sharetronic.com", "dianzicang@sharetronic.com" }, |
| | | Recipients = Cache.SysParam.Params.Where(q => q.PRMG_CODE == "PickingEmailGroup").Select(q => q.PARAM_VALUE).ToList(), // new List<string> { "ben.lin@tigerclouds.com", "dyfang@sharetronic.com", "dianzicang@sharetronic.com" }, |
| | | Cc = new List<string>(), |
| | | Sender = "WMS Email Admin", |
| | | SenderAddress = "xcerp@sharetronic.com", |
| | |
| | | using System.Diagnostics; |
| | | using System.Threading; |
| | | using System.Data; |
| | | using Tiger.IBusiness; |
| | | |
| | | namespace Tiger.Business |
| | | { |
| | | public partial class Biz |
| | | { |
| | | /// <summary> |
| | | /// è·åæ¡ç è§åç¼å |
| | | /// </summary> |
| | | public static CodeRuleCache CodeRule => DbCacheBus.CodeRuleCache; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// BAS_CODE_RULE æ©å±ç±» |
| | | /// </summary> |
| | |
| | | /// <returns></returns> |
| | | public static Result Verify(this BAS_CODE_RULE rule, string sn) |
| | | { |
| | | return Biz.CodeRule.Verify(sn, rule); |
| | | return Cache.CodeRule.Verify(sn, rule); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | public static Result Generate(this BAS_CODE_RULE rule, params object?[] args) |
| | | { |
| | | return Biz.CodeRule.Generate(rule.RULE_CODE, args); |
| | | return Cache.CodeRule.Generate(rule.RULE_CODE, args); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | public static Result TryGenerate(this BAS_CODE_RULE rule, params object?[] args) |
| | | { |
| | | return Biz.CodeRule.TryGenerate(rule.RULE_CODE, args); |
| | | return Cache.CodeRule.TryGenerate(rule.RULE_CODE, args); |
| | | } |
| | | }//endClass |
| | | |
| | |
| | | public Expression<Func<BAS_CODE_RULE, bool>> Expression { get; set; } |
| | | public Exception VerifyException { get; set; } |
| | | private List<RuleVerifier> _Verifiers = new(); |
| | | public List<RuleVerifier> Verifiers => _Verifiers.IsNullOrEmpty() ? Biz.CodeRule.Rules.WhereIF(!Predicate.IsNullOrEmpty(), Predicate).Select(q => new RuleVerifier(q)).ToList() : _Verifiers; |
| | | public List<RuleVerifier> Verifiers => _Verifiers.IsNullOrEmpty() ? Cache.CodeRule.Rules.WhereIF(!Predicate.IsNullOrEmpty(), Predicate).Select(q => new RuleVerifier(q)).ToList() : _Verifiers; |
| | | /// <summary> |
| | | /// æ¯å¦å®æéªè¯ |
| | | /// </summary> |
| | |
| | | var begin = DateTime.Now; |
| | | ElapsedTime = 0; |
| | | //Debug.WriteLine($"{Code} verify begin at {begin:T}"); |
| | | _Verifiers = Biz.CodeRule.Rules.WhereIF(!Predicate.IsNullOrEmpty(), Predicate).Select(q => new RuleVerifier(q)).ToList(); |
| | | _Verifiers = Cache.CodeRule.Rules.WhereIF(!Predicate.IsNullOrEmpty(), Predicate).Select(q => new RuleVerifier(q)).ToList(); |
| | | foreach (var item in Verifiers) |
| | | { |
| | | Work.DoAsync(() => { item.Verify(Code); }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Tiger.Model; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq.Expressions; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Rhea.Common; |
| | | using System.Net; |
| | | using System.Linq; |
| | | using Newtonsoft.Json; |
| | | using Tiger.Business.DbCache; |
| | | using Tiger.IBusiness; |
| | | |
| | | namespace Tiger.Business |
| | | { |
| | | public partial class Cache |
| | | { |
| | | /// <summary> |
| | | /// è·åæ¡ç è§åç¼å |
| | | /// </summary> |
| | | public static ICodeRuleCache CodeRule => DI.Resolve<ICodeRuleCache>(); |
| | | /// <summary> |
| | | /// è·åç³»ç»åæ°ç¼å |
| | | /// </summary> |
| | | public static ISysParamCache SysParam => DI.Resolve<ISysParamCache>(); |
| | | }//endClass |
| | | } |
| | |
| | | var action = new ApiAction<List<SYS_PARAM>>(); |
| | | try |
| | | { |
| | | action.Data = code.IsNullOrEmpty()? Biz.SysParam.Params.Where(x=>x.PRMG_CODE == group).ToList(): new List<SYS_PARAM>() { Biz.SysParam[code, group] } ; |
| | | action.Data = code.IsNullOrEmpty()? Cache.SysParam.Params.Where(x=>x.PRMG_CODE == group).ToList(): new List<SYS_PARAM>() { Cache.SysParam[code, group] } ; |
| | | action.Message = $"è·ååæ°æåã"; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | <Compile Remove="BaseService.cs" /> |
| | | <Compile Remove="Common\ApiConfig.cs" /> |
| | | <Compile Remove="DbBaseR.cs" /> |
| | | <Compile Remove="DbCache\DbCacheBus.cs" /> |
| | | <Compile Remove="DbClientR.cs" /> |
| | | <Compile Remove="MES\Biz.WorkAction.cs" /> |
| | | </ItemGroup> |
| | |
| | | using System.Threading.Tasks; |
| | | using Tiger.Model; |
| | | using System.Linq.Expressions; |
| | | using Tiger.Api.DbCache; |
| | | |
| | | namespace Tiger.Api.Controllers.Base |
| | | { |
| | |
| | | ApiAction response; |
| | | try |
| | | { |
| | | response = action.GetResponse(DI.Resolve<IDbCacheBus>().GetCodeRuleCache()[action.Data?.ToString() ?? ""]); |
| | | response = action.GetResponse(Cache.CodeRule[action.Data?.ToString() ?? ""]); |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | |
| | | ApiAction response; |
| | | try |
| | | { |
| | | response = action.GetResponse(DI.Resolve<IDbCacheBus>().GetCodeRuleCache().Rules.Where(q => q.RULE_TYPE == (action.Data?.ToInt32() ?? -1)).ToList()); |
| | | response = action.GetResponse(Cache.CodeRule.Rules.Where(q => q.RULE_TYPE == (action.Data?.ToInt32() ?? -1)).ToList()); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | ApiAction response; |
| | | try |
| | | { |
| | | response = action.GetResponse(DI.Resolve<IDbCacheBus>().GetCodeRuleCache().TryGenerate(action.Data?.RuleCode, action.Data?.Args)); |
| | | response = action.GetResponse(Cache.CodeRule.TryGenerate(action.Data?.RuleCode, action.Data?.Args)); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | ApiAction response; |
| | | try |
| | | { |
| | | response = action.GetResponse(DI.Resolve<IDbCacheBus>().GetCodeRuleCache().Generate(action.Data?.RuleCode, action.Data?.Args)); |
| | | response = action.GetResponse(Cache.CodeRule.Generate(action.Data?.RuleCode, action.Data?.Args)); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | predicate = predicate.And(q => q.RULE_TYPE == action.Data.RuleType); |
| | | } |
| | | response = action.GetResponse(DI.Resolve<IDbCacheBus>().GetCodeRuleCache().Verify(action.Data?.Code, predicate.Compile())); |
| | | response = action.GetResponse(Cache.CodeRule.Verify(action.Data?.Code, predicate.Compile())); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | using Tiger.IBusiness; |
| | | using System.Linq; |
| | | using System.Threading.Tasks; |
| | | using Tiger.Api.DbCache; |
| | | |
| | | namespace Tiger.Api.Controllers.Base |
| | | { |
| | |
| | | ApiAction response; |
| | | try |
| | | { |
| | | response = action.GetResponse(DI.Resolve<IDbCacheBus>().GetSysParamCache()[action.Data?.ToString() ?? ""]); |
| | | response = action.GetResponse(Cache.SysParam[action.Data?.ToString() ?? ""]); |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | |
| | | ApiAction response; |
| | | try |
| | | { |
| | | response = action.GetResponse(DI.Resolve<IDbCacheBus>().GetSysParamCache().Groups.FirstOrDefault(q => q.PRMG_CODE == (action.Data?.ToString() ?? ""))); |
| | | response = action.GetResponse(Cache.SysParam.Groups.FirstOrDefault(q => q.PRMG_CODE == (action.Data?.ToString() ?? ""))); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | ApiAction response; |
| | | try |
| | | { |
| | | response = action.GetResponse(DI.Resolve<IDbCacheBus>().GetSysParamCache().Groups.Where(q => q.PRMG_TYPE == (action.Data?.ToString() ?? "")).ToList()); |
| | | response = action.GetResponse(Cache.SysParam.Groups.Where(q => q.PRMG_TYPE == (action.Data?.ToString() ?? "")).ToList()); |
| | | } |
| | | catch (Exception ex) |
| | | { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Autofac; |
| | | using Rhea.Common; |
| | | using Rhea.Common.Interface; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Text.RegularExpressions; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using Tiger.Model; |
| | | |
| | | namespace Tiger.IBusiness |
| | | { |
| | | public interface IMesDefectCache : ITigerCache |
| | | { |
| | | public List<BAS_DEFECT_GRP> Groups { get; set; } |
| | | public List<BAS_DEFECT> Defects { get; set; } |
| | | public BAS_DEFECT this[string code, string group = null] { get; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Autofac; |
| | | using Rhea.Common; |
| | | using Rhea.Common.Interface; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using Tiger.Model; |
| | | |
| | | namespace Tiger.IBusiness |
| | | { |
| | | public interface IMesPositionCache : ITigerCache |
| | | { |
| | | public List<MES_POSITION> Positions { get; set; } |
| | | public MES_POSITION this[string code] { get; } |
| | | |
| | | } |
| | | } |