ch
2022-12-01 8806e07a66f414e5aec181de5e954d1b0c045700
WebAPI/Controllers/LMESController.cs
@@ -1,4 +1,5 @@
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
@@ -59,6 +60,7 @@
            DataSet ds;
            try
            {
                List<object> columnNameList = new List<object>();
                //判断是否有查询权限
                //if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Query", 1, false, user))
                //{
@@ -72,11 +74,19 @@
                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)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                //{
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.list = columnNameList;
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
                //}
@@ -115,6 +125,7 @@
                string sql = "select * from h_v_Sc_ProcessExchangeBillQuerySub where hmainid = ";
                string sql1 = sql + sWhere;
                ds = oCN.RunProcReturn(sql1 + " order by cast(工序号 as int)", "h_v_Sc_ProcessExchangeBillQuerySub");
                return GetObjectJson(ds);
            }
            catch (Exception e)
            {
@@ -124,7 +135,6 @@
                objJsonResult.data = null;
                return objJsonResult;
            }
            return GetObjectJson(ds);
        }
        #region 工序流转卡(下达)
@@ -174,13 +184,13 @@
        /// <returns></returns>
        [Route("LEMS/MES_Sc_ProcessExchangeIssue")]
        [HttpGet]
        public object MES_Sc_ProcessExchangeIssue(string HGroupID, string HSourceID, string HEntryId)
        public object MES_Sc_ProcessExchangeIssue(string HGroupID, string HSourceID, string HSourceSub1ID, string HSourceSub2ID, string HSourceSub3ID, string HEntryId)
        {
            DataSet ds;
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                ds = oCN.RunProcReturn($"exec REALESE_Sc_ProcessExchangeIssue '{HGroupID}','{HSourceID}','{HEntryId}' ", "REALESE_Sc_ProcessExchangeIssue");
                ds = oCN.RunProcReturn($"exec REALESE_Sc_ProcessExchangeIssue '{HGroupID}','{HSourceID}','{HSourceSub1ID}','{HSourceSub2ID}','{HSourceSub3ID}','{HEntryId}' ", "REALESE_Sc_ProcessExchangeIssue");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
@@ -196,7 +206,42 @@
                return objJsonResult;
            }
        }
        /// <summary>
        /// 工序流转卡指派日期
        /// </summary>
        /// <returns></returns>
        [Route("LEMS/MES_Sc_ProcessExchangePlanDate")]
        [HttpGet]
        public object MES_Sc_ProcessExchangePlanDate(string HPlanBeginDate, string HPlanEndDate, string HEntryId)
        {
            DataSet ds;
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                string sql = string.Format(@"
update Sc_ProcessExchangeBillSub set
HPlanBeginDate = '{0}',
HPlanEndDate = '{1}'
where cast(HInterID as varchar(20))  +'-'+  cast(HEntryID as varchar(20)) in
(
 select * from fn_Split('{2}',',')
)", HPlanBeginDate, HPlanEndDate, HEntryId);
                oCN.RunProc(sql);
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "异常!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// 工序流转卡反下达
        /// </summary>
@@ -564,11 +609,21 @@
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                //{
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.list = columnNameList;
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
                //}