修正表结构

This commit is contained in:
qianhao.xu
2024-11-01 11:35:11 +08:00
parent d4fd12fd96
commit e4da25b1ca
13 changed files with 374 additions and 9 deletions

View 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);
}
}

View 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;
}
}
}
}