From 8dbe04f7807d7a4540910552a3db7d7d9008c488 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周二, 20 5月 2025 14:30:50 +0800
Subject: [PATCH] Merge branch 'master' of http://222.71.245.114:9086/r/HIA24016N_PipeLineDemo
---
PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs | 186 ++++++++++++++++++++++++++++++++--------------
1 files changed, 130 insertions(+), 56 deletions(-)
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 ff26b90..f681023 100644
--- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs
+++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs
@@ -1,37 +1,31 @@
+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.Dtos.WorkTask;
+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 CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsMaterialStocks;
+using CmsQueryExtensions.Entitys;
+using CmsQueryExtensions.Extension;
+using KissUtil.Extensions;
+using Microsoft.Extensions.DependencyInjection;
+using Newtonsoft.Json;
+using Volo.Abp;
+using Volo.Abp.ObjectMapping;
+using Volo.Abp.Uow;
namespace CMS.Plugin.PipeLineLems.Application.Implements;
@@ -50,6 +44,10 @@
/// <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("璇疯緭鍏ョ娈电紪鐮�");
@@ -111,13 +109,19 @@
});
}
//鐗╂枡鍙傛暟鍒楄〃
- 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
{
+ //棣栧厛鍒ゆ柇搴撳瓨鏄惁瀛樺湪
+ var dto = await IsExistInWms(input.PipeSpecCode);
+ if (dto != null)
+ {
+ throw new UserFriendlyException($"宸茬粡鍒嗘嫞杩囷紝搴撳瓨鍦ㄥ簱浣峽dto.PlaceNo},鎵樼洏鍙穥dto.ContainerNo}");
+ }
+
+
WmsMaterialStockCreateDto param = new WmsMaterialStockCreateDto()
{
ContainerNo = input.ContinerNo,
@@ -126,7 +130,9 @@
StockNumber = 1,
MaterialBatch = callMaterialOrder.MaterialBatch,
- RedundantField1 = firstWorkPlan.ProcessRouteNumber //鎵╁睍瀛楁鏄剧ず 宸ヨ壓娴佸悜缂栧彿
+ RedundantField1 = firstWorkPlan.ProcessRouteNumber, //鎵╁睍瀛楁鏄剧ず 宸ヨ壓娴佸悜缂栧彿
+ RedundantField2 = firstWorkPlan.PipeSpecCode, //鎵╁睍瀛楁鏄剧ず 绠℃缂栫爜
+ RedundantField3 = firstWorkPlan.PipeSectionName, //鎵╁睍瀛楁鏄剧ず 绠℃鍚嶇О
};
string baseUrl = @"http://127.0.0.1:18000/api/v1/HIAWms/";
@@ -262,6 +268,7 @@
};
return response;
}
+
/// <summary>
/// 鍒涘缓浣滀笟璁″垝
/// </summary>
@@ -270,7 +277,6 @@
/// <param name="workPlanAppService"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
-
public async Task<MesOrderResponse> CommonCreatebyApsAsync(List<WorkPlanInput> input, IServiceProvider _serviceProvider,
WorkPlanAppService workPlanAppService,
string userId, string userAccount
@@ -310,6 +316,8 @@
var orderManager = _serviceProvider.GetRequiredService<IOrderManager>();
var productProvider = _serviceProvider.GetRequiredService<IProductProvider>();
var formulaProvider = _serviceProvider.GetRequiredService<IFormulaProvider>();
+
+ var workTaskAppService = _serviceProvider.GetRequiredService<IWorkTaskAppService>();
List<OrderModel> orderModels = new List<OrderModel>();
@@ -447,16 +455,36 @@
insertObj.CreatorName = userAccount;
insertObj.Remark = "绯荤粺瀵煎叆";
await workPlanAppService.CreateAsync(insertObj);
+
+ //澧炲姞鏂板璁″垝浠诲姟琛ㄦ暟鎹� 銆怑ditby shaocx,2025-05-20銆�
+ var org_insertTaskObj = ObjectMapper.Map<WorkPlanCreateDto, WorkTaskCreateDto>(insertObj);
+ org_insertTaskObj.Son_TaskCode = insertObj.TaskCode;
+ await workTaskAppService.CreateAsync(org_insertTaskObj);
+ if (insertObj.ProcessName == "鍒囧壊宸ュ簭")
+ {//鏂板缓 鍒嗘嫞宸ュ簭
+ var insertTaskObj = ObjectMapper.Map<WorkPlanCreateDto, WorkTaskCreateDto>(insertObj);
+ insertTaskObj.Son_TaskCode = insertObj.TaskCode + "_1";
+ insertTaskObj.ProcessName = "鍒嗘嫞宸ュ簭";
+ await workTaskAppService.CreateAsync(insertTaskObj);
+ }
+ else if (insertObj.ProcessName == "瑁呴厤宸ュ簭")
+ {//鏂板缓 娉曞叞鍐茬爜宸ュ簭(澶氫釜)
+ //鐩墠鏆傛椂鎼炴垚涓�涓硶鍏�
+ var insertTaskObj = ObjectMapper.Map<WorkPlanCreateDto, WorkTaskCreateDto>(insertObj);
+ insertTaskObj.Son_TaskCode = insertObj.TaskCode + "_1";
+ insertTaskObj.ProcessName = "娉曞叞鍐茬爜宸ュ簭";
+ await workTaskAppService.CreateAsync(insertTaskObj);
+ }
}
#endregion
await uow.CompleteAsync();
}
- catch (Exception)
+ catch (Exception ex)
{
await uow.RollbackAsync();
- throw;
+ throw ex;
}
finally
{
@@ -565,6 +593,7 @@
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)
{
@@ -577,6 +606,7 @@
{
throw new UserFriendlyException(res.Message);
}
+ //*/
}
catch (Exception)
{
@@ -1085,33 +1115,34 @@
WorkPlanDto workPlanDto = await _workPlanAppService.FindSingleByFilterAsync(input);
- //TODO:杩欓噷璋冪敤wms鐨勫彨鏂欐帴鍙�
+ //TODO:杩欓噷璋冪敤wms鐨勫簱瀛樻煡璇㈡帴鍙�
try
{
- List<LMesCallMaterialInput> param = new List<LMesCallMaterialInput>() {
- new LMesCallMaterialInput(){
+ 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/LMesCallMaterial";
+ string url = baseUrl + "LMesOperate/FindListByFilter";
string json = JsonConvert.SerializeObject(param);
var result = HttpApiRequest.HttpPost(url, json);
- var res = JsonConvert.DeserializeObject<CmsApiResponse<List<MyCallMaterialOutput>>>(result);
+ var res = JsonConvert.DeserializeObject<CmsApiResponse<List<WmsMaterialStockDto>>>(result);
if (res.Code == 200)
{
- var retData = res.Data;
- //callMaterialOrder.MaterialBatch = retData[0].MaterialBatch;
- //callMaterialOrder.WmsTaskNo = retData[0].TaskNo;
- //callMaterialOrder.WmsRetResult = res.Message;
-
+ 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>
{
@@ -1125,24 +1156,67 @@
else
{
throw new UserFriendlyException(res.Message);
- }
+ };
//*/
//妯℃嫙
- var data = new PickOutput()
+ //var data = new PickOutput()
+ //{
+ // WorkPlan = workPlanDto,
+ // PlaceNo = "",//寰呰祴鍊�
+ // ContinerNo = ""//寰呰祴鍊�
+ //};
+ //var response = new CmsApiResponse<PickOutput>
+ //{
+ // Code = 200,
+ // Data = data,
+ // Message = "澶勭悊鎴愬姛",
+ //};
+ //return response;
+
+ }
+ catch (Exception)
+ {
+
+ throw;
+ }
+ }
+
+ /// <summary>
+ /// 绠℃缂栫爜鏄惁瀛樺湪搴撳瓨涓�
+ /// </summary>
+ /// <param name="pipeSpecCode"></param>
+ /// <returns></returns>
+ /// <exception cref="UserFriendlyException"></exception>
+ public async Task<WmsMaterialStockDto> IsExistInWms(string pipeSpecCode)
+ {
+ //TODO:杩欓噷璋冪敤wms鐨勫簱瀛樻煡璇㈡帴鍙�
+ try
+ {
+ GetWmsMaterialStockInput param = new GetWmsMaterialStockInput()
{
- WorkPlan = workPlanDto,
- PlaceNo = "",//寰呰祴鍊�
- ContinerNo = ""//寰呰祴鍊�
+ RedundantField2 = pipeSpecCode,
+ RedundantField2_FilterMode = SearchFilterModeEnum.绮惧噯鏌ヨ
};
- var response = new CmsApiResponse<PickOutput>
+ 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)
{
- Code = 200,
- Data = data,
- Message = "澶勭悊鎴愬姛",
- };
- return response;
+ var retData = res.Data as List<WmsMaterialStockDto>;
+ if (retData?.Count > 0)
+ {
+ return retData.First();
+ }
+ return null;
+ }
+ else
+ {
+ throw new UserFriendlyException(res.Message);
+ };
}
catch (Exception)
{
--
Gitblit v1.9.3