From 4eab704b733002d37ad9c097dcd6f4f8c4fb9e36 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期四, 25 七月 2024 16:37:32 +0800 Subject: [PATCH] 更新工单状态 --- Tiger.Api/Controllers/MES/MESController.BIZ_MES_WO.cs | 22 +++++++++++ Tiger.Model.Net/Tiger.Model.Net.csproj | 1 Tiger.IBusiness/MES/IMES_WO.cs | 2 + Tiger.Business.MES/BIZ_MES_WO.cs | 44 ++++++++++++++++++++++ Tiger.Model.Net/Entitys/MES/ParameterEntity/BizMesWoParameter.cs | 16 ++++++++ 5 files changed, 85 insertions(+), 0 deletions(-) diff --git a/Tiger.Api/Controllers/MES/MESController.BIZ_MES_WO.cs b/Tiger.Api/Controllers/MES/MESController.BIZ_MES_WO.cs index 7a30b11..cef776e 100644 --- a/Tiger.Api/Controllers/MES/MESController.BIZ_MES_WO.cs +++ b/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); + } } } diff --git a/Tiger.Business.MES/BIZ_MES_WO.cs b/Tiger.Business.MES/BIZ_MES_WO.cs index e32dbbd..c4f57de 100644 --- a/Tiger.Business.MES/BIZ_MES_WO.cs +++ b/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; + } } } diff --git a/Tiger.IBusiness/MES/IMES_WO.cs b/Tiger.IBusiness/MES/IMES_WO.cs index ef825e3..cd69ea6 100644 --- a/Tiger.IBusiness/MES/IMES_WO.cs +++ b/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); } } diff --git a/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizMesWoParameter.cs b/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizMesWoParameter.cs new file mode 100644 index 0000000..aac7b6f --- /dev/null +++ b/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizMesWoParameter.cs @@ -0,0 +1,16 @@ +锘縰sing 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; } + } +} diff --git a/Tiger.Model.Net/Tiger.Model.Net.csproj b/Tiger.Model.Net/Tiger.Model.Net.csproj index 79d02f1..cdf2e67 100644 --- a/Tiger.Model.Net/Tiger.Model.Net.csproj +++ b/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" /> -- Gitblit v1.9.3