服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2025-01-10 0aa630ac8c349b35da1f87c4cf1af7151d13d5c5
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
using Rhea.Common;
using Tiger.Model.Minsun;
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 Apache.NMS;
using System.Drawing.Drawing2D;
using Tiger.Model.Sharetronic.Shelf;
using Tiger.IBusiness;
 
namespace Tiger.Business.WMS.Transaction
{
    /// <summary>
    /// 查储位补印条码事务
    /// </summary>
    public class RePrintLabel : WMSTransactionBase, IRePrintLabel
    {
        public IRePrintLabel Init(string id, string userCode, string apiHost, string orgCode)
        {
            TransID = id;
            UserCode = userCode;
            ApiHost = apiHost;
            OrgCode = orgCode;
            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 OrgCode { get; set; }
        public List<SuggestItem> Suggests { get; set; } = new();
        public List<V_WMS_ITEM> Vitem { get; set; } = new();
        public List<WMS_ITEM_POOL> CurPoolList => Suggests.Where(q => !q.poolItem.IsNullOrEmpty()).Select(q => q.poolItem).ToList();
        public Inventory CurInv { get; set; }
        public BIZ_ERP_PROD_OUT req { get; set; }
        public ReqType CurReqType { get; set; }
        public List<BIZ_ERP_PROD_OUT_DTL> dtls { get; set; } = new();
        public bool isExceed { get; set; }
        public ProductionPickToMes toMes { get; set; }
        public bool his_isComplete { get; set; }
        public bool isCutting { get; set; }
        public decimal cutQty { get; set; }
 
        public BIZ_WMS_TRANSFER transferH = null;
        public BIZ_WMS_TRANSFER cTransferH = null;
        public BIZ_WMS_TRANSFER_DTL transferDtl = null;
        public BIZ_WMS_TRANSFER_SN transferSn = null;
        #endregion
 
        #region Functions
        /// <summary>
        /// 扫描入口
        /// </summary>
        public async Task<ApiAction<ScanOutput>> Scan(BaseInput input)
        {
            var action = new ApiAction<ScanOutput>();
            try
            {
                if (input.SN.IsNullOrEmpty())
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = Biz.L("WMS.RePrint.ScanItem.SnEmptyFailure");
                    return SetOutPutMqttMsg(action, input.Locale);
                }
                
                var whUnit = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => (t.SHELF_CODE.ToUpper() == input.SN || t.LOCATION_CODE.ToUpper() == input.SN) && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync();
                
                
            }
            catch (Exception ex)
            {
                //取消当前操作
                ResetInfo();
                //action.CatchExceptionWithLog(ex, $"扫描[{input.SN}]异常");
                action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.Scan.ScanException", input.SN));
            }
            return SetOutPutMqttMsg(action, input.Locale);
        }
 
        #endregion
 
        public override bool Close(bool needSaveHistoryLog = false)
        {
            needSaveHistoryLog = true;
            //保存操作日志
 
            this.IsFinished = true;
            return IsFinished ? base.Close(needSaveHistoryLog) : IsFinished;
        }
 
    }//endClass
}