schangxiang@126.com
2025-05-07 7eb4eb64a854eae4f3f62f0dfc4e63427d7231b6
PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/MesAppService.cs
@@ -1,36 +1,31 @@
using CMS.Plugin.FormulaManagement.Abstractions;
using CMS.Plugin.MesSuite.Abstractions.Events;
using CMS.Plugin.OrderManagement.Abstractions;
using CMS.Plugin.OrderManagement.Abstractions.Enums;
using CMS.Plugin.OrderManagement.Abstractions.Models;
using CMS.Plugin.OrderManagement.Abstractions;
using CMS.Plugin.PipeLineLems.Application.Contracts.Dtos.MyTestEntityNames;
using CMS.Plugin.PipeLineLems.Application.Contracts.Dtos.WorkPlan;
using CMS.Plugin.PipeLineLems.Application.Contracts.Services;
using CMS.Plugin.PipeLineLems.Domain.MyTestEntityNames;
using CMS.Plugin.PipeLineLems.Domain.Shared;
using CMS.Plugin.PipeLineLems.Domain.Shared.MyTestEntityNames;
using CMS.Plugin.PipeLineLems.Domain.WorkPlan;
using CMS.Plugin.ProductManagement.Abstractions;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Data;
using Volo.Abp.ObjectExtending;
using CMS.Plugin.PipeLineLems.Application.Contracts.Dtos.WorkPlan;
using Volo.Abp.EventBus;
namespace CMS.Plugin.PipeLineLems.Application.Implements;
public class MesAppService : IMesAppService
public class MesAppService : CMSPluginAppService, IMesAppService
{
    private readonly IServiceProvider _serviceProvider;
    private readonly IWorkPlanAppService _workPlanAppService;
    //private readonly IEventBus _eventBus;
    public MesAppService(IServiceProvider serviceProvider
        , IWorkPlanAppService workPlanAppService
        //, IEventBus eventBus
        )
    {
        _serviceProvider = serviceProvider;
        // _eventBus = eventBus;
        _workPlanAppService = workPlanAppService;
    }
    public async Task<MesOrderResponse> CreateAsync(List<WorkPlanInput> input)
@@ -57,7 +52,7 @@
            var order = await orderManager.GetByCodeAsync(taskCode);
            if (order != null)
            {
                throw new UserFriendlyException($"工单[{taskCode}]已存在");
                throw new UserFriendlyException($"任务编号[{taskCode}]已存在");
            }
@@ -141,6 +136,17 @@
        }
        //保存到表中
        foreach (var item in input)
        {
            var insertObj = ObjectMapper.Map<WorkPlanInput, WorkPlanCreateDto>(item);
            insertObj.OrgMaterialCode = "1111";
            insertObj.Sort = 1;
            await _workPlanAppService.CreateAsync(insertObj);
        }
        // 发布事件
        //await _eventBus.PublishAsync(new EntityChangedEto("MESCREATE", input, null, EntityChangeType.Add, true));