修改物料页面
parent
495d66bc20
commit
1e341f201e
|
@ -164,5 +164,16 @@ public class PrintCodeDetailService : IDynamicApiController, ITransient
|
||||||
return await _rep.GetFirstAsync(a => a.Code == productCode);
|
return await _rep.GetFirstAsync(a => a.Code == productCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取打印条码详情
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="productCode"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
[ApiDescriptionSettings(Name = "GetByProductCodes")]
|
||||||
|
public async Task<List<PrintCodeDetail>> GetByProductCodes(string? productCode)
|
||||||
|
{
|
||||||
|
return await _rep.AsQueryable().Where(a => !a.IsDelete && a.Code.Contains(productCode)).ToListAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -387,3 +387,21 @@ public class QueryByIdReportDetailTableInput : DeleteReportDetailTableInput
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 汇报单详情更新审核状态
|
||||||
|
/// </summary>
|
||||||
|
public class UpdateStateReportDetailTableInput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 主键Id
|
||||||
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "主键Id不能为空")]
|
||||||
|
public string[] Ids { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否启用
|
||||||
|
/// </summary>
|
||||||
|
public string State { get; set; }
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ using Admin.NET.Application.Const;
|
||||||
using Admin.NET.Application.Entity;
|
using Admin.NET.Application.Entity;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Admin.NET.Application.Utils;
|
using Admin.NET.Application.Utils;
|
||||||
|
using AngleSharp.Dom;
|
||||||
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
|
||||||
|
|
||||||
namespace Admin.NET.Application;
|
namespace Admin.NET.Application;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -169,6 +171,23 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
|
||||||
}
|
}
|
||||||
|
|
||||||
var repeatCodes = await _codeDetailService.GetRepeat(input.CodeDatas);
|
var repeatCodes = await _codeDetailService.GetRepeat(input.CodeDatas);
|
||||||
|
var codesToKeep = new List<PrintCodeDetailOutput>();
|
||||||
|
foreach (var repeatCode in repeatCodes)
|
||||||
|
{
|
||||||
|
if (repeatCode.ReportTableId > 0)
|
||||||
|
{
|
||||||
|
var reportTable = await _reportTableService.Detail(new QueryByIdReportTableInput { Id = repeatCode.ReportTableId ?? 0 });
|
||||||
|
if (string.IsNullOrWhiteSpace(reportTable.ProductType) || reportTable.ProductType.Equals("普通生产"))
|
||||||
|
{
|
||||||
|
codesToKeep.Add(repeatCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
codesToKeep.Add(repeatCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repeatCodes = codesToKeep;
|
||||||
if (repeatCodes!=null&&repeatCodes.Count>0)
|
if (repeatCodes!=null&&repeatCodes.Count>0)
|
||||||
{
|
{
|
||||||
var repeats = repeatCodes.ConvertAll(a => a.Code).Distinct();
|
var repeats = repeatCodes.ConvertAll(a => a.Code).Distinct();
|
||||||
|
@ -230,7 +249,19 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
|
||||||
var code = CodeHelper.GetCode(item.BarCode, item.QrCode);
|
var code = CodeHelper.GetCode(item.BarCode, item.QrCode);
|
||||||
var codeType = string.IsNullOrEmpty(item.BarCode) ? "二维码" : "条码";
|
var codeType = string.IsNullOrEmpty(item.BarCode) ? "二维码" : "条码";
|
||||||
var unit = units.Find(a => a.Name == item.PackageName);
|
var unit = units.Find(a => a.Name == item.PackageName);
|
||||||
|
var reportTable = await _reportTableService.Detail(new QueryByIdReportTableInput { Id = reprotId });
|
||||||
|
if (reportTable.ProductType.Equals("返工生产"))
|
||||||
|
{
|
||||||
|
var upPrintCodeDetails = await _codeDetailService.GetByProductCodes(code);
|
||||||
|
foreach (var upPrintCodeDetail in upPrintCodeDetails)
|
||||||
|
{
|
||||||
|
if (!upPrintCodeDetail.Code.Contains("#"))
|
||||||
|
{
|
||||||
|
upPrintCodeDetail.Code = new string('#', (upPrintCodeDetails.Where(t=>t.Code.Contains("#")).Count())+1)+upPrintCodeDetail.Code;
|
||||||
|
await _codeDetailService.UpdateByEntity(upPrintCodeDetail);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
var detail = new AddPrintCodeDetailInput()
|
var detail = new AddPrintCodeDetailInput()
|
||||||
{
|
{
|
||||||
ReportTableId = reprotId,
|
ReportTableId = reprotId,
|
||||||
|
@ -460,6 +491,22 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
|
||||||
return await _rep.AsQueryable().Where(a => !a.IsDelete).Select<ReportDetailTableOutput>().ToListAsync();
|
return await _rep.AsQueryable().Where(a => !a.IsDelete).Select<ReportDetailTableOutput>().ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改汇报单审核状态
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[ApiDescriptionSettings(Name = "UpdateState")]
|
||||||
|
public async Task UpdateState(UpdateStateReportDetailTableInput input)
|
||||||
|
{
|
||||||
|
foreach (var id in input.Ids)
|
||||||
|
{
|
||||||
|
var entity = await _rep.GetByIdAsync(id);
|
||||||
|
entity.State = input.State;
|
||||||
|
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ using Admin.NET.Application.Service.ReportTable.Dto;
|
||||||
using static SKIT.FlurlHttpClient.Wechat.Api.Models.ComponentTCBBatchCreateContainerServiceVersionRequest.Types;
|
using static SKIT.FlurlHttpClient.Wechat.Api.Models.ComponentTCBBatchCreateContainerServiceVersionRequest.Types;
|
||||||
using Nest;
|
using Nest;
|
||||||
using Admin.NET.Application.Utils;
|
using Admin.NET.Application.Utils;
|
||||||
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
|
||||||
|
using SkiaSharp;
|
||||||
|
|
||||||
namespace Admin.NET.Application;
|
namespace Admin.NET.Application;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -61,14 +63,42 @@ public class ReportTableService : IDynamicApiController, ITransient
|
||||||
|| u.Remarks.Contains(input.SearchKey.Trim())
|
|| u.Remarks.Contains(input.SearchKey.Trim())
|
||||||
)
|
)
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.OddNumber), u => u.OddNumber.Contains(input.OddNumber.Trim()))
|
.WhereIF(!string.IsNullOrWhiteSpace(input.OddNumber), u => u.OddNumber.Contains(input.OddNumber.Trim()))
|
||||||
.WhereIF(input.State>0, u => u.State == input.State)
|
.WhereIF(input.State > 0, u => u.State == input.State)
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.ProductType), u => u.ProductType.Contains(input.ProductType.Trim()))
|
.WhereIF(!string.IsNullOrWhiteSpace(input.ProductType), u => u.ProductType.Contains(input.ProductType.Trim()))
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.ProductionLine), u => u.ProductionLine.Contains(input.ProductionLine.Trim()))
|
.WhereIF(!string.IsNullOrWhiteSpace(input.ProductionLine), u => u.ProductionLine.Contains(input.ProductionLine.Trim()))
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.CodeNum), u => u.CodeNum.Contains(input.CodeNum.Trim()))
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CodeNum), u => u.CodeNum.Contains(input.CodeNum.Trim()))
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.SourceNumber), u => u.SourceNumber.Contains(input.SourceNumber.Trim()))
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SourceNumber), u => u.SourceNumber.Contains(input.SourceNumber.Trim()))
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Remarks), u => u.Remarks.Contains(input.Remarks.Trim()))
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Remarks), u => u.Remarks.Contains(input.Remarks.Trim()))
|
||||||
.Select<ReportTableOutput>();
|
.LeftJoin<PrintCodeDetail>((u, detail) => u.Id == detail.ReportTableId) // 左连接的条件
|
||||||
if(input.StartDateRange != null && input.StartDateRange.Count >0)
|
.GroupBy((u, detail) => u.Id)
|
||||||
|
.Select<ReportTableOutput>((u, detail) => new ReportTableOutput
|
||||||
|
{
|
||||||
|
Id = u.Id,
|
||||||
|
OddNumber = u.OddNumber,
|
||||||
|
StartDate = u.StartDate,
|
||||||
|
State = u.State,
|
||||||
|
ProductType = u.ProductType,
|
||||||
|
ProductionLine = u.ProductionLine,
|
||||||
|
CodeNum = u.CodeNum,
|
||||||
|
SourceNumber = u.SourceNumber,
|
||||||
|
SourceId = u.SourceId,
|
||||||
|
MaterialsId = u.MaterialsId,
|
||||||
|
ProductCount = SqlFunc.AggregateSum(detail.Count),
|
||||||
|
BaseProductCount = u.BaseProductCount,
|
||||||
|
Unit = u.Unit,
|
||||||
|
Batch = u.Batch,
|
||||||
|
Name = u.Name,
|
||||||
|
Remarks = u.Remarks,
|
||||||
|
TenantId = u.TenantId,
|
||||||
|
CreateTime = u.CreateTime,
|
||||||
|
UpdateTime = u.UpdateTime,
|
||||||
|
CreateUserId = u.CreateUserId,
|
||||||
|
CreateUserName = u.CreateUserName,
|
||||||
|
UpdateUserId = u.UpdateUserId,
|
||||||
|
UpdateUserName = u.UpdateUserName,
|
||||||
|
IsDelete = u.IsDelete
|
||||||
|
});
|
||||||
|
if (input.StartDateRange != null && input.StartDateRange.Count >0)
|
||||||
{
|
{
|
||||||
DateTime? start= input.StartDateRange[0];
|
DateTime? start= input.StartDateRange[0];
|
||||||
query = query.WhereIF(start.HasValue, u => u.StartDate > start);
|
query = query.WhereIF(start.HasValue, u => u.StartDate > start);
|
||||||
|
|
Loading…
Reference in New Issue