From 7a49829b614767de98100810d0c787e7130c1624 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期二, 25 六月 2024 20:24:51 +0800
Subject: [PATCH] 生产质量月汇报单

---
 WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs |  103 +++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 87 insertions(+), 16 deletions(-)

diff --git a/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs b/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
index 6346119..c083f5e 100644
--- a/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
+++ b/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
@@ -49,22 +49,12 @@
                     ds = oCN.RunProcReturn(sql, "h_v_Gy_EquipFileMainList");
                 }
 
-                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
-                //{
+              
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
                 objJsonResult.data = ds.Tables[0];
                 return objJsonResult;
-                //}
-                //else
-                //{
-                //objJsonResult.code = "0";
-                //objJsonResult.count = 0;
-                //objJsonResult.Message = "鏃犳暟鎹�";
-                //objJsonResult.data = null;
-                //return objJsonResult;
-                //}
             }
             catch (Exception e)
             {
@@ -104,8 +94,18 @@
                 return objJsonResult;
             }
             DLL.ClsGy_EquipFileMain oBill = new DLL.ClsGy_EquipFileMain();
-            if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
+            ds = oCN.RunProcReturn("select * from Gy_EquipFileBillMain where HInterID=" + HItemID, "Gy_EquipFileBillMain");
+            if (ds.Tables[0].Rows.Count > 0)
             {
+                if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵�侊紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 oCN.RunProc("Delete From Gy_EquipFileBillMain  where HInterID=" + lngBillKey);
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -211,6 +211,9 @@
                 string HLogo = list[0].HLogo;                //鈭�		varchar(50)	//鍝佺墝
                 int HSellSupID = list[0].HSellSupID;              // 鈭�	int		//渚涘簲鍟�(Gy_Supplier)
                 int HMakeSupID = list[0].HMakeSupID;              // int		//鍒堕�犲晢 (Gy_Supplier) 
+                string HMainSourceFlag = list[0].HMainSourceFlag;             //varchar(10) //鏄惁涓荤敓浜ц澶�(鍚︼紝鏄�)
+                string HMacAddress = list[0].HMacAddress;   // varchar(50) //鏁伴噰鐗╃悊鍦板潃
+                int HMainSourceID = list[0].HMainSourceID;  //int //鎵�灞炰富鐢熶骇璁惧锛圙y_EquipFileBillMain锛�
                 string HMaker = msg4;
                 string HMakeDate = DateTime.Now.Date.ToString();
                 int HEquipDotCheckRuleInterID = list[0].HEquipDotCheckRuleInterID;
@@ -231,11 +234,11 @@
                 oCN.RunProc("Insert into Gy_EquipFileBillMain " +
                    " (hbillno,HEquipFileNumber,HEquipFileNo,HName,HModel,HModel2,HMaterID,HUnitID,HOutComDate" +
                    ",HOutComNo,HDeptID,HUseEmpID,HRepairEmpID,HAddress,HSetupDate,HStartupDate,HStatus," +
-"HEquipFileTypeID,HProNum,HBarCode,HWorkArea,HLogo,HSellSupID,HMakeSupID,hbilltype,HDate,HYear,HMaker,HMakeDate,HEquipMaintainRuleInterID,HEquipDotCheckRuleInterID,HSourceID) " +
+"HEquipFileTypeID,HProNum,HBarCode,HWorkArea,HLogo,HSellSupID,HMakeSupID,hbilltype,HDate,HYear,HMaker,HMakeDate,HEquipMaintainRuleInterID,HEquipDotCheckRuleInterID,HSourceID,HMainSourceFlag,HMacAddress,HMainSourceID) " +
                    " Values('" + hbillno + "','" + HEquipFileNumber + "','" + HEquipFileNo + "','" + HName + "','" + HModel + "','" + HModel2 + "'," + HMaterID + "," + HUnitID +
                    ",'" + HOutComDate + "','" + HOutComNo + "'," + HDeptID + "," + HUseEmpID + "," + HRepairEmpID + ",'" + HAddress +
                    "','" + HSetupDate + "','" + HStartupDate + "','" + HStatus + "'," + HEquipFileTypeID + ",'" + HProNum +
-                   "','" + HBarCode + "','" + HWorkArea + "','" + HLogo + "'," + HSellSupID + "," + HMakeSupID + ",'3308','" + HDate + "','" + HYear + "','" + HMaker + "','" + HMakeDate + "','" + HEquipMaintainRuleInterID + "','" + HEquipDotCheckRuleInterID +"'," + HSourceID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
+                   "','" + HBarCode + "','" + HWorkArea + "','" + HLogo + "'," + HSellSupID + "," + HMakeSupID + ",'3308','" + HDate + "','" + HYear + "','" + HMaker + "','" + HMakeDate + "','" + HEquipMaintainRuleInterID + "','" + HEquipDotCheckRuleInterID +"'," + HSourceID + ",'" + HMainSourceFlag + "','" + HMacAddress + "','" + HMainSourceID + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                 //淇敼涓婄骇涓洪潪鏈骇浠g爜
                 oCN.Commit();
                 objJsonResult.code = "1";
@@ -309,6 +312,9 @@
                 string HLogo = list[0].HLogo;                //鈭�		varchar(50)	//鍝佺墝
                 int HSellSupID = list[0].HSellSupID;              // 鈭�	int		//渚涘簲鍟�(Gy_Supplier)
                 int HMakeSupID = list[0].HMakeSupID;              // int		//鍒堕�犲晢 (Gy_Supplier)
+                string HMainSourceFlag = list[0].HMainSourceFlag;             //varchar(10) //鏄惁涓荤敓浜ц澶�(鍚︼紝鏄�)
+                string HMacAddress = list[0].HMacAddress;   // varchar(50) //鏁伴噰鐗╃悊鍦板潃
+                int HMainSourceID = list[0].HMainSourceID;  //int //鎵�灞炰富鐢熶骇璁惧锛圙y_EquipFileBillMain锛�
                 string HUpDater = msg4;
                 string HUpDateDate = DateTime.Now.Date.ToString();
                 int HEquipDotCheckRuleInterID = list[0].HEquipDotCheckRuleInterID;
@@ -364,11 +370,14 @@
                     ",HLogo='" + HLogo + "'" +
                     ",HSellSupID=" + HSellSupID +
                     ",HMakeSupID= " + HMakeSupID +
-                    ",HUpDater= '" + HUpDater + "'" +
+                    ",HUpDater= '" + HUpDater + "'" +                    
                     ",HUpDateDate= '" + HUpDateDate + "'" +
                     ",HEquipDotCheckRuleInterID='" + HEquipDotCheckRuleInterID + "'" +
                     ",HEquipMaintainRuleInterID='" + HEquipMaintainRuleInterID + "'" +
                     ",HSourceID='" + HSourceID + "'" +
+                    ",HMainSourceFlag= '" + HMainSourceFlag + "'" +
+                    ",HMacAddress= '" + HMacAddress + "'" +
+                    ",HMainSourceID = '" + HMainSourceID + "'" +
                     " Where HInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                 //淇敼瀛愰」鐩唬鐮�
                 //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
@@ -926,6 +935,68 @@
 
         }
         #endregion
-       
+
+        #region 璁惧PDA妯″潡 鎵爜       
+        [Route("Gy_EquipFileBill/txtHBarCode_KeyDown")]
+        [HttpGet]
+        public object txtHBarCode_KeyDown(string HBarCode, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                if (HBarCode == null || HBarCode.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏉$爜淇℃伅涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    string sql = "select * from h_v_Gy_EquipFileBill_KeyDown_PDA where 鏉″舰鐮� = '" + HBarCode + "'";
+                    ds = oCN.RunProcReturn(sql, "锘縣_v_Gy_EquipFileBill_KeyDown_PDA");
+                }
+
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    //娣诲姞鍒楀悕
+                    foreach (DataColumn col in ds.Tables[0].Columns)
+                    {
+                        Type dataType = col.DataType;
+                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                    }
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    objJsonResult.list = columnNameList;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "璁惧鏉$爜锛�" + HBarCode + " ,娌℃湁鍒涘缓姝よ澶囨。妗�";
+                    objJsonResult.data = ds.Tables[0];
+                    objJsonResult.list = columnNameList;
+                    return objJsonResult;
+                }
+               
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 }

--
Gitblit v1.9.1