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 System.Data; using System.Data.SqlClient; using System.Drawing; using System.Drawing.Imaging; using System.Dynamic; using static Gs.Toolbox.UtilityHelper; namespace Gs.Wom.WorkService { [ApiGroup(ApiGroupNames.WOM)] public class KanBanController : IRomteService { private readonly IHttpContextAccessor _http; private readonly string _userCode, _userGuid, _orgFids; public KanBanController(IHttpContextAccessor httpContextAccessor) { _http = httpContextAccessor; (_userCode, _userGuid, _orgFids) = GetUserGuidAndOrgGuid(_http); } /// /// 读取列表,支持分页 /// /// /// [RequestMethod(RequestMethods.POST)] public ReturnDto> GetLaTouListPage([FromBody] dynamic model) { int currentPage = model.currentPage; int everyPageSize = model.everyPageSize; string sortName = model.sortName; string keyWhere = model.keyWhere; SqlParameter[] parameters = { new("@inCurrentPage", currentPage), new("@inEveryPageSize", everyPageSize), new("@inSortName", sortName), new("@inSortOrder", ""), new("@inQueryWhere", keyWhere), new("@inFid", ""), new("@inP1", ""), new("@inP2", ""), new("@inP3", ""), new("@inP4", "") }; var dset = new DataSet(); var _pglist = new PageList { total = 0, everyPageSize = 0, pages = 0, list = new List() }; try { dset = DbHelperSQL.RunProcedure("kanban_latou_lst", parameters, "0"); if (dset != null && dset.Tables.Count > 0 && dset.Tables[0].Rows.Count > 0) //有数据 { var intTotal = int.Parse(dset.Tables[1].Rows[0]["intTotal"].ToString()); var pages = intTotal % everyPageSize != 0 ? intTotal / everyPageSize + 1 : intTotal / everyPageSize; _pglist.total = intTotal; _pglist.everyPageSize = everyPageSize; _pglist.pages = pages; var _dy = dset.Tables[0].TableToDynamicList(); _pglist.list = _dy; } } catch (Exception ex) { LogHelper.Debug(ToString(), ex.Message); return ReturnDto>.QuickReturn(_pglist, ReturnCode.Exception, ex.Message); } return ReturnDto>.QuickReturn(_pglist, ReturnCode.Success, "读取成功"); } /// /// 读取 /// /// /// [RequestMethod(RequestMethods.POST)] public ReturnDto GetLaTouModel([FromBody] dynamic model) { string guid = model.guid.ToString(); dynamic m = new ExpandoObject(); m.tb0 = new ExpandoObject(); m.tb1 = new List(); m.tb2 = new List(); m.tb3 = new List(); m.tb4 = new List(); m.tb5 = new List(); m.tb6 = new List(); m.tb7 = new ExpandoObject(); m.tb8 = new ExpandoObject(); m.tb9 = new ExpandoObject(); m.tb10 = new List(); m.tb11 = new List(); m.tb12 = new List(); m.tb13 = new List();//产能图时间段 m.tb14 = new ExpandoObject();//下一指令 SqlParameter[] parameters = { new("@inMainGuid", guid), new("@inLineId", ""), }; var dset = new DataSet(); try { dset = DbHelperSQL.RunProcedure("[kanban_latou]", parameters, "0"); if (dset != null && dset.Tables.Count > 0 && dset.Tables[0].Rows.Count > 0) { //--@0主表信息 var _tb0 = dset.Tables[0].Rows[0]; m.tb0 = _tb0.RowToDynamic(); // --@1在制品明细 var _tb1 = dset.Tables[1].TableToDynamicList(); m.tb1 = _tb1; // --@2产能图柱 var _tb2 = dset.Tables[2].TableToDynamicList(); m.tb2 = _tb2; // --@3标准产能 var _tb3 = dset.Tables[3].TableToDynamicList(); m.tb3 = _tb3; // --@4标准下线 var _tb4 = dset.Tables[4].TableToDynamicList(); m.tb4 = _tb4; // --@5标准上线 var _tb5 = dset.Tables[5].TableToDynamicList(); m.tb5 = _tb5; //--@6产能表 var _tb6 = dset.Tables[6].TableToDynamicList(); m.tb6 = _tb6; //--@7不良项目图 var _tb7 = dset.Tables[7].Rows[0].RowToDynamic(); m.tb7 = _tb7; // --@8良品目图 var _tb8 = dset.Tables[8].Rows[0].RowToDynamic(); m.tb8 = _tb8; // --@9异常报警 var _tb9 = dset.Tables[9].Rows[0].RowToDynamic(); m.tb9 = _tb9; // --@10计件 var _tb10 = dset.Tables[10].TableToDynamicList(); m.tb10 = _tb10; // --@11计时 var _tb11 = dset.Tables[11].TableToDynamicList(); m.tb11 = _tb11; // --@12不良项目表 var _tb12 = dset.Tables[12].TableToDynamicList(); m.tb12 = _tb12; //产能图时间点 foreach (DataRow row in dset.Tables[2].Rows) { m.tb13.Add(row["t"].ToString()); } var _tb14 = dset.Tables[13].Rows[0]; m.tb14 = _tb14.RowToDynamic(); } } catch (Exception ex) { LogHelper.Debug(ToString(), ex.Message); } if (m != null) return ReturnDto.QuickReturn(m, ReturnCode.Success, "读取成功!"); return ReturnDto.QuickReturn(m, ReturnCode.Default, "读取失败!"); } } }