WebAPI/Controllers/LMESController.cs
@@ -7,6 +7,7 @@
using System.Data;
using System.Data.SqlClient;
using System.Web.Http;
using System.Windows.Forms;
using WebAPI.Models;
namespace WebAPI.Controllers
{
@@ -16,6 +17,7 @@
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        /// <summary>
        /// 返回进站扫描列表|工序进站接收单列表 
        ///参数:string sql。
@@ -71,8 +73,23 @@
                    return objJsonResult;
                }
                //获取系统参数
                string Ret = "";
                if (oSystemParameter.ShowBill(ref Ret))
                {
                    //判断客户为龙山汽配
                    if (oSystemParameter.omodel.WMS_CampanyName == "龙山汽配")
                    {
                        //获取需要拼接的字符串
                        string sql_splice = DBUtility.ClsPub.SpliceSQL(user, "工序派工单列表");
                        sWhere += sql_splice;
                    }
                }
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillQuery where 1 = 1 " + sWhere + " order by hmainid desc ", "h_v_Sc_ProcessExchangeBillQuery");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
@@ -151,6 +168,21 @@
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                //获取系统参数
                string Ret = "";
                if (oSystemParameter.ShowBill(ref Ret))
                {
                    //判断客户为龙山汽配
                    if (oSystemParameter.omodel.WMS_CampanyName == "龙山汽配")
                    {
                        //获取需要拼接的字符串
                        string sql_splice = DBUtility.ClsPub.SpliceSQL(user, "工序派工单明细列表");
                        sWhere += sql_splice;
                    }
                }
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeIssueBillQuery where 1 = 1 " + sWhere + " order by hmainid desc ", "h_v_Sc_ProcessExchangeIssueBillQuery");
                objJsonResult.code = "1";
@@ -372,14 +404,33 @@
                    return objJsonResult;
                }
                //获取系统参数
                string Ret = "";
                if (oSystemParameter.ShowBill(ref Ret))
                {
                    //判断客户为龙山汽配
                    if (oSystemParameter.omodel.WMS_CampanyName == "龙山汽配")
                    {
                        //获取需要拼接的字符串
                        string sql_splice = DBUtility.ClsPub.SpliceSQL(user,"工艺路线列表");
                        sWhere += sql_splice;
                    }
                }
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_Gy_RoutingBillList order by hmainid desc", "h_v_Gy_RoutingBillList");
                    ds = oCN.RunProcReturn("select * from h_v_Gy_RoutingBillList where 1 = 1" + sWhere + " order by hmainid desc", "h_v_Gy_RoutingBillList");
                }
                else
                {
                    string sql1 = "select * from h_v_Gy_RoutingBillList where 1 = 1 ";
                    //客户自定义
                    if (oSystemParameter.omodel.WMS_CampanyName == "瑞与祺")
                    {
                         sql1 = "select top 1000 * from h_v_Gy_RoutingBillList where 1 = 1 ";
                    }
                    string sql = sql1 + sWhere + " order by hmainid desc,cast(工序号 as int)";
                    ds = oCN.RunProcReturn(sql, "h_v_Gy_RoutingBillList");
                }
@@ -395,6 +446,100 @@
            return GetObjectJson(ds);
        }
        #endregion
        #region 查看工艺路线列表工价权限
        /// <summary>
        /// 判断有无查看工价权限
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Web/CheckProcPrice")]
        [HttpGet]
        public object CheckProcPrice(string UserName)
        {
            try
            {
                //获取系统参数
                string Ret = "";
                if (oSystemParameter.ShowBill(ref Ret))
                {
                    //判断客户为龙山汽配
                    if (oSystemParameter.omodel.WMS_CampanyName == "龙山汽配")
                    {
                        //判断是否有查询工价权限
                        if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_CheckProcPrice", 1, false, UserName))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "无查看工价权限!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "查看成功!";
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "异常!" + e.Message;
                objJsonResult.data = null;
                return objJsonResult; ;
            }
        }
        #endregion
        #region 修改工艺路线工价权限
        /// <summary>
        /// 判断有无修改工价权限
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Web/EditProcPrice")]
        [HttpGet]
        public object EditProcPrice(string UserName)
        {
            try
            {
                //获取系统参数
                string Ret = "";
                if (oSystemParameter.ShowBill(ref Ret))
                {
                    //判断客户为龙山汽配
                    if (oSystemParameter.omodel.WMS_CampanyName == "龙山汽配")
                    {
                        //判断是否有查询工价权限
                        if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_EditProcPrice", 1, false, UserName))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "无修改工价权限!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "修改成功!";
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "异常!" + e.Message;
                objJsonResult.data = null;
                return objJsonResult; ;
            }
        }
        #endregion
        #region 工艺路线  删除
@@ -410,6 +555,7 @@
            string ModRightNameCheck = "Gy_RoutingBill_Drop";
            try
            {
                string HComputerName = SystemInformation.ComputerName; //设备名称
                //删除权限
                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, user))
                {
@@ -430,7 +576,7 @@
                    return objJsonResult;
                }
                oCN.BeginTran();//开始事务
                ds = oCN.RunProcReturn("select * from Gy_RoutingBillmain where HInterID=" + lngBillKey, "Gy_RoutingBillmain");
                ds = oCN.RunProcReturn("select * from Gy_RoutingBillMain where HInterID=" + lngBillKey, "Gy_RoutingBillmain");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
@@ -459,6 +605,10 @@
                //}
                oCN.RunProc("delete from Gy_RoutingBillmain where HInterID=" + lngBillKey);
                oCN.RunProc("delete from Gy_RoutingBillSub where HInterID=" + lngBillKey);
                LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",删除工艺路线单据:" + ds.Tables[0].Rows[0]["HBillNo"].ToString());
                oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "删除工艺路线单据:" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','LMES-工艺路线模块','" + DBUtility.ClsPub.IPAddress + "','删除单据'", ref DBUtility.ClsPub.sExeReturnInfo);
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
@@ -623,6 +773,20 @@
                    return objJsonResult;
                }
                //获取系统参数
                string Ret = "";
                if (oSystemParameter.ShowBill(ref Ret))
                {
                    //判断客户为龙山汽配
                    if (oSystemParameter.omodel.WMS_CampanyName == "龙山汽配")
                    {
                        //获取需要拼接的字符串
                        string sql_splice = DBUtility.ClsPub.SpliceSQL(user, "生产订单列表");
                        sWhere += sql_splice;
                    }
                }
                ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where 1 = 1 " + sWhere + " order by 制单日期 desc,单据号 desc", "h_v_IF_ICMOBillList");
            }
            catch (Exception e)