1
duhe
2024-03-03 2d1dd7ea14fdf01d08ea52889037681dfb1a19cc
WebAPI/Controllers/XSGL/YS_ReceiveBillController.cs
@@ -351,10 +351,59 @@
                    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();
@@ -366,6 +415,7 @@
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
@@ -961,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
    }
}