From 2d98e07db706e1a882fff03685411b103d747a34 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期一, 11 十二月 2023 16:22:56 +0800
Subject: [PATCH] 销售订单:下查增加工序流转卡

---
 WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs |  254 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 251 insertions(+), 3 deletions(-)

diff --git a/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs b/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
index a078e77..81d8fa5 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);
@@ -1447,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)
                     {
@@ -1845,11 +1856,11 @@
             try
             {
                 string sql = @"select 
-                            c.HEmpID
+                            ISNULL(c.HEmpID,0) HEmpID
                             ,e.HName HEmpName
-                            ,c.HDeptID
+                            ,ISNULL(c.HDeptID,0) HDeptID
                             ,d.HName HDeptName
-                            ,d.HEmpID HManagerID
+                            ,ISNULL(d.HEmpID,0) HManagerID
                             ,e1.HName HManagerName
                             from Gy_Czygl as c
                             left join Gy_Employee as e on c.HEmpID = e.HItemID
@@ -1885,5 +1896,242 @@
             }
         }
         #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() + ")";
+                    //        }
+                    //    }
+                    //}
+
+                    sWhere = " and 1=1 ";
+                }
+
+                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
+
+        #region 閿�鍞鍗� 妫�鏌ュ崟鎹槸鍚﹀瓨鍦�
+        /// <summary>
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <returns></returns>
+        [Route("Xs_SeOrderBill/CheckSeOrderBill_IsExist")]
+        [HttpGet]
+        public object CheckSeOrderBill_IsExist(int HInterID)
+        {
+            try
+            {
+                //HInterID鏁版嵁鍒ゆ柇
+                if (HInterID <= 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID灏忎簬0锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                Int64 lngBillKey = 0;
+                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
+                DAL.ClsXs_SeOrderBill oBill = new DAL.ClsXs_SeOrderBill();                              //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍗曟嵁瀛樺湪";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "绋嬪簭閿欒锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 閿�鍞鍗� 涓嬫煡
+        /// <summary>
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <returns></returns>
+        [Route("Xs_SeOrderBill/SeOrderBill_LookDown")]
+        [HttpGet]
+        public object SeOrderBill_LookDown(int HInterID)
+        {
+            try
+            {
+                List<object> columnNameListSum = new List<object>();
+                List<object> columnNameList0 = new List<object>();
+                List<object> columnNameList1 = new List<object>();
+                List<object> columnNameList2 = new List<object>();
+                List<object> columnNameList3 = new List<object>();
+                List<object> columnNameList4 = new List<object>();
+
+                string sql = "exec h_p_Xs_SeOrderBill_lookdown " + HInterID;
+                ds = oCN.RunProcReturn(sql, "h_p_Xs_SeOrderBill_lookdown");
+
+                //娣诲姞 閿�鍞鍗曞彉鏇村崟 鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList0.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                //娣诲姞 鐢熶骇璁㈠崟 鍒楀悕
+                foreach (DataColumn col in ds.Tables[1].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList1.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                //娣诲姞 鐗规壒鐢宠鍗� 鍒楀悕
+                foreach (DataColumn col in ds.Tables[2].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList2.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                //娣诲姞 閿�鍞嚭搴撳崟 鍒楀悕
+                foreach (DataColumn col in ds.Tables[3].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList3.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                //娣诲姞 宸ュ簭娴佽浆鍗� 鍒楀悕
+                foreach (DataColumn col in ds.Tables[4].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList4.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                columnNameListSum.Add(columnNameList0);
+                columnNameListSum.Add(columnNameList1);
+                columnNameListSum.Add(columnNameList2);
+                columnNameListSum.Add(columnNameList3);
+                columnNameListSum.Add(columnNameList4);
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables;
+                objJsonResult.list = columnNameListSum;
+                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