From b04c7a175efa4cc5097729dcfd9bbea9b8cd0df2 Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期二, 24 十二月 2024 13:02:00 +0800
Subject: [PATCH] 合并
---
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/GetStationService.cs | 54 ++++++++++++++++++++++++++++++++++--------------------
1 files changed, 34 insertions(+), 20 deletions(-)
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/GetStationService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/GetStationService.cs
index f2b4ed0..f5dd88d 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/GetStationService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/GetStationService.cs
@@ -1,9 +1,4 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using WIDESEAWCS_BasicInfoRepository;
+锘縰sing WIDESEAWCS_BasicInfoRepository;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseServices;
using WIDESEAWCS_ISystemServices;
@@ -13,37 +8,56 @@
namespace WIDESEAWCS_Tasks
{
- public class GetStationService:ServiceBase<Dt_StationManager, IDt_StationManagerRepository>, IGetStationService
+ public class GetStationService : ServiceBase<Dt_StationManager, IDt_StationManagerRepository>, IGetStationService
{
//private readonly IDt_StationManagerRepository _stationManagerRepository;
public GetStationService(IDt_StationManagerRepository BaseDal, ISys_ConfigService sys_ConfigService) : base(BaseDal)
{
}
+
public WebResponseContent GetStationHasPallet(List<string> stations)
{
- WebResponseContent content = new WebResponseContent();
+ var content = new WebResponseContent();
+
try
{
- var x = 0;
- var stationManagers = BaseDal.QueryData(x => stations.Contains(x.stationChildCode));
- foreach (var item in stationManagers)
- {
- if (Convert.ToInt32(item.stationPLC) > 1010)
- {
- CommonConveyorLine_GW commonConveyorLine_GW = Storage.Devices.FirstOrDefault(x => x.DeviceCode == item.stationPLC) as CommonConveyorLine_GW;
+ int palletCount = 0; // 鐢ㄤ簬璁板綍娌℃湁鎵樼洏鐨勭珯鐐规暟閲�
+ var stationManagers = BaseDal.QueryData(s => stations.Contains(s.stationChildCode)); // 鏌ヨ鐩稿叧绔欑偣绠$悊淇℃伅
- var isHasPallet = Convert.ToInt32(commonConveyorLine_GW.ReadValue(ConveyorLineDBName_After.HasPallet, item.stationChildCode));
- if (isHasPallet == 0) x++;
+ foreach (var station in stationManagers)
+ {
+ if (IsStationValid(station))
+ {
+ var hasPallet = ReadPalletStatus(station); // 鑾峰彇鎵樼洏鐘舵��
+ if (hasPallet == 16) // 濡傛灉娌℃湁鎵樼洏
+ {
+ palletCount++;
+ }
}
}
- content.OK(data: x);
+
+ content.OK(data: palletCount); // 杩斿洖缁撴灉
}
catch (Exception ex)
{
- content.Error(ex.Message);
+ content.Error(ex.Message); // 鎹曡幏骞惰繑鍥為敊璇俊鎭�
}
+
return content;
}
+
+ // 楠岃瘉绔欑偣鏄惁鏈夋晥
+ private bool IsStationValid(Dt_StationManager station)
+ {
+ return Convert.ToInt32(station.stationPLC) > 1010;
+ }
+
+ // 璇诲彇鎵樼洏鐘舵��
+ private int ReadPalletStatus(Dt_StationManager station)
+ {
+ var commonConveyorLine_GW = Storage.Devices.FirstOrDefault(device => device.DeviceCode == station.stationPLC) as CommonConveyorLine_GW;
+ return Convert.ToInt32(commonConveyorLine_GW.ReadValue(ConveyorLineDBName_After.InteractiveSignal, station.stationChildCode));
+ }
}
-}
+}
\ No newline at end of file
--
Gitblit v1.9.3