From 3b4dd8ba2e49d193dea28766c2477e540b4614c4 Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期三, 11 九月 2024 20:07:33 +0800
Subject: [PATCH] Merge branch 'master' of http://47.115.28.255:8110/r/TigerClouds-Tech/Server/TigerApi6_2024

---
 /dev/null                                                             |   70 ----------
 Tiger.Model.Net/Entitys/MES/ParameterEntity/BizBasPkgRuleParameter.cs |    5 
 Tiger.Model.Net/Tiger.Model.Net.csproj                                |    1 
 Tiger.Api/Controllers/MES/MESController.BizBaseRule.cs                |   57 ++++++++
 Tiger.IBusiness/MES/BIZ/IBasRule.cs                                   |    3 
 Tiger.Model.Net/Entitys/MES/V_BAS_PROD_R.cs                           |  127 ++++++++++++++++++
 Tiger.Business.MES/BIZ/BizBasRule.cs                                  |  109 +++++++++++++++
 7 files changed, 301 insertions(+), 71 deletions(-)

diff --git a/Tiger.Api/Controllers/MES/MESController.BAS_PKG_RULE.cs b/Tiger.Api/Controllers/MES/MESController.BAS_PKG_RULE.cs
deleted file mode 100644
index 136ff6a..0000000
--- a/Tiger.Api/Controllers/MES/MESController.BAS_PKG_RULE.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-锘縰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.Api/Controllers/MES/MESController.BizBaseRule.cs b/Tiger.Api/Controllers/MES/MESController.BizBaseRule.cs
new file mode 100644
index 0000000..f12b0ea
--- /dev/null
+++ b/Tiger.Api/Controllers/MES/MESController.BizBaseRule.cs
@@ -0,0 +1,57 @@
+锘縰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<IBasRule>().SaveBasPkgRule(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> SaveBasItemRule([FromBody] ApiAction<BizBasItemRuleInput> action)
+        {
+            ApiAction response = new();
+            try
+            {
+                response = response.GetResponse(await DI.Resolve<IBasRule>().SaveBasItemRule(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
deleted file mode 100644
index 6cb1275..0000000
--- a/Tiger.Business.MES/BIZ/BAS_PKG_RULE.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-锘縰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/BIZ/BizBasRule.cs b/Tiger.Business.MES/BIZ/BizBasRule.cs
new file mode 100644
index 0000000..6be57a4
--- /dev/null
+++ b/Tiger.Business.MES/BIZ/BizBasRule.cs
@@ -0,0 +1,109 @@
+锘縰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 BizBasRule : IBasRule
+    {
+        /// <summary>
+        /// 淇濆瓨鐗╂枡鏉$爜瑙勫垯
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        public async Task<ApiAction> SaveBasItemRule(BizBasItemRuleInput input)
+        {
+            var result = new ApiAction();
+            try
+            {
+                var ItemCusts = input.ItemCusts.Select(q => q.ID).ToList();
+                List<BAS_ITEM_CUST> list = await Biz.Db.Queryable<BAS_ITEM_CUST>().Where(q => !SqlFunc.ContainsArray(ItemCusts, q.ID)).ToListAsync();
+                var db = Biz.Db;
+                var dbTran = db.UseTran(() =>
+                {
+                    var z = db.Storageable(input.ItemCusts)
+                       .WhereColumns(t => new { t.ID, t.GHOST_ROW })
+                       .ToStorage();
+                    z.AsInsertable.ExecuteCommand();
+                    z.AsUpdateable.ExecuteCommand();
+
+                    db.Deleteable(list).ExecuteCommand();
+                });
+                if (!dbTran.IsSuccess)
+                {
+                    result.IsSuccessed = false;
+                    result.Message = $"淇濆瓨鐗╂枡鏉$爜瑙勫垯寮傚父";
+                }
+            }
+            catch (Exception ex)
+            {
+                result.CatchExceptionWithLog(ex, "淇濆瓨鐗╂枡鏉$爜瑙勫垯寮傚父");
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// 淇濆瓨鍖呰瑙勫垯锛屽寘鎷槑缁嗗拰閲嶉噺鑼冨洿
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        public async Task<ApiAction> SaveBasPkgRule(BizBasPkgRuleInput input)
+        {
+            var result = new ApiAction();
+            try
+            {
+                var pkgProds = input.PkgProd.Select(q => q.ID).ToList();
+                List<BAS_PKG_PROD> listPrd = await Biz.Db.Queryable<BAS_PKG_PROD>().Where(q => !SqlFunc.ContainsArray(pkgProds, q.ID)).ToListAsync();
+                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();
+
+                    db.Deleteable(listPrd).ExecuteCommand();
+                });
+                if (!dbTran.IsSuccess)
+                {
+                    result.IsSuccessed = false;
+                    result.Message = $"淇濆瓨鍖呰瑙勫垯寮傚父";
+                }
+            }
+            catch (Exception ex)
+            {
+                result.CatchExceptionWithLog(ex, "淇濆瓨鍖呰瑙勫垯寮傚父");
+            }
+            return result;
+        }
+    }
+}
diff --git a/Tiger.IBusiness/MES/BIZ/IBasPkgRule.cs b/Tiger.IBusiness/MES/BIZ/IBasRule.cs
similarity index 76%
rename from Tiger.IBusiness/MES/BIZ/IBasPkgRule.cs
rename to Tiger.IBusiness/MES/BIZ/IBasRule.cs
index a410cc9..bb316ff 100644
--- a/Tiger.IBusiness/MES/BIZ/IBasPkgRule.cs
+++ b/Tiger.IBusiness/MES/BIZ/IBasRule.cs
@@ -10,8 +10,9 @@
 
 namespace Tiger.IBusiness
 {
-    public interface IBasPkgRule
+    public interface IBasRule
     {
         public Task<ApiAction> SaveBasPkgRule(BizBasPkgRuleInput input);
+        public Task<ApiAction> SaveBasItemRule(BizBasItemRuleInput input);
     }
 }
diff --git a/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizBasPkgRuleParameter.cs b/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizBasPkgRuleParameter.cs
index 401af7c..4ba6b86 100644
--- a/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizBasPkgRuleParameter.cs
+++ b/Tiger.Model.Net/Entitys/MES/ParameterEntity/BizBasPkgRuleParameter.cs
@@ -12,4 +12,9 @@
         public List<BAS_PKG_DTL> PkgDtl { get; set; }
         public List<BAS_PKG_PROD> PkgProd { get; set; }
     }
+
+    public class BizBasItemRuleInput
+    {
+        public List<BAS_ITEM_CUST> ItemCusts { get; set; }
+    }
 }
diff --git a/Tiger.Model.Net/Entitys/MES/V_BAS_PROD_R.cs b/Tiger.Model.Net/Entitys/MES/V_BAS_PROD_R.cs
new file mode 100644
index 0000000..7b099c4
--- /dev/null
+++ b/Tiger.Model.Net/Entitys/MES/V_BAS_PROD_R.cs
@@ -0,0 +1,127 @@
+using System;
+using SqlSugar;
+using System.Linq;
+using System.ComponentModel;
+using System.Collections.Generic;
+using Tiger.Model;
+
+namespace Tiger.Model
+{
+	/// <summary>
+	/// 实体:V_BAS_PROD
+	/// </summary>
+	[Serializable]
+	[SugarTable("V_BAS_PROD_R")]
+	public class V_BAS_PROD_R : iViewEntity, iTableHasAuth
+    {
+        #region 构造函数
+        /// <summary>
+        /// 实体:V_BAS_PROD_R
+        /// </summary>
+        public V_BAS_PROD_R() {}
+		#endregion
+
+		#region 公共属性
+		/// <summary>
+		/// 
+		/// </summary>
+		public string ID { get; set; }
+		/// <summary>
+		/// 
+		/// </summary>
+		public DateTime CREATE_TIME { get; set; } = DateTime.MinValue;
+		/// <summary>
+		/// 
+		/// </summary>
+		public string CREATE_USER { get; set; }
+		/// <summary>
+		/// 
+		/// </summary>
+		public DateTime UPDATE_TIME { get; set; } = DateTime.MinValue;
+		/// <summary>
+		/// 
+		/// </summary>
+		public string UPDATE_USER { get; set; }
+		/// <summary>
+		/// 
+		/// </summary>
+		public bool GHOST_ROW { get; set; } = false;
+		/// <summary>
+		/// 
+		/// </summary>
+		public string AUTH_ORG { get; set; }
+		/// <summary>
+		/// 
+		/// </summary>
+		public string AUTH_PROD { get; set; }
+		/// <summary>
+		/// 
+		/// </summary>
+		public string AUTH_WH { get; set; }
+		/// <summary>
+		/// 
+		/// </summary>
+		public string ITEM_CODE { get; set; }
+		/// <summary>
+		/// 
+		/// </summary>
+		public string ITEM_NAME { get; set; }
+		/// <summary>
+		/// 
+		/// </summary>
+		public string ITEM_DESC { get; set; }
+		/// <summary>
+		/// 
+		/// </summary>
+		public string ITEM_TYPE { get; set; }
+		/// <summary>
+		/// 
+		/// </summary>
+		public string ITEM_VER { get; set; }
+        /// <summary>
+        /// 绑定的工艺
+        /// </summary>
+        public string PROD_ROT { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public string SPEC { get; set; }
+		/// <summary>
+		/// 
+		/// </summary>
+		public string SPEC_WH { get; set; }
+		/// <summary>
+		/// 
+		/// </summary>
+		public string IS_PROD { get; set; }
+		/// <summary>
+		/// 
+		/// </summary>
+		public string IS_ACTIVE { get; set; }
+		#endregion
+
+		#region 虚拟属性
+		/*例子
+		[SugarColumn(IsIgnore = true)]
+		public string FieldName { get; set; }
+		*/
+		#endregion
+
+		#region 枚举变量
+		/*例子
+		public enum FieldNames
+		{
+			[Description("枚举描述0")]
+			Enum0,
+			[Description("枚举描述1")]
+			Enum1,
+		}
+		*/
+		#endregion
+
+		#region 公共方法
+
+		#endregion
+
+	}//endClass
+}
\ No newline at end of file
diff --git a/Tiger.Model.Net/Tiger.Model.Net.csproj b/Tiger.Model.Net/Tiger.Model.Net.csproj
index 64dfdf8..d369ac4 100644
--- a/Tiger.Model.Net/Tiger.Model.Net.csproj
+++ b/Tiger.Model.Net/Tiger.Model.Net.csproj
@@ -178,6 +178,7 @@
     <Compile Include="Entitys\MES\SMT_PROD_TABLE.cs" />
     <Compile Include="Entitys\MES\SMT_SOLDER.cs" />
     <Compile Include="Entitys\MES\SMT_SOLDER_HIS.cs" />
+    <Compile Include="Entitys\MES\V_BAS_PROD_R.cs" />
     <Compile Include="Entitys\MES\V_BAS_PROD.cs" />
     <Compile Include="Entitys\MES\V_MES_ROUTE_NDS.cs" />
     <Compile Include="Entitys\MES\V_MES_ROUTE_NES.cs" />

--
Gitblit v1.9.3