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 |  189 +++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 167 insertions(+), 22 deletions(-)

diff --git a/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs b/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
index 57200ba..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;
@@ -31,7 +32,7 @@
             try
             {
 
-                ds = oCN.RunProcReturn("select * from h_v_IF_POInStockBillList where HitemID=" + HInterID, "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";
@@ -66,36 +67,47 @@
         /// </summary>
         [Route("Cg_POInStockBill/list")]
         [HttpGet]
-        public object list(string sWhere)
+        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 " + sWhere, "h_v_IF_POInStockBillList");
+                    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;
+                    string sql = sql1 + sWhere+ " order by 鏃ユ湡 desc,hmainid desc";
                     ds = oCN.RunProcReturn(sql, "h_v_IF_POInStockBillList");
                 }
-                if (ds == null || ds.Tables[0].Rows.Count == 0)
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                else
-                {
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "Sucess锛�";
-                    objJsonResult.data = ds.Tables[0];
-                    return objJsonResult;
-                }
+
+                //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)
             {
@@ -149,7 +161,7 @@
                 string HUpDater = list[0].HUpDater;
 
                 ////鍒ゆ柇鏉冮檺
-                //if (!ClsPub.Security_Log(msg5, 1, true, msg4))
+                //if (!ClsPub.Security_Log(msg5, 1, false, msg4))
                 //{
                 //    objJsonResult.code = "0";
                 //    objJsonResult.count = 0;
@@ -234,7 +246,140 @@
                 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