From 9a75f7db9431032c0f1ecc64be4966a25c74bafa Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期二, 05 十一月 2024 16:48:12 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs |  175 +++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 149 insertions(+), 26 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index 92b3995..e8cb406 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -226,6 +226,12 @@
                 string Ret = "";
                 if (oSystemParameter.ShowBill(ref Ret))
                 {
+                    //鍒ゆ柇瀹㈡埛涓轰箶涓�
+                    if(oSystemParameter.omodel.WMS_CampanyName == "涔斾竴")
+                    {
+                        HDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+                    }
+
                     //鍒ゆ柇瀹㈡埛涓嶄负榫欏北姹介厤
                     if (oSystemParameter.omodel.WMS_CampanyName != "榫欏北姹介厤" && oSystemParameter.omodel.WMS_CampanyName != "鐟炰笌绁�" && oSystemParameter.omodel.WMS_CampanyName != "娣诲悍绉戞妧") //绯荤粺鍙傛暟                      
                     {
@@ -605,6 +611,10 @@
                 string sReturn = "";
                 if (oSystemParameter.ShowBill(ref sReturn) == true)
                 {
+                    if (oSystemParameter.omodel.MES_StationOutBill_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+                    {
+                        object objResult = set_CheckBill(HInterID.ToString(), user, HBillSubType);
+                    }
                     if (oSystemParameter.omodel.MES_StationOutBill_SaveAutoAddnew == "Y") //绯荤粺鍙傛暟  椤甸潰淇濆瓨鑷姩鍙樻垚鏂板鐘舵��
                     {
                         objJsonResult.Verify = "Y";
@@ -617,6 +627,27 @@
                 sw.Stop();//缁撴潫璁℃椂
                 LogService.Write($"11.鍙傛暟鏌ヨ缁撴潫,鏂板缁撴潫锛岀敤鏃�" + sw.Elapsed);
                 LogService.Write("END--鍑虹珯鍗曟嵁淇濆瓨缁撴潫锛屽嚭绔欏崟鍙凤細" + HBillNo);
+
+                //娴嬭瘯璇彞===========================================================================================================
+                string msg_str = "";
+                string sql_str = "select a.HQty HQty_Main,b.HQty HQty_Sub " +
+                            "from Sc_ProcessExchangeBillMain as a " +
+                            "inner join Sc_ProcessExchangeBillSub as b on a.HInterID = b.HInterID " +
+                            "where a.HInterID = " + HProcExchInterID;
+                DataSet ds_str = oCN.RunProcReturn(sql_str, "Sc_ProcessExchangeBillMain");
+                if (ds_str.Tables[0].Rows.Count > 0)
+                {
+                    msg_str = "HQty_Main:" + ds_str.Tables[0].Rows[0]["HQty_Main"].ToString() + ";HQty_Sub:";
+                    for (int j = 0; j < ds_str.Tables[0].Rows.Count; j++)
+                    {
+                        msg_str += ds_str.Tables[0].Rows[j]["HQty_Sub"].ToString() + ",";
+                    }
+                }
+
+                oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼宸ュ簭鍑虹珯鍗曟嵁锛�" + HBillNo + "[宸ュ簭娴佽浆鍗″彿锛�" + HProcExchBillNo + "]" + msg_str + "','LMES-宸ュ簭鍑虹珯妯″潡','" + DBUtility.ClsPub.IPAddress + "','鏂板鎴栦慨鏀瑰崟鎹�'", ref DBUtility.ClsPub.sExeReturnInfo);
+                //==============================================================================================================
+
+
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
@@ -1718,31 +1749,74 @@
         }
         #endregion
 
-        #region 宸ュ簭鍑虹珯姹囨姤鍗曞垪琛�
-        [Route("Cj_StationOutBill/page")]
+        #region 杩斿洖宸ュ簭鍑虹珯姹囨姤鍗曞垪琛�-鍒嗛〉
+        [Route("Cj_StationOutBill/get_Display_byPage")]
         [HttpGet]
-        public json page(string sWhere, string user, int page, int size)
+        public object get_Display_byPage(string sWhere, string user, string Organization, int page, int size, string HBillSubType)
         {
-            json res = new json();
             try
             {
                 List<object> columnNameList = new List<object>();
-                    //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
-             if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, user))
-                    {
-                        res.code = "0";
-                        res.count = 0;
-                        res.Message = "鍑虹珯鍗曟棤鏌ヨ鏉冮檺!";
-                        res.data = null;
-                        return res;
-                    }
-                if (sWhere == null || sWhere.Equals(""))
+                if (HBillSubType == "SUB")
                 {
-                    ds = oCN.RunProcReturn("exec h_p_MES_StationOutBillList " + page + "," + size + ",''", "h_p_MES_StationOutBillList");
+                    //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                    if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Sub_Query", 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹屽伐鍗曟棤鏌ヨ鏉冮檺!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
                 }
                 else
                 {
-                    ds = oCN.RunProcReturn("exec h_p_MES_StationOutBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_MES_StationOutBillList");
+                    //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                    if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_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, "宸ュ簭姹囨姤鍗曞垪琛�");
+
+                        if (sql_splice == "娌℃湁鏌ヨ鍒扮浉鍏崇敤鎴蜂俊鎭�")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "娌℃湁鏌ヨ鍒扮浉鍏崇敤鎴蜂俊鎭�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            sWhere += sql_splice;
+                        }
+                    }
+                }
+
+                //sWhere = sWhere.Replace("'", "''");
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("exec h_p_MES_StationOutBillList " + page + "," + size + ",'" + Organization + "'," + "''", "h_p_MES_StationOutBillList");
+                }
+                else
+                {
+                    ds = oCN.RunProcReturn("exec h_p_MES_StationOutBillList " + page + "," + size + ",'" + Organization + "','" + sWhere + "'", "h_p_MES_StationOutBillList");
                 }
 
                 //娣诲姞鍒楀悕
@@ -1753,23 +1827,24 @@
                     columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
                 }
 
-                res.code = CodeConstant.SUCCEED;
-                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
-                res.Message = "Sucess锛�";
-                res.list = columnNameList;
-                res.data = ds.Tables[0];
-                return res;
+                objJsonResult.code = "1";
+                objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.list = columnNameList;
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
             }
             catch (Exception e)
             {
-                res.code = CodeConstant.FAIL;
-                res.count = CountConstant.FAIL;
-                res.Message = "Exception锛�" + e.ToString();
-                res.data = null;
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
                 return objJsonResult;
             }
         }
         #endregion
+
         #region 宸ュ簭鍑虹珯姹囨姤鍗� 瀛愯〃鏌ヨ
         [Route("Cj_StationOutBill/get_SubDisplay")]
         [HttpGet]
@@ -3852,5 +3927,53 @@
         }
 
         #endregion
+
+        #region 涓嬫帹璐ㄩ噺姹囨姤鍗曟椂杩斿洖宸ュ簭鍑虹珯姹囨姤鍗曚俊鎭�
+        [Route("Cj_StationOutBill/PushDownBackInfo")]
+        [HttpGet]
+        public object PushDownBackInfo(string linterid, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                ds = oCN.RunProcReturn("select * from h_v_Sc_StationOutBill_PushDownBackInfo where hmainid in (" + linterid + ")", "h_v_Sc_StationOutBill_PushDownBackInfo");
+
+                if (ds.Tables[0].Rows.Count > 0 && ds != null)
+                {
+                    //娣诲姞鍒楀悕
+                    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;
+                }
+                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;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1