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/Sc_ProcessExchangeBillController.cs |  104 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 98 insertions(+), 6 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
index 28e33cc..4d73021 100644
--- a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
+++ b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
@@ -1,6 +1,7 @@
 锘縰sing Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Pub_Class;
+using SyntacticSugar.constant;
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -131,14 +132,50 @@
                     // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                     bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
 
-                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + msg4 + "','" + HComputerName + "','" + "鏂板宸ュ簭娴佽浆鍗″崟鎹細" + oBill.omodel.HBillNo + "','LMES-宸ュ簭娴佽浆鍗℃ā鍧�','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+
+                    //娴嬭瘯璇彞===========================================================================================================
+                    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 = " + oBill.omodel.HInterID;
+                    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(),'" + msg4 + "','" + HComputerName + "','" + "鏂板宸ュ簭娴佽浆鍗″崟鎹細" + oBill.omodel.HBillNo + msg_str + "','LMES-宸ュ簭娴佽浆鍗℃ā鍧�','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 else
                 {
                     LogService.Write("鐢ㄦ埛:" + msg4 + ",鏃ユ湡:" + DateTime.Now + ",淇敼宸ュ簭娴佽浆鍗″崟鎹�:" + oBill.omodel.HBillNo);
                     bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
 
-                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + msg4 + "','" + HComputerName + "','" + "淇敼宸ュ簭娴佽浆鍗″崟鎹細" + oBill.omodel.HBillNo + "','LMES-宸ュ簭娴佽浆鍗℃ā鍧�','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+                    //娴嬭瘯璇彞===========================================================================================================
+                    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 = " + oBill.omodel.HInterID;
+                    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(),'" + msg4 + "','" + HComputerName + "','" + "淇敼宸ュ簭娴佽浆鍗″崟鎹細" + oBill.omodel.HBillNo + msg_str + "','LMES-宸ュ簭娴佽浆鍗℃ā鍧�','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 if (bResult)
                 {
@@ -827,8 +864,8 @@
                 string sql = string.Format(@"select 娴佹按鍙� HProcNo,HProcID,宸ュ簭浠g爜 HProcNumber,宸ュ簭鍚嶇О HProcName,鍔犲伐璇存槑 HWorkRemark,HCenterID,宸ヤ綔涓績浠g爜 HCenterNumber,
                                                 宸ヤ綔涓績 HCenterName,HSupID,渚涘簲鍟嗕唬鐮� HSupNumber,渚涘簲鍟� HSupName,isEntrust HSupFlag,璁″垝鏁伴噺 HQty,鍔犲伐鍗曚环 HOutPrice, 琛ㄤ綋澶囨敞 HRemark,
                                             杩涚珯鍏宠仈鏁伴噺 HRelationQty_In,鍑虹珯鍏宠仈鏁伴噺 HRelationQty_Out,濮斿宸ュ崟鏁伴噺 HRelationQty_WWOrder,涓嶅悎鏍兼暟閲� HRelationQty_Bad,瓒呴姣斾緥 HOverRate,
-                                            鑹巼 HPassRate,绱鑹巼 HSumPassRate,鍥剧焊缂栧彿 HPicNum,鏈伐搴忕‘璁よ褰� HProcCheckNote,宸ヨ壓鍙傛暟 HTechnologyParameter,HDeptID,
-                                            鍔犲伐杞﹂棿浠g爜 HDeptNumber,鍔犲伐杞﹂棿 HDeptName,鍑虹珯鎶ュ簾鍏宠仈鏁伴噺 HRelationQty_OutBad,SN杩囩珯鎺у埗 HSNCtrl
+                                            鑹巼 HPassRate,绱鑹巼 HSumPassRate,鍥剧焊缂栧彿 HPicNum,鏈伐搴忕‘璁よ褰� HProcCheckNote,宸ヨ壓鍙傛暟 HTechnologyParameter,HDeptID,HSourceID,
+                                            鍔犲伐杞﹂棿浠g爜 HDeptNumber,鍔犲伐杞﹂棿 HDeptName,鍑虹珯鎶ュ簾鍏宠仈鏁伴噺 HRelationQty_OutBad,SN杩囩珯鎺у埗 HSNCtrl,HRoutingInterID HRoutingBillMainID,HRoutingEntryID HRoutingBillEntryID
                                             from h_v_Sc_ProcessExchangeBillQuerySub");
                 ds = oCN.RunProcReturn(sql+ " where hmainid="+ HInterID + "  order by cast(娴佹按鍙� as int) ", "h_v_Sc_ProcessExchangeBillQuerySub");
                 objJsonResult.code = "0";
@@ -1911,6 +1948,59 @@
         }
         #endregion
 
+        #region 宸ュ簭娴佽浆鍗″垎椤靛垪琛�
+        [Route("Sc_ProcessExchangeBillList/page")]
+        [HttpGet]
+        public json page(string sWhere, string user, int page, int size)
+        {
+            json res = new json();
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //缂栬緫鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Sc_ProcessExchangeBill_SubQuery", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("exec h_p_Sc_ProcessExchangeBillList_Query " + page + "," + size + ",''", "h_p_Sc_ProcessExchangeBillList_Query");
+                }
+                else
+                {
+                    ds = oCN.RunProcReturn("exec h_p_Sc_ProcessExchangeBillList_Query " + page + "," + size + ",'" + sWhere + "'", "h_p_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鍒楀璞$殑鍒楀悕
+                }
+
+                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;
+            }
+            catch (Exception e)
+            {
+                res.code = CodeConstant.FAIL;
+                res.count = CountConstant.FAIL;
+                res.Message = "Exception锛�" + e.ToString();
+                res.data = null;
+                return res;
+            }
+        }
+        #endregion
+
         #region 宸ュ簭娴佽浆鍗″垪琛�
         /// <summary>
         /// 鑾峰彇宸ュ簭娴佽浆鍗″垪琛ㄤ俊鎭�
@@ -2103,7 +2193,7 @@
                     HProQty = oItemSub.HProQty;
 
                     sql = "select * from h_v_Sc_ProcessExchangeBill_BatchSplit where hmainid = " + oItemSub.HICMOInterID + " and hentryid = " 
-                         + oItemSub.HICMOEntryID;
+                         + oItemSub.HICMOEntryID + " and HRoutingID = " + oItemSub.HRoutingInterID.ToString();
                     ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessExchangeBill_BatchSplit");
                     //涓昏〃璧嬪��
                     if (ds.Tables[0].Rows.Count > 0 && ds != null)
@@ -2242,7 +2332,7 @@
                         oItemSubs.HDeptID = Pub_Class.ClsPub.isLong(ds.Tables[0].Rows[i]["HDeptID"]);
                         oItemSubs.HDeptNumber = ds.Tables[0].Rows[i]["HDeptNumber"].ToString();
                         oItemSubs.HGroupID = 0;
-                        oItemSubs.HGroupNumber = "";
+                        oItemSubs.HGroupNumber = oItemSub.HGroupNumber;
                         oItemSubs.HWorkerID = 0;
                         oItemSubs.HWorkerNumber = "";
                         oItemSubs.HSourceID = 0;
@@ -2287,6 +2377,8 @@
                         oItemSubs.HSeOrderInterID = 0;
                         oItemSubs.HSeOrderEntryID = 0;
                         oItemSubs.HSNCtrl = false;
+                        oItemSubs.HRoutingBillMainID = Pub_Class.ClsPub.isLong(ds.Tables[0].Rows[i]["HRoutingID"]);
+                        oItemSubs.HRoutingBillEntryID = Pub_Class.ClsPub.isLong(ds.Tables[0].Rows[i]["HRoutingEntryID"]);
 
                         oBill.DetailColl.Add(oItemSubs);//娣诲姞鏄庣粏琛屽��                
                     }

--
Gitblit v1.9.1