From 1e7d7684899b3103ced970abc78b0930788e0433 Mon Sep 17 00:00:00 2001 From: git_rabbit Date: Sat, 24 Jan 2026 13:47:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E5=85=A5=E5=BA=93=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Mobile/ReportFlowController.cs | 141 +++++++++++------- DOAN.Service/Mobile/ReportFlowService.cs | 14 +- 2 files changed, 88 insertions(+), 67 deletions(-) diff --git a/DOAN.Admin.WebApi/Controllers/Mobile/ReportFlowController.cs b/DOAN.Admin.WebApi/Controllers/Mobile/ReportFlowController.cs index dd430e8..e45e91a 100644 --- a/DOAN.Admin.WebApi/Controllers/Mobile/ReportFlowController.cs +++ b/DOAN.Admin.WebApi/Controllers/Mobile/ReportFlowController.cs @@ -1,3 +1,4 @@ +using Azure; using DOAN.Model.Mobile.ReportFlow.Dto; using DOAN.Service.Mobile.IService; using Infrastructure.Converter; @@ -93,21 +94,30 @@ public class ReportFlowController : BaseController string process_operator ) { - if (string.IsNullOrEmpty(workorder)) + try { - throw new CustomException("workorder or process is null"); + if (string.IsNullOrEmpty(workorder)) + { + throw new CustomException("workorder or process is null"); + } + + return SUCCESS( + _reportFlowService.FeedProcessReportwork( + workorder, + processId, + finish_num, + stove_code, + feed_order, + process_operator + ) + ); + } + catch (Exception e) + { + + return ToResponse(new ApiResult(500, e.Message)); } - return SUCCESS( - _reportFlowService.FeedProcessReportwork( - workorder, - processId, - finish_num, - stove_code, - feed_order, - process_operator - ) - ); } //TODO 工序报工 @@ -123,20 +133,29 @@ public class ReportFlowController : BaseController [HttpGet("process_reportwork")] public IActionResult ProcessReportWork([FromQuery] ProReportWorkDto proReportWorkDto) { - if (string.IsNullOrEmpty(proReportWorkDto.workorder)) + try { - throw new CustomException("workorder or process is null"); + if (string.IsNullOrEmpty(proReportWorkDto.workorder)) + { + throw new CustomException("workorder or process is null"); + } + + return SUCCESS( + _reportFlowService.ProcessReportWork( + proReportWorkDto.workorder, + proReportWorkDto.processId, + proReportWorkDto.finish_num, + proReportWorkDto.bad_num, + proReportWorkDto.process_operator + ) + ); + } + catch (Exception e) + { + + return ToResponse(new ApiResult(500, e.Message)); } - return SUCCESS( - _reportFlowService.ProcessReportWork( - proReportWorkDto.workorder, - proReportWorkDto.processId, - proReportWorkDto.finish_num, - proReportWorkDto.bad_num, - proReportWorkDto.process_operator - ) - ); } //TODO 出货工序 @@ -150,44 +169,52 @@ public class ReportFlowController : BaseController string process_operator ) { - if (string.IsNullOrEmpty(workorder)) + try { - throw new CustomException("workorder or process is null"); + if (string.IsNullOrEmpty(workorder)) + { + throw new CustomException("workorder or process is null"); + } + int ret = _reportFlowService.ShipmentProcessReportwork( + workorder, + processId, + finish_num, + bad_num, + customer_order, + process_operator + ); + string data = ""; + if (ret == 0) + { + data = "系统操作失败!"; + } + if (ret == 1) + { + data = "成功"; + } + if (ret == 2) + { + data = "采购订单不存在,请检查订单号!"; + } + if (ret == 3) + { + data = "出货数量超额!"; + } + if (ret == 4) + { + data = "工单异常,该工单不存在!"; + } + if (ret == 5) + { + data = "采购订单主体型号与工单不符合!"; + } + return SUCCESS(data); } - int ret = _reportFlowService.ShipmentProcessReportwork( - workorder, - processId, - finish_num, - bad_num, - customer_order, - process_operator - ); - string data = ""; - if (ret == 0) + catch (Exception e) { - data = "系统操作失败!"; + return ToResponse(new ApiResult(500, e.Message)); } - if (ret == 1) - { - data = "成功"; - } - if (ret == 2) - { - data = "采购订单不存在,请检查订单号!"; - } - if (ret == 3) - { - data = "出货数量超额!"; - } - if (ret == 4) - { - data = "工单异常,该工单不存在!"; - } - if (ret == 5) - { - data = "采购订单主体型号与工单不符合!"; - } - return SUCCESS(data); + } //TODO 获取工单下的报工列表 diff --git a/DOAN.Service/Mobile/ReportFlowService.cs b/DOAN.Service/Mobile/ReportFlowService.cs index 92e6160..0dc4bce 100644 --- a/DOAN.Service/Mobile/ReportFlowService.cs +++ b/DOAN.Service/Mobile/ReportFlowService.cs @@ -305,11 +305,8 @@ public class ReportFlowService : BaseService, IReportFlowServic } else { - if (inboundRecord.Quantity != finish_num) - { - Context.Ado.RollbackTran(); - throw new Exception("修改数量前请先撤销已有生产入库记录!"); - } + Context.Ado.RollbackTran(); + throw new Exception("重新成品入库前请先撤销已有物料生产入库记录!"); } } Context.Ado.CommitTran(); @@ -451,11 +448,8 @@ public class ReportFlowService : BaseService, IReportFlowServic } else { - if (outboundDto.Quantity != finish_num) - { - Context.Ado.RollbackTran(); - throw new Exception("修改数量前请先撤销出货出库记录"); - } + Context.Ado.RollbackTran(); + throw new Exception("重新出货前请先撤销物料出货出库记录"); } // 修改工单信息