获取工单下的报工列表

This commit is contained in:
qianhao.xu
2024-12-03 20:10:18 +08:00
parent 37a6f76d0c
commit 34ffda9557
5 changed files with 123 additions and 20 deletions

View File

@@ -46,13 +46,13 @@ public class ReportFlowController : BaseController
/// <returns></returns>
/// <exception cref="CustomException"></exception>
[HttpGet("get_process_reportwork_detail")]
public IActionResult GetProcessReportWorkDetail(string workorder, string process)
public IActionResult GetProcessReportWorkDetail(string workorder, int processId)
{
if (string.IsNullOrEmpty(workorder) || string.IsNullOrEmpty(process))
if (string.IsNullOrEmpty(workorder))
{
throw new CustomException("workorder or process is null");
}
return SUCCESS(_reportFlowService.GetProcessReportWorkDetail(workorder, process));
return SUCCESS(_reportFlowService.GetProcessReportWorkDetail(workorder, processId));
}
//TODO 工序报工
@@ -66,14 +66,14 @@ public class ReportFlowController : BaseController
/// <returns></returns>
/// <exception cref="CustomException"></exception>
[HttpGet("process_reportwork")]
public IActionResult ProcessReportWork(string workorder, string process, int finish_num,int bad_num)
public IActionResult ProcessReportWork(string workorder, int processId, int finish_num,int bad_num)
{
if (string.IsNullOrEmpty(workorder) || string.IsNullOrEmpty(process))
if (string.IsNullOrEmpty(workorder))
{
throw new CustomException("workorder or process is null");
}
return SUCCESS(_reportFlowService.ProcessReportWork(workorder, process, finish_num,bad_num,HttpContext.GetNickName()));
return SUCCESS(_reportFlowService.ProcessReportWork(workorder, processId, finish_num,bad_num,HttpContext.GetNickName()));
}
//TODO 获取工单下的报工列表
@@ -88,6 +88,9 @@ public class ReportFlowController : BaseController
return SUCCESS(_reportFlowService.GetWorkOrderReportWorkList(workorder));
}
}

View File

@@ -25,10 +25,10 @@ namespace DOAN.Model.MES.product
public string RouteCode { get; set; }
/// <summary>
/// 工序code
/// 工序id
/// </summary>
[SugarColumn(ColumnName = "process_code")]
public string ProcessCode { get; set; }
[SugarColumn(ColumnName = "process_id")]
public int ProcessId { get; set; }
/// <summary>
/// 计划数量

View File

@@ -0,0 +1,82 @@
namespace DOAN.Model.Mobile.ReportFlow.Dto;
public class ProReportWorkDetialDto
{
public string Id { get; set; }
/// <summary>
/// 工单code
/// </summary>
public string Workorder { get; set; }
/// <summary>
/// 路线code
/// </summary>
public string RouteCode { get; set; }
/// <summary>
/// 工序id
/// </summary>
public int ProcessId { get; set; }
/// <summary>
/// 工序名称
/// </summary>
public string ProcessName { get; set; }
/// <summary>
/// 计划数量
/// </summary>
public int? PlanNum { get; set; }
/// <summary>
/// 完成数量
/// </summary>
public int? FinishNum { get; set; }
/// <summary>
/// 不良数量
/// </summary>
public int? BadNum { get; set; }
/// <summary>
/// 作业员
/// </summary>
public string Worker { get; set; }
/// <summary>
/// 作业日期
/// </summary>
public DateTime? JobDate { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string CreatedBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreatedTime { get; set; }
/// <summary>
/// 更新人
/// </summary>
public string UpdatedBy { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime? UpdatedTime { get; set; }
}

View File

@@ -1,4 +1,5 @@
using DOAN.Model.MES.product;
using DOAN.Model.Mobile.ReportFlow.Dto;
namespace DOAN.Service.Mobile.IService;
@@ -7,10 +8,10 @@ public interface IReportFlowService: IBaseService<ProReportwork01>
ProWorkorder GetWorkOrderDetail(string workorder);
ProReportwork01 GetProcessReportWorkDetail(string workorder, string process);
ProReportwork01 GetProcessReportWorkDetail(string workorder, int process);
bool ProcessReportWork(string workorder, string process, int finish_num,int bad_num,string Worker);
bool ProcessReportWork(string workorder, int process, int finish_num,int bad_num,string Worker);
List<ProReportwork01> GetWorkOrderReportWorkList(string workorder);
List<ProReportWorkDetialDto> GetWorkOrderReportWorkList(string workorder);
}

View File

@@ -1,4 +1,6 @@
using DOAN.Model.MES.base_;
using DOAN.Model.MES.product;
using DOAN.Model.Mobile.ReportFlow.Dto;
using DOAN.Model.Public;
using DOAN.Service.Mobile.IService;
using DOAN.Service.Public.IPublicService;
@@ -18,18 +20,18 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
return Context.Queryable<ProWorkorder>().Where(x => x.Workorder == workorder).First();
}
public ProReportwork01 GetProcessReportWorkDetail(string workorder, string process)
public ProReportwork01 GetProcessReportWorkDetail(string workorder, int process)
{
return Context.Queryable<ProReportwork01>().Where(x => x.Workorder == workorder && x.ProcessCode == process).First();
return Context.Queryable<ProReportwork01>().Where(x => x.Workorder == workorder && x.ProcessId == process).First();
}
public bool ProcessReportWork(string workorder, string process, int finish_num,int bad_num,string Worker)
public bool ProcessReportWork(string workorder, int process, int finish_num,int bad_num,string Worker)
{
int result = 0;
bool Exist= Context.Queryable<ProReportwork01>().Where(it => it.Workorder == workorder&&it.ProcessCode==process).Any();
bool Exist= Context.Queryable<ProReportwork01>().Where(it => it.Workorder == workorder&&it.ProcessId==process).Any();
if (Exist)
{
result= Context.Updateable<ProReportwork01>().Where(it => it.Workorder == workorder && it.ProcessCode == process)
result= Context.Updateable<ProReportwork01>().Where(it => it.Workorder == workorder && it.ProcessId == process)
.SetColumns(it => it.FinishNum == finish_num)
.SetColumns(it => it.BadNum == bad_num)
.SetColumns(it => it.Worker == Worker)
@@ -44,7 +46,7 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
ProReportwork01 proReportwork01=new ProReportwork01();
proReportwork01.Id = XueHua;
proReportwork01.Workorder = workorder;
proReportwork01.ProcessCode = process;
proReportwork01.ProcessId = process;
proReportwork01.FinishNum = finish_num;
proReportwork01.BadNum = bad_num;
proReportwork01.Worker = Worker;
@@ -58,9 +60,24 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
}
public List<ProReportwork01> GetWorkOrderReportWorkList(string workorder)
public List<ProReportWorkDetialDto> GetWorkOrderReportWorkList(string workorder)
{
return Context.Queryable<ProReportwork01>().Where(x => x.Workorder == workorder).ToList();
return Context.Queryable<ProReportwork01>()
.LeftJoin<BaseWorkProcesses>((rw, wp) => rw.ProcessId == wp.Id)
.Where((rw, wp) => rw.Workorder == workorder)
.OrderBy(rw => rw.ProcessId)
.Select((rw, wp) => new ProReportWorkDetialDto()
{
ProcessName = wp.Name,
}, true)
.ToList();
}
}