yusijie
2023-11-15 33cfe29fcdd731c3c759dcae74bdcfaeecd309ea
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");
                }
@@ -312,6 +312,8 @@
        {
            try
            {
                string s = "";
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("YS_ReceiveBill_Drop", 1, false, user))
                {
@@ -328,6 +330,24 @@
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID不能为空!";
                    objJsonResult.data = null;
                    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;
                }
@@ -781,5 +801,63 @@
            }
        }
        #endregion
        #region 收款单 根据客户获取币别、汇率、结算方式、银行、银行账户、客户信用额度
        [Route("YS_ReceiveBill/getCustomerByCusID")]
        [HttpGet]
        public object getCustomerByCusID(long HCusID)
        {
            try
            {
                string sql = @"select
                            c.HItemID HCusID
                            ,c.HNumber HCusNumber
                            ,c.HName HCusName
                            ,c.HSSID
                            ,s.HName HSSName
                            ,c.HCurID
                            ,cur.HName HCurName
                            ,cur.HExchangeRate HExRate
                            ,c.HTaxRate
                            ,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");
                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
    }
}