From 015997e4efd5e5189498c9af00b7805919a676b2 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期三, 15 十一月 2023 19:44:17 +0800
Subject: [PATCH] 特批申请单:审核时判断源单是否处于创建状态,不是则审核失败

---
 WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs |  234 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 234 insertions(+), 0 deletions(-)

diff --git a/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs b/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
index 30ca36b..134b1ca 100644
--- a/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
+++ b/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
@@ -1157,6 +1157,7 @@
                     UserName = oItem.HMaker;  //鍒跺崟浜�
                     oItem.HBillType = "1401";
                     oItem.HBillSubType = "1401";
+                    oItem.HSALEORGID = oItem.HOrgID;
 
                     oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                     oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
@@ -1289,6 +1290,8 @@
         {
             try
             {
+                string s = "";
+
                 //鏌ョ湅鏉冮檺
                 if (!DBUtility.ClsPub.Security_Log("Xs_SeOrderBill_Drop", 1, false, user))
                 {
@@ -1307,6 +1310,25 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+
+                if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                //鍒ゆ柇鏄惁鍙紪杈�
+                if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽鍒犻櫎锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+
 
                 oCN.BeginTran();
 
@@ -1426,6 +1448,16 @@
                 //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣�
                 if (IsAudit == 0) //瀹℃牳鎻愪氦
                 {
+                    ds = oCN.RunProcReturn("exec h_p_Kf_CheckSeOrderBill_CrediControl " + oBill.omodel.HInterID, "h_p_Kf_CheckSeOrderBill_CrediControl");
+                    if(ds.Tables[0].Rows[0]["HBack"].ToString() == "1")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString();
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
                     //瀹℃牳鎻愪氦
                     if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                     {
@@ -1758,5 +1790,207 @@
             }
         }
         #endregion
+
+        #region 閿�鍞鍗� 鏍规嵁瀹㈡埛鑾峰彇甯佸埆銆佹眹鐜囥�佺粨绠楁柟寮�
+        [Route("Xs_SeOrderBill/getCustomerByCusID")]
+        [HttpGet]
+        public object getCustomerByCusID(long HCusID)
+        {
+            try
+            {
+                string sql = @"select 
+                            c.HItemID HCusID
+                            ,c.HNumber HCusNumber
+                            ,c.HName HCusName
+                            ,c.HSSID
+                            ,s.HName HSSName
+                            ,c.HCurID
+                            ,cur.HName HCurName
+                            ,cur.HExchangeRate HExRate
+                            ,c.HTaxRate
+							,c.HLinkMan
+							,c.HLinkPhone
+							,c.HMobilePhone
+							,ISNULL(cre.HCreditRating_Now,0) HCreditRating_Now
+                            from Gy_Customer as c 
+                            left join Gy_SettleStyle as s on c.HSSID = s.HItemID
+                            left join Gy_Currency as cur on c.HCurID = cur.HItemID
+							left join Gy_Customer_Credit as cre on c.HItemID = cre.HCusID
+                            where c.HItemID = " + HCusID;
+                ds = oCN.RunProcReturn(sql,"Gy_Customer");
+
+
+                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;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 閿�鍞鍗� 鏍规嵁鐢ㄦ埛鑾峰彇閿�鍞憳銆侀攢鍞儴闂ㄣ�侀攢鍞富绠�
+        [Route("Xs_SeOrderBill/getCzyglByUser")]
+        [HttpGet]
+        public object getCzyglByUser(string CurUserName)
+        {
+            try
+            {
+                string sql = @"select 
+                            c.HEmpID
+                            ,e.HName HEmpName
+                            ,c.HDeptID
+                            ,d.HName HDeptName
+                            ,d.HEmpID HManagerID
+                            ,e1.HName HManagerName
+                            from Gy_Czygl as c
+                            left join Gy_Employee as e on c.HEmpID = e.HItemID
+                            left join Gy_Department as d on c.HDeptID = d.HItemID
+                            left join Gy_Employee as e1 on d.HEmpID = e1.HItemID
+                            where c.Czymc = '" + CurUserName + "'";
+                ds = oCN.RunProcReturn(sql, "Gy_Czygl");
+
+                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;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 閿�鍞鍗� 鏍规嵁鐢ㄦ埛鑾峰彇鐢ㄦ埛鍏宠仈瀹㈡埛杩囨护鏉′欢
+        [Route("Xs_SeOrderBill/getCusIDListByUser")]
+        [HttpGet]
+        public object getCusIDListByUser(string CurUserID, string CurUserName)
+        {
+            string sWhere = "";
+            string ModRightNameCheck = "Gy_UserLookAllCus";
+            DBUtility.ClsPub.CurUserName = CurUserName;
+            try
+            {
+                //鏉冮檺鍒ゆ柇锛氭槸鍚﹀彲浠ユ煡鐪嬫墍鏈夊鎴�
+                if (DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
+                {
+                    sWhere = "";
+                }
+                else
+                {
+                    string sql = "select * from Gy_UserCustomerRelation where HUserID = '" + CurUserID + "'";
+                    ds = oCN.RunProcReturn(sql, "Gy_UserCustomerRelation");
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        sWhere = " and 1 = 0";
+                    }
+                    else
+                    {
+                        sWhere = " and HCusID in (";
+                        for(var i = 0; i < ds.Tables[0].Rows.Count; i++)
+                        {
+                            if (i < ds.Tables[0].Rows.Count - 1)
+                            {
+                                sWhere += ds.Tables[0].Rows[i]["HCusID"].ToString() + ",";
+                            }
+                            else
+                            {
+                                sWhere += ds.Tables[0].Rows[i]["HCusID"].ToString() + ")";
+                            }
+                        }
+                    }
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = sWhere;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                sWhere = " and 1=0 ";
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = sWhere;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 閿�鍞鍗� 涓嬫帹鐢熶骇璁㈠崟(鏃犲垪琛�)-鑾峰彇鏁版嵁
+        [Route("Xs_SeOrderBill/loadXs_SeOrderBill_InitICMO")]
+        [HttpGet]
+        public object loadXs_SeOrderBill_InitICMO(long HInterID,long HEntryID)
+        {
+            try
+            {
+                string sql = "select * from h_v_IF_SeOrderBillList where hmainid = " + HInterID + " and HSubID = " + HEntryID;
+                ds = oCN.RunProcReturn(sql, "h_v_IF_SeOrderBillList");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "false锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    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
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1