From 00d963405d2d5161052934f2cb67a2b6ea0947dd Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期二, 23 四月 2024 17:14:30 +0800
Subject: [PATCH] 1.销售出库单 增加 反写源单 销售订单和发货通知单   超出 关联数量  关闭源单 2.应收单 增加  反写源单 销售出库单 和 销售订单  超出关联数量  关闭源单 3.动态获取源单增加参数 Num 0蓝单   1红单  2全部 4.销售流程的测试并完善功能; 销售订单-》发货通知单-》销售出库单-》应收单 (注意: 源单类型的下拉框 需要 根据数据库 表动态加载, 关联数量 要准确 , 审核 且 未关闭 未行关闭的行 才能下推 ,关联数量超额后,要 反写 关闭 源单 )

---
 WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs |  167 ++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 108 insertions(+), 59 deletions(-)

diff --git a/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs b/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs
index 53ab7da..8aa0c73 100644
--- a/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs
+++ b/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs
@@ -25,6 +25,17 @@
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         DataSet ds;
 
+        public class ClsYS_ReceiveOtherBillSubs 
+        {
+           
+            public Int64 HProjectMoneyIDSub;//   int	 //璐圭敤椤圭洰
+            public string HTypeSub;//   varchar(20)     --鍙戠エ绫诲瀷
+            public double HMoneySub;//  dec(18,8) //鍗曟嵁閲戦
+            public double HTaxRateSub;//  dec(18,8) //绋庣巼
+            public double HSumMoneySub;//  dec(18,8) //鎬婚噾棰�
+        }
+
+
         #region 鍏朵粬搴旀敹鍗曞垪琛� 鏌ヨ
         /// <summary>
         /// 杩斿洖椤圭洰闃舵鍒楄〃
@@ -93,9 +104,10 @@
             var _value = msg["msg"].ToString();
             string msg1 = _value.ToString();
             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
-            string msg2 = sArray[0].ToString();                             //琛ㄥご鏁版嵁
-            string refSav = sArray[1].ToString();                           //鎿嶄綔鏂瑰紡
-            string msg4 = sArray[2].ToString();                             //鐢ㄦ埛
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString(); //瀛愯〃
+            string refSav = sArray[2].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
+            string msg4 = sArray[3].ToString();//鐢ㄦ埛鍚�
 
             DBUtility.ClsPub.CurUserName = msg4;
 
@@ -187,6 +199,26 @@
                     }
                     oBill.omodel = oItem;
                 }
+                // 琛ㄤ綋鏁版嵁
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                msg3 = msg3.Substring(1, msg3.Length - 2);
+                msg3 = msg3.Replace("\\", "");
+                msg3 = msg3.Replace("\n", "");  //\n
+                List<Model.ClsYS_ReceiveOtherBillSub> ls = new List<Model.ClsYS_ReceiveOtherBillSub>();
+                ls = oListModels.getObjectByJson_YS_ReceiveOtherBillSub(msg3);
+                int i = 0;
+                foreach (Model.ClsYS_ReceiveOtherBillSub oItemSub in ls)
+                {
+                    i++;
+                    oItemSub.HEntryID = i;
+
+                   
+                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+                    
+                    oBill.DetailColl.Add(oItemSub);
+
+                }
 
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
@@ -239,7 +271,11 @@
         {
             try
             {
-                ds = oCN.RunProcReturn("select * from h_v_YS_ReceiveOtherBillMainList where hmainid=" + HInterID, "h_v_YS_ReceiveOtherBillMainList");
+                List<DataTable> tableList = new List<DataTable>();
+
+                ds = oCN.RunProcReturn("exec h_p_YS_ReceiveOtherBillMain_Edit  " + HInterID, "h_p_YS_ReceiveOtherBillMain_Edit");
+                tableList.Add(ds.Tables[0]);
+                tableList.Add(ds.Tables[1]);
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
@@ -253,7 +289,7 @@
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "Sucess锛�";
-                    objJsonResult.data = ds.Tables[0];
+                    objJsonResult.data = tableList;
                     return objJsonResult;
                 }
             }
@@ -308,7 +344,7 @@
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
-                //鍒ゆ柇鏄惁鍙紪杈�
+                //鍒ゆ柇鏄惁鍙垹闄�
                 if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
                 {
                     objJsonResult.code = "0";
@@ -317,68 +353,81 @@
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
-
-                //鍒犻櫎鍓嶆帶鍒�=========================================      
-                string sql1 = "exec h_p_YS_ReceiveOtherBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
-                ds = oCN.RunProcReturn(sql1, "h_p_YS_ReceiveOtherBill_BeforeDelCtrl");
-                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                //鍒ゆ柇鏄惁鏄垱寤虹姸鎬佽繘琛屽垹闄�
+                if (int.Parse(BillOld.omodel.HBillStatus.ToString()) <= 1)
                 {
-                    objJsonResult.code = "0";
+
+
+                    //鍒犻櫎鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_YS_ReceiveOtherBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_YS_ReceiveOtherBill_BeforeDelCtrl");
+                    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;
+                    }
+                    //==================================================================================  
+
+
+
+                    oCN.BeginTran();
+
+                    oCN.RunProc("delete from YS_ReceiveOtherBillMain where HInterID = " + HInterID);
+                    oCN.RunProc("delete from YS_ReceiveOtherBillSub where HInterID= " + HInterID);
+
+                    //鍒犻櫎鍚庢帶鍒�==================================================================================      
+                    string sql2 = "exec h_p_YS_ReceiveOtherBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql2, "h_p_YS_ReceiveOtherBill_AfterDelCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        s = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s;
+                        objJsonResult.data = null;
+                        oCN.RollBack();
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        s = ds.Tables[0].Rows[0]["HRemark"].ToString();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s;
+                        objJsonResult.data = null;
+                        oCN.RollBack();
+                        return objJsonResult;
+                    }
+                    //==============================================================================================
+
+                    oCN.Commit();
+
+                    objJsonResult.code = "1";
                     objJsonResult.count = 1;
-                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    objJsonResult.Message = "鍒犻櫎鎴愬姛";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-
-                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                else
                 {
                     objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
-                    objJsonResult.data = null;
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "姝ゅ崟鎹笉鏄垱寤虹姸鎬侊紝涓嶅厑璁稿垹闄わ紒";
+                    objJsonResult.data = 1;
                     return objJsonResult;
                 }
-                //==================================================================================  
-
-
-
-                oCN.BeginTran();
-
-                oCN.RunProc("delete from YS_ReceiveOtherBillMain where HInterID = " + HInterID);
-                oCN.RunProc("delete from YS_ReceiveOtherBillSub where HInterID= " + HInterID);
-
-                //鍒犻櫎鍚庢帶鍒�==================================================================================      
-                string sql2 = "exec h_p_YS_ReceiveOtherBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
-                ds = oCN.RunProcReturn(sql2, "h_p_YS_ReceiveOtherBill_AfterDelCtrl");
-                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
-                {
-                    s = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s;
-                    objJsonResult.data = null;
-                    oCN.RollBack();
-                    return objJsonResult;
-                }
-                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
-                {
-                    s = ds.Tables[0].Rows[0]["HRemark"].ToString();
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s;
-                    objJsonResult.data = null;
-                    oCN.RollBack();
-                    return objJsonResult;
-                }
-                //==============================================================================================
-
-                oCN.Commit();
-
-                objJsonResult.code = "1";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鍒犻櫎鎴愬姛";
-                objJsonResult.data = null;
-                return objJsonResult;
             }
             catch (Exception e)
             {

--
Gitblit v1.9.1