天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
5.1 KiB

using System;
using System.Collections.Generic;
using QMAPP.FJC.Entity.Basic;
using System.ServiceModel.Activation;
using QMAPP.FJC.BLL.Basic;
using QMAPP.FJC.DAL.Basic;
using QMFrameWork.Common.Serialization;
using QMFrameWork.Log;
using QMAPP.FJC.BLL.Process;
using QMAPP.FJC.Entity.QT;
using QMAPP.FJC.DAL.QT;
using System.Threading.Tasks;
using QMAPP.FJC.Entity.Operation;
namespace QMFrameWork.WebServiceHost
{
// 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码、svc 和配置文件中的类名“OpcService”。
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class OpcService : IOpcService
{
#region IOpcService 成员
/// <summary>
/// 获取所有的设备信息
/// </summary>
/// <returns></returns>
public string GetMachineList()
{
MachineInfoBLL machineBll = new MachineInfoBLL();
List<MachineInfo> machinelist = machineBll.GetAllList(new MachineInfo());
string machineStr = JsonConvertHelper.GetSerializes(machinelist);
return machineStr;
}
/// <summary>
/// 获取所有的配置信息
/// </summary>
/// <returns></returns>
public string GetParaConfigList()
{
List<ParameterConfig> paraConfigList = new List<ParameterConfig>();
ParameterConfigDAL paraConDal = new ParameterConfigDAL();
paraConfigList = paraConDal.GetList(new ParameterConfig() { });
string paraStr = JsonConvertHelper.GetSerializes(paraConfigList);
return paraStr;
}
/// <summary>
/// 获取所有
/// </summary>
/// <returns></returns>
public string GetSendOrderConfigList()
{
List<SendOrderConfig> list = new List<SendOrderConfig>();
SendOrderConfigDAL dal = new SendOrderConfigDAL();
list = dal.GetList(new SendOrderConfig());
string paraStr = JsonConvertHelper.GetSerializes(list);
return paraStr;
}
/// <summary>
/// opcserver提交参数
/// </summary>
/// <param name="paraListStr"></param>
public void SubmitParameters(string paraListStr)
{
try
{
List<ParameterConfig> paraList = JsonConvertHelper.GetDeserialize<List<ParameterConfig>>(paraListStr);
string machineNo = paraList[0].MACHINECODDE;
string mouldcode = paraList[0].MOLDNUMBER;
if (mouldcode != null && mouldcode.Length > 2)
{
}
else
{
mouldcode = "";
}
MachineInfoDAL machineDal = new MachineInfoDAL();
MachineInfo machineInfo = machineDal.GetMachineInfo(new MachineInfo() { MACHINECODDE = machineNo });
try
{
#region 处理数据
OperateProcess operateProcess = new OperateProcess();
MainOperation mo = operateProcess.ProcessPLC(machineInfo, mouldcode, paraList);
if (mo != null)
{
Task task = new Task(() =>
{
ParameterDeal deal = new ParameterDeal();
deal.InsertParameter(mo, paraList);
});
task.Start();
}
#endregion
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo() { ErrorInfo = ex, Info = "处理加工完成失败!" });
throw ex;
}
}
catch (Exception ex)
{
}
}
/// <summary>
/// opcserver中断体检参数
/// </summary>
/// <param name="paraListStr"></param>
public void SubmitInterruptParameters(string paraListStr)
{
try
{
List<ParameterConfig> paraList = JsonConvertHelper.GetDeserialize<List<ParameterConfig>>(paraListStr);
string machineNo = paraList[0].MACHINECODDE;
MachineInfoDAL machineDal = new MachineInfoDAL();
MachineInfo machineInfo = machineDal.GetMachineInfo(new MachineInfo() { MACHINECODDE = machineNo });
try
{
//其他加工工位
OperateProcess operateProcess = new OperateProcess();
operateProcess.Interrupt(machineInfo, paraList);
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo() { ErrorInfo = ex, Info = "处理加工完成失败!" });
throw ex;
}
}
catch (Exception ex)
{
}
}
#endregion
}
}