BeizeValveBackend/DOAN.Service/MES/Product/ProWorkorderService.cs

1390 lines
54 KiB
C#
Raw Normal View History

2024-12-03 14:35:59 +08:00
using System;
using SqlSugar;
using Infrastructure.Attribute;
using DOAN.Model;
using DOAN.Model.MES.product;
using DOAN.Model.MES.product.Dto;
using DOAN.Repository;
using DOAN.Service.MES.product.IService;
using System.Linq;
using SqlSugar.Extensions;
using MimeKit.Tnef;
using DOAN.Model.MES.base_;
using Microsoft.AspNetCore.Http;
using DOAN.Model.System;
using MiniExcelLibs;
using NPOI.SS.Formula.Functions;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using System.Data.Common;
using NPOI.XWPF.UserModel;
using NPOI.HSSF.UserModel;
using Microsoft.AspNetCore.Components.Forms;
using System.Globalization;
2024-12-11 17:24:15 +08:00
using DOAN.Infrastructure.Helper;
2024-12-03 14:35:59 +08:00
using DOAN.Model.MES.base_.Dto;
using Infrastructure.Converter;
2024-12-11 17:24:15 +08:00
using QuestPDF;
using QuestPDF.Fluent;
2024-12-16 13:46:46 +08:00
using QuestPDF.Helpers;
2024-12-11 17:24:15 +08:00
using QuestPDF.Infrastructure;
2024-12-03 14:35:59 +08:00
namespace DOAN.Service.MES.product
{
/// <summary>
/// 生产工单Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IProWorkorderService), ServiceLifetime = LifeTime.Transient)]
public class ProWorkorderService : BaseService<ProWorkorder>, IProWorkorderService
{
/// <summary>
/// 查询生产工单列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<ProWorkorderDto3> GetList(ProWorkorderQueryDto parm)
{
if (parm.WorkorderDate != null && parm.WorkorderDate.Length > 0)
{
parm.WorkorderDate[0] = parm.WorkorderDate[0].Date;
parm.WorkorderDate[1] = parm.WorkorderDate[1].Date;
}
var predicate = Expressionable.Create<ProWorkorder>()
2024-12-11 17:24:15 +08:00
.AndIF(!string.IsNullOrEmpty(parm.productionName),
it => it.productionName.Contains(parm.productionName))
.AndIF(!string.IsNullOrEmpty(parm.productionCode),
it => it.productionCode.Contains(parm.productionCode))
.AndIF(!string.IsNullOrEmpty(parm.RouteCode), it => it.RouteCode == parm.RouteCode)
.AndIF(!string.IsNullOrEmpty(parm.GroupCode), it => it.GroupCode == parm.GroupCode)
.AndIF(parm.WorkorderDate != null && parm.WorkorderDate[0] > DateTime.MinValue,
it => it.WorkorderDate >= parm.WorkorderDate[0])
.AndIF(parm.WorkorderDate != null && parm.WorkorderDate[1] > DateTime.MinValue,
it => it.WorkorderDate <= parm.WorkorderDate[1])
2024-12-03 14:35:59 +08:00
;
var query = Queryable()
2024-12-11 17:24:15 +08:00
.Where(predicate.ToExpression());
2024-12-03 14:35:59 +08:00
var finalQuery = Context.Queryable(query)
2024-12-11 17:24:15 +08:00
.LeftJoin<BaseMaterialList>((q, m) => q.productionCode == m.Code)
.LeftJoin<BaseMaterialList>((q, m, m2) => q.productionName == m2.Name)
.LeftJoin<BaseWorkRoute>((q, m, m2, r) => q.RouteCode == r.Code)
.LeftJoin<BaseGroup>((q, m, m2, r, g) => q.GroupCode == g.GroupCode)
.LeftJoin<BaseUnit>((q, m, m2, r, g, u) => q.Unit == u.UnitCode)
.Select((q, m, m2, r, g, u) => new ProWorkorderDto3()
{
IsMatch_material_code = m.Code,
IsMatch_material_name = m2.Name,
IsMatch_line = r.Code,
IsMatch_group = g.GroupCode,
IsMatch_Unit = u.UnitCode,
}, true);
2024-12-03 14:35:59 +08:00
2024-12-11 17:24:15 +08:00
var response = finalQuery.MergeTable().Distinct().OrderBy(it => it.WorkorderDate)
.ToPage<ProWorkorderDto3, ProWorkorderDto3>(parm);
2024-12-03 14:35:59 +08:00
//var query = Queryable()
// .Where(predicate.ToExpression());
////TODO 添加校验
//var query1 = Context.Queryable(query).LeftJoin<BaseMaterialList>((q, m) => q.productionCode == m.Code)
// .Select((q, m) => new ProWorkorderDto3()
// {
// IsMatch_material_code = m.Code
// }, true);
//var query2 = Context.Queryable(query1).LeftJoin<BaseMaterialList>((q1, m) => q1.productionName == m.Name)
// .Select((q1, m) => new ProWorkorderDto3()
// {
// IsMatch_material_name = m.Name
// }, true);
//var query3 = Context.Queryable(query2).LeftJoin<BaseWorkRoute>((q2, r) => q2.RouteCode == r.Code)
// .Select((q2, r) => new ProWorkorderDto3()
// {
// IsMatch_line = r.Code??""
// }, true);
//var query4 = Context.Queryable(query3).LeftJoin<BaseGroup>((q3, g) => q3.GroupCode == g.GroupCode)
// .Select((q3, g) => new ProWorkorderDto3()
// {
// IsMatch_group = g.GroupCode
// }, true);
//var response = query4.MergeTable().OrderBy(it => it.WorkorderDate).ToPage<ProWorkorderDto3, ProWorkorderDto3>(parm);
return response;
}
/// <summary>
/// 获取工单无校验
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<ProWorkorderDto> GetList_NOCheck(ProWorkorderQueryDto parm)
{
var predicate = Expressionable.Create<ProWorkorder>()
2024-12-11 17:24:15 +08:00
.AndIF(!string.IsNullOrEmpty(parm.productionName),
it => it.productionName.Contains(parm.productionName))
2024-12-03 14:35:59 +08:00
.AndIF(!string.IsNullOrEmpty(parm.Workorder), it => it.Workorder.Contains(parm.Workorder))
2024-12-11 17:24:15 +08:00
.AndIF(!string.IsNullOrEmpty(parm.productionCode),
it => it.productionCode.Contains(parm.productionCode))
2024-12-03 14:35:59 +08:00
.AndIF(!string.IsNullOrEmpty(parm.RouteCode), it => it.RouteCode == parm.RouteCode)
.AndIF(!string.IsNullOrEmpty(parm.GroupCode), it => it.GroupCode == parm.GroupCode)
2024-12-11 17:24:15 +08:00
.AndIF(parm.WorkorderDate != null && parm.WorkorderDate[0] > DateTime.MinValue,
it => it.WorkorderDate >= parm.WorkorderDate[0])
.AndIF(parm.WorkorderDate != null && parm.WorkorderDate[1] > DateTime.MinValue,
it => it.WorkorderDate <= parm.WorkorderDate[1])
2024-12-03 14:35:59 +08:00
;
2024-12-11 17:24:15 +08:00
2024-12-03 14:35:59 +08:00
var query = Queryable()
2024-12-11 17:24:15 +08:00
.Where(predicate.ToExpression()).ToPage<ProWorkorder, ProWorkorderDto>(parm);
2024-12-03 14:35:59 +08:00
return query;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public ProWorkorder GetInfo(string Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加生产工单
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public ProWorkorder AddProWorkorder(ProWorkorder model)
{
model.Id = SnowFlakeSingle.Instance.NextId().ToString();
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改生产工单
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateProWorkorder(ProWorkorder model)
{
//增加日志
/*ProWorkorderUpdateLog logObj = new ProWorkorderUpdateLog();
logObj.Id = XueHua;
logObj.Workorder = model.Workorder;
logObj.Log = "修改生产工单";
logObj.ChangeTime = DateTime.Now;
logObj.Operator = model.CreatedBy;
Context.Insertable(logObj).ExecuteCommand();*/
2024-12-11 17:24:15 +08:00
2024-12-03 14:35:59 +08:00
var response = Update(model, true);
return response;
}
/// <summary>
/// 生成工单号
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public int Generate_workorder(ProWorkorderQueryDto2 parm)
{
DateTime update_time = parm.WorkorderDate.ToLocalTime().Date;
2024-12-11 17:24:15 +08:00
List<ProWorkorder> proWorkorderList = Context.Queryable<ProWorkorder>()
.Where(it => it.WorkorderDate == update_time)
.Where(it => it.Status == 1)
.OrderBy(it => it.Sort).ToList();
2024-12-03 14:35:59 +08:00
string maxs = Context.Queryable<ProWorkorder>().Where(it => it.WorkorderDate == update_time)
2024-12-11 17:24:15 +08:00
.Where(it => it.Status == 3).Max(it => it.Workorder);
2024-12-03 14:35:59 +08:00
if (proWorkorderList != null && proWorkorderList.Count() > 0)
{
string baseSort = update_time.ToString("yyyyMMdd");
int index = 1;
if (!string.IsNullOrEmpty(maxs))
{
index = Convert.ToInt32(maxs.Substring(maxs.Length - 3)) + 1;
}
foreach (ProWorkorder item in proWorkorderList)
{
item.Workorder = baseSort + index.ToString("000");
item.Sort = index * 10;
index++;
}
}
2024-12-11 17:24:15 +08:00
2024-12-03 14:35:59 +08:00
return Context.Updateable(proWorkorderList).ExecuteCommand();
}
/// <summary>
/// 插入工单、新增工单
/// </summary>
/// <param name="proWorkorder"></param>
/// <param name="next_id"></param>
/// <returns></returns>
///
public int Insert_workOrder(ProWorkorder proWorkorder, string next_id)
{
int result = 0;
proWorkorder.Id = XueHua;
2024-12-11 17:24:15 +08:00
proWorkorder.WorkorderDate =
DOANConvertDate.ConvertLocalDate(proWorkorder.WorkorderDate ?? DateTime.MinValue);
2024-12-10 16:03:49 +08:00
// 获取 产品代号
2024-12-11 17:24:15 +08:00
List<SysDictData> ProductCodeList =
Context.Queryable<SysDictData>().Where(it => it.DictType == "product_code").ToList();
2024-12-03 14:35:59 +08:00
DateTime handleDate = proWorkorder.WorkorderDate.Value;
//插入工单
if (!string.IsNullOrEmpty(next_id) && next_id != "-1")
{
// 向前插工单
UseTran2(() =>
{
ProWorkorder maxs = Context.Queryable<ProWorkorder>().Where(it => it.WorkorderDate == handleDate)
2024-12-11 17:24:15 +08:00
.OrderByDescending(it => SqlFunc.Right(it.Workorder, 3)).First();
2024-12-03 14:35:59 +08:00
int index = 1;
if (!string.IsNullOrEmpty(maxs.Workorder))
{
index = Convert.ToInt32(maxs.Workorder.Substring(maxs.Workorder.Length - 3)) + 1;
}
2024-12-11 17:24:15 +08:00
// proWorkorder.Workorder = "K" + handleDate.ToString("yyyyMMdd") + "_" + proWorkorder.GroupCode + "_" + proWorkorder.RouteCode + "_" + index.ToString("000");
2024-12-03 14:35:59 +08:00
2024-12-11 17:24:15 +08:00
string nickCode = ProductCodeList.Where(it => it.DictLabel == proWorkorder.productionCode)
.Select(it => it.DictValue).FirstOrDefault();
proWorkorder.Workorder = "K" + handleDate.ToString("yyyyMMdd") + "_" + proWorkorder.RouteCode +
proWorkorder.GroupCode + "_" + nickCode + "_" + index.ToString("000");
2024-12-03 14:35:59 +08:00
2024-12-11 17:24:15 +08:00
int sortNum = Context.Queryable<ProWorkorder>().Where(it => it.Id == next_id)
.Select(it => it.Sort.Value).First();
2024-12-03 14:35:59 +08:00
// 调整序号
Context.Updateable<ProWorkorder>()
.Where(it => it.WorkorderDate == handleDate)
.Where(it => it.Sort >= sortNum)
.SetColumns(it => new ProWorkorder() { Sort = it.Sort + 10 })
.ExecuteCommand();
proWorkorder.Sort = sortNum;
proWorkorder.Status = 1;
//增加日志
ProWorkorderUpdateLog logObj = new ProWorkorderUpdateLog();
logObj.Id = XueHua;
logObj.Workorder = proWorkorder.Workorder;
logObj.Log = "手动新增";
logObj.ChangeTime = DateTime.Now;
logObj.Operator = proWorkorder.CreatedBy;
2024-12-11 17:24:15 +08:00
logObj.ChangeTime = DateTime.Now;
2024-12-03 14:35:59 +08:00
logObj.CreatedBy = proWorkorder.CreatedBy;
UseTran2(() =>
{
result = Context.Insertable(proWorkorder).ExecuteCommand();
Context.Insertable(logObj).ExecuteCommand();
});
});
}
else
{
// 新增工单
2024-12-11 17:24:15 +08:00
int sortNum = Context.Queryable<ProWorkorder>().Where(it => it.WorkorderDate == handleDate)
.Max(it => it.Sort.Value);
2024-12-03 14:35:59 +08:00
2024-12-11 17:24:15 +08:00
ProWorkorder maxWorkorder = Context.Queryable<ProWorkorder>()
.Where(it => it.WorkorderDate == handleDate)
.OrderByDescending(it => SqlFunc.Right(it.Workorder, 3)).First();
2024-12-03 14:35:59 +08:00
int index = 0;
if (maxWorkorder == null)
{
index = 1;
proWorkorder.Sort = 10;
}
else
{
string maxs = maxWorkorder.Workorder;
index = Convert.ToInt32(maxs.Substring(maxs.Length - 3)) + 1;
proWorkorder.Sort = maxWorkorder.Sort + 10;
}
2024-12-10 16:03:49 +08:00
//proWorkorder.Workorder = "H" + handleDate.ToString("yyyyMMdd") + "_" + proWorkorder.GroupCode + "_" + proWorkorder.RouteCode + "_" + index.ToString("000");
2024-12-11 17:24:15 +08:00
string nickCode = ProductCodeList.Where(it => it.DictLabel == proWorkorder.productionCode)
.Select(it => it.DictValue).FirstOrDefault();
proWorkorder.Workorder = "H" + handleDate.ToString("yyyyMMdd") + "_" + proWorkorder.RouteCode +
proWorkorder.GroupCode + "_" + nickCode + "_" + index.ToString("000");
2024-12-03 14:35:59 +08:00
proWorkorder.Status = 1;
//增加日志
ProWorkorderUpdateLog logObj = new ProWorkorderUpdateLog();
logObj.Id = XueHua;
logObj.Workorder = proWorkorder.Workorder;
logObj.Log = "手动新增";
logObj.ChangeTime = DateTime.Now;
logObj.Operator = proWorkorder.CreatedBy;
2024-12-11 17:24:15 +08:00
logObj.ChangeTime = DateTime.Now;
2024-12-03 14:35:59 +08:00
logObj.CreatedBy = proWorkorder.CreatedBy;
UseTran2(() =>
{
result = Context.Insertable(proWorkorder).ExecuteCommand();
Context.Insertable(logObj).ExecuteCommand();
});
}
return result;
}
/// <summary>
/// 移动工单移动工单
/// </summary>
/// <param name="id"></param>
/// <param name="type"></param>
/// <returns></returns>
public int MoveWorkorder(string id, int type)
{
int result = 0;
ProWorkorder toMove = Context.Queryable<ProWorkorder>().Where(it => it.Id == id).First();
var pervious = Context.Queryable<ProWorkorder>()
2024-12-11 17:24:15 +08:00
.Where(it => it.WorkorderDate == toMove.WorkorderDate);
2024-12-03 14:35:59 +08:00
//上移动
if (type == 1)
{
pervious = pervious.Where(it => it.Sort <= toMove.Sort).OrderByDescending(it => it.Sort);
}
//下移
else if (type == 2)
{
pervious = pervious.Where(it => it.Sort >= toMove.Sort).OrderBy(it => it.Sort);
}
2024-12-11 17:24:15 +08:00
2024-12-03 14:35:59 +08:00
ProWorkorder exchange = pervious.Skip(1).Take(1).First();
if (exchange != null)
{
int temp = toMove.Sort.Value;
toMove.Sort = exchange.Sort;
exchange.Sort = temp;
result += Context.Updateable(toMove).ExecuteCommand();
result += Context.Updateable(exchange).ExecuteCommand();
}
return result;
}
/// <summary>
/// 导入工单 必须整删除 整改
/// </summary>
/// <param name="formFile"></param>
/// <returns></returns>
public int ImportData(IFormFile formFile, string username)
{
int result = 0;
List<ProWorkorder> workorderList = new();
DateTime dateValue = DateTime.MinValue;
2024-12-10 16:03:49 +08:00
// 获取 产品代号
2024-12-11 17:24:15 +08:00
List<SysDictData> ProductCodeList =
Context.Queryable<SysDictData>().Where(it => it.DictType == "product_code").ToList();
2024-12-03 14:35:59 +08:00
using (var stream = formFile.OpenReadStream())
{
try
{
IWorkbook workbook = new XSSFWorkbook(stream);
ISheet sheet = workbook.GetSheetAt(0);
// 处理第2行 获取日期
IRow secondRow = sheet.GetRow(1);
NPOI.SS.UserModel.ICell cell = secondRow.GetCell(0);
// 将单元格的数字值转换为DateTime
dateValue = cell.DateCellValue.Value;
2024-12-11 17:24:15 +08:00
#region excel
2024-12-03 14:35:59 +08:00
// 遍历每一行
for (int row = 4; row <= sheet.LastRowNum; row++)
{
IRow currentRow = sheet.GetRow(row);
if (currentRow != null) // 确保行不为空
{
ProWorkorder workorder = new ProWorkorder();
//00主体品名
NPOI.SS.UserModel.ICell currentCell_01 = currentRow.GetCell(0);
workorder.productionName = currentCell_01?.ToString();
if (currentCell_01 == null || string.IsNullOrEmpty(workorder.productionName))
{
continue;
}
//01主体型号
NPOI.SS.UserModel.ICell currentCell_02 = currentRow.GetCell(1);
workorder.productionCode = currentCell_02?.ToString();
if (currentCell_02 == null || string.IsNullOrEmpty(workorder.productionCode))
{
continue;
}
2024-12-11 17:24:15 +08:00
2024-12-03 14:35:59 +08:00
//02单位
NPOI.SS.UserModel.ICell currentCell_04 = currentRow.GetCell(2);
workorder.Unit = currentCell_04?.ToString();
if (currentCell_04 == null || string.IsNullOrEmpty(workorder.Unit))
{
continue;
}
//3 plan_num
NPOI.SS.UserModel.ICell currentCell_07 = currentRow.GetCell(3);
workorder.PlanNum = (int)currentCell_07?.NumericCellValue;
//4 材料型号
NPOI.SS.UserModel.ICell currentCell_11 = currentRow.GetCell(4);
workorder.MaterialName = currentCell_11?.ToString();
if (currentCell_11 == null || string.IsNullOrEmpty(workorder.MaterialName))
{
continue;
}
//5 材料编号
NPOI.SS.UserModel.ICell currentCell_12 = currentRow.GetCell(5);
workorder.MaterialCode = currentCell_12?.ToString();
if (currentCell_12 == null || string.IsNullOrEmpty(workorder.MaterialCode))
{
continue;
}
//6 材质
NPOI.SS.UserModel.ICell currentCell_13 = currentRow.GetCell(6);
workorder.MaterialtextureCode = currentCell_13?.ToString();
if (currentCell_13 == null || string.IsNullOrEmpty(workorder.MaterialtextureCode))
{
continue;
}
//7 炉号
NPOI.SS.UserModel.ICell currentCell_14 = currentRow.GetCell(7);
workorder.StoveCode = currentCell_14?.ToString();
if (currentCell_14 == null || string.IsNullOrEmpty(workorder.StoveCode))
{
continue;
}
//8 图号
NPOI.SS.UserModel.ICell currentCell_15 = currentRow.GetCell(8);
workorder.DrawingCode = currentCell_15?.ToString();
if (currentCell_15 == null || string.IsNullOrEmpty(workorder.DrawingCode))
{
continue;
}
//
//9 版本
NPOI.SS.UserModel.ICell currentCell_16 = currentRow.GetCell(9);
workorder.Version = currentCell_16?.ToString();
if (currentCell_16 == null || string.IsNullOrEmpty(workorder.Version))
{
continue;
}
//10指示日期
2024-12-03 15:45:10 +08:00
NPOI.SS.UserModel.ICell cell17 = currentRow.GetCell(10);
2024-12-03 14:35:59 +08:00
// 将单元格的数字值转换为DateTime
workorder.InstructionDate = cell17.DateCellValue.Value;
//装箱容积
/*NPOI.SS.UserModel.ICell currentCell_0811 = currentRow.GetCell(6);
workorder.PackageCapacity = (int)currentCell_0811?.NumericCellValue;*/
// 11车间code
NPOI.SS.UserModel.ICell currentCell_18 = currentRow.GetCell(11);
if (currentCell_18 == null)
{
2024-12-04 14:41:33 +08:00
workorder.WorkshopCode = string.Empty;
2024-12-03 14:35:59 +08:00
}
else
{
if (currentCell_18.CellType == CellType.Numeric)
{
2024-12-04 14:41:33 +08:00
workorder.WorkshopCode = currentCell_18.NumericCellValue.ToString();
2024-12-03 14:35:59 +08:00
}
else
{
2024-12-04 14:41:33 +08:00
workorder.WorkshopCode = currentCell_18.StringCellValue;
2024-12-03 14:35:59 +08:00
}
}
//12 组别code
NPOI.SS.UserModel.ICell currentCell_19 = currentRow.GetCell(12);
if (currentCell_19 == null)
{
workorder.GroupCode = string.Empty;
}
else
{
if (currentCell_19.CellType == CellType.Numeric)
{
workorder.GroupCode = currentCell_19.NumericCellValue.ToString();
}
else
{
workorder.GroupCode = currentCell_19.StringCellValue;
}
}
2024-12-11 17:24:15 +08:00
2024-12-03 14:35:59 +08:00
//13 线别code
NPOI.SS.UserModel.ICell currentCell_20 = currentRow.GetCell(13);
if (currentCell_20 == null)
{
workorder.RouteCode = string.Empty;
}
else
{
if (currentCell_20.CellType == CellType.Numeric)
{
workorder.RouteCode = currentCell_20.NumericCellValue.ToString();
}
else
{
workorder.RouteCode = currentCell_20.StringCellValue;
}
}
//14 优先级
NPOI.SS.UserModel.ICell currentCell_21 = currentRow.GetCell(14);
if (currentCell_21.StringCellValue == "紧急")
{
workorder.Priority = 3;
}
else
{
if (currentCell_21.StringCellValue == "插单")
{
workorder.Priority = 2;
}
2024-12-11 17:24:15 +08:00
else if (currentCell_21.StringCellValue == "正常" ||
string.IsNullOrEmpty(currentCell_11.StringCellValue))
2024-12-03 14:35:59 +08:00
{
workorder.Priority = 1;
}
}
//15节拍
NPOI.SS.UserModel.ICell currentCell_22 = currentRow.GetCell(15);
workorder.Beat = (int)currentCell_22?.NumericCellValue;
2024-12-10 16:03:49 +08:00
//16进料单号领料
2024-12-03 14:35:59 +08:00
NPOI.SS.UserModel.ICell currentCell_010 = currentRow.GetCell(16);
2024-12-10 16:13:59 +08:00
workorder.FeedOrder = currentCell_010?.StringCellValue;
2024-12-10 16:03:49 +08:00
//17 客户单号(出货)
NPOI.SS.UserModel.ICell currentCell_011 = currentRow.GetCell(17);
2024-12-10 16:13:59 +08:00
workorder.CustomerOrder = currentCell_011?.StringCellValue;
2024-12-10 16:03:49 +08:00
//18备注
NPOI.SS.UserModel.ICell currentCell_012 = currentRow.GetCell(18);
2024-12-10 16:13:59 +08:00
workorder.Remark01 = currentCell_012?.StringCellValue;
2024-12-03 14:35:59 +08:00
workorder.Id = XueHua;
workorder.CreatedBy = username;
workorder.CreatedTime = DateTime.Now;
workorder.WorkorderDate = dateValue;
workorder.Status = 1;
//工单 2024-9-13-组-线-序号
2024-12-03 16:17:06 +08:00
int index = (row - 3);
2024-12-11 17:24:15 +08:00
string nickCode = ProductCodeList.Where(it => it.DictLabel == workorder.productionCode)
.Select(it => it.DictValue).FirstOrDefault();
2024-12-16 13:46:46 +08:00
workorder.Workorder = dateValue.ToString("yyyyMMdd") + "_" +workorder.GroupCode+ workorder.RouteCode +
"_" + nickCode + "_" + index.ToString("000");
2024-12-03 14:35:59 +08:00
workorder.Sort = index * 10;
2024-12-11 17:24:15 +08:00
2024-12-03 14:35:59 +08:00
CultureInfo culture = CultureInfo.CurrentCulture;
workorderList.Add(workorder);
}
}
2024-12-11 17:24:15 +08:00
2024-12-03 14:35:59 +08:00
#endregion
}
catch (Exception ex)
{
return -1;
}
}
2024-12-11 17:24:15 +08:00
2024-12-03 14:35:59 +08:00
UseTran2(() =>
{
Context.Deleteable<ProWorkorder>().Where(it => it.WorkorderDate == dateValue).ExecuteCommand();
result = Context.Insertable(workorderList).ExecuteCommand();
});
return result;
}
/// <summary>
/// 分批导入,追加导入
/// </summary>
/// <param name="formFile"></param>
/// <param name="username"></param>
/// <returns></returns>
public int ImportDataAppend(IFormFile formFile, string username)
{
int result = 0;
List<ProWorkorder> workorderList = new();
DateTime dateValue = DateTime.MinValue;
2024-12-10 16:03:49 +08:00
// 获取 产品代号
2024-12-11 17:24:15 +08:00
List<SysDictData> ProductCodeList =
Context.Queryable<SysDictData>().Where(it => it.DictType == "product_code").ToList();
2024-12-03 14:35:59 +08:00
using (var stream = formFile.OpenReadStream())
{
try
{
IWorkbook workbook = new XSSFWorkbook(stream);
ISheet sheet = workbook.GetSheetAt(0);
// 处理第2行 获取日期
IRow secondRow = sheet.GetRow(1);
NPOI.SS.UserModel.ICell cell = secondRow.GetCell(0);
// 将单元格的数字值转换为DateTime
dateValue = cell.DateCellValue.Value;
// 遍历每一行
2024-12-03 16:17:06 +08:00
for (int row = 4; row <= sheet.LastRowNum; row++)
2024-12-03 14:35:59 +08:00
{
IRow currentRow = sheet.GetRow(row);
if (currentRow != null) // 确保行不为空
{
ProWorkorder workorder = new ProWorkorder();
2024-12-11 17:24:15 +08:00
#region excel
2024-12-03 14:35:59 +08:00
//00主体品名
NPOI.SS.UserModel.ICell currentCell_01 = currentRow.GetCell(0);
workorder.productionName = currentCell_01?.ToString();
if (currentCell_01 == null || string.IsNullOrEmpty(workorder.productionName))
{
continue;
}
//01主体型号
NPOI.SS.UserModel.ICell currentCell_02 = currentRow.GetCell(1);
workorder.productionCode = currentCell_02?.ToString();
if (currentCell_02 == null || string.IsNullOrEmpty(workorder.productionCode))
{
continue;
}
//02单位
NPOI.SS.UserModel.ICell currentCell_04 = currentRow.GetCell(2);
workorder.Unit = currentCell_04?.ToString();
if (currentCell_04 == null || string.IsNullOrEmpty(workorder.Unit))
{
continue;
}
//3 plan_num
NPOI.SS.UserModel.ICell currentCell_07 = currentRow.GetCell(3);
workorder.PlanNum = (int)currentCell_07?.NumericCellValue;
//4 材料型号
NPOI.SS.UserModel.ICell currentCell_11 = currentRow.GetCell(4);
workorder.MaterialName = currentCell_11?.ToString();
if (currentCell_11 == null || string.IsNullOrEmpty(workorder.MaterialName))
{
continue;
}
//5 材料编号
NPOI.SS.UserModel.ICell currentCell_12 = currentRow.GetCell(5);
workorder.MaterialCode = currentCell_12?.ToString();
if (currentCell_12 == null || string.IsNullOrEmpty(workorder.MaterialCode))
{
continue;
}
//6 材质
NPOI.SS.UserModel.ICell currentCell_13 = currentRow.GetCell(6);
workorder.MaterialtextureCode = currentCell_13?.ToString();
if (currentCell_13 == null || string.IsNullOrEmpty(workorder.MaterialtextureCode))
{
continue;
}
//7 炉号
NPOI.SS.UserModel.ICell currentCell_14 = currentRow.GetCell(7);
workorder.StoveCode = currentCell_14?.ToString();
if (currentCell_14 == null || string.IsNullOrEmpty(workorder.StoveCode))
{
continue;
}
//8 图号
NPOI.SS.UserModel.ICell currentCell_15 = currentRow.GetCell(8);
workorder.DrawingCode = currentCell_15?.ToString();
if (currentCell_15 == null || string.IsNullOrEmpty(workorder.DrawingCode))
{
continue;
}
//
//9 版本
NPOI.SS.UserModel.ICell currentCell_16 = currentRow.GetCell(9);
workorder.Version = currentCell_16?.ToString();
if (currentCell_16 == null || string.IsNullOrEmpty(workorder.Version))
{
continue;
}
//10指示日期
2024-12-03 15:45:52 +08:00
NPOI.SS.UserModel.ICell cell17 = currentRow.GetCell(10);
2024-12-03 14:35:59 +08:00
// 将单元格的数字值转换为DateTime
workorder.InstructionDate = cell17.DateCellValue.Value;
//装箱容积
/*NPOI.SS.UserModel.ICell currentCell_0811 = currentRow.GetCell(6);
workorder.PackageCapacity = (int)currentCell_0811?.NumericCellValue;*/
// 11车间code
NPOI.SS.UserModel.ICell currentCell_18 = currentRow.GetCell(11);
if (currentCell_18 == null)
{
2024-12-04 14:41:33 +08:00
workorder.WorkshopCode = string.Empty;
2024-12-03 14:35:59 +08:00
}
else
{
if (currentCell_18.CellType == CellType.Numeric)
{
2024-12-04 14:41:33 +08:00
workorder.WorkshopCode = currentCell_18.NumericCellValue.ToString();
2024-12-03 14:35:59 +08:00
}
else
{
2024-12-04 14:41:33 +08:00
workorder.WorkshopCode = currentCell_18.StringCellValue;
2024-12-03 14:35:59 +08:00
}
}
//12 组别code
NPOI.SS.UserModel.ICell currentCell_19 = currentRow.GetCell(12);
if (currentCell_19 == null)
{
workorder.GroupCode = string.Empty;
}
else
{
if (currentCell_19.CellType == CellType.Numeric)
{
workorder.GroupCode = currentCell_19.NumericCellValue.ToString();
}
else
{
workorder.GroupCode = currentCell_19.StringCellValue;
}
}
2024-12-11 17:24:15 +08:00
2024-12-03 14:35:59 +08:00
//13 线别code
NPOI.SS.UserModel.ICell currentCell_20 = currentRow.GetCell(13);
if (currentCell_20 == null)
{
workorder.RouteCode = string.Empty;
}
else
{
if (currentCell_20.CellType == CellType.Numeric)
{
workorder.RouteCode = currentCell_20.NumericCellValue.ToString();
}
else
{
workorder.RouteCode = currentCell_20.StringCellValue;
}
}
//14 优先级
NPOI.SS.UserModel.ICell currentCell_21 = currentRow.GetCell(14);
if (currentCell_21.StringCellValue == "紧急")
{
workorder.Priority = 3;
}
else
{
if (currentCell_21.StringCellValue == "插单")
{
workorder.Priority = 2;
}
2024-12-11 17:24:15 +08:00
else if (currentCell_21.StringCellValue == "正常" ||
string.IsNullOrEmpty(currentCell_11.StringCellValue))
2024-12-03 14:35:59 +08:00
{
workorder.Priority = 1;
}
}
//15节拍
NPOI.SS.UserModel.ICell currentCell_22 = currentRow.GetCell(15);
workorder.Beat = (int)currentCell_22?.NumericCellValue;
2024-12-10 16:03:49 +08:00
//16进料单号领料
2024-12-03 14:35:59 +08:00
NPOI.SS.UserModel.ICell currentCell_010 = currentRow.GetCell(16);
2024-12-10 16:13:59 +08:00
workorder.FeedOrder = currentCell_010?.StringCellValue;
2024-12-10 16:03:49 +08:00
//17 客户单号(出货)
NPOI.SS.UserModel.ICell currentCell_011 = currentRow.GetCell(17);
2024-12-10 16:13:59 +08:00
workorder.CustomerOrder = currentCell_011?.StringCellValue;
2024-12-10 16:03:49 +08:00
//18备注
NPOI.SS.UserModel.ICell currentCell_012 = currentRow.GetCell(18);
2024-12-10 16:13:59 +08:00
workorder.Remark01 = currentCell_012?.StringCellValue;
2024-12-11 17:24:15 +08:00
2024-12-03 14:35:59 +08:00
#endregion
workorder.Id = XueHua;
workorder.CreatedBy = username;
workorder.CreatedTime = DateTime.Now;
workorder.WorkorderDate = dateValue;
workorder.Status = 1;
//获取当前日期工单序列号 和序号
DateTime currentDate = dateValue.Date;
var MaxWorkorder = Context.Queryable<ProWorkorder>()
.Where(it => it.WorkorderDate == currentDate)
.OrderByDescending(it => it.Sort)
.Select(it => new { it.Workorder, it.Sort })
.First();
//工单 2024-9-13-组-线-序号
2024-12-03 16:17:06 +08:00
int index = (row - 3);
2024-12-03 14:35:59 +08:00
int flowNum = index +
2024-12-11 17:24:15 +08:00
Convert.ToInt16(
MaxWorkorder.Workorder.Substring(MaxWorkorder.Workorder.Length - 3, 3));
2024-12-03 14:35:59 +08:00
2024-12-11 17:24:15 +08:00
//workorder.Workorder = dateValue.ToString("yyyyMMdd") + "_" + workorder.GroupCode + "_" + workorder.RouteCode + "_" + flowNum.ToString("000");
2024-12-03 14:35:59 +08:00
2024-12-11 17:24:15 +08:00
string nickCode = ProductCodeList.Where(it => it.DictLabel == workorder.productionCode)
.Select(it => it.DictValue).FirstOrDefault();
2024-12-16 13:46:46 +08:00
workorder.Workorder = dateValue.ToString("yyyyMMdd") + "_" + workorder.GroupCode+ workorder.RouteCode +
"_" + nickCode + "_" + index.ToString("000");
2024-12-03 14:35:59 +08:00
workorder.Sort = index * 10 + Convert.ToInt16(MaxWorkorder.Sort);
CultureInfo culture = CultureInfo.CurrentCulture;
workorderList.Add(workorder);
}
}
}
catch (Exception ex)
{
return -1;
}
}
2024-12-11 17:24:15 +08:00
2024-12-03 14:35:59 +08:00
UseTran2(() =>
{
// Context.Deleteable<ProWorkorder>().Where(it => it.WorkorderDate == dateValue).ExecuteCommand();
result = Context.Insertable(workorderList).ExecuteCommand();
});
return result;
}
/// <summary>
/// 工单导出
/// </summary>
/// <param name="exportTime"></param>
/// <param name="pager"></param>
/// <returns></returns>
public PagedInfo<ProWorkorder> WorkOrderExport(DateTime exportTime, PagerInfo pager)
{
exportTime = exportTime.Date;
return Context.Queryable<ProWorkorder>().Where(it => it.WorkorderDate == exportTime).ToPage(pager);
}
/// <summary>
/// 获取物料信息
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<BaseMaterialList> GetMaterialInfo(BaseMaterialListQueryDto5 parm)
{
var predicate = Expressionable.Create<BaseMaterialList>()
2024-12-11 17:24:15 +08:00
.OrIF(!string.IsNullOrEmpty(parm.Name_or_Code), it => it.Name.Contains(parm.Name_or_Code))
.OrIF(!string.IsNullOrEmpty(parm.Name_or_Code), it => it.Code.Contains(parm.Name_or_Code))
;
2024-12-03 14:35:59 +08:00
return Context.Queryable<BaseMaterialList>()
2024-12-11 17:24:15 +08:00
.Where(predicate.ToExpression()).Take(20).ToList();
2024-12-03 14:35:59 +08:00
}
/// <summary>
/// 获取客户信息
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public List<BaseCustom> GetCustomInfo(BaseCustomQueryDto2 parm)
{
var predicate = Expressionable
2024-12-11 17:24:15 +08:00
.Create<BaseCustom>()
.AndIF(
!string.IsNullOrEmpty(parm.CustomNo),
it => it.CustomNo.Contains(parm.CustomNo)
)
//.AndIF(
// !string.IsNullOrEmpty(parm.CustomNo),
// it => it.CustomName.Contains(parm.CustomNo)
//)
.And(it => it.Status == 1);
2024-12-03 14:35:59 +08:00
var response = Context.Queryable<BaseCustom>()
.Where(predicate.ToExpression())
.OrderBy(it => it.CustomNo)
.Take(20)
.ToList();
return response;
}
public List<BaseWorkRoute> GetProcessRoute(DateTime dateTime)
{
throw new NotImplementedException();
}
/*/// <summary>
/// 获取工艺路线
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public List<BaseWorkRoute> GetProcessRoute(DateTime dateTime)
{
DateTime dataTO = dateTime.ToLocalTime().Date;
var query = Context.Queryable<GroupSchedule>().Where(it => it.ScheduleDate == dataTO);
return Context
.Queryable(query)
.LeftJoin<BaseWorkRoute>((q, p) => q.FkBelongRouteCode == p.Code)
.Select((q, p) => p)
.Distinct()
.ToList();
}*/
public List<BaseWorkRoute> GetAllRoute()
{
return Context.Queryable<BaseWorkRoute>().ToList();
}
/// <summary>
/// 获取班组
/// </summary>
/// <param name="route_code"></param>
/// <returns></returns>
/*public List<GroupSchedule> GetGroupList(string route_code, DateTime dateTime)
{
dateTime = dateTime.ToLocalTime().Date;
return Context.Queryable<GroupSchedule>().Where(it => it.FkBelongRouteCode == route_code)
.Where(it => it.ScheduleDate == dateTime)
.ToList();
}*/
//public List<GroupSchedule> GetGroupList(string route_code, DateTime dateTime)
//{
// throw new NotImplementedException();
//}
public List<BaseGroup> GetGroupList()
{
return Context.Queryable<BaseGroup>().Where(it => it.Status == 1).ToList();
}
/// <summary>
/// 查询BOM 及其所需数量
/// </summary>
/// <param name="workorder_num"></param>
/// <returns></returns>
public List<WorkOrderBom> SearchBOMNum(string workorder_num)
{
List<WorkOrderBom> workOrderBoms = new List<WorkOrderBom>();
List<BaseMaterialBom> baseMaterialBoms = null;
2024-12-11 17:24:15 +08:00
ProWorkorder proworkorder =
Context.Queryable<ProWorkorder>().Where(it => it.Workorder == workorder_num).First();
2024-12-03 14:35:59 +08:00
if (proworkorder != null)
{
2024-12-11 17:24:15 +08:00
baseMaterialBoms = Context.Queryable<BaseMaterialBom>()
.Where(it => it.InvCode == proworkorder.productionCode).ToList();
2024-12-03 14:35:59 +08:00
if (baseMaterialBoms != null && baseMaterialBoms
2024-12-11 17:24:15 +08:00
.Count() > 0)
2024-12-03 14:35:59 +08:00
{
foreach (var item in baseMaterialBoms)
{
WorkOrderBom objectMaterial = new WorkOrderBom();
2024-12-11 17:24:15 +08:00
objectMaterial.SubInvCode = item.SubInvCode;
2024-12-03 14:35:59 +08:00
objectMaterial.SubInvName = item.SubInvName;
2024-12-11 17:24:15 +08:00
objectMaterial.Iusequantity_Single = item.Iusequantity;
float num = float.Parse(item.Iusequantity) * proworkorder.PlanNum.Value;
2024-12-03 14:35:59 +08:00
objectMaterial.Iusequantity_All = num.ToString();
objectMaterial.BOMVersion = item.BOMVersion;
workOrderBoms.Add(objectMaterial);
}
}
}
return workOrderBoms;
}
/// <summary>
/// 工单日志
/// </summary>
/// <param name="workorder"></param>
/// <param name="log"></param>
/// <returns></returns>
public int WorkOrderLog(string workorder, string log, string Operator)
{
ProWorkorderUpdateLog logObj = new ProWorkorderUpdateLog();
logObj.Id = XueHua;
logObj.Workorder = workorder;
logObj.Log = log;
logObj.ChangeTime = DateTime.Now;
logObj.Operator = Operator;
2024-12-11 17:24:15 +08:00
logObj.ChangeTime = DateTime.Now;
2024-12-03 14:35:59 +08:00
logObj.CreatedBy = Operator;
return Context.Insertable(logObj).ExecuteCommand();
}
/// <summary>
/// 工单进度跟踪
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public PagedInfo<ProWorkorderTranceProgressDto> GetWorkorderTraceProgressList(ProWorkorderQueryDto query)
{
var predicate = Expressionable.Create<ProWorkorder>()
2024-12-11 17:24:15 +08:00
.AndIF(!string.IsNullOrEmpty(query.productionName),
it => it.productionName.Contains(query.productionName))
.AndIF(!string.IsNullOrEmpty(query.productionCode),
it => it.productionCode.Contains(query.productionCode))
.AndIF(!string.IsNullOrEmpty(query.RouteCode), it => it.RouteCode == query.RouteCode)
.AndIF(!string.IsNullOrEmpty(query.GroupCode), it => it.GroupCode == query.GroupCode)
.AndIF(query.WorkorderDate != null && query.WorkorderDate[0] > DateTime.MinValue,
it => it.WorkorderDate >= query.WorkorderDate[0])
.AndIF(query.WorkorderDate != null && query.WorkorderDate[1] > DateTime.MinValue,
it => it.WorkorderDate <= query.WorkorderDate[1])
.AndIF(query.Status > -1, it => it.Status == query.Status)
2024-12-03 14:35:59 +08:00
;
var query2 = Queryable()
2024-12-11 17:24:15 +08:00
.Where(predicate.ToExpression());
2024-12-03 14:35:59 +08:00
return Context.Queryable(query2).LeftJoin<ProReportwork>((q, r) => q.Workorder == r.FkWorkorder)
2024-12-11 17:24:15 +08:00
.Select((q, r) => new ProWorkorderTranceProgressDto()
{
PlanNum = q.PlanNum,
ActualNum = r.FinishedNum,
}, true).ToPage_NO_Convert<ProWorkorderTranceProgressDto>(query);
2024-12-03 14:35:59 +08:00
}
public int Insert_workOrder2(ProWorkorder proWorkorder, string next_id)
{
int result = 0;
proWorkorder.Id = XueHua;
proWorkorder.WorkorderDate = proWorkorder.WorkorderDate.Value.Date;
if (!string.IsNullOrEmpty(next_id) && next_id != "-1")
{
UseTran2(() =>
{
2024-12-11 17:24:15 +08:00
int sortNum = Context.Queryable<ProWorkorder>().Where(it => it.Id == next_id)
.Select(it => it.Sort.Value).First();
2024-12-03 14:35:59 +08:00
Context.Updateable<ProWorkorder>()
.Where(it => it.WorkorderDate == proWorkorder.WorkorderDate)
.Where(it => it.Sort >= sortNum)
.SetColumns(it => new ProWorkorder() { Sort = it.Sort + 10 })
.ExecuteCommand();
proWorkorder.Sort = sortNum;
proWorkorder.Status = 1;
Context.Insertable(proWorkorder).ExecuteCommand();
});
}
else
{
DateTime dateOnly = proWorkorder.WorkorderDate.Value.Date;
2024-12-11 17:24:15 +08:00
int sortNum = Context.Queryable<ProWorkorder>().Where(it => it.WorkorderDate == dateOnly)
.Max(it => it.Sort.Value);
2024-12-03 14:35:59 +08:00
proWorkorder.Sort = sortNum + 10;
proWorkorder.Status = 1;
Context.Insertable(proWorkorder).ExecuteCommand();
}
Generate_workorder(new ProWorkorderQueryDto2()
{
WorkorderDate = proWorkorder.WorkorderDate.Value
});
return result;
}
2024-12-16 13:46:46 +08:00
/// <summary>
/// https://www.questpdf.com/
/// </summary>
/// <param name="workorderArray"></param>
/// <returns></returns>
2024-12-11 17:24:15 +08:00
public async Task<(string, Stream)> ExportPDFByQuestPDFDemo(string[] workorderArray)
{
var dataList = Context.Queryable<ProWorkorder>().Where(it => workorderArray.Contains(it.Workorder))
.ToList();
if (dataList.Count() == 0)
{
return (null, null);
}
var ms = new MemoryStream();
Settings.License = LicenseType.Community;
Settings.CheckIfAllTextGlyphsAreAvailable = false;
2024-12-18 15:06:02 +08:00
await Task.Run(() =>
2024-12-11 17:24:15 +08:00
{
2024-12-18 15:06:02 +08:00
var document = QuestPDF.Fluent.Document.Create(container =>
2024-12-11 17:24:15 +08:00
{
2024-12-18 15:06:02 +08:00
int PageWidth = 40 * 10;
int PageHeight = 30 * 10;
for (int i = 0; i < dataList.Count(); i++)
2024-12-11 17:24:15 +08:00
{
2024-12-18 15:06:02 +08:00
byte[] imageBytes = PrintHelper.CreateQcCode(dataList[i].Workorder, PageHeight * 40 + 100, PageHeight * 20);
container.Page(page =>
2024-12-11 17:24:15 +08:00
{
2024-12-18 15:06:02 +08:00
// 设置页面大小为A4默认有页边距
//page.Size(new PageSize(40*10,30*10)); // 移除默认页边距或设置自定义边距
2024-12-16 13:46:46 +08:00
2024-12-18 15:06:02 +08:00
page.Size(PageWidth, PageHeight);
page.DefaultTextStyle(TextStyle.Default.FontSize(10 * 2 + 2));
//page.DefaultTextStyle(TextStyle.Default.FontSize(1));
page.Content().Column(column =>
{
column.Item().Table(table =>
2024-12-11 17:24:15 +08:00
{
2024-12-18 15:06:02 +08:00
// 动态计算列宽,减去必要的边距
float columnWidth = (PageWidth) / 8;
table.ColumnsDefinition(columns =>
{
for (int j = 0; j < 8; j++)
columns.ConstantColumn(columnWidth);
});
// 创建一个单元格跨越所有列,用于放置图片
table.Cell().ColumnSpan(8).Height(PageHeight / 14 * 8).Image(imageBytes);
2024-12-16 13:46:46 +08:00
2024-12-18 15:06:02 +08:00
// 剩余内容...
// 注意:确保剩余内容的高度不超过剩余的页面空间
// 这里只是一个简单的例子,实际应用中你可能需要更复杂的逻辑来计算剩余可用空间
table.Cell().ColumnSpan(2).Border(1).MinHeight(PageHeight / 7).AlignLeft().Padding(1).Text("编号");
table.Cell().ColumnSpan(6).Border(1).MinHeight(PageHeight / 14).AlignLeft().Padding(1).Text(dataList[i].Workorder);
table.Cell().ColumnSpan(2).Border(1).MinHeight(PageHeight / 14).AlignLeft().Padding(1).Text("炉号");
table.Cell().ColumnSpan(6).Border(1).MinHeight(PageHeight / 14).AlignLeft().Padding(1).Text(dataList[i].StoveCode);
table.Cell().ColumnSpan(2).Border(1).MinHeight(PageHeight / 14).AlignLeft().Padding(1).Text("数量");
table.Cell().ColumnSpan(6).Border(1).MinHeight(PageHeight / 14).AlignLeft().Padding(1).Text(dataList[i].PlanNum);
for (int j = 0; j < 8; j++)
{
table.Cell().Border(1).MinHeight(PageHeight / 14).AlignCenter().Text($"[{j + 1}]");
}
});
2024-12-11 17:24:15 +08:00
});
});
2024-12-18 15:06:02 +08:00
}
});
document.GeneratePdf(ms);
ms.Seek(0, SeekOrigin.Begin);
2024-12-11 17:24:15 +08:00
});
var fileName = $"工单({DateTime.Now.ToString("yyyyMMdd")}).pdf";
return new(fileName, ms);
}
2024-12-03 14:35:59 +08:00
}
2024-12-11 17:24:15 +08:00
2024-12-03 14:35:59 +08:00
}