From 88d52606d0db8fb0343ebcd2d53c8df62fd05f2a Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期六, 28 十二月 2024 23:39:46 +0800 Subject: [PATCH] 1 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_CSJ.cs | 8 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs | 147 +++++++++------ 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVExtend.cs | 2 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs | 37 ++- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Record/Dt_StockQuantityChangeRecord.cs | 2 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderService.cs | 2 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/PDAController.cs | 18 + 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs | 4 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs | 4 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs | 2 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 30 ++ 代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/9e5bb932-a2ae-42b5-8ed0-09de9b346dc6.vsidx | 0 代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/4a20dff1-21c1-4155-a046-64d2b9450c27.vsidx | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs | 109 +++++++++-- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/ReceiveOrderService.cs | 38 ++-- 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/cefa9c6e-65e6-4f5e-8814-550d3e8d3f27.vsidx | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/RootList.cs | 23 ++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs | 7 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 48 +++- 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/996cb05a-4002-49d6-b075-bdc5451f77c7.vsidx | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpMesHelper.cs | 7 /dev/null | 0 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_Server.csproj | 8 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/read.lock | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/TestToolModel.cs | 2 25 files changed, 330 insertions(+), 168 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/4a20dff1-21c1-4155-a046-64d2b9450c27.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/4a20dff1-21c1-4155-a046-64d2b9450c27.vsidx" new file mode 100644 index 0000000..7617cfa --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/4a20dff1-21c1-4155-a046-64d2b9450c27.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/995da1df-bccd-4c50-83da-49435a3bf126.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/995da1df-bccd-4c50-83da-49435a3bf126.vsidx" deleted file mode 100644 index 18b2043..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/995da1df-bccd-4c50-83da-49435a3bf126.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/f5f21838-c06b-4a66-8b67-766679145a82.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/9e5bb932-a2ae-42b5-8ed0-09de9b346dc6.vsidx" similarity index 73% rename from "\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/f5f21838-c06b-4a66-8b67-766679145a82.vsidx" rename to "\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/9e5bb932-a2ae-42b5-8ed0-09de9b346dc6.vsidx" index 3eef876..859b039 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/f5f21838-c06b-4a66-8b67-766679145a82.vsidx" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/9e5bb932-a2ae-42b5-8ed0-09de9b346dc6.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs" index 0f850ff..0ec998c 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs" @@ -47,9 +47,9 @@ builder.Services.AddInitializationHostServiceSetup();//应用初始化服务注入 builder.Services.AddDbSetup();//Db 启动服务 -//builder.Services.AddScoped<QuartzJobCreateDataTabel>(); +builder.Services.AddScoped<QuartzJobCreateDataTabel>(); builder.Services.AddHostedService<WarehouseHostedService>(); -//builder.Services.AddHostedService<QuartzJobDataTableHostedService>(); +builder.Services.AddHostedService<QuartzJobDataTableHostedService>(); builder.Services.AddAutoMapperSetup(); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_Server.csproj" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_Server.csproj" index e160ea1..5a4a541 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_Server.csproj" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_Server.csproj" @@ -13,8 +13,6 @@ <Content Remove="wwwroot\WIDESEAWCS_DB.DBSeed.Json\Dt_DeviceProtocolDetail.tsv" /> <Content Remove="wwwroot\WIDESEAWCS_DB.DBSeed.Json\Dt_DispatchInfo.tsv" /> <Content Remove="wwwroot\WIDESEAWCS_DB.DBSeed.Json\Dt_Router.tsv" /> - <Content Remove="wwwroot\WIDESEAWCS_DB.DBSeed.Json\Dt_Task.tsv" /> - <Content Remove="wwwroot\WIDESEAWCS_DB.DBSeed.Json\Dt_TaskExecuteDetail.tsv" /> <Content Remove="wwwroot\WIDESEAWCS_DB.DBSeed.Json\Sys_Dictionary.tsv" /> <Content Remove="wwwroot\WIDESEAWCS_DB.DBSeed.Json\Sys_DictionaryList.tsv" /> <Content Remove="wwwroot\WIDESEAWCS_DB.DBSeed.Json\Sys_Menu.tsv" /> @@ -44,12 +42,6 @@ <CopyToOutputDirectory>Always</CopyToOutputDirectory> </EmbeddedResource> <EmbeddedResource Include="wwwroot\WIDESEAWCS_DB.DBSeed.Json\Dt_Router.tsv"> - <CopyToOutputDirectory>Always</CopyToOutputDirectory> - </EmbeddedResource> - <EmbeddedResource Include="wwwroot\WIDESEAWCS_DB.DBSeed.Json\Dt_Task.tsv"> - <CopyToOutputDirectory>Always</CopyToOutputDirectory> - </EmbeddedResource> - <EmbeddedResource Include="wwwroot\WIDESEAWCS_DB.DBSeed.Json\Dt_TaskExecuteDetail.tsv"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </EmbeddedResource> <EmbeddedResource Include="wwwroot\WIDESEAWCS_DB.DBSeed.Json\Sys_Dictionary.tsv"> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs" index 129ec17..6f5ab5c 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs" @@ -24,7 +24,7 @@ WebResponseContent content = new WebResponseContent(); try { - string apiAddress = "http://10.30.4.19:8182/rcms/services/rest/hikRpcService/genAgvSchedulingTask";// AppSettings.Get(APIEnum.AgvSendTask.ToString()); + string apiAddress = "http://10.30.4.29:8182/rcms/services/rest/hikRpcService/genAgvSchedulingTask";// AppSettings.Get(APIEnum.AgvSendTask.ToString()); string response = HttpHelper.Post(apiAddress, taskModel.Serialize()); AgvResponseContent agvContent = response.DeserializeObject<AgvResponseContent>(); if (agvContent.Code == "0") @@ -59,7 +59,7 @@ WebResponseContent content = new WebResponseContent(); try { - string apiAddress = "http://10.30.4.19:8182/rcms/services/rest/hikRpcService/continueTask";// AppSettings.Get(APIEnum.AgvSecureReply.ToString()); + string apiAddress = "http://10.30.4.29:8182/rcms/services/rest/hikRpcService/continueTask";// AppSettings.Get(APIEnum.AgvSecureReply.ToString()); string response = HttpHelper.Post(apiAddress, secureReplyModel.Serialize()); AgvResponseContent agvContent = response.DeserializeObject<AgvResponseContent>(); if (agvContent.Code == "0") diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" index 3ab0634..f7e3c24 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" @@ -176,22 +176,40 @@ if (routers.Count == 1) { task.NextAddress = router?.NextPosi ?? ""; + task.DeviceCode = stationManger.StationDeviceCode; } else { task.NextAddress = ""; + task.DeviceCode = ""; } } else { - List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && item.AGVArea == x.StartPosi); - if (routers.FirstOrDefault() == null) + if(item.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { - return WebResponseContent.Instance.Error($"鏈壘鍒拌矾鐢遍厤缃俊鎭�"); - } - router = routers.FirstOrDefault(); + List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && item.AGVArea == x.NextPosi); + if (routers.FirstOrDefault() == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒拌矾鐢遍厤缃俊鎭�"); + } + router = routers.FirstOrDefault(); - task.NextAddress = router?.NextPosi ?? ""; + task.NextAddress = router?.StartPosi ?? ""; + task.DeviceCode = item.RoadWay; + } + else + { + List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && item.AGVArea == x.StartPosi); + if (routers.FirstOrDefault() == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒拌矾鐢遍厤缃俊鎭�"); + } + router = routers.FirstOrDefault(); + + task.NextAddress = router?.NextPosi ?? ""; + task.DeviceCode = "AGV"; + } } tasks.Add(task); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVExtend.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVExtend.cs" index 3f480c9..7d4b8c3 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVExtend.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVExtend.cs" @@ -20,7 +20,7 @@ { try { - var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.New.ObjToInt()).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); + var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); foreach (var agvTask in newTasks) { AgvTaskDTO taskDTO = new AgvTaskDTO() diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/47049b24-30e9-4e73-be80-cc5abf5cfefd.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/47049b24-30e9-4e73-be80-cc5abf5cfefd.vsidx" deleted file mode 100644 index 8951428..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/47049b24-30e9-4e73-be80-cc5abf5cfefd.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/996cb05a-4002-49d6-b075-bdc5451f77c7.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/996cb05a-4002-49d6-b075-bdc5451f77c7.vsidx" new file mode 100644 index 0000000..d13af6c --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/996cb05a-4002-49d6-b075-bdc5451f77c7.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/b4300a95-0842-480f-9efa-8633f9f71fe0.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/b4300a95-0842-480f-9efa-8633f9f71fe0.vsidx" deleted file mode 100644 index c9e1ac7..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/b4300a95-0842-480f-9efa-8633f9f71fe0.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/cefa9c6e-65e6-4f5e-8814-550d3e8d3f27.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/cefa9c6e-65e6-4f5e-8814-550d3e8d3f27.vsidx" new file mode 100644 index 0000000..bc11c4e --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/cefa9c6e-65e6-4f5e-8814-550d3e8d3f27.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/read.lock" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/read.lock" new file mode 100644 index 0000000..e69de29 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/read.lock" diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_CSJ.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_CSJ.cs" index c3c44a5..c04414c 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_CSJ.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_CSJ.cs" @@ -190,20 +190,20 @@ case PalletTypeEnum.LargePallet: { List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); - moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt()) == null;//鏌ヨ澶т簬褰撳墠璐т綅娣卞害鐨勯泦鍚堥噷鏄惁鏈夌姸鎬佷笉涓烘湁璐х殑璐т綅锛屽鏋滄槸true锛屽垯琛ㄧず娣辫揣浣嶆湁鏈浣跨敤鐨勬儏鍐� + moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt() && x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) == null;//鏌ヨ澶т簬褰撳墠璐т綅娣卞害鐨勯泦鍚堥噷鏄惁鏈夌姸鎬佷笉涓烘湁璐х殑璐т綅锛屽鏋滄槸true锛屽垯琛ㄧず娣辫揣浣嶆湁鏈浣跨敤鐨勬儏鍐� List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); - littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //鏌ヨ灏忎簬褰撳墠璐т綅娣卞害鐨勯泦鍚堥噷鏄惁鏈夌姸鎬佷笉涓虹┖锛屼笖绂佺敤鐘舵�佷笉涓虹鐢ㄤ互鍙婂彧鍏ョ殑璐т綅锛屽鏋滄槸true锛屽垯琛ㄧず娴呰揣浣嶈浣跨敤鎴栬�呰绂佺敤鐨勬儏鍐� + littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) == null; //鏌ヨ灏忎簬褰撳墠璐т綅娣卞害鐨勯泦鍚堥噷鏄惁鏈夌姸鎬佷笉涓虹┖锛屼笖绂佺敤鐘舵�佷笉涓虹鐢ㄤ互鍙婂彧鍏ョ殑璐т綅锛屽鏋滄槸true锛屽垯琛ㄧず娴呰揣浣嶈浣跨敤鎴栬�呰绂佺敤鐨勬儏鍐� } break; case PalletTypeEnum.MediumPallet: case PalletTypeEnum.SmallPallet: { List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); - moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt()) == null;//鏌ヨ澶т簬褰撳墠璐т綅娣卞害鐨勯泦鍚堥噷鏄惁鏈夌姸鎬佷笉涓烘湁璐х殑璐т綅锛屽鏋滄槸true锛屽垯琛ㄧず娣辫揣浣嶆湁鏈浣跨敤鐨勬儏鍐� + moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) == null;//鏌ヨ澶т簬褰撳墠璐т綅娣卞害鐨勯泦鍚堥噷鏄惁鏈夌姸鎬佷笉涓烘湁璐х殑璐т綅锛屽鏋滄槸true锛屽垯琛ㄧず娣辫揣浣嶆湁鏈浣跨敤鐨勬儏鍐� List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); - littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //鏌ヨ灏忎簬褰撳墠璐т綅娣卞害鐨勯泦鍚堥噷鏄惁鏈夌姸鎬佷笉涓虹┖锛屼笖绂佺敤鐘舵�佷笉涓虹鐢ㄤ互鍙婂彧鍏ョ殑璐т綅锛屽鏋滄槸true锛屽垯琛ㄧず娴呰揣浣嶈浣跨敤鎴栬�呰绂佺敤鐨勬儏鍐� + littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) == null; //鏌ヨ灏忎簬褰撳墠璐т綅娣卞害鐨勯泦鍚堥噷鏄惁鏈夌姸鎬佷笉涓虹┖锛屼笖绂佺敤鐘舵�佷笉涓虹鐢ㄤ互鍙婂彧鍏ョ殑璐т綅锛屽鏋滄槸true锛屽垯琛ㄧず娴呰揣浣嶈浣跨敤鎴栬�呰绂佺敤鐨勬儏鍐� } break; diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpMesHelper.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpMesHelper.cs" index 389b525..36da40e 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpMesHelper.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpMesHelper.cs" @@ -23,14 +23,11 @@ using HttpClient httpClient = new HttpClient(); httpClient.Timeout = new TimeSpan(0, 0, 60); - long currentTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); - string key = $"appkey=1830415116987195392×tamp={currentTimestamp}"; - string authorization = "Open " + GetStr(key); + string authorization = "AppKey 1830415116987195392"; headers = new Dictionary<string, string> { - { "Appkey", "1830415116987195392" }, { "Authorization", authorization }, - { "site_tenant_id", "ced19269-2b83-4577-be43-8cc2f700251e" } + { "Site_tenant_id", "0dc2d164-8a62-417e-8a00-808007464feb" } }; if (headers != null) { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/RootList.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/RootList.cs" new file mode 100644 index 0000000..9ff5822 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/RootList.cs" @@ -0,0 +1,23 @@ +锘縰sing OfficeOpenXml.FormulaParsing.Excel.Functions.Text; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WIDESEA_DTO.MES +{ + public class RootList + { + /// <summary> + /// + /// </summary> + public string From { get; set; } + /// <summary> + /// + /// </summary> + public string DateTime { get; set; } + + public List<TestToolScrap> Content { get; set; } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/TestToolModel.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/TestToolModel.cs" index 3084fa6..93d371f 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/TestToolModel.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/TestToolModel.cs" @@ -35,7 +35,7 @@ /// 娴嬭瘯鏋舵壒娆″彿 /// </summary> [PropertyValidate("娴嬭瘯鏋舵壒娆″彿", NotNullAndEmpty = true)] - public string ToolCode { get; set; } + public List<string> ToolCodes { get; set; } } /// <summary> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs" index c63b33d..6d43109 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs" @@ -24,7 +24,10 @@ WebResponseContent FeedbackInboundOrder(int id); WebResponseContent MaterielGroup(SaveModel saveModel); - //鍏ュ簱瀹屾垚涓婃姤 - WebResponseContent FeedbackInboundOrder(Dt_StockInfo stockInfo); + /// <summary> + /// 鍏ュ簱瀹屾垚涓婃姤 + /// </summary> + /// <returns></returns> + WebResponseContent FeedbackInboundOrder(Dt_StockInfo stockInfo,Dt_InboundOrder inboundOrder); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderService.cs" index add2672..58b2717 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderService.cs" @@ -18,6 +18,6 @@ IOutboundOrderRepository Repository { get; } WebResponseContent ReceiveOutOrder(ErpOutOrderDTO model); - WebResponseContent TestOutUpload(int id); + WebResponseContent TestOutUpload(int id,Dt_StockInfo stockInfo=null); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" index 3963410..6cd6c6d 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" @@ -110,7 +110,7 @@ /// </summary> /// <param name="toolScrap"></param> /// <returns></returns> - MesResponseContent TestScrap(TestToolScrap toolScrap); + MesResponseContent TestScrap(TestToolScrap toolScraps); WebResponseContent IsRelocation(int taskNum, string locationCode); WebResponseContent TestSynStock(TestToolSynInfo toolSynInfo); } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" index 2363716..6f1f954 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" @@ -1,5 +1,6 @@ 锘縰sing AutoMapper; using HslCommunication.WebSocket; +using Newtonsoft.Json; using SqlSugar; using System; using System.Collections.Generic; @@ -152,17 +153,7 @@ { return WebResponseContent.Instance.Error($"鏈壘鍒板叆搴撳崟鏄庣粏淇℃伅"); } - MatSerNumAnalysisModel model = new MatSerNumAnalysisModel() - { - MaterielCode = "504907335", - LotNo = "20241217001", - ProductionDate = "2024-12-17", - EffectiveDate = "2025-12-17", - PurchaseOrderNo = "POHA02241227285", - Quantity = 1, - SerialNumber = "M:504907335,BS:20241217001,DM:2024-12-17,DE:2025-12-17,Q:1,PO:POHA02241227285" - };//娴嬭瘯 - //CodeAnalysisHelper.CodeAnalysis<MatSerNumAnalysisModel>(AnalysisCodeEnum.MatSerNumAnalysis, serNum); + MatSerNumAnalysisModel model = CodeAnalysisHelper.CodeAnalysis<MatSerNumAnalysisModel>(AnalysisCodeEnum.MatSerNumAnalysis, serNum); Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == model.MaterielCode); if (materielInfo == null) { @@ -567,15 +558,97 @@ return WebResponseContent.Instance.Error(ex.Message); } } - public WebResponseContent FeedbackInboundOrder(Dt_StockInfo stockInfo) + /// <summary> + /// 鍏ュ簱瀹屾垚涓婃姤ERP + /// </summary> + /// <returns></returns> + public WebResponseContent FeedbackInboundOrder(Dt_StockInfo stockInfo,Dt_InboundOrder inboundOrder) { WebResponseContent content=new WebResponseContent(); try { - + if (inboundOrder.Details.Count == 0) + { + return WebResponseContent.Instance.Error($"鏈壘鍒板叆搴撳崟鏄庣粏淇℃伅"); + } + if (inboundOrder.OrderStatus == InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt()) + { + return WebResponseContent.Instance.Error($"鍏ュ簱鍗曟嵁宸插畬鎴�"); + } + List<ERPInboundDetailModel> detailModels = new List<ERPInboundDetailModel>(); + Dt_Warehouse warehouse = _warehouseService.Repository.QueryFirst(x => x.WarehouseId == stockInfo.WarehouseId); + if (warehouse == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒颁粨搴撲俊鎭�"); + } + List<Dt_InboundOrderDetail> inboundOrderDetails = new List<Dt_InboundOrderDetail>(); + foreach (var item in stockInfo.Details) + { + Dt_InboundOrderDetail? inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x=>x.RowNo==item.InboundOrderRowNo); + if (inboundOrderDetail == null) + { + continue; + } + ERPInboundDetailModel detailModel = new ERPInboundDetailModel() + { + ExpiryDate = item.EffectiveDate ?? "", + LocationCode = warehouse.WarehouseCode, + MaterialsCode = item.MaterielCode, + MfgDate = item.ProductionDate ?? "", + QtyCustoms = "0", + Quantity = item.StockQuantity.ToString(), + Rack = stockInfo.LocationCode, + ReceiptCode = inboundOrder.UpperOrderNo, + ReceiptSerNo = item.InboundOrderRowNo.ToString() + }; + inboundOrderDetail.OverInQuantity += detailModel.Quantity.ObjToInt(); + if (inboundOrderDetail.OverInQuantity== inboundOrderDetail.OrderQuantity) + { + inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt(); + } + inboundOrderDetails.Add(inboundOrderDetail); + detailModels.Add(detailModel); + } + ERPInboundModel model = new ERPInboundModel() + { + Code = inboundOrder.InboundOrderNo, + CreatorCode = "TC20082",//娴嬭瘯 + EntDate = inboundOrder.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"), + StockDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + SuppliersId = inboundOrder.SupplierId, + Type = "S", + UniqueTag = inboundOrder.Id.ToString(), + WarehouseCode = warehouse.WarehouseCode, + Way = 1, + Details = detailModels + }; + //鍏ュ簱鏄庣粏鏂板瀹屾垚鏁伴噺 + int newCount = inboundOrderDetails.Select(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count; + //鍏ュ簱鏄庣粏鍘熷畬鎴愭暟閲� + int oldCount = inboundOrder.Details.Select(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count; + string response = _invokeERPService.InvokeInboundOrderApi(model); + ErpRequestContent requestContent = JsonConvert.DeserializeObject<ErpRequestContent>(response); + if (requestContent==null) + { + return WebResponseContent.Instance.Error(); + } + if (requestContent.res==0) + { + return WebResponseContent.Instance.Error(requestContent.Data); + } + _unitOfWorkManage.BeginTran(); + _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetails); + if (inboundOrder.Details.Count == (newCount + oldCount)) + { + inboundOrder.OrderStatus = InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt(); + _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder); + } + _unitOfWorkManage.CommitTran(); + return WebResponseContent.Instance.OK(); } catch (Exception ex) { + _unitOfWorkManage.RollbackTran(); content.Error(ex.Message); } return content; @@ -599,13 +672,9 @@ { return WebResponseContent.Instance.Error($"鏈壘鍒板叆搴撳崟鏄庣粏淇℃伅"); } - if (inboundOrder.OrderStatus != InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt()) + if (inboundOrder.OrderStatus == InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt()) { - return WebResponseContent.Instance.Error($"鍏ュ簱鍗曟嵁鏈畬鎴�"); - } - if (inboundOrder.Details.FirstOrDefault(x => x.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt()) != null) - { - return WebResponseContent.Instance.Error($"鍏ュ簱鏄庣粏鏈畬鎴�"); + return WebResponseContent.Instance.Error($"鍏ュ簱鍗曟嵁宸插畬鎴�"); } List<Dt_StockInfo> stockInfos = Db.Queryable<Dt_StockInfo>().Where(x => x.Details.Any(v => v.OrderNo == inboundOrder.InboundOrderNo)).Includes(x => x.Details).ToList(); @@ -658,9 +727,7 @@ Way = 1, Details = detailModels }; - string response = _invokeERPService.InvokeInboundOrderApi(model); - return WebResponseContent.Instance.OK(); } catch (Exception ex) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/ReceiveOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/ReceiveOrderService.cs" index 6d593ae..2165c8c 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/ReceiveOrderService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/ReceiveOrderService.cs" @@ -231,7 +231,7 @@ Dt_InboundOrder inboundOrder = new Dt_InboundOrder() { - InboundOrderNo = "TestInboundNo21",//娴嬭瘯 + InboundOrderNo="IN"+DateTime.Now.ToString("yyyyMMddHHmmss"),//娴嬭瘯 UpperOrderNo = receiveOrder.ReceiveOrderNo, CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(), OrderStatus = InOrderStatusEnum.鏈紑濮�.ObjToInt(), @@ -353,7 +353,7 @@ } receiveOrder = new Dt_ReceiveOrder() { - ReceiveOrderNo = "TestReceiveOrderNo21",//娴嬭瘯 + ReceiveOrderNo= "RE"+DateTime.Now.ToString("yyyyMMddHHmmss"),//娴嬭瘯 ReceiveOrderStatus = ReceiveOrderStatusEnum.Receiving.ObjToInt(), CustomerId = "", DeliveryCode = "/", @@ -400,19 +400,19 @@ rowNo += 1; receiveOrderDetails.Add(receiveOrderDetail); - if (materielInfo.IsCheck == WhetherEnum.True) - { - Dt_CheckOrder checkOrder = _mapper.Map<Dt_CheckOrder>(receiveOrderDetail); - checkOrder.CheckOrderNo = "Test-CheckNo1";//娴嬭瘯 - checkOrder.QualifiedQuantity = receiveOrderDetail.ReceivedQuantity; - checkOrder.ScrappedQuantity = 0; - checkOrder.ReceiveOrderNo = receiveOrder.ReceiveOrderNo; - checkOrder.ReturnQuantity = 0; - checkOrder.DefectedQuantity = 0; - checkOrder.ReceiveDetailRowNo = rowNo; - checkOrder.UploadStatus = CheckUploadEnum.UploadNo.ObjToInt(); - checkOrders.Add(checkOrder); - } + //if (materielInfo.IsCheck == WhetherEnum.True) + //{ + // Dt_CheckOrder checkOrder = _mapper.Map<Dt_CheckOrder>(receiveOrderDetail); + // checkOrder.CheckOrderNo = "Test-CheckNo1";//娴嬭瘯 + // checkOrder.QualifiedQuantity = receiveOrderDetail.ReceivedQuantity; + // checkOrder.ScrappedQuantity = 0; + // checkOrder.ReceiveOrderNo = receiveOrder.ReceiveOrderNo; + // checkOrder.ReturnQuantity = 0; + // checkOrder.DefectedQuantity = 0; + // checkOrder.ReceiveDetailRowNo = rowNo; + // checkOrder.UploadStatus = CheckUploadEnum.UploadNo.ObjToInt(); + // checkOrders.Add(checkOrder); + //} } } @@ -429,10 +429,10 @@ Db.InsertNav(receiveOrder).Include(x => x.Details).ExecuteCommand(); checkOrders.ForEach(x => x.ReceiveOrderNo = receiveOrder.ReceiveOrderNo); } - if (checkOrders.Count > 0) - { - _checkOrderRepository.AddData(checkOrders); - } + //if (checkOrders.Count > 0) + //{ + // _checkOrderRepository.AddData(checkOrders); + //} _inboundRepository.PurchaseOrderRepository.UpdateData(purchaseOrder); _inboundRepository.PurchaseOrderDetailRepository.UpdateData(purchaseOrder.Details); _unitOfWorkManage.CommitTran(); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Record/Dt_StockQuantityChangeRecord.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Record/Dt_StockQuantityChangeRecord.cs" index e6b74e1..269dbae 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Record/Dt_StockQuantityChangeRecord.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Record/Dt_StockQuantityChangeRecord.cs" @@ -47,7 +47,7 @@ /// <summary> /// 鎵规鍙� /// </summary> - [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "鎵规鍙�")] + [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "鎵规鍙�")] public string BatchNo { get; set; } /// <summary> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs" index 026f877..213cd49 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs" @@ -171,50 +171,101 @@ return WebResponseContent.Instance.Error(ex.Message); } } - //涓婃姤鍑哄簱瀹屾垚 娴嬭瘯鏋� - public WebResponseContent TestOutUpload(int id) + //涓婃姤鍑哄簱瀹屾垚 + public WebResponseContent TestOutUpload(int id,Dt_StockInfo stockInfo) { try { Dt_OutboundOrder outboundOrder = Db.Queryable<Dt_OutboundOrder>().Where(x=>x.Id==id).Includes(x=>x.Details).First(); Dt_Warehouse warehouse = _basicService.WarehouseService.Repository.QueryFirst(x => x.WarehouseId == outboundOrder.WarehouseId); //娴嬭瘯鏋跺簱缁橢RP涓婃姤鍑哄簱瀹屾垚 - ERPPickItemModel eRPOutPick = new ERPPickItemModel() + ERPIssueModel issueModel = new ERPIssueModel(); + List<Dt_StockInfo> stockInfos = new List<Dt_StockInfo>(); + if (stockInfo==null) { - Lotno = "20241227001", - Qty = "1", - Location = warehouse.WarehouseCode - }; - ERPPickModel pickModel = new ERPPickModel() + stockInfos = TestOutStocksUpdate(warehouse).Data as List<Dt_StockInfo> ?? new List<Dt_StockInfo>(); + List<ERPPickItemModel> eRPOutPick =new List<ERPPickItemModel>(); + for (int i = 0; i < stockInfos.Count; i++) + { + ERPPickItemModel pickItemModel = new ERPPickItemModel() + { + Lotno= stockInfos[i].Details[0].BatchNo, + Qty= stockInfos[i].Details[0].StockQuantity.ObjToInt().ToString(), + Location= warehouse.WarehouseCode + }; + eRPOutPick.Add(pickItemModel); + } + + ERPPickModel pickModel = new ERPPickModel() + { + Rowindex = outboundOrder.Details[0].RowNo, + Material = outboundOrder.Details[0].MaterielCode, + Qty = (outboundOrder.Details[0].OrderQuantity.ObjToInt()).ToString(), + Dataitem = eRPOutPick + }; + + ERPIssueItemModel issueItemModel = new ERPIssueItemModel() + { + Pickcode = outboundOrder.UpperOrderNo, + PickList = new List<ERPPickModel>() { pickModel } + }; + issueModel = new ERPIssueModel() + { + UniqueTag = id.ToString(), + Code = "OT" + DateTime.Now.ToString("yyyyMMddHHmmss"),//娴嬭瘯 + WarehouseCode = warehouse.WarehouseCode, + Docremark = "", + Deptno = outboundOrder.DepartmentCode, + Deptname = outboundOrder.DepartmentName, + Createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + Createuser = "TC20082", + Issitem = new List<ERPIssueItemModel>() { issueItemModel }, + }; + } + else { - Rowindex = outboundOrder.Details[0].RowNo, - Material = outboundOrder.Details[0].MaterielCode, - Qty = (outboundOrder.Details[0].OrderQuantity.ObjToInt()).ToString(), - Dataitem=new List<ERPPickItemModel> { eRPOutPick } - }; + Dt_OutboundOrderDetail orderDetail = outboundOrder.Details.FirstOrDefault(x => x.MaterielCode == stockInfo.Details[0].MaterielCode); + + ERPPickItemModel pickItemModel = new ERPPickItemModel() + { + Lotno = stockInfo.Details[0].BatchNo, + Qty = stockInfo.Details[0].StockQuantity.ObjToInt().ToString(), + Location = stockInfo.LocationCode + }; + ERPPickModel pickModel = new ERPPickModel() + { + Rowindex = outboundOrder.Details[0].RowNo, + Material = outboundOrder.Details[0].MaterielCode, + Qty = (outboundOrder.Details[0].OrderQuantity.ObjToInt()).ToString(), + Dataitem = new List<ERPPickItemModel> { pickItemModel } + }; + ERPIssueItemModel issueItemModel = new ERPIssueItemModel() + { + Pickcode = outboundOrder.UpperOrderNo, + PickList = new List<ERPPickModel>() { pickModel } + }; + issueModel = new ERPIssueModel() + { + UniqueTag = id.ToString(), + Code = "OT" + DateTime.Now.ToString("yyyyMMddHHmmss"),//娴嬭瘯 + WarehouseCode = warehouse.WarehouseCode, + Docremark = "", + Deptno = outboundOrder.DepartmentCode, + Deptname = outboundOrder.DepartmentName, + Createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + Createuser = "TC20082", + Issitem = new List<ERPIssueItemModel>() { issueItemModel }, + }; + } - ERPIssueItemModel issueItemModel = new ERPIssueItemModel() - { - Pickcode = outboundOrder.UpperOrderNo, - PickList = new List<ERPPickModel>() { pickModel } - }; - ERPIssueModel issueModel = new ERPIssueModel() - { - UniqueTag = id.ToString(), - Code = "FL20241227001",//娴嬭瘯 - WarehouseCode = warehouse.WarehouseCode, - Docremark = "", - Deptno = outboundOrder.DepartmentCode, - Deptname = outboundOrder.DepartmentName, - Createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), - Createuser = "TC20082", - Issitem = new List<ERPIssueItemModel>() { issueItemModel }, - }; string response = _invokeERPService.InvokeOutStandardsApi(issueModel); ErpRequestContent requestContent = response.DeserializeObject<ErpRequestContent>(); if (requestContent.res == 1) { - + if (stockInfos.Count>0) + { + _stockInfoRepository.UpdateData(stockInfos); + } return WebResponseContent.Instance.OK(requestContent.Data); } else @@ -233,15 +284,15 @@ /// <param name="warehouse"></param> /// <param name="model"></param> /// <returns></returns> - public WebResponseContent TestOutStocksUpdate(Dt_Warehouse warehouse, ErpOutOrderDTO model) + public WebResponseContent TestOutStocksUpdate(Dt_Warehouse warehouse) { try { //鑾峰彇鍑哄簱鍗曞簱瀛� List<Dt_StockInfo> stockInfos = _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.WarehouseId == warehouse.WarehouseId).Includes(x => x.Details).ToList(); - if (model.Qty > stockInfos.Count) + if (stockInfos.Count<=0) { - return WebResponseContent.Instance.Error($"鐗╂枡:{model.MCode}搴撳瓨涓嶈冻"); + return WebResponseContent.Instance.Error($"搴撳瓨涓嶈冻"); } //鏇存敼鐘舵�� stockInfos.ForEach(x => @@ -255,33 +306,5 @@ return WebResponseContent.Instance.Error(ex.Message); } } - ///鎺ㄩ�佹祴璇曟灦鍑哄簱 - //public WebResponseContent TestOutBack(int id,List<string> locationIds) - //{ - // try - // { - - // string response = _invokeERPService.InvokeOutStandardsApi(issueModel); - // ErpRequestContent requestContent = response.DeserializeObject<ErpRequestContent>(); - // if (requestContent.res == 1) - // { - - // return WebResponseContent.Instance.OK(requestContent.Data); - // } - // else - // { - // return WebResponseContent.Instance.Error(requestContent.Data); - // } - // } - // catch (Exception ex) - // { - // return WebResponseContent.Instance.Error(ex.Message); - // } - //} - - //public WebResponseContent FeedbackOutbondIssue(List<Dt_OutStockLockInfo> outStockLockInfos) - //{ - // ERPPickItemModel - //} } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" index a5e1ad6..ddda47e 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" @@ -75,6 +75,12 @@ stockInfo.StockStatus = (int)StockStatusEmun.鍑哄簱閿佸畾; LocationStatusEnum locationStatus = (LocationStatusEnum)locationInfo.LocationStatus; locationInfo.LocationStatus = (int)LocationStatusEnum.Lock; + //灏嗕换鍔℃帹閫佸埌WCS + WebResponseContent content = PushTasksToWCS(new List<Dt_Task>() { taskOut }, "AGV"); + if (!content.Status) + { + return responseContent.Error(); + } //鍒ゆ柇鏄惁鏈夊嚭搴撳崟淇℃伅 _unitOfWorkManage.BeginTran(); //鏇存柊搴撳瓨鐘舵�� @@ -88,8 +94,6 @@ //鍔犲叆搴撳瓨鍙樺姩璁板綍 //_recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfoDetails, beforeQuantity, totalQuantity, StockChangeTypeEnum.StockLock); _unitOfWorkManage.CommitTran(); - //灏嗕换鍔℃帹閫佸埌WCS - PushTasksToWCS(new List<Dt_Task>() { taskOut }, "AGV"); responseContent.OK(); } catch (Exception ex) @@ -137,9 +141,14 @@ }; //鏇存敼搴撳瓨鐘舵�� stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); - //灏嗕换鍔℃帹閫佸埌WCS - PushTasksToWCS(new List<Dt_Task>() { taskIn }, "AGV"); + BaseDal.AddData(taskIn); _stockRepository.StockInfoRepository.UpdateData(stockInfo); + //灏嗕换鍔℃帹閫佸埌WCS + WebResponseContent content = PushTasksToWCS(new List<Dt_Task>() { taskIn }, "AGV"); ; + if (!content.Status) + { + return responseContent.Error(); + } responseContent.OK(); } catch (Exception ex) @@ -153,7 +162,7 @@ /// 娴嬭瘯鏋舵姤搴� /// </summary> /// <returns></returns> - public MesResponseContent TestScrap(TestToolScrap toolScrap) + public MesResponseContent TestScrap(TestToolScrap toolScraps) { MesResponseContent responseContent = new MesResponseContent(); try @@ -161,21 +170,25 @@ //鑾峰彇娴嬭瘯鏋舵壒娆″彿搴撳瓨 Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA64.ToString()); //鑾峰彇搴撳瓨璁板綍 - //鑾峰彇搴撳瓨璁板綍 List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.WarehouseId == warehouse.WarehouseId && x.StockStatus == (int)StockStatusEmun.鍑哄簱瀹屾垚).Includes(x => x.Details).ToList(); - Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.BatchNo == toolScrap.ToolCode)); - - if (stockInfo == null) + List<Dt_StockInfo> stockInfoUpdates = new List<Dt_StockInfo>(); + List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>(); + foreach (var item in toolScraps.ToolCodes) { - return responseContent.Error($"{toolScrap.ToolCode}搴撳瓨淇℃伅涓嶅瓨鍦�"); + Dt_StockInfo stockInfo = stockInfos.Find(x => x.Details.Any(x => x.BatchNo == item)); + if (stockInfo == null) + { + return responseContent.Error($"{item}搴撳瓨淇℃伅涓嶅瓨鍦�"); + } + stockInfoUpdates.Add(stockInfo); } //娓呴櫎搴撳瓨淇℃伅 _unitOfWorkManage.BeginTran(); - _stockRepository.StockInfoRepository.DeleteAndMoveIntoHty(stockInfo,OperateTypeEnum.鑷姩鍒犻櫎); - _stockRepository.StockInfoDetailRepository.DeleteAndMoveIntoHty(stockInfo.Details, OperateTypeEnum.鑷姩鍒犻櫎); + _stockRepository.StockInfoRepository.DeleteAndMoveIntoHty(stockInfoUpdates, OperateTypeEnum.鑷姩鍒犻櫎); _unitOfWorkManage.CommitTran(); + responseContent.OK($"鎶ュ簾鎴愬姛"); } catch (Exception ex) { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" index 607c8f4..a5bbf26 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" @@ -64,6 +64,7 @@ private readonly IApiInfoRepository _apiInfoRepository; private readonly IInvokeERPService _invokeERPService; private readonly IInboundRepository _inboundRepository; + private readonly IInboundOrderService _inboundOrderService; public ITaskRepository Repository => BaseDal; @@ -77,7 +78,7 @@ public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList(); - public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IStockRepository stockRepository, IBasicService basicService, IRecordService recordService, IOutboundService outboundService, IStockService stockService, IBasicRepository basicRepository, IApiInfoRepository apiInfoRepository, IInvokeERPService invokeERPService, IInboundRepository inboundRepository) : base(BaseDal) + public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IStockRepository stockRepository, IBasicService basicService, IRecordService recordService, IOutboundService outboundService, IStockService stockService, IBasicRepository basicRepository, IApiInfoRepository apiInfoRepository, IInvokeERPService invokeERPService, IInboundRepository inboundRepository, IInboundOrderService inboundOrderService) : base(BaseDal) { _mapper = mapper; _unitOfWorkManage = unitOfWorkManage; @@ -90,6 +91,7 @@ _apiInfoRepository = apiInfoRepository; _invokeERPService = invokeERPService; _inboundRepository = inboundRepository; + _inboundOrderService = inboundOrderService; } /// <summary> @@ -130,10 +132,10 @@ return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅"); } - if (task.TaskType != TaskTypeEnum.Inbound.ObjToInt()) - { - return WebResponseContent.Instance.Error($"浠诲姟绫诲瀷閿欒"); - } + //if (task.TaskType != TaskTypeEnum.Inbound.ObjToInt()) + //{ + // return WebResponseContent.Instance.Error($"浠诲姟绫诲瀷閿欒"); + //} Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode && x.WarehouseId==task.WarehouseId).Includes(x => x.Details).First(); if (stockInfo == null) @@ -181,12 +183,15 @@ }); stockInfo.LocationCode = locationInfo.LocationCode; //鎺ㄩ�佸叆搴撳畬鎴愮粰Erp - //鑾峰彇鍏ュ簱鍗曟洿鏂板叆搴撳崟 - //Dt_InboundOrder inboundOrder = _inboundRepository.InboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x=>x.InboundOrderNo); - if (true) + Dt_InboundOrder? inboundOrder = _inboundRepository.InboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == stockInfo.Details.FirstOrDefault().OrderNo).Includes(x=>x.Details).First(); + if (inboundOrder == null) { - + return WebResponseContent.Instance.Error($"瀵瑰簲鍏ュ簱鍗曚笉瀛樺湪"); } + if (!_inboundOrderService.FeedbackInboundOrder(stockInfo, inboundOrder).Status) + { + return WebResponseContent.Instance.Error($"鍏ュ簱鍚屾Erp澶辫触"); + } _unitOfWorkManage.BeginTran(); BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.浜哄伐瀹屾垚 : OperateTypeEnum.鑷姩瀹屾垚); _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId); @@ -230,9 +235,10 @@ { return WebResponseContent.Instance.Error($"鏈壘鍒拌揣浣嶄俊鎭�"); } - + Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseId== task.WarehouseId); List<Dt_OutStockLockInfo> outStockLockInfos = _outboundService.OutboundStockLockInfoService.Repository.QueryData(x => x.TaskNum == taskNum); - if (outStockLockInfos == null || outStockLockInfos.Count == 0) + + if ((outStockLockInfos == null || outStockLockInfos.Count == 0) && warehouse.WarehouseCode != WarehouseEnum.HA64.ToString()) { return WebResponseContent.Instance.Error($"鏈壘鍒板嚭搴撹鎯呬俊鎭�"); } @@ -251,14 +257,23 @@ outboundOrderDetails.Add(outboundOrderDetail); } } - + if (warehouse.WarehouseCode != WarehouseEnum.HA64.ToString()) + { + //鎺ㄩ�佸嚭搴撳畬鎴� + WebResponseContent webResponse = _outboundService.OutboundOrderService.TestOutUpload(outboundOrderDetails.FirstOrDefault().Id,stockInfo); + if (!webResponse.Status) + { + return webResponse; + } + } _unitOfWorkManage.BeginTran(); - _outboundService.OutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails); - + if (outboundOrderDetails.Count>0) + { + _outboundService.OutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails); + } stockInfo.LocationCode = locationInfo.LocationCode; stockInfo.StockStatus = StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt(); _stockService.StockInfoService.Repository.UpdateData(stockInfo); - int beforeStatus = locationInfo.LocationStatus; locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.Free, stockInfo.WarehouseId); @@ -266,7 +281,8 @@ _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, (LocationStatusEnum)beforeStatus, LocationChangeType.OutboundCompleted, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); _unitOfWorkManage.CommitTran(); - //鎺ㄩ�佸嚭搴撳畬鎴� + + return WebResponseContent.Instance.OK(); } catch (Exception ex) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/PDAController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/PDAController.cs" index 3747638..ad7c944 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/PDAController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/PDAController.cs" @@ -29,14 +29,18 @@ _taskService = taskService; } + /// <summary> + /// 涓嬭浇PDA + /// </summary> + /// <returns></returns> [HttpPost, HttpGet, Route("DownLoadApp"), AllowAnonymous] public virtual ActionResult DownLoadApp() { string path = $"{AppDomain.CurrentDomain.BaseDirectory}Upload/App/"; if (!Directory.Exists(path)) Directory.CreateDirectory(path); path += "WMS-PDA.apk"; - - if(System.IO.File.Exists(path)) + + if (System.IO.File.Exists(path)) { byte[] fileBytes = System.IO.File.ReadAllBytes(path); return File( @@ -49,9 +53,14 @@ { return Json(WebResponseContent.Instance.Error($"鏈壘鍒板畨瑁呭寘")); } - + } + /// <summary> + /// 涓婁紶PDA + /// </summary> + /// <param name="fileInput"></param> + /// <returns></returns> [HttpPost, HttpGet, Route("UploadApp"), AllowAnonymous] [Consumes("multipart/form-data")] public WebResponseContent UploadApp(IEnumerable<IFormFile> fileInput) @@ -66,7 +75,8 @@ if (!Directory.Exists(dicPath)) Directory.CreateDirectory(dicPath); string path = $"{dicPath}WMS-PDA{DateTime.Now:yyyyMMddhhmmss}.apk"; dicPath = $"{dicPath}WMS-PDA.apk"; - System.IO.File.Move(dicPath, path); + if (System.IO.File.Exists(dicPath)) + System.IO.File.Move(dicPath, path); using (var stream = new FileStream(dicPath, FileMode.Create)) { -- Gitblit v1.9.3