| | |
| | | return ReturnDto<PageList<dynamic>>.QuickReturn(_pglist, |
| | | ReturnCode.Success, "读取成功"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Debug(ToString(), "prc_wom_pba_select error:" + ex.Message); |
| | | return ReturnDto<PageList<dynamic>>.QuickReturn( default(PageList<dynamic>), ReturnCode.Exception, "读取失败"); |
| | | return ReturnDto<PageList<dynamic>>.QuickReturn(default(PageList<dynamic>), ReturnCode.Exception, "读取失败"); |
| | | } |
| | | |
| | | var _pglist = new PageList<dynamic> |
| | |
| | | } |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "操作成功!"); |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 批量处理明细数据 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [RequestMethod(RequestMethods.POST)] |
| | | public ReturnDto<ExpandoObject> BatchProcessDetails([FromBody] dynamic model) |
| | | { |
| | | dynamic result = new ExpandoObject(); |
| | | result.outSum = 0; |
| | | result.outMsg = ""; |
| | | |
| | | try |
| | | { |
| | | // 获取请求参数 |
| | | string operatorGuid = model.operatorGuid?.ToString() ?? ""; |
| | | string operationType = model.operationType?.ToString() ?? "BatchProcess"; |
| | | var selectedDetails = model.selectedDetails; |
| | | |
| | | if (selectedDetails == null) |
| | | { |
| | | result.outMsg = "未接收到要处理的明细数据!"; |
| | | return ReturnDto<ExpandoObject>.QuickReturn(result, ReturnCode.Default, result.outMsg); |
| | | } |
| | | |
| | | // 构建明细数据字符串,用于传递给存储过程 |
| | | var _sb = new StringBuilder(); |
| | | var _split = "|"; |
| | | int processCount = 0; |
| | | |
| | | foreach (var detail in selectedDetails) |
| | | { |
| | | string detailGuid = detail.guid?.ToString() ?? ""; |
| | | string daa002 = detail.daa002?.ToString() ?? ""; |
| | | string daa003 = detail.daa003?.ToString() ?? ""; |
| | | string daa005 = detail.daa005?.ToString() ?? ""; |
| | | string daa010 = detail.daa010?.ToString() ?? ""; |
| | | |
| | | // 验证必要字段 |
| | | if (string.IsNullOrEmpty(detailGuid)) |
| | | continue; |
| | | |
| | | // 构建明细行数据字符串 |
| | | var _line = detailGuid + _split |
| | | + daa002 + _split |
| | | + daa003 + _split |
| | | + daa005 + _split |
| | | + daa010 + _split |
| | | + operationType + _split |
| | | + _userCode + _split |
| | | + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | if (_sb.Length > 0) |
| | | _sb.Append("~"); |
| | | _sb.Append(_line); |
| | | processCount++; |
| | | } |
| | | |
| | | if (processCount == 0) |
| | | { |
| | | result.outMsg = "没有有效的明细数据需要处理!"; |
| | | return ReturnDto<ExpandoObject>.QuickReturn(result, ReturnCode.Default, result.outMsg); |
| | | } |
| | | |
| | | // 调用存储过程进行批量处理 |
| | | SqlParameter[] parameters = |
| | | { |
| | | new("@inOperatorGuid", operatorGuid), |
| | | new("@inOperationType", operationType), |
| | | new("@inDetailsData", _sb.ToString()), |
| | | new("@inUserCode", _userCode), |
| | | new("@inUserGuid", _userGuid), |
| | | new("@inOrgFids", _orgFids), |
| | | new("@outSum", SqlDbType.Int) { Direction = ParameterDirection.Output }, |
| | | new("@outMsg", SqlDbType.NVarChar, 500) { Direction = ParameterDirection.Output } |
| | | }; |
| | | |
| | | var dset = new DataSet(); |
| | | dset = DbHelperSQL.RunProcedure("prc_wom_pbagx_batch_process", parameters, "0"); |
| | | |
| | | // 获取输出参数 |
| | | int outSum = Convert.ToInt32(parameters[6].Value ?? 0); |
| | | string outMsg = parameters[7].Value?.ToString() ?? ""; |
| | | |
| | | result.outSum = outSum; |
| | | result.outMsg = outMsg; |
| | | |
| | | if (outSum > 0) |
| | | { |
| | | |
| | | return ReturnDto<ExpandoObject>.QuickReturn(result, ReturnCode.Success, outMsg); |
| | | } |
| | | else |
| | | { |
| | | |
| | | return ReturnDto<ExpandoObject>.QuickReturn(result, ReturnCode.Default, outMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | result.outMsg = "批量处理明细时发生异常:" + ex.Message; |
| | | return ReturnDto<ExpandoObject>.QuickReturn(result, ReturnCode.Exception, result.outMsg); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |