From d6478661f2af69e00351dcf241fe94ddeccbc0d1 Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期六, 13 九月 2025 10:51:11 +0800
Subject: [PATCH] 群里问题部分进行修改

---
 WebAPI/Controllers/MaterialHandingController.cs         |   32 ++++++++++++++++++++++++--------
 WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs |   10 +++++-----
 2 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/WebAPI/Controllers/MaterialHandingController.cs b/WebAPI/Controllers/MaterialHandingController.cs
index 324b55c..154228d 100644
--- a/WebAPI/Controllers/MaterialHandingController.cs
+++ b/WebAPI/Controllers/MaterialHandingController.cs
@@ -86,12 +86,12 @@
 
         [Route("MaterialHandingController/OpenMaterial")]
         [HttpGet]
-        public object OpenMaterial(int HInterID, int IsUse, string CurUserName)
+        public object OpenMaterial(int HInterID, int IsUse, string CurUserName,string HMaterID)
         {
             try
             {
-
                 var ds = oCN.RunProcReturn("select * from Gy_UserMaterRelation where HItemID=" + HInterID, "Gy_UserMaterRelation");
+                var ds_1 = oCN.RunProcReturn("select * from Gy_UserMaterRelation where HMaterID=" + HMaterID+ "order by HItemID desc", "Gy_UserMaterRelation");
                 if (ds.Tables[0].Rows.Count > 0)
                 {
                     IsUse = Convert.ToInt32(ds.Tables[0].Rows[0]["HUseFlag"]) ;
@@ -106,7 +106,19 @@
                             return objJsonResult;
                         }
                     }
+                    else
+                    {
+                        if (ds_1.Tables[0].Rows.Count > 1)
+                        {
+                            string sql = "update Gy_UserMaterRelation  set HUseFlag=0 where HMaterID= " + "'" + HMaterID + "'" + "and HItemID!=" + HInterID;
+                            oCN.BeginTran();
+                            oCN.RunProc(sql);
+                            oCN.Commit();
+                            
+                        }
+                    }
                 }
+                
                 else
                 {
                     objJsonResult.code = "0";
@@ -174,10 +186,14 @@
                     //================================================================================== 
 
 
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鍚敤鎴愬姛";
-                    objJsonResult.data = null;
+
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍚敤鎴愬姛";
+                        objJsonResult.data = null;
+
+
+                   
                 }
                 //if (IsStop == 1) //鍙嶇鐢ㄥ垽鏂�
                 //{
@@ -262,7 +278,7 @@
             try
             {
                 //ds1鑾峰彇鐨剆ql鍚庢湡璁板緱鏀瑰洖渚涘簲鍟嗭紝淇敼浜�->渚涘簲鍟�
-                var ds1 = oCN.RunProcReturn("select * from h_v_Gy_UserMaterRelationEdit where 鐗╂枡浠g爜='" + HMaterID + "'" + "and 淇敼浜�='" + user + "'", "h_v_Gy_UserMaterRelationEdit");
+                var ds1 = oCN.RunProcReturn("select * from h_v_Gy_UserMaterRelationEdit where 鐗╂枡浠g爜='" + HMaterID + "'" + "and 鍒涘缓浜�='" + user + "'", "h_v_Gy_UserMaterRelationEdit");
                 var ds = oCN.RunProcReturn("select * from Gy_Material where HNumber='" + HMaterID+ "'"+ " and HUSEORGID="+"'"+ OrganizationID+"'", "Gy_Material");
                 if(ds.Tables[0].Rows.Count == 0)
                 {
@@ -283,7 +299,7 @@
                 else
                 {
                     oCN.BeginTran();
-                    string sqlUpd = "UPDATE Gy_UserMaterRelation set HUseFlag=0 where HMaterID="+ ds.Tables[0].Rows[0]["HItemID"];
+                    string sqlUpd = "UPDATE Gy_UserMaterRelation set HUseFlag=0 where HItemID=" + ds1.Tables[0].Rows[0]["HItemID"];
                     oCN.RunProc(sqlUpd);
                     oCN.Commit();
 
diff --git a/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs b/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs
index 2ae1922..d4af355 100644
--- a/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs
+++ b/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs
@@ -151,8 +151,7 @@
                 string HMaterShortNumber = ls[0].HMaterShortNumber;
                 string HMaterName = ls[0].HMaterName;
                 //渚涘簲鍟�
-                long HSupID= ls[0].HSupID;
-                string HSupName= ls[0].HSupName;
+                long HSupID = lsmain[0].HSupID;
                 string HMaker= ls[0].HMaker;
                 DateTime HMakeDate= ls[0].HMakeDate;
                 double HQty= ls[0].HQty; //鏈鐢熸垚鏉$爜鏁伴噺
@@ -161,7 +160,8 @@
         DataSet Ds;
                 SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                 oCn.BeginTran();
-                Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH");
+                //Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH");
+                Ds = oCn.RunProcReturn("exec GetLSH '" + HSupID+"_"+ HMaterID+"_" + DateTime.Today+ "'", "GetLSH");
                 LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                 #endregion
 
@@ -246,8 +246,8 @@
        "1, 1, '1', '" + HSourceBillType + "', '1', '" +
        HKFDate + "', '" + HKFDQDate + "', " + HISKFPERIOD + ")";
                             LogService.Write("鐢熸垚鏉$爜锛� " + sql);
-                            oCn.RunProc(sql);
-                            oCn.RunProc("exec setLSH '" + DateTime.Today + "'");
+                            oCn.RunProc(sql); 
+                            oCn.RunProc("exec setLSH '" + HSupID + "_" + HMaterID + "_" + DateTime.Today + "'");
                             virtualCount++;
                            }
 

--
Gitblit v1.9.1