duhe
2023-11-09 dd6a64701b6ade18e1a4742deac10f21bedb723c
WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
@@ -1289,6 +1289,8 @@
        {
            try
            {
                string s = "";
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Xs_SeOrderBill_Drop", 1, false, user))
                {
@@ -1307,6 +1309,25 @@
                    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;
                }
                oCN.BeginTran();
@@ -1758,5 +1779,106 @@
            }
        }
        #endregion
        #region 销售订单 根据客户获取币别、汇率、结算方式
        [Route("Xs_SeOrderBill/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
                            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
                            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
        #region 销售订单 根据用户获取销售员、销售部门、销售主管
        [Route("Xs_SeOrderBill/getCzyglByUser")]
        [HttpGet]
        public object getCzyglByUser(string CurUserName)
        {
            try
            {
                string sql = @"select
                            c.HEmpID
                            ,e.HName HEmpName
                            ,c.HDeptID
                            ,d.HName HDeptName
                            ,d.HEmpID HManagerID
                            ,e1.HName HManagerName
                            from Gy_Czygl as c
                            left join Gy_Employee as e on c.HEmpID = e.HItemID
                            left join Gy_Department as d on c.HDeptID = d.HItemID
                            left join Gy_Employee as e1 on d.HEmpID = e1.HItemID
                            where c.Czymc = '" + CurUserName + "'";
                ds = oCN.RunProcReturn(sql, "Gy_Czygl");
                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
    }
}