ClsWebService.cs 2.6 KB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace LineWebService
{
    // 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码和配置文件中的类名“Service1”。
   //[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Reentrant)]
    ///[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
    public class ClsWebService : IWebService
    {
        //private readonly log4net.ILog LOG  = log4net.LogManager.GetLogger("ClsWebService");

        public ClsWebService()
        {
           
        }

        public Result CreateEmptyRecycleTask(string line)
        {
            //LOG.Info("CreateEmptyRecycleTask emptyStation=" + line);
            Result res;
            if (!line.Equals(""))
            {
    
                res = new Result() { Succeed = "true", ResultData = "", ErrorMessage = "" };
                //IWebService_Callback callback = OperationContext.Current.GetCallbackChannel<IWebService_Callback>();
               //callback.GetEmptyRecycleTask(line);
            }
            else
            {
                res = new Result() { Succeed = "false", ResultData = "", ErrorMessage = "Not find " + line };
            }
            //if (AGVControl.Common.agvProductionLine.TryGetValue(line, out string value))
            //{
            //    res = new Result() { Succeed = "true", ResultData = "", ErrorMessage = "" };
            //LOG.Info("WebService Response OK");

            //    //加到任务
            //    //int idx = AGVControl.Common.nodeInfo.FindIndex(s => s.Name == value);
            //    //if (idx > -1)
            //    //    AGVControl.Common.linePlace.Add(value);
            //    //else
            //    //    AGVControl.Common.log.Error("CreateEmptyRecycleTask " + value + "不存在");
            //    if (!Common.AddLinePlace(value))
            //        Common.log.Error("CreateEmptyRecycleTask 节点【" + value + "】不存在");
            //    else
            //    {
            //        Common.LogInfo("任务:" + value + " 出空料架 【" + line + "】");
            //    }
            //    //System.IO.File.WriteAllLines(Common.CONFIG_PATH + "LinePlace.txt", Common.linePlace);
            //}
            //else
            //{
            //    res = new Result() { Succeed = "false", ResultData = "", ErrorMessage = "Not find " + line };
            //LOG.Info("WebService Response false");
            //}

            return res;
        }
    }

}