From b674ec171725dee1911483f0a1dbc0b3b9ad4ce5 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期三, 08 五月 2024 17:01:54 +0800 Subject: [PATCH] SMT更新 --- Tiger.IBusiness/MES/SMT/ISmtTool.cs | 2 Tiger.Business/MES/SMT/Biz.SmtTool.cs | 35 +++++++++++++---- Tiger.Api/Controllers/MES/SMTController.Tool.cs | 32 ++++++++++++++++ Tiger.Api/Controllers/MES/SMTController.cs | 12 ++++++ Tiger.Model.Net/Entitys/MES/SMT_WO_TABLE.cs | 8 ++++ 5 files changed, 80 insertions(+), 9 deletions(-) diff --git a/Tiger.Api/Controllers/MES/SMTController.Tool.cs b/Tiger.Api/Controllers/MES/SMTController.Tool.cs new file mode 100644 index 0000000..7f6bcc9 --- /dev/null +++ b/Tiger.Api/Controllers/MES/SMTController.Tool.cs @@ -0,0 +1,32 @@ +锘縰sing Microsoft.AspNetCore.Mvc; +using Rhea.Common; +using System.Threading.Tasks; +using Tiger.IBusiness; +using Tiger.Model; + +namespace Tiger.Api.Controllers.MES +{ + public partial class SMTController: ControllerBase + { + /// <summary> + /// 鑾峰彇鏈笂鏂欏垪琛� + /// </summary> + /// <param name="action"></param> + /// <returns></returns> + [HttpPost] + [Route("api/[controller]/[action]")] + public async Task<IActionResult> GetNotLoadingMaterial([FromBody] ApiAction<smtWoTableParams> action) + { + ApiAction response = new(); + try + { + response = response.GetResponse(await DI.Resolve<ISmtTool>().GetNotLoadingMaterial(action.Data)); + } + catch (System.Exception ex) + { + response = response.GetResponse().CatchExceptionWithLog(ex); + } + return Ok(response); + } + } +} diff --git a/Tiger.Api/Controllers/MES/SMTController.cs b/Tiger.Api/Controllers/MES/SMTController.cs new file mode 100644 index 0000000..ffa9402 --- /dev/null +++ b/Tiger.Api/Controllers/MES/SMTController.cs @@ -0,0 +1,12 @@ +锘縰sing Microsoft.AspNetCore.Mvc; + +namespace Tiger.Api.Controllers.MES +{ + /// <summary> + /// + /// </summary> + public partial class SMTController : ControllerBase + { + + } +} diff --git a/Tiger.Business/MES/SMT/Biz.SmtTool.cs b/Tiger.Business/MES/SMT/Biz.SmtTool.cs index 0827d74..a9cccb2 100644 --- a/Tiger.Business/MES/SMT/Biz.SmtTool.cs +++ b/Tiger.Business/MES/SMT/Biz.SmtTool.cs @@ -12,6 +12,7 @@ using Tiger.IBusiness; using static Tiger.Business.Biz; using Microsoft.AspNetCore.Http; +using System.Collections; namespace Tiger.Business { @@ -25,16 +26,34 @@ /// <summary> /// 鑾峰彇鏈笂鏂欏垪琛� /// </summary> - /// <param name="itemCode"></param> - /// <param name="lineCode"></param> - /// <param name="pcbSurface"></param> - /// <param name="moCode"></param> - /// <param name="machineCode"></param> + /// <param name="paras"></param> /// <returns></returns> - /// <exception cref="NotImplementedException"></exception> - public Task<ApiAction<SMT_PROD_TABLE>> GetNotLoadingMaterial(string itemCode, string lineCode, string pcbSurface, string moCode, string machineCode = null) + public async Task<ApiAction<List<SMT_WO_TABLE>>> GetNotLoadingMaterial(smtWoTableParams paras) { - throw new NotImplementedException(); + var res = new ApiAction<List<SMT_WO_TABLE>>(); + List<SMT_WO_TABLE> sList = new List<SMT_WO_TABLE>(); + try + { + sList = Db.Queryable<SMT_WO_TABLE, SMT_LOADING>((t, l) => + new JoinQueryInfos( + JoinType.Left, + t.WORK_ORDER == l.WORK_ORDER + && t.PROD_CODE == l.PROD_CODE + && t.PCB_SURFACE == l.PCB_SURFACE + && t.LINE_CODE == l.LINE_CODE + && t.SLOT_NO == l.SLOT_NO + )) + .Where((t, l) => SqlFunc.IsNullOrEmpty(l.WORK_ORDER) && t.WORK_ORDER == paras.moCode && t.PROD_CODE == paras.prodCode && t.LINE_CODE == paras.lineCode && t.PCB_SURFACE == paras.pcbSurface) + .WhereIF(SqlFunc.IsNullOrEmpty(paras.machineCode), (t, l) => t.SMT_CODE == paras.machineCode) + .Select((t, l) => t) + .ToList(); + } + catch (Exception ex) + { + res.CatchExceptionWithLog(ex, "鏌ヨ寮傚父"); + } + res.Data = sList; + return await Task.FromResult(res); } } } diff --git a/Tiger.IBusiness/MES/SMT/ISmtTool.cs b/Tiger.IBusiness/MES/SMT/ISmtTool.cs index 177a61b..863ac75 100644 --- a/Tiger.IBusiness/MES/SMT/ISmtTool.cs +++ b/Tiger.IBusiness/MES/SMT/ISmtTool.cs @@ -11,6 +11,6 @@ { public interface ISmtTool { - public Task<ApiAction<SMT_PROD_TABLE>> GetNotLoadingMaterial(string itemCode, string lineCode, string pcbSurface, string moCode, string? machineCode = null); + public Task<ApiAction<List<SMT_WO_TABLE>>> GetNotLoadingMaterial(smtWoTableParams paras); } } diff --git a/Tiger.Model.Net/Entitys/MES/SMT_WO_TABLE.cs b/Tiger.Model.Net/Entitys/MES/SMT_WO_TABLE.cs index 90282c4..76360ad 100644 --- a/Tiger.Model.Net/Entitys/MES/SMT_WO_TABLE.cs +++ b/Tiger.Model.Net/Entitys/MES/SMT_WO_TABLE.cs @@ -126,4 +126,12 @@ #endregion }//endClass + + public class smtWoTableParams { + public string prodCode { get; set; } + public string lineCode { get; set; } + public string pcbSurface { get; set; } + public string moCode { get; set; } + public string machineCode { get; set; } + } } \ No newline at end of file -- Gitblit v1.9.3