更改 增加工单 根据计划ID查询工单

This commit is contained in:
xiaowei.song
2023-11-16 09:41:52 +08:00
parent ee917a3133
commit 1db36d34d9
3 changed files with 9 additions and 5 deletions

View File

@@ -105,7 +105,7 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro
if (!string.IsNullOrEmpty(id)) if (!string.IsNullOrEmpty(id))
{ {
lst = proWorkplanService.GetWorkorderList(id); lst = proWorkplanService.GetWorkorderListByPlanId(id);
} }
return ToResponse(new ApiResult(200, "success", lst)); return ToResponse(new ApiResult(200, "success", lst));
@@ -136,17 +136,21 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro
List<ProWorkplan> lstWorkplan = proWorkplanService.GetProWorkplanById(workPlanId); List<ProWorkplan> lstWorkplan = proWorkplanService.GetProWorkplanById(workPlanId);
// 查询所有生产工单 // 查询所有生产工单
List<ProWorkorder> lstWorkorder = proWorkplanService.GetWorkorderList(workorderId); List<ProWorkorder> lstWorkorder = proWorkplanService.GetWorkorderListByPlanId(workPlanId);
// 计算所有工单的数量和,生产计划的数量:比较 // 计算所有工单的数量和,生产计划的数量:比较
if(lstWorkplan!=null && lstWorkplan.Count==1) if(lstWorkplan!=null && lstWorkplan.Count==1)
{ {
int countWorkplan = int.Parse(lstWorkplan[0].ActualplanNumber.Trim()); int countWorkplan = int.Parse(lstWorkplan[0].ActualplanNumber.Trim());
// 计算已有工单的计划数
int countWorkorder = 0; int countWorkorder = 0;
foreach (ProWorkorder item in lstWorkorder) foreach (ProWorkorder item in lstWorkorder)
{ {
countWorkorder += item.Actualnumber.GetValueOrDefault(); countWorkorder += item.Actualnumber.GetValueOrDefault();
} }
// 再加上当前订单计划数
countWorkorder += proWorkorder.Actualnumber.GetValueOrDefault(); countWorkorder += proWorkorder.Actualnumber.GetValueOrDefault();
// 计划数>0 计划数要大于等于当前工单总数 // 计划数>0 计划数要大于等于当前工单总数
@@ -186,7 +190,7 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro
string isArrange = "0"; string isArrange = "0";
// 查询所有生产工单根据生产计划ID // 查询所有生产工单根据生产计划ID
List<ProWorkorder> lstWorkorder = proWorkplanService.GetWorkorderList(workPlanId); List<ProWorkorder> lstWorkorder = proWorkplanService.GetWorkorderListByPlanId(workPlanId);
// 找到要更新的工单,要判断当前工单状态 // 找到要更新的工单,要判断当前工单状态
ProWorkorder currentWorkorder = null; ProWorkorder currentWorkorder = null;

View File

@@ -32,7 +32,7 @@ namespace ZR.Service.mes.pro.IService
/// </summary> /// </summary>
/// <param name="id"></param> /// <param name="id"></param>
/// <returns></returns> /// <returns></returns>
public List<ProWorkorder> GetWorkorderList(string id); public List<ProWorkorder> GetWorkorderListByPlanId(string id);
/// <summary> /// <summary>
/// 根据工单ID获取工单 /// 根据工单ID获取工单

View File

@@ -55,7 +55,7 @@ namespace ZR.Service.mes.pro
return Context.Deleteable<ProWorkplan>().In(id).ExecuteCommand(); return Context.Deleteable<ProWorkplan>().In(id).ExecuteCommand();
} }
public List<ProWorkorder> GetWorkorderList(string id) public List<ProWorkorder> GetWorkorderListByPlanId(string id)
{ {
return Context.Queryable<ProWorkorder>().Where(it => it.FkProPlanId == id).ToList(); return Context.Queryable<ProWorkorder>().Where(it => it.FkProPlanId == id).ToList();
} }