From 51441c716afe303d6d8f1aba76406a4fd39b084a Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周五, 16 5月 2025 15:44:09 +0800 Subject: [PATCH] 222 --- HIAWms/hiawms_web/.vscode/settings.json | 1 Weben_CMS专用代码生成器/queryExtensions/CmsQueryExtensions/Entitys/CmsApiResponse.cs | 54 ++++++++++ PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs | 36 +++++++ PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/CallMaterialOrder/MyCallMaterialOutput.cs | 73 ++++++++++++++ Weben_CMS专用代码生成器/queryExtensions/CmsQueryExtensions/Utils/HttpApiRequest.cs | 63 ++++++++++++ HIAWms/server/src/CMS.Plugin.HIAWms/Controller/LMesOperateController.cs | 25 ++++ PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMS.Plugin.PipeLineLems.csproj | 15 +++ PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/CMS.Plugin.PipeLineLems.Application.csproj | 9 + PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMSPluginEntry.cs | 13 ++ CommonDLL/CmsQueryExtensions.dll | 0 10 files changed, 286 insertions(+), 3 deletions(-) diff --git a/CommonDLL/CmsQueryExtensions.dll b/CommonDLL/CmsQueryExtensions.dll index 6fc8269..de1c59c 100644 --- a/CommonDLL/CmsQueryExtensions.dll +++ b/CommonDLL/CmsQueryExtensions.dll Binary files differ diff --git a/HIAWms/hiawms_web/.vscode/settings.json b/HIAWms/hiawms_web/.vscode/settings.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/HIAWms/hiawms_web/.vscode/settings.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms/Controller/LMesOperateController.cs b/HIAWms/server/src/CMS.Plugin.HIAWms/Controller/LMesOperateController.cs index ad56343..50523df 100644 --- a/HIAWms/server/src/CMS.Plugin.HIAWms/Controller/LMesOperateController.cs +++ b/HIAWms/server/src/CMS.Plugin.HIAWms/Controller/LMesOperateController.cs @@ -1,6 +1,7 @@ 锘縰sing CMS.Extensions.Abp.AspNetCore.Mvc.Filters; using CMS.Plugin.HIAWms.Application.Contracts.Dtos.CommonDto; using CMS.Plugin.HIAWms.Application.Contracts.Services; +using CmsQueryExtensions.Entitys; using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; @@ -32,9 +33,29 @@ /// <returns></returns> [HttpPost] [Route("LMesCallMaterial")] - public async Task<List<CallMaterialOutput>> LMesCallMaterialAsync(List<LMesCallMaterialInput> input) + public async Task<CmsApiResponse<List<CallMaterialOutput>>> LMesCallMaterialAsync(List<LMesCallMaterialInput> input) { - return await _mesOperateAppService.LMesCallMaterialAsync(input); + try + { + var list = await _mesOperateAppService.LMesCallMaterialAsync(input); + return new CmsApiResponse<List<CallMaterialOutput>>() + { + Data = list, + Code = 200, + Message = "LMes鍙枡鎴愬姛" + }; + } + catch (Exception ex) + { + //throw; //涓嶈鎶涘嚭寮傚父锛屽惁鍒欏鏂逛細鎺ユ敹澶辫触鍛� + return new CmsApiResponse<List<CallMaterialOutput>>() + { + Data = null, + Code = 500, + Message = ex.Message + }; + } + } } } diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/CallMaterialOrder/MyCallMaterialOutput.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/CallMaterialOrder/MyCallMaterialOutput.cs new file mode 100644 index 0000000..68ace54 --- /dev/null +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/CallMaterialOrder/MyCallMaterialOutput.cs @@ -0,0 +1,73 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Entities; + +namespace CMS.Plugin.PipeLineLems.Application.Contracts.Dtos.CallMaterialOrder +{ + /// <summary> + /// 鍙枡杩斿洖 + /// </summary> + public class MyCallMaterialOutput : ExtensibleEntityDto<Guid>, IHasConcurrencyStamp + { + public string MaterialNo { get; set; } + /// <summary> + /// 缂栧彿 + /// </summary> + public virtual string MaterialId { get; set; } + + /// <summary> + /// 鍚嶇О + /// </summary> + public virtual string MaterialName { get; set; } + + /// <summary> + /// 瀹瑰櫒缂栧彿 + /// </summary> + public string ContainerNo { get; set; } + + /// <summary> + /// 鐗╂枡鎵规 + /// </summary> + public string MaterialBatch { get; set; } + + /// <summary> + /// 鍨嬪彿 + /// </summary> + public string MaterialModel { get; set; } + + /// <summary> + /// 搴撲綅缂栧彿 + /// </summary> + public string PlaceNo { get; set; } + + /// <summary> + /// 鍏ュ簱鏃堕棿 + /// </summary> + public DateTime? InStockTime { get; set; } + + /// <summary> + /// 浠诲姟鍙� + /// </summary> + public string TaskNo { get; set; } + + /// <summary> + /// 鏉ユ簮鍗曟嵁鍙� + /// </summary> + public string? SourceOrderNo { get; set; } + + /// <summary> + /// PLC浠诲姟鍙� + /// </summary> + public int PlcTaskId { get; set; } + public string ConcurrencyStamp + { + get + ; + set; + } + } +} diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/CMS.Plugin.PipeLineLems.Application.csproj b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/CMS.Plugin.PipeLineLems.Application.csproj index a8c00a1..1c2b41d 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/CMS.Plugin.PipeLineLems.Application.csproj +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/CMS.Plugin.PipeLineLems.Application.csproj @@ -19,6 +19,15 @@ </ItemGroup> <ItemGroup> + <Reference Include="CMS.Plugin.HIAWms.Abstractions"> + <HintPath>..\..\..\..\..\..\Program Files\CMS Editor\plugins\cms.plugin.hiawms\net6.0\CMS.Plugin.HIAWms.Abstractions.dll</HintPath> + </Reference> + <Reference Include="CMS.Plugin.HIAWms.Application"> + <HintPath>..\..\..\..\..\..\Program Files\CMS Editor\plugins\cms.plugin.hiawms\net6.0\CMS.Plugin.HIAWms.Application.dll</HintPath> + </Reference> + <Reference Include="CMS.Plugin.HIAWms.Application.Contracts"> + <HintPath>..\..\..\..\..\..\Program Files\CMS Editor\plugins\cms.plugin.hiawms\net6.0\CMS.Plugin.HIAWms.Application.Contracts.dll</HintPath> + </Reference> <Reference Include="CmsQueryExtensions"> <HintPath>..\..\..\..\CommonDLL\CmsQueryExtensions.dll</HintPath> </Reference> diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs index 3a1e6b2..58720e2 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs @@ -25,6 +25,12 @@ 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 CmsQueryExtensions; namespace CMS.Plugin.PipeLineLems.Application.Implements; @@ -460,10 +466,38 @@ // 楠岃瘉鐘舵�� if (callMaterialOrder.CallMaterialStatus != Domain.Shared.Enums.CallMaterialStatusEnum.鏈墽琛�) { - throw new UserFriendlyException($"鍘熸枡鏍囪瘑涓� '{callMaterialOrder.DataIdentifier}' 鐨勫彨鏂欒褰曠姸鎬佷负 '{callMaterialOrder.CallMaterialStatus}'锛屼笉鍏佽鍙枡"); + //throw new UserFriendlyException($"鍘熸枡鏍囪瘑涓� '{callMaterialOrder.DataIdentifier}' 鐨勫彨鏂欒褰曠姸鎬佷负 '{callMaterialOrder.CallMaterialStatus}'锛屼笉鍏佽鍙枡"); } //TODO:杩欓噷璋冪敤wms鐨勫彨鏂欐帴鍙� + try + { + List<LMesCallMaterialInput> param = new List<LMesCallMaterialInput>() { + new LMesCallMaterialInput(){ + DataIdentifier=callMaterialOrder.DataIdentifier, + MaterialMode="Q235B-桅89脳4", + } + }; + string baseUrl = @"http://127.0.0.1:18000/api/v1/HIAWms/"; + 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) + { + var retData = res.Data; + callMaterialOrder.MaterialBatch = retData[0].MaterialBatch; + } + else { + throw new UserFriendlyException(res.Message); + } + } + catch (Exception) + { + + throw; + } + // 鏇存柊鏁版嵁 callMaterialOrder.MaterialBatch = GenerateRandomBatch();//wms杩斿洖鐨勫師鏂欐壒娆� diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMS.Plugin.PipeLineLems.csproj b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMS.Plugin.PipeLineLems.csproj index 099e1a1..4108cc0 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMS.Plugin.PipeLineLems.csproj +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMS.Plugin.PipeLineLems.csproj @@ -56,6 +56,21 @@ </ItemGroup> <ItemGroup> + <Reference Include="CMS.Plugin.HIAWms.Abstractions"> + <HintPath>..\..\..\..\..\..\Program Files\CMS Editor\plugins\cms.plugin.hiawms\net6.0\CMS.Plugin.HIAWms.Abstractions.dll</HintPath> + </Reference> + <Reference Include="CMS.Plugin.HIAWms.Application"> + <HintPath>..\..\..\..\..\..\Program Files\CMS Editor\plugins\cms.plugin.hiawms\net6.0\CMS.Plugin.HIAWms.Application.dll</HintPath> + </Reference> + <Reference Include="CMS.Plugin.HIAWms.Application.Contracts"> + <HintPath>..\..\..\..\HIAWms\server\src\CMS.Plugin.HIAWms.Application.Contracts\bin\Debug\net6.0\CMS.Plugin.HIAWms.Application.Contracts.dll</HintPath> + </Reference> + <Reference Include="CMS.Plugin.HIAWms.Domain"> + <HintPath>..\..\..\..\..\..\Program Files\CMS Editor\plugins\cms.plugin.hiawms\net6.0\CMS.Plugin.HIAWms.Domain.dll</HintPath> + </Reference> + <Reference Include="CMS.Plugin.HIAWms.EntityFrameworkCore"> + <HintPath>..\..\..\..\..\..\Program Files\CMS Editor\plugins\cms.plugin.hiawms\net6.0\CMS.Plugin.HIAWms.EntityFrameworkCore.dll</HintPath> + </Reference> <Reference Include="CmsQueryExtensions"> <HintPath>..\..\..\..\CommonDLL\CmsQueryExtensions.dll</HintPath> </Reference> diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMSPluginEntry.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMSPluginEntry.cs index 87ffc61..73807a4 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMSPluginEntry.cs +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMSPluginEntry.cs @@ -24,6 +24,12 @@ using Volo.Abp.Modularity.PlugIns; using CMS.Plugin.PipeLineLems.Application.Contracts.Services; using CMS.Plugin.PipeLineLems.Application.Implements; +using CMS.Plugin.HIAWms.Application.Contracts.Services; +using CMS.Plugin.HIAWms.Application.Implements; +using CMS.Plugin.HIAWms.Domain.WmsTask; +using CMS.Plugin.HIAWms.EntityFrameworkCore.Repositories; +using CMS.Plugin.HIAWms.Domain.WmsMaterials; +using CMS.Plugin.HIAWms.Abstractions; namespace CMS.Plugin.PipeLineLems; @@ -51,6 +57,13 @@ context.Services.AddSingleton<IProjectService, PipeLineLemsProjectService>(); context.Services.AddScoped<IMesAppService, MesAppService>(); context.Services.AddScoped<IWorkPlanAppService, WorkPlanAppService>(); + //context.Services.AddScoped<ILMesOperateAppService, LMesOperateAppService>(); + //context.Services.AddScoped<IWmsTaskRepository, EfCoreWmsTaskRepository>(); + //context.Services.AddScoped<IWmsMaterialRepository, EfCoreWmsMaterialRepository>(); + //context.Services.AddScoped<IWmsInOutStockOrderAppService, WmsInOutStockOrderAppService>(); + //context.Services.AddScoped<IWmsOutStockAppService, WmsOutStockAppService>(); + + context.Services.AddScoped<IEFDataProvider>(p => { diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/queryExtensions/CmsQueryExtensions/Entitys/CmsApiResponse.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/queryExtensions/CmsQueryExtensions/Entitys/CmsApiResponse.cs" new file mode 100644 index 0000000..7108486 --- /dev/null +++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/queryExtensions/CmsQueryExtensions/Entitys/CmsApiResponse.cs" @@ -0,0 +1,54 @@ +锘縰sing System; +namespace CmsQueryExtensions.Entitys; +/// <summary> +/// CMS鐨凙PI 鍝嶅簲瀹炰綋绫� +/// </summary> +public class CmsApiResponse<T> +{ + /// <summary> + /// 閿欒淇℃伅锛堝 "璇ュ瀷鍙风墿鏂欎俊鎭笉瀛樺湪"锛� + /// </summary> + public string Message { get; set; } + + /// <summary> + /// 杩斿洖鐨勬暟鎹紙鍙兘涓� null锛� + /// </summary> + public T Data { get; set; } + + /// <summary> + /// 鑷畾涔夌姸鎬佺爜锛堝 200 琛ㄧず鎴愬姛锛屼絾涓氬姟閫昏緫鍙兘杩斿洖閿欒锛� + /// </summary> + public int Code { get; set; } = 200; +} + +///// <summary> +///// 閿欒璇︽儏瀹炰綋绫� +///// </summary> +//public class ResponseError +//{ +// /// <summary> +// /// 閿欒浠g爜锛堝彲鑳戒负 null锛� +// /// </summary> +// public string Code { get; set; } + +// /// <summary> +// /// 閿欒娑堟伅锛堝 "璇ュ瀷鍙风墿鏂欎俊鎭笉瀛樺湪"锛� +// /// </summary> +// public string Message { get; set; } + +// /// <summary> +// /// 閿欒璇︽儏锛堝彲鑳戒负绌猴級 +// /// </summary> +// public string Details { get; set; } + +// /// <summary> +// /// 棰濆鏁版嵁锛堝彲鑳戒负 null锛� +// /// </summary> +// public object Data { get; set; } + +// /// <summary> +// /// 楠岃瘉閿欒锛堝彲鑳戒负 null锛� +// /// </summary> +// public object ValidationErrors { get; set; } +//} + diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/queryExtensions/CmsQueryExtensions/Utils/HttpApiRequest.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/queryExtensions/CmsQueryExtensions/Utils/HttpApiRequest.cs" new file mode 100644 index 0000000..63bf4e5 --- /dev/null +++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/queryExtensions/CmsQueryExtensions/Utils/HttpApiRequest.cs" @@ -0,0 +1,63 @@ +锘�// 楹荤渷鐞嗗伐瀛﹂櫌璁稿彲璇� +// +// 鐗堟潈鎵�鏈� (c) 2021-2023 zuohuaijun锛屽ぇ鍚嶇鎶�锛堝ぉ娲ワ級鏈夐檺鍏徃 鑱旂郴鐢佃瘽/寰俊锛�18020030720 QQ锛�515096995 +// +// 鐗规鍏嶈垂鎺堜簣鑾峰緱鏈蒋浠剁殑浠讳綍浜轰互澶勭悊鏈蒋浠剁殑鏉冨埄锛屼絾椤婚伒瀹堜互涓嬫潯浠讹細鍦ㄦ墍鏈夊壇鏈垨閲嶈閮ㄥ垎鐨勮蒋浠朵腑蹇呴』鍖呮嫭涓婅堪鐗堟潈澹版槑鍜屾湰璁稿彲澹版槑銆� +// +// 杞欢鎸夆�滃師鏍封�濇彁渚涳紝涓嶆彁渚涗换浣曞舰寮忕殑鏄庣ず鎴栨殫绀虹殑淇濊瘉锛屽寘鎷絾涓嶉檺浜庡閫傞攢鎬с�侀�傜敤鎬у拰闈炰镜鏉冪殑淇濊瘉銆� +// 鍦ㄤ换浣曟儏鍐典笅锛屼綔鑰呮垨鐗堟潈鎸佹湁浜哄潎涓嶅浠讳綍绱㈣禂銆佹崯瀹虫垨鍏朵粬璐d换璐熻矗锛屾棤璁烘槸鍥犲悎鍚屻�佷镜鏉冩垨鍏朵粬鏂瑰紡寮曡捣鐨勶紝涓庤蒋浠舵垨鍏朵娇鐢ㄦ垨鍏朵粬浜ゆ槗鏈夊叧銆� + +using Newtonsoft.Json; +using System.Net; +using System.Text; + +namespace CmsQueryExtensions; +public class HttpApiRequest +{ + public static string HttpGet(string url) + { + string result = ""; + HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); + req.Method = "GET"; + req.ContentType = "application/json"; + HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); + Stream stream = resp.GetResponseStream(); + //鑾峰彇鍝嶅簲鍐呭 + using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) + { + result = reader.ReadToEnd(); + } + return result; + } + public static string HttpPost(string url, string jsondata) + { + string result = ""; + HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); + // HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); + + req.Method = "POST"; + req.ContentType = "application/json"; + + if (!string.IsNullOrWhiteSpace(jsondata)) + { + byte[] data = Encoding.UTF8.GetBytes(jsondata); + req.ContentLength = data.Length; + + using (Stream reqStream = req.GetRequestStream()) + { + reqStream.Write(data, 0, data.Length); + reqStream.Close(); + } + } + + HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); + Stream stream = resp.GetResponseStream(); + //鑾峰彇鍝嶅簲鍐呭 + using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) + { + result = reader.ReadToEnd(); + } + return result; + } +} + -- Gitblit v1.9.3