From b0688c1efd606284fd5bc31f2d60a1fec9aef968 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期二, 08 四月 2025 11:20:50 +0800
Subject: [PATCH] 自定义菜单优化

---
 WebAPI/Controllers/生产管理/质量汇报单/Sc_QualityReportBillController.cs |  120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 112 insertions(+), 8 deletions(-)

diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\350\264\250\351\207\217\346\261\207\346\212\245\345\215\225/Sc_QualityReportBillController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\350\264\250\351\207\217\346\261\207\346\212\245\345\215\225/Sc_QualityReportBillController.cs"
index 57cb3ed..466e0c2 100644
--- "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\350\264\250\351\207\217\346\261\207\346\212\245\345\215\225/Sc_QualityReportBillController.cs"
+++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\350\264\250\351\207\217\346\261\207\346\212\245\345\215\225/Sc_QualityReportBillController.cs"
@@ -1,6 +1,7 @@
 锘縰sing Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Pub_Class;
+using SyntacticSugar.constant;
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -92,23 +93,25 @@
                         ds = oCN.RunProcReturn
                      ("select a.HInterID,a.HBillType,a.HICMOBillNo,a.HICMOInterID,a.HMaterID" +
                      ",m.HNumber HMaterNumber,m.HName HMaterName,m.HModel HMaterModel,a.HICMOEntryID,a.HSourceID,s.HName HSourceName" +
-                     ",a.HSourceBillNo,a.HSourceInterID,a.HSourceEntryID,a.HDatePlanQty,a.HDeptID,d.HName HDeptName,m.HUnitID,u.HName HUnitName" +
+                     ",a.HSourceBillNo,a.HSourceInterID,a.HSourceEntryID,a.HDatePlanQty,a.HDeptID,d.HName HDeptName,m.HUnitID,u.HName HUnitName,a.HProcID,p.HName HProcName" +
                      " from Sc_ICMOBillStatus_Tmp a " +
                      " left join Gy_Material m on a.HMaterID=m.HItemID " +
                      " left join Gy_Department d on a.HDeptID=d.HItemID " +
                      " left join Gy_Unit u on m.HUnitID=u.HItemID " +
                      " left join Gy_Source s on a.HSourceID=s.HItemID " +
+                     " left join Gy_Process p on a.HProcID = p.HItemID " +                    
                      " Where a.HInterID=" + HInterID + " and a.HBillType=" + HBillType, "Sc_ICMOBillStatus_Tmp");
                     }
                     else {
                         ds = oCN.RunProcReturn
                          ("select a.HInterID,a.HBillType,a.HICMOBillNo,a.HICMOInterID,a.HMaterID,a.HSourceID,s.HName HSourceName" +
-                         ",m.HNumber HMaterNumber,m.HName HMaterName,m.HModel HMaterModel,a.HICMOEntryID,a.HDeptID,d.HName HDeptName,m.HUnitID,u.HName HUnitName " +
+                         ",m.HNumber HMaterNumber,m.HName HMaterName,m.HModel HMaterModel,a.HICMOEntryID,a.HDeptID,d.HName HDeptName,m.HUnitID,u.HName HUnitName,a.HProcID,p.HName HProcName " +
                          " from Sc_ICMOBillStatus_Tmp a " +
                          " left join Gy_Material m on a.HMaterID=m.HItemID " +
                          " left join Gy_Department d on a.HDeptID=d.HItemID " +
                          " left join Gy_Unit u on m.HUnitID=u.HItemID " +
                          " left join Gy_Source s on a.HSourceID=s.HItemID " +
+                         " left join Gy_Process p on a.HProcID = p.HItemID " +
                          " Where a.HInterID=" + HInterID + " and a.HBillType=" + HBillType, "Sc_ICMOBillStatus_Tmp");
                     }
                  
@@ -638,7 +641,7 @@
         #region 鎻愪氦淇濆瓨锛屽瓨涓诲瓙琛ㄥ強鏄庣粏琛�
         [Route("Sc_QualityReportBill/set_SaveBill")]
         [HttpGet]
-        public object set_SaveBill(long HInterID,string HBillNo, string HChecker)
+        public object set_SaveBill(long HInterID,string HBillNo, string HChecker,string HBillSubType)
         {
             try
             {
@@ -670,11 +673,11 @@
                 ds = oCN.RunProcReturn(sql, "Sc_QualityReportBillSub");
                 if (ds.Tables[0].Rows.Count>0)
                 {
-                    oCN.RunProc("exec h_p_save_Sc_QualityReportBillSum " + HInterID + "");
+                    oCN.RunProc("exec h_p_save_Sc_QualityReportBillSum '" + HInterID + "','" + HBillSubType +"'");
                 }
                 else
                 {
-                    oCN.RunProc("exec h_p_save_Sc_QualityReportBill " + HInterID + "");
+                    oCN.RunProc("exec h_p_save_Sc_QualityReportBill '" + HInterID + "','" + HBillSubType + "'");
                 }
                 
                 //鍒ゆ柇鏄惁鍏佽淇濆瓨锛屼笉鍏佽鍒欏洖婊�
@@ -797,7 +800,7 @@
                     string subSql = "Insert into Sc_QualityReportBillSub " +
                  " (HInterID,HEntryID,HBillNo_bak,HRemark" +
                  ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                 ",HMaterID,HUnitID,HQty,HResult,HEmpID,HSourceID,HProcID,HBadReasonID,HBadReasonNumber,HGroupID" +
+                 ",HMaterID,HUnitID,HQty,HResult,HEmpID,HSourceID,HProcID,HBadReasonID,HBadReasonNumber,HBadPhenomenaID,HGroupID" +
                  ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcExchInterID,HProcExchEntryID,HProcExchBillNo" +
                  ",HBarCode,HReportType" +
                  ",HAddr,HMaker,HMakeDate" +
@@ -822,6 +825,7 @@
                  "," + oSub.HProcID.ToString() + "" +
                  "," + oSub.HBadReasonID.ToString() + "" +
                  ",'" + oSub.HBadReasonNumber.ToString() + "'" +
+                "," + oSub.HBadPhenomenaID.ToString() + "" +
                  ",'" + oSub.HGroupID.ToString() + "'" +
 
                  "," + oSub.HICMOInterID.ToString() + "" +
@@ -915,6 +919,61 @@
                 objJsonResult.Message = "Exception锛�" + e.ToString();
                 objJsonResult.data = null;
                 return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鐢熶骇璐ㄩ噺姹囨姤鍗曞垪琛� 鍒嗛〉鍒楄〃
+        [Route("Sc_QualityReportBill/getSc_QualityReportBillPage")]
+        [HttpGet]
+        public json getSc_QualityReportBillPage(string sWhere, string user, int page, int size)
+        {
+            DataSet ds;
+            json res = new json();
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Sc_QualityReportBill_Query", 3, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愭煡璇紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                sWhere = sWhere.Replace("'", "''");
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("exec h_p_Sc_QualityReportBillMainList " + page + "," + size + ",''", "h_p_Sc_QualityReportBillMainList");
+                }
+                else
+                {
+                    ds = oCN.RunProcReturn("exec h_p_Sc_QualityReportBillMainList " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_QualityReportBillMainList");
+                }
+
+                //娣诲姞鍒楀悕
+                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鍒楀璞$殑鍒楀悕
+                }
+
+                res.code = CodeConstant.SUCCEED;
+                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
+                res.Message = "Sucess锛�";
+                res.list = columnNameList;
+                res.data = ds.Tables[0];
+                return res;
+            }
+            catch (Exception e)
+            {
+                res.code = CodeConstant.FAIL;
+                res.count = CountConstant.FAIL;
+                res.Message = "Exception锛�" + e.ToString();
+                res.data = null;
+                return res;
             }
         }
         #endregion
@@ -1537,8 +1596,30 @@
                 //杩涜闇�瑕佽繘琛岀殑鍏抽棴/鍙嶅叧闂搷浣�
                 if (IsAudit == 0) //鍏抽棴鎻愪氦
                 {
+                    //鍏抽棴鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_Sc_QualityReportBill_BeforeCloseCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Sc_QualityReportBill_BeforeCloseCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:鍏抽棴鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //==================================================================================      
+
                     //鍏抽棴鎻愪氦
-                    if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    if (oBill.CloseBill(lngBillKey, oBill.omodel.HBillNo, "h_p_Sc_QualityReportBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                     {
                         objJsonResult.code = "1";
                         objJsonResult.count = 1;
@@ -1557,8 +1638,31 @@
                 }
                 if (IsAudit == 1) //鍙嶅叧闂彁浜�
                 {
+                    //鍙嶅叧闂墠鎺у埗=========================================      
+                    string sql1 = "exec h_p_Sc_QualityReportBill_BeforeUnCloseCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Sc_QualityReportBill_BeforeUnCloseCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:鍙嶅叧闂墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //==================================================================================      
+
+
                     //鍙嶅叧闂彁浜�
-                    if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    if (oBill.CancelClose(lngBillKey, oBill.omodel.HBillNo, "h_p_Sc_QualityReportBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                     {
                         objJsonResult.code = "1";
                         objJsonResult.count = 1;

--
Gitblit v1.9.1