From a1c3a3d1b0b0b8c28a19e99177e4cee5a64949b7 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期二, 25 二月 2025 11:20:17 +0800
Subject: [PATCH] 增加斯莫尔  性能检测散点图报表

---
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs |  254 ++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 243 insertions(+), 11 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index 4c5b8b3..ceb4d6b 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -451,6 +451,7 @@
                     ",HSourceID5=" + HSourceID5 +
                     ",HPayProcID=" + HPayProcID +
                     ",HGroupID=" + HGroupID +
+                    ",HShiftsID=" + HShiftsID +
                     ",HWorkTimes=" + HWorkTimes +
                     ",HSaveBillFlag=0 " +
                     ",HBadCount=" + HBadCount +
@@ -468,10 +469,9 @@
                     ",HWasterQty_Work=" + HWasterQty_Work +
                     ",HWasterQty_Mater=" + HWasterQty_Mater +
                     ",HBackWorkQty=" + HBackWorkQty +
-                    ",HShiftsID=" + HShiftsID +
                     ",HBackWorkByMaterQty=" + HBackWorkByMaterQty +
                     ",HMouldID=" + HMouldID +
-                    ",HMachineWorkTimes=" + HMachineWorkTimes +
+                    ",HMachineWorkTimes=" + HMachineWorkTimes +  
                     " where HInterID=" + HInterID);
 
                     LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼宸ュ簭鍑虹珯鍗曟嵁:" + HBillNo);
@@ -628,6 +628,27 @@
                 sw.Stop();//缁撴潫璁℃椂
                 LogService.Write($"11.鍙傛暟鏌ヨ缁撴潫,鏂板缁撴潫锛岀敤鏃�" + sw.Elapsed);
                 LogService.Write("END--鍑虹珯鍗曟嵁淇濆瓨缁撴潫锛屽嚭绔欏崟鍙凤細" + HBillNo);
+
+                //娴嬭瘯璇彞===========================================================================================================
+                string msg_str = "";
+                string sql_str = "select a.HQty HQty_Main,b.HQty HQty_Sub " +
+                            "from Sc_ProcessExchangeBillMain as a " +
+                            "inner join Sc_ProcessExchangeBillSub as b on a.HInterID = b.HInterID " +
+                            "where a.HInterID = " + HProcExchInterID;
+                DataSet ds_str = oCN.RunProcReturn(sql_str, "Sc_ProcessExchangeBillMain");
+                if (ds_str.Tables[0].Rows.Count > 0)
+                {
+                    msg_str = "HQty_Main:" + ds_str.Tables[0].Rows[0]["HQty_Main"].ToString() + ";HQty_Sub:";
+                    for (int j = 0; j < ds_str.Tables[0].Rows.Count; j++)
+                    {
+                        msg_str += ds_str.Tables[0].Rows[j]["HQty_Sub"].ToString() + ",";
+                    }
+                }
+
+                oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼宸ュ簭鍑虹珯鍗曟嵁锛�" + HBillNo + "[宸ュ簭娴佽浆鍗″彿锛�" + HProcExchBillNo + "]" + msg_str + "','LMES-宸ュ簭鍑虹珯妯″潡','" + DBUtility.ClsPub.IPAddress + "','鏂板鎴栦慨鏀瑰崟鎹�'", ref DBUtility.ClsPub.sExeReturnInfo);
+                //==============================================================================================================
+
+
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
@@ -1850,7 +1871,10 @@
                     case "Emp":
                         sql = "select * from h_v_Sc_StationOutBillSubQuery_Emp where 1 = 1 and HInterID=" + sWhere;
                         break;
-                  
+                    case "Sup":
+                        sql = "select * from h_v_Sc_StationOutBillSubQuery_Sup where 1 = 1 and HInterID=" + sWhere;
+                        break;
+
                 }
 
                 ds = oCN.RunProcReturn(sql, TableName);
@@ -1929,7 +1953,7 @@
             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/" + HBillNo);
+            string path = HttpContext.Current.Server.MapPath("~/../Files/Cj_StationOutBill/" + HBillNo);
             //string path = @"D:\\Files\\"+ HBillNo;
             dynamic dyResult = UpLoadFile(files, path, HBillNo, HRemark, HUserName);
             if (dyResult != null && dyResult.result == 1)
@@ -1985,7 +2009,7 @@
                 {
                     File.Delete(fileurl);      //鍒犻櫎鎸囧畾鏂囦欢
                     files.SaveAs(fileurl);
-                    string StrPath = "/files/"+ HBillNo+"/"+ filename;
+                    string StrPath = "/files/Cj_StationOutBill/" + HBillNo+"/"+ filename;
                     if (File.Exists(fileurl)) 
                     {
                         //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱
@@ -2008,7 +2032,7 @@
                 {
                     Directory.CreateDirectory(fileSavePath); //娣诲姞鏂囦欢澶�
                     files.SaveAs(fileurl);
-                    string StrPath = "/files/" + HBillNo + "/" + filename;
+                    string StrPath = "/files/Cj_StationOutBill/" + HBillNo + "/" + filename;
                     if (File.Exists(fileurl))
                     {
                         //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱
@@ -2049,7 +2073,7 @@
             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/" + HBillNo);
+            string path = HttpContext.Current.Server.MapPath("~/../Files/Cj_StationOutBill/" + HBillNo);
             //string path = @"D:\\Files\\"+ HBillNo;
             dynamic dyResult = UpLoadFile1(files, path, HBillNo, HRemark, HUserName);
             if (dyResult != null && dyResult.result == 1)
@@ -2105,7 +2129,7 @@
                 {
                     File.Delete(fileurl);      //鍒犻櫎鎸囧畾鏂囦欢
                     files.SaveAs(fileurl);
-                    string StrPath = "/files/" + HBillNo + "/" + filename;
+                    string StrPath = "/files/Cj_StationOutBill/" + HBillNo + "/" + filename;
                     if (File.Exists(fileurl))
                     {
                         //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱
@@ -2128,7 +2152,7 @@
                 {
                     Directory.CreateDirectory(fileSavePath); //娣诲姞鏂囦欢澶�
                     files.SaveAs(fileurl);
-                    string StrPath = "/files/" + HBillNo + "/" + filename;
+                    string StrPath = "/files/Cj_StationOutBill/" + HBillNo + "/" + filename;
                     if (File.Exists(fileurl))
                     {
                         //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱
@@ -2178,7 +2202,7 @@
         [HttpGet]
         public object Filelist(string HBillNo)
         {
-            var url = fileip + "/files/" + HBillNo+"/";
+            var url = fileip + "/files/Cj_StationOutBill/" + HBillNo+"/";
             //@"C:\\files\\"
             try
             {
@@ -2213,7 +2237,7 @@
             {
 
                 oCN.RunProc("delete from MES_AccessoriesList where HItemID =" + HItemID);
-                string fileurl = Path.Combine(HttpContext.Current.Server.MapPath("~/../Files/" + HSourceBillNo), HFileName);
+                string fileurl = Path.Combine(HttpContext.Current.Server.MapPath("~/../Files/Cj_StationOutBill/" + HSourceBillNo), HFileName);
                 File.Delete(fileurl);      //鍒犻櫎鎸囧畾鏂囦欢
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -3955,5 +3979,213 @@
             }
         }
         #endregion
+
+        #region 缂栬緫椤甸潰鏍规嵁id鑾峰彇宸ュ簭鍑虹珯姹囨姤鍗曚俊鎭�
+        [Route("Cj_StationOutBill/SetBillTime")]
+        [HttpGet]
+        public object SetBillTime(int HInterID,DateTime dateTime,string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夌紪杈戞潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Edit", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍑虹珯鍗曟棤缂栬緫鏉冮檺!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                string sql = "select * from Sc_StationOutBillMain  with(nolock) where HInterID=" + HInterID;
+                ds = oCN.RunProcReturn(sql, "Sc_StationOutBillMain");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇敼澶辫触娌℃壘鍒扮浉鍏冲嚭绔欐眹鎶ュ崟";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //淇敼鍓嶆椂闂翠慨鏀瑰悗鏃堕棿鍒ゆ柇鏈夋棤宸ヨ祫璁$畻
+                string HGroupID = ds.Tables[0].Rows[0]["HGroupID"].ToString();
+                string HOldDate = ds.Tables[0].Rows[0]["HDate"].ToString();
+                string sql1 = "select * from Pay_SingleBalBillMain where HGroupID =" +HGroupID + " and HDate ='" + HOldDate + "'";
+                string sql2 = "select * from Pay_GroupBalBillMain where HGroupID =" + HGroupID + " and HDate ='" + HOldDate + "'";
+                string sql3 = "select * from Pay_SingleBalBillMain where HGroupID =" + HGroupID + " and HDate ='" + dateTime + "'";
+                string sql4 = "select * from Pay_GroupBalBillMain where HGroupID =" + HGroupID + " and HDate ='" + dateTime + "'";
+                ds = oCN.RunProcReturn(sql1, "Sc_StationOutBillMain");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇敼澶辫触璇ユ椂闂寸彮缁勫凡璁$畻宸ヨ祫:" + HOldDate;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                ds = oCN.RunProcReturn(sql2, "Sc_StationOutBillMain");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇敼澶辫触璇ユ椂闂寸彮缁勫凡璁$畻宸ヨ祫:" + HOldDate;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                ds = oCN.RunProcReturn(sql3, "Sc_StationOutBillMain");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇敼澶辫触璇ユ椂闂寸彮缁勫凡璁$畻宸ヨ祫:" + dateTime;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                ds = oCN.RunProcReturn(sql4, "Sc_StationOutBillMain");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇敼澶辫触璇ユ椂闂寸彮缁勫凡璁$畻宸ヨ祫:" + dateTime;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //淇敼鏃堕棿
+                sql = "update Sc_StationOutBillMain set HDate = '" + dateTime + "' where HInterID = " + HInterID;
+                oCN.RunProcReturn(sql, "Sc_StationOutBillMain");
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                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
+
+        #region 鍑虹珯鍗曞垪琛�-涓嬫帹PPM鏁版嵁褰曞叆淇濆瓨,鍒犻櫎
+
+        [Route("Cj_StationOutBill/PPMSupAddBill")]
+        [HttpPost]
+        public object PPMSupAddBill([FromBody] JObject sSubStr)
+        {
+            var _value = sSubStr["sSubStr"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            try
+            {
+                //鍙嶅簭鍒楀寲
+                string msg2 = sArray[0].ToString(); //琛ㄤ綋
+                string refSav = sArray[1].ToString();//鎿嶄綔绫诲瀷
+                string user = sArray[2].ToString(); //鐢ㄦ埛
+                msg2 = msg2.Substring(1, msg2.Length - 2);
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");
+                msg2 = "[" + msg2 + "]";
+                //鍒ゆ柇鏄惁鏈夌紪杈戞潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Edit", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犵紪杈戞潈闄�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                List<Sc_StationOutBillSub_Sup> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Sc_StationOutBillSub_Sup>>(msg2);
+
+                oCN.BeginTran();
+                for (int i = 0; i < list.Count; i++)
+                {              
+                    int HInterID = list[i].HInterID;
+                    int HEntryID = i+1;
+                    int HSupID = list[i].HSupID;
+                    double HWasterQty_Mater = list[i].HWasterQty_Mater;
+                    double HBackWorkQty = list[i].HBackWorkQty;
+
+                    oCN.RunProc("Insert Into Sc_StationOutBillSub_Sup " +
+                     "(HInterID, HEntryID, HSupID, HWasterQty_Mater, HBackWorkQty) " +
+                     "values ('" + HInterID + "', '" + HEntryID + "', '" + HSupID + "', '" + HWasterQty_Mater + "', '" + HBackWorkQty + "')");
+
+                }
+
+                oCN.Commit();            
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        [Route("Cj_StationOutBill/PPMSupDelete")]
+        [HttpGet]
+        public object PPMSupDelete(int HInterID,string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Drop", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ds = oCN.RunProcReturn("select * from Sc_StationOutBillSub_Sup WITH(NOLOCK) where HInterID = " + HInterID, "Sc_StationOutBillSub_Sup");
+
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏌ユ棤鏁版嵁锛�";
+                    objJsonResult.data = null;
+                }
+
+                oCN.BeginTran();
+
+                string sql = "";
+               
+                sql = "delete from Sc_StationOutBillSub_Sup where HInterID = " + HInterID;
+                oCN.RunProc(sql);
+
+                oCN.Commit();
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1