服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-09-04 0116b5d2ed16a0825da9e7474fc786ee06b2d60c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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
{
    /// <summary>
    /// 货架遥控器
    /// </summary>
    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
        /// <summary>
        /// CloseShelfAllLight
        /// </summary>
        /// <returns></returns>
        public async Task<ApiAction> 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<string>();
                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<ApiAction> 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
}