From 6466627106669dbfe72a670522c18fb14cba4748 Mon Sep 17 00:00:00 2001 From: "qianhao.xu" Date: Fri, 1 Nov 2024 14:13:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PBL/MESInteractionController.cs | 49 ------------------- DOAN.Service/PBL/MESInteractionServcie.cs | 25 +++++++--- 2 files changed, 17 insertions(+), 57 deletions(-) delete mode 100644 DOAN.Admin.WebApi/Controllers/PBL/MESInteractionController.cs diff --git a/DOAN.Admin.WebApi/Controllers/PBL/MESInteractionController.cs b/DOAN.Admin.WebApi/Controllers/PBL/MESInteractionController.cs deleted file mode 100644 index 46c517f..0000000 --- a/DOAN.Admin.WebApi/Controllers/PBL/MESInteractionController.cs +++ /dev/null @@ -1,49 +0,0 @@ -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 -{ - /// - /// 与MES交互 - /// - [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); - } - - - } - -} - - - - diff --git a/DOAN.Service/PBL/MESInteractionServcie.cs b/DOAN.Service/PBL/MESInteractionServcie.cs index afa9ddc..ba11536 100644 --- a/DOAN.Service/PBL/MESInteractionServcie.cs +++ b/DOAN.Service/PBL/MESInteractionServcie.cs @@ -37,6 +37,10 @@ namespace DOAN.Service.PBL SqlFunc.Subqueryable().Where(It => It.Productcode == light.AssemblyPartNumber).Select(it => it.MirrorbodyCode)).First(); // 3.对应料架亮灯 + + //TODO PLC 交互 + + //亮灯日志 Light_Log light_Log = new Light_Log(); light_Log.Id = XUEHUA; light_Log.LightOperation = 1; @@ -76,7 +80,15 @@ namespace DOAN.Service.PBL Context.Insertable(item).ExecuteCommand(); //2 找到对应的料架 灭灯 + + + Storagelocation storagelocation= Context.Queryable().Where(it => it.Partnumber == scan_code).First(); + + //TODO PLC 交互 + + + //亮灯日志 Light_Log light_Log = new Light_Log(); light_Log.Id = XUEHUA; light_Log.LightOperation = 2; @@ -87,14 +99,11 @@ namespace DOAN.Service.PBL light_Log.Operationer = "PBL"; light_Log.CreatedTime = DateTime.Now; int result= Context.Insertable(light_Log).ExecuteCommand(); - if (result > 0) - { - return true; - } - else - { - return false; - } + + //3 扣减对应的库存 + + return result > 0; + } }