| | |
| | | |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\CMS.Plugin.PipeLineLems.Domain.Shared\CMS.Plugin.PipeLineLems.Domain.Shared.csproj" /> |
| | | <ProjectReference Include="..\CMS.Plugin.PipeLineLems.Domain\CMS.Plugin.PipeLineLems.Domain.csproj" /> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | |
| | | using CMS.Plugin.PipeLineLems.Application.Contracts.Dtos.CallMaterialOrder; |
| | | using Volo.Abp.Application.Services; |
| | | |
| | | namespace CMS.Plugin.PipeLineLems.Application.Contracts.Services; |
| | | |
| | | using CMS.Plugin.PipeLineLems.Application.Contracts.Dtos.CallMaterialOrder; |
| | | using CMS.Plugin.PipeLineLems.Domain.CallMaterialOrder; |
| | | using Volo.Abp.Application.Services; |
| | | |
| | | namespace CMS.Plugin.PipeLineLems.Application.Contracts.Services; |
| | | |
| | | /// <summary> |
| | | /// 叫料单表应用服务接口 |
| | | /// </summary> |
| | | public interface ICallMaterialOrderAppService : ICrudAppService<CallMaterialOrderDto, Guid, GetCallMaterialOrderInput, CallMaterialOrderCreateDto, CallMaterialOrderUpdateDto> |
| | | { |
| | | public interface ICallMaterialOrderAppService : ICrudAppService<CallMaterialOrderDto, Guid, GetCallMaterialOrderInput, CallMaterialOrderCreateDto, CallMaterialOrderUpdateDto> |
| | | { |
| | | /// <summary> |
| | | /// 克隆叫料单表 |
| | | /// </summary> |
| | | /// <param name="ids"></param> |
| | | /// <returns></returns> |
| | | Task<List<CallMaterialOrderDto>> CloneAsync(IEnumerable<Guid> ids); |
| | | |
| | | Task<List<CallMaterialOrderDto>> CloneAsync(IEnumerable<Guid> ids); |
| | | |
| | | /// <summary> |
| | | /// 删除叫料单表 |
| | | /// </summary> |
| | |
| | | /// <returns></returns> |
| | | Task DeleteManyAsync(IEnumerable<Guid> ids); |
| | | |
| | | Task<CallMaterialOrder> FindByWmsTaskNoAsync(string wmsTaskNo); |
| | | |
| | | Task CallMaterialByDataIdentifier(Guid id); |
| | | |
| | | Task CallMaterialByDataIdentifier(Guid id); |
| | | |
| | | /// <summary> |
| | | /// 调整排序叫料单表 |
| | |
| | | /// <param name="id"></param> |
| | | /// <param name="sort"></param> |
| | | /// <returns></returns> |
| | | Task AdjustSortAsync(Guid id, int sort); |
| | | |
| | | Task AdjustSortAsync(Guid id, int sort); |
| | | |
| | | /// <summary> |
| | | /// 导入叫料单表 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | Task ImportAsync(CallMaterialOrdersImportModel input); |
| | | |
| | | Task ImportAsync(CallMaterialOrdersImportModel input); |
| | | |
| | | /// <summary> |
| | | /// 导出叫料单表 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | Task<(Dictionary<string, object> Sheets, string FileName)> ExportAsync(GetCallMaterialOrderInput input); |
| | | } |
| | | Task<(Dictionary<string, object> Sheets, string FileName)> ExportAsync(GetCallMaterialOrderInput input); |
| | | } |
| | |
| | | using CMS.Plugin.PipeLineLems.Application.Contracts.Dtos.WorkPlan; |
| | | using Volo.Abp.Application.Services; |
| | | |
| | | namespace CMS.Plugin.PipeLineLems.Application.Contracts.Services; |
| | | |
| | | using CMS.Plugin.PipeLineLems.Application.Contracts.Dtos.WorkPlan; |
| | | using CMS.Plugin.PipeLineLems.Domain.WorkPlan; |
| | | using Volo.Abp.Application.Services; |
| | | |
| | | namespace CMS.Plugin.PipeLineLems.Application.Contracts.Services; |
| | | |
| | | /// <summary> |
| | | /// 作业计划表应用服务接口 |
| | | /// </summary> |
| | | public interface IWorkPlanAppService : ICrudAppService<WorkPlanDto, Guid, GetWorkPlanInput, WorkPlanCreateDto, WorkPlanUpdateDto> |
| | | { |
| | | public interface IWorkPlanAppService : ICrudAppService<WorkPlanDto, Guid, GetWorkPlanInput, WorkPlanCreateDto, WorkPlanUpdateDto> |
| | | { |
| | | /// <summary> |
| | | /// 克隆作业计划表 |
| | | /// </summary> |
| | | /// <param name="ids"></param> |
| | | /// <returns></returns> |
| | | Task<List<WorkPlanDto>> CloneAsync(IEnumerable<Guid> ids); |
| | | |
| | | Task<List<WorkPlanDto>> CloneAsync(IEnumerable<Guid> ids); |
| | | |
| | | |
| | | /// <summary> |
| | | /// 按照 原料标记 查找作业计划表 |
| | | /// </summary> |
| | | /// <param name="name"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | Task<List<WorkPlan>> FindByDataIdentifierAsync(string dataIdentifier); |
| | | |
| | | /// <summary> |
| | | /// 删除作业计划表 |
| | | /// </summary> |
| | | /// <param name="ids"></param> |
| | | /// <returns></returns> |
| | | Task DeleteManyAsync(IEnumerable<Guid> ids); |
| | | |
| | | Task DeleteManyAsync(IEnumerable<Guid> ids); |
| | | |
| | | /// <summary> |
| | | /// 调整排序作业计划表 |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <param name="sort"></param> |
| | | /// <returns></returns> |
| | | Task AdjustSortAsync(Guid id, int sort); |
| | | |
| | | Task AdjustSortAsync(Guid id, int sort); |
| | | |
| | | /// <summary> |
| | | /// 导入作业计划表 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | Task ImportAsync(WorkPlansImportModel input); |
| | | |
| | | Task ImportAsync(WorkPlansImportModel input); |
| | | |
| | | /// <summary> |
| | | /// 导出作业计划表 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | Task<(Dictionary<string, object> Sheets, string FileName)> ExportAsync(GetWorkPlanInput input); |
| | | } |
| | | Task<(Dictionary<string, object> Sheets, string FileName)> ExportAsync(GetWorkPlanInput input); |
| | | } |
| | |
| | | await _sharedService.CallMaterialByDataIdentifier(id, _serviceProvider); |
| | | } |
| | | |
| | | public virtual async Task<CallMaterialOrder> FindByWmsTaskNoAsync(string wmsTaskNo) |
| | | { |
| | | return await callMaterialOrderRepository.FindByWmsTaskNoAsync(wmsTaskNo); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 分页获取叫料单表 |
| | | /// </summary> |
| | |
| | | var insertObj = ObjectMapper.Map<WorkPlanInput, WorkPlanCreateDto>(item); |
| | | //insertObj.OrgMaterialCode = "1111"; |
| | | insertObj.CallMaterialStatus = Domain.Shared.Enums.CallMaterialStatusEnum.未执行; |
| | | insertObj.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.未执行; |
| | | insertObj.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.未生产; |
| | | insertObj.Sort = 1; |
| | | await workPlanAppService.CreateAsync(insertObj); |
| | | } |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 按照 原料标记 查找作业计划表 |
| | | /// </summary> |
| | | /// <param name="name"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public virtual async Task<List<WorkPlan>> FindByDataIdentifierAsync(string dataIdentifier) |
| | | { |
| | | return await workPlanRepository.FindByDataIdentifierAsync(dataIdentifier); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 分页获取作业计划表 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | |
| | | public enum WorkPlanStatusEnum |
| | | { |
| | | /// <summary> |
| | | /// 未执行 |
| | | /// 未生产 |
| | | /// </summary> |
| | | [Description("未执行")] |
| | | 未执行 = 1, |
| | | [Description("未生产")] |
| | | 未生产 = 1, |
| | | |
| | | /// <summary> |
| | | /// 执行中 |
| | | /// 生产中 |
| | | /// </summary> |
| | | [Description("执行中")] |
| | | 执行中 = 2, |
| | | [Description("生产中")] |
| | | 生产中 = 2, |
| | | |
| | | /// <summary> |
| | | /// 暂停中 |
| | |
| | | /// <param name="name"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | Task<CallMaterialOrder> FindByNameAsync(string name, CancellationToken cancellationToken = default); |
| | | |
| | | Task<CallMaterialOrder> FindByNameAsync(string name, CancellationToken cancellationToken = default); |
| | | |
| | | Task<CallMaterialOrder> FindByWmsTaskNoAsync(string wmsTaskNo, CancellationToken cancellationToken = default); |
| | | |
| | | /// <summary> |
| | | /// 验证名称是否存在叫料单表 |
| | | /// </summary> |
| | |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderByDescending(x=>x.CreationTime) |
| | | .FirstOrDefaultAsync(t => t.DataIdentifier == name, GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | } |
| | | |
| | | public virtual async Task<CallMaterialOrder> FindByWmsTaskNoAsync(string wmsTaskNo, CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .IncludeDetails() |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderByDescending(x => x.CreationTime) |
| | | .FirstOrDefaultAsync(t => t.WmsTaskNo == wmsTaskNo, GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 验证名称是否存在叫料单表 |
| | | /// </summary> |
| | |
| | | using System; |
| | | using Volo.Abp.BackgroundJobs; |
| | | using Volo.Abp.Uow; |
| | | using CMS.Plugin.PipeLineLems.Application.Contracts.Services; |
| | | using CMS.Plugin.PipeLineLems.Domain.WorkPlan; |
| | | using CMS.Plugin.PipeLineLems.Domain.CallMaterialOrder; |
| | | |
| | | namespace CMS.Plugin.PipeLineLems.ProjectService |
| | | { |
| | |
| | | private async Task HanlderForPringBarCodeAsync() |
| | | { |
| | | |
| | | var workPlanAppService = _serviceProvider.GetRequiredService<IWorkPlanAppService>(); |
| | | var workPlanRepository = _serviceProvider.GetRequiredService<IWorkPlanRepository>(); |
| | | var callMaterialOrderAppService = _serviceProvider.GetRequiredService<ICallMaterialOrderAppService>(); |
| | | |
| | | using var scope = _serviceProvider.CreateScope(); |
| | | var unitOfWorkManager = scope.ServiceProvider.GetRequiredService<IUnitOfWorkManager>(); |
| | | using var uow = unitOfWorkManager.Begin(requiresNew: true); |
| | | |
| | | var plcTaskNo = await _variableService.ReadValueAsync("打码进站PLC任务号"); |
| | | |
| | | if (string.IsNullOrEmpty(plcTaskNo?.Content?.Value.SafeString().ToString())) |
| | |
| | | else |
| | | { |
| | | var myTaskNo = plcTaskNo.Content.Value.SafeString().ToString(); |
| | | //TODO:暂时先写入 内部变量 |
| | | Dictionary<string, object?> keyValuePairs = new Dictionary<string, object?> |
| | | { |
| | | { "打码1", "11111111" }, |
| | | { "打码2", "22222222" }, |
| | | { "打码3", "33333333" } |
| | | }; |
| | | _variableService.WriteValueAsync(keyValuePairs); |
| | | CallMaterialOrder callMaterialOrder = null; |
| | | try |
| | | { |
| | | //根据wms任务号寻找 叫料工单 |
| | | callMaterialOrder = await callMaterialOrderAppService.FindByWmsTaskNoAsync(myTaskNo); |
| | | if (callMaterialOrder == null) return;//结束 |
| | | |
| | | //TODO:模拟采集参数 |
| | | keyValuePairs = new Dictionary<string, object?> |
| | | |
| | | |
| | | //根据原料标识寻找 作业计划 |
| | | var workPlanList = await workPlanAppService.FindByDataIdentifierAsync(callMaterialOrder.DataIdentifier); |
| | | if (workPlanList?.Count == 0) return;//结束 |
| | | |
| | | //更新为生产中 |
| | | foreach (var item in workPlanList) |
| | | { |
| | | item.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.生产中; |
| | | } |
| | | await workPlanRepository.UpdateManyAsync(workPlanList); |
| | | |
| | | //得到码值 |
| | | var code1 = ""; |
| | | var code2 = ""; |
| | | var code3 = ""; |
| | | var new_workPlanList = workPlanList.Where(x => x.ProcessRouteNumber == "切割").ToList(); |
| | | for (int i = 0; i < new_workPlanList.Count; i++) |
| | | { |
| | | if (i == 0) |
| | | { |
| | | code1 = new_workPlanList[i].MarkingContent; |
| | | } |
| | | if (i == 1) |
| | | { |
| | | code2 = new_workPlanList[i].MarkingContent; |
| | | } |
| | | if (i == 2) |
| | | { |
| | | code3 = new_workPlanList[i].MarkingContent; |
| | | } |
| | | } |
| | | Dictionary<string, object?> keyValuePairs = new Dictionary<string, object?> |
| | | { |
| | | { "打码工件1",code1}, |
| | | { "打码工件2", code2}, |
| | | { "打码工件3", code3 }, |
| | | { "打码原料管型号", new_workPlanList.First().MaterialMode }, |
| | | { "打码原料标识", new_workPlanList.First().DataIdentifier } |
| | | }; |
| | | _variableService.WriteValueAsync(keyValuePairs); |
| | | |
| | | //TODO:模拟采集参数 |
| | | keyValuePairs = new Dictionary<string, object?> |
| | | { |
| | | { "打码速度", 100}, |
| | | { "打码质量", 2}, |
| | | }; |
| | | var ret2 = _variableService.WriteValueAsync(keyValuePairs); |
| | | var ret2 = _variableService.WriteValueAsync(keyValuePairs); |
| | | |
| | | //TODO:暂时生成产品ID |
| | | //var productID = Guid.NewGuid().ToString(); |
| | | var productID = DateTime.Now.ToString("yyyyMMddHHmmssfff"); |
| | | keyValuePairs = new Dictionary<string, object?> |
| | | //TODO:暂时生成产品ID |
| | | var productID = DateTime.Now.ToString("yyyyMMddHHmmssfff"); |
| | | //var productID = new_workPlanList.Last().PipeSpecCode; |
| | | keyValuePairs = new Dictionary<string, object?> |
| | | { |
| | | { "打码_ProductID", productID}, |
| | | }; |
| | | var ret = _variableService.WriteValueAsync(keyValuePairs); |
| | | var ret = _variableService.WriteValueAsync(keyValuePairs); |
| | | |
| | | |
| | | uow.CompleteAsync(); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | uow.RollbackAsync(); |
| | | throw; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | //TODO:暂时先写入 内部变量 |
| | | Dictionary<string, object?> keyValuePairs = new Dictionary<string, object?> |
| | | { |
| | | { "切割1", "555555" }, |
| | | { "切割2", "66666" }, |
| | | { "切割3", "77777" } |
| | | { "切割位置1", "555555" }, |
| | | { "切割位置2", "66666" }, |
| | | { "切割位置3", "77777" } |
| | | }; |
| | | _variableService.WriteValueAsync(keyValuePairs); |
| | | |