Tiger.Api/Controllers/MES/MESController.MES_WORKSHOP.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Tiger.Business/MES/Biz.MES_WORKSHOP.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Tiger.IBusiness/MES/IMES_WO.cs | 补丁 | 查看 | 原始文档 | blame | 历史 | |
Tiger.IBusiness/MES/IMES_WORKSHOP.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Tiger.Api/Controllers/MES/MESController.MES_WORKSHOP.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,54 @@ using Microsoft.AspNetCore.Mvc; using Rhea.Common; using System.Threading.Tasks; using Tiger.IBusiness; using Tiger.Model; 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> SaveMesWs([FromBody] ApiAction<MES_WORKSHOP> action) { ApiAction response = new(); try { response = response.GetResponse(await DI.Resolve<IMES_WORKSHOP>().SaveMesWs(action.Data)); } catch (System.Exception ex) { response = response.GetResponse().CatchExceptionWithLog(ex); } return Ok(response); } /// <summary> /// å é¤è½¦é´ /// </summary> /// <param name="action"></param> /// <returns></returns> [HttpPost] [Route("api/[controller]/[action]")] public async Task<IActionResult> DeleteMesWs([FromBody] ApiAction action) { ApiAction response = new(); try { response = response.GetResponse(await DI.Resolve<IMES_WORKSHOP>().DeleteMesWs(action.Data?.ToString())); } catch (System.Exception ex) { response = response.GetResponse().CatchExceptionWithLog(ex); } return Ok(response); } } } Tiger.Business/MES/Biz.MES_WORKSHOP.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,92 @@ 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 static Tiger.Business.Biz; using Microsoft.AspNetCore.Http; namespace Tiger.Business { public partial class Biz { /// <summary> /// è½¦é´ /// </summary> public partial class BizMesWs : IMES_WORKSHOP { /// <summary> /// ä¿å /// </summary> /// <param name="ws"></param> /// <returns></returns> public async Task<ApiAction> SaveMesWs(MES_WORKSHOP ws) { var result = new ApiAction(); try { if (Db.Queryable<MES_WORKSHOP>().Where(x => x.WS_CODE == ws.WS_CODE && x.ID != ws.ID).Any()) { result.IsSuccessed = false; result.LocaleMsg = new($"车é´å·²ç»åå¨ï¼ä¸è½æ°å¢ï¼"); return result; } var db = Db; var dbTran = db.UseTran(() => { var y = db.Storageable(ws) .WhereColumns(t => new { t.WS_CODE, t.GHOST_ROW }) .ToStorage(); y.AsInsertable.ExecuteCommand(); y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand(); }); if (!dbTran.IsSuccess) { result.IsSuccessed = false; result.Message = $"ä¿å车é´å¼å¸¸"; } } catch (Exception ex) { result.CatchExceptionWithLog(ex, "ä¿å车é´å¼å¸¸"); } return await Task.FromResult(result); } /// <summary> /// å é¤è½¦é´ /// </summary> /// <param name="wsId"></param> /// <returns></returns> public async Task<ApiAction> DeleteMesWs(string wsId) { var result = new ApiAction(); try { //æ¥è¯¢æ¯å¦å·²ç»æè½¦é´å¨ç¨ var db = Db; var dbTran = db.UseTran(() => { db.Deleteable<MES_WORKSHOP>().Where(x => x.ID == wsId).ExecuteCommand(); }); if (!dbTran.IsSuccess) { result.IsSuccessed = false; result.LocaleMsg = new($"å é¤è½¦é´å¼å¸¸"); } } catch (Exception ex) { result.CatchExceptionWithLog(ex, "å é¤è½¦é´å¼å¸¸"); } return await Task.FromResult(result); } } } } Tiger.IBusiness/MES/IMES_WO.cs
Tiger.IBusiness/MES/IMES_WORKSHOP.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; namespace Tiger.IBusiness { public interface IMES_WORKSHOP { public Task<ApiAction> SaveMesWs(MES_WORKSHOP ws); public Task<ApiAction> DeleteMesWs(string wsId); } }