using Newtonsoft.Json;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using yunneiWCS.EnumDefine;
|
|
namespace yunneiWCS.mes
|
{
|
public class mesDataManipulation
|
{
|
|
static HTTPService api = new HTTPService("http://192.168.6.47:8000/api/");//mes基地址
|
/// <summary>入库,或者退库
|
///
|
/// </summary>
|
/// <param name="isred">是否红单:0否1是</param>
|
/// <param name="prodep">生产部门:汽油机车间-机加工-机体线/汽油机车间-机加工-缸盖线</param>
|
/// <param name="materialCode">物料编号</param>
|
/// <param name="quantity">数量</param>
|
/// <returns></returns>
|
public static mesMsg InStockSend(string isred, string prodep, decimal quantity, string materialCode)
|
{
|
mesMsg res = null;
|
try
|
{
|
receivingNote inStockData = new receivingNote(isred, prodep, quantity,materialCode);
|
var data = new
|
{
|
SystemType = "ERP",
|
Secret = "HJY^*HGYIIY",
|
TableName = "MES_GOODSMOVEMENTSH",
|
PrimaryKeys = "",
|
Datas = inStockData
|
};
|
string paprm = JsonConvert.SerializeObject(data);
|
Guid guid = System.Guid.NewGuid();
|
res = JsonConvert.DeserializeObject<mesMsg>(api.postContentForString("Save", paprm, guid));
|
WZ.Useful.Commons.LogTextHelper.WriteLine("mesDataManipulation", "InStockSend 返回状态码:",res.ErrorCode+" 返回信息:"+ res.ErrorMsg);
|
}
|
catch (Exception)
|
{
|
WZ.Useful.Commons.LogTextHelper.WriteLine("mesDataManipulation", "InStockSend ", " 发送异常 /物料编号:" + materialCode);
|
res.ErrorCode = 3;
|
res.ErrorMsg = "发送异常了";
|
}
|
return res;
|
|
}
|
|
/// <summary>出库,或者余料回库
|
///
|
/// </summary>
|
/// <param name="isred">是否红单:0否1是</param>
|
/// <param name="materialCode">物料编号</param>
|
/// <param name="quantity">数量</param>
|
/// <returns></returns>
|
public static mesMsg OUTStockSend(string isred, string materialCode, decimal quantity)
|
{
|
mesMsg res = null;
|
try
|
{
|
consignmentNote outStockData = new consignmentNote(isred, materialCode, quantity);
|
var data = new
|
{
|
SystemType = "ERP",
|
Secret = "HJY^*HGYIIY",
|
TableName = "MES_GOODSMOVEMENTFH",
|
PrimaryKeys = "",
|
Datas = outStockData
|
};
|
string paprm = JsonConvert.SerializeObject(data);
|
Guid guid = System.Guid.NewGuid();
|
res = JsonConvert.DeserializeObject<mesMsg>(api.postContentForString("Save", paprm, guid));
|
WZ.Useful.Commons.LogTextHelper.WriteLine("mesDataManipulation", "OUTStockSend 返回状态码:", res.ErrorCode + " 返回信息:" + res.ErrorMsg);
|
}
|
catch (Exception)
|
{
|
res.ErrorCode = 3;
|
res.ErrorMsg = "发送异常了";
|
WZ.Useful.Commons.LogTextHelper.WriteLine("mesDataManipulation", "OUTStockSend ", " 发送异常 /物料编号:" + materialCode);
|
}
|
return res;
|
}
|
}
|
}
|