public static void ProcessNoSend(int quantity) { var items = ExceptionDao.GetNoSendCommand(quantity); foreach (var commandInfo in items) { CommandInfo info = commandInfo; #if debug Execute(info); #else var threadStart = new ThreadStart(() => Execute(info)); var thread = new Thread(threadStart); thread.Start(); #endif } }
public static void ProcessFailure(int quantity, int failCount) { var items = ExceptionDao.GetFailureExceptionByFailCount(quantity, failCount); foreach (var commandInfo in items) { CommandInfo info = commandInfo; #if debug Execute(info); #else var threadStart = new ThreadStart(() => Execute(info)); var thread = new Thread(threadStart); thread.Start(); #endif } }
/// <summary> /// 运行KD的异步数据 /// </summary> /// <param name="commandInfo"> </param> private static void Execute(CommandInfo commandInfo) { var prmObjs = DesObjectArray(commandInfo.CommandParameter); if (prmObjs != null) { string fromSourceName = string.Empty; var count = prmObjs.Count(); if (count > 0) { var fromSourceId = (Guid)prmObjs[count - 2]; if (_fromSourceDict.ContainsKey(fromSourceId)) { fromSourceName = _fromSourceDict[fromSourceId].ToLower().Replace("endpoint", string.Empty); } } //处理参数信息 var arrayList = prmObjs.ToList(); arrayList.RemoveAt(prmObjs.Count() - 1); arrayList.RemoveAt(prmObjs.Count() - 2); //默认第一个参数必须是CommandID if (arrayList[0] is Guid) { if ((Guid)arrayList[0] != commandInfo.CommandID) { arrayList.Insert(0, commandInfo.CommandID); } } else { arrayList.Insert(0, commandInfo.CommandID); } var prms = arrayList.ToArray(); object result; try { if (fromSourceName == string.Empty) { fromSourceName = "eyesee"; } //#region -- 临时处理订单同步 //if (commandInfo.CommandMethod == "UpdateManyOrderState") //{ // var ids = prms[1] as List<Guid>; // var state = prms[2] is OrderState ? (OrderState) prms[2] : OrderState.Consignmented; // if (ids != null) // { // foreach (var id in ids) // { // result = Execute(fromSourceName, "UpdateOrderState", Guid.NewGuid(), id, state); // //Thread.Sleep(10); // } // } //} //#endregion result = Execute(fromSourceName, commandInfo.CommandMethod, prms); } catch (Exception expInfo) { result = expInfo; } ProcessSendResult(commandInfo.CommandID, result); } }