|
using iWareCommon.Utils;
|
using iWareModel;
|
using iWareModel.Entity.Device;
|
using iWareSql.DataAccess;
|
using Newtonsoft.Json;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Runtime.Serialization;
|
using System.ServiceModel;
|
using System.Text;
|
using XiGang.Core.Model;
|
using XiGang.Core.Model.PostParamModels.Task;
|
|
namespace iWareCC.WCF
|
{
|
// 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码和配置文件中的类名“CCWcfService”。
|
public class CCWcfService : ICCWcfService
|
{
|
/// <summary>
|
/// MES提供某个发动机的详细信息
|
/// </summary>
|
/// <param name="_barCode"></param>
|
public string getEngineInfo(string mes_url, string XiGang_Mes_Url_getEngineInfo, string token, string _barCode)
|
{
|
return MyMesService.getEngineInfo(mes_url, XiGang_Mes_Url_getEngineInfo, token, _barCode);
|
}
|
|
/// <summary>
|
/// 获取设备坐标
|
/// </summary>
|
/// <returns></returns>
|
public DeviceCoordinat GetDeviceCoordinat()
|
{
|
DeviceCoordinat result = null;
|
try
|
{
|
result = new DeviceCoordinat()
|
{
|
|
};
|
|
//result.RgvCoordinate = FormCC.rgvView.R_RGV_Coordinate;
|
|
result.Srm1Coordinat = FormCC.srmViewDict[(int)EDevice.堆垛机].R_PosXmm.ToString();
|
result.Srm2Coordinat = FormCC.srmViewDict[(int)EDevice.二号堆垛机].R_PosXmm.ToString();
|
|
return result;
|
}
|
catch (Exception ex)
|
{
|
Log4NetHelper.WriteErrorLog(LogType.CCWCFService, "GetDeviceCoordinat出现异常:" + ex.Message, ex);
|
return result;
|
}
|
}
|
|
/// <summary>
|
/// 模式是否正在运行
|
/// </summary>
|
/// <returns></returns>
|
public bool IsStartedModel()
|
{
|
return SystemValue.isStartedModel;
|
}
|
|
/// <summary>
|
/// 生成最新的任务序列号
|
/// </summary>
|
/// <param name="edm"></param>
|
/// <returns></returns>
|
public int GenerateTaskSequence()
|
{
|
try
|
{
|
//using (DbModel edm = new DbModel())
|
//{
|
// return MainTaskHandler.GenerateTaskSequence(edm);
|
//}
|
return 0;
|
}
|
catch (Exception ex)
|
{
|
Log4NetHelper.WriteErrorLog(LogType.CCWCFService, "GenerateTaskSequence出现异常:" + ex.Message, ex);
|
return 0;
|
}
|
}
|
|
/// <summary>
|
/// 重新扫描输送线1015上的托盘号
|
/// </summary>
|
/// <returns></returns>
|
public FunRetEntity Write1015ReScan(bool value)
|
{
|
try
|
{
|
using (RgvService.RgvServiceClient client = new RgvService.RgvServiceClient())
|
{
|
iWareCC.RgvService.SdaResEntity result = client.Write1015ReScan((int)EDevice.RGV, value);
|
if (result.result)
|
{
|
return FunRetEntity.Success("成功", "");
|
}
|
else
|
{
|
return FunRetEntity.Fail(result.resMsg, "");
|
}
|
}
|
}
|
catch (Exception ex)
|
{
|
return FunRetEntity.Fail("获取输送线1015上扫描的托盘号出现异常:" + ex.Message);
|
}
|
}
|
|
|
///// <summary>
|
///// 寻找空闲的立库空库位 (普通物料)
|
///// </summary>
|
///// <returns></returns>
|
//public Base_Station FindBestEmptyPlaceForOrdinaryMaterial(string orderNo)
|
//{
|
// try
|
// {
|
// using (DbModel edm = new DbModel())
|
// {
|
// var item = StationHandler.FindBestEmptyPlaceForOrdinaryMaterial(edm, orderNo, MaterialTypeEnum.一般物料);
|
// return item;
|
// }
|
// }
|
// catch (Exception ex)
|
// {
|
// return null;
|
// }
|
//}
|
|
/// <summary>
|
/// 新增入库任务
|
/// </summary>
|
/// <param name="user"></param>
|
/// <param name="material"></param>
|
/// <param name="salver"></param>
|
/// <returns></returns>
|
public FunRetEntity AddInStoreTask(SysUser user, AddMainTaskPostParam param)
|
{
|
try
|
{
|
//return MainTaskHandler.AddInStoreTask(user, param);
|
return null;
|
}
|
catch (Exception ex)
|
{
|
return FunRetEntity.Fail("出现异常:" + ex.Message);
|
}
|
}
|
|
/// <summary>
|
/// 输送线站台是否满足新入库任务生成
|
/// </summary>
|
/// <param station="101"></param>
|
/// <returns></returns>
|
public bool IsMeetRequirements(string station)
|
{
|
try
|
{
|
var stationStatus = FormCC.conveyerView.R_ConveyerForReadCommList.Where(x => x.StationCode == station).FirstOrDefault();
|
if (stationStatus != null)
|
{
|
bool temp = false;
|
//是否有入库请求
|
switch (station)
|
{
|
case "101":
|
temp = FormCC.conveyerView.R_Scan1_Success;
|
break;
|
//case "102":
|
// temp = FormCC.conveyerView.R_Scan2_Success;
|
// break;
|
//case "103":
|
// temp = FormCC.conveyerView.R_Scan3_Success;
|
// break;
|
//case "104":
|
// temp = FormCC.conveyerView.R_Scan4_Success;
|
// break;
|
}
|
if(temp)
|
{
|
return false;
|
}
|
return stationStatus.R_HasCargo;
|
}
|
return false;
|
}
|
catch (Exception ex)
|
{
|
return false;
|
}
|
}
|
|
///// <summary>
|
///// 新增入库任务
|
///// </summary>
|
///// <param name="user"></param>
|
///// <param name="material"></param>
|
///// <param name="salver"></param>
|
///// <returns></returns>
|
//public FunRetEntity AddInStoreTask(SysUser user, AddMainTaskPostParam param)
|
//{
|
// try
|
// {
|
// return MainTaskHandler.AddInStoreTask(user, param);
|
// }
|
// catch (Exception ex)
|
// {
|
// return FunRetEntity.Fail("出现异常:" + ex.Message);
|
// }
|
//}
|
|
|
///// <summary>
|
///// 新增手动出库任务
|
///// </summary>
|
///// <param name="user"></param>
|
///// <param name="material"></param>
|
///// <param name="salver"></param>
|
///// <returns></returns>
|
//public FunRetEntity AddOutStoreTaskByHand(SysUser user, int stationId)
|
//{
|
// try
|
// {
|
// return MainTaskHandler.AddOutStoreTaskByHand(user, stationId);
|
// }
|
// catch (Exception ex)
|
// {
|
// return FunRetEntity.Fail("出现异常:" + ex.Message);
|
// }
|
//}
|
}
|
}
|