1.车间管理调整为异步

2.明确生产制造的部署模式为单账套部署,多账套采用多服务的形式部署
This commit is contained in:
qmj
2025-07-23 08:57:44 +08:00
parent 1141095898
commit b8a9595cc1
12 changed files with 395 additions and 191 deletions
+1 -17
View File
@@ -599,22 +599,6 @@
<param name="input">报文数据</param>
<returns></returns>
</member>
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.APController.AP48Save(System.String,System.Collections.Generic.Dictionary{System.String,System.Object})">
<summary>
收款单保存
</summary>
<param name="cAccId"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.APController.AP49Save(System.String,System.Collections.Generic.Dictionary{System.String,System.Object})">
<summary>
收款单保存
</summary>
<param name="cAccId"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.APController.ApNote_Save(System.String,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.String,System.Boolean)">
<summary>
票据保存
@@ -862,7 +846,7 @@
车间管理
</summary>
</member>
<member name="F:UFIDA.U8.Framework.Api.Controllers.U8.SFCController.logInfo">
<member name="F:UFIDA.U8.Framework.Api.Controllers.U8.SFCController._logInfo">
<summary>
日志组件
</summary>
@@ -0,0 +1,21 @@
{
"MoId": 1000000001, //生产订单id
"MoDId": 1000000001, //生产订单明细id
"MoCode": "000000001", //生产订单号
"WcId": "", //工作中心id
"MoSeq": 1, //生产订单行号
"Body": [
{
"cPersonCode": "", //人员编码
"cTeamCode": "", //班组编码
"dDate": "2025-07-22", //报工日期
"Qualifiedqty": 1, //合格数量
"MoRoutingId": 1000000001, //生产订单工艺路线id
"MoRoutingDId": 1000000001, //生产订单工艺路线明细id
"MoId": 1000000001, //生产订单id
"MoDId": 1000000001, //生产订单明细id
"MoCode": "000000001", //生产订单号
"MoSeq": 1 //生产订单行号
}
]
}
@@ -37,7 +37,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
/// <param name="bNeedBillClosed"></param>
/// <returns></returns>
[HttpPost]
[Route("api/U8/{cSubId}/{cCardNum}/Save")]
//[Route("api/U8/{cSubId}/{cCardNum}/Save")]
public async Task<BaseResult<string>> Save(string cAccId, string cCardNum, string cSubId, [FromBody] Dictionary<string, object> input, string busDate="", bool bNeedBillClosed = false)
{
try
@@ -74,8 +74,8 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
/// <param name="input">报文数据</param>
/// <returns></returns>
[HttpPost]
[Route("api/U8/AP/{cCardNum}/CloseBillSave")]
[Route("api/U8/AR/{cCardNum}/CloseBillSave")]
//[Route("api/U8/AP/{cCardNum}/CloseBillSave")]
//[Route("api/U8/AR/{cCardNum}/CloseBillSave")]
public async Task<BaseResult<string>> CloseBillSave(string cAccId, string cCardNum, [FromBody] Dictionary<string, object> input)
{
try
@@ -130,33 +130,33 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
}
/// <summary>
/// 收款单保存
/// </summary>
/// <param name="cAccId"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("api/U8/AR/AP48/Save")]
[Route("api/U8/AR/AP49/Save")]
public async Task<BaseResult<string>> AP48Save(string cAccId, [FromBody] Dictionary<string, object> input)
{
return await CloseBillSave(cAccId, "AP48", input);
}
///// <summary>
///// 收款单保存
///// </summary>
///// <param name="cAccId"></param>
///// <param name="input"></param>
///// <returns></returns>
//[HttpPost]
//[Route("api/U8/AR/AP48/Save")]
//[Route("api/U8/AR/AP49/Save")]
//public async Task<BaseResult<string>> AP48Save(string cAccId, [FromBody] Dictionary<string, object> input)
//{
// return await CloseBillSave(cAccId, "AP48", input);
//}
/// <summary>
/// 收款单保存
/// </summary>
/// <param name="cAccId"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("api/U8/AP/AP49/Save")]
[Route("api/U8/AP/AP49/Save")]
public async Task<BaseResult<string>> AP49Save(string cAccId, [FromBody] Dictionary<string, object> input)
{
return await CloseBillSave(cAccId, "AP49", input);
}
///// <summary>
///// 收款单保存
///// </summary>
///// <param name="cAccId"></param>
///// <param name="input"></param>
///// <returns></returns>
//[HttpPost]
//[Route("api/U8/AP/AP49/Save")]
//[Route("api/U8/AP/AP49/Save")]
//public async Task<BaseResult<string>> AP49Save(string cAccId, [FromBody] Dictionary<string, object> input)
//{
// return await CloseBillSave(cAccId, "AP49", input);
//}
/// <summary>
/// 票据保存
@@ -10,6 +10,7 @@ using UFIDA.U8.Framework.Api.ControlObject.U8M;
using UFIDA.U8.Framework.Api.Unit;
using UFIDA.U8.Framework.Api.Models;
using Convert = System.Convert;
using SqlSugar;
// ReSharper disable InconsistentNaming
// ReSharper disable IdentifierTypo
@@ -25,7 +26,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
/// <summary>
/// 日志组件
/// </summary>
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
protected readonly ILog _logInfo = LogManager.GetLogger("logInfo");
private static readonly MemoryCache _cache = new MemoryCache(new MemoryCacheOptions { ExpirationScanFrequency = TimeSpan.FromMinutes(10) });
@@ -42,17 +43,55 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
{
//var taskId = 0L;
var db = CommUnit.GetDbClient();
BaseLogin baseLogin=null;
try
{
logInfo.Debug($"接口标识:MoRoutingBillSave,系统号:{cAccId},单据类型编码:{cCardNum},报文数据:{input.ToJson()}");
var db = CommUnit.GetDbClient();
var workId = SnowFlakeSingle.Instance.NextId();
_logInfo.Debug($"作业Id:{workId}-----接口标识:MoRoutingBillSave,系统号:{cAccId},单据类型编码:{cCardNum},报文数据:{input.ToJson()}");
if (cCardNum != "FC90" && cCardNum != "FC91" && cCardNum != "FC92")
throw new Exception("当前接口不支持此类型的单据");
if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin))
{
_logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
baseLogin = new BaseLogin();
var param = await CommUnit.GetLoginParamter(cAccId);
if (param == null)
{
throw new Exception("未能加载指定系统号的登录信息");
}
baseLogin.Init(param);
try
{
_cache.Remove($"U8_{cAccId}");
}
catch
{
_logInfo.Debug($"不存在[U8_{cAccId}]的缓存");
}
_cache.Set($"U8_{cAccId}", baseLogin);
}
if (baseLogin == null)
{
throw new Exception("登录对象加载失败");
}
if (!baseLogin.CheckCallar())
{
baseLogin.RefreshCallar(baseLogin.userToken);
}
//var runtimes = 0;
//var u8mTask = new SysU8MTask()
@@ -60,30 +99,30 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
// U8MPool = $"U8M_{cAccId}"
//};
//#if !DEBUG
// while (await db.Queryable<SysU8MTask>().AnyAsync())
// {
// if (runtimes > 20)
// {
// throw new Exception("当前任务队列过长");
// }
//#if !DEBUG
// while (await db.Queryable<SysU8MTask>().AnyAsync())
// {
// if (runtimes > 20)
// {
// throw new Exception("当前任务队列过长");
// }
// runtimes++;
// runtimes++;
// await Task.Delay(100 * runtimes);
// await Task.Delay(100 * runtimes);
// //u8mTask.Id = DateTime.Now.Ticks;
// //u8mTask.Id = DateTime.Now.Ticks;
// if (await db.Queryable<SysU8MTask>()
// .AnyAsync(a => SqlFunc.DateDiff(DateType.Minute, a.dDate, DateTime.Now) > 1))
// {
// await db.Deleteable<SysU8MTask>()
// .Where(a => SqlFunc.DateDiff(DateType.Minute, a.dDate, DateTime.Now) > 1)
// .ExecuteCommandAsync();
// }
// if (await db.Queryable<SysU8MTask>()
// .AnyAsync(a => SqlFunc.DateDiff(DateType.Minute, a.dDate, DateTime.Now) > 1))
// {
// await db.Deleteable<SysU8MTask>()
// .Where(a => SqlFunc.DateDiff(DateType.Minute, a.dDate, DateTime.Now) > 1)
// .ExecuteCommandAsync();
// }
// }
//#endif
// }
//#endif
//u8mTask.dDate = DateTime.Now;
@@ -96,23 +135,23 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
//var taskid = SnowFlakeSingle.Instance.NextId();
//logInfo.Debug($"开始操作,当前任务ID:{taskId}");
//_logInfo.Debug($"开始操作,当前任务ID:{taskId}");
//if (!_cache.TryGetValue($"U8M_{cAccId}", out BaseLogin baseLogin))
//{
// _cache.Clear();
baseLogin = new BaseLogin();
////baseLogin = new BaseLogin();
var param = await CommUnit.GetLoginParamter(cAccId);
////var param = await CommUnit.GetLoginParamter(cAccId);
if (param == null)
{
throw new Exception("未能加载指定系统号的登录信息");
}
////if (param == null)
////{
//// throw new Exception("未能加载指定系统号的登录信息");
////}
logInfo.Debug("开始登录");
////_logInfo.Debug("开始登录");
baseLogin.Init(param,true);
////baseLogin.Init(param,true);
var bo = new MoRoutingBill();
BaseResult<string> res;
@@ -120,11 +159,11 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
{
var inputs = input["inputs"] as List<Dictionary<string, object>> ?? $"{input["inputs"]}".ToObject<List<Dictionary<string, object>>>();
res = bo.Save(cCardNum, inputs);
res =await bo.Save(baseLogin, cCardNum, inputs);
}
else
{
res = bo.Save(cCardNum, input);
res =await bo.Save(baseLogin, cCardNum, input);
}
//loader.Unload();
@@ -140,7 +179,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
//var bf = new MoRoutingBill();
logInfo.Debug($"开始保存");
_logInfo.Debug($"开始保存");
//BaseResult<string> res;
//if (input.ContainsKey("bBatch") && Convert.ToBoolean(input["bBatch"]))
@@ -154,7 +193,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
// res = bf.Save(cCardNum, input);
//}
logInfo.Debug($"退出登录");
_logInfo.Debug($"退出登录");
//baseLogin.ShutDown();
//if (taskId != 0)
@@ -167,7 +206,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
}
catch (Exception ex)
{
logInfo.Error(ex.Message, ex);
_logInfo.Error(ex.Message, ex);
//if (taskId != 0)
//{
@@ -244,7 +283,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
{
try
{
logInfo.Debug($"接口标识:MoRoutingBillDelete,系统号:{cAccId},单据类型编码:{cCardNum},报文数据:{input.ToJson()}");
_logInfo.Debug($"接口标识:MoRoutingBillDelete,系统号:{cAccId},单据类型编码:{cCardNum},报文数据:{input.ToJson()}");
if (cCardNum != "FC90" && cCardNum != "FC91" && cCardNum != "FC92")
throw new Exception("当前接口不支持此类型的单据");
@@ -269,17 +308,17 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
if (input.cVouchCode != null && input.cVouchCode.Count > 0)
{
return bf.Delete(cCardNum, input.cVouchCode);
return await bf.Delete(baseLogin,cCardNum, input.cVouchCode);
}
else
{
return bf.Delete(input.MID);
return await bf.Delete(baseLogin,input.MID);
}
}
catch (Exception ex)
{
logInfo.Error(ex.Message, ex);
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> {bSuccess = false,message = ex.Message,result = ex.StackTrace};
}
@@ -343,7 +382,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
{
try
{
logInfo.Debug($"接口标识:MoRoutingBillVerify,系统号:{cAccId},单据类型编码:{cCardNum},报文数据:{input.ToJson()}");
_logInfo.Debug($"接口标识:MoRoutingBillVerify,系统号:{cAccId},单据类型编码:{cCardNum},报文数据:{input.ToJson()}");
if (cCardNum != "FC90" && cCardNum != "FC91" && cCardNum != "FC92")
throw new Exception("当前接口不支持此类型的单据");
@@ -368,17 +407,17 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
if (input.cVouchCode != null && input.cVouchCode.Count > 0)
{
return bf.Verify(cCardNum, input.cVouchCode);
return await bf.Verify(baseLogin, cCardNum, input.cVouchCode);
}
else
{
return bf.Verify(input.MID);
return await bf.Verify(baseLogin, input.MID);
}
}
catch (Exception ex)
{
logInfo.Error(ex.Message, ex);
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> {bSuccess = false,message = ex.Message,result = ex.StackTrace};
}
@@ -442,7 +481,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
{
try
{
logInfo.Debug($"接口标识:MoRoutingBillUnVerify,系统号:{cAccId},单据类型编码:{cCardNum},报文数据:{input.ToJson()}");
_logInfo.Debug($"接口标识:MoRoutingBillUnVerify,系统号:{cAccId},单据类型编码:{cCardNum},报文数据:{input.ToJson()}");
if (cCardNum != "FC90" && cCardNum != "FC91" && cCardNum != "FC92")
@@ -478,7 +517,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
}
catch (Exception ex)
{
logInfo.Error(ex.Message, ex);
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> {bSuccess = false,message = ex.Message,result = ex.StackTrace};
}
@@ -488,6 +488,7 @@
<Content Include="App_Data\票据录入模板.json" />
<Content Include="App_Data\请购单模板.json" />
<Content Include="App_Data\销售订单模板.json" />
<Content Include="App_Data\订单报工模板.json" />
<None Include="Oracle.DataAccess.Common.Configuration.Section.xsd">
<SubType>Designer</SubType>
</None>
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Web;
using System.Web.UI.WebControls;
using UFIDA.U8.Framework.Api.ControlObject.Entity;
@@ -38,18 +39,18 @@ namespace UFIDA.U8.Framework.Api.Unit
remoteLoader = (RemoteLoader)appDomain.CreateInstanceAndUnwrap(name, typeof(RemoteLoader).FullName ?? throw new InvalidOperationException());
}
internal BaseResult<string> Save(LoginParamter paramter, string cCardNum, Dictionary<string, object> input)
internal async Task<BaseResult<string>> Save(LoginParamter paramter, string cCardNum, Dictionary<string, object> input)
{
remoteLoader._paramter = paramter;
return remoteLoader.Save(cCardNum, input);
return await remoteLoader.Save(cCardNum, input);
}
internal BaseResult<string> Save(LoginParamter paramter, string cCardNum, List<Dictionary<string, object>> inputs)
internal async Task<BaseResult<string>> Save(LoginParamter paramter, string cCardNum, List<Dictionary<string, object>> inputs)
{
remoteLoader._paramter = paramter;
return remoteLoader.Save(cCardNum, inputs);
return await remoteLoader.Save(cCardNum, inputs);
}
/// <summary>
+5 -4
View File
@@ -1,6 +1,7 @@
using log4net;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using UFIDA.U8.Framework.Api.ControlObject.Entity;
using UFIDA.U8.Framework.Api.ControlObject.U8M;
@@ -30,7 +31,7 @@ namespace UFIDA.U8.Framework.Api.Unit
/// <param name="input">数据包</param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
internal BaseResult<string> Save(string cCardNum, Dictionary<string, object> input)
internal async Task<BaseResult<string>> Save(string cCardNum, Dictionary<string, object> input)
{
try
{
@@ -57,7 +58,7 @@ namespace UFIDA.U8.Framework.Api.Unit
baseLogin.Init(_paramter);
return bf.Save(cCardNum, input);
return await bf.Save(baseLogin, cCardNum, input);
}
catch (Exception ex)
@@ -75,7 +76,7 @@ namespace UFIDA.U8.Framework.Api.Unit
/// <param name="inputs">数据包</param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
internal BaseResult<string> Save(string cCardNum, List<Dictionary<string, object>> inputs)
internal async Task<BaseResult<string>> Save(string cCardNum, List<Dictionary<string, object>> inputs)
{
try
{
@@ -102,7 +103,7 @@ namespace UFIDA.U8.Framework.Api.Unit
baseLogin.Init(_paramter);
return bf.Save(cCardNum, inputs);
return await bf.Save(baseLogin, cCardNum, inputs);
}
catch (Exception ex)
+1 -1
View File
@@ -150,7 +150,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.17.0" newVersion="2.0.17.0" />
<bindingRedirect oldVersion="0.0.0.0-2.0.17.0" newVersion="1.2.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral" />