修正表结构
This commit is contained in:
@@ -0,0 +1,49 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using DOAN.Model.PBL.Dto;
|
||||||
|
using DOAN.Model.PBL;
|
||||||
|
using DOAN.Service.PBL.IService;
|
||||||
|
using DOAN.Admin.WebApi.Filters;
|
||||||
|
|
||||||
|
//创建时间:2024-09-23
|
||||||
|
namespace DOAN.Admin.WebApi.Controllers.PBL
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 与MES交互
|
||||||
|
/// </summary>
|
||||||
|
[AllowAnonymous]
|
||||||
|
[Route("PBL/mes_interation")]
|
||||||
|
public class MESInteractionController : BaseController
|
||||||
|
{
|
||||||
|
private readonly IMESInteractionServcie mesInteraction;
|
||||||
|
public MESInteractionController(IMESInteractionServcie mesInteraction)
|
||||||
|
{
|
||||||
|
this.mesInteraction = mesInteraction;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO 接受工单 亮灯
|
||||||
|
|
||||||
|
[HttpPost("mes_light_up")]
|
||||||
|
public IActionResult MESLightUp([FromBody] LightUpDto light)
|
||||||
|
{
|
||||||
|
var response= mesInteraction.MESLightUp(light);
|
||||||
|
|
||||||
|
return SUCCESS(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO 扫码灭灯
|
||||||
|
[HttpGet("mes_light_down")]
|
||||||
|
public IActionResult MESLightDown(string scan_code)
|
||||||
|
{
|
||||||
|
var response = mesInteraction.MESLightDown(scan_code);
|
||||||
|
|
||||||
|
return SUCCESS(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
36
DOAN.Model/PBL/Dto/LightUp.cs
Normal file
36
DOAN.Model/PBL/Dto/LightUp.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DOAN.Model.PBL.Dto
|
||||||
|
{
|
||||||
|
public class LightUpDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 工单号
|
||||||
|
/// </summary>
|
||||||
|
public string Workorder { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单号
|
||||||
|
/// </summary>
|
||||||
|
public string OrderNumber { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 总成零件号
|
||||||
|
/// </summary>
|
||||||
|
public string AssemblyPartNumber { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -19,10 +19,17 @@ namespace DOAN.Model.PBL.Dto
|
|||||||
[Required(ErrorMessage = "Id不能为空")]
|
[Required(ErrorMessage = "Id不能为空")]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public string Partnumber { get; set; }
|
|
||||||
|
|
||||||
public string RackCode { get; set; }
|
public string RackCode { get; set; }
|
||||||
|
|
||||||
|
public int LayerNum { get; set; }
|
||||||
|
|
||||||
|
public string Partnumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最大容量
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public int MaxCapacity { get; set; }
|
||||||
public int? PackageNum { get; set; }
|
public int? PackageNum { get; set; }
|
||||||
|
|
||||||
public string CreatedBy { get; set; }
|
public string CreatedBy { get; set; }
|
||||||
|
|||||||
48
DOAN.Model/PBL/Light_Log.cs
Normal file
48
DOAN.Model/PBL/Light_Log.cs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DOAN.Model.PBL
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 库存日志
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("light_log")]
|
||||||
|
public class Light_Log
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 雪花
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 1亮灯、2灭灯
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "light_operation")]
|
||||||
|
public int LightOperation { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 货架号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "shelf_code")]
|
||||||
|
public string ShelfCode { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 操作者
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "operationer")]
|
||||||
|
public string Operationer { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "created_time")]
|
||||||
|
public DateTime? CreatedTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
56
DOAN.Model/PBL/MES_Interaction.cs
Normal file
56
DOAN.Model/PBL/MES_Interaction.cs
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DOAN.Model.PBL
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// mes交互日志
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("mes_interation_log")]
|
||||||
|
public class MES_Interation_Log
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 雪花
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工单号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "Workorder")]
|
||||||
|
public string Workorder { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "OrderNumber")]
|
||||||
|
public string OrderNumber { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 总成零件号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "AssemblyPartNumber")]
|
||||||
|
public string AssemblyPartNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 扫描scancode
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "scancode")]
|
||||||
|
public string ScanCode { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
[SugarColumn(ColumnName = "created_time")]
|
||||||
|
public DateTime CreatedTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[SugarColumn(ColumnName = "updated_time")]
|
||||||
|
public DateTime UpdatedTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
namespace DOAN.Model.PBL
|
namespace DOAN.Model.PBL
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -13,16 +12,28 @@ namespace DOAN.Model.PBL
|
|||||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 料架号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "rack_code")]
|
||||||
|
public string RackCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 层号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "layer_num")]
|
||||||
|
public int LayerNum { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 零件号
|
/// 零件号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Partnumber { get; set; }
|
public string Partnumber { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 料架号
|
/// 最大容量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "rack_code")]
|
[SugarColumn(ColumnName = "max_capacity")]
|
||||||
public string RackCode { get; set; }
|
public int MaxCapacity { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 箱子数
|
/// 箱子数
|
||||||
@@ -53,6 +64,5 @@ namespace DOAN.Model.PBL
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "uPDATED_TIME")]
|
[SugarColumn(ColumnName = "uPDATED_TIME")]
|
||||||
public DateTime? UpdatedTime { get; set; }
|
public DateTime? UpdatedTime { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
17
DOAN.Service/PBL/IService/IMESInteractionServcie.cs
Normal file
17
DOAN.Service/PBL/IService/IMESInteractionServcie.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using DOAN.Model.PBL.Dto;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DOAN.Service.PBL.IService
|
||||||
|
{
|
||||||
|
public interface IMESInteractionServcie
|
||||||
|
{
|
||||||
|
|
||||||
|
bool MESLightUp(LightUpDto light);
|
||||||
|
bool MESLightDown(string scan_code);
|
||||||
|
}
|
||||||
|
}
|
||||||
101
DOAN.Service/PBL/MESInteractionServcie.cs
Normal file
101
DOAN.Service/PBL/MESInteractionServcie.cs
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
using Infrastructure.Attribute;
|
||||||
|
using Infrastructure.Extensions;
|
||||||
|
using DOAN.Model.PBL.Dto;
|
||||||
|
using DOAN.Model.PBL;
|
||||||
|
using DOAN.Repository;
|
||||||
|
using DOAN.Service.PBL.IService;
|
||||||
|
using Mapster;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using SqlSugar;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
|
||||||
|
|
||||||
|
namespace DOAN.Service.PBL
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 料架表Service业务层处理
|
||||||
|
/// </summary>
|
||||||
|
[AppService(ServiceType = typeof(IMESInteractionServcie), ServiceLifetime = LifeTime.Transient)]
|
||||||
|
public class MESInteractionServcie : BaseService<Storagelocation>, IMESInteractionServcie
|
||||||
|
{
|
||||||
|
public bool MESLightUp(LightUpDto light)
|
||||||
|
{
|
||||||
|
// 1.记录MES交互记录
|
||||||
|
MES_Interation_Log item = light.Adapt<MES_Interation_Log>();
|
||||||
|
item.Id = XUEHUA;
|
||||||
|
item.CreatedTime= DateTime.Now;
|
||||||
|
Context.Insertable(item).ExecuteCommand();
|
||||||
|
|
||||||
|
// 2.根据总成零件号 查询对应零件号,使得对应料架亮灯
|
||||||
|
|
||||||
|
//镜壳 料架
|
||||||
|
Storagelocation MirrorshellShelf = Context.Queryable<Storagelocation>().Where(it => it.Partnumber ==
|
||||||
|
SqlFunc.Subqueryable<Billofmaterials>().Where(It => It.Productcode == light.AssemblyPartNumber).Select(it => it.MirrorshellCode)).First();
|
||||||
|
|
||||||
|
//镜体 料架
|
||||||
|
Storagelocation MirrorshellBody = Context.Queryable<Storagelocation>().Where(it => it.Partnumber ==
|
||||||
|
SqlFunc.Subqueryable<Billofmaterials>().Where(It => It.Productcode == light.AssemblyPartNumber).Select(it => it.MirrorbodyCode)).First();
|
||||||
|
|
||||||
|
// 3.对应料架亮灯
|
||||||
|
Light_Log light_Log = new Light_Log();
|
||||||
|
light_Log.Id = XUEHUA;
|
||||||
|
light_Log.LightOperation = 1;
|
||||||
|
if (MirrorshellShelf != null)
|
||||||
|
{
|
||||||
|
light_Log.ShelfCode = MirrorshellShelf.RackCode;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
light_Log.Operationer = "PBL";
|
||||||
|
light_Log.CreatedTime = DateTime.Now;
|
||||||
|
Light_Log light_Log2 = new Light_Log();
|
||||||
|
light_Log2.Id = XUEHUA;
|
||||||
|
light_Log2.LightOperation = 1;
|
||||||
|
if (MirrorshellShelf != null)
|
||||||
|
{
|
||||||
|
light_Log2.ShelfCode = MirrorshellShelf.RackCode;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
light_Log2.Operationer = "PBL";
|
||||||
|
light_Log2.CreatedTime = DateTime.Now;
|
||||||
|
Context.Insertable(light_Log2).ExecuteCommand();
|
||||||
|
int result = Context.Insertable(light_Log).ExecuteCommand();
|
||||||
|
return result > 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool MESLightDown(string scan_code)
|
||||||
|
{
|
||||||
|
// 1.记录MES交互记录
|
||||||
|
MES_Interation_Log item = new MES_Interation_Log();
|
||||||
|
item.Id = XUEHUA;
|
||||||
|
item.ScanCode=scan_code;
|
||||||
|
item.CreatedTime = DateTime.Now;
|
||||||
|
Context.Insertable(item).ExecuteCommand();
|
||||||
|
|
||||||
|
//2 找到对应的料架 灭灯
|
||||||
|
Storagelocation storagelocation= Context.Queryable<Storagelocation>().Where(it => it.Partnumber == scan_code).First();
|
||||||
|
Light_Log light_Log = new Light_Log();
|
||||||
|
light_Log.Id = XUEHUA;
|
||||||
|
light_Log.LightOperation = 2;
|
||||||
|
if (storagelocation != null) {
|
||||||
|
light_Log.ShelfCode = storagelocation.RackCode ;
|
||||||
|
}
|
||||||
|
|
||||||
|
light_Log.Operationer = "PBL";
|
||||||
|
light_Log.CreatedTime = DateTime.Now;
|
||||||
|
int result= Context.Insertable(light_Log).ExecuteCommand();
|
||||||
|
if (result > 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -134,7 +134,7 @@ namespace DOAN.Common
|
|||||||
|
|
||||||
//.net7需要这样写
|
//.net7需要这样写
|
||||||
var coherentState = Cache.GetType().GetField("_coherentState", flags).GetValue(Cache);
|
var coherentState = Cache.GetType().GetField("_coherentState", flags).GetValue(Cache);
|
||||||
var entries = coherentState.GetType().GetField("_entries", flags).GetValue(coherentState);
|
var entries = coherentState.GetType()?.GetField("_entries", flags)?.GetValue(coherentState);
|
||||||
|
|
||||||
var keys = new List<string>();
|
var keys = new List<string>();
|
||||||
if (entries is not IDictionary cacheItems) return keys;
|
if (entries is not IDictionary cacheItems) return keys;
|
||||||
|
|||||||
@@ -23,4 +23,13 @@
|
|||||||
<PackageReference Include="IP2Region.Net" Version="2.0.2" />
|
<PackageReference Include="IP2Region.Net" Version="2.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="HslCommunication">
|
||||||
|
<HintPath>dll\HslCommunication.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Register">
|
||||||
|
<HintPath>dll\Register.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
32
Infrastructure/WebExtensions/HslCommunicationExtension.cs
Normal file
32
Infrastructure/WebExtensions/HslCommunicationExtension.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Register;
|
||||||
|
|
||||||
|
namespace DOAN.Infrastructure.WebExtensions
|
||||||
|
{
|
||||||
|
public static class HslCommunicationExtension
|
||||||
|
{
|
||||||
|
|
||||||
|
public static void AddHslCommunication(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
//if (!HslCommunication.Authorization.SetAuthorizationCode("71d19e25-1fc3-419f-adaa-8c14df37952a"))
|
||||||
|
//{
|
||||||
|
// Console.WriteLine("HslCommunication激活失败");
|
||||||
|
|
||||||
|
//}
|
||||||
|
if (!Register.Reg.RegLicense())
|
||||||
|
{
|
||||||
|
Console.WriteLine("HslCommunication激活失败");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("HslCommunication激活成功");
|
||||||
|
}
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Infrastructure/dll/HslCommunication.dll
Normal file
BIN
Infrastructure/dll/HslCommunication.dll
Normal file
Binary file not shown.
BIN
Infrastructure/dll/Register.dll
Normal file
BIN
Infrastructure/dll/Register.dll
Normal file
Binary file not shown.
Reference in New Issue
Block a user