From 9167264eeb081fdbb94d8a1d2f76f35a6ccdd5fe Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期三, 06 四月 2022 11:02:33 +0800
Subject: [PATCH] nothing

---
 WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs |  343 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 327 insertions(+), 16 deletions(-)

diff --git a/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs b/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
index e48d969..a8cf93a 100644
--- a/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
+++ b/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json.Linq;
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
 using Pub_Class;
 using System;
 using System.Collections;
@@ -19,33 +20,24 @@
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         DataSet ds;
 
-
         /// <summary>
-        /// 杩斿洖鏀舵枡閫氱煡鍗曞垪琛�
+        /// 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍
         ///鍙傛暟锛歴tring sql銆�
         ///杩斿洖鍊硷細object銆�
         /// </summary>
-        [Route("Cg_POInStockBill/list")]
+        [Route("Cg_POInStockBill/cx")]
         [HttpGet]
-        public object list(string sWhere)
+        public object cx(long HInterID)
         {
             try
             {
-                if (sWhere == null || sWhere.Equals(""))
-                {
-                    ds = oCN.RunProcReturn("select * from h_v_IF_POInStockBillList " + sWhere, "h_v_IF_POInStockBillList");
-                }
-                else
-                {
-                    string sql1 = "select * from h_v_IF_POInStockBillList where 1 = 1 ";
-                    string sql = sql1 + sWhere;
-                    ds = oCN.RunProcReturn(sql, "h_v_IF_POInStockBillList");
-                }
+
+                ds = oCN.RunProcReturn("select * from h_v_IF_POInStockBillList where hmainid=" + HInterID, "h_v_IF_POInStockBillList");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
+                    objJsonResult.Message = "false锛�";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
@@ -68,7 +60,326 @@
             }
         }
 
+        /// <summary>
+        /// 杩斿洖鏀舵枡閫氱煡鍗曞垪琛�
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Cg_POInStockBill/list")]
+        [HttpGet]
+        public object list(string sWhere,string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBillQuery", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愭煡璇�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_IF_POInStockBillList  order by hmainid desc" , "h_v_IF_POInStockBillList");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_IF_POInStockBillList where 1 = 1 ";
+                    string sql = sql1 + sWhere+ " order by 鏃ユ湡 desc,hmainid desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_IF_POInStockBillList");
+                }
+
+                //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)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        /// <summary>
+        /// 淇濆瓨鎸夐挳
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Cg_POInStockBill/ModifyByID")]
+        [HttpPost]
+        public object ModifyByID([FromBody] JObject oMain)
+        {
+            try
+            {
+                DAL.ClsGy_Warehouse_Ctl oDept = new DAL.ClsGy_Warehouse_Ctl();
+                DAL.ClsGy_Warehouse_View oDeptHlp = new DAL.ClsGy_Warehouse_View();
+
+                var _value = oMain["oMain"].ToString();
+                string msg1 = _value.ToString();
+                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+                string msg2 = sArray[0].ToString();
+                //string msg3 = sArray[1].ToString();
+                //string msg4 = sArray[2].ToString();
+                //string msg5 = sArray[3].ToString();
+                //鍙嶅簭鍒楀寲
+                msg2 = "[" + msg2.ToString() + "]";
+                List<Warehouse> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Warehouse>>(msg2);
+
+                long HItemID = list[0].HItemID;
+                string HNumber = list[0].HNumber;
+                string HName = list[0].HName;
+                string HHelpCode = list[0].HHelpCode;
+                string HShortNumber = list[0].HShortNumber;
+                long HParentID = list[0].HParentID;
+                long HLevel = list[0].HLevel;
+                bool HEndFlag = list[0].HEndFlag;
+                bool HStopflag = list[0].HStopflag;
+                string HRemark = list[0].HRemark;
+                string HBarCode = list[0].HBarCode;
+                long HEmpID = list[0].HEmpID;
+                string HAddress = list[0].HAddress;
+                string HPhone = list[0].HPhone;
+                long HUSEORGID = list[0].HUSEORGID;
+                string HUpDater = list[0].HUpDater;
+
+                ////鍒ゆ柇鏉冮檺
+                //if (!ClsPub.Security_Log(msg5, 1, false, msg4))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                //if (!DBUtility.ClsPub.AllowNumber(HNumber))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                //if (oDept.HavSameNumber(HItemID, HNumber))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "浠g爜閲嶅锛�";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                if (HItemID == 0)
+                {
+                    oCN.BeginTran();
+                    oCN.RunProc("Insert into Gy_Warehouse  " +
+                        " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
+                        ",HLevel,HEndFlag,HStopflag,HRemark,HEmpID,HAddress,HPhone,HUSEORGID) " +
+                        " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID.ToString() +
+                        "," + HLevel.ToString() + "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "'," + HEmpID.ToString() + ",'" + HAddress + "','" + HPhone + "','" + HUSEORGID + "')", ref DBUtility.ClsPub.sExeReturnInfo);
+                    //淇敼涓婄骇涓洪潪鏈骇浠g爜
+                    oCN.RunProc("Update Gy_Warehouse set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
+                    oCN.Commit();
+                }
+                else
+                {
+                    //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+                    oCN.BeginTran();
+                    //涓昏〃
+                    oCN.RunProc("Update Gy_Warehouse set " +
+                        " HNumber='" + HNumber + "'" +
+                        ",HName='" + HName + "'" +
+                        ",HShortNumber='" + HShortNumber + "'" +
+                        ",HHelpCode='" + HHelpCode + "'" +
+                        ",HLevel=" + HLevel.ToString() +
+                        ",HParentID=" + HParentID.ToString() +
+                        ",HEndflag=" + Convert.ToString(HEndFlag ? 1 : 0) +
+                        ",HStopflag=" + Convert.ToString(HStopflag ? 1 : 0) +
+                        ",HEmpID=" + HEmpID.ToString() +
+                        ",HAddress='" + HAddress + "'" +
+                        ",HPhone='" + HPhone + "'" +
+                        ",HUSEORGID='" + HUSEORGID + "'" +
+                        ",HUpdater='" + HUpDater + "'" +
+                        ",HUpdateDate= getdate()" +
+                        ",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
+                    //淇敼瀛愰」鐩唬鐮�
+                    //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_Warehouse,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
+                    //灏嗕笂绾� 涓洪潪鏈骇
+                    oCN.RunProc("Update Gy_Warehouse set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
+                    //
+                    oCN.Commit();
+                }
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.Message;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        /// <summary>
+        ///鍒犻櫎鍔熻兘
+        /// </summary>
+        /// <returns></returns>
+        [Route("Cg_POInStockBill/DeltetPOInStockBill")]
+        [HttpGet]
+        public object DeltetPOInStockBill(string HInterID,string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ょ殑鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBill_Drop", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍏堝垹闄� 閲戣澏鏁版嵁
+                objJsonResult = DeleteKingDee(HInterID);
+                if (objJsonResult.code == "0")
+                    return objJsonResult;
+
+                oCN.BeginTran();
+                oCN.RunProc("Delete From Cg_POInStockBillMain where HInterID = " + HInterID);
+                oCN.RunProc("Delete From Cg_POInStockBillSub where HInterID = " + HInterID);
+                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;
+            }
+        }
+
+        /// <summary>
+        /// 鍙嶅鏍�
+        /// </summary>
+        [Route("Cg_POInStockBill/DeAuditPOInStockBill")]
+        [HttpGet]
+        public object DeAuditPOInStockBill(string HInterID,string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊鏍哥殑鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBill_Check", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲鏍告潈闄�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍏堝垹闄� 閲戣澏鏁版嵁
+                objJsonResult = DeleteKingDee(HInterID);
+                if (objJsonResult.code == "0")
+                    return objJsonResult;
+
+                oCN.BeginTran();
+                oCN.RunProc("update  Cg_POInStockBillMain  set HERPBillNO='',HERPInterID = 0 ,HBillStatus =5 where HInterID = " + HInterID);
+                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;
+            }
+        }
+        //鍙嶅鏍� 鍒犻櫎 鍒犻櫎閲戣澏鏁版嵁搴撳搴� 鏀舵枡閫氱煡鍒版暟鎹�
+        public json DeleteKingDee(string hinterid)
+        {
+            string sql = string.Format("select HinterID,HERPBillNO,HERPInterID from Cg_POInStockBillMain where HERPInterID>0 and hinterid in (" + hinterid + ")");
+            DataTable dt = oCN.RunProcReturn(sql, "deleteDt").Tables[0];
+            if (dt.Rows.Count > 0)
+            {
+                foreach (DataRow dr in dt.Rows)
+                {
+                    var sJson = new
+                    {
+                        Numbers = dr["HERPBillNO"].ToString(),
+                        Ids = ""
+                    };
+                    var loginRet = InvokeHelper.Login();
+                    
+                    var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
+                    if (isSuccess == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鎿嶄綔澶辫触,閲戣澏璐﹀彿鐧诲綍寮傚父銆�" + loginRet;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    var result = InvokeHelper.Delete("PUR_ReceiveBill", JsonConvert.SerializeObject(sJson));
+                    //LogService.Write(result);
+                    if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀵瑰簲閲戣澏鏀舵枡閫氱煡鍗曞垹闄ゅけ璐� 锛�" + result;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                }
+            }
+            objJsonResult.code = "1";
+            objJsonResult.count = 1;
+            objJsonResult.Message = "Sucess锛�";
+            objJsonResult.data = null;
+            return objJsonResult;
+        }
 
         //
     }

--
Gitblit v1.9.1