feat(工单物料): 重构工单物料查询接口并支持分页

- 新增WorkorderMaterialQueryDto作为统一查询参数模型
- 修改物料库存、可领料工单、成品库存和可出货订单查询接口,支持分页返回
- 优化RouteCode为10的工单编号生成逻辑,从101开始编号
- 调整采购订单出货数量计算方式,直接减扣出库数量
This commit is contained in:
2026-03-02 19:19:23 +08:00
parent dc8cb4053d
commit 6418bb67b9
7 changed files with 235 additions and 100 deletions

View File

@@ -534,6 +534,36 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
result = Context.Updateable(ReportWorkOrderDetail).ExecuteCommand();
}
workorderInfo.CustomerOrder = customer_order;
// 修改工单信息,绑定出货记录
Context.Updateable(workorderInfo).ExecuteCommand();
// 修改采购订单出货数
orderPurchase.DeliveryQuantity += finish_num;
//int newQuantity = Context
// .Queryable<ProWorkorder>()
// .Where(it => it.CustomerOrder == customer_order)
// .Sum(it => it.ShipmentNum);
//orderPurchase.DeliveryQuantity = newQuantity;
if (orderPurchase.DeliveryQuantity > orderPurchase.DemandQuantity)
{
// 订单超额了
Context.Ado.RollbackTran();
return 3;
}
if (orderPurchase.DeliveryQuantity == orderPurchase.DemandQuantity)
{
orderPurchase.Orderindicator = 1;
}
else
{
orderPurchase.Orderindicator = -1;
}
orderPurchase.UpdatedTime = DateTime.Now;
orderPurchase.UpdatedBy = Worker;
int res = Context.Updateable(orderPurchase).ExecuteCommand();
// XXX 成品库出库
// 需要保证已入库数大于等于已出货数+现在要出货的数量
workorderInfo.ShipmentNum += finish_num;
@@ -571,30 +601,7 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
Context.Ado.RollbackTran();
throw new Exception("出货数超出工单成品入库数!");
}
workorderInfo.CustomerOrder = customer_order;
// 修改工单信息
Context.Updateable(workorderInfo).ExecuteCommand();
// 修改采购订单是否完成
int newQuantity = Context
.Queryable<ProWorkorder>()
.Where(it => it.CustomerOrder == customer_order)
.Sum(it => it.ShipmentNum);
orderPurchase.DeliveryQuantity = newQuantity;
if (orderPurchase.DeliveryQuantity > orderPurchase.DemandQuantity)
{
// 订单超额了
Context.Ado.RollbackTran();
return 3;
}
if (orderPurchase.DeliveryQuantity == orderPurchase.DemandQuantity)
{
orderPurchase.Orderindicator = 1;
}
else
{
orderPurchase.Orderindicator = -1;
}
int res = Context.Updateable(orderPurchase).ExecuteCommand();
Context.Ado.CommitTran();
return result > 0 ? 1 : 0;
}