From b3945f6341250e318b91d41b0584ae4bd6590fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AD=A3=E6=98=93?= Date: Tue, 3 Jun 2025 13:24:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=A4=E6=96=AD=E6=8A=A5?= =?UTF-8?q?=E5=B7=A5=E6=97=B6=E6=A3=80=E6=9F=A5=E4=B8=BB=E4=BD=93=E5=9E=8B?= =?UTF-8?q?=E5=8F=B7=E6=98=AF=E5=90=A6=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Mobile/ReportFlowController.cs | 14 +++++++-- DOAN.Service/Mobile/ReportFlowService.cs | 30 ++++++++++++++----- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/DOAN.Admin.WebApi/Controllers/Mobile/ReportFlowController.cs b/DOAN.Admin.WebApi/Controllers/Mobile/ReportFlowController.cs index 306bda8..dd430e8 100644 --- a/DOAN.Admin.WebApi/Controllers/Mobile/ReportFlowController.cs +++ b/DOAN.Admin.WebApi/Controllers/Mobile/ReportFlowController.cs @@ -165,7 +165,7 @@ public class ReportFlowController : BaseController string data = ""; if (ret == 0) { - data = "系统操作失败"; + data = "系统操作失败!"; } if (ret == 1) { @@ -173,11 +173,19 @@ public class ReportFlowController : BaseController } if (ret == 2) { - data = "采购订单不存在,请检查订单号"; + data = "采购订单不存在,请检查订单号!"; } if (ret == 3) { - data = "出货数量超额"; + data = "出货数量超额!"; + } + if (ret == 4) + { + data = "工单异常,该工单不存在!"; + } + if (ret == 5) + { + data = "采购订单主体型号与工单不符合!"; } return SUCCESS(data); } diff --git a/DOAN.Service/Mobile/ReportFlowService.cs b/DOAN.Service/Mobile/ReportFlowService.cs index 969b217..93fecb7 100644 --- a/DOAN.Service/Mobile/ReportFlowService.cs +++ b/DOAN.Service/Mobile/ReportFlowService.cs @@ -204,6 +204,23 @@ public class ReportFlowService : BaseService, IReportFlowServic // 订单号不存在 return 2; } + // 判断工单是否存在 + ProWorkorder workorderInfo = + Context + .Queryable() + .Where(it => it.Workorder == workorder) + .First(); + if (workorderInfo == null) + { + // 工单不存在 + return 4; + } + // 判断工单主体型号和订单物料号是否匹配 + if(workorderInfo.productionCode != orderPurchase.MaterialCode) + { + return 5; + } + string NickName = Context .Queryable() .Where(it => it.UserName == Worker) @@ -238,7 +255,6 @@ public class ReportFlowService : BaseService, IReportFlowServic CreatedTime = DateTime.Now }; result = Context.Insertable(proReportwork01).ExecuteCommand(); - } else { @@ -249,7 +265,6 @@ public class ReportFlowService : BaseService, IReportFlowServic ReportWorkOrderDetail.UpdatedBy = Worker; ReportWorkOrderDetail.UpdatedTime = DateTime.Now; result = Context.Updateable(ReportWorkOrderDetail).ExecuteCommand(); - } // 修改工单信息 Context @@ -259,12 +274,13 @@ public class ReportFlowService : BaseService, IReportFlowServic .SetColumns(it => it.CustomerOrder == customer_order) .ExecuteCommand(); // 修改采购订单信息 - int newQuantity = Context - .Queryable() - .Where(it => it.CustomerOrder == customer_order) - .Sum(it => it.ShipmentNum) ?? 0; + int newQuantity = + Context + .Queryable() + .Where(it => it.CustomerOrder == customer_order) + .Sum(it => it.ShipmentNum) ?? 0; orderPurchase.DeliveryQuantity = newQuantity; - if (orderPurchase.DeliveryQuantity > orderPurchase.DemandQuantity) + if (orderPurchase.DeliveryQuantity > orderPurchase.DemandQuantity) { // 订单超额了 Context.Ado.RollbackTran();