From 2ba5117206c152cece2e5ac40067a6232dfb2870 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期三, 10 九月 2025 17:12:08 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 WebApi/GS.QC/Service/FqcItemsManager.cs |  900 +++++++++++++++++++++++++++++------------------------------
 1 files changed, 442 insertions(+), 458 deletions(-)

diff --git a/WebApi/GS.QC/Service/FqcItemsManager.cs b/WebApi/GS.QC/Service/FqcItemsManager.cs
index dd58b7b..3d55749 100644
--- a/WebApi/GS.QC/Service/FqcItemsManager.cs
+++ b/WebApi/GS.QC/Service/FqcItemsManager.cs
@@ -1,490 +1,474 @@
-锘縰sing System.Data;
-using System.Data.SqlClient;
-using System.Dynamic;
-using System.Text;
-using Gs.Toolbox;
+锘縰sing Gs.Toolbox;
 using Gs.Toolbox.ApiCore.Abstract.Mvc;
 using Gs.Toolbox.ApiCore.Common.Mvc;
 using Gs.Toolbox.ApiCore.Group;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json.Linq;
+using System.Data;
+using System.Data.SqlClient;
+using System.Dynamic;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
 using static Gs.Toolbox.UtilityHelper;
 
-namespace GS.QC.Service;
-
-[ApiGroup(ApiGroupNames.QC)]
-public class FqcItemsManager : IRomteService
+namespace GS.QC.Service
 {
-    private readonly IHttpContextAccessor _http;
-    private readonly string _userCode, _userGuid, _orgFids;
-
-    public FqcItemsManager(IHttpContextAccessor httpContextAccessor)
+    [ApiGroup(ApiGroupNames.QC)]
+    public class FqcItemsManager : IRomteService
     {
-        _http = httpContextAccessor;
-        (_userCode, _userGuid, _orgFids) =
-            GetUserGuidAndOrgGuid(_http);
-    }
+        private readonly IHttpContextAccessor _http;
+        private readonly string _userCode, _userGuid, _orgFids;
 
-    /// <summary>
-    ///     璇诲彇鍒楄〃锛屾敮鎸佸垎椤�
-    /// </summary>
-    /// <param name="model"></param>
-    /// <returns></returns>
-    [RequestMethod(RequestMethods.POST)]
-    public ReturnDto<PageList<dynamic>> GetListPage([FromBody] dynamic model)
-    {
-        int currentPage = model.currentPage;
-        int everyPageSize = model.everyPageSize;
-        string sortName = model.sortName;
-        string keyWhere = model.keyWhere;
-        SqlParameter[] parameters =
+        public FqcItemsManager(IHttpContextAccessor httpContextAccessor)
         {
+            _http = httpContextAccessor;
+            (_userCode, _userGuid, _orgFids) =
+                GetUserGuidAndOrgGuid(_http);
+        }
+
+        /// <summary>
+        ///     璇诲彇鍒楄〃锛屾敮鎸佸垎椤�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [RequestMethod(RequestMethods.POST)]
+        public ReturnDto<PageList<dynamic>> GetListPage([FromBody] dynamic model)
+        {
+            int currentPage = model.currentPage;
+            int everyPageSize = model.everyPageSize;
+            string sortName = model.sortName;
+            string keyWhere = model.keyWhere;
+            SqlParameter[] parameters =
+            {
+                new("@inCurrentPage", currentPage),
+                new("@inEveryPageSize", everyPageSize),
+                new("@inSortName", sortName),
+                new("@inSortOrder", ""),
+                new("@inQueryWhere", keyWhere),
+                new("@inFid", ""),
+                new("@inP1", ""),
+                new("@inP2", ""),
+                new("@inP3", ""),
+                new("@inP4", "")
+            };
+            var dset = new DataSet();
+            var _pglist = new PageList<dynamic>
+            {
+                total = 0,
+                everyPageSize = 0,
+                pages = 0,
+                list = new List<dynamic>()
+            };
+            try
+            {
+                dset = DbHelperSQL.RunProcedure("prc_fqc_items_lst", parameters, "0");
+                if (dset != null && dset.Tables.Count > 0 &&
+                    dset.Tables[0].Rows.Count > 0) //鏈夋暟鎹�
+                {
+                    var intTotal =
+                        int.Parse(dset.Tables[1].Rows[0]["intTotal"].ToString());
+                    var pages = intTotal % everyPageSize != 0
+                        ? intTotal / everyPageSize + 1
+                        : intTotal / everyPageSize;
+                    _pglist.total = intTotal;
+                    _pglist.everyPageSize = everyPageSize;
+                    _pglist.pages = pages;
+                    var _dy = dset.Tables[0].TableToDynamicList();
+                    _pglist.list = _dy;
+                }
+            }
+            catch (Exception ex)
+            {
+                LogHelper.Debug(ToString(), ex.Message);
+                return ReturnDto<PageList<dynamic>>.QuickReturn(_pglist,
+              ReturnCode.Exception, ex.Message);
+            }
+            return ReturnDto<PageList<dynamic>>.QuickReturn(_pglist,
+                ReturnCode.Success, "璇诲彇鎴愬姛");
+        }
+
+        /// <summary>
+        ///     璇诲彇鍗曚釜瀹炰綋
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [RequestMethod(RequestMethods.POST)]
+        public ReturnDto<ExpandoObject> GetModel([FromBody] dynamic model)
+        {
+            string guid = model.guid.ToString();
+            dynamic m = new ExpandoObject();
+            m.list = new List<dynamic>();
+            m.list2 = new List<dynamic>();
+            
+            try
+            {
+                // 鏌ヨ涓昏〃鏁版嵁
+                string sqlMain = $"SELECT A.*,B.Name as OrgName FROM MES_FQC_ITEMS A LEFT JOIN SYS_ORGANIZATION b ON A.OrgId = b.FID  WHERE a.GUID='{guid}'";
+                var dsMain = DbHelperSQL.Query(sqlMain);
+                if (dsMain != null && dsMain.Tables.Count > 0 && dsMain.Tables[0].Rows.Count > 0)
+                {
+                    var dr = dsMain.Tables[0].Rows[0];
+                    m = dr.RowToDynamic();
+                }
+
+                // 鏌ヨ瀛愯〃1鏁版嵁
+                string sqlDetail1 = $"SELECT * FROM MES_FQC_ITEM_DETAIL1 WHERE PID='{guid}' ORDER BY Seq";
+                var dsDetail1 = DbHelperSQL.Query(sqlDetail1);
+                if (dsDetail1 != null && dsDetail1.Tables.Count > 0)
+                {
+                    var _tb = dsDetail1.Tables[0].TableToDynamicList();
+                    m.list = _tb;
+                }
+
+                // 鏌ヨ瀛愯〃2鏁版嵁
+                string sqlDetail2 = $"SELECT * FROM MES_FQC_ITEM_DETAIL2 WHERE PID='{guid}' ORDER BY Seq";
+                var dsDetail2 = DbHelperSQL.Query(sqlDetail2);
+                if (dsDetail2 != null && dsDetail2.Tables.Count > 0)
+                {
+                    var _tb2 = dsDetail2.Tables[0].TableToDynamicList();
+                    m.list2 = _tb2;
+                }
+            }
+            catch (Exception ex)
+            {
+                LogHelper.Debug(ToString(), ex.Message);
+            }
+            
+            if (m != null)
+                return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "璇诲彇鎴愬姛锛�");
+            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "璇诲彇澶辫触锛�");
+        }
+
+        /// <summary>
+        ///     澧炲姞鎴栫紪杈戝疄浣�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [RequestMethod(RequestMethods.POST)]
+        public ReturnDto<ExpandoObject> EditModel([FromBody] dynamic model)
+        {
+            Guid? guid = model.guid; //涓婚敭
+            string fqcNo = model.fqcNo; // 妫�楠屽崟鍙�
+            string workShop = model.workShop; // 鐢熶骇杞﹂棿
+            string itemName = model.itemName; // 浜у搧鍚嶇О
+            string itemModel = model.itemModel; // 瑙勬牸鍨嬪彿
+            string brand = model.brand; // 鍟嗘爣
+            
+            // 澶勭悊鐢熶骇鏃ユ湡锛屽厑璁镐负绌�
+            DateTime? productionDate = null;
+            if (model.productionDate != null && !string.IsNullOrEmpty(model.productionDate.ToString()))
+            {
+                if (DateTime.TryParse(model.productionDate.ToString(), out DateTime parsedDate))
+                {
+                    productionDate = parsedDate;
+                }
+            }
+            
+            string acRe_A = model.acRe_A; // AC/Re A绫�
+            string acRe_B = model.acRe_B; // AC/Re B绫�
+            string acRe_C = model.acRe_C; // AC/Re C绫�
+            string sampleMethod = model.sampleMethod; // 鎶芥牱
+            string sampleSize1 = model.sampleSize1; // 鍖�閫熸娊鏍烽��
+            string sampleSize2 = model.sampleSize2; // 闅忔満鎶芥牱鏁�
+            string sampleSize3 = model.sampleSize3; // 鏍锋湰鏁�
+            string temperature = model.temperature; // 瀹ゆ俯
+            string voltage = model.voltage; // 鐢靛帇
+            string classes = model.classes; // 鐝
+            string lineNo = model.lineNo; // 绾垮彿
+            string batch = model.batch; // 鎵归噺
+            string checkResult = model.checkResult; // 妫�楠岀粨鏋�
+            string processResults = model.processResults; // 澶勭悊缁撴灉
+
+            // 娣诲姞妫�楠屼汉銆佸鏍镐汉銆佸鎵逛汉鍙婂搴旂殑鏃ユ湡
+            string jyUser = model.jyUser; // 妫�楠屼汉
+            string checkUser = model.checkUser; // 瀹℃牳浜�
+            string spUser = model.spUser; // 瀹℃壒浜�
+            
+            // 澶勭悊妫�楠屾棩鏈燂紝鍏佽涓虹┖
+            DateTime? jyDate = null;
+            if (model.jyDate != null && !string.IsNullOrEmpty(model.jyDate.ToString()))
+            {
+                if (DateTime.TryParse(model.jyDate.ToString(), out DateTime parsedJyDate))
+                {
+                    jyDate = parsedJyDate;
+                }
+            }
+            
+            // 澶勭悊瀹℃牳鏃ユ湡锛屽厑璁镐负绌�
+            DateTime? checkDate = null;
+            if (model.checkDate != null && !string.IsNullOrEmpty(model.checkDate.ToString()))
+            {
+                if (DateTime.TryParse(model.checkDate.ToString(), out DateTime parsedCheckDate))
+                {
+                    checkDate = parsedCheckDate;
+                }
+            }
+            
+            // 澶勭悊瀹℃壒鏃ユ湡锛屽厑璁镐负绌�
+            DateTime? spDate = null;
+            if (model.spDate != null && !string.IsNullOrEmpty(model.spDate.ToString()))
+            {
+                if (DateTime.TryParse(model.spDate.ToString(), out DateTime parsedSpDate))
+                {
+                    spDate = parsedSpDate;
+                }
+            }
+
+            // 鏋勫缓瀛愯〃1鏁版嵁瀛楃涓�
+            var _sb1 = new StringBuilder();
+            var _split = "|";
+            foreach (var m in model.list1)
+            {
+                string _guid = m.Guid.ToString();
+                var _line = m.RPB001 + _split
+                                + m.RPB003 + _split
+                                + m.RPB004 + _split
+                                + m.RPB005 + _split
+                                + m.RPB006 + _split
+                                + m.RPB007 + _split
+                                + m.RPB008 + _split
+                                + m.RPB009 + _split
+                                + m.RPB010 + _split
+                                + m.RPB011 + _split
+                                + m.RPB012 + _split
+                                + m.RPB013 + _split
+                                + m.RPB014 + _split
+                                + m.RPB015 + _split
+                                + m.RPB016 + _split
+                                + m.RPB017 + _split
+                                + m.RPB018 + _split
+                                + m.RPB019 + _split
+                                + m.Remark + _split
+                                + (CheckGuid(_guid) ? _guid : Guid.Empty.ToString());
+                if (_sb1.Length > 0)
+                    _sb1.Append("~");
+                _sb1.Append(_line);
+            }
+
+            // 鏋勫缓瀛愯〃2鏁版嵁瀛楃涓�
+            var _sb2 = new StringBuilder();
+            foreach (var m in model.list2)
+            {
+                string _guid = m.Guid.ToString();
+                var _line = m.Seq + _split
+                                + m.Description + _split
+                                + m.AClass + _split
+                                + m.BClass + _split
+                                + m.CClass + _split
+                                + m.Point + _split
+                                + m.Remark + _split
+                                + (CheckGuid(_guid) ? _guid : Guid.Empty.ToString());
+                if (_sb2.Length > 0)
+                    _sb2.Append("~");
+                _sb2.Append(_line);
+            }
+
+            dynamic mObj = new ExpandoObject();
+            mObj.outMsg = "";
+            mObj.outSum = -1;
+            mObj.outGuid = "";
+            mObj.outNo = "";
+            
+            using (var conn = new SqlConnection(DbHelperSQL.strConn))
+            {
+                using (var cmd = new SqlCommand("[prc_fqc_items_edt]", conn))
+                {
+                    try
+                    {
+                        conn.Open();
+                        cmd.CommandType = CommandType.StoredProcedure;
+                        SqlParameter[] parameters =
+                        {
+                            new("@outMsg", SqlDbType.NVarChar, 300),
+                            new("@outSum", SqlDbType.Int),
+                            new("@outGuid", SqlDbType.UniqueIdentifier),
+                            new("@outNo", SqlDbType.NVarChar, 300),
+                            new("@inOrderGuid", CheckGuid(guid) ? guid : DBNull.Value),
+                            new("@inFQCNo", fqcNo),
+                            new("@inWorkShop", workShop),
+                            new("@inItemName", itemName),
+                            new("@inItemModel", itemModel),
+                            new("@inBrand", brand),
+                            new("@inProductionDate", productionDate.HasValue ? (object)productionDate.Value : DBNull.Value),
+                            new("@inAcRe_A", acRe_A),
+                            new("@inAcRe_B", acRe_B),
+                            new("@inAcRe_C", acRe_C),
+                            new("@inSampleMethod", sampleMethod),
+                            new("@inSampleSize1", sampleSize1),
+                            new("@inSampleSize2", sampleSize2),
+                            new("@inSampleSize3", sampleSize3),
+                            new("@inTemperature", temperature),
+                            new("@inVoltage", voltage),
+                            new("@inClasses", classes),
+                            new("@inLineNo", lineNo),
+                            new("@inBatch", batch),
+                            new("@inCheckResult", checkResult),
+                            new("@inProcessResults", processResults),
+                            // 娣诲姞妫�楠屼汉銆佸鏍镐汉銆佸鎵逛汉鍙婂搴旂殑鏃ユ湡鍙傛暟
+                            new("@inJyUser", jyUser),
+                            new("@inCheckUser", checkUser),
+                            new("@inSpUser", spUser),
+                            new("@inJyDate", jyDate.HasValue ? (object)jyDate.Value : DBNull.Value),
+                            new("@inCheckDate", checkDate.HasValue ? (object)checkDate.Value : DBNull.Value),
+                            new("@inSpDate", spDate.HasValue ? (object)spDate.Value : DBNull.Value),
+                            new("@inEdtUserGuid", _userGuid),
+                            new("@inDetail1List", _sb1.ToString()),
+                            new("@inDetail2List", _sb2.ToString())
+                        };
+                        parameters[0].Direction = ParameterDirection.Output;
+                        parameters[1].Direction = ParameterDirection.Output;
+                        parameters[2].Direction = ParameterDirection.Output;
+                        parameters[3].Direction = ParameterDirection.Output;
+                        foreach (var parameter in parameters)
+                            cmd.Parameters.Add(parameter);
+                        cmd.ExecuteNonQuery();
+                        mObj.outMsg = parameters[0].Value.ToString();
+                        mObj.outSum = int.Parse(parameters[1].Value.ToString());
+                        mObj.outGuid = parameters[2].Value.ToString();
+                        mObj.outNo = parameters[3].Value.ToString();
+                    }
+                    catch (Exception ex)
+                    {
+                        LogHelper.Debug(ToString(),
+                            "prc_fqc_items_edt error锛�" + ex.Message);
+                        mObj.outMsg = ex.Message;
+                        mObj.outSum = -1;
+                    }
+                    finally
+                    {
+                        conn.Close();
+                    }
+                }
+            }
+            if (mObj.outSum <= 0)
+                return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Exception, mObj.outMsg);
+            return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success, mObj.outMsg);
+        }
+
+        /// <summary>
+        ///     鍒犻櫎涓昏〃鍙婃槑缁�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [RequestMethod(RequestMethods.POST)]
+        public ReturnDto<int?> DeleteModel([FromBody] dynamic model)
+        {
+            int? rtnInt = (int)ReturnCode.Default;
+            Guid? guid = model.guid;
+            var _outMsg = "";
+            var _outSum = -1;
+            try
+            {
+                if (CheckGuid(guid))
+                {
+                    string sql = $@"
+                        DELETE FROM MES_FQC_ITEM_DETAIL1 WHERE PID='{guid}';
+                        DELETE FROM MES_FQC_ITEM_DETAIL2 WHERE PID='{guid}';
+                        DELETE FROM MES_FQC_ITEMS WHERE GUID='{guid}';";
+                    _outSum = DbHelperSQL.ExecuteSql(sql);
+                    _outMsg = _outSum > 0 ? "鍒犻櫎鎴愬姛锛�" : "鏈垹闄や换浣曟暟鎹�";
+                }
+                else
+                {
+                    _outMsg = "涓婚敭涓嶈兘涓虹┖锛�";
+                    _outSum = -1;
+                }
+            }
+            catch (Exception ex)
+            {
+                LogHelper.Debug(ToString(), "DeleteModel error锛�" + ex.Message);
+                _outMsg = ex.Message;
+                _outSum = -1;
+            }
+            if (_outSum <= 0)
+                return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Exception, _outMsg);
+            return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Success, _outMsg);
+        }
+
+
+        /// <summary>
+        /// 鎴愬搧妫�楠屾姤琛�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [RequestMethod(RequestMethods.POST)]
+        public ReturnDto<PageList<dynamic>> GetCPMX([FromBody] dynamic model)
+        {
+            int currentPage = model.currentPage;
+            int everyPageSize = model.everyPageSize;
+            string sortName = model.sortName;
+            string keyWhere = model.keyWhere;
+            SqlParameter[] parameters =
+            {
             new("@inCurrentPage", currentPage),
             new("@inEveryPageSize", everyPageSize),
             new("@inSortName", sortName),
             new("@inSortOrder", ""),
             new("@inQueryWhere", keyWhere),
-            new("@inFid", ""),
-            new("@inP1", ""),
-            new("@inP2", ""),
-            new("@inP3", ""),
-            new("@inP4", "")
         };
-        var dset = new DataSet();
-        var _pglist = new PageList<dynamic>
-        {
-            total = 0,
-            everyPageSize = 0,
-            pages = 0,
-            list = new List<dynamic>()
-        };
-        try
-        {
-            dset = DbHelperSQL.RunProcedure("prc_fqc_items_lst", parameters,
-                "0");
-            if (dset != null && dset.Tables.Count > 0 &&
-                dset.Tables[0].Rows.Count > 0) //鏈夋暟鎹�
+            var dset = new DataSet();
+            var _pglist = new PageList<dynamic>
             {
-                var intTotal =
-                    int.Parse(dset.Tables[1].Rows[0]["intTotal"].ToString());
-                var pages = intTotal % everyPageSize != 0
-                    ? intTotal / everyPageSize + 1
-                    : intTotal / everyPageSize;
-                _pglist.total = intTotal;
-                _pglist.everyPageSize = everyPageSize;
-                _pglist.pages = pages;
-                var _dy = dset.Tables[0].TableToDynamicList();
-                _pglist.list = _dy;
+                total = 0,
+                everyPageSize = 0,
+                pages = 0,
+                list = new List<dynamic>()
+            };
+            try
+            {
+                dset = DbHelperSQL.RunProcedure("report_cprkjd", parameters, "0");
+                if (dset != null && dset.Tables.Count > 0 &&
+                    dset.Tables[0].Rows.Count > 0) //鏈夋暟鎹�
+                {
+                    var intTotal =
+                        int.Parse(dset.Tables[1].Rows[0]["intTotal"].ToString());
+                    var pages = intTotal % everyPageSize != 0
+                        ? intTotal / everyPageSize + 1
+                        : intTotal / everyPageSize;
+                    _pglist.total = intTotal;
+                    _pglist.everyPageSize = everyPageSize;
+                    _pglist.pages = pages;
+                    var _dy = dset.Tables[0].TableToDynamicList();
+                    _pglist.list = _dy;
+                }
             }
-        }
-        catch (Exception ex)
-        {
-            LogHelper.Debug(ToString(), ex.Message);
+            catch (Exception ex)
+            {
+                LogHelper.Debug(ToString(), ex.Message);
+            }
+
             return ReturnDto<PageList<dynamic>>.QuickReturn(_pglist,
-                ReturnCode.Exception, ex.Message);
+                ReturnCode.Success, "璇诲彇鎴愬姛");
         }
 
-        return ReturnDto<PageList<dynamic>>.QuickReturn(_pglist,
-            ReturnCode.Success, "璇诲彇鎴愬姛");
-    }
-
-    /// <summary>
-    ///     璇诲彇鍗曚釜瀹炰綋
-    /// </summary>
-    /// <param name="model"></param>
-    /// <returns></returns>
-    [RequestMethod(RequestMethods.POST)]
-    public ReturnDto<ExpandoObject> GetModel([FromBody] dynamic model)
-    {
-        string guid = model.guid.ToString();
-        dynamic m = new ExpandoObject();
-        m.list = new List<dynamic>();
-        m.list2 = new List<dynamic>();
-
-        try
+        [RequestMethod(RequestMethods.POST)]
+        public ReturnDto<ExpandoObject> GetCPMXDetail([FromBody] dynamic model)
         {
-            // 鏌ヨ涓昏〃鏁版嵁
-            var sqlMain =
-                $"SELECT A.*,B.Name as OrgName FROM MES_FQC_ITEMS A LEFT JOIN SYS_ORGANIZATION b ON A.OrgId = b.FID  WHERE a.GUID='{guid}'";
-            var dsMain = DbHelperSQL.Query(sqlMain);
-            if (dsMain != null && dsMain.Tables.Count > 0 &&
-                dsMain.Tables[0].Rows.Count > 0)
+            dynamic m = new ExpandoObject();
+            m.list = new List<dynamic>();
+
+            string daa001 = model.daa001;
+            SqlParameter[] parameters =
             {
-                var dr = dsMain.Tables[0].Rows[0];
-                m = dr.RowToDynamic();
-            }
-
-            // 鏌ヨ瀛愯〃1鏁版嵁
-            var sqlDetail1 =
-                $"SELECT * FROM MES_FQC_ITEM_DETAIL1 WHERE PID='{guid}' ORDER BY Seq";
-            var dsDetail1 = DbHelperSQL.Query(sqlDetail1);
-            if (dsDetail1 != null && dsDetail1.Tables.Count > 0)
+                new("@daa001", daa001)
+            };
+            try
             {
-                var _tb = dsDetail1.Tables[0].TableToDynamicList();
-                m.list = _tb;
-            }
-
-            // 鏌ヨ瀛愯〃2鏁版嵁
-            var sqlDetail2 =
-                $"SELECT * FROM MES_FQC_ITEM_DETAIL2 WHERE PID='{guid}' ORDER BY Seq";
-            var dsDetail2 = DbHelperSQL.Query(sqlDetail2);
-            if (dsDetail2 != null && dsDetail2.Tables.Count > 0)
-            {
-                var _tb2 = dsDetail2.Tables[0].TableToDynamicList();
-                m.list2 = _tb2;
-            }
-        }
-        catch (Exception ex)
-        {
-            LogHelper.Debug(ToString(), ex.Message);
-        }
-
-        if (m != null)
-            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success,
-                "璇诲彇鎴愬姛锛�");
-        return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "璇诲彇澶辫触锛�");
-    }
-
-    /// <summary>
-    ///     澧炲姞鎴栫紪杈戝疄浣�
-    /// </summary>
-    /// <param name="model"></param>
-    /// <returns></returns>
-    [RequestMethod(RequestMethods.POST)]
-    public ReturnDto<ExpandoObject> EditModel([FromBody] dynamic model)
-    {
-        Guid? guid = model.guid; //涓婚敭
-        string fqcNo = model.fqcNo; // 妫�楠屽崟鍙�
-        string workShop = model.workShop; // 鐢熶骇杞﹂棿
-        string itemName = model.itemName; // 浜у搧鍚嶇О
-        string itemModel = model.itemModel; // 瑙勬牸鍨嬪彿
-        string brand = model.brand; // 鍟嗘爣
-
-        // 澶勭悊鐢熶骇鏃ユ湡锛屽厑璁镐负绌�
-        DateTime? productionDate = null;
-        if (model.productionDate != null &&
-            !string.IsNullOrEmpty(model.productionDate.ToString()))
-            if (DateTime.TryParse(model.productionDate.ToString(),
-                    out DateTime parsedDate))
-                productionDate = parsedDate;
-
-        string acRe_A = model.acRe_A; // AC/Re A绫�
-        string acRe_B = model.acRe_B; // AC/Re B绫�
-        string acRe_C = model.acRe_C; // AC/Re C绫�
-        string sampleMethod = model.sampleMethod; // 鎶芥牱
-        string sampleSize1 = model.sampleSize1; // 鍖�閫熸娊鏍烽��
-        string sampleSize2 = model.sampleSize2; // 闅忔満鎶芥牱鏁�
-        string sampleSize3 = model.sampleSize3; // 鏍锋湰鏁�
-        string temperature = model.temperature; // 瀹ゆ俯
-        string voltage = model.voltage; // 鐢靛帇
-        string classes = model.classes; // 鐝
-        string lineNo = model.lineNo; // 绾垮彿
-        string batch = model.batch; // 鎵归噺
-        string checkResult = model.checkResult; // 妫�楠岀粨鏋�
-        string processResults = model.processResults; // 澶勭悊缁撴灉
-
-        // 娣诲姞妫�楠屼汉銆佸鏍镐汉銆佸鎵逛汉鍙婂搴旂殑鏃ユ湡
-        string jyUser = model.jyUser; // 妫�楠屼汉
-        string checkUser = model.checkUser; // 瀹℃牳浜�
-        string spUser = model.spUser; // 瀹℃壒浜�
-
-        // 澶勭悊妫�楠屾棩鏈燂紝鍏佽涓虹┖
-        DateTime? jyDate = null;
-        if (model.jyDate != null &&
-            !string.IsNullOrEmpty(model.jyDate.ToString()))
-            if (DateTime.TryParse(model.jyDate.ToString(),
-                    out DateTime parsedJyDate))
-                jyDate = parsedJyDate;
-
-        // 澶勭悊瀹℃牳鏃ユ湡锛屽厑璁镐负绌�
-        DateTime? checkDate = null;
-        if (model.checkDate != null &&
-            !string.IsNullOrEmpty(model.checkDate.ToString()))
-            if (DateTime.TryParse(model.checkDate.ToString(),
-                    out DateTime parsedCheckDate))
-                checkDate = parsedCheckDate;
-
-        // 澶勭悊瀹℃壒鏃ユ湡锛屽厑璁镐负绌�
-        DateTime? spDate = null;
-        if (model.spDate != null &&
-            !string.IsNullOrEmpty(model.spDate.ToString()))
-            if (DateTime.TryParse(model.spDate.ToString(),
-                    out DateTime parsedSpDate))
-                spDate = parsedSpDate;
-
-        // 鏋勫缓瀛愯〃1鏁版嵁瀛楃涓�
-        var _sb1 = new StringBuilder();
-        var _split = "|";
-        foreach (var m in model.list1)
-        {
-            string _guid = m.Guid.ToString();
-            var _line = m.RPB001 + _split
-                                 + m.RPB003 + _split
-                                 + m.RPB004 + _split
-                                 + m.RPB005 + _split
-                                 + m.RPB006 + _split
-                                 + m.RPB007 + _split
-                                 + m.RPB008 + _split
-                                 + m.RPB009 + _split
-                                 + m.RPB010 + _split
-                                 + m.RPB011 + _split
-                                 + m.RPB012 + _split
-                                 + m.RPB013 + _split
-                                 + m.RPB014 + _split
-                                 + m.RPB015 + _split
-                                 + m.RPB016 + _split
-                                 + m.RPB017 + _split
-                                 + m.RPB018 + _split
-                                 + m.RPB019 + _split
-                                 + m.Remark + _split
-                                 + (CheckGuid(_guid)
-                                     ? _guid
-                                     : Guid.Empty.ToString());
-            if (_sb1.Length > 0)
-                _sb1.Append("~");
-            _sb1.Append(_line);
-        }
-
-        // 鏋勫缓瀛愯〃2鏁版嵁瀛楃涓�
-        var _sb2 = new StringBuilder();
-        foreach (var m in model.list2)
-        {
-            string _guid = m.Guid.ToString();
-            var _line = m.Seq + _split
-                              + m.Description + _split
-                              + m.AClass + _split
-                              + m.BClass + _split
-                              + m.CClass + _split
-                              + m.Point + _split
-                              + m.Remark + _split
-                              + (CheckGuid(_guid)
-                                  ? _guid
-                                  : Guid.Empty.ToString());
-            if (_sb2.Length > 0)
-                _sb2.Append("~");
-            _sb2.Append(_line);
-        }
-
-        dynamic mObj = new ExpandoObject();
-        mObj.outMsg = "";
-        mObj.outSum = -1;
-        mObj.outGuid = "";
-        mObj.outNo = "";
-
-        using (var conn = new SqlConnection(DbHelperSQL.strConn))
-        {
-            using (var cmd = new SqlCommand("[prc_fqc_items_edt]", conn))
-            {
-                try
+                var dsMain = DbHelperSQL.RunProcedure("report_cprkjdDetail", parameters, "0");
+                if (dsMain != null && dsMain.Tables.Count > 0 && dsMain.Tables[0].Rows.Count > 0)
                 {
-                    conn.Open();
-                    cmd.CommandType = CommandType.StoredProcedure;
-                    SqlParameter[] parameters =
-                    {
-                        new("@outMsg", SqlDbType.NVarChar, 300),
-                        new("@outSum", SqlDbType.Int),
-                        new("@outGuid", SqlDbType.UniqueIdentifier),
-                        new("@outNo", SqlDbType.NVarChar, 300),
-                        new("@inOrderGuid",
-                            CheckGuid(guid) ? guid : DBNull.Value),
-                        new("@inFQCNo", fqcNo),
-                        new("@inWorkShop", workShop),
-                        new("@inItemName", itemName),
-                        new("@inItemModel", itemModel),
-                        new("@inBrand", brand),
-                        new("@inProductionDate",
-                            productionDate.HasValue
-                                ? productionDate.Value
-                                : DBNull.Value),
-                        new("@inAcRe_A", acRe_A),
-                        new("@inAcRe_B", acRe_B),
-                        new("@inAcRe_C", acRe_C),
-                        new("@inSampleMethod", sampleMethod),
-                        new("@inSampleSize1", sampleSize1),
-                        new("@inSampleSize2", sampleSize2),
-                        new("@inSampleSize3", sampleSize3),
-                        new("@inTemperature", temperature),
-                        new("@inVoltage", voltage),
-                        new("@inClasses", classes),
-                        new("@inLineNo", lineNo),
-                        new("@inBatch", batch),
-                        new("@inCheckResult", checkResult),
-                        new("@inProcessResults", processResults),
-                        // 娣诲姞妫�楠屼汉銆佸鏍镐汉銆佸鎵逛汉鍙婂搴旂殑鏃ユ湡鍙傛暟
-                        new("@inJyUser", jyUser),
-                        new("@inCheckUser", checkUser),
-                        new("@inSpUser", spUser),
-                        new("@inJyDate",
-                            jyDate.HasValue ? jyDate.Value : DBNull.Value),
-                        new("@inCheckDate",
-                            checkDate.HasValue
-                                ? checkDate.Value
-                                : DBNull.Value),
-                        new("@inSpDate",
-                            spDate.HasValue ? spDate.Value : DBNull.Value),
-                        new("@inEdtUserGuid", _userGuid),
-                        new("@inDetail1List", _sb1.ToString()),
-                        new("@inDetail2List", _sb2.ToString())
-                    };
-                    parameters[0].Direction = ParameterDirection.Output;
-                    parameters[1].Direction = ParameterDirection.Output;
-                    parameters[2].Direction = ParameterDirection.Output;
-                    parameters[3].Direction = ParameterDirection.Output;
-                    foreach (var parameter in parameters)
-                        cmd.Parameters.Add(parameter);
-                    cmd.ExecuteNonQuery();
-                    mObj.outMsg = parameters[0].Value.ToString();
-                    mObj.outSum = int.Parse(parameters[1].Value.ToString());
-                    mObj.outGuid = parameters[2].Value.ToString();
-                    mObj.outNo = parameters[3].Value.ToString();
-                }
-                catch (Exception ex)
-                {
-                    LogHelper.Debug(ToString(),
-                        "prc_fqc_items_edt error锛�" + ex.Message);
-                    mObj.outMsg = ex.Message;
-                    mObj.outSum = -1;
-                }
-                finally
-                {
-                    conn.Close();
+
+                    m.list = dsMain.Tables[0].TableToDynamicList();
                 }
             }
-        }
-
-        if (mObj.outSum <= 0)
-            return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Exception,
-                mObj.outMsg);
-        return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success,
-            mObj.outMsg);
-    }
-
-    /// <summary>
-    ///     鍒犻櫎涓昏〃鍙婃槑缁�
-    /// </summary>
-    /// <param name="model"></param>
-    /// <returns></returns>
-    [RequestMethod(RequestMethods.POST)]
-    public ReturnDto<int?> DeleteModel([FromBody] dynamic model)
-    {
-        int? rtnInt = (int)ReturnCode.Default;
-        Guid? guid = model.guid;
-        var _outMsg = "";
-        var _outSum = -1;
-        try
-        {
-            if (CheckGuid(guid))
+            catch (Exception ex)
             {
-                var sql = $@"
-                        DELETE FROM MES_FQC_ITEM_DETAIL1 WHERE PID='{guid}';
-                        DELETE FROM MES_FQC_ITEM_DETAIL2 WHERE PID='{guid}';
-                        DELETE FROM MES_FQC_ITEMS WHERE GUID='{guid}';";
-                _outSum = DbHelperSQL.ExecuteSql(sql);
-                _outMsg = _outSum > 0 ? "鍒犻櫎鎴愬姛锛�" : "鏈垹闄や换浣曟暟鎹�";
+                LogHelper.Debug(ToString(), ex.Message);
             }
-            else
-            {
-                _outMsg = "涓婚敭涓嶈兘涓虹┖锛�";
-                _outSum = -1;
-            }
+            if (m != null)
+                return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "璇诲彇鎴愬姛锛�");
+            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "璇诲彇澶辫触锛�");
         }
-        catch (Exception ex)
-        {
-            LogHelper.Debug(ToString(), "DeleteModel error锛�" + ex.Message);
-            _outMsg = ex.Message;
-            _outSum = -1;
-        }
-
-        if (_outSum <= 0)
-            return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Exception,
-                _outMsg);
-        return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Success, _outMsg);
     }
-
-
-    /// <summary>
-    ///     鎴愬搧妫�楠屾姤琛�
-    /// </summary>
-    /// <param name="model"></param>
-    /// <returns></returns>
-    [RequestMethod(RequestMethods.POST)]
-    public ReturnDto<PageList<dynamic>> GetCPMX([FromBody] dynamic model)
-    {
-        int currentPage = model.currentPage;
-        int everyPageSize = model.everyPageSize;
-        string sortName = model.sortName;
-        string keyWhere = model.keyWhere;
-        SqlParameter[] parameters =
-        {
-            new("@inCurrentPage", currentPage),
-            new("@inEveryPageSize", everyPageSize),
-            new("@inSortName", sortName),
-            new("@inSortOrder", ""),
-            new("@inQueryWhere", keyWhere)
-        };
-        var dset = new DataSet();
-        var _pglist = new PageList<dynamic>
-        {
-            total = 0,
-            everyPageSize = 0,
-            pages = 0,
-            list = new List<dynamic>()
-        };
-        try
-        {
-            dset = DbHelperSQL.RunProcedure("report_cprkjd", parameters, "0");
-            if (dset != null && dset.Tables.Count > 0 &&
-                dset.Tables[0].Rows.Count > 0) //鏈夋暟鎹�
-            {
-                var intTotal =
-                    int.Parse(dset.Tables[1].Rows[0]["intTotal"].ToString());
-                var pages = intTotal % everyPageSize != 0
-                    ? intTotal / everyPageSize + 1
-                    : intTotal / everyPageSize;
-                _pglist.total = intTotal;
-                _pglist.everyPageSize = everyPageSize;
-                _pglist.pages = pages;
-                var _dy = dset.Tables[0].TableToDynamicList();
-                _pglist.list = _dy;
-            }
-        }
-        catch (Exception ex)
-        {
-            LogHelper.Debug(ToString(), ex.Message);
-        }
-
-        return ReturnDto<PageList<dynamic>>.QuickReturn(_pglist,
-            ReturnCode.Success, "璇诲彇鎴愬姛");
-    }
-
-    [RequestMethod(RequestMethods.POST)]
-    public ReturnDto<ExpandoObject> GetCPMXDetail([FromBody] dynamic model)
-    {
-        dynamic m = new ExpandoObject();
-        m.list = new List<dynamic>();
-
-        string daa001 = model.daa001;
-        SqlParameter[] parameters =
-        {
-            new("@daa001", daa001)
-        };
-        try
-        {
-            var dsMain =
-                DbHelperSQL.RunProcedure("report_cprkjdDetail", parameters,
-                    "0");
-            if (dsMain != null && dsMain.Tables.Count > 0 &&
-                dsMain.Tables[0].Rows.Count > 0)
-                m.list = dsMain.Tables[0].TableToDynamicList();
-        }
-        catch (Exception ex)
-        {
-            LogHelper.Debug(ToString(), ex.Message);
-        }
-
-        if (m != null)
-            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success,
-                "璇诲彇鎴愬姛锛�");
-        return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "璇诲彇澶辫触锛�");
-    }
-}
\ No newline at end of file
+}

--
Gitblit v1.9.3