服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-11-06 a96e763c96401cbc7695acbcd6b18770d8aedf8d
Tiger.Business.MES/BIZ/BIZ_MES_WO.cs
@@ -18,6 +18,7 @@
using System.Drawing.Printing;
using System.Net.NetworkInformation;
using Tiger.Model.MES.Yada;
using static Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser;
namespace Tiger.Business.MES
{
@@ -554,7 +555,8 @@
            try
            {
                //先查出工单条码中是否存在
                var woSn = await Biz.Db.Queryable<BIZ_MES_WO_SN>().Where(q => q.SN.Equals(input.Code) || q.FLOW_SN.Equals(input.Code)).FirstAsync();
                var outerSn = input.Code.Split('|')[0];
                var woSn = await Biz.Db.Queryable<BIZ_MES_WO_SN>().Where(q => q.SN.Equals(input.Code) || q.FLOW_SN.Equals(input.Code) || q.OUTER_SN == outerSn).FirstAsync();
                if (woSn == null)
                {
                    result.IsSuccessed = false;
@@ -605,13 +607,14 @@
            {
                DbClient db = Biz.DataSource["YadaU9C"].Client;
                var org = await Biz.Db.Queryable<SYS_ORGANIZATION>().Where(q=>q.ORG_CODE == orgCode).FirstAsync();
                if (db.Queryable<mes_ShipList>().Any(q => q.MoDoc.Equals(wo) && SqlFunc.DateIsSame(q.BusinessDate, DateTime.Now) && q.Status == 2 && q.Org == org.ID.ToInt64()))
                var shipList = db.Queryable<mes_ShipList>().Where(q => q.MoDoc.Equals(wo) && SqlFunc.DateIsSame(q.BusinessDate, DateTime.Now) && q.Status == 2 && q.Org == org.ID.ToInt64()).ToList();
                if (shipList.Any())
                {
                    result.Data = "Customer";
                    result.Data = shipList[0].ShipQty;
                    result.LocaleMsg = new($"出货信息存在!");
                }
                else
                {
                    result.LocaleMsg = new($"出货信息存在!");
                    result.Data = "InStoreLabel";
                }
            }
@@ -621,5 +624,33 @@
            }
            return result;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="SN"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public async Task<ApiAction> UnbindWipSnFromWO(UnbindWipSnInput input)
        {
            var result = new ApiAction();
            try
            {
                var cartonSn = input.SN.Split('|')[0];
                var wipList = await Biz.Db.Queryable<MES_WIP_DATA>().Where(q => q.SN.Equals(input.SN) || q.FLOW_SN.Equals(input.SN) || q.CARTON_SN == cartonSn).ToListAsync();
                if (wipList.Count == 0)
                {
                    result.IsSuccessed = false;
                    result.LocaleMsg = new($"解绑的条码不存在当前操作表中!");
                }
                var wo = await Biz.Db.Queryable<BIZ_MES_WO>().Where(q => q.ORDER_NO == wipList[0].WORK_ORDER).FirstAsync();
                result = WorkBatch.UnbindWipSnFromWO(wo, wipList, input.user);
            }
            catch (Exception ex)
            {
                result.CatchExceptionWithLog(ex, "解绑条码异常");
            }
            return result;
        }
    }
}