zzr99
2022-02-10 dac1d793ad118eebf9048588a356ae0ea8a3aa95
WebAPI/Controllers/Éú²ú¹ÜÀí/±¨¹¤Ì¨¹¤Ðò/Sc_QualityReportStepBillController.cs
@@ -6,6 +6,7 @@
using System.Data;
using System.Data.SqlClient;
using System.Web.Http;
using ViewAPI;
using WebAPI.Models;
namespace WebAPI.Controllers
@@ -25,18 +26,28 @@
        #region è¿”回生产质量汇报单列表
        [Route("Sc_QualityReportStepBill/list")]
        [HttpGet]
        public object list(string sWhere)
        public object list(string sWhere,string user)
        {
            try
            {
                //判断是否有查询权限
                if (!DBUtility.ClsPub.Security_Log("Sc_QualityReportBill_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限查询!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_Sc_QualityReportBillListDetail " + sWhere, "h_v_Sc_QualityReportBillListDetail");
                    ds = oCN.RunProcReturn("select * from h_v_Sc_QualityReportBillListDetail order by hmainid desc ", "h_v_Sc_QualityReportBillListDetail");
                }
                else
                {
                    string sql1 = "select * from h_v_Sc_QualityReportBillListDetail where 1 = 1 ";
                    string sql = sql1 + sWhere;
                    string sql = sql1 + sWhere+ " order by hmainid desc ";
                    ds = oCN.RunProcReturn(sql, "h_v_Sc_QualityReportBillListDetail");
                }
                if (ds == null || ds.Tables[0].Rows.Count == 0)
@@ -87,8 +98,11 @@
                    ds = oCN.RunProcReturn
                        ("select a.HInterID,a.HBillType,a.HICMOBillNo,a.HICMOInterID,a.HMaterID" +
                        ",m.HNumber HMaterNumber,m.HName HMaterName,m.HModel HMaterModel,a.HICMOEntryID " +
                        ",a.HProcID,p.HNumber HProcNo,p.HName HProcName,a.HSourceID,s.HNumber HSourceNumber,s.HName HSourceName " +
                        " from Sc_ICMOBillStatus_Tmp a " +
                        " left join Gy_Material m on a.HMaterID=m.HItemID " +
                        " left join Gy_Process  p on a.HProcID=p.HItemID " +
                        " left join Gy_Source s on a.HSourceID=s.HItemID " +
                        " Where a.HInterID=" + HInterID + " and a.HBillType="+ HBillType, "Sc_ICMOBillStatus_Tmp");
                }
                if (ds == null || ds.Tables[0].Rows.Count == 0)
@@ -255,21 +269,21 @@
        #region è´¨é‡æ±‡æŠ¥å•列表删除按钮
        [Route("Sc_QualityReportStepBill/DeltetSc_QualityReportBill")]
        [HttpGet]
        public object DeltetSc_QualityReportBill(long HItemID)
        public object DeltetSc_QualityReportBill(long HItemID,string user)
        {
            DataSet ds;
            DataSet ds1;
            try
            {
                //删除权限
                //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName))
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "审核失败!无权限!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                if (!DBUtility.ClsPub.Security_Log("Sc_QualityReportBill_Drop", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (HItemID == 0)
@@ -281,8 +295,8 @@
                    return objJsonResult;
                }
                oCN.BeginTran();//开始事务
                ds = oCN.RunProcReturn("select * from Sc_QualityReportBillMain where hmainid=" + HItemID, "Sc_QualityReportBillMain");
                ds1 = oCN.RunProcReturn("select * from Sc_QualityReportBillSub where hmainid=" + HItemID, "Sc_QualityReportBillSub");
                ds = oCN.RunProcReturn("select * from Sc_QualityReportBillMain where HInterID=" + HItemID, "Sc_QualityReportBillMain");
                ds1 = oCN.RunProcReturn("select * from Sc_QualityReportBillSub where HInterID=" + HItemID, "Sc_QualityReportBillSub");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
@@ -310,18 +324,18 @@
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                string HUseFlag = Convert.ToString(ds.Tables[0].Rows[0]["HUseFlag"]);
                if (HUseFlag == "已使用")
                string HBillStatus = Convert.ToString(ds.Tables[0].Rows[0]["HBillStatus"]);
                if (HBillStatus == "2")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "此项目已使用,不能删除!";
                    objJsonResult.Message = "此项目已审核,不能删除!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.RunProc("delete from Sc_QualityReportBillMain where hmainid=" + HItemID);
                oCN.RunProc("delete from Sc_QualityReportBillSub where hmainid=" + HItemID);
                oCN.RunProc("delete from Sc_QualityReportBillMain where HInterID=" + HItemID);
                oCN.RunProc("delete from Sc_QualityReportBillSub where HInterID=" + HItemID);
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
@@ -618,6 +632,16 @@
        {
            try
            {
                //判断是否有编辑权限
                if (!DBUtility.ClsPub.Security_Log("Sc_QualityReportBill_Edit", 1, false, HChecker))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限编辑!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                bool bResult2 = false;
                oCN.BeginTran();