From 862257fe2991fa96e0f20e31bcf00e4f9b1f86a2 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期一, 22 十二月 2025 16:07:44 +0800
Subject: [PATCH] 来料检验单 生产入库检验单 出厂检验单 添加 检验数量 字段,添加 检验值字段

---
 WebAPI/Controllers/BaseSet/Gy_MaterialController.cs |  295 ++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 253 insertions(+), 42 deletions(-)

diff --git a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
index b493f57..f6d5708 100644
--- a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
@@ -2584,11 +2584,8 @@
             }
         }
         #endregion
-        /// <summary>
-        /// 鏂板妯″叿妗f-淇濆瓨鎸夐挳
-        ///鍙傛暟锛歴tring sql銆�
-        ///杩斿洖鍊硷細object銆�
-        /// </summary>
+
+        #region[鍣ㄥ叿妗f淇濆瓨涓庝慨鏀逛繚瀛樻柟娉昡
         [Route("Gy_Mould_Edit/AddBill")]
         [HttpPost]
         public object AddBill([FromBody] JObject oMain)
@@ -2702,6 +2699,16 @@
                 int HMouldHeight = mainList[0].HMouldHeight;          //楂�
                 int HMouldFoldHeight = mainList[0].HMouldFoldHeight;  //鎶樺彔楂樺害
 
+                int HUserID = mainList[0].HUserID;  // 浣跨敤浜猴紙Gy_Employee锛�
+                string HBrand = mainList[0].HBrand;  // 鍝佺墝
+                string HCalibrationType = mainList[0].HCalibrationType;  // 鏍″噯绫诲瀷 (鍐�/澶栨牎)
+                string HLocation = mainList[0].HLocation;  // 浣嶇疆
+                DateTime HCalibrationDate = mainList[0].HCalibrationDate;  // 鏍″噯鏃ユ湡
+                string HCalibrationCycle = mainList[0].HCalibrationCycle;  // 鏍″噯鍛ㄦ湡
+                string HProductDesignSize = mainList[0].HProductDesignSize;  // 浜у搧璁捐灏哄
+                string HGaugeDesignSize = mainList[0].HGaugeDesignSize;  // 妫�鍏疯璁″昂瀵�
+                int HProductQTY = mainList[0].HProductQTY;  // 浜у搧鏁伴噺
+
                 //淇濆瓨鍓嶆帶鍒�=========================================
                 string HBillNote = "";
                 ds = oCN.RunProcReturn("Exec h_p_Gy_MouldFileMain_BeforeSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "','" + HBillNote + "',1 ", "h_p_Gy_MouldFileMain_BeforeSaveCtrl");
@@ -2737,19 +2744,21 @@
                 ",HBomID,HVersion,HSPGroupID,HSPID,HDesignLife,HNowSupID,HNowSupTypeID" +
                 ",HUseLife,HLeaveLife,HProdQty,HProdWeight,HMouldOWNER,HSaveLife,HMouldDotCheckRuleInterID,HMouldMaintainRuleInterID,HBarCode,HMadeSupID" +
                 ",HMouldClass,HNowWHID,HNowSPID,HInitLife,HMouldUseStatus,HCREATEORGID,HUSEORGID " +
-                 ",HMouldLength,HMouldWidth,HMouldHeight,HMouldFoldHeight,HTransPackFlag,HSendPackFlag ) " +
+                 ",HMouldLength,HMouldWidth,HMouldHeight,HMouldFoldHeight,HTransPackFlag,HSendPackFlag," +
+                 "HUserID,HBrand,HCalibrationType,HLocation,HCalibrationDate,HCalibrationCycle,HProductDesignSize,HGaugeDesignSize,HProductQTY ) " +
 
                " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
-                        "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()" +
-                        ",'" + HMouldNo + "','" + HName + "','" + HModel + "','" + HModel2 + "','" + HDiameter + "'" +
-                        ",'" + HSubjoin + "','" + HSubjoin2 + "','" + HPICNo + "','" + HWorkMaterModel + "'" +
-                        "," + HMaterID + ",'" + HMaterNumber + "'," + HMouleTypeID + "," + HUnitID +
-                        ",'" + HOutComDate + "','" + HOutComNo + "'," + HDeptID + "," + HSupID + ",'" + HSupNumber + "'" +
-                        "," + HPrintQty + ",'" + HMouldStatus + "'," + HWHID + "," + HRoutingID + "," + HCaveQty +
-                        "," + HBOMID + ",'" + HVersion + "'," + HSPGroupID + "," + HSPID + ",'" + HDesignLife + "','" + HNowSupID + "','" + HNowSupTypeID + "'" +
-                        ",'" + HUseLife + "','" + HLeaveLife + "','" + HProdQty + "','" + HProdWeight + "','" + HMouldOWNER + "','" + HSaveLife + "','" + HMouldDotCheckRuleInterID + "','" + HMouldMaintainRuleInterID + "','" + HBarCode + "'," + HMadeSupID +
-                        ",'" + HMouldClass + "'," + HNowWHID + "," + HNowSPID + ",'" + HInitLife + "','" + HMouldUseStatus + "'," + HCREATEORGID + "," + HUSEORGID +
-                        "," + HMouldLength + "," + HMouldWidth + "," + HMouldHeight + "," + HMouldFoldHeight + "," + Convert.ToString(HTransPackFlag ? 1 : 0) + "," + Convert.ToString(HSendPackFlag ? 1 : 0) + ") ");
+                "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()" +
+                ",'" + HMouldNo + "','" + HName + "','" + HModel + "','" + HModel2 + "','" + HDiameter + "'" +
+                ",'" + HSubjoin + "','" + HSubjoin2 + "','" + HPICNo + "','" + HWorkMaterModel + "'" +
+                "," + HMaterID + ",'" + HMaterNumber + "'," + HMouleTypeID + "," + HUnitID +
+                ",'" + HOutComDate + "','" + HOutComNo + "'," + HDeptID + "," + HSupID + ",'" + HSupNumber + "'" +
+                "," + HPrintQty + ",'" + HMouldStatus + "'," + HWHID + "," + HRoutingID + "," + HCaveQty +
+                "," + HBOMID + ",'" + HVersion + "'," + HSPGroupID + "," + HSPID + ",'" + HDesignLife + "','" + HNowSupID + "','" + HNowSupTypeID + "'" +
+                ",'" + HUseLife + "','" + HLeaveLife + "','" + HProdQty + "','" + HProdWeight + "','" + HMouldOWNER + "','" + HSaveLife + "','" + HMouldDotCheckRuleInterID + "','" + HMouldMaintainRuleInterID + "','" + HBarCode + "'," + HMadeSupID +
+                ",'" + HMouldClass + "'," + HNowWHID + "," + HNowSPID + ",'" + HInitLife + "','" + HMouldUseStatus + "'," + HCREATEORGID + "," + HUSEORGID +
+                "," + HMouldLength + "," + HMouldWidth + "," + HMouldHeight + "," + HMouldFoldHeight + "," + Convert.ToString(HTransPackFlag ? 1 : 0) + "," + Convert.ToString(HSendPackFlag ? 1 : 0) + "," +
+                "'" + HUserID + "','" + HBrand + "','" + HCalibrationType + "','" + HLocation + "','" + HCalibrationDate + "','" + HCalibrationCycle + "','" + HProductDesignSize + "','" + HGaugeDesignSize + "','" + HProductQTY + "') ");
 
                 //瀛愯〃
                 oCN.RunProc("Insert into Gy_MouldFileSub " +
@@ -2796,6 +2805,7 @@
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
+                objJsonResult.HInterID = HInterID.ToString();
                 objJsonResult.Message = null;
                 objJsonResult.data = null;
                 return objJsonResult;
@@ -2811,12 +2821,6 @@
             }
         }
 
-
-        /// <summary>
-        /// 淇敼鍗曟嵁-淇濆瓨鎸夐挳
-        ///鍙傛暟锛歴tring sql銆�
-        ///杩斿洖鍊硷細object銆�
-        /// </summary>
         [Route("Gy_Mould_Edit/AddBill1")]
         [HttpPost]
         public object AddBill1([FromBody] JObject oMain)
@@ -2908,6 +2912,18 @@
                 int HMouldWidth = mainList[0].HMouldWidth;            //瀹�
                 int HMouldHeight = mainList[0].HMouldHeight;          //楂�
                 int HMouldFoldHeight = mainList[0].HMouldFoldHeight;  //鎶樺彔楂樺害
+
+
+                int HUserID = mainList[0].HUserID;  // 浣跨敤浜猴紙Gy_Employee锛�
+                string HBrand = mainList[0].HBrand;  // 鍝佺墝
+                string HCalibrationType = mainList[0].HCalibrationType;  // 鏍″噯绫诲瀷 (鍐�/澶栨牎)
+                string HLocation = mainList[0].HLocation;  // 浣嶇疆
+                DateTime HCalibrationDate = mainList[0].HCalibrationDate;  // 鏍″噯鏃ユ湡
+                string HCalibrationCycle = mainList[0].HCalibrationCycle;  // 鏍″噯鍛ㄦ湡
+                string HProductDesignSize = mainList[0].HProductDesignSize;  // 浜у搧璁捐灏哄
+                string HGaugeDesignSize = mainList[0].HGaugeDesignSize;  // 妫�鍏疯璁″昂瀵�
+                int HProductQTY = mainList[0].HProductQTY;  // 浜у搧鏁伴噺
+
                 //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
                 oCN.BeginTran();
 
@@ -2996,12 +3012,16 @@
                  ",HInitLife='" + HInitLife +
                  "',HNextMainDate='" + HNextMainDate +
                  "',HMouldUseStatus='" + HMouldUseStatus +
-                  "' where HInterID=" + HInterID.ToString());
-
-                //淇敼瀛愰」鐩唬鐮�
-                //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_Department,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
-                //灏嗕笂绾� 涓洪潪鏈骇
-                // oCN.RunProc("Update Gy_Department set HEndflag=0 where HItemID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                 "',HUserID='" + HUserID +
+                 "',HBrand='" + HBrand +
+                 "',HCalibrationType='" + HCalibrationType +
+                 "',HLocation='" + HLocation +
+                 "',HCalibrationDate='" + HCalibrationDate +
+                 "',HCalibrationCycle='" + HCalibrationCycle +
+                 "',HProductDesignSize='" + HProductDesignSize +
+                 "',HGaugeDesignSize='" + HGaugeDesignSize +
+                 "',HProductQTY='" + HProductQTY +
+                 "' where HInterID=" + HInterID.ToString());             
 
                 oCN.RunProc("delete from Gy_MouldFileSub_SubMater where HInterID='" + HInterID + "'");
                 oCN.RunProc("delete from Gy_MouldFileSub_MaintainRule where HInterID='" + HInterID + "'");
@@ -3035,7 +3055,7 @@
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "淇敼鍗曟嵁鎴愬姛锛�";
-                //objJsonResult.data = null;
+                objJsonResult.HInterID = HInterID.ToString();
                 return objJsonResult;
             }
             catch (Exception e)
@@ -3130,11 +3150,9 @@
             return objJsonResult;
         }
 
-        /// <summary>
-        /// 纾ㄥ叿妗f淇敼鎸夐挳鏂规硶-璁$畻涓嬫淇濆吇/鏍℃鏃ユ湡-鑾峰彇妗f鏈�杩戜竴娆$殑淇濆吇璁板綍
-        ///鍙傛暟锛歴tring sql銆�
-        ///杩斿洖鍊硷細object銆�
-        /// </summary>
+        #endregion
+
+        #region [妯″叿妗f淇敼鎸夐挳鏂规硶-璁$畻涓嬫淇濆吇/鏍℃鏃ユ湡-鑾峰彇妗f鏈�杩戜竴娆$殑淇濆吇璁板綍]
         [Route("Gy_Mould_Edit/calculateHNextMainDate")]
         [HttpGet]
         public object calculateHNextMainDate(long HInterID)
@@ -3164,6 +3182,8 @@
                 return objJsonResult;
             }
         }
+        #endregion
+
 
         /// <summary>
         /// 纾ㄥ叿妗f淇敼鎸夐挳鏂规硶
@@ -3996,7 +4016,7 @@
         #region [妯″叿妗f鎵归噺鐢熸垚]
         [Route("Gy_Mould/SaveBatchGen_MouldFile")]
         [HttpGet]
-        public object SaveBatchGen_MouldFile(long HInterID, string StarNum, string EndNum)
+        public object SaveBatchGen_MouldFile(long HInterID, string StarNum, string EndNum,string user)
         {
             int StarNum1 = int.Parse(StarNum);
             int EndNum1 = int.Parse(EndNum);
@@ -4049,10 +4069,10 @@
                         ",HUseLife,HLeaveLife,HProdQty,HProdWeight,HMouldOWNER,HSaveLife,HMouldDotCheckRuleInterID,HMouldMaintainRuleInterID" +
                         ") " +
                         " values('3899','3899'," + HItemID + ",'" + Num1 + j + "',getdate()" +
-                        "," + dr["HYear"] + "," + dr["HPeriod"] + ",'" + dr["HRemark"] + "','" + dr["HMaker"] + "',getdate(),'" + Num1 + j +
+                        "," + dr["HYear"] + "," + dr["HPeriod"] + ",'" + dr["HRemark"] + "','" + user + "',getdate(),'" + Num1 + j +
                         "','" + Num1 + j + "','" + dr["HName"] + "','" + dr["HModel"] + "','" + dr["HModel2"] + "','" + dr["HDiameter"] + "'" +
                         ",'" + dr["HSubjoin"] + "','" + dr["HSubjoin2"] + "','" + dr["HPICNo"] + "','" + dr["HWorkMaterModel"] + "'" +
-                        "," + dr["HMaterID"] + ",'" + dr["HMaterNumber"] + "',0," + dr["HUnitID"] +
+                        "," + dr["HMaterID"] + ",'" + dr["HMaterNumber"] + "',"+dr["HMouldType"]+"," + dr["HUnitID"] +
                         ",'" + dr["HOutComDate"] + "','" + dr["HOutComNo"] + "'," + dr["HDeptID"] + "," + dr["HSupID"] + ",'" + dr["HSupNumber"] + "'" +
                         "," + dr["HPrintQty"] + ",'" + dr["HMouldStatus"] + "'," + dr["HWHID"] + "," + dr["HRoutingID"] + ",'" + dr["HCaveQty"] +
                         "'," + dr["HBOMID"] + ",'" + dr["HVersion"] + "'," + dr["HSPGroupID"] + "," + dr["HSPID"] + ",'" + dr["HDesignLife"] + "','" + dr["HNowSupID"] + "','" + dr["HNowSupTypeID"] + "'" +
@@ -4896,6 +4916,185 @@
         #endregion
         #endregion
 
+        #region 鍣ㄥ叿妗f 鏂囦欢涓婁紶
+        [Route("Gy_MouldFileBIllMain/UploadFile_Gy_MouldFilen")]
+        [HttpPost]
+        public object UploadFile_Gy_MouldFilen()
+        {
+
+            string HBillNo = HttpContext.Current.Request.Params["HBillNo"];  //鍗曟嵁鍙�
+            string HRemark = HttpContext.Current.Request.Params["HRemark"];  //澶囨敞
+            string HUserName = HttpContext.Current.Request.Params["HUserName"];  //鍒涘缓浜�
+            HttpPostedFile files = HttpContext.Current.Request.Files["file"];
+            string path = HttpContext.Current.Server.MapPath("~/../Files/Gy_MouldFilen/" + HBillNo);
+            dynamic dyResult = UploadFile_Gy_MouldFilen(files, path, HBillNo, HRemark, HUserName);
+            if (dyResult != null && dyResult.result == 1)
+            {
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "涓婁紶鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            else
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = dyResult.returnval;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+        }
+
+        public dynamic UploadFile_Gy_MouldFilen(HttpPostedFile files, string path, string HBillNo, string HRemark, string HUserName)
+        {
+            dynamic Result_Ob = new { result = 1, returnval = "涓婁紶鎴愬姛锛�" };
+            string filePath = Path.GetFullPath(files.FileName);//鏂囦欢涓婁紶璺緞
+            string fileExtension = Path.GetExtension(files.FileName);// 鏂囦欢鎵╁睍鍚�
+            string filename = files.FileName;//鏂囦欢鍚�
+            string fileSavePath = path;// 涓婁紶淇濆瓨璺緞
+            int filesize = files.ContentLength;//鑾峰彇涓婁紶鏂囦欢鐨勫ぇ灏忓崟浣嶄负瀛楄妭byte
+            int Maxsize = 40000 * 1024;//瀹氫箟涓婁紶鏂囦欢鐨勬渶澶х┖闂村ぇ灏忎负40M
+            try
+            {
+                if (files == null || files.ContentLength <= 0)
+                {
+                    Result_Ob = new { result = 0, returnval = "鏂囦欢涓嶈兘涓虹┖!" };
+                    return Result_Ob;
+                }
+                if (filesize >= Maxsize)
+                {
+                    Result_Ob = new { result = 0, returnval = "涓婁紶鏂囦欢瓒呰繃40M锛屼笉鑳戒笂浼狅紒" };
+                    return Result_Ob;
+                }
+
+                string fileurl = Path.Combine(fileSavePath, filename);
+                if (Directory.Exists(fileurl) == true)  //濡傛灉瀛樺湪閲嶅悕鏂囦欢灏辨彁绀�  
+                {
+                    Result_Ob = new { result = 0, returnval = "瀛樺湪鍚屽悕鏂囦欢锛�" };
+                    return Result_Ob;
+                }
+                //鍒犻櫎鏁版嵁琛ㄦ暟鎹�
+                ds = oCN.RunProcReturn("delete from MES_AccessoriesList where HSourceBillNo ='" + HBillNo + "' and HFileName='" + filename + "'", "MES_AccessoriesList");
+                if (Directory.Exists(path))
+                {
+                    File.Delete(fileurl);      //鍒犻櫎鎸囧畾鏂囦欢
+                    files.SaveAs(fileurl);
+                    string StrPath = "/files/Gy_MouldFilen/" + HBillNo + "/" + filename;
+                    if (File.Exists(fileurl))
+                    {
+                        //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱
+                        //鍐欏叆鏁版嵁琛�
+                        oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" +
+                                    ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" +
+                                    ",HFileClsID,HSourceBillNo" +
+                                   ") values('"
+                                    + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" +
+                                    ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize +
+                                    "','" + 0 + "','" + HBillNo +
+                                   "') ");
+                    }
+                    else
+                    {
+                        Result_Ob = new { result = 0, returnval = "涓婁紶澶辫触锛佹鏂囦欢涓烘伓鎰忔枃浠�" };
+                    }
+                }
+                else
+                {
+                    Directory.CreateDirectory(fileSavePath); //娣诲姞鏂囦欢澶�
+                    files.SaveAs(fileurl);
+                    string StrPath = "/files/Gy_MouldFilen/" + HBillNo + "/" + filename;
+                    if (File.Exists(fileurl))
+                    {
+                        //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱
+                        //鍐欏叆鏁版嵁琛�
+                        oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" +
+                                    ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" +
+                                    ",HFileClsID,HSourceBillNo" +
+                                   ") values('"
+                                    + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" +
+                                    ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize +
+                                    "','" + 0 + "','" + HBillNo +
+                                   "') ");
+                    }
+                    else
+                    {
+                        Result_Ob = new { result = 0, returnval = "涓婁紶澶辫触锛佹鏂囦欢涓烘伓鎰忔枃浠�" };
+                    }
+                }
+
+            }
+            catch (Exception e)
+            {
+                Result_Ob = new { result = 0, returnval = e.Message };
+            }
+            return Result_Ob;
+        }
+
+        /// <summary>
+        /// 鏍规嵁鍗曟嵁鍙锋煡鎵句笂浼犳枃浠跺垪琛�
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        [Route("Gy_MouldFileBIllMain/Gy_MouldFilen_Filelist")]
+        [HttpGet]
+        public object Gy_MouldFilen_Filelist(string HBillNo)
+        {
+            var url = fileip + "/Files/Gy_MouldFilen/" + HBillNo + "/";
+
+            try
+            {
+                ds = oCN.RunProcReturn("select *,'" + url + "'+CAST(HFileName as varchar(200))as url  from MES_AccessoriesList where HSourceBillNo='" + HBillNo + "'", "MES_AccessoriesList");
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        /// <summary>
+        /// 鏍规嵁ID,鍗曟嵁鍙�,鏂囦欢鍚� 鍒犻櫎鏂囦欢
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        [Route("Gy_MouldFileBIllMain/Gy_MouldFilen_DeleteFilelist")]
+        [HttpGet]
+        public object Gy_MouldFilen_DeleteFilelist(string HItemID, string HSourceBillNo, string HFileName)
+        {
+            try
+            {
+
+                oCN.RunProc("delete from MES_AccessoriesList where HItemID =" + HItemID);
+                string fileurl = Path.Combine(HttpContext.Current.Server.MapPath("~/../Files/Gy_MouldFilen/" + HSourceBillNo), HFileName);
+                File.Delete(fileurl);      //鍒犻櫎鎸囧畾鏂囦欢
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
 
         //鏍规嵁鏉$爜鎵剧墿鏂欎俊鎭�
         [Route("Gy_Material/findMaterialByNumber")]
@@ -4905,11 +5104,23 @@
             try
             {
                 ds = oCN.RunProcReturn($"select * from Gy_BarCodeBill where HBarCode='{HbarCode}' ", "Gy_Material");
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鎴愬姛";
-                objJsonResult.data = ds.Tables[0];
-                return objJsonResult;
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏌ユ壘澶辫触锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鎴愬姛";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+                
             }
             catch (Exception)
             {

--
Gitblit v1.9.1