using Newtonsoft.Json;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using WIDESEA_Common.Tools;
|
using WIDESEA_Core.Utilities;
|
using WIDESEA_Entity.DomainModels.Mes;
|
using WIDESEA_WCS.JobsPart.Public;
|
using WIDESEA_WCS.WCSClient;
|
|
namespace WIDESEA_WCS
|
{
|
public partial class ToMesServer
|
{
|
public static List<string> ZhengJiTiShenji = new List<string>()
|
{
|
"提升机2", "提升机3"
|
};
|
|
public static List<string> FuJiTiShenji = new List<string>()
|
{
|
"提升机4", "提升机5"
|
};
|
|
/// <summary>
|
/// 三楼叫料临时
|
/// </summary>
|
/// <param name="requestTemp"></param>
|
/// <returns></returns>
|
public WebResponseContent Float3Rquired(MesRequestTemp requestTemp)
|
{
|
WebResponseContent content = new WebResponseContent();
|
try
|
{
|
if (WCSService.Clients == null)
|
{
|
throw new Exception("服务未启动!");
|
}
|
bool haveAdd = false;
|
List<PLCClient> clientList = null;
|
|
if (requestTemp.TiArea == "正极")
|
{
|
clientList = WCSService.Clients.Where(t => ZhengJiTiShenji.Contains(t.PLCName)).ToList();
|
}
|
else if (requestTemp.TiArea == "负极")
|
{
|
clientList = WCSService.Clients.Where(t => FuJiTiShenji.Contains(t.PLCName)).ToList();
|
}
|
foreach (var item in clientList)
|
{
|
var stationStatus = (byte[])item.ReadDBValue("DB6.1293", 1);
|
if (stationStatus[0] == 0x0)
|
{
|
//上料
|
var station = centerEqDBList.FirstOrDefault(t => t.tiShenJiName == item.PLCName)
|
?.stationInfos.FirstOrDefault(t => t.tiShenJiUniCode == 4);
|
WCSCommon.CreateTask(station, true, requestTemp.Type);
|
haveAdd = true;
|
break;
|
}
|
}
|
if (haveAdd)
|
{
|
content.OK();
|
}
|
else
|
{
|
throw new Exception("当前提升机无空闲入口");
|
}
|
}
|
catch (Exception ex)
|
{
|
WriteLog.GetLog().Write($"【error】{ex.Message}\n{JsonConvert.SerializeObject(requestTemp)}" + "\n", "三楼模拟叫料");
|
content.Error(ex.Message);
|
}
|
return content;
|
}
|
}
|
}
|