添加判断报工时检查主体型号是否一致

This commit is contained in:
2025-06-03 13:24:43 +08:00
parent d2f16241bb
commit b3945f6341
2 changed files with 34 additions and 10 deletions

View File

@@ -165,7 +165,7 @@ public class ReportFlowController : BaseController
string data = ""; string data = "";
if (ret == 0) if (ret == 0)
{ {
data = "系统操作失败"; data = "系统操作失败";
} }
if (ret == 1) if (ret == 1)
{ {
@@ -173,11 +173,19 @@ public class ReportFlowController : BaseController
} }
if (ret == 2) if (ret == 2)
{ {
data = "采购订单不存在,请检查订单号"; data = "采购订单不存在,请检查订单号";
} }
if (ret == 3) if (ret == 3)
{ {
data = "出货数量超额"; data = "出货数量超额";
}
if (ret == 4)
{
data = "工单异常,该工单不存在!";
}
if (ret == 5)
{
data = "采购订单主体型号与工单不符合!";
} }
return SUCCESS(data); return SUCCESS(data);
} }

View File

@@ -204,6 +204,23 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
// 订单号不存在 // 订单号不存在
return 2; return 2;
} }
// 判断工单是否存在
ProWorkorder workorderInfo =
Context
.Queryable<ProWorkorder>()
.Where(it => it.Workorder == workorder)
.First();
if (workorderInfo == null)
{
// 工单不存在
return 4;
}
// 判断工单主体型号和订单物料号是否匹配
if(workorderInfo.productionCode != orderPurchase.MaterialCode)
{
return 5;
}
string NickName = Context string NickName = Context
.Queryable<SysUser>() .Queryable<SysUser>()
.Where(it => it.UserName == Worker) .Where(it => it.UserName == Worker)
@@ -238,7 +255,6 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
CreatedTime = DateTime.Now CreatedTime = DateTime.Now
}; };
result = Context.Insertable(proReportwork01).ExecuteCommand(); result = Context.Insertable(proReportwork01).ExecuteCommand();
} }
else else
{ {
@@ -249,7 +265,6 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
ReportWorkOrderDetail.UpdatedBy = Worker; ReportWorkOrderDetail.UpdatedBy = Worker;
ReportWorkOrderDetail.UpdatedTime = DateTime.Now; ReportWorkOrderDetail.UpdatedTime = DateTime.Now;
result = Context.Updateable(ReportWorkOrderDetail).ExecuteCommand(); result = Context.Updateable(ReportWorkOrderDetail).ExecuteCommand();
} }
// 修改工单信息 // 修改工单信息
Context Context
@@ -259,12 +274,13 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
.SetColumns(it => it.CustomerOrder == customer_order) .SetColumns(it => it.CustomerOrder == customer_order)
.ExecuteCommand(); .ExecuteCommand();
// 修改采购订单信息 // 修改采购订单信息
int newQuantity = Context int newQuantity =
.Queryable<ProWorkorder>() Context
.Where(it => it.CustomerOrder == customer_order) .Queryable<ProWorkorder>()
.Sum(it => it.ShipmentNum) ?? 0; .Where(it => it.CustomerOrder == customer_order)
.Sum(it => it.ShipmentNum) ?? 0;
orderPurchase.DeliveryQuantity = newQuantity; orderPurchase.DeliveryQuantity = newQuantity;
if (orderPurchase.DeliveryQuantity > orderPurchase.DemandQuantity) if (orderPurchase.DeliveryQuantity > orderPurchase.DemandQuantity)
{ {
// 订单超额了 // 订单超额了
Context.Ado.RollbackTran(); Context.Ado.RollbackTran();