| | |
| | | throw new InvalidOperationException($"生成子表ID失败,无法获取数据库序列值: {ex.Message}", ex); |
| | | } |
| | | } |
| | | //唯一键组合:主表就是工单单别+工单单号,子表是工单单号+工单单号+材料品号 |
| | | |
| | | /// <summary> |
| | | /// 整单删除,调用存储过程 |
| | |
| | | new SugarParameter("@outSum", outSum, typeof(int), ParameterDirection.Output) |
| | | }; |
| | | |
| | | Db.Ado.UseStoredProcedure().ExecuteCommand("ERP_DeleteMesRohInByBillNo", parameters); |
| | | Db.Ado.UseStoredProcedure().ExecuteCommand("ERP_DeleteWomcaaByBillNo", parameters); |
| | | |
| | | outMsg = parameters[2].Value?.ToString() ?? ""; |
| | | outSum = parameters[3].Value != null ? Convert.ToInt32(parameters[index: 3].Value) : -1; |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new InvalidOperationException($"调用存储过程 ERP_DeleteMesRohInByBillNo 失败: {ex.Message}", ex); |
| | | throw new InvalidOperationException($"调用存储过程 ERP_DeleteWomcaaByBillNo 失败: {ex.Message}", ex); |
| | | } |
| | | } |
| | | } |
| | |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 整单删除 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost("Delete")] |
| | | public ResponseResult Delete([FromBody] DeleteRequestDto data) |
| | | { |
| | | var entity = new MessageCenter(); |
| | | entity.TableName = TableName; |
| | | entity.Url = URL + "Delete"; |
| | | entity.Method = METHOD; |
| | | entity.Data = JsonConvert.SerializeObject(data); |
| | | entity.Status = 1; |
| | | entity.CreateBy = "PL017"; |
| | | entity.Route = data.FBillNo; |
| | | try |
| | | { |
| | | dynamic resultInfos = new ExpandoObject(); |
| | | // 调用删除,获取存储过程返回的状态和消息 |
| | | var (outSum, outMsg) = m.Delete(data.FBillNo, data.FBillTypeID); |
| | | resultInfos.OutSum = outSum; |
| | | resultInfos.OutMsg = outMsg; |
| | | |
| | | entity.Result = 0; |
| | | if (resultInfos.OutSum == 1) entity.Result = 1; |
| | | |
| | | entity.DealWith = 1; |
| | | _manager.save(entity); |
| | | |
| | | entity.ResultData = outMsg; |
| | | return new ResponseResult |
| | | { |
| | | //status = outSum, |
| | | status = 0, |
| | | message = outMsg, |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | entity.Result = 0; |
| | | |
| | | entity.DealWith = 0; |
| | | |
| | | entity.ResultData = ex.Message; |
| | | |
| | | _manager.save(entity); |
| | | |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | | } |