服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-09-09 5ab5e848589059becbcddc8295dd17251477c1fd
拆解包装
已修改1个文件
已添加4个文件
131 ■■■■■ 文件已修改
Tiger.Api/Controllers/MES/MESController.DoUnPack.cs 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MES/Common/DoUnPack.cs 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.IBusiness/MES/Common/IDoUnPack.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Model.Net/Entitys/MES/ParameterEntity/DoUnPackParameter.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Model.Net/Tiger.Model.Net.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Api/Controllers/MES/MESController.DoUnPack.cs
对比新文件
@@ -0,0 +1,40 @@
锘縰sing Microsoft.AspNetCore.Mvc;
using Rhea.Common;
using System.Threading.Tasks;
using Tiger.IBusiness;
using Tiger.Model;
using Tiger.Model.Entitys.MES.BizMesWo;
using Tiger.Model.Entitys.MES.BizMesWoBatch;
using Tiger.Model.Entitys.MES.CodeVerification;
using Tiger.Model.Entitys.MES.DoUnPack;
namespace Tiger.Api.Controllers.MES
{
    /// <summary>
    ///
    /// </summary>
    public partial class MESController : ControllerBase
    {
        /// <summary>
        /// 鎷嗚В鍖呰
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("api/[controller]/DoUnPack/Submit")]
        public async Task<IActionResult> DoUnPack_Submit([FromBody] ApiAction<DoUnPackInput> action)
        {
            ApiAction response = new();
            try
            {
                response = response.GetResponse(await DI.Resolve<IDoUnPack>().Submit(action.Data));
            }
            catch (System.Exception ex)
            {
                response = response.GetResponse().CatchExceptionWithLog(ex);
            }
            return Ok(response);
        }
    }
}
Tiger.Business.MES/Common/DoUnPack.cs
对比新文件
@@ -0,0 +1,59 @@
锘縰sing Tiger.Model;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Rhea.Common;
using System.Net;
using System.Linq;
using Newtonsoft.Json;
using Tiger.IBusiness;
using Microsoft.AspNetCore.Http;
using Tiger.Model.Entitys.MES.BizMesWoBatch;
using Tiger.Model.Entitys.MES.BizMesWo;
using Tiger.Model.Entitys.MES.DoUnPack;
using Tiger.Model.Entitys.MES.Position;
namespace Tiger.Business.MES
{
    public partial class DoUnPack : IDoUnPack
    {
        /// <summary>
        /// 鎷嗚В鍖呰
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
       public async Task<ApiAction<List<MES_WIP_PKG>>> Submit(DoUnPackInput input)
        {
            var result = new ApiAction<List<MES_WIP_PKG>>();
            try
            {
                var wipPkg = await Biz.Db.Queryable<MES_WIP_PKG>().Where(q => q.SN == input.SN && q.AUTH_ORG == input.AUTH_ORG).FirstAsync();
                var wipPkgParent = await Biz.Db.Queryable<MES_WIP_PKG>().Where(q => q.SN == wipPkg.PARENT_SN && q.AUTH_ORG == input.AUTH_ORG).FirstAsync();
                var db = Biz.Db;
                var dbTran = db.UseTran(() =>
                {
                    db.Updateable<WMS_ITEM_PKG>().SetColumns(q => q.PARENT_SN == null).Where(q => q.ID == wipPkg.ID).ExecuteCommand();
                    db.Updateable<WMS_ITEM_PKG>().SetColumns(q => q.QTY == q.QTY - 1).Where(q => q.ID == wipPkgParent.ID).ExecuteCommand();
                    if (!Biz.Db.Queryable<WMS_ITEM_PKG>().Any(q => q.PARENT_SN == wipPkg.PARENT_SN && q.SN != wipPkg.SN))
                    {
                        db.Deleteable(wipPkgParent);
                    }
                });
                if (!dbTran.IsSuccess)
                {
                    result.IsSuccessed = false;
                    result.Message = $"鎷嗚В鍖呰寮傚父";
                }
                result.Data = Biz.Db.Queryable<MES_WIP_PKG>().Where(q => q.PARENT_SN == wipPkgParent.SN).ToList();
            }
            catch (Exception ex)
            {
                result.CatchExceptionWithLog(ex, "鎷嗚В鍖呰寮傚父");
            }
            return result;
        }
    }
}
Tiger.IBusiness/MES/Common/IDoUnPack.cs
对比新文件
@@ -0,0 +1,17 @@
锘縰sing Rhea.Common;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tiger.Model;
using Tiger.Model.Entitys.MES.DoUnPack;
namespace Tiger.IBusiness
{
    public interface IDoUnPack
    {
        public Task<ApiAction<List<MES_WIP_PKG>>> Submit(DoUnPackInput input);
    }
}
Tiger.Model.Net/Entitys/MES/ParameterEntity/DoUnPackParameter.cs
对比新文件
@@ -0,0 +1,14 @@
锘縰sing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tiger.Model.Entitys.MES.DoUnPack
{
    public class DoUnPackInput
    {
        public string SN { get; set; }
        public string AUTH_ORG { get; set; }
    }
}
Tiger.Model.Net/Tiger.Model.Net.csproj
@@ -157,6 +157,7 @@
    <Compile Include="Entitys\MES\MES_WO_OPER.cs" />
    <Compile Include="Entitys\MES\node.cs" />
    <Compile Include="Entitys\MES\ParameterEntity\BizMesWoBatchParameter.cs" />
    <Compile Include="Entitys\MES\ParameterEntity\DoUnPackParameter.cs" />
    <Compile Include="Entitys\MES\ParameterEntity\CodeVerificationParameter.cs" />
    <Compile Include="Entitys\MES\ParameterEntity\BizMesWoParameter.cs" />
    <Compile Include="Entitys\MES\ParameterEntity\BasLabelTempParameter.cs" />