服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-09-11 ba0b68c347de4c9214d128d0b51d3af75688d6b3
Merge branch 'master' of http://47.115.28.255:8110/r/TigerClouds-Tech/Server/TigerApi6_2024
已修改3个文件
已添加4个文件
163 ■■■■■ 文件已修改
Tiger.Api/Controllers/MES/MESController.BAS_PKG_RULE.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MES/BIZ/BAS_PKG_RULE.cs 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MES/Common/DoUnPack.cs 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business/MES/Biz.Route.cs 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.IBusiness/MES/BIZ/IBasPkgRule.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Model.Net/Entitys/MES/ParameterEntity/BizBasPkgRuleParameter.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Model.Net/Tiger.Model.Net.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Api/Controllers/MES/MESController.BAS_PKG_RULE.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
using Microsoft.AspNetCore.Mvc;
using Rhea.Common;
using System.Threading.Tasks;
using Tiger.IBusiness;
using Tiger.Model;
using Tiger.Model.Entitys.MES.BizBasPkgRule;
using Tiger.Model.Entitys.MES.BizMesWo;
using Tiger.Model.Entitys.MES.BizMesWoBatch;
namespace Tiger.Api.Controllers.MES
{
    public partial class MESController : ControllerBase
    {
        /// <summary>
        /// ä¿å­˜åŒ…装规则
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("api/[controller]/[action]")]
        public async Task<IActionResult> SaveBasPkgRule([FromBody] ApiAction<BizBasPkgRuleInput> action)
        {
            ApiAction response = new();
            try
            {
                response = response.GetResponse(await DI.Resolve<IBasPkgRule>().SaveBasPkgRule(action.Data));
            }
            catch (System.Exception ex)
            {
                response = response.GetResponse().CatchExceptionWithLog(ex);
            }
            return Ok(response);
        }
    }
}
Tiger.Business.MES/BIZ/BAS_PKG_RULE.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,70 @@
using 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.BizBasPkgRule;
namespace Tiger.Business.MES
{
    public partial class BizBasPkgRule : IBasPkgRule
    {
        /// <summary>
        /// ä¿å­˜åŒ…装规则,包括明细和重量范围
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<ApiAction> SaveBasPkgRule(BizBasPkgRuleInput input)
        {
            var result = new ApiAction();
            try
            {
                var db = Biz.Db;
                var dbTran = db.UseTran(() =>
                {
                    //if (input.PkgRule!=null)
                    //{
                    //    var y = db.Storageable(input.PkgRule)
                    //       .WhereColumns(t => new { t.ID, t.GHOST_ROW })
                    //       .ToStorage();
                    //    y.AsInsertable.ExecuteCommand();
                    //    y.AsUpdateable.ExecuteCommand();
                    //}
                    var z = db.Storageable(input.PkgDtl)
                       .WhereColumns(t => new { t.ID, t.GHOST_ROW })
                       .ToStorage();
                    z.AsInsertable.ExecuteCommand();
                    z.AsUpdateable.ExecuteCommand();
                    var o = db.Storageable(input.PkgProd)
                       .WhereColumns(t => new { t.ID, t.GHOST_ROW })
                       .ToStorage();
                    o.AsInsertable.ExecuteCommand();
                    o.AsUpdateable.ExecuteCommand();
                });
                if (!dbTran.IsSuccess)
                {
                    result.IsSuccessed = false;
                    result.Message = $"保存包装规则异常";
                }
            }
            catch (Exception ex)
            {
                result.CatchExceptionWithLog(ex, "保存包装规则异常");
            }
            return await Task.FromResult(result);
        }
    }
}
Tiger.Business.MES/Common/DoUnPack.cs
@@ -25,12 +25,18 @@
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
       public async Task<ApiAction<List<MES_WIP_PKG>>> Submit(DoUnPackInput input)
        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();
                if (wipPkg == null)
                {
                    result.IsSuccessed = false;
                    result.LocaleMsg = new($"条码不存在包装中");
                    return result;
                }
                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(() =>
@@ -45,7 +51,7 @@
                if (!dbTran.IsSuccess)
                {
                    result.IsSuccessed = false;
                    result.Message = $"拆解包装异常";
                    result.LocaleMsg = new($"拆解包装异常");
                }
                result.Data = Biz.Db.Queryable<MES_WIP_PKG>().Where(q => q.PARENT_SN == wipPkgParent.SN).ToList();
            }
Tiger.Business/MES/Biz.Route.cs
@@ -273,20 +273,26 @@
                try
                {
                    var _route = Db.Queryable<MES_ROUTE>().Where(x => x.ROT_CODE == route.ROT_CODE).First();
                    if (_route != null && Db.Queryable<MES_ROUTE_NODE>().Where(x => x.ROT_ID == _route.ID).Any())
                    //if (_route != null && Db.Queryable<MES_ROUTE_NODE>().Where(x => x.ROT_ID == _route.ID).Any())
                    //{
                    //    result.IsSuccessed = false;
                    //    result.LocaleMsg = new($"工艺路线已经有设计记录,不能保存!");
                    //    return result;
                    //}
                    if (_route != null && Db.Queryable<MES_PROD_OPER>().Where(x => x.ROT_ID == _route.ID).Any())
                    {
                        result.IsSuccessed = false;
                        result.LocaleMsg = new($"工艺路线已经有设计记录,不能保存!");
                        result.LocaleMsg = new($"工艺路线已经有绑定记录,不能保存!");
                        return result;
                    }
                    var db = Db;
                    var dbTran = db.UseTran(() =>
                    {
                        var y = db.Storageable(route)
                           .WhereColumns(t => new { t.ROT_CODE, t.GHOST_ROW })
                           //.WhereColumns(t => new { t.ROT_CODE, t.GHOST_ROW })
                           .ToStorage();
                        y.AsInsertable.ExecuteCommand();
                        y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand();
                        y.AsUpdateable.ExecuteCommand();
                    });
                    if (!dbTran.IsSuccess)
                    {
Tiger.IBusiness/MES/BIZ/IBasPkgRule.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
using 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.BizBasPkgRule;
namespace Tiger.IBusiness
{
    public interface IBasPkgRule
    {
        public Task<ApiAction> SaveBasPkgRule(BizBasPkgRuleInput input);
    }
}
Tiger.Model.Net/Entitys/MES/ParameterEntity/BizBasPkgRuleParameter.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tiger.Model.Entitys.MES.BizBasPkgRule
{
    public class BizBasPkgRuleInput
    {
        public BAS_PKG_RULE PkgRule { get; set; }
        public List<BAS_PKG_DTL> PkgDtl { get; set; }
        public List<BAS_PKG_PROD> PkgProd { 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\BizBasPkgRuleParameter.cs" />
    <Compile Include="Entitys\MES\ParameterEntity\DoUnPackParameter.cs" />
    <Compile Include="Entitys\MES\ParameterEntity\CodeVerificationParameter.cs" />
    <Compile Include="Entitys\MES\ParameterEntity\BizMesWoParameter.cs" />