| | |
| | | using CMS.Extensions.Variable; |
| | | using CMS.Plugin.FormulaManagement.Abstractions; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.CommonDto; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsMaterialStocks; |
| | | using CMS.Plugin.MaterialManagement.Abstractions; |
| | | using CMS.Plugin.OrderManagement.Abstractions; |
| | | using CMS.Plugin.OrderManagement.Abstractions.Enums; |
| | | using CMS.Plugin.OrderManagement.Abstractions.Models; |
| | | using CMS.Plugin.PipeLineLems.Application.Contracts.Dtos.WorkPlan; |
| | | using CMS.Plugin.ProductManagement.Abstractions; |
| | | using Microsoft.Extensions.DependencyInjection; |
| | | using Volo.Abp; |
| | | using Microsoft.Extensions.DependencyInjection; |
| | | using NPOI.Util; |
| | | using CMS.Plugin.PipeLineLems.Domain.CallMaterialOrder; |
| | | using CMS.Plugin.PipeLineLems.Application.Contracts.Services; |
| | | using CMS.Plugin.PipeLineLems.Application.Contracts.Dtos.CallMaterialOrder; |
| | | using Volo.Abp.Uow; |
| | | using System.Text; |
| | | using CMS.Plugin.PipeLineLems.Domain.WorkPlan; |
| | | using CMS.Plugin.PipeLineLems.Application.Contracts.Dtos.WorkPlan; |
| | | using CMS.Plugin.PipeLineLems.Application.Contracts.Services; |
| | | using CMS.Plugin.PipeLineLems.Domain.CallMaterialOrder; |
| | | using CMS.Plugin.PipeLineLems.Domain.CallMaterialOrderRecord; |
| | | using Volo.Abp.Users; |
| | | using CmsQueryExtensions.Entitys; |
| | | using CMS.Unit.RuntimeValue.Abstractions; |
| | | using CMS.Extensions.Variable; |
| | | using CMS.Plugin.TraceManagement.Abstractions.Models.Traces; |
| | | using CMS.Plugin.PipeLineLems.Domain.WorkPlan; |
| | | using CMS.Plugin.ProcessManagement.Abstractions; |
| | | using KissUtil.Extensions; |
| | | using CMS.Plugin.ProductManagement.Abstractions; |
| | | using CMS.Plugin.TraceManagement.Abstractions; |
| | | using CMS.Plugin.ProductManagement.Abstractions.Models; |
| | | using CMS.Plugin.MaterialManagement.Abstractions; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Services; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.CommonDto; |
| | | using System.Collections.Generic; |
| | | using CMS.Plugin.HIAWms.Abstractions; |
| | | using Newtonsoft.Json; |
| | | using CMS.Plugin.TraceManagement.Abstractions.Models.Traces; |
| | | using CmsQueryExtensions; |
| | | using CmsQueryExtensions.Entitys; |
| | | using CmsQueryExtensions.Extension; |
| | | using KissUtil.Extensions; |
| | | using Microsoft.Extensions.DependencyInjection; |
| | | using Newtonsoft.Json; |
| | | using Volo.Abp; |
| | | using Volo.Abp.Uow; |
| | | |
| | | namespace CMS.Plugin.PipeLineLems.Application.Implements; |
| | | |
| | |
| | | /// <returns></returns> |
| | | public async Task<MesOrderResponse> CommonPick(IServiceProvider _serviceProvider, PickInput input, MyCurrentUser myCurrentUser) |
| | | { |
| | | if (string.IsNullOrEmpty(input.TaskCode)) |
| | | { |
| | | throw new UserFriendlyException("请输入任务编号"); |
| | | }; |
| | | if (string.IsNullOrEmpty(input.PipeSpecCode)) |
| | | { |
| | | throw new UserFriendlyException("请输入管段编码"); |
| | | }; |
| | | if (string.IsNullOrEmpty(input.ContinerNo)) |
| | | { |
| | | throw new UserFriendlyException("请输入托盘号"); |
| | | }; |
| | | //1、记录分拣记录表 |
| | | //2、更新作业计划表的状态 =已分拣 |
| | | //3、写入 分拣变量 |
| | | //4、写入追溯报表 |
| | | //5、物料组盘 |
| | | |
| | | |
| | | VariableService _variableService = _serviceProvider.GetRequiredService<VariableService>(); |
| | | var _workSectionManager = _serviceProvider.GetRequiredService<IWorkSectionManager>(); |
| | |
| | | }); |
| | | } |
| | | //物料参数列表 |
| | | var firstWorkPlans = await workPlanAppService.GetListByFilterAsync(x => x.PipeSpecCode == input.PipeSpecCode); |
| | | |
| | | var firstWorkPlan = await workPlanAppService.GetSingleByFilterAsync(x => x.PipeSpecCode == input.PipeSpecCode); |
| | | |
| | | var firstWorkPlan = await workPlanAppService.GetSingleByFilterAsync(x => x.TaskCode == input.TaskCode); |
| | | var callMaterialOrder = await callMaterialOrderAppService.GetSingleByFilterAsync(x => x.DataIdentifier == firstWorkPlan.DataIdentifier); |
| | | //TODO:这里调用wms的叫料接口 |
| | | try |
| | | { |
| | | WmsMaterialStockCreateDto param = new WmsMaterialStockCreateDto() |
| | | { |
| | | ContainerNo = input.ContinerNo, |
| | | MaterialModel = firstWorkPlan.MaterialMode, |
| | | PlaceNo = input.PlaceNo, |
| | | StockNumber = 1, |
| | | MaterialBatch = callMaterialOrder.MaterialBatch, |
| | | |
| | | RedundantField1 = firstWorkPlan.ProcessRouteNumber, //扩展字段显示 工艺流向编号 |
| | | RedundantField2 = firstWorkPlan.PipeSpecCode, //扩展字段显示 管段编码 |
| | | RedundantField3 = firstWorkPlan.PipeSectionName, //扩展字段显示 管段名称 |
| | | |
| | | }; |
| | | string baseUrl = @"http://127.0.0.1:18000/api/v1/HIAWms/"; |
| | | string url = baseUrl + "LMesOperate/LMesPick"; |
| | | string json = JsonConvert.SerializeObject(param); |
| | | var result = HttpApiRequest.HttpPost(url, json); |
| | | var res = JsonConvert.DeserializeObject<CmsApiResponse<WmsMaterialStockDto>>(result); |
| | | if (res.Code == 200) |
| | | { |
| | | var retData = res.Data; |
| | | //callMaterialOrder.MaterialBatch = retData[0].MaterialBatch; |
| | | //callMaterialOrder.WmsTaskNo = retData[0].TaskNo; |
| | | //callMaterialOrder.WmsRetResult = res.Message; |
| | | } |
| | | else |
| | | { |
| | | throw new UserFriendlyException(res.Message); |
| | | } |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | var rawPipe_DataIdentifier = await materialProvider.FindByNameAsync("原料管标识"); |
| | | var rawPipe_MaterialMode = await materialProvider.FindByNameAsync("原料管型号"); |
| | |
| | | string url = baseUrl + "lMesOperate/LMesCallMaterial"; |
| | | string json = JsonConvert.SerializeObject(param); |
| | | var result = HttpApiRequest.HttpPost(url, json); |
| | | |
| | | var res = JsonConvert.DeserializeObject<CmsApiResponse<List<MyCallMaterialOutput>>>(result); |
| | | if (res.Code == 200) |
| | | { |
| | |
| | | { |
| | | throw new UserFriendlyException(res.Message); |
| | | } |
| | | //*/ |
| | | } |
| | | catch (Exception) |
| | | { |
| | |
| | | //{ |
| | | // workPlan.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.已完成; |
| | | //} |
| | | if (workPlan.ProcessRouteNumber == "无") |
| | | { |
| | | workPlan.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.已完成; |
| | | } |
| | | else |
| | | { |
| | | workPlan.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.生产中; |
| | | } |
| | | workPlan.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.生产中; |
| | | |
| | | await workPlanRepository.UpdateAsync(workPlan); |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 分拣时获取生产计划和分配区域 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <param name="_serviceProvider"></param> |
| | | /// <param name="myCurrentUser"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="UserFriendlyException"></exception> |
| | | public async Task<CmsApiResponse<PickOutput>> GetPickRetAsync(GetWorkPlanInput input, IServiceProvider _serviceProvider, MyCurrentUser myCurrentUser) |
| | | { |
| | | |
| | | |
| | | var callMaterialOrderRepository = _serviceProvider.GetRequiredService<ICallMaterialOrderRepository>(); |
| | | var workPlanRepository = _serviceProvider.GetRequiredService<IWorkPlanRepository>(); |
| | | var _workPlanAppService = _serviceProvider.GetRequiredService<IWorkPlanAppService>(); |
| | | var callMaterialOrderRecordRepository = _serviceProvider.GetRequiredService<ICallMaterialOrderRecordRepository>(); |
| | | var orderManager = _serviceProvider.GetRequiredService<IOrderManager>(); |
| | | |
| | | // 查找数据 |
| | | |
| | | WorkPlanDto workPlanDto = await _workPlanAppService.FindSingleByFilterAsync(input); |
| | | |
| | | //TODO:这里调用wms的库存查询接口 |
| | | try |
| | | { |
| | | GetWmsMaterialStockInput param = new GetWmsMaterialStockInput() |
| | | { |
| | | RedundantField1 = workPlanDto.ProcessRouteNumber, |
| | | RedundantField1_FilterMode = SearchFilterModeEnum.精准查询 |
| | | }; |
| | | |
| | | string baseUrl = @"http://127.0.0.1:18000/api/v1/HIAWms/"; |
| | | string url = baseUrl + "LMesOperate/FindListByFilter"; |
| | | string json = JsonConvert.SerializeObject(param); |
| | | var result = HttpApiRequest.HttpPost(url, json); |
| | | var res = JsonConvert.DeserializeObject<CmsApiResponse<List<WmsMaterialStockDto>>>(result); |
| | | if (res.Code == 200) |
| | | { |
| | | var retData = res.Data as List<WmsMaterialStockDto>; |
| | | var data = new PickOutput() |
| | | { |
| | | WorkPlan = workPlanDto, |
| | | PlaceNo = "",//待赋值 |
| | | ContinerNo = ""//待赋值 |
| | | }; |
| | | if (retData?.Count > 0) |
| | | { |
| | | data.PlaceNo = retData.First().PlaceNo; |
| | | data.ContinerNo = retData.First().ContainerNo; |
| | | } |
| | | |
| | | var response = new CmsApiResponse<PickOutput> |
| | | { |
| | | Code = 200, |
| | | Data = data, |
| | | Message = "处理成功", |
| | | }; |
| | | return response; |
| | | |
| | | } |
| | | else |
| | | { |
| | | throw new UserFriendlyException(res.Message); |
| | | }; |
| | | //*/ |
| | | //模拟 |
| | | //var data = new PickOutput() |
| | | //{ |
| | | // WorkPlan = workPlanDto, |
| | | // PlaceNo = "",//待赋值 |
| | | // ContinerNo = ""//待赋值 |
| | | //}; |
| | | //var response = new CmsApiResponse<PickOutput> |
| | | //{ |
| | | // Code = 200, |
| | | // Data = data, |
| | | // Message = "处理成功", |
| | | //}; |
| | | //return response; |
| | | |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 生成随机的WmsTaskNo |
| | | /// </summary> |