WebAPI/Controllers/XSGL/YS_ReceiveBillController.cs
@@ -49,12 +49,12 @@
                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");
                }
@@ -469,17 +469,60 @@
                //进行需要进行的审核/反审核操作
                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;
@@ -489,6 +532,17 @@
                }
                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;
                    }
                    //反审核提交AbandonCheck
                    if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
@@ -511,6 +565,8 @@
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
@@ -802,7 +858,7 @@
        }
        #endregion
        #region 收款单 根据客户获取币别、汇率、结算方式、银行、银行账户
        #region 收款单 根据客户获取币别、汇率、结算方式、银行、银行账户、客户信用额度
        [Route("YS_ReceiveBill/getCustomerByCusID")]
        [HttpGet]
        public object getCustomerByCusID(long HCusID)
@@ -822,10 +878,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");