From f9c66dcfca26da4eeba5c87df4ca3916461e37f8 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期四, 28 十一月 2024 14:27:32 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/CGGL/Cg_POInStockBackBillController.cs |  280 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 270 insertions(+), 10 deletions(-)

diff --git a/WebAPI/Controllers/CGGL/Cg_POInStockBackBillController.cs b/WebAPI/Controllers/CGGL/Cg_POInStockBackBillController.cs
index 4b59d38..df78c81 100644
--- a/WebAPI/Controllers/CGGL/Cg_POInStockBackBillController.cs
+++ b/WebAPI/Controllers/CGGL/Cg_POInStockBackBillController.cs
@@ -40,7 +40,7 @@
         {
             try
             {
-                
+                List<object> columnNameList = new List<object>();  //瀹氫箟澹版槑鍙橀噺 锛屾妸閫氳繃 new List<object>()鍒涘缓鐨� 瀹炰緥锛岃祴鍊肩粰鍙橀噺
                 //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
                 if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBackBillQuery", 1, false, user))
                 {
@@ -61,16 +61,20 @@
                     string sql = sql1 + sWhere+ " order by hmainid desc";
                     ds = oCN.RunProcReturn(sql, "h_v_IF_POInStockBackBillList");
                 }
-
-
-
-                
+                foreach (DataColumn col in ds.Tables[0].Columns)//閬嶅巻ds涓涓�涓〃锛圱ables[0]锛夌殑鎵�鏈夊垪锛圕olumns锛夋瘡娆″惊鐜腑锛宑ol鍙橀噺浼氭寔鏈夊綋鍓嶅垪鐨勫紩鐢�
+                {
+                    Type dataType = col.DataType; //鑾峰彇褰撳墠鏁版嵁绫诲瀷浼犲叆 鑷畾涔夊彉閲廳atadataType
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
                 //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                 //{
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
-                objJsonResult.data = ds.Tables[0];
+                //objJsonResult.data = ds.Tables[0];
+                objJsonResult.data = ds.Tables[0];//浠g爜灏嗙涓�涓狣ataTable锛堢储寮曚负0锛夎祴鍊肩粰objJsonResult鐨刣ata灞炴��
+                objJsonResult.list = columnNameList;//灏哻olumnNameList璧嬪�肩粰objJsonResult鐨刲ist灞炴��
                 return objJsonResult;
                 //}
                 //else
@@ -91,7 +95,7 @@
                 return objJsonResult;
             }
         }
-        #region 閲囪喘閫�鏂欏崟 淇濆瓨/缂栬緫鍔熻兘
+        #region 閫�鏂欓�氱煡鍗� 淇濆瓨/缂栬緫鍔熻兘
         [Route("Cg_POInStockBackBill/POInStockBackBillEdit")]
         [HttpPost]
         public object POInStockBackBillEdit([FromBody] JObject sMainSub)
@@ -144,7 +148,7 @@
             {
                 msg2 = "[" + msg2.ToString() + "]";
                 List<ClsCg_POInStockBackBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBackBillMain>>(msg2);
-
+                long HPURCHASEORGID = mainList[0].HOrgID;
                 long HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D
                 string HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿
                 long HPRDORGID = mainList[0].HPRDORGID;//鐢熶骇缁勭粐
@@ -158,7 +162,6 @@
                 Single HExRate = mainList[0].HExRate;//姹囩巼
                 long HManagerID = mainList[0].HManagerID;//涓荤
                 long HAPPORGID = mainList[0].HAPPORGID;//鐢宠缁勭粐
-                long HPURCHASEORGID = mainList[0].HPURCHASEORGIDD;//閲囪喘缁勭粐
                 long HREQUIREORGID = mainList[0].HREQUIREORGID;//闇�姹傜粍缁�
                 long HSETTLEORGID = mainList[0].HSETTLEORGID;//缁撶畻缁勭粐
                 long HOWNERTYPEID = mainList[0].HOWNERTYPEID;//璐т富绫诲瀷
@@ -187,6 +190,16 @@
                 string HDeleteDate = mainList[0].HDeleteDate;
                 string HCloseMan = mainList[0].HCloseMan;
                 string HCloseDate = mainList[0].HCloseDate;
+
+                //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+                string s = "";
+                int sYear = 0;
+                int sPeriod = 0;
+                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
+                {
+                    objJsonResult.Message = s;
+                    return objJsonResult;
+                }
 
                 ds = oCN.RunProcReturn("select * from h_v_IF_POInStockBackBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_POInStockBackBillList");
 
@@ -234,7 +247,7 @@
                                 "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" +
                                  ",HSupID=" + HSupID + ",HCurID=" + HCurID + ", HWHID = " + HWHID
                                  + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID + ",HOWNERID=" + HOWNERID
-                                 + ",HAddress='" + HAddress + "'where HInterID=" + HInterID;
+                                 + ",HAddress='" + HAddress + "' ,HInnerBillNo='" + HInnerBillNo + "' where HInterID=" + HInterID;
 
                     oCN.RunProc(sql);
                     //鍒犻櫎瀛愯〃
@@ -242,6 +255,9 @@
                 }
                 //淇濆瓨瀛愯〃
                 objJsonResult = AddBillSub(msg3, HInterID, OperationType, user);
+
+                //閫�鏂欓�氱煡鍗曟柊澧炲洖濉噰璐鍗曞叧鑱旀暟閲�
+                oCN.RunProc("exec h_p_Cg_UpDateRelation_POInStockBackToPOOrder_Add " + HInterID);
 
                 if (objJsonResult.code == "0")
                 {
@@ -414,6 +430,17 @@
                     return objJsonResult;
                 }
                 //==================================================================================      
+
+                //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+                string s = "";
+                int sYear = 0;
+                int sPeriod = 0;
+                DateTime HDate = DateTime.Now;
+                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
+                {
+                    objJsonResult.Message = s;
+                    return objJsonResult;
+                }
 
                 string sReturn = "";
                 oCN.BeginTran();
@@ -983,6 +1010,17 @@
                     }
                     //==================================================================================      
 
+                    //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    DateTime HDate = DateTime.Now;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.Message = s;
+                        return objJsonResult;
+                    }
+
                     //瀹℃牳鎻愪氦
                     if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Cg_POInStockBackBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                     {
@@ -1022,6 +1060,17 @@
                         return objJsonResult;
                     }
                     //=========================================================
+
+                    //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    DateTime HDate = DateTime.Now;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.Message = s;
+                        return objJsonResult;
+                    }
 
                     //鍙嶅鏍告彁浜bandonCheck
                     if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Cg_POInStockBackBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
@@ -1202,6 +1251,182 @@
         }
         #endregion
 
+        #region 閫�鏂欓�氱煡鍗� 琛屽叧闂�/琛屽弽鍏抽棴
+        /// <summary>
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="IsAudit">鍏抽棴(0),鍙嶅叧闂�(1)</param>
+        /// <param name="CurUserName">鍏抽棴浜�</param>
+        /// <returns></returns>
+        [Route("Cg_POInStockBackBill/CloseRowCg_POInStockBackBill")]
+        [HttpGet]
+        public object CloseRowCg_POInStockBackBill(int HInterID, int HEntryID, int IsAudit, string CurUserName)
+        {
+            string ModRightNameCheck = "Cg_POInStockBackBill_Close";
+            string SubBillName = "Cg_POInStockBackBillSub";                   //瀛愯〃琛ㄥ悕
+            DBUtility.ClsPub.CurUserName = CurUserName;
+            DataSet ds = null;
+            try
+            {
+                //妫�鏌ユ潈闄�
+                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "琛屽叧闂け璐ワ紒鏃犳潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //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.ClsCg_POInStockBackBill oBill = new DAL.ClsCg_POInStockBackBill();              //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+                {
+                    if (oBill.omodel.HDeleteMan.Trim() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜琛屽叧闂紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (oBill.omodel.HCloseMan.Trim() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘杩涜琛屽叧闂紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (oBill.omodel.HChecker.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜琛屽叧闂紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    string sql = "select * from " + SubBillName + " where HInterID = " + HInterID + " and HEntryID = " + HEntryID;
+                    ds = oCN.RunProcReturn(sql, "Cg_POInStockBackBillSub");
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "璇ヨ鏁版嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (IsAudit == 0)  //琛屽叧闂垽鏂�
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "琛屽凡鍏抽棴!涓嶈兘鍐嶆琛屽叧闂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //琛屽弽鍏抽棴鍒ゆ柇
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "琛屾湭鍏抽棴!涓嶉渶瑕佸啀琛屽弽鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+
+                        //鍒ゆ柇琛屾槸鍚︿负鑷姩鍏抽棴
+                        string temp = ds.Tables[0].Rows[0]["HCloseType"].ToString();
+                        if (ds.Tables[0].Rows[0]["HCloseType"].ToString() == "False")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "琛屽弽鍏抽棴澶辫触!琛屼负鑷姩鍏抽棴锛屼笉鑳借繘琛屾墜鍔ㄥ弽鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                //杩涜闇�瑕佽繘琛岀殑琛屽叧闂�/琛屽弽鍏抽棴鎿嶄綔
+                if (IsAudit == 0) //琛屽叧闂彁浜�
+                {
+                    //琛屽叧闂彁浜�
+                    if (oBill.CloseRow(lngBillKey, HEntryID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        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;
+                    }
+                }
+                if (IsAudit == 1) //琛屽弽鍏抽棴鎻愪氦
+                {
+                    //琛屽弽鍏抽棴鎻愪氦
+                    if (oBill.CancelRow(lngBillKey, HEntryID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        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;
+                    }
+                }
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍏抽棴澶辫触鎴栬�呭弽鍏抽棴澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region 閫�鏂欓�氱煡鍗� 浣滃簾/鍙嶄綔搴熷姛鑳�
         [Route("Cg_POInStockBackBill/DropCg_POInStockBackBill")]
         [HttpGet]
@@ -1332,7 +1557,42 @@
         }
         #endregion
 
+        #region 閫�鏂欓�氱煡鍗� 鏍规嵁涓诲唴鐮佷笌瀛愬唴鐮佽幏鍙栭��鏂欓�氱煡鍗曟暟鎹�
+        [Route("Cg_POInStockBackBill/loadCg_POInStockBackBill_Push")]
+        [HttpGet]
+        public object loadCg_POInStockBackBill_Push(long HInterID, long HSubID)
+        {
+            try
+            {
 
+                ds = oCN.RunProcReturn("select * from h_v_IF_POInStockBackBillList where hmainid =" + HInterID + " and hsubid = " + HSubID, "h_v_IF_POInStockBackBillList");
+                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
     }
 }
 #endregion
\ No newline at end of file

--
Gitblit v1.9.1