1
yangle
2023-10-26 dfaeb9635591ed4b13f0ae265022872b081c0758
WebAPI/Controllers/LMESController.cs
@@ -58,20 +58,35 @@
        /// </summary>
        [Route("LEMS/MES_Sc_ProcessExchangeBillQuery_Json")]
        [HttpGet]
        public object MES_Sc_ProcessExchangeBillList_Json(string sWhere, string user)
        public object MES_Sc_ProcessExchangeBillList_Json(string sWhere, string user,string HBillSubType)
        {
            DataSet ds;
            try
            {
                List<object> columnNameList = new List<object>();
                //判断是否有查询权限
                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Query", 1, false, user))
                if (HBillSubType == "SUB")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查询权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                    //判断是否有查询权限
                    if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_SubQuery", 1, false, user))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "指引卡无查询权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else {
                    //判断是否有查询权限
                    if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Query", 1, false, user))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "流转卡无查询权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                //获取系统参数
@@ -159,7 +174,7 @@
                    }
                    SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                    ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillList where 1 = 1 " + sWhere + " order by hmainid desc ", "h_v_Sc_ProcessExchangeBillList");
                    ds = oCN.RunProcReturn("select top 1000 * from h_v_Sc_ProcessExchangeBillList where 1 = 1 " + sWhere + " order by hmainid desc ", "h_v_Sc_ProcessExchangeBillList");
                }
                else 
                {
@@ -211,11 +226,21 @@
        {
            DataSet ds;
            DataSet ds1;
            DataSet ds2;
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Sub_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "指引卡无编辑权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var HNum = HInterID_S.Split(',');
                oCN.BeginTran();
                for (int j = 0; j < HNum.Length; j++)
                {
@@ -236,12 +261,21 @@
                    string HMaterID = ds.Tables[0].Rows[0]["HMaterID"].ToString();
                    string HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString();
                    ds2 = oCN.RunProcReturn(@"select  a.HMaterID,a.HMainProcID,b.* from Gy_RoutingBillMain a    inner join Gy_RoutingBillSub b on a.HInterID=b.HInterID where a.HMaterID=" + HMaterID + " and a.HMainProcID=" + HProcID + " and a.HBillSubType='SUB'", "Gy_RoutingBillMain");
                    if (ds2.Tables[0].Rows.Count == 0)
                    {
                        long HGYInterID = DBUtility.ClsPub.CreateBillID("3301", ref DBUtility.ClsPub.sExeReturnInfo);
                        string HGYBillNo = DBUtility.ClsPub.CreateBillCode("3301", ref DBUtility.ClsPub.sExeReturnInfo, true);
                        oCN.RunProc("exec h_p_gy_Materl_PG " + HGYInterID + ",'" + HGYBillNo + "'," + HMaterID);
                    }
                    ds1 = oCN.RunProcReturn(@"select  a.HMaterID,a.HMainProcID,b.* from Gy_RoutingBillMain a    inner join Gy_RoutingBillSub b on a.HInterID=b.HInterID where a.HMaterID=" + HMaterID + " and a.HMainProcID=" + HProcID + " and a.HBillSubType='SUB'", "Gy_RoutingBillMain");
                    if (ds1.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "没有相对应的默认工艺路线,请先设置工艺路线!";
                        objJsonResult.Message = "无默认工艺路线!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -251,8 +285,11 @@
                    DBUtility.ClsPub.HOrgID = HOrgID;
                    oBill.ShowBill(HInterID, ref sReturn);
                    oCN.BeginTran();
                    long HInterID1 = DBUtility.ClsPub.CreateBillID(oBill.omodel.HBillType, ref DBUtility.ClsPub.sExeReturnInfo);
                    string HBillNo = DBUtility.ClsPub.CreateBillCode(oBill.omodel.HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
                    HBillNo = HBillNo.Replace("GXLX", "ZYK0");
                    oBill.omodel.HInterID = HInterID1;
                    oBill.omodel.HBillNo = HBillNo;
                    oBill.omodel.HBillSubType = "SUB";
@@ -285,7 +322,6 @@
                        oBill.DetailColl.Add(oSub);
                    }
                    bool bResult = false;
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
@@ -300,9 +336,10 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    oCN.Commit();
                }
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "派工成功!";
@@ -330,6 +367,15 @@
            DataSet ds1;
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Sub_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "指引卡无编辑权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var HNum = HInterID_S.Split(',');
                oCN.BeginTran();
@@ -658,20 +704,38 @@
        /// </summary>
        [Route("LEMS/MES_Gy_RoutingBillList_Json")]
        [HttpGet]
        public object MES_Gy_RoutingBillList_Json(string sWhere, string user)
        public object MES_Gy_RoutingBillList_Json(string sWhere, string user,string HBillSubType)
        {
            DataSet ds;
            try
            {
                //判断是否有查询权限
                if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Query", 1, false, user))
                if (HBillSubType == "SUB")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限查询!";
                    objJsonResult.data = null;
                    return objJsonResult;
                    //判断是否有查询权限
                    if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Sub_Query", 1, false, user))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "子工艺路线无权限查询!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else {
                    //判断是否有查询权限
                    if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Query", 1, false, user))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "工艺路线无权限查询!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                //获取系统参数
                string Ret = "";
@@ -885,22 +949,37 @@
        /// <returns></returns>
        [Route("LEMS/DeltetGy_RoutingBillSub")]
        [HttpGet]
        public object DeltetGy_RoutingBillSub(Int64 lngBillKey, string user)
        public object DeltetGy_RoutingBillSub(Int64 lngBillKey, string user,string HBillSubType)
        {
            DataSet ds;
            string ModRightNameCheck = "Gy_RoutingBill_Drop";
            try
            {
                string HComputerName = SystemInformation.ComputerName; //设备名称
                //删除权限
                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, user))
                if (HBillSubType == "SUB")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                    //删除权限
                    if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Sub_Drop", 1, false, user))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "子工艺路线删除失败!无权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else {
                    //删除权限
                    if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Drop", 1, false, user))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "工艺路线删除失败!无权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                string HComputerName = SystemInformation.ComputerName; //设备名称
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (lngBillKey == 0)
@@ -2191,19 +2270,35 @@
        #region 工艺路线审核/反审核功能
        [Route("Gy_RoutingBill/CheckGy_RoutingBill")]
        [HttpGet]
        public object CheckGy_RoutingBill(string HInterID, int Type, string user)
        public object CheckGy_RoutingBill(string HInterID, int Type, string user,string HBillSubType)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Check", 1, false, user))
                if (HBillSubType == "SUB")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限审核!";
                    objJsonResult.data = null;
                    return objJsonResult;
                    //判断是否有删除权限
                    if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Sub_Check", 1, false, user))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "子工艺路线无权限审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    //判断是否有删除权限
                    if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Check", 1, false, user))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "工艺路线无权限审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {
@@ -2310,19 +2405,35 @@
        #region 工艺路线单关闭/反关闭功能
        [Route("Gy_RoutingBill/CloseGy_RoutingBill_1")]
        [HttpGet]
        public object CloseGy_RoutingBill(string HInterID, int Type, string user)
        public object CloseGy_RoutingBill(string HInterID, int Type, string user,string HBillSubType)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Close", 1, false, user))
                if (HBillSubType == "SUB")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限关闭!";
                    objJsonResult.data = null;
                    return objJsonResult;
                    //判断是否有删除权限
                    if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Sub_Close", 1, false, user))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "子工艺路线无权限关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    //判断是否有删除权限
                    if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Close", 1, false, user))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "工艺路线无权限关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {