服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-10-29 83d595aad854a42d6b28f8651ee7ef774dfd4e04
Tiger.Business.MES/Transaction/Position.cs
@@ -14,6 +14,7 @@
using System.Globalization;
using Tiger.Business.MES.WorkAction;
using System.Collections;
using Tiger.IBusiness.MES.WorkAction;
namespace Tiger.Business.MES.Transaction
{
@@ -566,9 +567,9 @@
                                case "GetPackNumber":
                                    return GetLabelVarWo(lv, WorkBatch.WO.ORDER_NO);
                                case "GetBoxQR":
                                    return curAction is PackingAction ? GetBoxCode(lvars, curAction as PackingAction) : "";
                                    return GetCardOrBoxQR(GetBoxCode(lvars), curAction);
                                case "GetCardQR":
                                    return curAction is PackingAction ? GetCardOrBoxQR(GetCardCode(lvars), lvars, curAction as PackingAction) : "";
                                    return GetCardOrBoxQR(GetCardCode(lvars), curAction);
                                case "GetCardSN":
                                    List<string> minPkgList = new List<string>();
                                    var _pkaction = curAction is PackingAction ? curAction as PackingAction : null;
@@ -595,10 +596,13 @@
                                    return GetHuaWeiWeek(WorkBatch.Batch.ORDER_NO, list);
                                case "GetQty":
                                    List<string> qtylist = new List<string>();
                                    var _qtyAction = curAction is PackingAction ? curAction as PackingAction : null;
                                    if (_qtyAction != null)
                                    if (curAction is PackingAction)
                                    {
                                        qtylist = GetMinPkgList(_qtyAction);
                                        qtylist = GetMinPkgList(curAction as PackingAction);
                                    }
                                    if (curAction is PrintInStoreLabel)
                                    {
                                        qtylist = (curAction as PrintInStoreLabel).CurPkg.Item.GetMinPackageList().Select(q=>q.SN).ToList();
                                    }
                                    return $"{qtylist.Count}PCS";
                                case "GetModel":
@@ -732,10 +736,9 @@
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        private string GetBoxCode(List<BAS_LABEL_VAR> lvars, PackingAction action)
        private string GetBoxCode(List<BAS_LABEL_VAR> lvars)
        {
            var boxCode = Biz.CodeRule["WhiteBoxNo"]?.Generate("W", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? "";
            return GetCardOrBoxQR(boxCode, lvars, action);
            return Biz.CodeRule["WhiteBoxNo"]?.Generate("W", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? "";
        }
        /// <summary>
@@ -746,8 +749,7 @@
        /// <returns></returns>
        private string GetCardCode(List<BAS_LABEL_VAR> lvars)
        {
            var cardCode = Biz.CodeRule["CartonNo"]?.Generate("B", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? "";
            return cardCode;
            return Biz.CodeRule["CartonNo"]?.Generate("B", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? "";
        }
        /// <summary>
@@ -757,15 +759,31 @@
        /// <param name="lvars"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        private string GetCardOrBoxQR(string code, List<BAS_LABEL_VAR> lvars, PackingAction action)
        private string GetCardOrBoxQR(string code, IWorkAction action)
        {
            var minPkgList = action.CurPkg.Item.GetMinPackageList().Select(q => q.SN);
            List<string> minPkgList = new List<string>();
            var itemCode = "";
            double weight = 0;
            var unit = "";
            if (action is PackingAction)
            {
                var pkg = action as PackingAction;
                minPkgList = pkg.CurPkg.Item.GetMinPackageList().Select(q => q.SN).ToList();
                itemCode = pkg.CurPkg.CustSN?.ITEM_CODE;
                weight = pkg.CurPkg.WeightInfo.Weight;
                unit = pkg.CurPkg.WeightInfo.Unit?.ToUpper() ?? "kg";
            }
            if (action is PrintInStoreLabel)
            {
                var print = action as PrintInStoreLabel;
                minPkgList = print.CurPkg.Item.GetMinPackageList().Select(q => q.SN).ToList();
                itemCode = print.CurPkg.CustSN?.ITEM_CODE;
                weight = print.CurPkg.WeightInfo.Weight;
                unit = print.CurPkg.WeightInfo.Unit?.ToUpper() ?? "kg";
            }
            var wo = WorkBatch.Batch.ORDER_NO;
            var snList = string.Join("\r\n", minPkgList);
            if (snList.IsNullOrEmpty()) { snList = $"{CurSN}"; }
            var itemCode = action.CurPkg.CustSN?.ITEM_CODE;
            var weight = action.CurPkg.WeightInfo.Weight;
            var unit = action.CurPkg.WeightInfo.Unit.ToUpper();
            var model = WorkBatch.Product.ExtInfo?.Model;
            var Input = WorkBatch.Product.ExtInfo?.Input;
            var OutPut = WorkBatch.Product.ExtInfo?.OutPut;