| | |
| | | //进行需要进行的审核/反审核操作 |
| | | if (IsAudit == 0) //审核提交 |
| | | { |
| | | 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 = "收款单折扣后金额小于源单-特批申请单的欠缺金额,无法关闭源单-特批申请单!"; |
| | | } |
| | | else |
| | | { |
| | | //反写源单-特批申请单单据状态 |
| | | sql = "update Xs_ExceptiveCheckRequestBillMain set HBillStatus = 3 where HInterID = " + oBill.omodel.HMainSourceInterID; |
| | | oCN.RunProc(sql); |
| | | } |
| | | } |
| | | |
| | | //审核提交 |
| | | if (oBill.CheckBill(lngBillKey, 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; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); |