|
|
|
|
using AUCMA.STORE.Business.Implements;
|
|
|
|
|
using AUCMA.STORE.Business.Interface;
|
|
|
|
|
using AUCMA.STORE.Common;
|
|
|
|
|
using AUCMA.STORE.Entity.DAO;
|
|
|
|
|
using AUCMA.STORE.Entity.DTO;
|
|
|
|
|
using NetworkCommsDotNet;
|
|
|
|
|
using NetworkCommsDotNet.Connections.TCP;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using System.Web.Http;
|
|
|
|
|
|
|
|
|
|
namespace AUCMA.STORE.WebAPI.Controllers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 物料信息数据接口
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class MaterialInfoController : ApiController
|
|
|
|
|
{
|
|
|
|
|
// GET: api/MaterialInfo
|
|
|
|
|
public WebApiResult Get(int id)
|
|
|
|
|
{
|
|
|
|
|
string resMsg = "";
|
|
|
|
|
if(id == 0)
|
|
|
|
|
resMsg = TCPConnection.GetConnection(new ConnectionInfo("127.0.0.1", int.Parse("1212"))).SendReceiveObject<string, string>("GetName", "ResName", 50000, JsonChange.ModeToJson(123));
|
|
|
|
|
if(id == 1)
|
|
|
|
|
resMsg = TCPConnection.GetConnection(new ConnectionInfo("127.0.0.1", int.Parse("1212"))).SendReceiveObject<string, string>("GetName", "ResName", 50000, JsonChange.ModeToJson(456));
|
|
|
|
|
if(id == 2)
|
|
|
|
|
resMsg = TCPConnection.GetConnection(new ConnectionInfo("127.0.0.1", int.Parse("1212"))).SendReceiveObject<string, string>("GetName", "ResName", 50000, JsonChange.ModeToJson(789));
|
|
|
|
|
|
|
|
|
|
return new WebApiResult(200, true, resMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// POST: api/MaterialInfo
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public WebApiResult Post([FromBody] BaseMaterialDTO baseMaterialDTO)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (baseMaterialDTO.materialCode == null || baseMaterialDTO.materialCode == "")
|
|
|
|
|
{
|
|
|
|
|
return new WebApiResult(201, false, "物料编码不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (baseMaterialDTO.InStoreArea == 0)
|
|
|
|
|
{
|
|
|
|
|
return new WebApiResult(202, false, "入库区域不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string resMsg = TCPConnection.GetConnection(new ConnectionInfo("127.0.0.1", int.Parse("1212"))).SendReceiveObject<string, string>("GetName", "ResName", 5000, JsonChange.ModeToJson(baseMaterialDTO));
|
|
|
|
|
}catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.Error("接口数据处理异常:"+ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new WebApiResult(200, true, "数据上传成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PUT: api/MaterialInfo/5
|
|
|
|
|
public void Put(int id, [FromBody]string value)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// DELETE: api/MaterialInfo/5
|
|
|
|
|
public void Delete(int id)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|