2023-05-23 16:13:17 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
|
using System.ServiceModel;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using DeiNiu.wms.Data.Model;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using DeiNiu.wms.Logical;
|
|
|
|
|
using DeiNiu.Utils;
|
|
|
|
|
using WcfServiceAuthentication;
|
|
|
|
|
|
|
|
|
|
namespace DeiNiu.Wcf
|
|
|
|
|
{
|
|
|
|
|
// 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码、svc 和配置文件中的类名“Node”。
|
|
|
|
|
public class NodeService : basicService, INode
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private static lNode _lnode;
|
2023-11-21 19:18:23 +08:00
|
|
|
|
protected static log4net.ILog logNode = log4net.LogManager.GetLogger("node");
|
2023-05-23 16:13:17 +08:00
|
|
|
|
lNode lnode
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_lnode == null || _lnode.operId != getOperId())
|
|
|
|
|
{
|
|
|
|
|
_lnode = new lNode(getOperId());
|
|
|
|
|
}
|
|
|
|
|
return _lnode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int newNode(string name,string description,int parentId,int flag)
|
|
|
|
|
{
|
|
|
|
|
Node node = new Node();
|
|
|
|
|
node.flag = flag;
|
|
|
|
|
node.parentid = parentId;
|
|
|
|
|
node.description = description;
|
|
|
|
|
node.name = name;
|
|
|
|
|
node.operater = getOperId();
|
|
|
|
|
|
|
|
|
|
return node.Add();//return pk
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public wcfNode newWcfNode(wcfNode wnode)
|
|
|
|
|
{
|
|
|
|
|
Node node = getNode(wnode);
|
|
|
|
|
node.Add();
|
|
|
|
|
wnode.id = node.ID;
|
|
|
|
|
return wnode;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public wcfNode updateWcfNode(wcfNode wnode)
|
|
|
|
|
{
|
2023-11-21 19:18:23 +08:00
|
|
|
|
logNode.Debug("operId is " + getOperId());
|
|
|
|
|
logNode.Debug("before update node......" + new Node(wnode.id).ToJsonString());
|
|
|
|
|
|
|
|
|
|
Node nd = getNode(wnode);
|
|
|
|
|
|
|
|
|
|
logNode.Debug("start update node......" + nd.ToJsonString());
|
|
|
|
|
nd.operater = getOperId();
|
|
|
|
|
|
|
|
|
|
nd .Update();
|
|
|
|
|
WmsConstants.IS_INITIALED = false; // to update constants
|
|
|
|
|
|
|
|
|
|
nd = new Node(wnode.id);
|
2023-09-04 22:41:19 +08:00
|
|
|
|
|
2023-11-21 19:18:23 +08:00
|
|
|
|
logNode.Debug("updated value...." +nd.ToJsonString());
|
2023-09-04 22:41:19 +08:00
|
|
|
|
|
|
|
|
|
return wnode;
|
2023-05-23 16:13:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Node getNode(wcfNode wnode)
|
|
|
|
|
{
|
2023-09-04 22:41:19 +08:00
|
|
|
|
Node node = new Node(wnode.id);
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
node.flag = wnode.flag;
|
|
|
|
|
node.parentid = wnode.parentid;
|
|
|
|
|
node.description = wnode.description;
|
|
|
|
|
node.name = wnode.name;
|
|
|
|
|
node.operater = getOperId();
|
|
|
|
|
node.ID = wnode.id;
|
|
|
|
|
node.value = wnode.value;
|
|
|
|
|
node.isOn = wnode.isOn;
|
|
|
|
|
node.isSystem = wnode.isSystem;
|
|
|
|
|
node.valueType = wnode.valueType;
|
2023-09-04 22:41:19 +08:00
|
|
|
|
|
2023-11-21 19:18:23 +08:00
|
|
|
|
// log.Debug(Util.getJson(node));
|
2023-09-04 22:41:19 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
return node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DataSet Query(string querystr, int rownumStart, int rownumEnd)
|
|
|
|
|
{
|
|
|
|
|
return lnode.Query(querystr, rownumStart, rownumEnd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int deleteNode(int id)
|
|
|
|
|
{
|
|
|
|
|
Node node = new Node(id);
|
|
|
|
|
|
|
|
|
|
return node.Delete();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DataTable getNodesByFlag(int flag)
|
|
|
|
|
{
|
|
|
|
|
return new Node().QueryByFlag(flag);
|
|
|
|
|
}
|
|
|
|
|
public void applyDicChanges()
|
|
|
|
|
{
|
|
|
|
|
WmsConstants.IS_INITIALED = false;
|
|
|
|
|
lnode.initialConstants();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DataTable getOwners()
|
|
|
|
|
{
|
|
|
|
|
Owner owner = new Owner();
|
|
|
|
|
|
|
|
|
|
return owner.getActiveOwners();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|