From 3f080b1b040f022fc1a625f5537e275ed9bb149e Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期日, 03 三月 2024 16:46:48 +0800
Subject: [PATCH] 客户余额查询报表(未完成):临时存储

---
 WebAPI/Controllers/XSGL/Kf_SellOutBillController.cs |  284 ++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 252 insertions(+), 32 deletions(-)

diff --git a/WebAPI/Controllers/XSGL/Kf_SellOutBillController.cs b/WebAPI/Controllers/XSGL/Kf_SellOutBillController.cs
index a495249..33bce9c 100644
--- a/WebAPI/Controllers/XSGL/Kf_SellOutBillController.cs
+++ b/WebAPI/Controllers/XSGL/Kf_SellOutBillController.cs
@@ -276,7 +276,6 @@
             string user = sArray[2].ToString();
             string OperationType = sArray[3].ToString();
 
-            string UserName = "";
             ListModels oListModels = new ListModels();
             try
             {
@@ -296,19 +295,9 @@
                 lsmain = oListModels.getSellOutBillMainByJson(msg2);
                 foreach (Model.ClsKf_SellOutBillMain oItem in lsmain)
                 {
-                    //oItem.HMaker = "";
-                    UserName = oItem.HMaker;
-                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
-                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
-                    oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));
-                    oItem.HBillType = "1205";
-                    oItem.HBillSubType = "1205";
-                    oItem.HBillStatus = 0;
-                    oItem.HPeriod = 0;
                     oItem.HMaker = user;
-                    oItem.HMainSourceInterID = oItem.HInterID;
+                    oItem.HUpDater = user;
 
-                    //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
                     if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
                     {
                         objJsonResult.code = "0";
@@ -324,50 +313,74 @@
                 msg3 = msg3.Substring(1, msg3.Length - 2);
                 msg3 = msg3.Replace("\\", "");
                 msg3 = msg3.Replace("\n", "");  //\n
-                //msg2 = msg2.Replace("'", "鈥�");
                 List<Model.ClsKf_SellOutBillSub> ls = new List<Model.ClsKf_SellOutBillSub>();
                 ls = oListModels.getSellOutBillSubByJson(msg3);
                 int i = 0;
                 foreach (Model.ClsKf_SellOutBillSub oItemSub in ls)
                 {
                     i++;
-
                     oItemSub.HEntryID = i;
-                    //oItemSub.HSourceEntryID = 0;
-                    //oItemSub.HSourceInterID = 0;
-                    //oItemSub.HSourceBillNo = "";
-                    //oItemSub.HSourceBillType = "";
-                    oItemSub.HRelationQty = 0;
-                    oItemSub.HRelationMoney = 0;
-
-                    
-                    // DBUtility.ClsPub.isDate(DateTime.Now);
                     oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                     oItemSub.HCloseType = false;
                     oItemSub.HCloseMan = "";
-                    //oItemSub.HRemark = "";
                     oBill.DetailColl.Add(oItemSub);
-
                 }
 
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 bool bResult;
-                if (Convert.ToInt32(OperationType) == 1)
+                if (Convert.ToInt32(OperationType) == 1)                                //鏂板淇濆瓨
                 {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                } else if(Convert.ToInt32(OperationType) == 4)                          //涓嬫帹淇濆瓨
+                {
                     bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                 }
-                else
+                else                                                                    //缂栬緫淇濆瓨
                 {
+                    string s = "";
+                    if (BillOld.ShowBill(lsmain[0].HInterID, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    //鍒ゆ柇鏄惁鍙紪杈�
+                    if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (BillOld.omodel.HBillStatus > 1)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s + "锛屼笉鍏佽淇敼";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+
                     bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                 }
+
                 if (bResult)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -398,7 +411,8 @@
         {
             try
             {
-                ds = oCN.RunProcReturn("select * from h_v_IF_SellOutBillList where hmainid=" + HInterID, "h_v_IF_SellOutBillList");
+                //ds = oCN.RunProcReturn("select * from h_v_IF_SellOutBillList where hmainid=" + HInterID, "h_v_IF_SellOutBillList");
+                ds = oCN.RunProcReturn("select * from h_v_IF_SellOutBillList_EditInit where hmainid=" + HInterID, "h_v_IF_SellOutBillList_EditInit");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
@@ -531,8 +545,31 @@
                         return objJsonResult;
                     }
 
+                    //瀹℃牳鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_Kf_SellOutBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Kf_SellOutBill_BeforeCheckCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //==================================================================================      
+
+
                     //瀹℃牳鎻愪氦
-                    if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_SellOutBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                     {
                         objJsonResult.code = "1";
                         objJsonResult.count = 1;
@@ -551,8 +588,30 @@
                 }
                 if (IsAudit == 1) //鍙嶅鏍告彁浜�
                 {
+                    //鍙嶅鏍稿墠鎺у埗=========================================        
+                    string sql1 = "exec h_p_Kf_SellOutBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Kf_SellOutBill_BeforeUnCheckCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+
+                    }
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //===========================================================         
+
                     //鍙嶅鏍告彁浜bandonCheck
-                    if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_SellOutBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                     {
                         objJsonResult.code = "1";
                         objJsonResult.count = 1;
@@ -863,5 +922,166 @@
             }
         }
         #endregion
+
+        #region 閿�鍞嚭搴� 鏉$爜鏄庣粏
+        /// <summary>
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <returns></returns>
+        [Route("Kf_SellOutBill/BarCodeNote")]
+        [HttpGet]
+        public object SellOutBill_BarCodeNote(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>();
+
+                string sql = "exec h_p_Kf_SellOutBillBarCodeNote " + HInterID;
+                ds = oCN.RunProcReturn(sql, "h_p_Kf_SellOutBillBarCodeNote");
+
+                //娣诲姞 鍩烘湰淇℃伅 鍒楀悕
+                foreach (DataColumn col in ds.Tables[1].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[2].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[3].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList2.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                columnNameListSum.Add(columnNameList0);
+                columnNameListSum.Add(columnNameList1);
+                columnNameListSum.Add(columnNameList2);
+
+                List<DataTable> tableList = new List<DataTable>();
+                tableList.Add(ds.Tables[1]);
+                tableList.Add(ds.Tables[2]);
+                tableList.Add(ds.Tables[3]);
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = tableList;
+                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
+
+        #region 閿�鍞嚭搴撳崟 鏍规嵁涓诲唴鐮佷笌瀛愬唴鐮佽幏鍙栭攢鍞嚭搴撳崟鏁版嵁
+        [Route("Kf_SellOutBill/loadKf_SellOutBill_Push")]
+        [HttpGet]
+        public object loadKf_SellOutBill_Push(long HInterID, long HSubID)
+        {
+            try
+            {
+
+                ds = oCN.RunProcReturn("select * from h_v_IF_SellOutBillList_EditInit where hmainid =" + HInterID + " and hsubid = " + HSubID, "h_v_IF_SellOutBillList_EditInit");
+                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
+
+        #region 閿�鍞嚭搴撳崟 妫�鏌ュ崟鎹槸鍚﹀瓨鍦�
+        /// <summary>
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <returns></returns>
+        [Route("Kf_SellOutBill/CheckSellOutBill_IsExist")]
+        [HttpGet]
+        public object CheckSellOutBill_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.ClsKf_SellOutBill oBill = new DAL.ClsKf_SellOutBill();                              //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                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
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1