| | |
| | | |
| | | |
| | | |
| | | ///// <summary> |
| | | ///// 增加或编辑实体 |
| | | ///// </summary> |
| | | ///// <param name="model"></param> |
| | | ///// <returns></returns> |
| | | //[RequestMethod(RequestMethods.POST)] |
| | | //public ReturnDto<string?> EditModel([FromBody] dynamic model) |
| | | //{ |
| | | // Guid? guid = model.guid; //主键 |
| | | // string sjxt = model.sjxt; //工单号 |
| | | // string bz = model.bz;//仓库 |
| | | // var _outMsg = ""; |
| | | // var _outSum = -1; |
| | | // using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | // { |
| | | // using (var cmd = new SqlCommand("[prc_wom_daa_edt]", conn)) |
| | | // { |
| | | // try |
| | | // { |
| | | // conn.Open(); |
| | | // cmd.CommandType = CommandType.StoredProcedure; |
| | | // SqlParameter[] parameters = |
| | | // { |
| | | // new("@outMsg", SqlDbType.NVarChar, 300), |
| | | // new("@outSum", SqlDbType.Int), |
| | | // new("@inOrderGuid",UtilityHelper.CheckGuid(guid)? guid : DBNull.Value), |
| | | // new("@inSjxt", sjxt), |
| | | // new("@inBz", bz), |
| | | // new("@inEdtUserGuid", _userGuid), |
| | | // }; |
| | | // parameters[0].Direction = ParameterDirection.Output; |
| | | // parameters[1].Direction = ParameterDirection.Output; |
| | | // foreach (var parameter in parameters) |
| | | // cmd.Parameters.Add(parameter); |
| | | // cmd.ExecuteNonQuery(); |
| | | // _outMsg = parameters[0].Value.ToString(); |
| | | // _outSum = int.Parse(parameters[1].Value.ToString()); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // LogHelper.Debug(ToString(), |
| | | // "prc_wom_daa_edt error:" + ex.Message); |
| | | // _outMsg = ex.Message; |
| | | // _outSum = -1; |
| | | // } |
| | | // finally |
| | | // { |
| | | // conn.Close(); |
| | | // } |
| | | // } |
| | | // } |
| | | // if (_outSum <= 0) |
| | | // return ReturnDto<string>.QuickReturn(guid.ToString(), |
| | | // ReturnCode.Exception, _outMsg); |
| | | // return ReturnDto<string>.QuickReturn(guid.ToString(), |
| | | // ReturnCode.Success, _outMsg); |
| | | //} |
| | | /// <summary> |
| | | /// 增加或编辑实体 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [RequestMethod(RequestMethods.POST)] |
| | | public ReturnDto<string?> EditModel([FromBody] dynamic model) |
| | | { |
| | | Guid? guid = model.guid; //主键 |
| | | string sjxt = model.sjxt; //线体 |
| | | string bz = model.bz;//备注 |
| | | string xgdate = model.xgdate;//备注 |
| | | var _outMsg = ""; |
| | | var _outSum = -1; |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | using (var cmd = new SqlCommand("[prc_wom_daa_edt]", conn)) |
| | | { |
| | | try |
| | | { |
| | | conn.Open(); |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | SqlParameter[] parameters = |
| | | { |
| | | new("@outMsg", SqlDbType.NVarChar, 300), |
| | | new("@outSum", SqlDbType.Int), |
| | | new("@inOrderGuid",UtilityHelper.CheckGuid(guid)? guid : DBNull.Value), |
| | | new("@inSjxt", sjxt), |
| | | new("@inBz", bz), |
| | | new("@inEdtUserGuid", _userGuid), |
| | | new("@inP1", xgdate), |
| | | }; |
| | | parameters[0].Direction = ParameterDirection.Output; |
| | | parameters[1].Direction = ParameterDirection.Output; |
| | | foreach (var parameter in parameters) |
| | | cmd.Parameters.Add(parameter); |
| | | cmd.ExecuteNonQuery(); |
| | | _outMsg = parameters[0].Value.ToString(); |
| | | _outSum = int.Parse(parameters[1].Value.ToString()); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Debug(ToString(), |
| | | "prc_wom_daa_edt error:" + ex.Message); |
| | | _outMsg = ex.Message; |
| | | _outSum = -1; |
| | | } |
| | | finally |
| | | { |
| | | conn.Close(); |
| | | } |
| | | } |
| | | } |
| | | if (_outSum <= 0) |
| | | return ReturnDto<string>.QuickReturn(guid.ToString(), |
| | | ReturnCode.Exception, _outMsg); |
| | | return ReturnDto<string>.QuickReturn(guid.ToString(), |
| | | ReturnCode.Success, _outMsg); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | string keyWhere = model.keyWhere; |
| | | string workId = model.workId; |
| | | string lineId = model.lineId; |
| | | string cgyId = model.cgyId; |
| | | var dset = new DataSet(); |
| | | try |
| | | { |
| | |
| | | new("@inQueryWhere", keyWhere), |
| | | new("@workId", workId), |
| | | new("@inP1", lineId), |
| | | new("@inP2", "") |
| | | new("@inP2", cgyId) |
| | | }; |
| | | foreach (var parameter in parameters) |
| | | cmd.Parameters.Add(parameter); |
| | |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "操作成功!"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读取列表,支持分页 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [RequestMethod(RequestMethods.POST)] |
| | | public ReturnDto<PageList<dynamic>> Getbly([FromBody] dynamic model) |
| | | { |
| | | int currentPage = model.currentPage; |
| | | int everyPageSize = model.everyPageSize; |
| | | string sortName = model.sortName; |
| | | string keyWhere = model.keyWhere; |
| | | string guid = model.guid; |
| | | SqlParameter[] parameters = |
| | | { |
| | | new("@inCurrentPage", currentPage), |
| | | new("@inEveryPageSize", everyPageSize), |
| | | new("@inSortName", sortName), |
| | | new("@inSortOrder", ""), |
| | | new("@inQueryWhere", keyWhere), |
| | | new("@guid", guid), |
| | | new("@inP1", ""), |
| | | new("@inP2", ""), |
| | | new("@inP3", ""), |
| | | new("@inP4", "") |
| | | }; |
| | | var dset = new DataSet(); |
| | | var _pglist = new PageList<dynamic> |
| | | { |
| | | total = 0, |
| | | everyPageSize = 0, |
| | | pages = 0, |
| | | list = new List<dynamic>() |
| | | }; |
| | | try |
| | | { |
| | | dset = DbHelperSQL.RunProcedure("prc_wom_bly_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<PageList<dynamic>>.QuickReturn(_pglist, |
| | | ReturnCode.Exception, ex.Message); |
| | | } |
| | | |
| | | return ReturnDto<PageList<dynamic>>.QuickReturn(_pglist, |
| | | ReturnCode.Success, "读取成功"); |
| | | } |
| | | |
| | | } |