From e7dcdcd81ad0a11d36084ca124f031f42d61bdd2 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期四, 19 六月 2025 10:29:02 +0800
Subject: [PATCH] 华远接口:优化

---
 WebAPI/Controllers/华远datamapping/HY_DataMappingController.cs |  108 +++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 78 insertions(+), 30 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 87ed51e..1fa2450 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"
@@ -45,8 +45,8 @@
     public class VRSInner_getPNLBarCodePosition_RequestResult_data
     {
         public string HBarCode_PNL;                     //PNL鏉$爜鍙�
-        public string HPosition_x;                      //浜岀淮鐮亁鍧愭爣
-        public string HPosition_y;                      //浜岀淮鐮亂鍧愭爣
+        public double HPosition_x;                      //浜岀淮鐮亁鍧愭爣
+        public double HPosition_y;                      //浜岀淮鐮亂鍧愭爣
     }
 
     #endregion
@@ -105,8 +105,8 @@
     public class VRSOuter_getSetBarCodePosition_RequestResult_data
     {
         public string HBarCode_Set;                     //Set鏉$爜鍙�
-        public string HPosition_x;                      //浜岀淮鐮亁鍧愭爣
-        public string HPosition_y;                      //浜岀淮鐮亂鍧愭爣
+        public double HPosition_x;                      //浜岀淮鐮亁鍧愭爣
+        public double HPosition_y;                      //浜岀淮鐮亂鍧愭爣
     }
 
     #endregion
@@ -284,7 +284,7 @@
         #region 鐐.VRS鍐呭眰鎻愬彇涓婁紶PNL浜岀淮鐮佷綅缃� 鎺ュ彛
         [Route("VRSInner/VRSInner_savePNLBarCodePosition")]
         [HttpGet]
-        public VRSInner_savePNLBarCodePosition_RequestResult VRSInner_savePNLBarCodePosition(string HBarCode_PNL,string HPNLPosition_x,string HPNLPosition_y)
+        public VRSInner_savePNLBarCodePosition_RequestResult VRSInner_savePNLBarCodePosition(string HBarCode_PNL,double HPNLPosition_x,double HPNLPosition_y)
         {
             VRSInner_savePNLBarCodePosition_RequestResult result = new VRSInner_savePNLBarCodePosition_RequestResult();
             try
@@ -309,7 +309,7 @@
                 }
 
                 string sql_save = "" +
-                    "update Gy_PNLInfo set HPNLPosition_x = '" + HPNLPosition_x + "',HPNLPosition_y = '" + HPNLPosition_y + "' where HLayOutName = '" + HLayOutName + "'";
+                    "update Gy_PNLInfo set HPNLPosition_x = " + HPNLPosition_x + ",HPNLPosition_y = " + HPNLPosition_y + " where HLayOutName = '" + HLayOutName + "'";
                 oCN.RunProc(sql_save);
 
                 result.code = "1";
@@ -353,8 +353,8 @@
                 {
                     VRSInner_getPNLBarCodePosition_RequestResult_data data = new VRSInner_getPNLBarCodePosition_RequestResult_data();
                     data.HBarCode_PNL = HBarCode_PNL;
-                    data.HPosition_x = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HPNLPosition_x"]);
-                    data.HPosition_y = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HPNLPosition_y"]);
+                    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);
                 }
 
@@ -459,7 +459,7 @@
         #region 鐐.VRS澶栧眰鎻愬彇涓婁紶set浜岀淮鐮佷綅缃� 鎺ュ彛
         [Route("VRSOuter/VRSOuter_saveSetBarCodePosition")]
         [HttpGet]
-        public VRSOuter_saveSetBarCodePosition_RequestResult VRSOuter_saveSetBarCodePosition(string HBarCode_Set, string HSetPosition_x, string HSetPosition_y)
+        public VRSOuter_saveSetBarCodePosition_RequestResult VRSOuter_saveSetBarCodePosition(string HBarCode_Set, double HSetPosition_x, double HSetPosition_y)
         {
             VRSOuter_saveSetBarCodePosition_RequestResult result = new VRSOuter_saveSetBarCodePosition_RequestResult();
             try
@@ -492,8 +492,8 @@
 
                 string sql_save = "" +
                     "update b set " +
-                    "b.HSetPosition_x = '" + HSetPosition_x + "' " +
-                    ",b.HSetPosition_y = '" + HSetPosition_y +"' " +
+                    "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 + "' " +
@@ -547,8 +547,8 @@
                 {
                     VRSOuter_getSetBarCodePosition_RequestResult_data data = new VRSOuter_getSetBarCodePosition_RequestResult_data();
                     data.HBarCode_Set = HBarCode_Set;
-                    data.HPosition_x = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSetPosition_x"]);
-                    data.HPosition_y = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSetPosition_y"]);
+                    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);
                 }
 
@@ -627,17 +627,19 @@
             try
             {
                 string sql = "" +
-                    //"select * from QC_CheckNote_PNL_His where HBarCode = '" + HBarCode + "' " +
+                    "select distinct * from (" +
+                    //"select HBarCode,HPCSNo from QC_CheckNote_PNL_His where HBarCode = '" + HBarCode + "' " +
                     //"union " +
-                    "select * from QC_CheckNote_PNL_Temp where HBarCode = '" + HBarCode + "'";
+                    "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"]);
+                    //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);
                 }
 
@@ -798,18 +800,44 @@
             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;
+                    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);
                 }
 
@@ -931,23 +959,33 @@
                 {
                     HBarCode_PNL = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBarCode_PNL"]);
                 }
+                else
+                {
+                    result.code = "0";
+                    result.msg = "mapping淇℃伅鑾峰彇澶辫触锛侊紒set鏉$爜涓嶅瓨鍦紒锛�";
+                    result.data = null;
+                    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);
                 }
 
@@ -1062,23 +1100,33 @@
                 {
                     HBarCode_PNL = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBarCode_PNL"]);
                 }
+                else
+                {
+                    result.code = "0";
+                    result.msg = "mapping淇℃伅鑾峰彇澶辫触锛侊紒set鏉$爜涓嶅瓨鍦紒锛�";
+                    result.data = null;
+                    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);
                 }
 

--
Gitblit v1.9.1