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_ReceiveBillController.cs | 251 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 235 insertions(+), 16 deletions(-) diff --git a/WebAPI/Controllers/XSGL/YS_ReceiveBillController.cs b/WebAPI/Controllers/XSGL/YS_ReceiveBillController.cs index 77bab9f..eea8e80 100644 --- a/WebAPI/Controllers/XSGL/YS_ReceiveBillController.cs +++ b/WebAPI/Controllers/XSGL/YS_ReceiveBillController.cs @@ -38,23 +38,23 @@ { List<object> columnNameList = new List<object>(); //鏌ョ湅鏉冮檺 - //if (!DBUtility.ClsPub.Security_Log("Gy_ProjectStage_Query", 1, false, user)) - //{ - // objJsonResult.code = "0"; - // objJsonResult.count = 0; - // objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; - // objJsonResult.data = null; - // return objJsonResult; - //} + if (!DBUtility.ClsPub.Security_Log("YS_ReceiveBillQuery", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from h_v_YS_ReceiveBillList_Query order by 鍗曟嵁鍙� ", "h_v_YS_ReceiveBillList_Query"); + ds = oCN.RunProcReturn("select * from h_v_YS_ReceiveBillList_Query order by 鍗曟嵁鍙� desc", "h_v_YS_ReceiveBillList_Query"); } else { string sql1 = "select * from h_v_YS_ReceiveBillList_Query where 1 = 1 "; - string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� "; + string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc"; ds = oCN.RunProcReturn(sql, "h_v_YS_ReceiveBillList_Query"); } @@ -312,6 +312,8 @@ { try { + string s = ""; + //鏌ョ湅鏉冮檺 if (!DBUtility.ClsPub.Security_Log("YS_ReceiveBill_Drop", 1, false, user)) { @@ -331,21 +333,89 @@ return objJsonResult; } + if (BillOld.ShowBill(long.Parse(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; + } + + //鍒犻櫎鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_YS_ReceiveBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_YS_ReceiveBill_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_ReceiveBillMain where HInterID = " + HInterID); oCN.RunProc("delete from YS_ReceiveBillSub where HInterID= " + HInterID); + //鍒犻櫎鍚庢帶鍒�================================================================================== + string sql2 = "exec h_p_YS_ReceiveBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_YS_ReceiveBill_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 = "Sucess锛�"; + objJsonResult.Message = "鎮ㄥ凡鍒犻櫎鍗曟嵁鍙蜂负" + BillOld.omodel.HBillNo + "鐨勬敹娆惧崟锛�"; objJsonResult.data = null; return objJsonResult; } catch (Exception e) { + oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception锛�" + e.ToString(); @@ -449,17 +519,84 @@ //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣� if (IsAudit == 0) //瀹℃牳鎻愪氦 { - //瀹℃牳鎻愪氦 - if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + oCN.BeginTran(); + + //璁板綍杩斿洖淇℃伅 + string msg = ""; + + if(oBill.omodel.HMainSourceInterID != 0) { + //妫�楠屾簮鍗曟槸鍚﹀瓨鍦ㄥ強鍗曟嵁鐘舵�� + string sql = "select * from Xs_ExceptiveCheckRequestBillMain where HInterID = " + oBill.omodel.HMainSourceInterID; + ds = oCN.RunProcReturn(sql, "Xs_ExceptiveCheckRequestBill"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:婧愬崟-鐗规壒鐢宠鍗曚笉瀛樺湪!"; + objJsonResult.data = null; + return objJsonResult; + } + else if (ds.Tables[0].Rows[0]["HBillStatus"].ToString() != "2") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:婧愬崟-鐗规壒鐢宠鍗曟湭澶勪簬宸插鏍哥姸鎬�!"; + objJsonResult.data = null; + return objJsonResult; + } + + if( oBill.omodel.HRelSumMoney*oBill.omodel.HExRate < double.Parse( ds.Tables[0].Rows[0]["HLeftMoney"].ToString() )) + { + msg = "鏀舵鍗曟姌鎵e悗閲戦灏忎簬婧愬崟-鐗规壒鐢宠鍗曠殑娆犵己閲戦锛屾棤娉曞叧闂簮鍗�-鐗规壒鐢宠鍗�!"; + } + else + { + //鍙嶅啓婧愬崟-鐗规壒鐢宠鍗曞崟鎹姸鎬� + sql = "update Xs_ExceptiveCheckRequestBillMain set HBillStatus = 3 where HInterID = " + oBill.omodel.HMainSourceInterID; + oCN.RunProc(sql); + } + } + + //瀹℃牳鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_YS_ReceiveBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_YS_ReceiveBill_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; + oCN.RollBack(); + 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; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + //瀹℃牳鎻愪氦 + if (oBill.CheckBill(oBill.omodel.HInterID,oBill.omodel.HBillNo, "h_p_YS_ReceiveBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + oCN.Commit(); + objJsonResult.code = "1"; objJsonResult.count = 1; - objJsonResult.Message = "瀹℃牳鎴愬姛"; + objJsonResult.Message = "瀹℃牳鎴愬姛锛�" + msg; objJsonResult.data = null; return objJsonResult; } else { + oCN.RollBack(); + objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; @@ -469,8 +606,41 @@ } if (IsAudit == 1) //鍙嶅鏍告彁浜� { + string sql = "exec h_p_YS_ReceiveBill_AbandonCheckCrediControl " + oBill.omodel.HInterID; + ds = oCN.RunProcReturn(sql, "h_p_YS_ReceiveBill_AbandonCheckCrediControl"); + if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); + objJsonResult.data = null; + return objJsonResult; + } + + //鍙嶅鏍稿墠鎺у埗========================================= + string sql1 = "exec h_p_YS_ReceiveBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_YS_ReceiveBill_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_YS_ReceiveBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; @@ -491,6 +661,8 @@ } catch (Exception e) { + oCN.RollBack(); + objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString(); @@ -782,7 +954,7 @@ } #endregion - #region 鏀舵鍗� 鏍规嵁瀹㈡埛鑾峰彇甯佸埆銆佹眹鐜囥�佺粨绠楁柟寮忋�侀摱琛屻�侀摱琛岃处鎴� + #region 鏀舵鍗� 鏍规嵁瀹㈡埛鑾峰彇甯佸埆銆佹眹鐜囥�佺粨绠楁柟寮忋�侀摱琛屻�侀摱琛岃处鎴枫�佸鎴蜂俊鐢ㄩ搴� [Route("YS_ReceiveBill/getCustomerByCusID")] [HttpGet] public object getCustomerByCusID(long HCusID) @@ -802,10 +974,12 @@ ,ISNULL(b.HItemID,0) HBankID ,b.HName HBankName ,c.HBankAccount + ,ISNULL(cre.HCreditRating_Now,0) HCreditRating_Now from Gy_Customer as c left join Gy_SettleStyle as s on c.HSSID = s.HItemID left join Gy_Currency as cur on c.HCurID = cur.HItemID left join Gy_Bank as b on c.HBank = b.HName + left join Gy_Customer_Credit as cre on c.HItemID = cre.HCusID where c.HItemID = " + HCusID; ds = oCN.RunProcReturn(sql, "Gy_Customer"); @@ -837,5 +1011,50 @@ } } #endregion + + #region 鏀舵鍗� 鏍规嵁瀹㈡埛鑾峰彇鍏宠仈鑱屽憳 + [Route("YS_ReceiveBill/getRelationEmpByCusID")] + [HttpGet] + public object getRelationEmpByCusID(long HCusID) + { + try + { + string sql = @"select b.HEmpID HEmpID,e.HName HEmpName,b.HDeptID HDeptID,d.HName HDeptName,d.HEmpID HManagerID,e1.HName HManagerName + from Gy_UserCustomerRelation as a + left join Gy_Czygl as b on a.HUserID = b.Czybm + left join Gy_Employee as e on b.HEmpID = e.HItemID + left join Gy_Department as d on b.HDeptID = d.HItemID + left join Gy_Employee as e1 on d.HEmpID = e1.HItemID + where a.HCusID = " + HCusID; + ds = oCN.RunProcReturn(sql, "Gy_UserCustomerRelation"); + + + 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 } } \ No newline at end of file -- Gitblit v1.9.1