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

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

@@ -204,6 +204,23 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
// 订单号不存在
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
.Queryable<SysUser>()
.Where(it => it.UserName == Worker)
@@ -238,7 +255,6 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
CreatedTime = DateTime.Now
};
result = Context.Insertable(proReportwork01).ExecuteCommand();
}
else
{
@@ -249,7 +265,6 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
ReportWorkOrderDetail.UpdatedBy = Worker;
ReportWorkOrderDetail.UpdatedTime = DateTime.Now;
result = Context.Updateable(ReportWorkOrderDetail).ExecuteCommand();
}
// 修改工单信息
Context
@@ -259,12 +274,13 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
.SetColumns(it => it.CustomerOrder == customer_order)
.ExecuteCommand();
// 修改采购订单信息
int newQuantity = Context
.Queryable<ProWorkorder>()
.Where(it => it.CustomerOrder == customer_order)
.Sum(it => it.ShipmentNum) ?? 0;
int newQuantity =
Context
.Queryable<ProWorkorder>()
.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();