From ba0b68c347de4c9214d128d0b51d3af75688d6b3 Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期三, 11 九月 2024 01:22:09 +0800 Subject: [PATCH] Merge branch 'master' of http://47.115.28.255:8110/r/TigerClouds-Tech/Server/TigerApi6_2024 --- Tiger.Business/MES/Biz.Route.cs | 14 +++- Tiger.Model.Net/Entitys/MES/ParameterEntity/BizBasPkgRuleParameter.cs | 15 +++++ Tiger.Business.MES/BIZ/BAS_PKG_RULE.cs | 70 +++++++++++++++++++++++ Tiger.IBusiness/MES/BIZ/IBasPkgRule.cs | 17 +++++ Tiger.Model.Net/Tiger.Model.Net.csproj | 1 Tiger.Api/Controllers/MES/MESController.BAS_PKG_RULE.cs | 36 ++++++++++++ Tiger.Business.MES/Common/DoUnPack.cs | 10 ++ 7 files changed, 157 insertions(+), 6 deletions(-) diff --git a/Tiger.Api/Controllers/MES/MESController.BAS_PKG_RULE.cs b/Tiger.Api/Controllers/MES/MESController.BAS_PKG_RULE.cs new file mode 100644 index 0000000..136ff6a --- /dev/null +++ b/Tiger.Api/Controllers/MES/MESController.BAS_PKG_RULE.cs @@ -0,0 +1,36 @@ +锘縰sing 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); + } + } +} diff --git a/Tiger.Business.MES/BIZ/BAS_PKG_RULE.cs b/Tiger.Business.MES/BIZ/BAS_PKG_RULE.cs new file mode 100644 index 0000000..6cb1275 --- /dev/null +++ b/Tiger.Business.MES/BIZ/BAS_PKG_RULE.cs @@ -0,0 +1,70 @@ +锘縰sing 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); + } + } +} diff --git a/Tiger.Business.MES/Common/DoUnPack.cs b/Tiger.Business.MES/Common/DoUnPack.cs index 2019812..04680d7 100644 --- a/Tiger.Business.MES/Common/DoUnPack.cs +++ b/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(); } diff --git a/Tiger.Business/MES/Biz.Route.cs b/Tiger.Business/MES/Biz.Route.cs index 38f5200..771a429 100644 --- a/Tiger.Business/MES/Biz.Route.cs +++ b/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) { diff --git a/Tiger.IBusiness/MES/BIZ/IBasPkgRule.cs b/Tiger.IBusiness/MES/BIZ/IBasPkgRule.cs new file mode 100644 index 0000000..a410cc9 --- /dev/null +++ b/Tiger.IBusiness/MES/BIZ/IBasPkgRule.cs @@ -0,0 +1,17 @@ +锘縰sing 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); + } +} diff --git a/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizBasPkgRuleParameter.cs b/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizBasPkgRuleParameter.cs new file mode 100644 index 0000000..401af7c --- /dev/null +++ b/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizBasPkgRuleParameter.cs @@ -0,0 +1,15 @@ +锘縰sing 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; } + } +} diff --git a/Tiger.Model.Net/Tiger.Model.Net.csproj b/Tiger.Model.Net/Tiger.Model.Net.csproj index 3cc8b8d..64dfdf8 100644 --- a/Tiger.Model.Net/Tiger.Model.Net.csproj +++ b/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" /> -- Gitblit v1.9.3