From aedc81d40157133df8b5c44d3fbabc803a0e6e75 Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期六, 13 九月 2025 11:42:42 +0800 Subject: [PATCH] 切换测试库地址 --- WebApi/Gs.Wom/WorkService/WorkCollectController.cs | 240 +++++++++++++++++++++++++++++------------------------------- 1 files changed, 116 insertions(+), 124 deletions(-) diff --git a/WebApi/Gs.Wom/WorkService/WorkCollectController.cs b/WebApi/Gs.Wom/WorkService/WorkCollectController.cs index 2fab50b..9d5bf87 100644 --- a/WebApi/Gs.Wom/WorkService/WorkCollectController.cs +++ b/WebApi/Gs.Wom/WorkService/WorkCollectController.cs @@ -1,7 +1,6 @@ 锘縰sing System.Data; using System.Data.SqlClient; using System.Dynamic; -using System.Text; using Gs.Toolbox; using Gs.Toolbox.ApiCore.Abstract.Mvc; using Gs.Toolbox.ApiCore.Common.Mvc; @@ -10,142 +9,135 @@ using Microsoft.AspNetCore.Mvc; using static Gs.Toolbox.UtilityHelper; -namespace Gs.Wom.WorkService; - -[ApiGroup(ApiGroupNames.WOM)] -public class WorkCollectController : IRomteService +namespace Gs.Wom.WorkService { - private readonly IHttpContextAccessor _http; - private readonly string _userCode, _userGuid, _orgFids; - public WorkCollectController(IHttpContextAccessor httpContextAccessor) + [ApiGroup(ApiGroupNames.WOM)] + public class WorkCollectController : IRomteService { - _http = httpContextAccessor; - (_userCode, _userGuid, _orgFids) = - GetUserGuidAndOrgGuid(_http); - } - - #region - - /// <summary> - /// 璇诲彇锛岄噰闆�,閲囬泦鐨勬椂鍊欒繑鍥炲垪琛� - /// </summary> - /// <param name="guid"></param> - /// <returns></returns> - [RequestMethod(RequestMethods.POST)] - public ReturnDto<ExpandoObject> GetModel([FromBody] dynamic model) - { - string barCode = model.barCode.ToString(); //杩芥函鐮� - string processNo = model.processNo; //宸ュ簭 - string banCi = model.banCi; //鐝 - string gongWei = model.gongWei; //宸ヤ綅 - string checkResult = model.checkResult; //缁撴灉 - string badDescription = model.badDescription; //涓嶈壇鎻忚堪 - string collectGuid = model.collectGuid; - //姘存鍊� - string t001 = model.t001; - string t002 = model.t002; - string t003 = model.t003; - string t004 = model.t004; - string t005 = model.t005; - string t006 = model.t006; - string t007 = model.t007; - string t008 = model.t008; - string t009 = model.t009; - string t010 = model.t010; - string t011 = model.t011; - string t012 = model.t012; - string t013 = model.t013; - dynamic m = new ExpandoObject(); - m.list = new List<dynamic>(); - m.list2 = new List<dynamic>(); - m.list3 = new List<dynamic>(); - m.outMsg = ""; - m.outSum = -1; - var _strMsg = ""; - var _sum = 0; - SqlParameter[] parameters = + private readonly IHttpContextAccessor _http; + private readonly string _userCode, _userGuid, _orgFids; + public WorkCollectController(IHttpContextAccessor httpContextAccessor) { - new("@inP3", checkResult), - new("@inP4", barCode), - new("@inEdtUserGuid", _userGuid), - new("@processNo", processNo), - new("@banCi", banCi), - new("@gongWei", gongWei), - new("@badDescription", badDescription), - new("@t001", t001), - new("@t002", t002), - new("@t003", t003), - new("@t004", t004), - new("@t005", t005), - new("@t006", t006), - new("@t007", t007), - new("@t008", t008), - new("@t009", t009), - new("@t010", t010), - new("@t011", t011), - new("@t012", t012), - new("@t013", t013), - new("@collectGuid", collectGuid) - }; - var dset = new DataSet(); - try + _http = httpContextAccessor; + (_userCode, _userGuid, _orgFids) = + GetUserGuidAndOrgGuid(_http); + } + #region + /// <summary> + /// 璇诲彇锛岄噰闆�,閲囬泦鐨勬椂鍊欒繑鍥炲垪琛� + /// </summary> + /// <param name="guid"></param> + /// <returns></returns> + [RequestMethod(RequestMethods.POST)] + public ReturnDto<ExpandoObject> GetModel([FromBody] dynamic model) { - dset = DbHelperSQL.RunProcedure("[work_collect_mx]", - parameters, "0"); - if (dset != null && dset.Tables.Count > 0 && - dset.Tables[0].Rows.Count > 0) + string barCode = model.barCode.ToString();//杩芥函鐮� + string processNo = model.processNo;//宸ュ簭 + string banCi = model.banCi;//鐝 + string gongWei = model.gongWei;//宸ヤ綅 + string checkResult = model.checkResult; //缁撴灉 + string badDescription = model.badDescription;//涓嶈壇鎻忚堪 + string collectGuid = model.collectGuid; + //姘存鍊� + string t001 = model.t001; + string t002 = model.t002; + string t003 = model.t003; + string t004 = model.t004; + string t005 = model.t005; + string t006 = model.t006; + string t007 = model.t007; + string t008 = model.t008; + string t009 = model.t009; + string t010 = model.t010; + string t011 = model.t011; + string t012 = model.t012; + string t013 = model.t013; + dynamic m = new ExpandoObject(); + m.list = new List<dynamic>(); + m.list2 = new List<dynamic>(); + m.list3 = new List<dynamic>(); + m.outMsg = ""; + m.outSum = -1; + string _strMsg = ""; + int _sum = 0; + SqlParameter[] parameters = { - //0杩斿洖娑堟伅鍜岃繑鍥炲�� - _strMsg = dset.Tables[0].Rows[0]["outMsg"].ToString(); - _sum = int.Parse(dset.Tables[0].Rows[0]["outSum"].ToString()); - //1缁熻鍜屽ご琛� - if (dset.Tables.Count > 1 && dset.Tables[1].Rows.Count > 0) + new("@inP3",checkResult), + new("@inP4", barCode), + new("@inEdtUserGuid", _userGuid), + new("@processNo",processNo), + new("@banCi",banCi), + new("@gongWei",gongWei), + new("@badDescription",badDescription), + new("@t001",t001), + new("@t002",t002), + new("@t003",t003), + new("@t004",t004), + new("@t005",t005), + new("@t006",t006), + new("@t007",t007), + new("@t008",t008), + new("@t009",t009), + new("@t010",t010), + new("@t011",t011), + new("@t012",t012), + new("@t013",t013), + new("@collectGuid",collectGuid), + }; + var dset = new DataSet(); + try + { + dset = DbHelperSQL.RunProcedure("[work_collect_mx]", + parameters, "0"); + if (dset != null && dset.Tables.Count > 0 && + dset.Tables[0].Rows.Count > 0) { - var dr = dset.Tables[1].Rows[0]; - m = dr.RowToDynamic(); + //0杩斿洖娑堟伅鍜岃繑鍥炲�� + _strMsg = dset.Tables[0].Rows[0]["outMsg"].ToString(); + _sum = int.Parse(dset.Tables[0].Rows[0]["outSum"].ToString()); + //1缁熻鍜屽ご琛� + if (dset.Tables.Count > 1 && dset.Tables[1].Rows.Count > 0) + { + var dr = dset.Tables[1].Rows[0]; + m = dr.RowToDynamic(); + } + m.outMsg = _strMsg; + m.outSum = _sum; + //2鑹搧鍒楄〃 + if (dset.Tables.Count > 2) + { + var _tb = dset.Tables[2].TableToDynamicList(); + m.list = _tb; + } + //3涓嶈壇鍝佸垪琛� + if (dset.Tables.Count > 3) + { + var _tb2 = dset.Tables[3].TableToDynamicList(); + m.list2 = _tb2; + } } - - m.outMsg = _strMsg; - m.outSum = _sum; - //2鑹搧鍒楄〃 - if (dset.Tables.Count > 2) + else { - var _tb = dset.Tables[2].TableToDynamicList(); - m.list = _tb; - } - - //3涓嶈壇鍝佸垪琛� - if (dset.Tables.Count > 3) - { - var _tb2 = dset.Tables[3].TableToDynamicList(); - m.list2 = _tb2; + m.outMsg = "娌℃湁鎵惧埌璇ユ潯鐮侊紒"; + m.outSum = -1; } } - else + catch (Exception ex) { - m.outMsg = "娌℃湁鎵惧埌璇ユ潯鐮侊紒"; + System.Text.StringBuilder sbLog = new System.Text.StringBuilder(); + sbLog.Append("_userGuid:" + _userGuid.ToString()); + sbLog.Append("processNo:" + processNo.ToString()); + sbLog.Append("gongWei:" + gongWei.ToString()); + sbLog.Append("inP4:" + barCode); + LogHelper.Debug(this.ToString(), ex.Message + ":" + sbLog.ToString()); + m.outMsg = ex.Message; m.outSum = -1; } + if (m.outSum > 0) + return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, m.outMsg); + return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Exception, m.outMsg); } - catch (Exception ex) - { - var sbLog = new StringBuilder(); - sbLog.Append("_userGuid:" + _userGuid); - sbLog.Append("processNo:" + processNo); - sbLog.Append("gongWei:" + gongWei); - sbLog.Append("inP4:" + barCode); - LogHelper.Debug(ToString(), ex.Message + ":" + sbLog); - m.outMsg = ex.Message; - m.outSum = -1; - } - - if (m.outSum > 0) - return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, - m.outMsg); - return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Exception, - m.outMsg); + #endregion } - - #endregion -} \ No newline at end of file +} -- Gitblit v1.9.3