- 添加Bartender打印工具类实现工单标签打印功能 - 修改PrintTicketsByTemplate方法返回类型为string并实现完整打印逻辑 - 优化工单领料逻辑,增加原材料工单信息获取 - 调整工单查询条件,移除PlanNum>0的限制 - 修复出库单操作符赋值错误 - 优化不良品处理流程,统一使用不良库代替报废库 - 完善领料报工逻辑,增加计划数校验和原材料工单处理
271 lines
8.5 KiB
C#
271 lines
8.5 KiB
C#
using DOAN.Model.MES.base_;
|
|
using DOAN.Model.MES.base_.Dto;
|
|
using DOAN.Model.MES.product;
|
|
using DOAN.Model.MES.product.Dto;
|
|
using DOAN.Service.MES.product.IService;
|
|
using Infrastructure;
|
|
using Infrastructure.Attribute;
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
namespace DOAN.Service.MES.product
|
|
{
|
|
/// <summary>
|
|
/// 生产工单Service业务层处理
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IProWorkorderService), ServiceLifetime = LifeTime.Transient)]
|
|
public class ProWorkorderService : BaseService<ProWorkorder>, IProWorkorderService
|
|
{
|
|
private readonly IProWorkorderCoreService _coreService;
|
|
private readonly IProWorkorderQueryService _queryService;
|
|
private readonly IProWorkorderImportService _importService;
|
|
private readonly IProWorkorderExportService _exportService;
|
|
private readonly IProWorkorderUtilityService _utilityService;
|
|
private readonly IProWorkorderReferenceService _referenceService;
|
|
|
|
/// <summary>
|
|
/// 构造函数
|
|
/// </summary>
|
|
/// <param name="coreService"></param>
|
|
/// <param name="queryService"></param>
|
|
/// <param name="importService"></param>
|
|
/// <param name="exportService"></param>
|
|
/// <param name="utilityService"></param>
|
|
/// <param name="referenceService"></param>
|
|
public ProWorkorderService(
|
|
IProWorkorderCoreService coreService,
|
|
IProWorkorderQueryService queryService,
|
|
IProWorkorderImportService importService,
|
|
IProWorkorderExportService exportService,
|
|
IProWorkorderUtilityService utilityService,
|
|
IProWorkorderReferenceService referenceService
|
|
)
|
|
{
|
|
_coreService = coreService;
|
|
_queryService = queryService;
|
|
_importService = importService;
|
|
_exportService = exportService;
|
|
_utilityService = utilityService;
|
|
_referenceService = referenceService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询生产工单列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<ProWorkorderDto3> GetList(ProWorkorderQueryDto parm)
|
|
{
|
|
return _queryService.GetList(parm);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取工单无校验
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<ProWorkorderDto> GetList_NOCheck(ProWorkorderQueryDto parm)
|
|
{
|
|
return _queryService.GetList_NOCheck(parm);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public ProWorkorder GetInfo(string Id)
|
|
{
|
|
return _queryService.GetInfo(Id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加生产工单
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public ProWorkorder AddProWorkorder(ProWorkorder model)
|
|
{
|
|
return _coreService.AddProWorkorder(model);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改生产工单
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateProWorkorder(ProWorkorder model)
|
|
{
|
|
return _coreService.UpdateProWorkorder(model);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 插入工单、新增工单
|
|
/// </summary>
|
|
/// <param name="proWorkorder"></param>
|
|
/// <param name="next_id"></param>
|
|
/// <returns></returns>
|
|
public int Insert_workOrder(ProWorkorder proWorkorder, string next_id)
|
|
{
|
|
return _coreService.Insert_workOrder(proWorkorder, next_id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 生成工单号
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public int Generate_workorder(ProWorkorderQueryDto2 parm)
|
|
{
|
|
return _utilityService.Generate_workorder(parm);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 移动工单移动工单
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <param name="type"></param>
|
|
/// <returns></returns>
|
|
public int MoveWorkorder(string id, int type)
|
|
{
|
|
return _utilityService.MoveWorkorder(id, type);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 导入工单 必须整删除 整改
|
|
/// </summary>
|
|
/// <param name="formFile"></param>
|
|
/// <returns></returns>
|
|
public int ImportData(IFormFile formFile, string username)
|
|
{
|
|
return _importService.ImportData(formFile, username);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分批导入,追加导入
|
|
/// </summary>
|
|
/// <param name="formFile"></param>
|
|
/// <param name="username"></param>
|
|
/// <returns></returns>
|
|
public int ImportDataAppend(IFormFile formFile, string username)
|
|
{
|
|
return _importService.ImportDataAppend(formFile, username);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 工单导出
|
|
/// </summary>
|
|
/// <param name="exportTime"></param>
|
|
/// <param name="pager"></param>
|
|
/// <returns></returns>
|
|
public List<ProWorkorder> WorkOrderExport(DateTime exportTime)
|
|
{
|
|
return _exportService.WorkOrderExport(exportTime);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取物料信息
|
|
/// </summary>
|
|
/// <param name="query"></param>
|
|
/// <returns></returns>
|
|
public List<BaseMaterialList> GetMaterialInfo(BaseMaterialListQueryDto5 parm)
|
|
{
|
|
return _referenceService.GetMaterialInfo(parm);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取客户信息
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public List<BaseCustom> GetCustomInfo(BaseCustomQueryDto2 parm)
|
|
{
|
|
return _referenceService.GetCustomInfo(parm);
|
|
}
|
|
|
|
public List<BaseWorkRoute> GetProcessRoute(DateTime dateTime)
|
|
{
|
|
return _referenceService.GetProcessRoute(dateTime);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取全部工艺路线
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<BaseWorkRoute> GetAllRoute()
|
|
{
|
|
return _referenceService.GetAllRoute();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取组
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<BaseGroup> GetGroupList()
|
|
{
|
|
return _referenceService.GetGroupList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询BOM 及其所需数量
|
|
/// </summary>
|
|
/// <param name="workorder_num"></param>
|
|
/// <returns></returns>
|
|
public List<WorkOrderBom> SearchBOMNum(string workorder_num)
|
|
{
|
|
return _utilityService.SearchBOMNum(workorder_num);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 工单日志
|
|
/// </summary>
|
|
/// <param name="workorder"></param>
|
|
/// <param name="log"></param>
|
|
/// <param name="Operator"></param>
|
|
/// <returns></returns>
|
|
public List<ProWorkorderUpdateLog> WorkOrderLog(string workorder)
|
|
{
|
|
return _utilityService.WorkOrderLog(workorder);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 导出PDF
|
|
/// </summary>
|
|
/// <param name="workorderArray"></param>
|
|
/// <returns></returns>
|
|
public Task<(string, Stream)> ExportPDFByQuestPDFDemo(string[] workorderArray)
|
|
{
|
|
return _utilityService.ExportPDFByQuestPDFDemo(workorderArray);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 打印工单
|
|
/// </summary>
|
|
/// <param name="param"></param>
|
|
/// <returns></returns>
|
|
public string PrintTicketsByTemplate(ProWorkorderExportDto param)
|
|
{
|
|
return _utilityService.PrintTicketsByTemplate(param);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取工单进度跟踪列表
|
|
/// </summary>
|
|
/// <param name="query"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<ProWorkorderTranceProgressDto> GetWorkorderTraceProgressList(ProWorkorderQueryDto query)
|
|
{
|
|
return _queryService.GetWorkorderTraceProgressList(query);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取工单生产进度
|
|
/// </summary>
|
|
/// <param name="workorder">工单号</param>
|
|
/// <returns></returns>
|
|
public int GetWorkorderWithProgress(string workorder)
|
|
{
|
|
return _queryService.GetWorkorderWithProgress(workorder);
|
|
}
|
|
}
|
|
}
|