| | |
| | | using 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; |
| | | using Gs.Toolbox.ApiCore.Group; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Newtonsoft.Json.Linq; |
| | | using static Gs.Toolbox.UtilityHelper; |
| | | |
| | | |
| | |
| | | return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Success, _outMsg); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据线体或车间id,读取工单 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [RequestMethod(RequestMethods.POST)] |
| | | public ReturnDto<PageList<dynamic>> SelectDaa([FromBody] dynamic model) |
| | | { |
| | | int currentPage = model.currentPage; |
| | | int everyPageSize = model.everyPageSize; |
| | | string sortName = model.sortName; |
| | | string keyWhere = model.keyWhere; |
| | | string workId = model.workId; |
| | | string lineId = model.lineId; |
| | | var dset = new DataSet(); |
| | | try |
| | | { |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | using (var cmd = new SqlCommand("[prc_wom_daa_select]", conn)) |
| | | { |
| | | conn.Open(); |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | SqlParameter[] parameters = |
| | | { |
| | | new("@inCurrentPage", currentPage), |
| | | new("@inEveryPageSize", everyPageSize), |
| | | new("@inSortName", sortName), |
| | | new("@inSortOrder", ""), |
| | | new("@inQueryWhere", keyWhere), |
| | | new("@workId", workId), |
| | | new("@inP1", lineId), |
| | | new("@inP2", "") |
| | | }; |
| | | foreach (var parameter in parameters) |
| | | cmd.Parameters.Add(parameter); |
| | | using (var dt = new SqlDataAdapter(cmd)) |
| | | { |
| | | dt.Fill(dset, "0"); |
| | | } |
| | | } |
| | | |
| | | conn.Close(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Debug(ToString(), "prc_wom_pba_select error:" + ex.Message); |
| | | return ReturnDto<PageList<dynamic>>.QuickReturn(default(PageList<dynamic>), ReturnCode.Exception, "读取失败"); |
| | | } |
| | | |
| | | var _pglist = new PageList<dynamic> |
| | | { |
| | | total = 0, |
| | | everyPageSize = 0, |
| | | pages = 0, |
| | | list = new List<dynamic>() |
| | | }; |
| | | 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; |
| | | } |
| | | |
| | | return ReturnDto<PageList<dynamic>>.QuickReturn(_pglist, |
| | | ReturnCode.Success, "读取成功"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据用户选择的采购明细guid,读取需要作入库到货单的明细 |
| | | /// </summary> |
| | | /// <param name="query"></param> |
| | | /// <returns></returns> |
| | | [RequestMethod(RequestMethods.POST)] |
| | | public ReturnDto<List<dynamic>> SelectDaaToView( |
| | | JArray guidList) |
| | | { |
| | | var intArray = guidList.ToObject<string[]>(); |
| | | var sbLine = new StringBuilder(); |
| | | foreach (var str in intArray) |
| | | { |
| | | if (sbLine.Length > 0) |
| | | sbLine.Append(","); |
| | | sbLine.Append(str); |
| | | } |
| | | |
| | | var lst = new List<dynamic>(); |
| | | var dset = new DataSet(); |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | using (var cmd = |
| | | new SqlCommand("[prc_wom_daa_select_to_grid]", conn)) |
| | | { |
| | | try |
| | | { |
| | | conn.Open(); |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | SqlParameter[] parameters = |
| | | { |
| | | new("@inP1", sbLine.ToString()) |
| | | }; |
| | | foreach (var parameter in parameters) |
| | | cmd.Parameters.Add(parameter); |
| | | using (var dt = new SqlDataAdapter(cmd)) |
| | | { |
| | | dt.Fill(dset, "0"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Debug(ToString(), |
| | | "prc_wom_daa_select_to_grid error:" + ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | conn.Close(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (dset != null && dset.Tables.Count > 0 && |
| | | dset.Tables[0].Rows.Count > 0) //有数据 |
| | | lst = dset.Tables[0].TableToDynamicList(); |
| | | return ReturnDto<List<dynamic>>.QuickReturn(lst, ReturnCode.Success, |
| | | "读取成功!"); |
| | | } |
| | | |
| | | } |