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

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 = "";
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);
}

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();