| | |
| | | |
| | | |
| | | |
| | | ///// <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;//备注 |
| | | 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> |
| | | /// 撤回报工 |
| | | /// </summary> |
| | | /// <param name="mode"></param> |
| | | /// <returns></returns> |
| | | [RequestMethod(RequestMethods.POST)] |
| | | public ReturnDto<ExpandoObject> EditModelChbg([FromBody] dynamic mode) |
| | | { |
| | | string _billNo = mode.billNo; |
| | | string _inFieldValue = mode.inFieldValue; |
| | | string _proName = "prc_pda_scbg_withdraw"; |
| | | dynamic m = new ExpandoObject(); |
| | | m.outSum = -1; |
| | | m.outMsg = ""; |
| | | |
| | | if (!Guid.TryParse(_userGuid, out Guid userGuid)) |
| | | throw new ArgumentException("无效的 UserGuid"); |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | using (var cmd = new SqlCommand(_proName, conn)) |
| | | { |
| | | try |
| | | { |
| | | conn.Open(); |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | // 按照存储过程定义的顺序添加参数 |
| | | SqlParameter[] parameters = |
| | | { |
| | | // 输入参数(按顺序) |
| | | new SqlParameter("@inEdtUserGuid", SqlDbType.UniqueIdentifier) { Value = userGuid }, |
| | | new SqlParameter("@inOrderGuid", SqlDbType.UniqueIdentifier) { Value = DBNull.Value }, // 传入null |
| | | new SqlParameter("@pi_inventoryAppBillNo", SqlDbType.NVarChar, 100) { Value = string.Empty }, |
| | | new SqlParameter("@inBarcodeGuids", SqlDbType.NVarChar, -1) { Value = _billNo ?? (object)DBNull.Value }, |
| | | new SqlParameter("@in1", SqlDbType.NVarChar, 100) { Value = string.Empty }, |
| | | new SqlParameter("@in2", SqlDbType.NVarChar, 100) { Value = string.Empty }, |
| | | new SqlParameter("@in3", SqlDbType.NVarChar, 100) { Value = string.Empty }, |
| | | |
| | | // 输出参数(最后) |
| | | new SqlParameter("@outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output }, |
| | | new SqlParameter("@outSum", SqlDbType.Int) { Direction = ParameterDirection.Output } |
| | | }; |
| | | |
| | | foreach (var parameter in parameters) |
| | | cmd.Parameters.Add(parameter); |
| | | |
| | | cmd.ExecuteNonQuery(); |
| | | |
| | | m.outMsg = parameters[7].Value?.ToString() ?? ""; // @outMsg是第8个参数(索引7) |
| | | if (parameters[8].Value != DBNull.Value && parameters[8].Value != null) |
| | | { |
| | | m.outSum = Convert.ToInt32(parameters[8].Value); // @outSum是第9个参数(索引8) |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Debug(ToString(), |
| | | "prc_pda_scbg_withdraw error:" + ex.Message); |
| | | m.outMsg = ex.Message; |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, |
| | | ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | conn.Close(); |
| | | } |
| | | } |
| | | } |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "操作成功!"); |
| | | } |
| | | |
| | | } |