using Rhea.Common; using Microsoft.AspNetCore.Http; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading; using System.Threading.Tasks; using Tiger.Model; using Org.BouncyCastle.Ocsp; using Newtonsoft.Json; using Apache.NMS.ActiveMQ.Commands; using Tiger.IBusiness; namespace Tiger.Business.WMS.Transaction { /// /// 货架遥控器 /// public class ShelfRemote : WMSTransactionBase, IShelfRemote { public IShelfRemote Init(string id, string userCode, string apiHost) { TransID = id; UserCode = userCode; ApiHost = apiHost; Logger.Console.Info($"Start {this.GetType().Name} Transaction[ID: {TransID}]"); return this; } #region Propertys & Variables public string UserCode { get; set; } public long UserId { get; set; } public string CurInv { get; set; } public AuthOption option { get; set; } #endregion #region Functions /// /// CloseShelfAllLight /// /// public async Task CloseShelfAllLight(string shelfStr) { var action = new ApiAction(true); try { var shelfs = shelfStr.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(q => q + "F").ToList(); shelfs.AddRange(shelfs.Select(q => q.Substring(0, q.Length - 1) + "R").ToList()); var success = new List(); foreach (var shelf in shelfs) { var result = await Share.Shelf.DownAll(shelf); if (result.IsSuccess) { success.Add(shelf); } } shelfs.RemoveAll(q => success.Contains(q)); if (success.Count == 0) { action.IsSuccessed = false; action.LocaleMsg = Biz.L($"货架[{string.Join(",", shelfs)}]灭灯失败"); } else { action.IsSuccessed = true; action.LocaleMsg = Biz.L($"货架[{string.Join(",", success)}]灭灯成功{(shelfs.IsNullOrEmpty() ? "" : $",货架[{string.Join(",", shelfs)}]灭灯失败")}"); } } catch (Exception ex) { action.CatchExceptionWithLog(ex, $"Close shelf all light[{shelfStr}] exception"); } return action; } public async Task Test(string billCode) { var action = new ApiAction(); try { string CurOrg = billCode; } catch (Exception ex) { action.CatchExceptionWithLog(ex, $"其他入库单[]过账异常"); } return action; } #endregion public override bool Close(bool needSaveHistoryLog = false) { //保存操作日志 this.IsFinished = true; return IsFinished ? base.Close(needSaveHistoryLog) : IsFinished; } }//endClass }