This commit is contained in:
qianhao.xu 2024-11-07 16:45:06 +08:00
parent 2b11aeae01
commit 9cf41d21a3
7 changed files with 98 additions and 20 deletions

View File

@ -64,6 +64,17 @@ public class WorkOrderProgressController : BaseController
var response = workorderProgressService.GetWorkOrderListNoFinish(today, line_code, group_code);
return SUCCESS(response);
}
//TODO 获取全部工单
//TODO 根据班组 ,产线 和日期获取all工单
[HttpGet("get_workorder_list")]
public IActionResult GetWorkOrderList(string group_code, string line_code, DateTime handleDate)
{
if (string.IsNullOrEmpty(group_code) || string.IsNullOrEmpty(line_code) || handleDate == DateTime.MinValue)
return SUCCESS(null);
var response = workorderProgressService.GetWorkOrderList(group_code, line_code, handleDate);
return SUCCESS(response);
}
// 获取工单详情

View File

@ -361,6 +361,19 @@ namespace DOAN.Admin.WebApi.Controllers
return SUCCESS(response);
}
// TODO 如果没有id 传入工单 手动生成报工记录
[HttpGet("manual_generation_reportwork")]
public IActionResult ManualGenerationOfReportWork(string workorder)
{
if (string.IsNullOrEmpty(workorder)) {
throw new CustomException("workorder is null");
}
var response = _ProWorkorderService.ManualGenerationOfReportWork(workorder,HttpContext.GetName());
return SUCCESS(response);
}
}
}

View File

@ -19,6 +19,8 @@ namespace DOAN.Service.JobKanban.IService
List<ProWorkorderDto4> GetWorkOrderListNoFinish(DateTime today, string line_code, string group_code);
List<ProWorkorder> GetWorkOrderList(string group_code, string line_code, DateTime handleDate);
ProWorkorderDto4 GetWorkOrderDetail(string workorder);

View File

@ -23,7 +23,15 @@ public class WorkorderProgressService : BaseService<ProWorkorder>, IWorkorderPro
return Context.Queryable<BaseGroup>().Where(it => it.Status == 1).ToList();
}
public List<ProWorkorder> GetWorkOrderList(string group_code, string line_code, DateTime handleDate)
{
handleDate = handleDate.ToLocalTime().Date;
return Context.Queryable<ProWorkorder>().Where(it => it.GroupCode == group_code)
.Where(it => it.LineCode == line_code)
.Where(it => it.WorkorderDate == handleDate)
.ToList();
}
public List<ProReportwork> GetReportWorkRecord(string group_code, string line_code, DateTime handleDate)
{

View File

@ -61,5 +61,7 @@ namespace DOAN.Service.MES.product.IService
int WorkOrderLog(string workorder, string log, string Operator);
int ManualGenerationOfReportWork(string workorder, string CreatedBy);
}
}

View File

@ -31,23 +31,33 @@ namespace DOAN.Service.MES.product
/// <returns></returns>
public PagedInfo<ProReportworkDto> GetList(ProReportworkQueryDto parm)
{
if(parm.TimeRange!=null&&parm.TimeRange.Length == 2)
if (parm.TimeRange != null && parm.TimeRange.Length == 2)
{
parm.TimeRange[0]= parm.TimeRange[0].Date;
parm.TimeRange[1]= parm.TimeRange[1].Date.AddDays(1);
parm.TimeRange[0] = parm.TimeRange[0].Date;
parm.TimeRange[1] = parm.TimeRange[1].Date.AddDays(1);
}
var predicate = Expressionable.Create<ProReportwork>()
.AndIF(!string.IsNullOrEmpty(parm.FkWorkorder),it=>it.FkWorkorder.Contains(parm.FkWorkorder))
.AndIF(!string.IsNullOrEmpty(parm.GroupCode),it=>it.GroupCode==parm.FkWorkorder)
.AndIF(!string.IsNullOrEmpty(parm.LineCode),it=>it.LineCode==parm.FkWorkorder)
.AndIF(parm.TimeRange != null && parm.TimeRange.Length == 2 && parm.TimeRange[0]>DateTime.MinValue,it=>it.CreatedTime>= parm.TimeRange[0])
.AndIF(parm.TimeRange != null && parm.TimeRange.Length == 2 && parm.TimeRange[1]>DateTime.MinValue,it=>it.CreatedTime<= parm.TimeRange[1])
var predicate = Expressionable.Create<ProWorkorder, ProReportwork>()
.AndIF(!string.IsNullOrEmpty(parm.FkWorkorder), (w, r) => w.Workorder.Contains(parm.FkWorkorder))
.AndIF(!string.IsNullOrEmpty(parm.GroupCode), (w, r) => w.GroupCode == parm.FkWorkorder)
.AndIF(!string.IsNullOrEmpty(parm.LineCode), (w, r) => w.LineCode == parm.FkWorkorder)
.AndIF(parm.TimeRange != null && parm.TimeRange.Length == 2 && parm.TimeRange[0] > DateTime.MinValue, (w, r) => w.WorkorderDate >= parm.TimeRange[0])
.AndIF(parm.TimeRange != null && parm.TimeRange.Length == 2 && parm.TimeRange[1] > DateTime.MinValue, (w, r) => w.WorkorderDate <= parm.TimeRange[1])
;
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<ProReportwork, ProReportworkDto>(parm);
var response = Context.Queryable<ProWorkorder>().LeftJoin<ProReportwork>((w, r) => w.Workorder == r.FkWorkorder)
.Where(predicate.ToExpression())
.Select((w, r) => new ProReportworkDto
{
Id = r.Id,
FkWorkorder =w.Workorder,
GroupCode = w.GroupCode,
LineCode = w.LineCode,
DispatchNum=w.DeliveryNum,
}, true).ToPage_NO_Convert<ProReportworkDto>(parm);
return response;
}
@ -103,14 +113,14 @@ namespace DOAN.Service.MES.product
public List<ProReportworkDto> UserExport(DateTime handleDate)
{
// DateTime AddhandleDate = handleDate.AddDays(1);
// DateTime AddhandleDate = handleDate.AddDays(1);
return Context.Queryable<ProWorkorder>()
.LeftJoin<ProReportwork>((w, r) => w.Workorder == r.FkWorkorder)
.Where((w, r) => w.WorkorderDate == handleDate)
.Select((w, r) => r)
.ToList()
.Adapt<List<ProReportworkDto>>();
return Context.Queryable<ProWorkorder>()
.LeftJoin<ProReportwork>((w, r) => w.Workorder == r.FkWorkorder)
.Where((w, r) => w.WorkorderDate == handleDate)
.Select((w, r) => r)
.ToList()
.Adapt<List<ProReportworkDto>>();
}

View File

@ -34,6 +34,7 @@ using Microsoft.AspNetCore.Authentication;
using System.Reflection;
using Infrastructure;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Http.HttpResults;
namespace DOAN.Service.MES.product
{
@ -1222,6 +1223,37 @@ namespace DOAN.Service.MES.product
return result;
}
/// <summary>
/// 如果没有id 传入工单 手动生成报工记录
/// </summary>
/// <param name="workorder"></param>
/// <returns></returns>
public int ManualGenerationOfReportWork(string workorder,string CreatedBy)
{
bool isEXsit= Context.Queryable<ProReportwork>().Where(it => it.FkWorkorder == workorder).Any();
if (isEXsit) {
return -1;
}
ProWorkorder handleWorkorder= Context.Queryable<ProWorkorder>().Where(it => it.Workorder == workorder).First();
ProReportwork proReportwork =new
ProReportwork();
proReportwork.Id = XueHua;
proReportwork.FkWorkorder = workorder;
proReportwork.DispatchNum = handleWorkorder.DeliveryNum;
proReportwork.FinishedNum = null;
proReportwork.GroupCode = handleWorkorder.GroupCode;
proReportwork.LineCode = handleWorkorder.LineCode;
proReportwork.CreatedBy = CreatedBy;
proReportwork.CreatedTime = DateTime.Now;
return Context.Insertable(proReportwork).ExecuteCommand();
}
}