From e9c383fe6a79fab1ef58107bda1b88808b5ad00c Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期二, 05 八月 2025 09:30:27 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/华远datamapping/HY_DataMappingController.cs |  686 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 628 insertions(+), 58 deletions(-)

diff --git "a/WebAPI/Controllers/\345\215\216\350\277\234datamapping/HY_DataMappingController.cs" "b/WebAPI/Controllers/\345\215\216\350\277\234datamapping/HY_DataMappingController.cs"
index 6e67119..30f6587 100644
--- "a/WebAPI/Controllers/\345\215\216\350\277\234datamapping/HY_DataMappingController.cs"
+++ "b/WebAPI/Controllers/\345\215\216\350\277\234datamapping/HY_DataMappingController.cs"
@@ -14,6 +14,43 @@
 namespace WebAPI.Controllers
 {
     #region 鍗庤繙璇锋眰鍩虹璧勬枡
+
+    #region 鐐.VRS鍐呭眰鎻愬彇涓婁紶浜岀淮鐮佷綅缃帴鍙� 鐩稿叧妯″瀷绫�
+    public class VRSInner_savePNLBarCodePosition_RequestParams
+    {
+        public string HBarCode_PNL;                         //PNL鏉$爜缂栧彿
+        public string HPosition_x;                      //浜岀淮鐮亁鍧愭爣
+        public string HPosition_y;                      //浜岀淮鐮亂鍧愭爣
+    }
+
+    public class VRSInner_savePNLBarCodePosition_RequestResult
+    {
+        public string code;
+        public string msg;
+    }
+    #endregion
+
+    #region 鐐.VRS鍐呭眰鑾峰彇PNL浜岀淮鐮佷綅缃俊鎭帴鍙� 鐩稿叧妯″瀷绫�
+    public class VRSInner_getPNLBarCodePosition_RequestParams
+    {
+        public string HBarCode_PNL;                      //PNL鏉$爜缂栧彿
+    }
+
+    public class VRSInner_getPNLBarCodePosition_RequestResult
+    {
+        public string code;
+        public string msg;
+        public List<VRSInner_getPNLBarCodePosition_RequestResult_data> data;
+    }
+    public class VRSInner_getPNLBarCodePosition_RequestResult_data
+    {
+        public string HBarCode_PNL;                     //PNL鏉$爜鍙�
+        public double HPosition_x;                      //浜岀淮鐮亁鍧愭爣
+        public double HPosition_y;                      //浜岀淮鐮亂鍧愭爣
+    }
+
+    #endregion
+
     #region 鐐.VRS鍐呭眰妫�楠岀粨鏋滀笂浼犳帴鍙� 鐩稿叧妯″瀷绫�
     public class VRSInner_saveCheckNote_RequestParams
     {
@@ -27,7 +64,7 @@
         public string HPCSNo;                           //PCS鍙�
         public int HPosition_x;                         //PCS鎵�鍦ㄨ鐨勭储寮�
         public int HPosition_y;                         //PCS鎵�鍦ㄥ垪鐨勭储寮�
-        public int HPageIndex;                          //姝e弽闈�(0:姝i潰,1:鍙嶉潰)
+        public string HPageIndex;                          //姝e弽闈�(0:姝i潰,1:鍙嶉潰)
         public string HBadReason;                       //涓嶈壇鍘熷洜
     }
 
@@ -36,6 +73,42 @@
         public string code;
         public string msg;
     }
+    #endregion
+
+    #region 鐐.VRS澶栧眰鎻愬彇涓婁紶浜岀淮鐮佷綅缃帴鍙� 鐩稿叧妯″瀷绫�
+    public class VRSOuter_saveSetBarCodePosition_RequestParams
+    {
+        public string HBarCode_Set;                     //Set鏉$爜缂栧彿
+        public string HPosition_x;                      //浜岀淮鐮亁鍧愭爣
+        public string HPosition_y;                      //浜岀淮鐮亂鍧愭爣
+    }
+
+    public class VRSOuter_saveSetBarCodePosition_RequestResult
+    {
+        public string code;
+        public string msg;
+    }
+    #endregion
+
+    #region 鐐.VRS澶栧眰鑾峰彇set浜岀淮鐮佷綅缃俊鎭帴鍙� 鐩稿叧妯″瀷绫�
+    public class VRSOuter_getSetBarCodePosition_RequestParams
+    {
+        public string HBarCode_Set;                      //set鏉$爜缂栧彿
+    }
+
+    public class VRSOuter_getSetBarCodePosition_RequestResult
+    {
+        public string code;
+        public string msg;
+        public List<VRSOuter_getSetBarCodePosition_RequestResult_data> data;
+    }
+    public class VRSOuter_getSetBarCodePosition_RequestResult_data
+    {
+        public string HBarCode_Set;                     //Set鏉$爜鍙�
+        public double HPosition_x;                      //浜岀淮鐮亁鍧愭爣
+        public double HPosition_y;                      //浜岀淮鐮亂鍧愭爣
+    }
+
     #endregion
 
     #region 鐐.VRS澶栧眰鑾峰彇datamapping鎺ュ彛 鐩稿叧妯″瀷绫�
@@ -73,7 +146,7 @@
         public string HPCSNo;                           //PCS鍙�
         public int HPosition_x;                         //PCS鎵�鍦ㄨ鐨勭储寮�
         public int HPosition_y;                         //PCS鎵�鍦ㄥ垪鐨勭储寮�
-        public int HPageIndex;                          //姝e弽闈�(0:姝i潰,1:鍙嶉潰)
+        public string HPageIndex;                          //姝e弽闈�(0:姝i潰,1:鍙嶉潰)
         public string HBadReason;                       //涓嶈壇鍘熷洜
     }
 
@@ -119,7 +192,7 @@
         public string HPCSNo;                           //PCS鍙�
         public int HPosition_x;                         //PCS鎵�鍦ㄨ鐨勭储寮�
         public int HPosition_y;                         //PCS鎵�鍦ㄥ垪鐨勭储寮�
-        public int HPageIndex;                          //姝e弽闈�(0:姝i潰,1:鍙嶉潰)
+        public string HPageIndex;                          //姝e弽闈�(0:姝i潰,1:鍙嶉潰)
         public string HBadReason;                       //涓嶈壇鍘熷洜
     }
 
@@ -165,7 +238,7 @@
         public string HPCSNo;                           //PCS鍙�
         public int HPosition_x;                         //PCS鎵�鍦ㄨ鐨勭储寮�
         public int HPosition_y;                         //PCS鎵�鍦ㄥ垪鐨勭储寮�
-        public int HPageIndex;                          //姝e弽闈�(0:姝i潰,1:鍙嶉潰)
+        public string HPageIndex;                          //姝e弽闈�(0:姝i潰,1:鍙嶉潰)
         public string HBadReason;                       //涓嶈壇鍘熷洜
     }
 
@@ -208,12 +281,127 @@
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         DataSet ds;
 
+        #region 鐐.VRS鍐呭眰鎻愬彇涓婁紶PNL浜岀淮鐮佷綅缃� 鎺ュ彛
+        [Route("VRSInner/VRSInner_savePNLBarCodePosition")]
+        [HttpGet]
+        public VRSInner_savePNLBarCodePosition_RequestResult VRSInner_savePNLBarCodePosition(string HBarCode_PNL,double HPNLPosition_x,double HPNLPosition_y)
+        {
+            LogService.Write("==============================================================================================");
+            LogService.Write("鐐.VRS鍐呭眰鎻愬彇涓婁紶PNL浜岀淮鐮佷綅缃��" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "銆�");
+            LogService.Write("閫掑叆鍙傛暟銆怘BarCode_PNL锛�" + HBarCode_PNL + "锛汬PNLPosition_x锛�" + HPNLPosition_x + "锛汬PNLPosition_y" + HPNLPosition_y + "銆�");
+
+            VRSInner_savePNLBarCodePosition_RequestResult result = new VRSInner_savePNLBarCodePosition_RequestResult();
+            try
+            {
+                string HLayOutName = "";                                            //PNL鏉$爜缂栧彿瀵瑰簲鐨凱NL甯冨眬鍚嶇О
+
+                string sql = @"
+                    select b.HLayOutName
+                    from Gy_BarCodeBill_PNL_Temp as a
+                    inner join Gy_PNLInfo as b on a.HLayOutName = b.HLayOutName
+                    where a.HBarCode = '" + HBarCode_PNL + "'";
+                ds = oCN.RunProcReturn(sql, "Gy_BarCodeBill_PNL_Temp");
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    result.code = "0";
+                    result.msg = "涓婁紶澶辫触锛侊紒鏂欏彿淇℃伅涓嶅瓨鍦紒锛�";
+                    LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                    LogService.Write("==============================================================================================");
+                    return result;
+                }
+                else
+                {
+                    HLayOutName = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HLayOutName"]);
+                }
+
+                string sql_save = "" +
+                    "update Gy_PNLInfo set HPNLPosition_x = " + HPNLPosition_x + ",HPNLPosition_y = " + HPNLPosition_y + " where HLayOutName = '" + HLayOutName + "'";
+                oCN.RunProc(sql_save);
+
+                result.code = "1";
+                result.msg = "涓婁紶鎴愬姛";
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
+                return result;
+            }
+            catch (Exception e)
+            {
+                result.code = "0";
+                result.msg = "" + e.Message;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
+                return result;
+            }
+        }
+        #endregion
+
+        #region 鐐.VRS鍐呭眰鑾峰彇PNL浜岀淮鐮佷綅缃俊鎭� 鎺ュ彛
+        [Route("VRSInner/VRSInner_getPNLBarCodePosition")]
+        [HttpGet]
+        public VRSInner_getPNLBarCodePosition_RequestResult VRSInner_getPNLBarCodePosition(string HBarCode_PNL)
+        {
+            LogService.Write("==============================================================================================");
+            LogService.Write("鐐.VRS鍐呭眰鑾峰彇PNL浜岀淮鐮佷綅缃俊鎭��" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "銆�");
+            LogService.Write("閫掑叆鍙傛暟銆怘BarCode_PNL锛�" + HBarCode_PNL + "銆�");
+
+            VRSInner_getPNLBarCodePosition_RequestResult result = new VRSInner_getPNLBarCodePosition_RequestResult();
+            List<VRSInner_getPNLBarCodePosition_RequestResult_data> dataList = new List<VRSInner_getPNLBarCodePosition_RequestResult_data>();
+            try
+            {
+                string sql = @"
+                    select top(1) b.*
+                    from Gy_BarCodeBill_PNL_Temp as a
+                    inner join Gy_PNLInfo as b on a.HLayOutName = b.HLayOutName
+                    where a.HBarCode = '" + HBarCode_PNL + "'";
+                ds = oCN.RunProcReturn(sql, "Gy_BarCodeBill_PNL_Temp");
+
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    result.code = "0";
+                    result.msg = "PNL浜岀淮鐮佺儳铓�浣嶇疆淇℃伅鑾峰彇澶辫触锛侊紒褰撳墠PNL浜岀淮鐮佸搴旀枡鍙锋湭璁剧疆榛樿鐑ц殌浣嶇疆锛侊紒";
+                    result.data = null;
+                    LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                    LogService.Write("==============================================================================================");
+                    return result;
+                }
+
+                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
+                {
+                    VRSInner_getPNLBarCodePosition_RequestResult_data data = new VRSInner_getPNLBarCodePosition_RequestResult_data();
+                    data.HBarCode_PNL = HBarCode_PNL;
+                    data.HPosition_x = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HPNLPosition_x"]);
+                    data.HPosition_y = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HPNLPosition_y"]);
+                    dataList.Add(data);
+                }
+
+                result.code = "1";
+                result.msg = "";
+                result.data = dataList;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
+                return result;
+            }
+            catch (Exception e)
+            {
+                result.code = "0";
+                result.msg = "" + e.Message;
+                result.data = null;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
+                return result;
+            }
+        }
+        #endregion
 
         #region 鐐.VRS鍐呭眰妫�楠岀粨鏋滀笂浼犳帴鍙�
         [Route("VRSInner/VRSInner_saveCheckNote")]
         [HttpPost]
         public VRSInner_saveCheckNote_RequestResult VRSInner_saveCheckNote([FromBody] JObject sMainSub)
         {
+            LogService.Write("==============================================================================================");
+            LogService.Write("鐐.VRS鍐呭眰妫�楠岀粨鏋滀笂浼犮��" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "銆�");
+            LogService.Write("閫掑叆鍙傛暟銆恠MainSub锛�" + sMainSub + "銆�");
+
             VRSInner_saveCheckNote_RequestResult result = new VRSInner_saveCheckNote_RequestResult();
             string msg_success = "";
             try
@@ -236,7 +424,7 @@
                         int HPosition_x = vRSInner_SaveCheckNote_RequestParams[i].param[j].HPosition_x;
                         int HPosition_y = vRSInner_SaveCheckNote_RequestParams[i].param[j].HPosition_y;
                         string HCheckProc = "鐐.VRS鍐呭眰";
-                        int HPageIndex = vRSInner_SaveCheckNote_RequestParams[i].param[j].HPageIndex;
+                        string HPageIndex = vRSInner_SaveCheckNote_RequestParams[i].param[j].HPageIndex;
                         string HBadReason = vRSInner_SaveCheckNote_RequestParams[i].param[j].HBadReason;
 
                         //鏍规嵁PNL鏉$爜鎵惧埌PNL瀵逛簬鐨凱NL甯冨眬淇℃伅銆傜劧鍚庢牴鎹甈CS鍙峰湪PNL甯冨眬淇℃伅涓壘鍒癙CS瀵瑰簲鐨剆et鍙�
@@ -266,7 +454,7 @@
                             "," + HPosition_x + "" +
                             "," + HPosition_y + "" +
                             ",'" + HCheckProc + "'" +
-                            "," + HPageIndex + "" +
+                            ",'" + HPageIndex + "'" +
                             ",'" + HBadReason + "'" +
                             ",'" + HMaker + "'" +
                             ",getdate() " +
@@ -280,6 +468,8 @@
                 oCN.Commit();
                 result.code = "1";
                 result.msg = "涓婁紶鎴愬姛锛侊紒" + msg_success;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
                 return result;
             }
             catch (Exception e)
@@ -287,38 +477,130 @@
                 oCN.RollBack();
                 result.code = "0";
                 result.msg = "涓婁紶澶辫触锛侊紒" + e.Message;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
                 return result;
             }
         }
         #endregion
 
-        #region 鐐.VRS澶栧眰鑾峰彇datamapping鏁版嵁 鎺ュ彛
-        [Route("VRSOuter/VRSOuter_getDataMapping")]
+        #region 鐐.VRS澶栧眰鎻愬彇涓婁紶set浜岀淮鐮佷綅缃� 鎺ュ彛
+        [Route("VRSOuter/VRSOuter_saveSetBarCodePosition")]
         [HttpGet]
-        public VRSOuter_getDataMapping_RequestResult VRSOuter_getDataMapping(string HBarCode)
+        public VRSOuter_saveSetBarCodePosition_RequestResult VRSOuter_saveSetBarCodePosition(string HBarCode_Set, double HSetPosition_x, double HSetPosition_y)
         {
-            VRSOuter_getDataMapping_RequestResult result = new VRSOuter_getDataMapping_RequestResult();
-            List<VRSOuter_getDataMapping_RequestResult_data> dataList = new List<VRSOuter_getDataMapping_RequestResult_data>();
+            LogService.Write("==============================================================================================");
+            LogService.Write("鐐.VRS澶栧眰鎻愬彇涓婁紶set浜岀淮鐮佷綅缃��" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "銆�");
+            LogService.Write("閫掑叆鍙傛暟銆怘BarCode_Set锛�" + HBarCode_Set + "锛汬SetPosition_x锛�" + HSetPosition_x + "锛汬SetPosition_y" + HSetPosition_y + "銆�");
+
+            VRSOuter_saveSetBarCodePosition_RequestResult result = new VRSOuter_saveSetBarCodePosition_RequestResult();
             try
             {
-                string sql = "" +
-                    //"select * from QC_CheckNote_PNL_His where HBarCode = '" + HBarCode + "' " +
-                    //"union " +
-                    "select * from QC_CheckNote_PNL_Temp where HBarCode = '" + HBarCode + "'";
-                ds = oCN.RunProcReturn(sql, "QC_CheckNote_PNL_Temp");
-                for(int i = 0; i < ds.Tables[0].Rows.Count; i++)
+                string HLayOutName = "";                                            //Set鏉$爜缂栧彿瀵瑰簲鐨凱NL甯冨眬鍚嶇О
+                string HSetNo = "";                                                 //set鍙�
+
+                string sql = @"
+                    select distinct
+	                    c.HLayOutName
+	                    ,d.HSetNo
+                    from Gy_BarCodeBill_Set_Temp as a
+                    inner join Gy_BarCodeBill_PNL_Temp as b on a.HBarCode_PNL = b.HBarCode
+                    inner join Gy_PNLInfo as c on b.HLayOutName = c.HLayOutName
+                    inner join Gy_PNLInfoSub as d on c.HInterID = d.HInterID
+                    where b.HBarCode + d.HSetNo = a.HBarCode
+                    and a.HBarCode = '" + HBarCode_Set + "'";
+                ds = oCN.RunProcReturn(sql, "Gy_BarCodeBill_Set_Temp");
+                if (ds.Tables[0].Rows.Count == 0)
                 {
-                    VRSOuter_getDataMapping_RequestResult_data data = new VRSOuter_getDataMapping_RequestResult_data();
-                    data.HBarCode = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBarCode"]); 
-                    data.HPCSNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HPCSNo"]);
-                    data.HPosition_x = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[i]["HPosition_x"]);
-                    data.HPosition_y = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[i]["HPosition_y"]);
+                    result.code = "0";
+                    result.msg = "涓婁紶澶辫触锛侊紒鏂欏彿淇℃伅涓嶅瓨鍦紒锛�";
+                    LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                    LogService.Write("==============================================================================================");
+                    return result;
+                }
+                else
+                {
+                    HLayOutName = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HLayOutName"]);
+                    HSetNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HSetNo"]);
+                }
+
+                string sql_save = "" +
+                    "update b set " +
+                    "b.HSetPosition_x = " + HSetPosition_x + " " +
+                    ",b.HSetPosition_y = " + HSetPosition_y +" " +
+                    "from Gy_PNLInfo as a " +
+                    "inner join Gy_PNLInfoSub as b on a.HInterID = b.HInterID " +
+                    "where a.HLayOutName = '" + HLayOutName + "' " +
+                    "and b.HSetNo = '" + HSetNo + "'";
+                oCN.RunProc(sql_save);
+
+                result.code = "1";
+                result.msg = "涓婁紶鎴愬姛";
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
+                return result;
+            }
+            catch (Exception e)
+            {
+                result.code = "0";
+                result.msg = "" + e.Message;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
+                return result;
+            }
+        }
+        #endregion
+
+        #region 鐐.VRS澶栧眰鑾峰彇Set浜岀淮鐮佷綅缃俊鎭� 鎺ュ彛
+        [Route("VRSOuter/VRSOuter_getSetBarCodePosition")]
+        [HttpGet]
+        public VRSOuter_getSetBarCodePosition_RequestResult VRSOuter_getSetBarCodePosition(string HBarCode_Set)
+        {
+            LogService.Write("==============================================================================================");
+            LogService.Write("鐐.VRS澶栧眰鑾峰彇Set浜岀淮鐮佷綅缃俊鎭��" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "銆�");
+            LogService.Write("閫掑叆鍙傛暟銆怘BarCode_Set锛�" + HBarCode_Set + "銆�");
+
+            VRSOuter_getSetBarCodePosition_RequestResult result = new VRSOuter_getSetBarCodePosition_RequestResult();
+            List<VRSOuter_getSetBarCodePosition_RequestResult_data> dataList = new List<VRSOuter_getSetBarCodePosition_RequestResult_data>();
+            try
+            {
+                string sql = @"
+                    select distinct
+	                    d.HSetNo
+                        ,d.HSetPosition_x
+                        ,d.HSetPosition_y
+                    from Gy_BarCodeBill_Set_Temp as a
+                    inner join Gy_BarCodeBill_PNL_Temp as b on a.HBarCode_PNL = b.HBarCode
+                    inner join Gy_PNLInfo as c on b.HLayOutName = c.HLayOutName
+                    inner join Gy_PNLInfoSub as d on c.HInterID = d.HInterID
+                    where b.HBarCode + d.HSetNo = a.HBarCode
+                    and a.HBarCode = '" + HBarCode_Set + "'";
+                ds = oCN.RunProcReturn(sql, "Gy_BarCodeBill_PNL_Temp");
+
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    result.code = "0";
+                    result.msg = "Set浜岀淮鐮佺儳铓�浣嶇疆淇℃伅鑾峰彇澶辫触锛侊紒褰撳墠Set浜岀淮鐮佸搴旀枡鍙锋湭璁剧疆榛樿鐑ц殌浣嶇疆锛侊紒";
+                    result.data = null;
+                    LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                    LogService.Write("==============================================================================================");
+                    return result;
+                }
+
+                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
+                {
+                    VRSOuter_getSetBarCodePosition_RequestResult_data data = new VRSOuter_getSetBarCodePosition_RequestResult_data();
+                    data.HBarCode_Set = HBarCode_Set;
+                    data.HPosition_x = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HSetPosition_x"]);
+                    data.HPosition_y = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HSetPosition_y"]);
                     dataList.Add(data);
                 }
 
                 result.code = "1";
                 result.msg = "";
                 result.data = dataList;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
                 return result;
             }
             catch (Exception e)
@@ -326,6 +608,133 @@
                 result.code = "0";
                 result.msg = "" + e.Message;
                 result.data = null;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
+                return result;
+            }
+        }
+        #endregion
+
+        #region 鐐.VRS鍐呭眰鐢宠PNL鏉$爜鎺ュ彛
+
+        /// <summary>
+        /// 鐢宠PNL鏉$爜鎺ュ彛
+        /// </summary>
+        /// <returns></returns>
+        [Route("VRSInner/VRSInner_getBarCodeBill_PNL")]
+        [HttpGet]
+        public object VRSInner_getBarCodeBill_PNL(string HLayOutName, string HMaker, string HBatchNo)
+        {
+            try
+            {
+                LogService.Write("==============================================================================================");
+                LogService.Write("鐢宠PNL鏉$爜銆�" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "銆�");
+                LogService.Write("閫掑叆鍙傛暟銆怘LayOutName锛�" + HLayOutName + "锛汬Maker:" + HMaker + "銆�");
+
+                string sql_checkPNLInfo = "select * from Gy_PNLInfo where HLayOutName = '" + HLayOutName + "'";
+                DataSet ds_checkPNLInfo = oCN.RunProcReturn(sql_checkPNLInfo, "Gy_PNLInfo");
+                if (ds_checkPNLInfo == null || ds_checkPNLInfo.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏂欏彿瀵瑰簲鐨凙OI鏈淮鎶わ紒锛�";
+                    objJsonResult.data = null;
+
+                    LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(objJsonResult) + "銆�");
+                    LogService.Write("==============================================================================================");
+                    return objJsonResult;
+                }
+
+                ds = oCN.RunProcReturn("exec h_p_Gy_BarCodeBill_PNL_Temp_Insert '" + HLayOutName + "','" + HMaker + "','" + HBatchNo + "'" , "h_p_Gy_BarCodeBill_PNL_Temp_Insert");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍐欏叆鑾峰彇PNL鏉$爜鏃跺彂鐢熼敊璇紒";
+                    objJsonResult.data = null;
+                    LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(objJsonResult) + "銆�");
+                    LogService.Write("==============================================================================================");
+                    return objJsonResult;
+                }
+                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;  //澶辫触锛�
+                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                    objJsonResult.data = null;
+                    LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(objJsonResult) + "銆�");
+                    LogService.Write("==============================================================================================");
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;  //鎴愬姛锛�
+                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                    objJsonResult.data = ds.Tables[0].Rows[0]["HBarCode"].ToString();
+                    LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(objJsonResult) + "銆�");
+                    LogService.Write("==============================================================================================");
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鐢宠PNL鏉$爜鎺ュ彛澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(objJsonResult) + "銆�");
+                LogService.Write("==============================================================================================");
+                return objJsonResult;
+            }
+        }
+
+        #endregion
+
+        #region 鐐.VRS澶栧眰鑾峰彇datamapping鏁版嵁 鎺ュ彛
+        [Route("VRSOuter/VRSOuter_getDataMapping")]
+        [HttpGet]
+        public VRSOuter_getDataMapping_RequestResult VRSOuter_getDataMapping(string HBarCode)
+        {
+            LogService.Write("==============================================================================================");
+            LogService.Write("鐐.VRS鑾峰彇datamapping淇℃伅銆�" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "銆�");
+            LogService.Write("閫掑叆鍙傛暟銆怘BarCode锛�" + HBarCode + "銆�");
+
+            VRSOuter_getDataMapping_RequestResult result = new VRSOuter_getDataMapping_RequestResult();
+            List<VRSOuter_getDataMapping_RequestResult_data> dataList = new List<VRSOuter_getDataMapping_RequestResult_data>();
+            try
+            {
+                string sql = "" +
+                    "select distinct * from (" +
+                    //"select HBarCode,HPCSNo from QC_CheckNote_PNL_His where HBarCode = '" + HBarCode + "' " +
+                    //"union " +
+                    "select HBarCode,HPCSNo from QC_CheckNote_PNL_Temp where HBarCode = '" + HBarCode + "' " +
+                    ") as a";
+                ds = oCN.RunProcReturn(sql, "QC_CheckNote_PNL_Temp");
+                for(int i = 0; i < ds.Tables[0].Rows.Count; i++)
+                {
+                    VRSOuter_getDataMapping_RequestResult_data data = new VRSOuter_getDataMapping_RequestResult_data();
+                    data.HBarCode = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBarCode"]); 
+                    data.HPCSNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HPCSNo"]);
+                    //data.HPosition_x = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[i]["HPosition_x"]);
+                    //data.HPosition_y = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[i]["HPosition_y"]);
+                    dataList.Add(data);
+                }
+
+                result.code = "1";
+                result.msg = "";
+                result.data = dataList;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
+                return result;
+            }
+            catch (Exception e)
+            {
+                result.code = "0";
+                result.msg = "" + e.Message;
+                result.data = null;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
                 return result;
             }
         }
@@ -336,6 +745,10 @@
         [HttpPost]
         public VRSOuter_saveCheckNote_RequestResult VRSOuter_saveCheckNote([FromBody] JObject sMainSub)
         {
+            LogService.Write("==============================================================================================");
+            LogService.Write("鐐.VRS澶栧眰妫�楠岀粨鏋滀笂浼犮��" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "銆�");
+            LogService.Write("閫掑叆鍙傛暟銆恠MainSub锛�" + sMainSub + "銆�");
+
             VRSOuter_saveCheckNote_RequestResult result = new VRSOuter_saveCheckNote_RequestResult();
             string msg_success = "";
             try
@@ -358,7 +771,7 @@
                         int HPosition_x = vRSOuter_SaveCheckNote_RequestParams[i].param[j].HPosition_x;
                         int HPosition_y = vRSOuter_SaveCheckNote_RequestParams[i].param[j].HPosition_y;
                         string HCheckProc = "鐐.VRS澶栧眰";
-                        int HPageIndex = vRSOuter_SaveCheckNote_RequestParams[i].param[j].HPageIndex;
+                        string HPageIndex = vRSOuter_SaveCheckNote_RequestParams[i].param[j].HPageIndex;
                         string HBadReason = vRSOuter_SaveCheckNote_RequestParams[i].param[j].HBadReason;
 
                         //鏍规嵁PNL鏉$爜鎵惧埌PNL瀵逛簬鐨凱NL甯冨眬淇℃伅銆傜劧鍚庢牴鎹甈CS鍙峰湪PNL甯冨眬淇℃伅涓壘鍒癙CS瀵瑰簲鐨剆et鍙�
@@ -388,7 +801,7 @@
                             "," + HPosition_x + "" +
                             "," + HPosition_y + "" +
                             ",'" + HCheckProc + "'" +
-                            "," + HPageIndex + "" +
+                            ",'" + HPageIndex + "'" +
                             ",'" + HBadReason + "'" +
                             ",'" + HMaker + "'" +
                             ",getdate() " +
@@ -402,6 +815,8 @@
                 oCN.Commit();
                 result.code = "1";
                 result.msg = "涓婁紶鎴愬姛锛侊紒" + msg_success;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
                 return result;
             }
             catch (Exception e)
@@ -409,9 +824,79 @@
                 oCN.RollBack();
                 result.code = "0";
                 result.msg = "涓婁紶澶辫触锛侊紒" + e.Message;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
                 return result;
             }
         }
+        #endregion
+
+        #region 鐐.VRS澶栧眰鐢宠set鏉$爜鎺ュ彛
+
+        /// <summary>
+        /// 鐢宠set鏉$爜鎺ュ彛
+        /// </summary>
+        /// <returns></returns>
+        [Route("VRSOuter/VRSOuter_getBarCodeBill_SET")]
+        [HttpGet]
+        public object VRSOuter_getBarCodeBill_SET(string HBarCode_PNL, string HMaker)
+        {
+            LogService.Write("==============================================================================================");
+            LogService.Write("鐐.VRS澶栧眰鐢宠set鏉$爜銆�" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "銆�");
+            LogService.Write("閫掑叆鍙傛暟銆怘BarCode_PNL锛�" + HBarCode_PNL + "锛汬Maker:" + HMaker + "銆�");
+
+            try
+            {
+                ds = oCN.RunProcReturn("exec h_p_Gy_BarCodeBill_Set_Temp_Insert '" + HBarCode_PNL + "','" + HMaker + "'", "h_p_Gy_BarCodeBill_Set_Temp_Insert");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍐欏叆鑾峰彇SET鏉$爜鏃跺彂鐢熼敊璇紒";
+                    objJsonResult.data = null;
+                    LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(objJsonResult) + "銆�");
+                    LogService.Write("==============================================================================================");
+                    return objJsonResult;
+                }
+                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;  //澶辫触锛�
+                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                    objJsonResult.data = null;
+                    LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(objJsonResult) + "銆�");
+                    LogService.Write("==============================================================================================");
+                    return objJsonResult;
+                }
+                else
+                {
+                    List<string> HBarCodeList = new List<string>();
+                    for(int i = 0; i < ds.Tables[0].Rows.Count; i++)
+                    {
+                        HBarCodeList.Add(ds.Tables[0].Rows[i]["HBarCode"].ToString());
+                    }
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;  //鎴愬姛锛�
+                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                    objJsonResult.data = HBarCodeList;
+                    LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(objJsonResult) + "銆�");
+                    LogService.Write("==============================================================================================");
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鐢宠SET鏉$爜鎺ュ彛澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(objJsonResult) + "銆�");
+                LogService.Write("==============================================================================================");
+                return objJsonResult;
+            }
+        }
+
         #endregion
 
         #region AVI鑾峰彇datamapping鏁版嵁 鎺ュ彛
@@ -419,28 +904,62 @@
         [HttpGet]
         public AVI_getDataMapping_RequestResult AVI_getDataMapping(string HBarCode)
         {
+            LogService.Write("==============================================================================================");
+            LogService.Write("AVI鑾峰彇datamapping鏁版嵁銆�" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "銆�");
+            LogService.Write("閫掑叆鍙傛暟銆怘BarCode锛�" + HBarCode + "銆�");
+
             AVI_getDataMapping_RequestResult result = new AVI_getDataMapping_RequestResult();
             List<AVI_getDataMapping_RequestResult_data> dataList = new List<AVI_getDataMapping_RequestResult_data>();
             try
             {
-                string sql = "" +
-                    //"select * from QC_CheckNote_PNL_His where HBarCode = '" + HBarCode + "' " +
+                //鏍规嵁set鏉$爜缂栧彿锛岃幏鍙杝et鎵�灞炵殑PNL鏉$爜缂栧彿
+                string HBarCode_PNL = "";
+                string sql_PNLBarCode = "" +
+                    //"select * from Gy_BarCodeBill_Set_His where HBarCode = '" + HBarCode + "' " +
                     //"union " +
-                    "select * from QC_CheckNote_PNL_Temp where HBarCode = '" + HBarCode + "'";
+                    "select * from Gy_BarCodeBill_Set_Temp where HBarCode = '" + HBarCode + "' ";
+                ds = oCN.RunProcReturn(sql_PNLBarCode, "Gy_BarCodeBill_Set_Temp");
+                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
+                {
+                    HBarCode_PNL = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBarCode_PNL"]);
+                }
+                else
+                {
+                    result.code = "0";
+                    result.msg = "mapping淇℃伅鑾峰彇澶辫触锛侊紒set鏉$爜涓嶅瓨鍦紒锛�";
+                    result.data = null;
+                    LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                    LogService.Write("==============================================================================================");
+                    return result;
+                }
+
+                //鏍规嵁set鏉$爜缂栧彿锛岃幏鍙杝et鍙枫�傦紙set鏉$爜缂栧彿瑙勫垯锛歽+ww+浜斾綅PNL娴佹按鍙�+涓や綅set鍙凤級
+                string HSetNo = HBarCode.Substring(HBarCode.Length - 2, 2);
+
+                //鏍规嵁PNL鏉$爜缂栧彿銆乻et鍙凤紝浠嶱NL妫�楠屼俊鎭〃涓幏鍙杝et瀵瑰簲鐨勬楠屼俊鎭�
+                string sql = "" +
+                    "select distinct * from (" +
+                    //"select HBarCode,HPCSNo from QC_CheckNote_PNL_His where HBarCode = '" + HBarCode_PNL + "' and HSetNo = '" + HSetNo + "' " +
+                    //"union " +
+                    "select HBarCode,HPCSNo from QC_CheckNote_PNL_Temp where HBarCode = '" + HBarCode_PNL + "' and HSetNo = '" + HSetNo + "' " +
+                    ") as a";
                 ds = oCN.RunProcReturn(sql, "QC_CheckNote_PNL_Temp");
+
                 for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                 {
                     AVI_getDataMapping_RequestResult_data data = new AVI_getDataMapping_RequestResult_data();
                     data.HBarCode = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBarCode"]);
                     data.HPCSNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HPCSNo"]);
-                    data.HPosition_x = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[i]["HPosition_x"]);
-                    data.HPosition_y = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[i]["HPosition_y"]);
+                    //data.HPosition_x = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[i]["HPosition_x"]);
+                    //data.HPosition_y = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[i]["HPosition_y"]);
                     dataList.Add(data);
                 }
 
                 result.code = "1";
                 result.msg = "";
                 result.data = dataList;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
                 return result;
             }
             catch (Exception e)
@@ -448,6 +967,8 @@
                 result.code = "0";
                 result.msg = "" + e.Message;
                 result.data = null;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
                 return result;
             }
         }
@@ -458,6 +979,10 @@
         [HttpPost]
         public AVI_saveCheckNote_RequestResult AVI_saveCheckNote([FromBody] JObject sMainSub)
         {
+            LogService.Write("==============================================================================================");
+            LogService.Write("AVI妫�楠岀粨鏋滀笂浼犮��" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "銆�");
+            LogService.Write("閫掑叆鍙傛暟銆恠MainSub锛�" + sMainSub + "銆�");
+
             AVI_saveCheckNote_RequestResult result = new AVI_saveCheckNote_RequestResult();
             string msg_success = "";
             try
@@ -475,42 +1000,35 @@
                     for (int j = 0; j < aVI_SaveCheckNote_RequestParams[i].param.Count; j++)
                     {
                         string HBarCode = aVI_SaveCheckNote_RequestParams[i].param[j].HBarCode;
-                        string HSetNo = "";
+                        string HBarCode_PNL = "";
+                        string HSetNo = HBarCode.Substring(HBarCode.Length - 2, 2);
                         string HPCSNo = aVI_SaveCheckNote_RequestParams[i].param[j].HPCSNo;
                         int HPosition_x = aVI_SaveCheckNote_RequestParams[i].param[j].HPosition_x;
                         int HPosition_y = aVI_SaveCheckNote_RequestParams[i].param[j].HPosition_y;
                         string HCheckProc = "AVI";
-                        int HPageIndex = aVI_SaveCheckNote_RequestParams[i].param[j].HPageIndex;
+                        string HPageIndex = aVI_SaveCheckNote_RequestParams[i].param[j].HPageIndex;
                         string HBadReason = aVI_SaveCheckNote_RequestParams[i].param[j].HBadReason;
 
-                        //鏍规嵁PNL鏉$爜鎵惧埌PNL瀵逛簬鐨凱NL甯冨眬淇℃伅銆傜劧鍚庢牴鎹甈CS鍙峰湪PNL甯冨眬淇℃伅涓壘鍒癙CS瀵瑰簲鐨剆et鍙�
-                        string sql_set = "" +
-                            "select distinct " +
-                            "	b.HSetNo " +
-                            "from Gy_PNLInfo as a " +
-                            "inner join Gy_PNLInfoSub as b on a.HInterID = b.HInterID " +
-                            "where a.HLayOutName in " +
-                            "	( " +
-                            "		select HLayOutName from Gy_BarCodeBill_PNL_Temp where HBarCode = '" + HBarCode + "' " +
-                            //"		union " +
-                            //"		select HLayOutName from Gy_BarCodeBill_PNL_His where HBarCode = '" + HBarCode + "' " +
-                            "	) " +
-                            "and b.HPCSNo = '" + HPCSNo + "' ";
-                        ds = oCN.RunProcReturn(sql_set, "Gy_PNLInfo");
+                        //鏍规嵁set鏉$爜缂栧彿锛岃幏鍙杝et鎵�灞炵殑PNL鏉$爜缂栧彿
+                        string sql_PNLBarCode = "" +
+                            //"select * from Gy_BarCodeBill_Set_His where HBarCode = '" + HBarCode + "' " +
+                            //"union " +
+                            "select * from Gy_BarCodeBill_Set_Temp where HBarCode = '" + HBarCode + "' ";
+                        ds = oCN.RunProcReturn(sql_PNLBarCode, "Gy_BarCodeBill_Set_Temp");
                         if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                         {
-                            HSetNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HSetNo"]);
+                            HBarCode_PNL = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBarCode_PNL"]);
                         }
 
                         string sql = "insert into QC_CheckNote_PNL_Temp(HBarCode,HSetNo,HPCSNo,HPosition_x,HPosition_y,HCheckProc,HPageIndex,HBadReason,HMaker,HMakeDate) " +
                             "values(" +
-                            "'" + HBarCode + "'" +
+                            "'" + HBarCode_PNL + "'" +
                             ",'" + HSetNo + "'" +
                             ",'" + HPCSNo + "'" +
                             "," + HPosition_x + "" +
                             "," + HPosition_y + "" +
                             ",'" + HCheckProc + "'" +
-                            "," + HPageIndex + "" +
+                            ",'" + HPageIndex + "'" +
                             ",'" + HBadReason + "'" +
                             ",'" + HMaker + "'" +
                             ",getdate() " +
@@ -524,6 +1042,8 @@
                 oCN.Commit();
                 result.code = "1";
                 result.msg = "涓婁紶鎴愬姛锛侊紒" + msg_success;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
                 return result;
             }
             catch (Exception e)
@@ -531,6 +1051,8 @@
                 oCN.RollBack();
                 result.code = "0";
                 result.msg = "涓婁紶澶辫触锛侊紒" + e.Message;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
                 return result;
             }
         }
@@ -541,6 +1063,10 @@
         [HttpGet]
         public DC_getDataMapping_RequestResult DC_getDataMapping(string HBarCode)
         {
+            LogService.Write("==============================================================================================");
+            LogService.Write("鐢垫祴鑾峰彇datamapping鏁版嵁銆�" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "銆�");
+            LogService.Write("閫掑叆鍙傛暟銆怘BarCode锛�" + HBarCode + "銆�");
+
             DC_getDataMapping_RequestResult result = new DC_getDataMapping_RequestResult();
             List<DC_getDataMapping_RequestResult_data> dataList = new List<DC_getDataMapping_RequestResult_data>();
             try
@@ -556,29 +1082,43 @@
                 {
                     HBarCode_PNL = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBarCode_PNL"]);
                 }
+                else
+                {
+                    result.code = "0";
+                    result.msg = "mapping淇℃伅鑾峰彇澶辫触锛侊紒set鏉$爜涓嶅瓨鍦紒锛�";
+                    result.data = null;
+                    LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                    LogService.Write("==============================================================================================");
+                    return result;
+                }
 
                 //鏍规嵁set鏉$爜缂栧彿锛岃幏鍙杝et鍙枫�傦紙set鏉$爜缂栧彿瑙勫垯锛歽+ww+浜斾綅PNL娴佹按鍙�+涓や綅set鍙凤級
                 string HSetNo = HBarCode.Substring(HBarCode.Length-2,2);
 
                 //鏍规嵁PNL鏉$爜缂栧彿銆乻et鍙凤紝浠嶱NL妫�楠屼俊鎭〃涓幏鍙杝et瀵瑰簲鐨勬楠屼俊鎭�
                 string sql = "" +
-                    //"select * from QC_CheckNote_PNL_His where HBarCode = '" + HBarCode_PNL + "' and HSetNo = '" + HSetNo + "' " +
+                    "select distinct * from (" +
+                    //"select HBarCode,HPCSNo from QC_CheckNote_PNL_His where HBarCode = '" + HBarCode_PNL + "' and HSetNo = '" + HSetNo + "' " +
                     //"union " +
-                    "select * from QC_CheckNote_PNL_Temp where HBarCode = '" + HBarCode_PNL + "' and HSetNo = '" + HSetNo + "' ";
+                    "select HBarCode,HPCSNo from QC_CheckNote_PNL_Temp where HBarCode = '" + HBarCode_PNL + "' and HSetNo = '" + HSetNo + "' " +
+                    ") as a";
                 ds = oCN.RunProcReturn(sql, "QC_CheckNote_PNL_Temp");
+
                 for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                 {
                     DC_getDataMapping_RequestResult_data data = new DC_getDataMapping_RequestResult_data();
                     data.HBarCode = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBarCode"]);
                     data.HPCSNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HPCSNo"]);
-                    data.HPosition_x = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[i]["HPosition_x"]);
-                    data.HPosition_y = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[i]["HPosition_y"]);
+                    //data.HPosition_x = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[i]["HPosition_x"]);
+                    //data.HPosition_y = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[i]["HPosition_y"]);
                     dataList.Add(data);
                 }
 
                 result.code = "1";
                 result.msg = "";
                 result.data = dataList;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
                 return result;
             }
             catch (Exception e)
@@ -586,6 +1126,8 @@
                 result.code = "0";
                 result.msg = "" + e.Message;
                 result.data = null;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
                 return result;
             }
         }
@@ -596,6 +1138,10 @@
         [HttpPost]
         public DC_saveCheckNote_RequestResult DC_saveCheckNote([FromBody] JObject sMainSub)
         {
+            LogService.Write("==============================================================================================");
+            LogService.Write("鐢垫祴妫�楠岀粨鏋滀笂浼犮��" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "銆�");
+            LogService.Write("閫掑叆鍙傛暟銆恠MainSub锛�" + sMainSub + "銆�");
+
             DC_saveCheckNote_RequestResult result = new DC_saveCheckNote_RequestResult();
             string msg_success = "";
             try
@@ -619,7 +1165,7 @@
                         int HPosition_x = dC_SaveCheckNote_RequestParams[i].param[j].HPosition_x;
                         int HPosition_y = dC_SaveCheckNote_RequestParams[i].param[j].HPosition_y;
                         string HCheckProc = "鐢垫祴";
-                        int HPageIndex = dC_SaveCheckNote_RequestParams[i].param[j].HPageIndex;
+                        string HPageIndex = dC_SaveCheckNote_RequestParams[i].param[j].HPageIndex;
                         string HBadReason = dC_SaveCheckNote_RequestParams[i].param[j].HBadReason;
 
                         //鏍规嵁set鏉$爜缂栧彿锛岃幏鍙杝et鎵�灞炵殑PNL鏉$爜缂栧彿
@@ -641,7 +1187,7 @@
                             "," + HPosition_x + "" +
                             "," + HPosition_y + "" +
                             ",'" + HCheckProc + "'" +
-                            "," + HPageIndex + "" +
+                            ",'" + HPageIndex + "'" +
                             ",'" + HBadReason + "'" +
                             ",'" + HMaker + "'" +
                             ",getdate() " +
@@ -655,6 +1201,8 @@
                 oCN.Commit();
                 result.code = "1";
                 result.msg = "涓婁紶鎴愬姛锛侊紒" + msg_success;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
                 return result;
             }
             catch (Exception e)
@@ -662,6 +1210,8 @@
                 oCN.RollBack();
                 result.code = "0";
                 result.msg = "涓婁紶澶辫触锛侊紒" + e.Message;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
                 return result;
             }
         }
@@ -672,6 +1222,10 @@
         [HttpGet]
         public JGG_getDataMapping_RequestResult JGG_getDataMapping(string HBarCode)
         {
+            LogService.Write("==============================================================================================");
+            LogService.Write("婵�鍏夊壊鑾峰彇datamapping鏁版嵁銆�" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "銆�");
+            LogService.Write("閫掑叆鍙傛暟銆怘BarCode锛�" + HBarCode + "銆�");
+
             JGG_getDataMapping_RequestResult result = new JGG_getDataMapping_RequestResult();
             List<JGG_getDataMapping_RequestResult_data> dataList = new List<JGG_getDataMapping_RequestResult_data>();
             try
@@ -687,29 +1241,43 @@
                 {
                     HBarCode_PNL = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBarCode_PNL"]);
                 }
+                else
+                {
+                    result.code = "0";
+                    result.msg = "mapping淇℃伅鑾峰彇澶辫触锛侊紒set鏉$爜涓嶅瓨鍦紒锛�";
+                    result.data = null;
+                    LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                    LogService.Write("==============================================================================================");
+                    return result;
+                }
 
                 //鏍规嵁set鏉$爜缂栧彿锛岃幏鍙杝et鍙枫�傦紙set鏉$爜缂栧彿瑙勫垯锛歽+ww+浜斾綅PNL娴佹按鍙�+涓や綅set鍙凤級
                 string HSetNo = HBarCode.Substring(HBarCode.Length - 2, 2);
 
                 //鏍规嵁PNL鏉$爜缂栧彿銆乻et鍙凤紝浠嶱NL妫�楠屼俊鎭〃涓幏鍙杝et瀵瑰簲鐨勬楠屼俊鎭�
                 string sql = "" +
-                    //"select * from QC_CheckNote_PNL_His where HBarCode = '" + HBarCode_PNL + "' and HSetNo = '" + HSetNo + "' " +
+                    "select distinct * from (" +
+                    //"select HBarCode,HPCSNo from QC_CheckNote_PNL_His where HBarCode = '" + HBarCode_PNL + "' and HSetNo = '" + HSetNo + "' " +
                     //"union " +
-                    "select * from QC_CheckNote_PNL_Temp where HBarCode = '" + HBarCode_PNL + "' and HSetNo = '" + HSetNo + "' ";
+                    "select HBarCode,HPCSNo from QC_CheckNote_PNL_Temp where HBarCode = '" + HBarCode_PNL + "' and HSetNo = '" + HSetNo + "' " +
+                    ") as a";
                 ds = oCN.RunProcReturn(sql, "QC_CheckNote_PNL_Temp");
+
                 for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                 {
                     JGG_getDataMapping_RequestResult_data data = new JGG_getDataMapping_RequestResult_data();
                     data.HBarCode = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBarCode"]);
                     data.HPCSNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HPCSNo"]);
-                    data.HPosition_x = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[i]["HPosition_x"]);
-                    data.HPosition_y = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[i]["HPosition_y"]);
+                    //data.HPosition_x = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[i]["HPosition_x"]);
+                    //data.HPosition_y = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[i]["HPosition_y"]);
                     dataList.Add(data);
                 }
 
                 result.code = "1";
                 result.msg = "";
                 result.data = dataList;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
                 return result;
             }
             catch (Exception e)
@@ -717,6 +1285,8 @@
                 result.code = "0";
                 result.msg = "" + e.Message;
                 result.data = null;
+                LogService.Write("杩斿洖淇℃伅锛氥��" + JsonConvert.SerializeObject(result) + "銆�");
+                LogService.Write("==============================================================================================");
                 return result;
             }
         }

--
Gitblit v1.9.1