ldj/winform/service/LightService.cs

206 lines
5.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using DeiNiu.Utils;
using DeiNiu.wms.win.service;
namespace DNLightSvr
{
// 注意: 使用“重构”菜单上的“重命名”命令可以同时更改代码和配置文件中的类名“LightService”。
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class LightService : ILightService//,IPrintingService
{
// static log4net.ILog log = log4net.LogManager.GetLogger("light");
public delegate bool lightLable(ELabel[] lables);
public delegate bool clsOrder(ClearOrder clearOrder);
public clsOrder clearO = null;
public lightLable lightUp = null;
public string lightLabels(ELabel[] labels)
{
if (lightUp != null)
{
if (lightUp(labels))
{
return "success";
}
}
return "failure";
}
public string clearOrder(ClearOrder clearOrder)
{
if (clearO != null)
{
if (clearO(clearOrder))
{
return "success";
}
}
return "failure";
}
public string testPost(ELabel label)
{
string json = getJson(label);
// Console.Write("get the lable: " + json );
return json;// "succeed";
}
public string test()
{
Console.Write("get request");
return "服务响应 success";
}
public string getJson(ELabel label)
{
string json = String.Format("\"labelId\":{0},\"address\":{1},\"count\":{2},\"color\":{3},\"port\":{4},\"orderNo\":{5}"
, label.labelId, label.address, label.count, label.color, label.port, label.orderNo);
// Console.Write("get the lable: " + json);
return "{" + json + "}";
}
static string getMsg(string className, string msg)
{
return string.Format("{0} {1}", className, msg);
}
//--------------------------------------------light by order
public delegate int lightOrder(string orderNo,bool isPickOrder, int partion);
public lightOrder lightOd = null;
public delegate string lightJob(int userId,string jobNo,bool isValid);
public lightJob lightJd = null;
public string lightByJobNo(int userId,string jobNo,bool isValid)
{
if (lightJd != null)
{
return lightJd(userId,jobNo,isValid);
//success
}
return "亮灯失败";
}
public int lightByPickOrder(string orderNo, int partion)
{
if (lightOd != null)
{
return lightOd(orderNo, true, partion);
//success
}
return 0;
}
public int lightBySaleOrder(string orderNo, int partion)
{
if (lightOd != null)
{
return lightOd(orderNo, false, partion);
}
return 0;
}
//---light by plate
public delegate string lightPlate(string plateId,int part);
public lightPlate lightPl = null;
public string lightByPlate(string plateId,int partion)
{
if (lightPl != null)
{
return lightPl(plateId, partion);
}
return "亮灯失败001";
}
//---print service
public delegate int printOutTaskCodes(int userId, int part, int lineId, int orderType);
public printOutTaskCodes prtOutTaskCode = null;
public void printPrenIn(string orderNo)
{
throw new NotImplementedException();
}
public void printOnShelfA4(string orderNo)
{
throw new NotImplementedException();
}
public void printOnShelfCode(string orderNo)
{
throw new NotImplementedException();
}
public int printOutTaskCode(int userId, int partion, int lineId, int orderType)
{
if (prtOutTaskCode != null)
{
return prtOutTaskCode(userId, partion, lineId, orderType);
}
return 0;
}
public string lightJobNo(int userId, string jobNo, bool isValid)
{
return lightByJobNo(userId,jobNo, isValid);
}
public string lightChkStk(string jobNo, bool isValid)
{
return lightByJobNo(0,jobNo, isValid);
}
public delegate string prinPreIn(int userId,string preInNo);
public prinPreIn printPreInd = null;
public string printStockIn(int userId, string preinNo)
{
if (printPreInd != null)
{
return printPreInd(userId, preinNo);
}
return "打印命令已发送";
}
public delegate string prinOutTrans(string plateId);
public prinOutTrans prinOutTransd = null;
public string printOutTrans(string plateId)
{
if (prinOutTransd != null)
{
return prinOutTransd(plateId);
}
return "打印命令已发送";
}
}
}