From e9046aea8de84c7b82167f4c05d82d2702203195 Mon Sep 17 00:00:00 2001
From: zrg <z1873@LAPTOP-EAVL132E>
Date: 星期三, 17 九月 2025 22:04:28 +0800
Subject: [PATCH] 数据采集优化,三坐标轮廓仪增加日志,过站增加生产质量汇报单日志

---
 WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.cs |  144 ++++++++++++++++++++++++++++-------------------
 1 files changed, 85 insertions(+), 59 deletions(-)

diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.cs b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.cs
index e6ca6c0..cb8c3f7 100644
--- a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.cs
+++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.cs
@@ -37,14 +37,14 @@
         {
             try
             {
-                DataSet ds = oCN.RunProcReturn("select  * from Sc_ProcessExchangeBillMain where HBillNo='" + HBillNo + "' ", "Sc_ProcessExchangeBillMain");
+                DataSet ds = oCN.RunProcReturn("select  HProjectNum from Sc_ProcessExchangeBillMain  WITH(NOLOCK) where HBillNo='" + HBillNo + "' ", "Sc_ProcessExchangeBillMain");
                 if (ds.Tables[0].Rows.Count == 0)
                 {
                     MessageBox.Show("鏌ユ棤鏁版嵁!");
                 }
                 else
                 {
-                    DataSet dataSet= oCN.RunProcReturn("select  * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + HBillNo + "' and HICMOStatus<>'0'", "Sc_ICMOBillStatus_Tmp");
+                    DataSet dataSet = oCN.RunProcReturn("select HICMOStatus  HICMOStatus from Sc_ICMOBillStatus_Tmp  WITH(NOLOCK) where HSourceBillNo='" + HBillNo + "' and HICMOStatus<>'0'", "Sc_ICMOBillStatus_Tmp");
                     if (dataSet.Tables[0].Rows.Count > 0)
                     {
                         string HProjectNum = ds.Tables[0].Rows[0]["HProjectNum"].ToString();
@@ -52,7 +52,8 @@
                         this.txtHBardCode.ReadOnly = true;
                         list.Clear();
                     }
-                    else {
+                    else
+                    {
                         MessageBox.Show(HBillNo + ",娴佽浆鍗℃湭寮�宸�!");
                     }
                 }
@@ -85,7 +86,7 @@
         {
             try
             {
-                DataSet ds = oCN.RunProcReturn("select  * from Gy_Employee where HNumber='" + HNumber + "' ", "Gy_Employee");
+                DataSet ds = oCN.RunProcReturn("select  HName,HNumber from Gy_Employee  WITH(NOLOCK) where HNumber='" + HNumber + "' ", "Gy_Employee");
                 if (ds.Tables[0].Rows.Count == 0)
                 {
                     MessageBox.Show("鏌ユ棤鏁版嵁!");
@@ -123,12 +124,13 @@
         private void btnReadData_Click(object sender, EventArgs e)
         {
 
-            if (this.HEmpCode.Text == "" || this.txtHBath.Text == ""|| this.HSouceName.Text == "")
+            if (this.HEmpCode.Text == "" || this.txtHBath.Text == "" || this.HSouceName.Text == "")
             {
 
                 MessageBox.Show("璇疯緭鍏ョ敓浜ц祫婧�,鍛樺伐缂栫爜,鑰呮潯褰㈢爜!");
             }
-            else {
+            else
+            {
                 if (num == 0)
                 {
                     this.btnReadData.Text = "鏆傚仠";
@@ -151,7 +153,7 @@
 
         private void timer1_Tick(object sender, EventArgs e)
         {
-            if (this.HEmpCode.Text == ""|| this.txtHBath.Text == "")
+            if (this.HEmpCode.Text == "" || this.txtHBath.Text == "")
             {
                 MessageBox.Show("璇疯緭鍏ュ憳宸ョ紪鐮佹垨鑰呮祦杞崱!");
             }
@@ -200,10 +202,11 @@
 
                 //string csv_file_path_Read = $@"D:\DATA SAVE\{Year}\{Year + Month}\{Year + Month + Day}\{HBath}\鏁版嵁淇濆瓨_MES璇诲彇.csv";
 
+                //澶嶅埗涓�浠芥枃浠�
                 File.Copy(csv_file_path, csv_file_path_Read, true);
 
                 string contents = File.ReadAllText(csv_file_path_Read, Encoding.GetEncoding("gb2312"));
-               
+
                 TextFieldParser parser = new TextFieldParser(new StringReader(contents));
 
                 parser.HasFieldsEnclosedInQuotes = true;
@@ -241,7 +244,7 @@
                         DateTime NowTime = DateTime.Parse(item["娴嬭瘯鏃堕棿"].ToString());
                         string HBadCodeSN = item["搴忓彿"].ToString();
 
-                        if (((NowTime >= ActionTime && NowTime < EndTime) || dt.Rows.Count <= 20) && HBadCodeSN != "" && list.Contains(HBadCodeSN)==false)
+                        if (((NowTime >= ActionTime && NowTime < EndTime) || dt.Rows.Count <= 20) && HBadCodeSN != "" && list.Contains(HBadCodeSN) == false)
                         {
 
                             string HSourceCode = this.HSouce.Text; //璁惧缂栧彿 缁勮1 9994 缁勮2 9995 缁勮3 9996
@@ -253,6 +256,7 @@
                             string HProcNumber = "005"; //005
                             int HFlag = 0;
                             //string HEmpCode = "";
+                            //鍒ゆ柇鏉$爜涓嶄负绌�
                             if (HBadCodeSN != "")
                             {
                                 string HType = "";
@@ -262,14 +266,15 @@
 
                                 if (true)
                                 {
-                                    if (Get_AllowLoadData(HBarCode, HProcNumber, flag_1,out flag_2))
+                                    if (Get_AllowLoadData(HBarCode, HProcNumber, flag_1, out flag_2))
                                     {
                                         string sql = $@"insert into Sb_EquipMentCollection_SN(HSourceCode,HEmpCode,HType,HBarCode,HCount,HCreateTime,HDate,HResult,HProcNumber,HFlag)
-                    values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{HCount}','{HCreateTime}','{HDate}','{HResult}','{HProcNumber}','{HFlag}')";
+                                        values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{HCount}','{HCreateTime}',GETDATE(),'{HResult}','{HProcNumber}','{HFlag}')";
                                         oCN.RunProc(sql);
                                         ListSelect.Items.Add("鏉$爜:" + HBarCode + ",褰撳墠鏃ユ湡:" + DateTime.Now.ToString() + ",鏃ユ湡:" + HCreateTime + ",缁撴灉:" + HResult);
                                         list.Add(HBarCode);
 
+                                        //鏂板宸ヨ壓鍙傛暟
                                         for (int i = 0; i < dt.Columns.Count; i++)
                                         {
                                             if (dt.Columns[i].ColumnName.Contains("Hz"))
@@ -277,19 +282,21 @@
                                                 HType = dt.Columns[i].ColumnName;
                                                 string HCount_1 = item[HType].ToString();
 
-                                                DataSet ds1 = oCN.RunProcReturn(@"select * from Sb_EquipMentCollectionTechParam_SN where HBarCode='" + HBarCode + "' and HType='" + HType + "'", "Sb_EquipMentCollectionTechParam_SN");
+                                                //鏌ヨ褰撳ぉ鏉$爜 瀵瑰簲鐨勫伐鑹哄弬鏁版湁娌℃湁鎻掑叆鍒伴噷闈� 濡傛灉娌℃湁鍒欐柊澧�
+                                                DataSet ds1 = oCN.RunProcReturn(@"select HBarCode from Sb_EquipMentCollectionTechParam_SN  WITH(NOLOCK)  where HBarCode='" + HBarCode + "' and HType='" + HType + "'", "Sb_EquipMentCollectionTechParam_SN");
 
                                                 if (ds1.Tables[0].Rows.Count == 0)
                                                 {
                                                     string sql1 = $@"insert into Sb_EquipMentCollectionTechParam_SN(HSourceCode,HEmpCode,HType,HBarCode,HCount,HCreateTime,HDate,HResult,HProcNumber,HFlag)
-values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{HCount_1}','{HCreateTime}','{HDate}','{HResult}','{HProcNumber}','{HFlag}')";
+                                                    values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{HCount_1}','{HCreateTime}',GETDATE(),'{HResult}','{HProcNumber}','{HFlag}')";
                                                     oCN.RunProc(sql1);
                                                     //ListSelect.Items.Add("鏉$爜:" + HBarCode + ",鏃ユ湡:" + HCreateTime + ",缁撴灉:" + HResult);
                                                 }
                                             }
                                         }
                                     }
-                                    else {
+                                    else
+                                    {
                                         flag_1 = flag_2;
                                     }
                                 }
@@ -314,13 +321,14 @@
                             string HProcNumber = "005";
                             int HFlag = 0;
 
-                            if (HResult != "") {
+                            if (HResult != "")
+                            {
                                 if (HBadCodeSN != "")
                                 {
                                     string HType = "";
                                     int HCount = 1;
 
-                                    DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN where HBarCode='" + HBarCode + "' and HCreateTime='" + HCreateTime + "'", "Sb_EquipMentCollection_SN");
+                                    DataSet ds = oCN.RunProcReturn(@"select HBarCode from Sb_EquipMentCollectionTechParam_SN  WITH(NOLOCK)  where HBarCode='" + HBarCode + "' and HCreateTime='" + HCreateTime + "'", "Sb_EquipMentCollection_SN");
 
 
                                     if (ds.Tables[0].Rows.Count == 0)
@@ -328,7 +336,7 @@
                                         if (Get_AllowLoadData(HBarCode, HProcNumber, flag_1, out flag_2))
                                         {
                                             string sql = $@"insert into Sb_EquipMentCollection_SN(HSourceCode,HEmpCode,HType,HBarCode,HCount,HCreateTime,HDate,HResult,HProcNumber,HFlag)
-                    values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{HCount}','{HCreateTime}','{HDate}','{HResult}','{HProcNumber}','{HFlag}')";
+                                            values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{HCount}','{HCreateTime}',GETDATE(),'{HResult}','{HProcNumber}','{HFlag}')";
                                             oCN.RunProc(sql);
                                             ListSelect.Items.Add("鏉$爜:" + HBarCode + ",鏃ユ湡:" + HCreateTime + ",缁撴灉:" + HResult);
 
@@ -348,12 +356,12 @@
                                                             HCount_1 = "0";
                                                         }
 
-                                                        DataSet ds1 = oCN.RunProcReturn(@"select * from Sb_EquipMentCollectionTechParam_SN where HBarCode='" + HBarCode + "' and HType='" + HType + "'", "Sb_EquipMentCollectionTechParam_SN");
+                                                        DataSet ds1 = oCN.RunProcReturn(@"select HBarCode from Sb_EquipMentCollectionTechParam_SN  WITH(NOLOCK)  where HBarCode='" + HBarCode + "' and HType='" + HType + "'", "Sb_EquipMentCollectionTechParam_SN");
 
                                                         if (ds1.Tables[0].Rows.Count == 0)
                                                         {
                                                             string sql1 = $@"insert into Sb_EquipMentCollectionTechParam_SN(HSourceCode,HEmpCode,HType,HBarCode,HCount,HCreateTime,HDate,HResult,HProcNumber,HFlag)
-values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{(HCount_1 == "" ? " 0" : HCount_1)}','{HCreateTime}','{HDate}','{HResult_TechParam}','{HProcNumber}','{HFlag}')";
+                                                            values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{(HCount_1 == "" ? " 0" : HCount_1)}','{HCreateTime}',GETDATE(),'{HResult_TechParam}','{HProcNumber}','{HFlag}')";
                                                             oCN.RunProc(sql1);
                                                             //ListSelect.Items.Add("鏉$爜:" + HBarCode + ",鏃ユ湡:" + HCreateTime + ",缁撴灉:" + HResult);
                                                         }
@@ -382,7 +390,7 @@
         public static string AllHProName = "";
         public static double AllHQty = 0;
         //鏍规嵁鏉$爜 鍒ゆ柇鏄惁淇濆瓨
-        public bool Get_AllowLoadData(string HBarCode,string HProcNumber,bool flag_1,out bool flag_2)
+        public bool Get_AllowLoadData(string HBarCode, string HProcNumber, bool flag_1, out bool flag_2)
         {
             decimal hqty = 2;
             if (HBarCode.Length != 29 && HBarCode.Length != 50)
@@ -398,8 +406,9 @@
             {
                 string str1 = HBarCode.Substring(18, 8);
                 //string str2 = HBarCode.Substring(23, 3);
-                if (AllProcessExchange != str1) {
-                    DataSet ds = oCN.RunProcReturn("select  HInterID,HBillNo from Sc_ProcessExchangeBillMain where HProjectNum like'" + str1 + "-1%' order by HMakeDate desc", "Sc_ProcessExchangeBillMain");
+                if (AllProcessExchange != str1)
+                {
+                    DataSet ds = oCN.RunProcReturn("select  HInterID,HBillNo from Sc_ProcessExchangeBillMain WITH(NOLOCK)  where HProjectNum like'" + str1 + "-1%' order by HMakeDate desc", "Sc_ProcessExchangeBillMain");
                     //鍒ゆ柇鏄惁鑳芥壘鍒板搴旂殑娴佽浆鍗�
                     if (ds.Tables[0].Rows.Count > 0)
                     {
@@ -409,6 +418,7 @@
                     }
                     else
                     {
+                        //閿欒淇℃伅寮瑰嚭妗� 瀹氭椂瓒呰繃2鍒嗛挓寮逛竴娆�
                         if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                         {
                             time = DateTime.Now;
@@ -425,20 +435,22 @@
             else if (HBarCode.Length == 50)
             {
                 string str1 = HBarCode.Substring(42, 8);
-                DataSet ds = oCN.RunProcReturn("select  HBillNo from Sc_ProcessExchangeBillMain where HProjectNum like'" + str1 + "-1%'", "Sc_ProcessExchangeBillMain");
+                DataSet ds = oCN.RunProcReturn("select  HBillNo from Sc_ProcessExchangeBillMain WITH(NOLOCK)  where HProjectNum like'" + str1 + "-1%'", "Sc_ProcessExchangeBillMain");
                 //鍒ゆ柇鏄惁鑳芥壘鍒板搴旂殑娴佽浆鍗�
                 if (ds.Tables[0].Rows.Count > 0)
                 {
                     AllProcessExchangeHProcExchBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                 }
-                else {
+                else
+                {
+                    //flag_1=鍙湁绗竴娆¤繘鏉ユ墠浼氬脊鍑� 閿欒淇℃伅寮瑰嚭妗� 瀹氭椂瓒呰繃2鍒嗛挓寮逛竴娆�
                     if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                     {
                         time = DateTime.Now;
                         MessageBox.Show("鏉$爜:" + HBarCode + ",娴佽浆鍗′笉瀛樺湪!");
                     }
                     DBHelper.CustomWriteLog("鏉$爜:" + HBarCode + ",娴佽浆鍗′笉瀛樺湪!", DateTime.Now.ToString("yyyy-MM-dd"));
-                  
+
                     flag_2 = true;
                     return false;
                 }
@@ -449,9 +461,12 @@
             HProcExchInterID = AllProcessExchangeHProcExchInterID;
 
             DataSet ds1;
-            if ((HProcExchBillNo + HProcNumber) != AllSNBarcodeProcCtrl) {
+
+            //绗竴娆℃祦杞崱+宸ュ簭鍜屽悗闈㈢殑鍋氬姣� 濡傛灉鏄悓涓�涓祦杞崱灏变笉杩涜鍒ゆ柇
+            if ((HProcExchBillNo + HProcNumber) != AllSNBarcodeProcCtrl)
+            {
                 //鏌ヨ宸ュ簭
-                ds1 = oCN.RunProcReturn(@"SELECT  HItemID,HName FROM Gy_Process WHERE HNumber='" + HProcNumber + "'", "Gy_Process");
+                ds1 = oCN.RunProcReturn(@"SELECT  HItemID,HName FROM Gy_Process WITH(NOLOCK)  WHERE HNumber='" + HProcNumber + "'", "Gy_Process");
                 if (ds1.Tables[0].Rows.Count > 0)
                 {
                     AllHProcID = ds1.Tables[0].Rows[0]["HItemID"].ToString();
@@ -459,7 +474,7 @@
                 }
 
                 //鏌ヨ娴佽浆鍗℃暟閲�
-                ds1 = oCN.RunProcReturn(@"SELECT  HQty FROM Sc_ProcessExchangeBillSub  where HInterID=" + HProcExchInterID + " and HProcID=" + AllHProcID, "Sc_ProcessExchangeBillSub");
+                ds1 = oCN.RunProcReturn(@"SELECT  HQty FROM Sc_ProcessExchangeBillSub WITH(NOLOCK)   where HInterID=" + HProcExchInterID + " and HProcID=" + AllHProcID, "Sc_ProcessExchangeBillSub");
                 if (ds1.Tables[0].Rows.Count > 0)
                 {
                     AllHQty = double.Parse(ds1.Tables[0].Rows[0]["HQty"].ToString());
@@ -467,53 +482,61 @@
 
                 AllSNBarcodeProcCtrl = HProcExchBillNo + HProcNumber;
             }
-               
+
             string HProcID = AllHProcID;
             string HProName = AllHProName;
-            if ((HProcExchBillNo + HProcNumber) == AllSNBarcodeProcCtrl)
-            {
-                ds1 = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_S '" + HBarCode + "'," + HProcID, "h_v_Gy_QualifiedRecordsList");
+            ////绗竴娆℃祦杞崱+宸ュ簭鍜屽悗闈㈢殑鍋氬姣� 濡傛灉鏄悓涓�涓祦杞崱灏变笉杩涜鍒ゆ柇
+            //if ((HProcExchBillNo + HProcNumber) == AllSNBarcodeProcCtrl)
+            //{
+            //鍒ゆ柇 褰撳墠宸ュ簭 鏉$爜 鐨勪笂涓�閬撳伐搴忔湁娌℃湁杩囩珯
+            ds1 = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_S '" + HBarCode + "'," + HProcID, "h_p_Sc_SNBarcodeProcCtrl_S");
 
-                if (ds1.Tables[0].Rows.Count == 0)
+            if (ds1.Tables[0].Rows.Count == 0)
+            {
+                //flag_1=鍙湁绗竴娆¤繘鏉ユ墠浼氬脊鍑� 閿欒淇℃伅寮瑰嚭妗� 瀹氭椂瓒呰繃2鍒嗛挓寮逛竴娆�
+                if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                 {
-                    if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
-                    {
-                        time = DateTime.Now;
-                        MessageBox.Show("鏉$爜:" + HBarCode + "宸ュ簭:" + HProName + ",宸ュ簭鎺у埗鏌ユ棤鏁版嵁!");
-                    }
-                    DBHelper.CustomWriteLog("鏉$爜:" + HBarCode + "宸ュ簭:" + HProName + ",宸ュ簭鎺у埗鏌ユ棤鏁版嵁!", DateTime.Now.ToString("yyyy-MM-dd"));
-                  
-                    flag_2 = true;
-                    return false;
+                    time = DateTime.Now;
+                    MessageBox.Show("鏉$爜:" + HBarCode + "宸ュ簭:" + HProName + ",宸ュ簭鎺у埗鏌ユ棤鏁版嵁!");
                 }
-                else if (ds1.Tables[0].Rows[0]["HBack"].ToString() == "2")
-                {
-                    if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
-                    {
-                        time = DateTime.Now;
-                        MessageBox.Show("鏉$爜:" + HBarCode + "宸ュ簭:" + HProcID + "," + ds1.Tables[0].Rows[0]["HBackRemark"].ToString() + "!");
-                    }
-                    DBHelper.CustomWriteLog("鏉$爜:" + HBarCode + "宸ュ簭:" + HProcID + "," + ds1.Tables[0].Rows[0]["HBackRemark"].ToString() + "!", DateTime.Now.ToString("yyyy-MM-dd"));
-                   
-                    flag_2 = true;
-                    return false;
-                }
+                DBHelper.CustomWriteLog("鏉$爜:" + HBarCode + "宸ュ簭:" + HProName + ",宸ュ簭鎺у埗鏌ユ棤鏁版嵁!", DateTime.Now.ToString("yyyy-MM-dd"));
+
+                flag_2 = true;
+                return false;
             }
+            else if (ds1.Tables[0].Rows[0]["HBack"].ToString() == "2")
+            {
+                //flag_1=鍙湁绗竴娆¤繘鏉ユ墠浼氬脊鍑� 閿欒淇℃伅寮瑰嚭妗� 瀹氭椂瓒呰繃2鍒嗛挓寮逛竴娆�
+                if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
+                {
+                    time = DateTime.Now;
+                    MessageBox.Show("鏉$爜:" + HBarCode + "宸ュ簭:" + HProcID + "," + ds1.Tables[0].Rows[0]["HBackRemark"].ToString() + "!");
+                }
+                DBHelper.CustomWriteLog("鏉$爜:" + HBarCode + "宸ュ簭:" + HProcID + "," + ds1.Tables[0].Rows[0]["HBackRemark"].ToString() + "!", DateTime.Now.ToString("yyyy-MM-dd"));
+
+                flag_2 = true;
+                return false;
+            }
+            //}
 
             //鏌ヨ鍑虹珯鏁伴噺鏄惁瓒呰繃娴佽浆鍗℃暟閲�
             ds1 = oCN.RunProcReturn($@"select ({AllHQty}-sum(isnull(ou.HQty,0))-sum(isnull(ou.HBadCount,0))) HQty from Sc_StationOutBillMain ou WITH(NOLOCK)
-where ou.HProcExchInterID={HProcExchInterID} and ou.HProcID={AllHProcID}
-group by  ou.HProcExchInterID,ou.HProcExchEntryID,ou.HQty", "Sc_StationOutBillMain");
+                                    where ou.HProcExchInterID={HProcExchInterID} and ou.HProcID={AllHProcID}
+                                    group by  ou.HProcExchInterID,ou.HProcExchEntryID,ou.HQty", "Sc_StationOutBillMain");
 
+            //鑾峰彇娴佽浆鍗℃暟閲�
             double hqtyOut = AllHQty;
 
+            //娴佽浆鍗℃暟閲�-鍑虹珯鍗曟暟閲忓ぇ浜�0 
             if (ds1.Tables[0].Rows.Count > 0)
             {
                 hqtyOut = double.Parse(ds1.Tables[0].Rows[0][0].ToString());
             }
 
+            //濡傛灉鏁伴噺<0 鍒欎唬琛ㄥ嚭绔欏崟鏁伴噺瓒呭嚭娴佽浆鍗℃暟閲� 
             if (hqtyOut <= 0)
             {
+                //flag_1=鍙湁绗竴娆¤繘鏉ユ墠浼氬脊鍑� 閿欒淇℃伅寮瑰嚭妗� 瀹氭椂瓒呰繃2鍒嗛挓寮逛竴娆�
                 if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                 {
                     time = DateTime.Now;
@@ -525,8 +548,10 @@
             }
 
             //鎷嶇収宸ュ簭闄ゅ
-            if (HProcNumber != "013") {
+            if (HProcNumber != "013")
+            {
                 //澧炲姞浜х嚎缁勮杩芥函鍗�
+                //鏌ヨ褰撳墠娴佽浆鍗″搴旂殑宸ュ簭鏈夋病鏈夐厤浠朵俊鎭�,濡傛灉鏈� 鍒欏垽鏂厤浠跺崟鐨勬暟閲忔槸鍚︿负0
                 DataSet dataSet = oCN.RunProcReturn("exec h_p_Gy_BarCodeBillBomList '" + HProcExchBillNo + "'," + HProcID, "h_p_Gy_BarCodeBillBomList");
                 if (dataSet.Tables[0].Rows.Count > 0)
                 {
@@ -538,6 +563,7 @@
                         string HMaterBarCode = dataSet.Tables[0].Rows[i]["HBarCode"].ToString();
                         if (SYHQty == 0)
                         {
+                            //flag_1=鍙湁绗竴娆¤繘鏉ユ墠浼氬脊鍑� 閿欒淇℃伅寮瑰嚭妗� 瀹氭椂瓒呰繃2鍒嗛挓寮逛竴娆�
                             if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                             {
                                 time = DateTime.Now;
@@ -550,7 +576,7 @@
                     }
                 }
             }
-                
+
             flag_2 = false;
             return true;
         }
@@ -569,7 +595,7 @@
         {
             try
             {
-                DataSet ds = oCN.RunProcReturn("select  * from Gy_Source where HNumber='" + HNumber + "' ", "Gy_Source");
+                DataSet ds = oCN.RunProcReturn("select HName,HNumber from Gy_Source  WITH(NOLOCK) where HNumber='" + HNumber + "' ", "Gy_Source");
                 if (ds.Tables[0].Rows.Count == 0)
                 {
                     MessageBox.Show("鏌ユ棤鏁版嵁!");

--
Gitblit v1.9.1