From a652949e0c299112797e1ed43a6b9f359d2352dc Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期二, 21 五月 2024 16:55:03 +0800
Subject: [PATCH] 器具缓存列表模块所调用方法新增,出站记录新增单据方法修正

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

diff --git a/WebAPI/Controllers/LMESController.cs b/WebAPI/Controllers/LMESController.cs
index 85f99bd..7535fe3 100644
--- a/WebAPI/Controllers/LMESController.cs
+++ b/WebAPI/Controllers/LMESController.cs
@@ -134,6 +134,92 @@
             }
         }
 
+        #region 宸ュ簭娴佽浆鍗$淮鎶�-鏌ヨ
+        /// <summary>
+        /// 杩斿洖宸ュ簭娴佽浆鍗$淮鎶ゅ垪琛ㄤ富琛�
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("LEMS/Sc_ProcessExchangeBillList_Query")]
+        [HttpGet]
+        public object Sc_ProcessExchangeBillList_Query(string sWhere, string user, string HBillSubType)
+        {
+            DataSet ds;
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                if (HBillSubType == "SUB")
+                {
+                    //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                    if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_SubQuery", 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鎸囧紩鍗℃棤鏌ヨ鏉冮檺!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+
+                    //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                    if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Query", 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "娴佽浆鍗℃棤鏌ヨ鏉冮檺!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                //鑾峰彇绯荤粺鍙傛暟
+                string Ret = "";
+                if (oSystemParameter.ShowBill(ref Ret))
+                {
+                    //鍒ゆ柇瀹㈡埛涓洪緳灞辨苯閰�
+                    if (oSystemParameter.omodel.WMS_CampanyName == "榫欏北姹介厤")
+                    {
+                        //鑾峰彇闇�瑕佹嫾鎺ョ殑瀛楃涓�
+                        string sql_splice = DBUtility.ClsPub.SpliceSQL(user, "宸ュ簭娲惧伐鍗曞垪琛�");
+
+                        sWhere += sql_splice;
+                    }
+                }
+
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+
+
+                ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillList_Query where 1 = 1 " + sWhere + " order by hmainid desc ", "h_v_Sc_ProcessExchangeBillList_Query");
+
+
+                //娣诲姞鍒楀悕
+                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鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.list = columnNameList;
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "寮傚父锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region 宸ュ簭娴佽浆鍗� 涓嬫煡
         /// <summary>
         /// </summary>
@@ -306,6 +392,224 @@
                 return objJsonResult;
             }
         }
+
+        #region 宸ュ簭娴佽浆鍗″彧鏄剧ず宸ュ簭鏁版嵁
+        [Route("LEMS/MES_ProcessExchangeBillList_PG")]
+        [HttpGet]
+        public object MES_ProcessExchangeBillList_PG(string sWhere, string user, int OperationType)
+        {
+            DataSet ds;
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡璇㈡潈闄�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (OperationType == 1)
+                {
+                    //鑾峰彇绯荤粺鍙傛暟
+                    string Ret = "";
+                    if (oSystemParameter.ShowBill(ref Ret))
+                    {
+                        //鍒ゆ柇瀹㈡埛涓烘澀宸炴柉鑾皵
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鏉窞鏂帿灏�")
+                        {
+                            sWhere += "  ";
+
+                        }
+                        else
+                        {
+                            sWhere += "  ";
+                        }
+                    }
+
+                    SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                    ds = oCN.RunProcReturn("select top 1000 * from h_v_Sc_ProcessExchangeArrangementList_PG where 1 = 1 " + sWhere + " order by hmainid desc ", "h_v_Sc_ProcessExchangeArrangementList_PG");
+                }
+                else
+                {
+                    //鑾峰彇绯荤粺鍙傛暟
+                    string Ret = "";
+                    if (oSystemParameter.ShowBill(ref Ret))
+                    {
+                        //鍒ゆ柇瀹㈡埛涓烘澀宸炴柉鑾皵
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鏉窞鏂帿灏�")
+                        {
+
+
+                        }
+                    }
+
+                    SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                    ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeArrangementList_PG where 1 = 1 " + sWhere, "h_v_Sc_ProcessExchangeArrangementList_PG");
+                }
+
+                //娣诲姞鍒楀悕
+                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鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.list = columnNameList;
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "寮傚父锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 宸ュ簭娴佽浆鍗� 娲惧伐(鏂帿灏�)
+        [Route("LEMS/ProcessExchangeArrangement_Add_PG")]
+        [HttpGet]
+        public object ProcessExchangeArrangement_Add_PG(string HInterID_S, int HSourceID, long HOrgID, string user)
+        {
+            DataSet ds;
+            try
+            {
+                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Edit", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娴佽浆鍗℃棤缂栬緫鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                var HNum = HInterID_S.Split(',');
+
+                for (int j = 0; j < HNum.Length; j++)
+                {
+                    long HInterID = long.Parse(HNum[j].Split('|')[0]);
+                    long HEntryID = long.Parse(HNum[j].Split('|')[1]);
+                    ds = oCN.RunProcReturn(@"select a.HMaterID,b.HProcID,a.HBillNo from Sc_ProcessExchangeBillMain a inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID 
+where a.HInterID=" + HInterID + " and b.HEntryID=" + HEntryID, "Sc_ProcessExchangeBillMain");
+                    if (ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鏌ユ棤姝ゅ伐搴忔祦杞崱锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    oCN.BeginTran();
+
+                    oCN.RunProc("update Sc_ProcessExchangeBillSub set HSourceID=" + HSourceID + " where HInterID=" + HInterID + " and HEntryID=" + HEntryID);
+
+                    oCN.RunProc("exec h_p_Sc_ICMOBillStatus_Tmp_PG " + HInterID + "," + HEntryID);
+                  
+                    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 = "寮傚父锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鍙栨秷娲惧伐鍔熻兘(鏂帿灏�)
+        [Route("LEMS/ProcessExchangeArrangementDel_PG")]
+        [HttpGet]
+        public object ProcessExchangeArrangementDel_PG(string HInterID_S, int HSourceID, string user)
+        {
+            DataSet ds;
+            DataSet ds1;
+            try
+            {
+                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Edit", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娴佽浆鍗℃棤缂栬緫鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                var HNum = HInterID_S.Split(',');
+
+                oCN.BeginTran();
+
+                for (int j = 0; j < HNum.Length; j++)
+                {
+
+                    long HInterID = long.Parse(HNum[j].Split('|')[0]);
+                    long HEntryID = long.Parse(HNum[j].Split('|')[1]);
+                    ds = oCN.RunProcReturn(@"select a.HMaterID,b.HProcID,a.HBillNo from Sc_ProcessExchangeBillMain a inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID 
+where a.HInterID=" + HInterID + " and b.HEntryID=" + HEntryID, "Sc_ProcessExchangeBillMain");
+                    if (ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鏌ユ棤姝ゅ伐搴忔祦杞崱锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    ds = oCN.RunProcReturn("select * from Sc_ICMOBillStatus_Tmp where HSourceInterID=" + HInterID + " and HSourceEntryID=" + HEntryID + " and HICMOStatus=0 and HSourceID=" + HSourceID, "Sc_ICMOBillStatus_Tmp");
+
+                    if (ds.Tables[0].Rows.Count == 0) {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "娴佽浆鍗″搴旂殑鎶ュ伐鏁版嵁涓嶄负鏈紑宸ョ姸鎬�,鏃犳硶鍒犻櫎锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+
+                    oCN.RunProc("update Sc_ProcessExchangeBillSub set HSourceID=0 where HInterID=" + HInterID + " and HEntryID=" + HEntryID);
+                    oCN.RunProc("delete from Sc_ICMOBillStatus_Tmp where HSourceInterID=" + HInterID + " and HSourceEntryID=" + HEntryID);
+                }
+
+                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 = "寮傚父锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
 
         #region 鎺掔几鍔熻兘
         [Route("LEMS/ProcessExchangeArrangement_Add")]
@@ -2870,6 +3174,44 @@
         #endregion
 
 
+        #region 鎶ヨ〃鏌ョ湅鏉冮檺鎺у埗
+        /// <summary>
+        ///鍙傛暟锛歴tring HInterID銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("LMES/getReportByModRightNameCheck")]
+        [HttpGet]
+        public object getReportByModRightNameCheck(string ModRightNameCheck, string user)
+        {
+            try
+            {
+                string s = "";
 
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                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;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1