From bbba888f3bca270b476ab2a3606f51089dac071c Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期二, 09 九月 2025 14:17:15 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/MaterialHandingController.cs |  581 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 581 insertions(+), 0 deletions(-)

diff --git a/WebAPI/Controllers/MaterialHandingController.cs b/WebAPI/Controllers/MaterialHandingController.cs
new file mode 100644
index 0000000..d287e02
--- /dev/null
+++ b/WebAPI/Controllers/MaterialHandingController.cs
@@ -0,0 +1,581 @@
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Text.RegularExpressions;
+using System.Web;
+using System.Web.Http;
+using WebAPI.Code;
+using WebAPI.Models;
+using WebAPI.Utility;
+namespace WebAPI.Controllers
+{
+    public class MaterialHandingController : ApiController
+    {
+        // GET: MaterialHanding
+        private JsonResult objJsonResult = new JsonResult();
+        private json objjson = new json();
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        DataSet ds;
+        //鑾峰彇绯荤粺鍙傛暟
+        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+        [Route("MaterialHandingController/GetMaterialHandingList")]
+        [HttpGet]
+        public object GetMaterialHandingList(string sWhere, string user)
+        {
+            List<object> columnNameList = new List<object>();
+            try
+            {
+                string VsWhere = sWhere;
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                DataSet ds;
+                //鍏朵粬杩囨护
+                //string sql = " where 1 = 1 " + sqlWhere;
+                ////杞崲鐗规畩瀛楃
+                //if (Common.SQLtoChange(sql, ref VsWhere, ref PcWhere) == false)
+                //{
+                //    objjson.code = "0";
+                //    objjson.count = 0;
+                //    objjson.Message = "杞崲鐗规畩瀛楃澶辫触";
+                //    objjson.data = null;
+                //    return objjson;
+                //}
+
+                //鑾峰彇杩斿洖鏁版嵁
+                ds = oCn.RunProcReturn("select * from h_v_Gy_UserMaterRelation where 1=1 " + sWhere, "h_v_Gy_UserMaterRelation");
+                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鍒楀璞$殑鍒楀悕
+                }
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objjson.code = "0";
+                    objjson.count = 0;
+                    objjson.Message = "鑾峰彇澶辫触,娌℃湁鐩稿叧鏁版嵁";
+                    objjson.data = null;
+                    return objjson;
+                }
+                else
+                {
+                    objjson.code = "0";
+                    objjson.count = 10000;
+                    objjson.Message = "鑾峰彇鎴愬姛";
+                    objjson.data = ds.Tables[0];
+                    objjson.list = columnNameList;
+                    return objjson;
+                }
+            }
+            catch (Exception e)
+            {
+                objjson.code = "0";
+                objjson.count = 0;
+                objjson.Message = "鑾峰彇澶辫触" + e.ToString();
+                objjson.data = null;
+                return objjson;
+            }
+        }
+
+        #region  鍚敤
+
+        [Route("MaterialHandingController/OpenMaterial")]
+        [HttpGet]
+        public object OpenMaterial(int HInterID, int IsUse, string CurUserName)
+        {
+            try
+            {
+
+                var ds = oCN.RunProcReturn("select * from Gy_UserMaterRelation where HItemID=" + HInterID, "Gy_UserMaterRelation");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    IsUse = Convert.ToInt32(ds.Tables[0].Rows[0]["HUseFlag"]) ;
+                    if (IsUse == 1)  //鍒ゆ柇
+                    {
+                        if (ds.Tables[0].Rows[0]["HUpDater"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插惎鐢�!涓嶈兘鍐嶆鍚敤锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();
+
+                if (IsUse == 0)  //鍚敤鍒ゆ柇
+                {
+
+                    //绂佺敤鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_Gy_MaterPrice_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPrice_BeforeStopCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "绂佺敤澶辫触!鍘熷洜:绂佺敤鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        oCN.RollBack();
+                        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;
+                        oCN.RollBack();
+                        return objJsonResult;
+                    }
+                    //================================================================================== 
+
+
+                    oCN.RunProc("update Gy_UserMaterRelation set HUpDater='" + CurUserName + "',HUpDateDate=getdate(),HUseFlag=1 where HItemID=" + HInterID);
+
+
+                    //绂佺敤鍚庢帶鍒�=========================================      
+                    string sql2 = "exec h_p_Gy_MaterPrice_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaterPrice_AfterStopCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "绂佺敤澶辫触!鍘熷洜:绂佺敤鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        oCN.RollBack();
+                        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;
+                        oCN.RollBack();
+                        return objJsonResult;
+                    }
+                    //================================================================================== 
+
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍚敤鎴愬姛";
+                    objJsonResult.data = null;
+                }
+                //if (IsStop == 1) //鍙嶇鐢ㄥ垽鏂�
+                //{
+                //    //鍙嶇鐢ㄥ墠鎺у埗=========================================      
+                //    string sql1 = "exec h_p_Gy_Gy_MaterPrice_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
+                //    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Gy_MaterPrice_BeforeUnStopCtrl");
+                //    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                //    {
+                //        objJsonResult.code = "0";
+                //        objJsonResult.count = 1;
+                //        objJsonResult.Message = "鍙嶇鐢ㄥけ璐�!鍘熷洜:鍙嶇鐢ㄥ墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                //        objJsonResult.data = null;
+                //        oCN.RollBack();
+                //        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;
+                //        oCN.RollBack();
+                //        return objJsonResult;
+                //    }
+                //    //================================================================================== 
+
+
+                //    oCN.RunProc("update Gy_MaterPrice set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
+
+
+                //    //鍙嶇鐢ㄥ悗鎺у埗=========================================      
+                //    string sql2 = "exec h_p_Gy_MaterPrice_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
+                //    ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaterPrice_AfterUnStopCtrl");
+                //    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                //    {
+                //        objJsonResult.code = "0";
+                //        objJsonResult.count = 1;
+                //        objJsonResult.Message = "鍙嶇鐢ㄥけ璐�!鍘熷洜:鍙嶇鐢ㄥ悗鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                //        objJsonResult.data = null;
+                //        oCN.RollBack();
+                //        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;
+                //        oCN.RollBack();
+                //        return objJsonResult;
+                //    }
+                //    //================================================================================== 
+
+                //    objJsonResult.code = "1";
+                //    objJsonResult.count = 1;
+                //    objJsonResult.Message = "鍙嶇鐢ㄦ垚鍔�";
+                //    objJsonResult.data = null;
+                //}
+                oCN.Commit();
+
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍚敤澶辫触鎴栬�呭弽绂佺敤澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鐗╂枡鏍¢獙
+        [Route("MaterialHandingController/CheckMaterial")]
+        [HttpGet]
+        public object CheckMaterial(string HMaterID, string user, int param,string OrganizationID)
+        {
+            try
+            {
+                //ds1鑾峰彇鐨剆ql鍚庢湡璁板緱鏀瑰洖渚涘簲鍟嗭紝淇敼浜�->渚涘簲鍟�
+                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+ "'", "Gy_Material");
+
+                if (param == 0)
+                {
+                    if (ds1.Tables[0].Rows.Count > 0)
+                    {
+                        return 1;
+                    }
+                    else
+                    {
+                        return GetMaterialResult(ds);
+                    }
+                }
+                else
+                {
+                    oCN.BeginTran();
+                    string sqlUpd = "UPDATE Gy_UserMaterRelation set HUseFlag=0 where HMaterID="+ ds.Tables[0].Rows[0]["HItemID"];
+                    oCN.RunProc(sqlUpd);
+                    oCN.Commit();
+
+                    return GetMaterialResult(ds);
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        private object GetMaterialResult(DataSet ds)
+        {
+            if (ds.Tables[0].Rows.Count > 0)
+            {
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Success锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            else
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鐗╂枡涓嶅瓨鍦紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region  缂栬緫鏌ョ湅淇℃伅
+        [Route("MaterialHandingController/Edit_M")]
+        [HttpGet]
+        public object Edit_M(string HItemID, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                string sql1 = string.Format(@"select * from h_v_Gy_UserMaterRelationEdit where HItemID = " + HItemID);
+
+                ds = oCN.RunProcReturn(sql1, "h_v_Gy_UserMaterRelationEdit");
+
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                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("MaterialHandingController/AddBill")]
+        [HttpPost]
+        public object AddBill([FromBody] JObject msg)
+        {
+            try
+            {
+                var _value = msg["msg"].ToString();
+                string msg3 = _value.ToString();
+                //string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+                //string msg1 = sArray[0].ToString();
+                //string msg2 = sArray[1].ToString();
+                string msg2 = msg3.ToString();
+
+                //鍙嶅簭鍒楀寲
+                msg2 = "[" + msg2.ToString() + "]";
+
+                List<Model.Cls_MaterialHandingModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.Cls_MaterialHandingModel>>(msg2);
+                var ds = oCN.RunProcReturn("select * from Gy_Material where HNumber='" + list[0].HMaterNumber + "'", "Gy_Material");
+
+                int HItemID =Convert.ToInt32(list[0].HItemID);
+                string HMaterNumber = list[0].HMaterNumber;
+                int HMaterID =Convert.ToInt32(ds.Tables[0].Rows[0]["HItemID"]);
+                int HSupID = list[0].HSupID;
+                string HUserID = list[0].HUserID;
+                decimal HMinPackQty = list[0].HMinPackQty;
+                decimal HInBoxPackQty = list[0].HInBoxPackQty;
+                decimal HOutBoxPackQty = list[0].HOutBoxPackQty;
+                int HUSEORGID = list[0].HUSEORGID;
+                bool HUseFlag = list[0].HUseFlag;
+                string HMaker = list[0].HMaker!=""? list[0].HMaker :"";
+                string HMakeTime = list[0].HMakeTime;
+                string HUpDater = list[0].HUpDater != "" ? list[0].HUpDater : "";
+                string HUpDateDate = list[0].HUpDateDate;
+                string HCheckEmp = list[0].HCheckEmp != "" ? list[0].HCheckEmp : "";
+                string HCheckTime = list[0].HCheckTime;
+
+                oCN.BeginTran();
+
+                #region  鍙傛暟鍖�
+                // 鏋勫缓鍙傛暟鍖� SQL 璇彞
+                string sql = @"INSERT INTO Gy_UserMaterRelation 
+                (HMaterID, HSupID, HMinPackQty, HInBoxPackQty, HOutBoxPackQty, HUSEORGID, HUseFlag,
+                HMaker, HMakeTime, HUpDater, HUpDateDate, HCheckEmp, HCheckTime)
+                VALUES(@HMaterID, @HSupID,  @HMinPackQty, @HInBoxPackQty, @HOutBoxPackQty, @HUSEORGID, @HUseFlag,
+                @HMaker, @HMakeTime, @HUpDater, @HUpDateDate, @HCheckEmp, @HCheckTime)";
+
+                // 浣跨敤 MakeInParam 鏂规硶鍒涘缓鍙傛暟
+                SqlParameter[] parameters = {
+                    oCN.MakeInParam("@HMaterID", SqlDbType.Int, 4, HMaterID),
+                    oCN.MakeInParam("@HSupID", SqlDbType.Int, 4, HSupID),
+                    //oCN.MakeInParam("@HUserID", SqlDbType.NVarChar, 50, HUserID),
+                    oCN.MakeInParam("@HMinPackQty", SqlDbType.Decimal, 8, HMinPackQty),
+                    oCN.MakeInParam("@HInBoxPackQty", SqlDbType.Decimal, 8, HInBoxPackQty),
+                    oCN.MakeInParam("@HOutBoxPackQty", SqlDbType.Decimal, 8, HOutBoxPackQty),
+                    oCN.MakeInParam("@HUSEORGID", SqlDbType.Int, 4, HUSEORGID),
+                    oCN.MakeInParam("@HUseFlag", SqlDbType.Bit, 1, HUseFlag),
+                    oCN.MakeInParam("@HMaker", SqlDbType.NVarChar, 50, (object)HMaker ?? DBNull.Value),
+                    oCN.MakeInParam("@HMakeTime", SqlDbType.NVarChar, 50, (object)HMakeTime ?? DBNull.Value),
+                    oCN.MakeInParam("@HUpDater", SqlDbType.NVarChar, 50, (object)HUpDater ?? DBNull.Value),
+                    oCN.MakeInParam("@HUpDateDate", SqlDbType.NVarChar, 50, (object)HUpDateDate ?? DBNull.Value),
+                    oCN.MakeInParam("@HCheckEmp", SqlDbType.NVarChar, 50, (object)HCheckEmp ?? DBNull.Value),
+                    oCN.MakeInParam("@HCheckTime", SqlDbType.NVarChar, 50, (object)HCheckTime ?? DBNull.Value)
+    
+                };
+
+                DataSet result = oCN.RunProcReturn(sql, parameters, "Gy_UserMaterRelation");
+                #endregion
+
+
+                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.Message;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 缂栬緫淇濆瓨
+        [Route("MaterialHandingController/EditSaveBill")]
+        [HttpPost]
+        public object EditSaveBill([FromBody] JObject msg)
+        {
+            try
+            {
+                var _value = msg["msg"].ToString();
+                string msg3 = _value.ToString();
+                string msg2 = msg3.ToString();
+
+                oCN.BeginTran();
+                //鍙嶅簭鍒楀寲
+                msg2 = "[" + msg2.ToString() + "]";
+
+                List<Model.Cls_MaterialHandingModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.Cls_MaterialHandingModel>>(msg2);
+               
+                
+                int HItemID = Convert.ToInt32(list[0].HItemID);
+                int HMaterID = Convert.ToInt32(list[0].HMaterNumber);
+                int HSupID = list[0].HSupID;
+                //string HUserID = list[0].HUserID;
+                decimal HMinPackQty = list[0].HMinPackQty;
+                decimal HInBoxPackQty = list[0].HInBoxPackQty;
+                decimal HOutBoxPackQty = list[0].HOutBoxPackQty;
+                int HUSEORGID = list[0].HUSEORGID;
+                bool HUseFlag = list[0].HUseFlag;
+                string HMaker = list[0].HMaker != "" ? list[0].HMaker : "";
+                string HMakeTime = list[0].HMakeTime;
+                string HUpDater = list[0].HUpDater != "" ? list[0].HUpDater : "";
+                string HUpDateDate = list[0].HUpDateDate;
+                string HCheckEmp = list[0].HCheckEmp != "" ? list[0].HCheckEmp : "";
+                string HCheckTime = list[0].HCheckTime;
+
+
+
+                #region  
+                //涓昏〃
+                string sql = @"UPDATE Gy_UserMaterRelation SET 
+                HMaterID = @HMaterID, 
+                HSupID = @HSupID, 
+                HMinPackQty = @HMinPackQty, 
+                HInBoxPackQty = @HInBoxPackQty, 
+                HUSEORGID = @HUSEORGID, 
+                HUseFlag = @HUseFlag,
+                HMaker = @HMaker, 
+                HMakeTime = @HMakeTime, 
+                HUpDater = @HUpDater, 
+                HUpDateDate = @HUpDateDate, 
+                HCheckEmp = @HCheckEmp, 
+                HCheckTime = @HCheckTime
+                WHERE HItemID = @HItemID"; 
+
+                SqlParameter[] parameters = {
+                        oCN.MakeInParam("@HItemID", SqlDbType.Int, 4, HItemID),
+                        oCN.MakeInParam("@HMaterID", SqlDbType.Int, 4, HMaterID),
+                        oCN.MakeInParam("@HSupID", SqlDbType.Int, 4, HSupID),
+                        //oCN.MakeInParam("@HUserID", SqlDbType.NVarChar, 50, HUserID),
+                        oCN.MakeInParam("@HMinPackQty", SqlDbType.Decimal, 8, HMinPackQty),
+                        oCN.MakeInParam("@HInBoxPackQty", SqlDbType.Decimal, 8, HInBoxPackQty),
+                        oCN.MakeInParam("@HOutBoxPackQty", SqlDbType.Decimal, 8, HOutBoxPackQty),
+                        oCN.MakeInParam("@HUSEORGID", SqlDbType.Int, 4, HUSEORGID),
+                        oCN.MakeInParam("@HUseFlag", SqlDbType.Bit, 1, HUseFlag),
+                        oCN.MakeInParam("@HMaker", SqlDbType.NVarChar, 50, (object)HMaker ?? DBNull.Value),
+                        oCN.MakeInParam("@HMakeTime", SqlDbType.NVarChar, 50, (object)HMakeTime ?? DBNull.Value),
+                        oCN.MakeInParam("@HUpDater", SqlDbType.NVarChar, 50, (object)HUpDater ?? DBNull.Value),
+                        oCN.MakeInParam("@HUpDateDate", SqlDbType.NVarChar, 50, (object)HUpDateDate ?? DBNull.Value),
+                        oCN.MakeInParam("@HCheckEmp", SqlDbType.NVarChar, 50, (object)HCheckEmp ?? DBNull.Value),
+                        oCN.MakeInParam("@HCheckTime", SqlDbType.NVarChar, 50, (object)HCheckTime ?? DBNull.Value),
+};
+
+                // 浣跨敤 RunProcReturn 鎵ц鍙傛暟鍖朥PDATE鏌ヨ锛屽拷鐣ヨ繑鍥炵殑 DataSet
+                DataSet result = oCN.RunProcReturn(sql, parameters, "Gy_UserMaterRelation");
+                #endregion
+
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鏇存柊鎴愬姛锛�";
+                return objJsonResult;
+                
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.Message;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        //#region 渚涘簲鍟嗘姤浠峰崟 鍒犻櫎
+        [Route("MaterialHandingController/DelBill")]
+        [HttpGet]
+        public object DelBill(string HItemID, string user)
+        {
+            
+                try
+                {
+                    if (HItemID == null || HItemID.Equals(""))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    oCN.BeginTran();
+
+                   // oCN.RunProc("delete from Gy_UserMaterRelation where HInterID = " + HItemID);
+                    oCN.RunProc("delete from Gy_UserMaterRelation where HItemID='" + HItemID + "'");
+
+                    oCN.Commit();
+
+                    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
+
+
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.1