From 437b54dcc6ca1fb57389fe7e3d46e47746766b25 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期三, 25 九月 2024 13:52:29 +0800
Subject: [PATCH] 销售订单:分页

---
 WebAPI/Controllers/BaseSet/Gy_MaterialController.cs |  181 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 176 insertions(+), 5 deletions(-)

diff --git a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
index d899f19..c4222fd 100644
--- a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
@@ -22,7 +22,7 @@
         //鑾峰彇绯荤粺鍙傛暟
         Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
         public DBUtility.ClsPub.Enum_BillStatus BillStatus;
-
+        public string sWhere = "";
         private json objJsonResult = new json();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         DataSet ds;
@@ -79,7 +79,7 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                string sql1 = string.Format(@"select * from h_v_Gy_MaterialList where 缁勭粐鍚嶇О='" + Organization + "'");
+                string sql1 = string.Format(@"select top(500) * from h_v_Gy_MaterialList where 缁勭粐鍚嶇О='" + Organization + "'");
                 if (sWhere == null || sWhere.Equals(""))
                 {
                     ds = oCN.RunProcReturn(sql1 + sWhere + " order by 鐗╂枡浠g爜 desc", "h_v_Gy_MaterialList");
@@ -114,6 +114,58 @@
                 return objJsonResult;
             }
         }
+
+        #region 鐗╂枡鍒嗛〉鍒楄〃
+        [Route("Gy_Material/page")]
+        [HttpGet]
+        public object page(string sWhere, string user, string Organization,int page,int size)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //缂栬緫鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_Material", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("exec h_p_Gy_MaterialList " + page + "," + size + ",'" + Organization +"'," + "''", "h_p_Gy_MaterialList");
+                }
+                else
+                {
+                    ds = oCN.RunProcReturn("exec h_p_Gy_MaterialList " + page + "," + size + ",'" + Organization + "','" + sWhere + "'", "h_p_Gy_MaterialList");
+                }
+
+                //娣诲姞鍒楀悕
+                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 = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.list = columnNameList;
+                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;
+            }
+        }
+        #endregion
 
         #region 鐗╂枡鏍规嵁鍒嗙被鑾峰彇鏈�澶х墿鏂欑紪鐮�
         [Route("Gy_Material/getMaxNum")]
@@ -234,6 +286,112 @@
         }
         #endregion
 
+        #region 鑾峰彇椤圭洰鍙�
+        [Route("Gy_Material/Get_HProject")]
+        [HttpGet]
+        public object Get_HProject()
+        {
+            try
+            {
+                DataSet oDs = new DataSet();
+                //==========
+                oDs = oCN.RunProcReturn("select top(20) HInterID as HItemID,HProName HName from PM_ProjectBillMain", "PM_ProjectBillMain");
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鑾峰彇鎴愬姛锛�";
+                objJsonResult.data = oDs.Tables[0];
+                return objJsonResult; ;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        /// <summary>
+        /// 鑾峰彇椤圭洰鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        [Route("Gy_Material/GetProjectGroupList_Json")]
+        [HttpGet]
+        public object GetProjectGroupList_Json(string Unit)
+            { 
+                if (Unit != "" && Unit != null)
+                {
+                    sWhere = sWhere + " and ( HBillNo like '%" + Unit + "%' or HProName like '%" + Unit + "%' ) ";
+                }
+
+                try
+                {
+                    SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                    if (sWhere == null || sWhere.Equals(""))
+                    {
+                        ds = oCN.RunProcReturn("Select HInterID,HBillNo 椤圭洰浠g爜,HProName 椤圭洰缁� from PM_ProjectBillMain where HCloseType = 0 Order by HInterID ", "PM_ProjectBillMain");
+                    }
+                    else
+                    {
+                        string sql1 = "Select HInterID,HBillNo 椤圭洰浠g爜,HProName 椤圭洰缁� from PM_ProjectBillMain where HCloseType = 0 ";
+                        string sql = sql1 + sWhere;
+                        ds = oCN.RunProcReturn(sql, "PM_ProjectBillMain");
+                    }
+
+                if (ds == null || ds.Tables[0].Rows.Count <= 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鑾峰彇鎴愬姛!";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鑾峰彇澶辫触" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #region 鑾峰彇浜嬩笟閮�
+        [Route("Gy_Material/Get_Gy_Division")]
+        [HttpGet]
+        public object Get_Gy_Division(string HOrgID)
+        {
+            try
+            {
+                DataSet oDs = new DataSet();
+                //==========
+                oDs = oCN.RunProcReturn("	select HItemID,HName from Gy_Division", "Gy_Division");
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鑾峰彇鎴愬姛锛�";
+                objJsonResult.data = oDs.Tables[0];
+                return objJsonResult; ;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
 
 
         /// <summary>
@@ -964,6 +1122,7 @@
         {
             try
             {
+                List<object> columnNameList = new List<object>();
                 //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
                 if (!DBUtility.ClsPub.Security_Log("Gy_BarCodeBill_Query", 1, false, user))
                 {
@@ -978,10 +1137,19 @@
                 string sql = sql1 + sWhere + " order by hmainid desc";
                 ds = oCN.RunProcReturn(sql, "h_v_IF_BarCodeBillList");
 
+                //娣诲姞鍒楀悕
+                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;
             }
             catch (Exception e)
@@ -1394,6 +1562,7 @@
                 long HSPID = mainList[0].HSPID;
                 Double HDesignLife = mainList[0].HDesignLife;
                 Double HUseLife = mainList[0].HUseLife;
+                Double HInitLife = mainList[0].HInitLife;//涓婄嚎鍒濆鍖栧鍛�
                 Double HLeaveLife = mainList[0].HLeaveLife;
                 Double HProdQty = mainList[0].HProdQty;
                 Double HProdWeight = mainList[0].HProdWeight;
@@ -1425,7 +1594,7 @@
                 ",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) " +
+                ",HMouldClass,HNowWHID,HNowSPID,HInitLife) " +
                 " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                 "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()" +
                 ",'" + HMouldNo + "','" + HName + "','" + HModel + "','" + HModel2 + "','" + HDiameter + "'" +
@@ -1435,7 +1604,7 @@
                 "," + 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 + ") ");
+                ",'"+ HMouldClass + "'," + HNowWHID + "," + HNowSPID + ",'" + HInitLife + "') ");
 
                 //瀛愯〃
                 oCN.RunProc("Insert into Gy_MouldFileSub " +
@@ -1542,6 +1711,7 @@
                 long HSPID = mainList[0].HSPID;
                 Double HDesignLife = mainList[0].HDesignLife;
                 Double HUseLife = mainList[0].HUseLife;
+                Double HInitLife = mainList[0].HInitLife;
                 Double HLeaveLife = mainList[0].HLeaveLife;
                 Double HProdQty = mainList[0].HProdQty;
                 Double HProdWeight = mainList[0].HProdWeight;
@@ -1617,7 +1787,8 @@
                 ",HMadeSupID=" + HMadeSupID +
                 ",HNowWHID=" + HNowWHID +
                 ",HNowSPID=" + HNowSPID +
-                " where HInterID=" + HInterID.ToString());
+                ",HInitLife='" + HInitLife +
+                "' where HInterID=" + HInterID.ToString());
 
                 //淇敼瀛愰」鐩唬鐮�
                 //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_Department,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);

--
Gitblit v1.9.1