@@ -25,6 +25,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Folder Include="Entitys\View\" /> | |||
<Folder Include="Services\DeviceService\" /> | |||
<Folder Include="Services\MaterialService\" /> | |||
<Folder Include="Services\RecipesService\" /> | |||
@@ -552,6 +552,11 @@ | |||
批次号 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.Pztj_WorkInfoEntity.Status"> | |||
<summary> | |||
工单当前状态 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.Pztj_WorkInfoEntity.CreateTime"> | |||
<summary> | |||
创建时间 | |||
@@ -1256,6 +1261,11 @@ | |||
日志消息 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.RunLogEntity.UpdateTime"> | |||
<summary> | |||
更新时间 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Entitys.UserLogEntity"> | |||
<summary> | |||
名 称 :用户日志 | |||
@@ -7139,7 +7149,7 @@ | |||
<summary> | |||
获取产品生产统计 | |||
</summary> | |||
<param name="inputDto"></param> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.ReportService.IReportService.GetMaterialsReport(BPA.MES.Base.Application.Services.ReportService.Dtos.MaterialsInputDto)"> | |||
@@ -7153,14 +7163,14 @@ | |||
<summary> | |||
获取成品生产统计 | |||
</summary> | |||
<param name="inputDto"></param> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.ReportService.ReportService.GetMaterialsReport(BPA.MES.Base.Application.Services.ReportService.Dtos.MaterialsInputDto)"> | |||
<summary> | |||
获取物料统计 | |||
</summary> | |||
<param name="inputDto"></param> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Services.StockInfoDto"> | |||
@@ -8703,7 +8713,7 @@ | |||
主键 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.EmployeeQueryPageInput.Keyword"> | |||
<member name="P:BPA.MES.Base.Application.EmployeeQueryPageInput.name"> | |||
<summary> | |||
关键字 | |||
</summary> | |||
@@ -12,22 +12,27 @@ | |||
/// <summary> | |||
/// 桶Id | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string BucketId { get; set; } | |||
/// <summary> | |||
/// 物料Id | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string MaterialId { get; set; } | |||
/// <summary> | |||
/// 添加时间 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public DateTime? CreateTime { get; set; } | |||
/// <summary> | |||
/// 重量 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Weight { get; set; } | |||
/// <summary> | |||
/// 工单Id | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string WorkId { get; set; } | |||
} | |||
} |
@@ -22,18 +22,22 @@ | |||
/// <summary> | |||
/// 设备类型 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string DeviceType { get; set; } | |||
/// <summary> | |||
/// 设备描述 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Describe { get; set; } | |||
/// <summary> | |||
/// 设备维保时间 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string RepairDate { get; set; } | |||
/// <summary> | |||
/// 设备创建时间 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string CreateTime { get; set; } | |||
} | |||
} |
@@ -36,6 +36,11 @@ | |||
/// </summary> | |||
public string BatchId { get; set; } | |||
/// <summary> | |||
/// 工单当前状态 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public WorkOrderStatusEnum? Status { get; set; } | |||
/// <summary> | |||
/// 创建时间 | |||
/// </summary> | |||
public DateTime CreateTime { get; set; } | |||
@@ -12,18 +12,22 @@ | |||
/// <summary> | |||
/// 工单Id | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string WorkId { get; set; } | |||
/// <summary> | |||
/// 工单状态 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public WorkOrderStatusEnum? Status { get; set; } | |||
/// <summary> | |||
/// 创建时间 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public DateTime CreateTime { get; set; } | |||
/// <summary> | |||
/// 备注 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Remark { get; set; } | |||
} | |||
} |
@@ -12,14 +12,17 @@ | |||
/// <summary> | |||
/// 物料名称 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string MaterialName { get; set; } | |||
/// <summary> | |||
/// 物料id | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string MaterialId { get; set; } | |||
/// <summary> | |||
/// 工单id | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string WorkId { get; set; } | |||
/// <summary> | |||
/// 重量 | |||
@@ -34,6 +37,7 @@ | |||
/// <summary> | |||
/// 配方Id | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string RecipeId { get; set; } | |||
/// <summary> | |||
/// 配方名称 | |||
@@ -53,6 +57,7 @@ | |||
/// <summary> | |||
/// 误差 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string ErrorWeight { get; set; } | |||
} | |||
} |
@@ -12,14 +12,17 @@ | |||
/// <summary> | |||
/// 设备产品Id | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string DeviceProductId { get; set; } | |||
/// <summary> | |||
/// 功能名称 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 功能编码 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Code { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
@@ -29,6 +32,7 @@ | |||
/// <summary> | |||
/// 方法参数 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true, ColumnDataType = "longtext")] | |||
public string Params { get; set; } | |||
} | |||
} |
@@ -12,13 +12,12 @@ | |||
/// <summary> | |||
/// 日志类型 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
[SugarColumn(IsNullable = true, ColumnDataType = "varchar",Length = 200)] | |||
public string LogType { get; set; } | |||
/// <summary> | |||
/// 日志消息 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
[SugarColumn(IsNullable = true, ColumnDataType = "longtext")] | |||
public string MsgInfo { get; set; } | |||
/// <summary> | |||
/// 日期 | |||
@@ -6,6 +6,8 @@ | |||
/// 创建时间 : 2023/8/21 10:18:34 | |||
/// 描 述 : | |||
/// </summary> | |||
[SplitTable(SplitType.Month)] | |||
//[SugarTable("runlog_{year}{month}{day}")] | |||
[SugarTable("runlog")] | |||
public class RunLogEntity : DEntityBase | |||
{ | |||
@@ -17,7 +19,7 @@ | |||
/// <summary> | |||
/// 日志消息 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
[SugarColumn(IsNullable = true, ColumnDataType = "longtext")] | |||
public string MsgInfo { get; set; } | |||
/// <summary> | |||
/// 日期 | |||
@@ -32,7 +34,12 @@ | |||
/// <summary> | |||
/// 日志消息 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
[SugarColumn(IsNullable = true),SplitField] | |||
public DateTime CreateDate { get; set; } | |||
/// <summary> | |||
/// 更新时间 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)]//设置为可空字段 | |||
public DateTime UpdateTime { get; set; } | |||
} | |||
} |
@@ -75,6 +75,7 @@ | |||
.WhereIF(!string.IsNullOrEmpty(input.MsgInfo), x => x.MsgInfo.Contains(input.MsgInfo)) | |||
.WhereIF(input.StartTime.HasVal(), x => x.CreateDate >= input.StartTime.Value) | |||
.WhereIF(input.EndTime.HasVal(), x => x.CreateDate <= input.EndTime.Value) | |||
//.SplitTable(input.StartTime.Value, input.EndTime.Value) | |||
.OrderByDescending(x => x.CreateDate) | |||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||
SqlSugarPagedList<RunLogOutput> output = entity.Adapt<SqlSugarPagedList<RunLogOutput>>(); | |||
@@ -6,10 +6,10 @@ using System.Threading.Tasks; | |||
namespace BPA.MES.Base.Application.Services.ReportService.Dtos | |||
{ | |||
public class MaterialsInputDto | |||
public class MaterialsInputDto: RequestPage | |||
{ | |||
public DateTime? StartTime { get; set; } | |||
public DateTime? EndTime { get; set; } | |||
public string MaterialsName { get; set; } | |||
public string MaterialName { get; set; } | |||
} | |||
} |
@@ -6,7 +6,7 @@ using System.Threading.Tasks; | |||
namespace BPA.MES.Base.Application.Services.ReportService.Dtos | |||
{ | |||
public class ProductInputDto | |||
public class ProductInputDto : RequestPage | |||
{ | |||
public DateTime? StartTime { get; set; } | |||
public DateTime? EndTime { get; set; } | |||
@@ -12,15 +12,15 @@ namespace BPA.MES.Base.Application.Services.ReportService | |||
/// <summary> | |||
/// 获取产品生产统计 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
Task<List<ProductOutDto>> GetProductReport(ProductInputDto inputDto); | |||
Task<SqlSugarPagedList<ProductOutDto>> GetProductReport(ProductInputDto input); | |||
/// <summary> | |||
/// 获取物料统计 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<List<MaterialsOutDto>> GetMaterialsReport(MaterialsInputDto inputDto); | |||
Task<SqlSugarPagedList<MaterialsOutDto>> GetMaterialsReport(MaterialsInputDto inputDto); | |||
} | |||
} |
@@ -20,29 +20,24 @@ namespace BPA.MES.Base.Application.Services.ReportService | |||
/// <summary> | |||
/// 获取成品生产统计 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
public async Task<List<ProductOutDto>> GetProductReport(ProductInputDto inputDto) | |||
public async Task<SqlSugarPagedList<ProductOutDto>> GetProductReport(ProductInputDto input) | |||
{ | |||
var res = await _dbContext.Queryable<Pztj_WorkInfoEntity, Pztj_WorkInfoStatusEntity,Pztj_FinalsInfoEntity> | |||
((a, b,c) => | |||
new JoinQueryInfos( | |||
JoinType.Left, a.Id == b.WorkId, | |||
JoinType.Left,a.FinalId==c.Id) | |||
) | |||
.Where((a,b,c)=>b.Status== WorkOrderStatusEnum.Completed) | |||
.WhereIF(!string.IsNullOrEmpty(inputDto.ProductName),(a,b,c)=>c.Name.Contains(inputDto.ProductName)) | |||
.WhereIF(inputDto.StartTime.HasVal(),(a,b,c)=>b.CreateTime>=inputDto.StartTime.Value) | |||
.WhereIF(inputDto.EndTime.HasVal(), (a, b, c) => b.CreateTime >= inputDto.EndTime.Value) | |||
var res = await _dbContext.Queryable<Pztj_WorkInfoEntity>().LeftJoin<Pztj_FinalsInfoEntity>((a, b) => a.FinalId == b.Id) | |||
.WhereIF(!string.IsNullOrEmpty(input.ProductName), (a, b) => b.Name.Contains(input.ProductName)) | |||
.WhereIF(input.StartTime.HasVal(), (a, b) => a.CreateTime >= input.StartTime.Value) | |||
.WhereIF(input.EndTime.HasVal(), (a, b) => a.CreateTime <= input.EndTime.Value) | |||
.Where((a, b) => a.Status == WorkOrderStatusEnum.Completed) | |||
.GroupBy((a, b) => b.Name) | |||
.Select((a, b) => new ProductOutDto | |||
{ | |||
ProductName = b.Name, | |||
Count = SqlFunc.AggregateSum(Convert.ToDecimal(a.Number)), | |||
.Select((a,b,c) => new ProductOutDto() | |||
{ | |||
Count = SqlFunc.AggregateSum(Convert.ToInt32(a.Number)), | |||
ProductId=a.FinalId, | |||
ProductName=c.Name | |||
}).ToPagedListAsync(input.PageIndex, input.PageSize); | |||
}).ToListAsync(); | |||
return res; | |||
} | |||
@@ -50,66 +45,25 @@ namespace BPA.MES.Base.Application.Services.ReportService | |||
/// <summary> | |||
/// 获取物料统计 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
public async Task<List<MaterialsOutDto>> GetMaterialsReport(MaterialsInputDto inputDto) | |||
public async Task<SqlSugarPagedList<MaterialsOutDto>> GetMaterialsReport(MaterialsInputDto input) | |||
{ | |||
var result = new List<MaterialsOutDto>(); | |||
var res = await _dbContext.Queryable<Pztj_WorkInfoEntity, Pztj_WorkInfoStatusEntity, Pztj_FinalsInfoEntity> | |||
((a, b, c) => | |||
new JoinQueryInfos( | |||
JoinType.Left, a.Id == b.WorkId, | |||
JoinType.Left, a.FinalId == c.Id) | |||
) | |||
.Where((a, b, c) => b.Status != WorkOrderStatusEnum.Draft) | |||
.WhereIF(inputDto.StartTime.HasVal(), (a, b, c) => b.CreateTime >= inputDto.StartTime.Value) | |||
.WhereIF(inputDto.EndTime.HasVal(), (a, b, c) => b.CreateTime >= inputDto.EndTime.Value) | |||
.Select((a, b, c) => new | |||
{ | |||
ProductId = a.FinalId, | |||
Count = SqlFunc.AggregateSum(Convert.ToInt32(a.Number)), | |||
c.RecipeId | |||
}).ToListAsync(); | |||
var recipeId = res.Select(x => x.RecipeId).ToList(); | |||
var recipes = await _dbContext.Queryable<RecipeMaterialEntity>() | |||
.Where(x => recipeId.Contains(x.RecipesId)) | |||
.Select(x => new | |||
{ | |||
x.MaterialId, | |||
x.Weight, | |||
x.RecipesId | |||
}) .ToListAsync(); | |||
var materialsId= recipes.Select(x => x.MaterialId).ToList(); | |||
var materials = await _dbContext.Queryable<Pztj_MaterialsInfoEntity>() | |||
.Where(x=> materialsId.Contains(x.Id)) | |||
.WhereIF(!string.IsNullOrEmpty(inputDto.MaterialsName),x=>x.Name.Contains(inputDto.MaterialsName)) | |||
.ToListAsync(); | |||
foreach (var item in materials) | |||
{ | |||
var count = 0; | |||
foreach (var item2 in res.GroupBy(x=>x.RecipeId)) | |||
{ | |||
var data = recipes.Where(x=>x.RecipesId==item2.Key &&x.MaterialId==item.Id).FirstOrDefault(); | |||
count=item2.First().Count*Convert.ToInt32(data==null? 0: data.Weight); | |||
} | |||
result.Add(new MaterialsOutDto() | |||
var result = await _dbContext.Queryable<WorkInfoMaterialsRecordEntity>() | |||
.LeftJoin<Pztj_WorkInfoEntity>((a, b) => a.WorkId == b.Id) | |||
.Where((a, b) => b.Status == WorkOrderStatusEnum.Completed) | |||
.WhereIF(!string.IsNullOrEmpty(input.MaterialName), (a, b) => a.MaterialName.Contains(input.MaterialName)) | |||
.WhereIF(input.StartTime.HasVal(), (a, b) => b.CreateTime >= input.StartTime.Value) | |||
.WhereIF(input.EndTime.HasVal(), (a, b) => b.CreateTime <= input.EndTime.Value) | |||
.GroupBy((a, b) => a.MaterialName) | |||
.Select((a, b) => new MaterialsOutDto | |||
{ | |||
MaterialId=item.Id, | |||
MaterialName=item.Name, | |||
Count= count, | |||
}); | |||
} | |||
Count = SqlFunc.AggregateSumNoNull(Convert.ToDecimal(a.Weight)), | |||
MaterialName = a.MaterialName, | |||
}).ToPagedListAsync(input.PageIndex, input.PageSize); | |||
return result; | |||
} | |||
} | |||
} |
@@ -84,7 +84,7 @@ | |||
/// <summary> | |||
/// 关键字 | |||
/// </summary> | |||
public string Keyword { get; set; } | |||
public string name { get; set; } | |||
/// <summary> | |||
/// 状态 | |||
/// </summary> | |||
@@ -352,8 +352,9 @@ | |||
var entity = await db.Queryable<EmployeeEntity>() | |||
.WhereIF(!string.IsNullOrEmpty(input.Keyword), t => t.Name.Contains(input.Keyword)) | |||
.WhereIF(input.Status > 0, t => t.Status == input.Status).WhereIF(input.Gender > 0, t => t.Gender == input.Gender) | |||
.WhereIF(!string.IsNullOrEmpty(input.name), t => t.Name.Contains(input.name)) | |||
.WhereIF(input.Status > 0, t => t.Status == input.Status). | |||
WhereIF(input.Gender > 0, t => t.Gender == input.Gender) | |||
.Where(t => t.IsAdmin == false) | |||
.Select(t => new EmployeeOutput() | |||
@@ -443,7 +444,21 @@ | |||
[HttpGet] | |||
public async Task<List<RoleModuleOutput>> RoleModuleList(string RoleId) | |||
{ | |||
var entitys = await _dbContext.Queryable<RoleModuleEntity>().Where(x => x.RoleId == RoleId&&x.ParentId!="").ToListAsync(); | |||
var entitys = await _dbContext.Queryable<RoleModuleEntity>().Where(x => x.RoleId == RoleId).ToListAsync(); | |||
var tementity = entitys.Where(x => x.ParentId == "").ToList();//查询出主菜单 | |||
var delentity = new List<RoleModuleEntity>(); | |||
foreach (var item in tementity)//查询出主菜单是否有多个 | |||
{ | |||
var v = entitys.Where(x=>x.ParentId==item.ModuleId).ToList(); | |||
if (v.Count>0)//如果只有一个,就不删除 | |||
{ | |||
delentity.Add(item); | |||
} | |||
} | |||
foreach (var item in delentity) | |||
{ | |||
entitys.Remove(item); | |||
} | |||
var output = entitys.Adapt<List<RoleModuleOutput>>(); | |||
return output; | |||
} | |||
@@ -92,5 +92,7 @@ | |||
/// </summary> | |||
public int Count { get; set; } | |||
public List<WorkInfoOutput> WorkList { get; set; } = new(); | |||
} | |||
} |
@@ -11,10 +11,12 @@ | |||
{ | |||
private readonly ISqlSugarClient _dbContext; | |||
private readonly IMQTTService _MQTTService; | |||
public WorkBatchService(ISqlSugarClient db, IMQTTService MQTTService) | |||
private readonly IWorkInfoService _workInfoService; | |||
public WorkBatchService(ISqlSugarClient db, IMQTTService MQTTService, IWorkInfoService WorkInfoService) | |||
{ | |||
_dbContext = db; | |||
_MQTTService = MQTTService; | |||
_workInfoService = WorkInfoService; | |||
} | |||
public async Task<bool> Add(WorkBatchAddInput input) | |||
{ | |||
@@ -61,10 +63,10 @@ | |||
Count = SqlFunc.Subqueryable<Pztj_WorkInfoEntity>().Where(d=>d.BatchId==x.Id).Count() | |||
}) | |||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||
//foreach (var item in entity.Items) | |||
//{ | |||
// item.Status = WorkOrderStatusEnum.Started | |||
//} | |||
foreach (var item in entity.Items) | |||
{ | |||
item.WorkList = await _workInfoService.List(new WorkInfoQueryInput { BatchId = item.Id }); | |||
} | |||
return entity; | |||
} | |||
@@ -154,23 +154,27 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services | |||
var entity = await _dbContext.Queryable<Pztj_WorkInfoEntity>() | |||
.LeftJoin<Pztj_FinalsInfoEntity>((a, b) => a.FinalId == b.Id) | |||
.LeftJoin<ProductLineEntity>((a, b, c) => a.LineId == c.Id) | |||
.LeftJoin<Pztj_WorkInfoStatusEntity>((a, b, c, d) => d.Id == SqlFunc.Subqueryable<Pztj_WorkInfoStatusEntity>().Where(s => s.WorkId == a.Id).OrderByDesc(s => s.CreateTime).Select(s => s.Id)) | |||
.LeftJoin<Pztj_DevicesInfoEntity>((a,b,c,d,e)=>a.DeviceId==e.Id) | |||
.LeftJoin<Pztj_DevicesInfoEntity>((a, b, c, d) =>a.DeviceId==d.Id) | |||
.WhereIF(!string.IsNullOrEmpty(input.Name), (a, b, c, d) => b.Name.Contains(input.Name)) | |||
.WhereIF(!string.IsNullOrEmpty(input.Id), (a, b, c, d) => a.Id.Contains(input.Id)) | |||
.WhereIF(!string.IsNullOrEmpty(input.BatchId), (a, b, c, d) => a.BatchId == input.BatchId) | |||
.WhereIF(input.Status != null, (a, b, c, d) => input.Status.Contains(d.Status)) | |||
.WhereIF(input.Status != null, (a, b, c, d) => input.Status.Contains(a.Status)) | |||
.WhereIF(input.StartTime != null, (a, b, c, d) => input.StartTime <= Convert.ToDateTime(a.CreateTime)) | |||
.WhereIF(input.EndTime != null, (a, b, c, d) => input.EndTime.Value.AddHours(23).AddMinutes(59).AddSeconds(59) >= Convert.ToDateTime(a.CreateTime)) | |||
.OrderByDescending((a, b, c, d) => a.CreateTime) | |||
.Select((a, b, c, d,e) => new WorkInfoOutput | |||
.Select((a, b, c, d) => new WorkInfoOutput | |||
{ | |||
Id = a.Id.SelectAll(), | |||
Id = a.Id, | |||
FinalName = b.Name, | |||
LineName = c.Name, | |||
DeviceId = a.DeviceId == null ? "" : a.DeviceId, | |||
DeviceName = e.Name, | |||
Status = d.Status == null ? WorkOrderStatusEnum.Draft : d.Status | |||
DeviceName =d.Name, | |||
Status = a.Status == null ? WorkOrderStatusEnum.Draft : a.Status, | |||
BatchId = a.BatchId, | |||
Number = a.Number, | |||
FinalId = a.FinalId, | |||
LineId = a.LineId, | |||
DeviceCode = a.DeviceId | |||
}).ToListAsync(); | |||
return entity; | |||
} | |||
@@ -185,21 +189,20 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services | |||
var entity = await _dbContext.Queryable<Pztj_WorkInfoEntity>() | |||
.LeftJoin<Pztj_FinalsInfoEntity>((a, b) => a.FinalId == b.Id) | |||
.LeftJoin<ProductLineEntity>((a, b, c) => a.LineId == c.Id) | |||
.LeftJoin<Pztj_WorkInfoStatusEntity>((a, b, c, d) => d.Id == SqlFunc.Subqueryable<Pztj_WorkInfoStatusEntity>().Where(s => s.WorkId == a.Id).OrderByDesc(s => s.CreateTime).Select(s => s.Id)) | |||
.WhereIF(!string.IsNullOrEmpty(input.Name), (a, b, c, d) => b.Name.Contains(input.Name)) | |||
.WhereIF(!string.IsNullOrEmpty(input.Id), (a, b, c, d) => a.Id.Contains(input.Id)) | |||
.WhereIF(!string.IsNullOrEmpty(input.BatchId), (a, b, c, d) => a.BatchId==input.BatchId) | |||
.WhereIF(input.Status != null, (a, b, c, d) => input.Status.Contains(d.Status)) | |||
.WhereIF(input.StartTime != null, (a, b, c, d) => input.StartTime <= Convert.ToDateTime(a.CreateTime)) | |||
.WhereIF(input.EndTime != null, (a, b, c, d) => input.EndTime.Value.AddHours(23).AddMinutes(59).AddSeconds(59) >= Convert.ToDateTime(a.CreateTime)) | |||
.OrderByDescending((a, b, c, d) => a.CreateTime) | |||
.Select((a, b, c, d) => new WorkInfoOutput | |||
.WhereIF(!string.IsNullOrEmpty(input.Name), (a, b, c) => b.Name.Contains(input.Name)) | |||
.WhereIF(!string.IsNullOrEmpty(input.Id), (a, b, c) => a.Id.Contains(input.Id)) | |||
.WhereIF(!string.IsNullOrEmpty(input.BatchId), (a, b, c) => a.BatchId==input.BatchId) | |||
.WhereIF(input.Status != null, (a, b, c) => input.Status.Contains(a.Status)) | |||
.WhereIF(input.StartTime != null, (a, b, c) => input.StartTime <= Convert.ToDateTime(a.CreateTime)) | |||
.WhereIF(input.EndTime != null, (a, b, c) => input.EndTime.Value.AddHours(23).AddMinutes(59).AddSeconds(59) >= Convert.ToDateTime(a.CreateTime)) | |||
.OrderByDescending((a, b, c) => a.CreateTime) | |||
.Select((a, b, c) => new WorkInfoOutput | |||
{ | |||
Id = a.Id.SelectAll(), | |||
FinalName = b.Name, | |||
LineName = c.Name, | |||
DeviceId = a.DeviceId == null?"": a.DeviceId, | |||
Status = d.Status == null ? WorkOrderStatusEnum.Draft : d.Status | |||
DeviceId = a.DeviceId ?? "", | |||
Status = a.Status == null ? WorkOrderStatusEnum.Draft : a.Status | |||
}) | |||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||
return entity; | |||
@@ -215,19 +218,18 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services | |||
var entity = await _dbContext.Queryable<Pztj_WorkInfoEntity>() | |||
.LeftJoin<Pztj_FinalsInfoEntity>((a, b) => a.FinalId == b.Id) | |||
.LeftJoin<ProductLineEntity>((a, b, c) => a.LineId == c.Id) | |||
.LeftJoin<Pztj_WorkInfoStatusEntity>((a, b, c, d) => d.Id == SqlFunc.Subqueryable<Pztj_WorkInfoStatusEntity>().Where(s => s.WorkId == a.Id).OrderByDesc(s => s.CreateTime).Select(s => s.Id)) | |||
.WhereIF(!string.IsNullOrEmpty(input.Name), (a, b, c, d) => b.Name.Contains(input.Name)) | |||
.WhereIF(!string.IsNullOrEmpty(input.Id), (a, b, c, d) => a.Id.Contains(input.Id)) | |||
.WhereIF(input.Status != null, (a, b, c, d) => input.Status.Contains(d.Status)) | |||
.WhereIF(input.StartTime != null, (a, b, c, d) => input.StartTime <= Convert.ToDateTime(a.CreateTime)) | |||
.WhereIF(input.EndTime != null, (a, b, c, d) => input.EndTime.Value.AddHours(23).AddMinutes(59).AddSeconds(59) >= Convert.ToDateTime(a.CreateTime)) | |||
.OrderByDescending((a, b, c, d) => a.CreateTime) | |||
.Select((a, b, c, d) => new WorkInfoOutput | |||
.WhereIF(!string.IsNullOrEmpty(input.Name), (a, b, c) => b.Name.Contains(input.Name)) | |||
.WhereIF(!string.IsNullOrEmpty(input.Id), (a, b, c) => a.Id.Contains(input.Id)) | |||
.WhereIF(input.Status != null, (a, b, c) => input.Status.Contains(a.Status)) | |||
.WhereIF(input.StartTime != null, (a, b, c) => input.StartTime <= Convert.ToDateTime(a.CreateTime)) | |||
.WhereIF(input.EndTime != null, (a, b, c) => input.EndTime.Value.AddHours(23).AddMinutes(59).AddSeconds(59) >= Convert.ToDateTime(a.CreateTime)) | |||
.OrderByDescending((a, b, c) => a.CreateTime) | |||
.Select((a, b, c) => new WorkInfoOutput | |||
{ | |||
Id = a.Id.SelectAll(), | |||
FinalName = b.Name, | |||
LineName = c.Name, | |||
Status = d.Status == null ? WorkOrderStatusEnum.Draft : d.Status | |||
Status = a.Status == null ? WorkOrderStatusEnum.Draft : a.Status | |||
}) | |||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||
return entity; | |||
@@ -548,10 +550,21 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services | |||
[HttpPost] | |||
public async Task<bool> UpdateStatus(WorkInfoStatusUpdateInput input) | |||
{ | |||
Pztj_WorkInfoStatusEntity entity = input.Adapt<Pztj_WorkInfoStatusEntity>(); | |||
var res = await _dbContext.Insertable(entity).IgnoreColumns(true).ExecuteCommandIdentityIntoEntityAsync(); | |||
var entitys = await _dbContext.Queryable<Pztj_WorkInfoEntity>().Where(x => x.Id == input.WorkId) | |||
.FirstAsync(); | |||
.FirstAsync(); | |||
Pztj_WorkInfoStatusEntity entity = input.Adapt<Pztj_WorkInfoStatusEntity>(); | |||
try | |||
{ | |||
_dbContext.Ado.BeginTran(); | |||
await _dbContext.Insertable(entity).IgnoreColumns(true).ExecuteCommandIdentityIntoEntityAsync(); | |||
await _dbContext.Updateable<Pztj_WorkInfoEntity>().SetColumns(x => x.Status == input.Status).Where(x => x.Id == input.WorkId).ExecuteCommandAsync(); | |||
_dbContext.Ado.CommitTran(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
_dbContext.Ado.RollbackTran(); | |||
throw Oops.Bah("更新失败"); | |||
} | |||
var workItems = await _dbContext.Queryable<Pztj_WorkInfoEntity>().LeftJoin<Pztj_WorkInfoStatusEntity>((a, b) => a.Id == b.WorkId).Where(a => a.BatchId == entitys.BatchId) | |||
.Select((a, b) => new WorkInfoOutput | |||
{ | |||
@@ -567,7 +580,7 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services | |||
{ | |||
await _dbContext.Updateable<WorkBatchEntity>().SetColumns(x => x.Status == workItems.Max(x => x.Status)).Where(x => x.Id == entitys.BatchId).ExecuteCommandAsync(); | |||
} | |||
return res; | |||
return true; | |||
} | |||
/// <summary> | |||
/// 修改工单物料状态 | |||
@@ -632,14 +645,13 @@ namespace BPA.MES.Base.Application.Services.WorkInfoService.Services | |||
{ | |||
string userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value; | |||
string userName = App.User?.FindFirst(ClaimConst.CLAINM_NAME)?.Value; | |||
Pztj_WorkInfoStatusEntity entity = new() | |||
await UpdateStatus(new WorkInfoStatusUpdateInput | |||
{ | |||
WorkId = workId, | |||
Status = WorkOrderStatusEnum.Completed, | |||
Remark = $"{userName}[{userId}]点击你强制结束" | |||
}; | |||
var res = await _dbContext.Insertable(entity).IgnoreColumns(true).ExecuteCommandIdentityIntoEntityAsync(); | |||
return res; | |||
Remark = $"{userName}[{userId}]点击了强制结束" | |||
}); | |||
return true; | |||
} | |||
/// <summary> | |||
/// 工单状态变更记录 | |||
@@ -69,7 +69,7 @@ public class Startup : AppStartup | |||
} | |||
app.UseHttpsRedirection(); | |||
app.UseStaticFiles(); | |||
app.UseRouting(); | |||
app.UseCorsAccessor(); | |||
@@ -77,7 +77,7 @@ public class Startup : AppStartup | |||
app.UseAuthentication(); | |||
app.UseAuthorization(); | |||
app.UseInject(string.Empty); | |||
app.UseInject("swagger"); | |||
app.UseEndpoints(endpoints => | |||
{ | |||
@@ -19,6 +19,11 @@ | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPA.MES.Base.Web.Core\BPA.MES.Base.Web.Core.csproj" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Folder Include="wwwroot\" /> | |||
</ItemGroup> | |||
<ProjectExtensions> | |||
<VisualStudio> | |||
<UserProperties properties_4launchsettings_1json__JsonSchema="" /> | |||
@@ -16,6 +16,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121. | |||
<TargetFramework>net6.0</TargetFramework> | |||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | |||
<ProjectGuid>c8d99f52-edc7-411f-8300-6db14bf59e8c</ProjectGuid> | |||
<SelfContained>false</SelfContained> | |||
<SelfContained>true</SelfContained> | |||
</PropertyGroup> | |||
</Project> |
@@ -5,6 +5,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121. | |||
<Project> | |||
<PropertyGroup> | |||
<_PublishTargetUrl>E:\PZTJ.MES\backend\BPA.MES.Base.Web.Entry\bin\Release\net6.0\publish\</_PublishTargetUrl> | |||
<History>True|2024-01-27T02:07:54.6475711Z;True|2024-01-27T10:07:00.1713996+08:00;True|2024-01-27T10:06:39.3502684+08:00;</History> | |||
<History>True|2024-05-31T07:31:49.0731968Z;True|2024-05-31T15:16:29.2827947+08:00;True|2024-05-23T12:24:54.2540638+08:00;False|2024-05-23T12:24:24.6362916+08:00;True|2024-05-23T12:11:13.9636411+08:00;True|2024-05-23T12:10:21.6566433+08:00;True|2024-05-08T17:55:07.3841087+08:00;True|2024-01-27T10:07:54.6475711+08:00;True|2024-01-27T10:07:00.1713996+08:00;True|2024-01-27T10:06:39.3502684+08:00;</History> | |||
</PropertyGroup> | |||
</Project> |