添加报工人
This commit is contained in:
@@ -30,6 +30,7 @@ using DOAN.Model.MES.base_.Dto;
|
||||
using Infrastructure.Converter;
|
||||
using QuestPDF;
|
||||
using QuestPDF.Fluent;
|
||||
using QuestPDF.Helpers;
|
||||
using QuestPDF.Infrastructure;
|
||||
|
||||
|
||||
@@ -679,8 +680,8 @@ namespace DOAN.Service.MES.product
|
||||
int index = (row - 3);
|
||||
string nickCode = ProductCodeList.Where(it => it.DictLabel == workorder.productionCode)
|
||||
.Select(it => it.DictValue).FirstOrDefault();
|
||||
workorder.Workorder = dateValue.ToString("yyyyMMdd") + "_" + workorder.RouteCode +
|
||||
workorder.GroupCode + "_" + nickCode + "_" + index.ToString("000");
|
||||
workorder.Workorder = dateValue.ToString("yyyyMMdd") + "_" +workorder.GroupCode+ workorder.RouteCode +
|
||||
"_" + nickCode + "_" + index.ToString("000");
|
||||
workorder.Sort = index * 10;
|
||||
|
||||
|
||||
@@ -997,8 +998,8 @@ namespace DOAN.Service.MES.product
|
||||
|
||||
string nickCode = ProductCodeList.Where(it => it.DictLabel == workorder.productionCode)
|
||||
.Select(it => it.DictValue).FirstOrDefault();
|
||||
workorder.Workorder = dateValue.ToString("yyyyMMdd") + "_" + workorder.RouteCode +
|
||||
workorder.GroupCode + "_" + nickCode + "_" + index.ToString("000");
|
||||
workorder.Workorder = dateValue.ToString("yyyyMMdd") + "_" + workorder.GroupCode+ workorder.RouteCode +
|
||||
"_" + nickCode + "_" + index.ToString("000");
|
||||
|
||||
workorder.Sort = index * 10 + Convert.ToInt16(MaxWorkorder.Sort);
|
||||
|
||||
@@ -1299,7 +1300,12 @@ namespace DOAN.Service.MES.product
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// https://www.questpdf.com/
|
||||
/// </summary>
|
||||
/// <param name="workorderArray"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<(string, Stream)> ExportPDFByQuestPDFDemo(string[] workorderArray)
|
||||
{
|
||||
|
||||
@@ -1315,38 +1321,51 @@ namespace DOAN.Service.MES.product
|
||||
Settings.CheckIfAllTextGlyphsAreAvailable = false;
|
||||
var document = QuestPDF.Fluent.Document.Create(container =>
|
||||
{
|
||||
int PageWidth = 40 * 10;
|
||||
int PageHeight = 30 * 10;
|
||||
for (int i = 0; i < dataList.Count(); i++)
|
||||
{
|
||||
byte[] imageBytes= PrintHelper.CreateBarCode(dataList[i].Workorder, 30, 30);
|
||||
container.Page(page =>
|
||||
byte[] imageBytes = PrintHelper.CreateBarCode(dataList[i].Workorder, PageWidth * 3, PageHeight);
|
||||
container.Page(page =>
|
||||
{
|
||||
page.Margin(20);
|
||||
// 设置页面大小为A4,默认有页边距
|
||||
//page.Size(new PageSize(40*10,30*10)); // 移除默认页边距或设置自定义边距
|
||||
|
||||
page.Size(PageWidth, PageHeight);
|
||||
page.DefaultTextStyle(TextStyle.Default.FontSize(16*2-5));
|
||||
//page.DefaultTextStyle(TextStyle.Default.FontSize(1));
|
||||
page.Content().Column(column =>
|
||||
{
|
||||
|
||||
column.Item().Table(table =>
|
||||
{
|
||||
// Define columns
|
||||
// 动态计算列宽,减去必要的边距
|
||||
float columnWidth = (PageWidth) / 8;
|
||||
|
||||
table.ColumnsDefinition(columns =>
|
||||
{
|
||||
columns.RelativeColumn(); // Column 1
|
||||
columns.RelativeColumn(); // Column 2
|
||||
columns.RelativeColumn();
|
||||
columns.RelativeColumn();
|
||||
columns.RelativeColumn();
|
||||
columns.RelativeColumn();
|
||||
columns.RelativeColumn();
|
||||
columns.RelativeColumn();
|
||||
for (int j = 0; j < 8; j++)
|
||||
columns.ConstantColumn(columnWidth);
|
||||
});
|
||||
table.Cell().Row(1).ColumnSpan(8).Image(imageBytes);
|
||||
|
||||
table.Cell().Row(2).Column(2).Text("编号");
|
||||
table.Cell().Row(2).Column(6).Text(dataList[i].Workorder);
|
||||
table.Cell().Row(3).Column(2).Text("炉号");
|
||||
table.Cell().Row(3).Column(6).Text(dataList[i].StoveCode);
|
||||
table.Cell().Row(4).Column(2).Text("数量");
|
||||
table.Cell().Row(4).Column(6).Text(dataList[i].PlanNum);
|
||||
|
||||
|
||||
// 创建一个单元格跨越所有列,用于放置图片
|
||||
table.Cell().ColumnSpan(8).Image(imageBytes);
|
||||
table.Cell().ColumnSpan(8).MinHeight(PageHeight / 7/4);
|
||||
|
||||
// 剩余内容...
|
||||
// 注意:确保剩余内容的高度不超过剩余的页面空间
|
||||
// 这里只是一个简单的例子,实际应用中你可能需要更复杂的逻辑来计算剩余可用空间
|
||||
|
||||
table.Cell().ColumnSpan(2).Border(1).MinHeight(PageHeight/7).AlignLeft().Padding(1).Text("编号");
|
||||
table.Cell().ColumnSpan(6).Border(1).MinHeight(PageHeight/7).AlignLeft().Padding(1).Text(dataList[i].Workorder);
|
||||
table.Cell().ColumnSpan(2).Border(1).MinHeight(PageHeight/7).AlignLeft().Padding(1).Text("炉号");
|
||||
table.Cell().ColumnSpan(6).Border(1).MinHeight(PageHeight/7).AlignLeft().Padding(1).Text(dataList[i].StoveCode);
|
||||
table.Cell().ColumnSpan(2).Border(1).MinHeight(PageHeight/7).AlignLeft().Padding(1).Text("数量");
|
||||
table.Cell().ColumnSpan(6).Border(1).MinHeight(PageHeight/7).AlignLeft().Padding(1).Text(dataList[i].PlanNum);
|
||||
for (int j = 0; j< 8; j++)
|
||||
{
|
||||
table.Cell().Border(1).MinHeight(PageHeight/7).AlignCenter().Text($"[{j+1}]");
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,6 +2,7 @@ using DOAN.Model.MES.base_;
|
||||
using DOAN.Model.MES.product;
|
||||
using DOAN.Model.Mobile.ReportFlow.Dto;
|
||||
using DOAN.Model.Public;
|
||||
using DOAN.Model.System;
|
||||
using DOAN.Service.Mobile.IService;
|
||||
using DOAN.Service.Public.IPublicService;
|
||||
using Infrastructure.Attribute;
|
||||
@@ -41,6 +42,9 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
|
||||
{
|
||||
int result = 0;
|
||||
bool Exist = Context.Queryable<ProReportwork01>().Where(it => it.Workorder == workorder && it.ProcessId == processId).Any();
|
||||
|
||||
string NickName= Context.Queryable<SysUser>().Where(it=>it.UserName==Worker).Select(it=>it.NickName).First();
|
||||
Worker = string.IsNullOrEmpty(NickName) ? Worker : NickName;
|
||||
if (Exist)
|
||||
{
|
||||
result = Context.Updateable<ProReportwork01>().Where(it => it.Workorder == workorder && it.ProcessId == processId)
|
||||
@@ -81,6 +85,8 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
|
||||
{
|
||||
int result = 0;
|
||||
bool Exist = Context.Queryable<ProReportwork01>().Where(it => it.Workorder == workorder && it.ProcessId == process).Any();
|
||||
string NickName = Context.Queryable<SysUser>().Where(it => it.UserName == Worker).Select(it => it.NickName).First();
|
||||
Worker = string.IsNullOrEmpty(NickName) ? Worker : NickName;
|
||||
if (Exist)
|
||||
{
|
||||
result = Context.Updateable<ProReportwork01>().Where(it => it.Workorder == workorder && it.ProcessId == process)
|
||||
@@ -125,6 +131,8 @@ public class ReportFlowService : BaseService<ProReportwork01>, IReportFlowServic
|
||||
{
|
||||
int result = 0;
|
||||
bool Exist = Context.Queryable<ProReportwork01>().Where(it => it.Workorder == workorder && it.ProcessId == processId).Any();
|
||||
string NickName = Context.Queryable<SysUser>().Where(it => it.UserName == Worker).Select(it => it.NickName).First();
|
||||
Worker = string.IsNullOrEmpty(NickName) ? Worker : NickName;
|
||||
if (Exist)
|
||||
{
|
||||
result = Context.Updateable<ProReportwork01>()
|
||||
|
||||
Reference in New Issue
Block a user