啊鑫
7 天以前 5707781039b9d902ce1d2d6727fba65bbab14574
WebApi/Gs.JJGZ/MesAttanConController.cs
@@ -1,13 +1,14 @@
using System.Data;
using System.Data.SqlClient;
using System.Dynamic;
using System.Text;
using Gs.Toolbox;
using Gs.Toolbox;
using Gs.Toolbox.ApiCore.Abstract.Mvc;
using Gs.Toolbox.ApiCore.Common.Mvc;
using Gs.Toolbox.ApiCore.Group;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Dynamic;
using System.Text;
using static Gs.Toolbox.UtilityHelper;
namespace Gs.JJGZ;
@@ -18,7 +19,6 @@
    private readonly IHttpContextAccessor _http;
    private readonly string _userCode, _userGuid, _orgFids;
    public MesAttanConController(IHttpContextAccessor httpContextAccessor)
    {
        _http = httpContextAccessor;
@@ -46,15 +46,12 @@
        m.list3 = new List<dynamic>();
        try
        {
            var parameters = new[]
            {
                new SqlParameter("@inLineNo", lineNo),
                new SqlParameter("@inDate", date),
                new SqlParameter("@inOrgId", orgId)
            };
            var dsMain = DbHelperSQL.Query(
                "EXEC prc_AttanCon_lst @inLineNo, @inDate, @inOrgId",
                parameters);
            var parameters = new[] {
                    new SqlParameter("@inLineNo", lineNo),
                    new SqlParameter("@inDate", date),
                    new SqlParameter("@inOrgId", orgId)
                };
            var dsMain = DbHelperSQL.Query("EXEC prc_AttanCon_lst @inLineNo, @inDate, @inOrgId", parameters);
            if (dsMain != null && dsMain.Tables.Count > 0)
            {
                var _tb = dsMain.Tables[0].TableToDynamicList();
@@ -73,16 +70,14 @@
        catch (Exception ex)
        {
            LogHelper.Debug(ToString(), ex.Message);
            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default,
                "读取失败!");
            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "读取失败!");
        }
        return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success,
            "读取成功!");
    }
    /// <summary>
    ///     修改
    /// 修改
    /// </summary>
    /// <param name="model"></param>
    /// <returns></returns>
@@ -97,13 +92,12 @@
        foreach (var m in model.list)
        {
            var _line = m.GUID + _split
                               + m.Hour + _split
                               + m.Reason;
                                    + m.Hour + _split
                                    + m.Reason;
            if (_sb.Length > 0)
                _sb.Append("~");
            _sb.Append(_line);
        }
        dynamic mObj = new ExpandoObject();
        mObj.outMsg = "";
        mObj.outSum = -1;
@@ -151,12 +145,10 @@
                }
            }
        }
        if (mObj.outSum <= 0)
            return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Exception,
                mObj.outMsg);
        return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success,
            mObj.outMsg);
            return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Exception, mObj.outMsg);
        return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success, mObj.outMsg);
    }
@@ -176,14 +168,14 @@
        mObj.outMsg = "";
        using (var conn = new SqlConnection(DbHelperSQL.strConn))
        {
            using (var cmd = new SqlCommand("[prc_AttanCon_count]", conn))
            {
                try
                {
                    conn.Open();
                    cmd.CommandType = CommandType.StoredProcedure;
                    var parameters = new[]
                    {
                    var parameters = new[] {
                        new SqlParameter("@inLineNo", lineNo),
                        new SqlParameter("@inDate", date),
                        new SqlParameter("@inOrgId", orgId),
@@ -208,12 +200,10 @@
                }
            }
        }
        if (mObj.outSum <= 0)
            return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Exception,
                mObj.outMsg);
        return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success,
            mObj.outMsg);
            return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Exception, mObj.outMsg);
        return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success, mObj.outMsg);
    }
    /// <summary>
@@ -234,9 +224,8 @@
        try
        {
            // 假设提交就是更新某个字段
            var sql =
                $"UPDATE MES_JJGZ_KQHZ SET check_status='{_inFieldValue}',check_date = getdate(), check_user='{_userGuid}' WHERE Line_No='{lineNo}' and attenDate = '{attenDate}'";
            var rows = DbHelperSQL.ExecuteSql(sql);
            string sql = $"UPDATE MES_JJGZ_KQHZ SET check_status='{_inFieldValue}',check_date = getdate(), check_user='{_userGuid}' WHERE Line_No='{lineNo}' and attenDate = '{attenDate}'";
            int rows = DbHelperSQL.ExecuteSql(sql);
            m.outSum = rows;
            m.outMsg = rows > 0 ? "操作成功!" : "未更新任何数据";
        }
@@ -245,10 +234,8 @@
            LogHelper.Debug(ToString(), "EditModelSubmit error:" + ex.Message);
            m.outMsg = ex.Message;
            m.outSum = -1;
            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default,
                ex.Message);
            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, ex.Message);
        }
        return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "操作成功!");
    }
@@ -261,14 +248,12 @@
    public ReturnDto<ExpandoObject> GetTimeType([FromBody] dynamic model)
    {
        dynamic m = new ExpandoObject();
        var mainTable = "MES_JJGZ_TIMETYPE";
        string mainTable = "MES_JJGZ_TIMETYPE";
        try
        {
            var sqlMain =
                "SELECT HourlyType 计时类型,HourlySalary 计时单价 FROM MES_JJGZ_JSSALARY WHERE CHECK_STATUS = 1";
            string sqlMain = $"SELECT HourlyType 计时类型,HourlySalary 计时单价 FROM MES_JJGZ_JSSALARY WHERE CHECK_STATUS = 1";
            var dsMain = DbHelperSQL.Query(sqlMain);
            if (dsMain != null && dsMain.Tables.Count > 0 &&
                dsMain.Tables[0].Rows.Count > 0)
            if (dsMain != null && dsMain.Tables.Count > 0 && dsMain.Tables[0].Rows.Count > 0)
            {
                var _tb = dsMain.Tables[0].TableToDynamicList();
                m.list = _tb;
@@ -278,10 +263,8 @@
        {
            LogHelper.Debug(ToString(), ex.Message);
        }
        if (m != null)
            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success,
                "读取成功!");
            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "读取成功!");
        return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "读取失败!");
    }
@@ -296,11 +279,9 @@
        dynamic m = new ExpandoObject();
        try
        {
            var sqlMain =
                "select line_no 产线,name 产线名称 from MES_WORKSHOP_LINE WHERE line_no IN (SELECT Line_No FROM Mes_DepartmentToLine )";
            string sqlMain = $"select line_no 产线,name 产线名称 from MES_WORKSHOP_LINE WHERE line_no IN (SELECT Line_No FROM Mes_DepartmentToLine )";
            var dsMain = DbHelperSQL.Query(sqlMain);
            if (dsMain != null && dsMain.Tables.Count > 0 &&
                dsMain.Tables[0].Rows.Count > 0)
            if (dsMain != null && dsMain.Tables.Count > 0 && dsMain.Tables[0].Rows.Count > 0)
            {
                var _tb = dsMain.Tables[0].TableToDynamicList();
                m.list = _tb;
@@ -310,10 +291,10 @@
        {
            LogHelper.Debug(ToString(), ex.Message);
        }
        if (m != null)
            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success,
                "读取成功!");
            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "读取成功!");
        return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "读取失败!");
    }
}