From 1ae7b5a517aaa0f3a45f0b31b0c5173c35558318 Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期四, 30 五月 2024 16:43:34 +0800
Subject: [PATCH] 按模块项目拆分Business

---
 Tiger.Api/Autofac/AutoFacContianer.cs                |   33 +-
 /dev/null                                            |  209 -----------------
 Tiger.Business/Model/TransactionBase.cs              |    2 
 Tiger.Business.MES/Transaction/MESTransactionBase.cs |    1 
 Tiger.Business.MES/MES_WORKSHOP.cs                   |   81 ++++++
 Tiger.Business.MES/Transaction/LoadingMaterial.cs    |    2 
 Tiger.Business/Tiger.Business.csproj                 |   10 
 Tiger.Api.sln                                        |   11 
 Tiger.Business.MES/SMT/SmtTool.cs                    |  206 +++++++++++++++++
 Tiger.Business.MES/Tiger.Business.MES.csproj         |   18 +
 Tiger.Business.MES/BIZ_MES_WO.cs                     |   95 +++++++
 11 files changed, 428 insertions(+), 240 deletions(-)

diff --git a/Tiger.Api.sln b/Tiger.Api.sln
index a456a67..f1ddd9d 100644
--- a/Tiger.Api.sln
+++ b/Tiger.Api.sln
@@ -24,6 +24,8 @@
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "05-鍗曞厓娴嬭瘯", "05-鍗曞厓娴嬭瘯", "{CF29B377-FE5A-488A-AF99-DF9D9C6FCA95}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tiger.Business.MES", "Tiger.Business.MES\Tiger.Business.MES.csproj", "{3848BCAB-4E77-4D5E-8BF0-2A747981C1B4}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -64,6 +66,14 @@
 		{60FA322B-9B03-4380-803C-63B1F240E453}.Release|Any CPU.Build.0 = Release|Any CPU
 		{60FA322B-9B03-4380-803C-63B1F240E453}.Release|x86.ActiveCfg = Release|x86
 		{60FA322B-9B03-4380-803C-63B1F240E453}.Release|x86.Build.0 = Release|x86
+		{3848BCAB-4E77-4D5E-8BF0-2A747981C1B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{3848BCAB-4E77-4D5E-8BF0-2A747981C1B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{3848BCAB-4E77-4D5E-8BF0-2A747981C1B4}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{3848BCAB-4E77-4D5E-8BF0-2A747981C1B4}.Debug|x86.Build.0 = Debug|Any CPU
+		{3848BCAB-4E77-4D5E-8BF0-2A747981C1B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{3848BCAB-4E77-4D5E-8BF0-2A747981C1B4}.Release|Any CPU.Build.0 = Release|Any CPU
+		{3848BCAB-4E77-4D5E-8BF0-2A747981C1B4}.Release|x86.ActiveCfg = Release|Any CPU
+		{3848BCAB-4E77-4D5E-8BF0-2A747981C1B4}.Release|x86.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -73,6 +83,7 @@
 		{2689560A-10E8-4E28-BCA4-37F697628F77} = {A994D516-643A-4543-B781-540E81F1DE55}
 		{E7540FE4-F284-4F66-A11C-24D846C4B558} = {FF44BF62-08C5-4B52-B24F-54CD79E96848}
 		{60FA322B-9B03-4380-803C-63B1F240E453} = {70881CAB-17ED-4C46-895A-62F2CE39A607}
+		{3848BCAB-4E77-4D5E-8BF0-2A747981C1B4} = {70881CAB-17ED-4C46-895A-62F2CE39A607}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {797A1D83-9F3C-4AEC-8A83-E3468102DBD1}
diff --git a/Tiger.Api/Autofac/AutoFacContianer.cs b/Tiger.Api/Autofac/AutoFacContianer.cs
index c052f95..db6b664 100644
--- a/Tiger.Api/Autofac/AutoFacContianer.cs
+++ b/Tiger.Api/Autofac/AutoFacContianer.cs
@@ -39,28 +39,25 @@
         /// <param name="builder"></param>
         public static void Build(ContainerBuilder builder)
         {
-            var assembly = Assembly.LoadFrom(AppDomain.CurrentDomain.BaseDirectory + "Tiger.Business.dll");
-            //娉ㄥ叆Tiger.Business.dll
-            builder.RegisterAssemblyTypes(assembly).AsImplementedInterfaces();
+            ////娉ㄥ叆Tiger.Business.dll
+            //var assembly = Assembly.LoadFrom(AppDomain.CurrentDomain.BaseDirectory + "Tiger.Business.dll");
+            //builder.RegisterAssemblyTypes(assembly).AsImplementedInterfaces();
 
             #region 鍔ㄦ�佸姞杞藉涓猟ll
-            //string[] assemblyScanerPattern = new[] { @"MyModule.*.dll"};
+            string[] assemblyPattern = new[] { "Tiger.Business([.].*)*.dll" };
 
-            //// Make sure process paths are same...
-            //Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
+            // 1. Scan for assemblies containing autofac modules in the bin folder
+            List<Assembly> assemblies = new List<Assembly>();
+            assemblies.AddRange(
+                Directory.EnumerateFiles(AppDomain.CurrentDomain.BaseDirectory, "*.dll", SearchOption.AllDirectories)
+                              .Where(filename => assemblyPattern.Any(pattern => Regex.IsMatch(filename, pattern)))
+                              .Select(Assembly.LoadFrom)
+            );
 
-            //// 1. Scan for assemblies containing autofac modules in the bin folder
-            //List<Assembly> assemblies = new List<Assembly>();
-            //assemblies.AddRange(
-            //    Directory.EnumerateFiles(Directory.GetCurrentDirectory(), "*.dll", SearchOption.AllDirectories)
-            //             .Where(filename => assemblyScanerPattern.Any(pattern => Regex.IsMatch(filename, pattern)))
-            //             .Select(Assembly.LoadFrom)
-            //);
-
-            //foreach (var assembly in assemblies)
-            //{
-            //    builder.RegisterAssemblyTypes(assembly).AsImplementedInterfaces();
-            //}
+            foreach (var assembly in assemblies)
+            {
+                builder.RegisterAssemblyTypes(assembly).AsImplementedInterfaces();
+            }
             #endregion
 
             //璇诲彇閰嶇疆鏂囦欢,鎶婇厤缃叧绯昏杞藉埌ContainerBuilder
diff --git a/Tiger.Business.MES/BIZ_MES_WO.cs b/Tiger.Business.MES/BIZ_MES_WO.cs
new file mode 100644
index 0000000..d696680
--- /dev/null
+++ b/Tiger.Business.MES/BIZ_MES_WO.cs
@@ -0,0 +1,95 @@
+锘縰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 static Tiger.Business.Biz;
+using Microsoft.AspNetCore.Http;
+
+namespace Tiger.Business.MES
+{
+    public partial class BizMesWo : IBIZ_MES_WO
+    {
+        /// <summary>
+        /// 淇濆瓨
+        /// </summary>
+        /// <param name="wo"></param>
+        /// <returns></returns>
+        public async Task<ApiAction> SaveMesWo(BIZ_MES_WO wo)
+        {
+            var result = new ApiAction();
+            try
+            {
+                var _wo = 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 = 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 (!dbTran.IsSuccess)
+                {
+                    result.IsSuccessed = false;
+                    result.Message = $"淇濆瓨宸ュ崟寮傚父";
+                }
+            }
+            catch (Exception ex)
+            {
+                result.CatchExceptionWithLog(ex, "淇濆瓨宸ュ崟寮傚父");
+            }
+            return await Task.FromResult(result);
+        }
+
+        /// <summary>
+        /// 鍒犻櫎宸ュ崟
+        /// </summary>
+        /// <param name="woId"></param>
+        /// <returns></returns>
+        public async Task<ApiAction> DeleteMesWo(string woId)
+        {
+            var result = new ApiAction();
+            try
+            {
+                //鏌ヨ鏄惁宸茬粡鏈夊伐鍗曞湪鐢�
+                var _wo = Db.Queryable<BIZ_MES_WO>().Where(x => x.ID == woId).First();
+                if (_wo != null && _wo.STATUS != (int)BIZ_MES_WO.STATUSs.Init)
+                {
+                    result.IsSuccessed = false;
+                    result.LocaleMsg = new($"宸ュ崟涓嶆槸鍒濆鍖栫姸鎬侊紝涓嶈兘鍒犻櫎锛�");
+                    return result;
+                }
+                var db = Db;
+                var dbTran = db.UseTran(() =>
+                {
+                    db.Deleteable<BIZ_MES_WO>().Where(x => x.ID == woId).ExecuteCommand();
+                });
+                if (!dbTran.IsSuccess)
+                {
+                    result.IsSuccessed = false;
+                    result.LocaleMsg = new($"鍒犻櫎宸ュ崟寮傚父");
+                }
+            }
+            catch (Exception ex)
+            {
+                result.CatchExceptionWithLog(ex, "鍒犻櫎宸ュ崟寮傚父");
+            }
+            return await Task.FromResult(result);
+        }
+    }
+}
diff --git a/Tiger.Business.MES/MES_WORKSHOP.cs b/Tiger.Business.MES/MES_WORKSHOP.cs
new file mode 100644
index 0000000..faece73
--- /dev/null
+++ b/Tiger.Business.MES/MES_WORKSHOP.cs
@@ -0,0 +1,81 @@
+锘縰sing Tiger.Model;
+using Rhea.Common;
+using Tiger.IBusiness;
+using static Tiger.Business.Biz;
+using Microsoft.AspNetCore.Http;
+
+namespace Tiger.Business.MES
+{
+    /// <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);
+        }
+    }
+}
diff --git a/Tiger.Business.MES/SMT/SmtTool.cs b/Tiger.Business.MES/SMT/SmtTool.cs
new file mode 100644
index 0000000..fde0f94
--- /dev/null
+++ b/Tiger.Business.MES/SMT/SmtTool.cs
@@ -0,0 +1,206 @@
+锘縰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 static Tiger.Business.Biz;
+using Microsoft.AspNetCore.Http;
+using System.Collections;
+using System.Data;
+using Sundial;
+
+namespace Tiger.Business.MES
+{
+    /// <summary>
+    /// 宸ュ叿绠$悊
+    /// </summary>
+    public partial class SmtTool : ISmtTool
+    {
+        /// <summary>
+        /// 鑾峰彇鏈笂鏂欏垪琛�
+        /// </summary>
+        /// <param name="paras"></param>
+        /// <returns></returns>
+        public async Task<ApiAction<List<SMT_WO_TABLE>>> GetNotLoadingMaterial(SmtLoadingInput paras)
+        {
+            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);
+        }
+        /// <summary>
+        /// 瀵煎叆宸ュ崟鏂欑珯琛�
+        /// </summary>
+        /// <param name="paras"></param>
+        /// <returns></returns>
+        public async Task<ApiAction<List<smtWoTableIn>>> ValidateTableImport(List<smtWoTableIn> paras)
+        {
+            var result = new ApiAction<List<smtWoTableIn>>();
+            try
+            {
+
+                //DataTable dt = JsonConvert.DeserializeObject<DataTable>(paras.ToString());
+                List<smtWoTableIn> currentList = new List<smtWoTableIn>();
+                if (paras?.Count > 0)
+                {
+                    //var duplicateWo = paras.GroupBy(p => p.鍏宠仈宸ュ崟鍙�)
+                    //                 .Where(g => g.Count() > 1)
+                    //                 .Select(g => g.Key)
+                    //                 .ToList();
+                    //if (duplicateWo.Count() > 0)//瀛樺湪閲嶅鏁版嵁  
+                    //{
+                    //    string WORK_ORDER = string.Empty;
+                    //    foreach (var item in duplicateWo)
+                    //    {
+                    //        WORK_ORDER += item;
+                    //    }
+                    //    WORK_ORDER = WORK_ORDER.TrimEnd(';');
+                    //    result.IsSuccessed = false;
+                    //    result.Message = $"瀵煎叆鐨勭墿鏂欎腑鏈夐噸澶嶆暟鎹細鍏宠仈宸ュ崟锛歿WORK_ORDER}";
+                    //}
+                    //else
+                    {
+                        foreach (var item in paras)
+                        {
+                            item.澶勭悊鏂瑰紡 = "鏂板";
+                            item.鍘熷洜 = null;
+                            if (item.鍏宠仈宸ュ崟鍙� == null || item.鍏宠仈宸ュ崟鍙� == " ")
+                            {
+                                item.澶勭悊鏂瑰紡 = "鏁版嵁寮傚父";
+                                item.鍘熷洜 += "宸ュ崟鍙风┖鎴栦笉瀛樺湪锛�";
+                            }
+                            if (item.浜у搧缂栫爜 == null || item.浜у搧缂栫爜 == " ")
+                            {
+                                item.澶勭悊鏂瑰紡 = "鏁版嵁寮傚父";
+                                item.鍘熷洜 += $"浜у搧缂栫爜涓虹┖锛�";
+                            }
+                            if (item.鐗╂枡缂栫爜 == null || item.鐗╂枡缂栫爜 == " ")
+                            {
+                                item.澶勭悊鏂瑰紡 = "鏁版嵁寮傚父";
+                                item.鍘熷洜 += $"鐗╂枡缂栫爜涓虹┖锛�";
+                            }
+                            if (item.绔欎綅鍙� == null || item.绔欎綅鍙� == " ")
+                            {
+                                item.澶勭悊鏂瑰紡 = "鏁版嵁寮傚父";
+                                item.鍘熷洜 += $"绔欎綅鍙蜂负绌猴紒";
+                            }
+                            currentList.Add(item);
+                            if (await Db.Queryable<SMT_WO_TABLE>().AnyAsync(x => x.WORK_ORDER == item.鍏宠仈宸ュ崟鍙� && x.ITEM_CODE == item.鐗╂枡缂栫爜 && x.SLOT_NO == item.绔欎綅鍙� && x.SMT_CODE == item.璐寸墖鏈虹紪鐮�))
+                            {
+                                item.澶勭悊鏂瑰紡 = "淇敼";
+                                item.鍘熷洜 += $"宸ュ崟{item.鍏宠仈宸ュ崟鍙穧锛岀墿鏂欑紪鐮亄item.鐗╂枡缂栫爜}锛岀珯浣嶅彿{item.绔欎綅鍙穧锛岃创鐗囨満缂栫爜{item.璐寸墖鏈虹紪鐮亇涓庢暟鎹簱閲嶅锛�";
+                            }
+                        }
+                        //for (int i = 0; i < item..Count; i++)
+                        {
+                        }
+
+                    }
+                }
+                else
+                {
+                    result.IsSuccessed = false;
+                    result.Message = $"瀵煎叆鐨勭墿鏂欎笉鑳戒负绌�";
+                }
+                result.Data = currentList;
+
+            }
+            catch (Exception ex)
+            {
+                result.CatchException(ex, $"楠岃瘉瀵煎叆宸ュ崟鏂欑珯琛ㄥ紓甯�");
+            }
+            return result;
+        }
+        /// <summary>
+        /// 瀵煎叆宸ュ崟鏂欑珯琛�
+        /// </summary>
+        /// <param name="paras"></param>
+        /// <returns></returns>
+        public async Task<ApiAction> SaveValidateTableImport(List<smtWoTableIn> paras)
+        {
+            var result = new ApiAction();
+            try
+            {
+
+                //DataTable dt = JsonConvert.DeserializeObject<DataTable>(paras.ToString());
+                List<SMT_WO_TABLE> currentList = new List<SMT_WO_TABLE>();
+                if (paras.Count > 0)
+                {
+                    var db = Biz.Db;
+                    foreach (var item in paras)
+                    {
+                        var workorder = item.鍏宠仈宸ュ崟鍙�.ToString();
+                        var id = db.Queryable<SMT_WO_TABLE>().Where(s => s.WORK_ORDER == workorder).Select(q => q.ID).First();
+                        SMT_WO_TABLE table = new SMT_WO_TABLE();
+                        table.ID = item.澶勭悊鏂瑰紡?.ToString() == "鏂板" ? Guid.NewGuid().ToString() : id;
+                        table.CREATE_TIME = DateTime.Now;
+                        table.UPDATE_TIME = DateTime.Now;
+                        table.WORK_ORDER = item.鍏宠仈宸ュ崟鍙�.ToString();
+                        table.PROD_CODE = item.浜у搧缂栫爜?.ToString();
+                        table.ITEM_CODE = item.鐗╂枡缂栫爜?.ToString();
+                        table.SUBITEM_CODE = item.鏇夸唬鏂�?.ToString();
+                        table.UNIT = item.鍗曚綅?.ToString();
+                        table.UNIT_QTY = item.鍗曚綅鐢ㄩ噺.ToInt32();
+                        table.LINE_CODE = item.浜х嚎缂栫爜?.ToString();
+                        table.SMT_CODE = item.璐寸墖鏈虹紪鐮�?.ToString();
+                        table.SMT_STENCIL = item.閽㈢綉缂栫爜?.ToString();
+                        table.SLOT_NO = item.绔欎綅鍙�?.ToString();
+                        table.LOCATION = item.璐寸墖浣嶇疆?.ToString();
+                        table.FEEDER_CODE = item.椋炶揪缂栫爜?.ToString();
+                        table.FEEDER_TYPE = item.椋炶揪绫诲瀷?.ToString();
+                        table.PCB_SURFACE = item.鍔犲伐闈�?.ToString();
+                        table.LOAD_SEQ = item.涓婃枡椤哄簭.ToInt32();
+                        table.REMARK = item.澶囨敞?.ToString();
+                        table.VALIDATION_TYPE = item.澶勭悊鏂瑰紡?.ToString();
+                        table.VALIDATION_RESULT = item.鍘熷洜?.ToString();
+                        currentList.Add(table);
+                    }
+                    var add = currentList.Where(q => q.VALIDATION_TYPE == "鏂板").ToList();
+                    var upd = currentList.Where(q => q.VALIDATION_TYPE == "淇敼").ToList();
+                    if (add.Count > 0)
+                    {
+                        Biz.Db.Insertable(add).ExecuteCommand();
+                    }
+                    if (upd.Count > 0)
+                    {
+                        Biz.Db.Updateable(upd).ExecuteCommand();
+                    }
+
+                }
+
+            }
+            catch (Exception ex)
+            {
+                result.CatchException(ex, $"楠岃瘉瀵煎叆宸ュ崟鏂欑珯琛ㄥ紓甯�");
+            }
+            return result;
+        }
+    }
+}
diff --git a/Tiger.Business.MES/Tiger.Business.MES.csproj b/Tiger.Business.MES/Tiger.Business.MES.csproj
new file mode 100644
index 0000000..0cd412d
--- /dev/null
+++ b/Tiger.Business.MES/Tiger.Business.MES.csproj
@@ -0,0 +1,18 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net6.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\Tiger.Business\Tiger.Business.csproj" />
+    <ProjectReference Include="..\Tiger.IBusiness\Tiger.IBusiness.csproj" />
+  </ItemGroup>
+
+  <Target Name="PostBuild" AfterTargets="PostBuildEvent">
+    <Exec Command="xcopy /r/y/i $(ProjectDir)$(OutDir)$(AssemblyName).dll $(SolutionDir)Tiger.Api\$(OutDir)&#xD;&#xA;xcopy /r/y/i $(ProjectDir)$(OutDir)$(AssemblyName).pdb $(SolutionDir)Tiger.Api\$(OutDir)&#xD;&#xA;xcopy /r/y/i $(ProjectDir)$(OutDir)BizSettings.json $(SolutionDir)Tiger.Api\$(OutDir)" />
+  </Target>
+
+</Project>
diff --git a/Tiger.Business/MES/Transaction/LoadingMaterial.cs b/Tiger.Business.MES/Transaction/LoadingMaterial.cs
similarity index 99%
rename from Tiger.Business/MES/Transaction/LoadingMaterial.cs
rename to Tiger.Business.MES/Transaction/LoadingMaterial.cs
index 5a41898..136ee7a 100644
--- a/Tiger.Business/MES/Transaction/LoadingMaterial.cs
+++ b/Tiger.Business.MES/Transaction/LoadingMaterial.cs
@@ -142,7 +142,7 @@
                 //02淇濆瓨涓婃枡鏁版嵁
 
                 //03鏌ョ湅鏈笂鏂欏垪琛�
-                Biz.SmtTool smtTool = new();
+                SmtTool smtTool = new();
                 var actionSmtTool = await smtTool.GetNotLoadingMaterial(input);
                 if (actionSmtTool.IsSuccessed)
                 {
diff --git a/Tiger.Business/MES/Transaction/MESTransactionBase.cs b/Tiger.Business.MES/Transaction/MESTransactionBase.cs
similarity index 96%
rename from Tiger.Business/MES/Transaction/MESTransactionBase.cs
rename to Tiger.Business.MES/Transaction/MESTransactionBase.cs
index 8b623b6..c0cd7d2 100644
--- a/Tiger.Business/MES/Transaction/MESTransactionBase.cs
+++ b/Tiger.Business.MES/Transaction/MESTransactionBase.cs
@@ -3,7 +3,6 @@
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
-using Tiger.Business.WMS.Transaction;
 using Tiger.IBusiness;
 
 namespace Tiger.Business.MES.Transaction
diff --git a/Tiger.Business/MES/Biz.BIZ_MES_WO.cs b/Tiger.Business/MES/Biz.BIZ_MES_WO.cs
deleted file mode 100644
index 28628cd..0000000
--- a/Tiger.Business/MES/Biz.BIZ_MES_WO.cs
+++ /dev/null
@@ -1,100 +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 static Tiger.Business.Biz;
-using Microsoft.AspNetCore.Http;
-
-namespace Tiger.Business
-{
-    public partial class Biz
-    {
-        /// <summary>
-        /// 宸ュ崟
-        /// </summary>
-        public partial class BizMesWo : IBIZ_MES_WO
-        {
-            /// <summary>
-            /// 淇濆瓨
-            /// </summary>
-            /// <param name="wo"></param>
-            /// <returns></returns>
-            public async Task<ApiAction> SaveMesWo(BIZ_MES_WO wo)
-            {
-                var result = new ApiAction();
-                try
-                {
-                    var _wo = 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 = 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 (!dbTran.IsSuccess)
-                    {
-                        result.IsSuccessed = false;
-                        result.Message = $"淇濆瓨宸ュ崟寮傚父";
-                    }
-                }
-                catch (Exception ex)
-                {
-                    result.CatchExceptionWithLog(ex, "淇濆瓨宸ュ崟寮傚父");
-                }
-                return await Task.FromResult(result);
-            }
-
-            /// <summary>
-            /// 鍒犻櫎宸ュ崟
-            /// </summary>
-            /// <param name="woId"></param>
-            /// <returns></returns>
-            public async Task<ApiAction> DeleteMesWo(string woId) {
-                var result = new ApiAction();
-                try
-                {
-                    //鏌ヨ鏄惁宸茬粡鏈夊伐鍗曞湪鐢�
-                    var _wo = Db.Queryable<BIZ_MES_WO>().Where(x => x.ID == woId).First();
-                    if (_wo != null && _wo.STATUS != (int)BIZ_MES_WO.STATUSs.Init)
-                    {
-                        result.IsSuccessed = false;
-                        result.LocaleMsg = new($"宸ュ崟涓嶆槸鍒濆鍖栫姸鎬侊紝涓嶈兘鍒犻櫎锛�");
-                        return result;
-                    }
-                    var db = Db;
-                    var dbTran = db.UseTran(() =>
-                    {
-                        db.Deleteable<BIZ_MES_WO>().Where(x => x.ID == woId).ExecuteCommand();
-                    });
-                    if (!dbTran.IsSuccess)
-                    {
-                        result.IsSuccessed = false;
-                        result.LocaleMsg = new($"鍒犻櫎宸ュ崟寮傚父");
-                    }
-                }
-                catch (Exception ex)
-                {
-                    result.CatchExceptionWithLog(ex, "鍒犻櫎宸ュ崟寮傚父");
-                }
-                return await Task.FromResult(result);
-            }
-        }
-    }
-}
diff --git a/Tiger.Business/MES/Biz.MES_WORKSHOP.cs b/Tiger.Business/MES/Biz.MES_WORKSHOP.cs
deleted file mode 100644
index 5e0ec2f..0000000
--- a/Tiger.Business/MES/Biz.MES_WORKSHOP.cs
+++ /dev/null
@@ -1,92 +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 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);
-            }
-        }
-    }
-}
diff --git a/Tiger.Business/MES/SMT/Biz.SmtTool.cs b/Tiger.Business/MES/SMT/Biz.SmtTool.cs
deleted file mode 100644
index 9cb84fd..0000000
--- a/Tiger.Business/MES/SMT/Biz.SmtTool.cs
+++ /dev/null
@@ -1,209 +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 static Tiger.Business.Biz;
-using Microsoft.AspNetCore.Http;
-using System.Collections;
-using System.Data;
-using Sundial;
-
-namespace Tiger.Business
-{
-    public partial class Biz
-    {
-        /// <summary>
-        /// 宸ュ叿绠$悊
-        /// </summary>
-        public partial class SmtTool : ISmtTool
-        {
-            /// <summary>
-            /// 鑾峰彇鏈笂鏂欏垪琛�
-            /// </summary>
-            /// <param name="paras"></param>
-            /// <returns></returns>
-            public async Task<ApiAction<List<SMT_WO_TABLE>>> GetNotLoadingMaterial(SmtLoadingInput paras)
-            {
-                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);
-            }
-            /// <summary>
-            /// 瀵煎叆宸ュ崟鏂欑珯琛�
-            /// </summary>
-            /// <param name="paras"></param>
-            /// <returns></returns>
-            public async Task<ApiAction<List<smtWoTableIn>>> ValidateTableImport(List<smtWoTableIn> paras)
-            {
-                var result = new ApiAction<List<smtWoTableIn>>();
-                try
-                {
-
-                    //DataTable dt = JsonConvert.DeserializeObject<DataTable>(paras.ToString());
-                    List<smtWoTableIn> currentList = new List<smtWoTableIn>();
-                    if (paras?.Count > 0)
-                    {
-                        //var duplicateWo = paras.GroupBy(p => p.鍏宠仈宸ュ崟鍙�)
-                        //                 .Where(g => g.Count() > 1)
-                        //                 .Select(g => g.Key)
-                        //                 .ToList();
-                        //if (duplicateWo.Count() > 0)//瀛樺湪閲嶅鏁版嵁  
-                        //{
-                        //    string WORK_ORDER = string.Empty;
-                        //    foreach (var item in duplicateWo)
-                        //    {
-                        //        WORK_ORDER += item;
-                        //    }
-                        //    WORK_ORDER = WORK_ORDER.TrimEnd(';');
-                        //    result.IsSuccessed = false;
-                        //    result.Message = $"瀵煎叆鐨勭墿鏂欎腑鏈夐噸澶嶆暟鎹細鍏宠仈宸ュ崟锛歿WORK_ORDER}";
-                        //}
-                        //else
-                        {
-                            foreach (var item in paras)
-                            {
-                                item.澶勭悊鏂瑰紡 = "鏂板";
-                                item.鍘熷洜 = null;
-                                if (item.鍏宠仈宸ュ崟鍙� == null|| item.鍏宠仈宸ュ崟鍙� == " ")
-                                {
-                                    item.澶勭悊鏂瑰紡 = "鏁版嵁寮傚父";
-                                    item.鍘熷洜 += "宸ュ崟鍙风┖鎴栦笉瀛樺湪锛�";
-                                }
-                                if (item.浜у搧缂栫爜 == null || item.浜у搧缂栫爜 == " ")
-                                {
-                                    item.澶勭悊鏂瑰紡 = "鏁版嵁寮傚父";
-                                    item.鍘熷洜 += $"浜у搧缂栫爜涓虹┖锛�";
-                                }
-                                if (item.鐗╂枡缂栫爜 == null || item.鐗╂枡缂栫爜 == " ")
-                                {
-                                    item.澶勭悊鏂瑰紡 = "鏁版嵁寮傚父";
-                                    item.鍘熷洜 += $"鐗╂枡缂栫爜涓虹┖锛�";
-                                }
-                                if (item.绔欎綅鍙� == null || item.绔欎綅鍙� == " ")
-                                {
-                                    item.澶勭悊鏂瑰紡 = "鏁版嵁寮傚父";
-                                    item.鍘熷洜 += $"绔欎綅鍙蜂负绌猴紒";
-                                }
-                                currentList.Add(item);
-                                if (await Db.Queryable<SMT_WO_TABLE>().AnyAsync(x => x.WORK_ORDER == item.鍏宠仈宸ュ崟鍙� && x.ITEM_CODE == item.鐗╂枡缂栫爜 && x.SLOT_NO==item.绔欎綅鍙�&&x.SMT_CODE==item.璐寸墖鏈虹紪鐮�))
-                                {
-                                    item.澶勭悊鏂瑰紡 = "淇敼";
-                                    item.鍘熷洜 += $"宸ュ崟{item.鍏宠仈宸ュ崟鍙穧锛岀墿鏂欑紪鐮亄item.鐗╂枡缂栫爜}锛岀珯浣嶅彿{item.绔欎綅鍙穧锛岃创鐗囨満缂栫爜{item.璐寸墖鏈虹紪鐮亇涓庢暟鎹簱閲嶅锛�";
-                                }
-                            }
-                            //for (int i = 0; i < item..Count; i++)
-                            {
-                            }
-
-                        }
-                    }
-                    else
-                    {
-                        result.IsSuccessed = false;
-                        result.Message = $"瀵煎叆鐨勭墿鏂欎笉鑳戒负绌�";
-                    }
-                    result.Data = currentList;
-
-                }
-                catch (Exception ex)
-                {
-                    result.CatchException(ex, $"楠岃瘉瀵煎叆宸ュ崟鏂欑珯琛ㄥ紓甯�");
-                }
-                return result;
-            }
-            /// <summary>
-            /// 瀵煎叆宸ュ崟鏂欑珯琛�
-            /// </summary>
-            /// <param name="paras"></param>
-            /// <returns></returns>
-            public async Task<ApiAction> SaveValidateTableImport(List<smtWoTableIn> paras)
-            {
-                var result = new ApiAction();
-                try
-                {
-
-                    //DataTable dt = JsonConvert.DeserializeObject<DataTable>(paras.ToString());
-                    List<SMT_WO_TABLE> currentList = new List<SMT_WO_TABLE>();
-                    if (paras.Count > 0)
-                    {
-                        var db = Biz.Db;
-                        foreach (var item in paras)
-                        {
-                            var workorder = item.鍏宠仈宸ュ崟鍙�.ToString();
-                            var id = db.Queryable<SMT_WO_TABLE>().Where(s => s.WORK_ORDER == workorder).Select(q => q.ID).First();
-                            SMT_WO_TABLE table = new SMT_WO_TABLE();
-                            table.ID= item.澶勭悊鏂瑰紡?.ToString()=="鏂板"?Guid.NewGuid().ToString():id;
-                            table.CREATE_TIME = DateTime.Now;
-                            table.UPDATE_TIME = DateTime.Now;
-                            table.WORK_ORDER = item.鍏宠仈宸ュ崟鍙�.ToString();
-                            table.PROD_CODE = item.浜у搧缂栫爜?.ToString();
-                            table.ITEM_CODE = item.鐗╂枡缂栫爜?.ToString();
-                            table.SUBITEM_CODE = item.鏇夸唬鏂�?.ToString();
-                            table.UNIT = item.鍗曚綅?.ToString();
-                            table.UNIT_QTY = item.鍗曚綅鐢ㄩ噺.ToInt32();
-                            table.LINE_CODE = item.浜х嚎缂栫爜?.ToString();
-                            table.SMT_CODE = item.璐寸墖鏈虹紪鐮�?.ToString();
-                            table.SMT_STENCIL = item.閽㈢綉缂栫爜?.ToString();
-                            table.SLOT_NO = item.绔欎綅鍙�?.ToString();
-                            table.LOCATION = item.璐寸墖浣嶇疆?.ToString();
-                            table.FEEDER_CODE = item.椋炶揪缂栫爜?.ToString();
-                            table.FEEDER_TYPE = item.椋炶揪绫诲瀷?.ToString();
-                            table.PCB_SURFACE = item.鍔犲伐闈�?.ToString();
-                            table.LOAD_SEQ = item.涓婃枡椤哄簭.ToInt32();
-                            table.REMARK = item.澶囨敞?.ToString();
-                            table.VALIDATION_TYPE = item.澶勭悊鏂瑰紡?.ToString();
-                            table.VALIDATION_RESULT = item.鍘熷洜?.ToString();
-                            currentList.Add(table);
-                        }
-                        var add = currentList.Where(q => q.VALIDATION_TYPE == "鏂板").ToList();
-                        var upd = currentList.Where(q => q.VALIDATION_TYPE == "淇敼").ToList();
-                        if(add.Count > 0)
-                        {
-                            Biz.Db.Insertable(add).ExecuteCommand();
-                        }
-                        if (upd.Count > 0)
-                        {
-                            Biz.Db.Updateable(upd).ExecuteCommand();
-                        }
-
-                    }
-
-                }
-                catch (Exception ex)
-                {
-                    result.CatchException(ex, $"楠岃瘉瀵煎叆宸ュ崟鏂欑珯琛ㄥ紓甯�");
-                }
-                return result;
-            }
-        }
-    }
-}
diff --git a/Tiger.Business/Model/TransactionBase.cs b/Tiger.Business/Model/TransactionBase.cs
index ec55fcc..0101577 100644
--- a/Tiger.Business/Model/TransactionBase.cs
+++ b/Tiger.Business/Model/TransactionBase.cs
@@ -10,7 +10,7 @@
 using Newtonsoft.Json;
 using Tiger.IBusiness;
 
-namespace Tiger.Business.WMS.Transaction
+namespace Tiger.Business
 {
     /// <summary>
     /// 浜嬪姟鍩虹被
diff --git a/Tiger.Business/Tiger.Business.csproj b/Tiger.Business/Tiger.Business.csproj
index 17883e5..7b518a6 100644
--- a/Tiger.Business/Tiger.Business.csproj
+++ b/Tiger.Business/Tiger.Business.csproj
@@ -101,17 +101,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="MailKit" Version="4.5.0" />
-    <PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
-    <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
-    <PackageReference Include="NLog" Version="5.2.8" />
-    <PackageReference Include="NLog.Database" Version="5.2.8" />
-    <PackageReference Include="Rhea.Common" Version="6.1.7.1356" />
-  </ItemGroup>
-
-  <ItemGroup>
     <ProjectReference Include="..\Tiger.IBusiness\Tiger.IBusiness.csproj" />
-    <ProjectReference Include="..\Tiger.Model.Net\Tiger.Model.Net.csproj" />
   </ItemGroup>
 
   <ItemGroup>

--
Gitblit v1.9.3