From 41a4105259344fa33706fa4ecc88e54d2d181005 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期三, 11 九月 2024 00:50:47 +0800
Subject: [PATCH] 包装规则更新

---
 Tiger.Model.Net/Entitys/MES/ParameterEntity/BizBasPkgRuleParameter.cs |    4 +-
 Tiger.Business.MES/BIZ/BAS_PKG_RULE.cs                                |   33 ++++++++++------
 Tiger.Api/Controllers/MES/MESController.BAS_PKG_RULE.cs               |   36 ++++++++++++++++++
 3 files changed, 59 insertions(+), 14 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
index 8bf6faf..6cb1275 100644
--- a/Tiger.Business.MES/BIZ/BAS_PKG_RULE.cs
+++ b/Tiger.Business.MES/BIZ/BAS_PKG_RULE.cs
@@ -29,21 +29,30 @@
             var result = new ApiAction();
             try
             {
-                //var _wo = Biz.Db.Queryable<BIZ_MES_WO>().Where(x => x.ORDER_NO == wo.ORDER_NO).First();
-                //if (_wo != null && _wo.STATUS != (int)BIZ_MES_WO.STATUSs.Init)
-                //{
-                //    result.IsSuccessed = false;
-                //    result.LocaleMsg = new($"宸ュ崟宸茬粡瀛樺湪涓斾笉鏄垵濮嬪寲鐘舵�侊紝涓嶈兘淇濆瓨淇敼锛�");
-                //    return result;
-                //}
                 var db = Biz.Db;
                 var dbTran = db.UseTran(() =>
                 {
-                    //var y = db.Storageable(wo)
-                    //   .WhereColumns(t => new { t.ORDER_NO, t.GHOST_ROW })
-                    //   .ToStorage();
-                    //y.AsInsertable.ExecuteCommand();
-                    //y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand();
+                    //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)
                 {
diff --git a/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizBasPkgRuleParameter.cs b/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizBasPkgRuleParameter.cs
index 3ee3329..401af7c 100644
--- a/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizBasPkgRuleParameter.cs
+++ b/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizBasPkgRuleParameter.cs
@@ -9,7 +9,7 @@
     public class BizBasPkgRuleInput
     {
         public BAS_PKG_RULE PkgRule { get; set; }
-        public BAS_PKG_DTL PkgDtl { get; set; }
-        public BAS_PKG_PROD PkgProd { get; set; }
+        public List<BAS_PKG_DTL> PkgDtl { get; set; }
+        public List<BAS_PKG_PROD> PkgProd { get; set; }
     }
 }

--
Gitblit v1.9.3