服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-07-25 4eab704b733002d37ad9c097dcd6f4f8c4fb9e36
更新工单状态
已修改4个文件
已添加1个文件
85 ■■■■■ 文件已修改
Tiger.Api/Controllers/MES/MESController.BIZ_MES_WO.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MES/BIZ_MES_WO.cs 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.IBusiness/MES/IMES_WO.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Model.Net/Entitys/MES/ParameterEntity/BizMesWoParameter.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Model.Net/Tiger.Model.Net.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Api/Controllers/MES/MESController.BIZ_MES_WO.cs
@@ -3,6 +3,7 @@
using System.Threading.Tasks;
using Tiger.IBusiness;
using Tiger.Model;
using Tiger.Model.Entitys.MES.BizMesWo;
using Tiger.Model.Entitys.MES.BizMesWoBatch;
namespace Tiger.Api.Controllers.MES
@@ -72,5 +73,26 @@
            }
            return Ok(response);
        }
        /// <summary>
        /// æ›´æ–°å·¥å•状态
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("api/[controller]/[action]")]
        public async Task<IActionResult> UpdateWoStatus([FromBody] ApiAction<BizMesWoInput> action)
        {
            ApiAction response = new();
            try
            {
                response = response.GetResponse(await DI.Resolve<IBIZ_MES_WO>().UpdateWoStatus(action.Data));
            }
            catch (System.Exception ex)
            {
                response = response.GetResponse().CatchExceptionWithLog(ex);
            }
            return Ok(response);
        }
    }
}
Tiger.Business.MES/BIZ_MES_WO.cs
@@ -12,6 +12,7 @@
using Tiger.IBusiness;
using Microsoft.AspNetCore.Http;
using Tiger.Model.Entitys.MES.BizMesWoBatch;
using Tiger.Model.Entitys.MES.BizMesWo;
namespace Tiger.Business.MES
{
@@ -156,5 +157,48 @@
            }
            return result;
        }
        /// <summary>
        /// æ›´æ–°å·¥å•状态
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<ApiAction> UpdateWoStatus(BizMesWoInput input)
        {
            var result = new ApiAction();
            try
            {
                //保存前的判断,并生成批次号
                var _wo = await Biz.Db.Queryable<BIZ_MES_WO>().Where(x => x.ORDER_NO == input.WorkOrder).FirstAsync();
                if (_wo != null)
                {
                    _wo.STATUS = input.Status < 0 ? _wo.STATUS : input.Status;
                    _wo.ROUTE_STATUS = input.RouteStatus;
                }
                else
                {
                    result.IsSuccessed = false;
                    result.LocaleMsg = new($"工单[{input.WorkOrder}]不存在");
                    return result;
                }
                var db = Biz.Db;
                var dbTran = db.UseTran(() =>
                {
                    db.Updateable(_wo, input.UserId).ExecuteCommand();
                });
                if (!dbTran.IsSuccess)
                {
                    result.IsSuccessed = false;
                    result.LocaleMsg = new($"更新工单状态异常");
                }
            }
            catch (Exception ex)
            {
                result.CatchExceptionWithLog(ex, "更新工单状态异常");
            }
            return result;
        }
    }
}
Tiger.IBusiness/MES/IMES_WO.cs
@@ -6,6 +6,7 @@
using System.Text;
using System.Threading.Tasks;
using Tiger.Model;
using Tiger.Model.Entitys.MES.BizMesWo;
using Tiger.Model.Entitys.MES.BizMesWoBatch;
namespace Tiger.IBusiness
@@ -15,5 +16,6 @@
        public Task<ApiAction> SaveMesWo(BIZ_MES_WO wo);
        public Task<ApiAction> DeleteMesWo(string woId);
        public Task<ApiAction> SaveMesBatchWo(SaveWoBatchInput input);
        public Task<ApiAction> UpdateWoStatus(BizMesWoInput input);
    }
}
Tiger.Model.Net/Entitys/MES/ParameterEntity/BizMesWoParameter.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tiger.Model.Entitys.MES.BizMesWo
{
    public class BizMesWoInput
    {
        public string WorkOrder { get; set; }
        public string UserId { get; set; }
        public int Status { get; set; }
        public int RouteStatus { get; set; }
    }
}
Tiger.Model.Net/Tiger.Model.Net.csproj
@@ -149,6 +149,7 @@
    <Compile Include="Entitys\MES\MES_WO_NODE_POST.cs" />
    <Compile Include="Entitys\MES\MES_WO_OPER.cs" />
    <Compile Include="Entitys\MES\node.cs" />
    <Compile Include="Entitys\MES\ParameterEntity\BizMesWoParameter.cs" />
    <Compile Include="Entitys\MES\ParameterEntity\BizMesWoBatchParameter.cs" />
    <Compile Include="Entitys\MES\ParameterEntity\SmtLoadingReturn.cs" />
    <Compile Include="Entitys\MES\ParameterEntity\SmtLoadingInput.cs" />