using ICSSoft.DataProject;
using ICSSoft.DataProject.ICSSoft.DataProject;
using ICSSoft.Entity;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web.Http;
using System.Web.Http.Description;
using ICSSoft.Common;
namespace ICSSoft.WebAPI.Controllers
{
public class ValuesController : ApiController
{
private static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region 请购单
///
/// 获取请购单
///
///
///
[Route("api/PurchaseRequisition/Get")]
[HttpPost]
public HttpResponseMessage GetPurchaseRequisition([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseRequisition/Get ");
log.Info("获取请购单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
PurchaseRequisition action = new PurchaseRequisition();
string resultStr = action.Get(infos);
if (resultStr.Length > 0)
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取请购单返回值:" + str);
return result;
}
///
/// 创建请购单
///
///
///
[Route("api/PurchaseRequisition/Create")]
[HttpPost]
public HttpResponseMessage CreatePurchaseRequisition([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseRequisition/Create ");
log.Info("创建请购单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
throw new Exception(res.Message);
}
PurchaseRequisition action = new PurchaseRequisition();
string resultStr = action.CreatePurchaseRequisition(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Data = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建请购单返回值:" + str);
return result;
}
///
/// 审核请购单
///
///
///
[Route("api/PurchaseRequisition/Approve")]
[HttpPost]
public HttpResponseMessage ApprovePurchaseRequisition([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseRequisition/Approve");
log.Info("审核请购单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
PurchaseRequisition action = new PurchaseRequisition();
string resultStr = action.Approve(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
//res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核请购单返回值:" + str);
return result;
}
///
/// 删除到货单
///
///
///
[Route("api/PurchaseRequisition/Delete")]
[HttpPost]
public HttpResponseMessage DeletePurchaseRequisition([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseRequisition/Delete");
log.Info("删除到货单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
PurchaseRequisition action = new PurchaseRequisition();
string resultStr = action.Delete(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
//res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除到货单返回值:" + str);
return result;
}
#endregion
#region 采购订单
///
/// 获取采购订单
///
///
///
[Route("api/PurchaseOrder/Get")]
[HttpPost]
public HttpResponseMessage GetPurchaseOrder([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseOrder/Get");
log.Info("获取采购订单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
PurchaseOrder action = new PurchaseOrder();
string resultStr = action.GET(infos);
if (resultStr.Length > 0)
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取采购订单返回值:" + str);
return result;
}
///
/// 创建采购订单
///
///
///
[Route("api/PurchaseOrder/Create")]
[HttpPost]
public HttpResponseMessage CreatePurchaseOrder([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseOrder/Create");
log.Info("创建采购订单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
throw new Exception(res.Message);
}
PurchaseOrder action = new PurchaseOrder();
string resultStr = action.CreateICSPurchaseOrder(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Data = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建采购订单返回值:" + str);
return result;
}
///
/// 审核采购订单
///
///
///
[Route("api/PurchaseOrder/Approve")]
[HttpPost]
public HttpResponseMessage ApprovePurchaseOrder([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseOrder/Approve");
log.Info("审核采购订单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
PurchaseOrder action = new PurchaseOrder();
string resultStr = action.Approve(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
//res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核采购订单返回值:" + str);
return result;
}
///
/// 删除采购订单
///
///
///
[Route("api/PurchaseOrder/Delete")]
[HttpPost]
public HttpResponseMessage DeletePurchaseOrder([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseOrder/Delete");
log.Info("删除采购订单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
PurchaseOrder action = new PurchaseOrder();
string resultStr = action.Delete(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
//res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除采购订单返回值:" + str);
return result;
}
#endregion
#region 到货单
///
/// 获取到货单
///
///
///
[Route("api/CreatePOArrive/Get")]
[HttpPost]
public HttpResponseMessage Get([FromBody]object JsonData)
{
log.Info("接口:api/CreatePOArrive/Get");
log.Info("获取到货单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
CreatePOArrive action = new CreatePOArrive();
string resultStr = action.Get(infos);
if (resultStr.Length > 0)
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取到货单返回值:" + str);
return result;
}
///
/// 创建到货单
///
///
///
[Route("api/CreatePOArrive/Create")]
[HttpPost]
public HttpResponseMessage Create([FromBody]object JsonData)
{
log.Info("接口:api/CreatePOArrive/Create");
log.Info("创建到货单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
throw new Exception(res.Message);
}
CreatePOArrive action = new CreatePOArrive();
string resultStr = action.CreatePUArrive(infos);
if (resultStr.Length > 0)
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Data = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建到货单返回值:" + str);
return result;
}
///
/// 审核到货单
///
///
///
[Route("api/CreatePOArrive/Approve")]
[HttpPost]
public HttpResponseMessage Approve([FromBody]object JsonData)
{
log.Info("接口:api/CreatePOArrive/Approve");
log.Info("审核到货单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
CreatePOArrive action = new CreatePOArrive();
string resultStr = action.Approve(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
//res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核到货单返回值:" + str);
return result;
}
///
/// 删除到货单
///
///
///
[Route("api/CreatePOArrive/Delete")]
[HttpPost]
public HttpResponseMessage Delete([FromBody]object JsonData)
{
log.Info("接口:api/CreatePOArrive/Delete");
log.Info("删除到货单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
CreatePOArrive action = new CreatePOArrive();
string resultStr = action.Delete(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
//res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除到货单返回值:" + str);
return result;
}
#endregion
#region 拒收单
///
/// 获取拒收单
///
///
///
[Route("api/CreatePuArrivalVouch/Get")]
[HttpPost]
public HttpResponseMessage GetPuArrivalVouch([FromBody]object JsonData)
{
log.Info("接口:api/CreatePuArrivalVouch/Get");
log.Info("获取拒收单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
CreatePuArrivalVouch action = new CreatePuArrivalVouch();
string resultStr = action.Get(infos);
if (resultStr.Length > 0)
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取拒收单返回值:" + str);
return result;
}
///
/// 创建拒收单
///
///
///
[Route("api/CreatePuArrivalVouch/Create")]
[HttpPost]
public HttpResponseMessage CreatePuArrivalVouch([FromBody]object JsonData)
{
log.Info("接口:api/CreatePuArrivalVouch/Create");
log.Info("创建拒收单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
throw new Exception(res.Message);
}
CreatePuArrivalVouch action = new CreatePuArrivalVouch();
string resultStr = action.CreatePUArrive(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Data = resultStr;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Data = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建拒收单返回值:" + str);
return result;
}
///
/// 创建委外拒收单
///
///
///
[Route("api/CreateWPuArrivalVouch/CreateNew")]
[HttpPost]
public HttpResponseMessage CreatePuArrivalVouchNEW([FromBody]object JsonData)
{
log.Info("接口:api/CreateWPuArrivalVouch/CreateNew");
log.Info("创建委外拒收单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
throw new Exception(res.Message);
}
CreatePuArrivalVouch action = new CreatePuArrivalVouch();
string resultStr = action.CreateWPUArrive(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Data = resultStr;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Data = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建拒收单返回值:" + str);
return result;
}
///
/// 审核拒收单
///
///
///
[Route("api/CreatePuArrivalVouch/Approve")]
[HttpPost]
public HttpResponseMessage ApprovePuArrivalVouch([FromBody]object JsonData)
{
log.Info("接口:api/CreatePuArrivalVouch/Approve");
log.Info("审核拒收单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
CreatePuArrivalVouch action = new CreatePuArrivalVouch();
string resultStr = action.Approve(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核拒收单返回值:" + str);
return result;
}
///
/// 删除拒收单
///
///
///
[Route("api/CreatePuArrivalVouch/Delete")]
[HttpPost]
public HttpResponseMessage DeletePuArrivalVouch([FromBody]object JsonData)
{
log.Info("接口:api/CreatePuArrivalVouch/Delete");
log.Info("删除拒收单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
CreatePuArrivalVouch action = new CreatePuArrivalVouch();
string resultStr = action.Delete(infos);
if (resultStr.Length > 0)
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除拒收单返回值:" + str);
return result;
}
#endregion
#region 采购入库单
///
/// 获取采购入库单
///
///
///
[Route("api/PurchaseReceiveDoc/Get")]
[HttpPost]
public HttpResponseMessage GetRdRecord01([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseReceiveDoc/Get");
log.Info("获取采购入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
PurchaseReceiveDoc action = new PurchaseReceiveDoc();
string resultStr = action.Get(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取采购入库单返回值:" + str);
return result;
}
///
/// 创建采购入库单(源头单据采购订单)
///
///
///
[Route("api/PurchaseReceiveDoc/Create")]
[HttpPost]
public HttpResponseMessage CreateRdRecord01([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseReceiveDoc/Create");
log.Info("创建采购入库单(源头单据采购订单)传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
throw new Exception(res.Message);
}
PurchaseReceiveDoc action = new PurchaseReceiveDoc();
string resultStr = action.CreateRdRecord01sByPO(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Data = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建采购入库单(源头单据采购订单)返回值:" + str);
return result;
}
///
/// 创建采购入库单(源头单据到货单)
///
///
///
[Route("api/PurchaseReceiveDocPOArrive/Create")]
[HttpPost]
public HttpResponseMessage CreateRdRecord01ByPOArrive([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseReceiveDocPOArrive/Create");
log.Info("创建采购入库单(源头单据到货单)传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
throw new Exception(res.Message);
}
PurchaseReceiveDoc action = new PurchaseReceiveDoc();
string resultStr = action.CreateRdRecord01sByPOArrive(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Data = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建采购入库单(源头单据到货单)返回值:" + str);
return result;
}
///
/// 审核采购入库单
///
///
///
[Route("api/PurchaseReceiveDoc/Approve")]
[HttpPost]
public HttpResponseMessage ApproveRdRecord01([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseReceiveDoc/Approve");
log.Info("审核采购入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
PurchaseReceiveDoc action = new PurchaseReceiveDoc();
string resultStr = action.Approve(infos);
if (resultStr.Length > 0)
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核采购入库单返回值:" + str);
return result;
}
///
/// 删除采购入库单
///
///
///
[Route("api/PurchaseReceiveDoc/Delete")]
[HttpPost]
public HttpResponseMessage DeleteRdRecord01([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseReceiveDoc/Delete");
log.Info("删除采购入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
PurchaseReceiveDoc action = new PurchaseReceiveDoc();
string resultStr = action.Delete(infos);
if (resultStr.Length > 0)
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除采购入库单返回值:" + str);
return result;
}
#endregion
#region 采购退货单
///
/// 创建物料检验单
///
///
///
[Route("api/PurchaseReturnBack/Get")]
[HttpPost]
public HttpResponseMessage GETPurchaseReturnBack([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseReturnBack/Get");
log.Info("创建物料检验单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
PurchaseReturnBack action = new PurchaseReturnBack();
string resultStr = action.Get(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建物料检验单返回值:" + str);
return result;
}
#endregion
#region 采购红字入库单
///
/// 获取采购红字入库单
///
///
///
[Route("api/PurchaseReceiveDoctNegative/Get")]
[HttpPost]
public HttpResponseMessage GetPurchaseReceiveDoctNegative([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseReceiveDoctNegative/Get");
log.Info("获取采购红字入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
PurchaseReceiveDoctNegative action = new PurchaseReceiveDoctNegative();
string resultStr = action.Get(infos);
if (resultStr.Length > 0)
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取采购红字入库单返回值:" + str);
return result;
}
///
/// 创建采购红字入库单
///
///
///
[Route("api/PurchaseReceiveDoctNegative/Create")]
[HttpPost]
public HttpResponseMessage CreatePurchaseReceiveDoctNegative([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseReceiveDoctNegative/Create");
log.Info("创建采购红字入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
throw new Exception(res.Message);
}
PurchaseReceiveDoctNegative action = new PurchaseReceiveDoctNegative();
string resultStr = action.CreatePurchaseReceiveDoctNegative(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Data = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建采购红字入库单返回值:" + str);
return result;
}
///
/// 审核采购红字入库单
///
///
///
[Route("api/PurchaseReceiveDoctNegative/Approve")]
[HttpPost]
public HttpResponseMessage ApprovePurchaseReceiveDoctNegative([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseReceiveDoctNegative/Approve");
log.Info("审核采购红字入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
PurchaseReceiveDoctNegative action = new PurchaseReceiveDoctNegative();
bool resultStr = action.Approve(infos);
if (resultStr==true)
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核采购红字入库单返回值:" + str);
return result;
}
///
/// 删除采购红字入库单
///
///
///
[Route("api/PurchaseReceiveDoctNegative/Delete")]
[HttpPost]
public HttpResponseMessage DeletePurchaseReceiveDoctNegative([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseReceiveDoctNegative/Delete");
log.Info("删除采购红字入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
PurchaseReceiveDoctNegative action = new PurchaseReceiveDoctNegative();
string resultStr = action.Delete(infos);
if (resultStr.Length > 0)
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除采购红字入库单返回值:" + str);
return result;
}
#endregion
#region 生产订单
///
/// 获取采购订单
///
///
///
[Route("api/ManufactureOrder/Get")]
[HttpPost]
public HttpResponseMessage GetManufactureOrder([FromBody]object JsonData)
{
log.Info("接口:api/ManufactureOrder/Get");
log.Info("获取采购订单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
ManufactureOrder action = new ManufactureOrder();
string resultStr = action.GET(infos);
if (resultStr.Length > 0)
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取采购订单返回值:" + str);
return result;
}
///
/// 创建生产订单
///
///
///
[Route("api/ManufactureOrder/Create")]
[HttpPost]
public HttpResponseMessage CreateManufactureOrder([FromBody]object JsonData)
{
log.Info("接口:api/ManufactureOrder/Create");
log.Info("创建生产订单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
throw new Exception(res.Message);
}
ManufactureOrder action = new ManufactureOrder();
string resultStr = action.CreateManufactureOrder(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Data = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建生产订单返回值:" + str);
return result;
}
///
/// 删除生产订单
///
///
///
[Route("api/ManufactureOrder/Delete")]
[HttpPost]
public HttpResponseMessage DeleteManufactureOrder([FromBody]object JsonData)
{
log.Info("接口:api/ManufactureOrder/Delete");
log.Info("删除生产订单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
ManufactureOrder action = new ManufactureOrder();
string resultStr = action.Delete(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
//res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除生产订单返回值:" + str);
return result;
}
#endregion
#region 生产订单备料表
#endregion
#region 领料申请单
///
/// 创建入库单
///
///
///
[Route("api/MOIssueApplyDoc/Get")]
[HttpPost]
public HttpResponseMessage GetMOIssueApplyDoc([FromBody]object JsonData)
{
log.Info("接口:api/MOIssueApplyDoc/Get");
log.Info("创建入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
MOIssueApplyDoc action = new MOIssueApplyDoc();
string resultStr = action.Get(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建入库单返回值:" + str);
return result;
}
#endregion
#region 材料出库
///
/// 获取材料出库
///
///
///
[Route("api/MOIssueDoc/Get")]
[HttpPost]
public HttpResponseMessage GetMOIssueDoc([FromBody]object JsonData)
{
log.Info("接口:api/MOIssueDoc/Get");
log.Info("获取材料出库传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
MOIssueDoc action = new MOIssueDoc();
string resultStr = action.Get(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取材料出库返回值:" + str);
return result;
}
///
/// 创建材料出库(生产订单)
///
///
///
[Route("api/MOIssueDoc/Create")]
[HttpPost]
public HttpResponseMessage CreateMOIssueDoc([FromBody]object JsonData)
{
log.Info("接口:api/MOIssueDoc/Create");
log.Info("创建材料出库(生产订单)传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
MOIssueDoc action = new MOIssueDoc();
string resultStr = action.CreateRd11(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建材料出库(生产订单)返回值:" + str);
return result;
}
///
/// 创建材料出库(领料申请)
///
///
///
[Route("api/MOIssueDocByPU/Create")]
[HttpPost]
public HttpResponseMessage CreateMOIssueDocBYPU([FromBody]object JsonData)
{
log.Info("接口:api/MOIssueDocByPU/Create");
log.Info("创建材料出库(领料申请)传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
MOIssueDoc action = new MOIssueDoc();
string resultStr = action.MaterialAppVouchs(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建材料出库(领料申请)返回值:" + str);
return result;
}
///
/// 审核材料出库(生产订单)
///
///
///
[Route("api/MOIssueDoc/Approve")]
[HttpPost]
public HttpResponseMessage ApproveMOIssueDoc([FromBody]object JsonData)
{
log.Info("接口:api/MOIssueDoc/Approve");
log.Info("审核材料出库(生产订单)传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
MOIssueDoc action = new MOIssueDoc();
string resultStr = action.Approve(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核材料出库(生产订单)返回值:" + str);
return result;
}
///
/// 删除材料出库(备料表)
///
///
///
[Route("api/MOIssueDoc/Delete")]
[HttpPost]
public HttpResponseMessage DeleteMOIssueDoc([FromBody]object JsonData)
{
log.Info("接口:api/MOIssueDoc/Delete");
log.Info("删除材料出库(备料表)传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
MOIssueDoc action = new MOIssueDoc();
string resultStr = action.Delete(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除材料出库(备料表)返回值:" + str);
return result;
}
#endregion
#region 生产退料单(红字材料出库)
///
/// 获取生产退料单
///
///
///
[Route("api/MOIssueDocNegative/Get")]
[HttpPost]
public HttpResponseMessage GetMOIssueDocNegatives([FromBody]object JsonData)
{
log.Info("接口:api/MOIssueDocNegative/Get");
log.Info("获取生产退料单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
MOIssueDocNegatives action = new MOIssueDocNegatives();
string resultStr = action.Get(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取生产退料单返回值:" + str);
return result;
}
///
/// 创建生产退料单
///
///
///
[Route("api/MOIssueDocNegative/Create")]
[HttpPost]
public HttpResponseMessage CreateMOIssueDocNegatives([FromBody]object JsonData)
{
log.Info("接口:api/MOIssueDocNegative/Create");
log.Info("创建生产退料单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
MOIssueDocNegatives action = new MOIssueDocNegatives();
string resultStr = action.CreateRd11(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建生产退料单返回值:" + str);
return result;
}
///
/// 审核生产退料单
///
///
///
[Route("api/MOIssueDocNegative/Approve")]
[HttpPost]
public HttpResponseMessage ApproveMOIssueDocNegatives([FromBody]object JsonData)
{
log.Info("接口:api/MOIssueDocNegative/Approve");
log.Info("审核生产退料单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
MOIssueDocNegatives action = new MOIssueDocNegatives();
string resultStr = action.Approve(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核生产退料单返回值:" + str);
return result;
}
///
/// 删除生产退料单
///
///
///
[Route("api/MOIssueDocNegative/Delete")]
[HttpPost]
public HttpResponseMessage DeleteMOIssueDocNegatives([FromBody]object JsonData)
{
log.Info("接口:api/MOIssueDocNegative/Delete");
log.Info("删除生产退料单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
MOIssueDocNegatives action = new MOIssueDocNegatives();
string resultStr = action.Delete(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除生产退料单返回值:" + str);
return result;
}
#endregion
#region 委外订单
///
/// 获取委外订单
///
///
///
[Route("api/OutsourcingOrder/Get")]
[HttpPost]
public HttpResponseMessage GetOutsourcingOrder([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingOrder/Get");
log.Info("获取委外订单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
OutsourcingOrder action = new OutsourcingOrder();
string resultStr = action.Get(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取委外订单返回值:" + str);
return result;
}
#endregion
#region 委外订单备料表
///
/// 获取委外订单备料表
///
///
///
[Route("api/OutsourcingOrderPick/Get")]
[HttpPost]
public HttpResponseMessage GetOutsourcingOrderPick([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingOrderPick/Get");
log.Info("获取委外订单备料表传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
OutsourcingOrderPick action = new OutsourcingOrderPick();
string resultStr = action.Get(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取委外订单备料表返回值:" + str);
return result;
}
#endregion
#region 委外发料
///
/// 获取委外发料
///
///
///
[Route("api/OutsourcingIssueDoc/Get")]
[HttpPost]
public HttpResponseMessage GetOutsourcingIssueDoc([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingIssueDoc/Get");
log.Info("获取委外发料传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
OutsourcingIssueDoc action = new OutsourcingIssueDoc();
string resultStr = action.Get(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取委外发料返回值:" + str);
return result;
}
///
/// 创建委外发料单
///
///
///
[Route("api/OutsourcingIssueDoc/Create")]
[HttpPost]
public HttpResponseMessage CreateOutsourcingIssueDoc([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingIssueDoc/Create");
log.Info("创建委外发料单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
OutsourcingIssueDoc action = new OutsourcingIssueDoc();
string resultStr = action.CreateOutsourcingIssueDoc(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建委外发料单返回值:" + str);
return result;
}
///
/// 审核委外发料单
///
///
///
[Route("api/OutsourcingIssueDoc/Approve")]
[HttpPost]
public HttpResponseMessage ApproveOutsourcingIssueDoc([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingIssueDoc/Approve");
log.Info("审核委外发料单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
OutsourcingIssueDoc action = new OutsourcingIssueDoc();
string resultStr = action.Approve(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核委外发料单返回值:" + str);
return result;
}
///
/// 删除委外发料单
///
///
///
[Route("api/OutsourcingIssueDoc/Delete")]
[HttpPost]
public HttpResponseMessage DeleteOutsourcingIssueDoc([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingIssueDoc/Delete");
log.Info("删除委外发料单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
OutsourcingIssueDoc action = new OutsourcingIssueDoc();
string resultStr = action.Delete(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除委外发料单返回值:" + str);
return result;
}
#endregion
#region 委外退料
///
/// 获取委外退料
///
///
///
[Route("api/OutsourcingIssueDoNegative/Get")]
[HttpPost]
public HttpResponseMessage GetOutsourcingIssueDoNegative([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingIssueDoNegative/Get");
log.Info("获取委外退料传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
OutsourcingIssueDoNegative action = new OutsourcingIssueDoNegative();
string resultStr = action.Get(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取委外退料返回值:" + str);
return result;
}
///
/// 创建委外退料
///
///
///
[Route("api/OutsourcingIssueDoNegative/Create")]
[HttpPost]
public HttpResponseMessage CreateOutsourcingIssueDoNegative([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingIssueDoNegative/Create");
log.Info("创建委外退料传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
OutsourcingIssueDoNegative action = new OutsourcingIssueDoNegative();
string resultStr = action.CreateOutsourcingIssueDoNegative(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建委外退料返回值:" + str);
return result;
}
///
/// 审核委外退料
///
///
///
[Route("api/OutsourcingIssueDoNegative/Approve")]
[HttpPost]
public HttpResponseMessage ApproveOutsourcingIssueDoNegative([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingIssueDoNegative/Approve");
log.Info("审核委外退料传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
OutsourcingIssueDoNegative action = new OutsourcingIssueDoNegative();
string resultStr = action.Approve(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核委外退料返回值:" + str);
return result;
}
///
/// 删除委外退料
///
///
///
[Route("api/OutsourcingIssueDoNegative/Delete")]
[HttpPost]
public HttpResponseMessage DeleteOutsourcingIssueDoNegative([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingIssueDoNegative/Delete");
log.Info("删除委外退料传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
OutsourcingIssueDoNegative action = new OutsourcingIssueDoNegative();
string resultStr = action.Delete(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除委外退料返回值:" + str);
return result;
}
#endregion
#region 委外到货单
///
/// 获取委外到货单
///
///
///
[Route("api/DeliveryNotice/Get")]
[HttpPost]
public HttpResponseMessage GetDeliveryNotice([FromBody]object JsonData)
{
log.Info("接口:api/DeliveryNotice/Get");
log.Info("获取委外到货单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
DeliveryNotice action = new DeliveryNotice();
string resultStr = action.Get(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取委外到货单返回值:" + str);
return result;
}
///
/// 创建委外到货单
///
///
///
[Route("api/DeliveryNotice/Create")]
[HttpPost]
public HttpResponseMessage CreateDeliveryNotice([FromBody]object JsonData)
{
log.Info("接口:api/DeliveryNotice/Create");
log.Info("创建委外到货单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
throw new Exception(res.Message);
}
DeliveryNotice action = new DeliveryNotice();
string resultStr = action.CreatePUArrive(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建委外到货单返回值:" + str);
return result;
}
///
/// 审核委外到货
///
///
///
[Route("api/DeliveryNotice/Approve")]
[HttpPost]
public HttpResponseMessage ApproveDeliveryNotice([FromBody]object JsonData)
{
log.Info("接口:api/DeliveryNotice/Approve");
log.Info("审核委外到货传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
DeliveryNotice action = new DeliveryNotice();
string resultStr = action.Approve(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核委外到货返回值:" + str);
return result;
}
///
/// 删除委外到货单
///
///
///
[Route("api/DeliveryNotice/Delete")]
[HttpPost]
public HttpResponseMessage DeleteDeliveryNotice([FromBody]object JsonData)
{
log.Info("接口:api/DeliveryNotice/Delete");
log.Info("删除委外到货单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
DeliveryNotice action = new DeliveryNotice();
string resultStr = action.Delete(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除委外到货单返回值:" + str);
return result;
}
#endregion
#region 委外采购入库单
///
/// 获取委外采购入库单
///
///
///
[Route("api/OutsourcingReceiveDoc/Get")]
[HttpPost]
public HttpResponseMessage GetOutsourcingReceiveDoc([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingReceiveDoc/Get");
log.Info("获取委外采购入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
OutsourcingReceiveDoc action = new OutsourcingReceiveDoc();
string resultStr = action.Get(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取委外采购入库单返回值:" + str);
return result;
}
///
/// 创建委外采购入库单
///
///
///
[Route("api/OutsourcingReceiveDocPOArrive/Create")]
[HttpPost]
public HttpResponseMessage CreateOutsourcingReceiveDoc([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingReceiveDocPOArrive/Create");
log.Info("创建委外采购入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
throw new Exception(res.Message);
}
OutsourcingReceiveDoc action = new OutsourcingReceiveDoc();
string resultStr = action.CreateOutsourcingReceiveDocByPOArrive(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Data = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建委外采购入库单返回值:" + str);
return result;
}
[Route("api/OutsourcingReceiveDoc/Create")]
[HttpPost]
public HttpResponseMessage CreateOutsourcingReceiveDocPO([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingReceiveDoc/Create");
log.Info("创建委外采购入(委外到货单)传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
throw new Exception(res.Message);
}
OutsourcingReceiveDoc action = new OutsourcingReceiveDoc();
string resultStr = action.CreateOutsourcingReceiveDocByPO(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Data = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建委外采购入(委外到货单)返回值:" + str);
return result;
}
///
/// 审核委外采购入库单
///
///
///
[Route("api/OutsourcingReceiveDoc/Approve")]
[HttpPost]
public HttpResponseMessage ApproveOutsourcingReceiveDoc([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingReceiveDoc/Approve");
log.Info("审核委外采购入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
OutsourcingReceiveDoc action = new OutsourcingReceiveDoc();
string resultStr = action.Approve(infos);
if (resultStr.Length > 0)
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核委外采购入库单返回值:" + str);
return result;
}
///
/// 删除采购入库单
///
///
///
[Route("api/PurchaseReceiveDoc/Delete")]
[HttpPost]
public HttpResponseMessage DeleteOutsourcingReceiveDoc([FromBody]object JsonData)
{
log.Info("接口:api/PurchaseReceiveDoc/Delete");
log.Info("删除采购入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
PurchaseReceiveDoc action = new PurchaseReceiveDoc();
string resultStr = action.Delete(infos);
if (resultStr.Length > 0)
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除采购入库单返回值:" + str);
return result;
}
#endregion
#region 委外采购退货单
///
/// 获取委外采购退货单
///
///
///
[Route("api/OutsourcingReturnBack/Get")]
[HttpPost]
public HttpResponseMessage GETOutsourcingReturnBack([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingReturnBack/Get");
log.Info("获取委外采购退货单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
OutsourcingReturnBack action = new OutsourcingReturnBack();
string resultStr = action.Get(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取委外采购退货单返回值:" + str);
return result;
}
#endregion
#region 委外采购入库红字
///
/// 获取委外采购入库单
///
///
///
[Route("api/OutsourcingReceiveDocNegative/Get")]
[HttpPost]
public HttpResponseMessage GetOutsourcingReceiveDocNegative([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingReceiveDocNegative/Get");
log.Info("获取委外采购入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
OutsourcingReceiveDocNegative action = new OutsourcingReceiveDocNegative();
string resultStr = action.Get(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取委外采购入库单返回值:" + str);
return result;
}
///
/// 创建委外采购入库单
///
///
///
[Route("api/OutsourcingReceiveDocNegative/Create")]
[HttpPost]
public HttpResponseMessage CreateOutsourcingReceiveDocNegative([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingReceiveDocNegative/Create");
log.Info("创建委外采购入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
throw new Exception(res.Message);
}
OutsourcingReceiveDocNegative action = new OutsourcingReceiveDocNegative();
string resultStr = action.CreateOutsourcingReceiveDocNegative(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Data = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建委外采购入库单返回值:" + str);
return result;
}
///
/// 审核委外采购入库单
///
///
///
[Route("api/OutsourcingReceiveDocNegative/Approve")]
[HttpPost]
public HttpResponseMessage ApproveOutsourcingReceiveDocNegative([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingReceiveDocNegative/Approve");
log.Info("审核委外采购入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
PurchaseReceiveDoctNegative action = new PurchaseReceiveDoctNegative();
bool resultStr = action.Approve(infos);
if (resultStr == true)
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核委外采购入库单返回值:" + str);
return result;
}
///
/// 删除采购入库单
///
///
///
[Route("api/OutsourcingReceiveDocNegative/Delete")]
[HttpPost]
public HttpResponseMessage DeleteOutsourcingReceiveDocNegative([FromBody]object JsonData)
{
log.Info("接口:api/OutsourcingReceiveDocNegative/Delete");
log.Info("删除采购入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
OutsourcingReceiveDocNegative action = new OutsourcingReceiveDocNegative();
string resultStr = action.Delete(infos);
if (string.IsNullOrEmpty(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = "接口调用失败";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除采购入库单返回值:" + str);
return result;
}
#endregion
#region 成品入库单
///
/// 获取成品入库单
///
///
///
[Route("api/ManufactureReceiveDoc/Get")]
[HttpPost]
public HttpResponseMessage GetManufactureReceiveDoc([FromBody]object JsonData)
{
log.Info("接口:api/ManufactureReceiveDoc/Get");
log.Info("获取成品入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
ManufactureReceiveDoc action = new ManufactureReceiveDoc();
string resultStr = action.Get(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取成品入库单返回值:" + str);
return result;
}
///
/// 创建成品入库单
///
///
///
[Route("api/ManufactureReceiveDoc/Create")]
[HttpPost]
public HttpResponseMessage CreateManufactureReceiveDoc([FromBody]object JsonData)
{
log.Info("接口:api/ManufactureReceiveDoc/Create");
log.Info("创建成品入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
ManufactureReceiveDoc action = new ManufactureReceiveDoc();
string resultStr = action.CreateManufactureReceiveDoc(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建成品入库单返回值:" + str);
return result;
}
///
/// 连副产品入库
///
///
///
[Route("api/ManufactureLFReceiveDoc/Create")]
[HttpPost]
public HttpResponseMessage CreateManufactureLFReceiveDoc([FromBody]object JsonData)
{
log.Info("接口:api/ManufactureLFReceiveDoc/Create");
log.Info("创建连副产品入库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
ManufactureReceiveDoc action = new ManufactureReceiveDoc();
string resultStr = action.CreateManufactureReceiveDoc1(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建连副产品入库单返回值:" + str);
return result;
}
///
/// 审核委外退料单
///
///
///
[Route("api/ManufactureReceiveDoc/Approve")]
[HttpPost]
public HttpResponseMessage ApproveManufactureReceiveDoc([FromBody]object JsonData)
{
log.Info("接口:api/ManufactureReceiveDoc/Approve");
log.Info("审核委外退料单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
ManufactureReceiveDoc action = new ManufactureReceiveDoc();
bool resultStr = action.Approve(infos);
if (resultStr == false)
{
res.Success = false;
res.Message = "接口调用失败!";
}
else
{
res.Success = true;
res.Message = "接口调用成功!";
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核委外退料单返回值:" + str);
return result;
}
///
/// 删除委外退料单
///
///
///
[Route("api/ManufactureReceiveDoc/Delete")]
[HttpPost]
public HttpResponseMessage DeleteManufactureReceiveDoc([FromBody]object JsonData)
{
log.Info("接口:api/ManufactureReceiveDoc/Delete");
log.Info("删除委外退料单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
ManufactureReceiveDoc action = new ManufactureReceiveDoc();
string resultStr = action.Delete(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除委外退料单返回值:" + str);
return result;
}
#endregion
#region 销售出库
///
/// 获取销售出库单
///
///
///
[Route("api/SalesShipmentDoc/Get")]
[HttpPost]
public HttpResponseMessage GetSalesShipmentDoc([FromBody]object JsonData)
{
log.Info("接口:api/SalesShipmentDoc/Get");
log.Info("获取销售出库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
SalesShipmentDoc action = new SalesShipmentDoc();
string resultStr = action.Get(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取销售出库单返回值:" + str);
return result;
}
///
/// 创建销售出库单
///
///
///
[Route("api/SalesShipmentDoc/Create")]
[HttpPost]
public HttpResponseMessage CreateSalesShipmentDoc([FromBody]object JsonData)
{
log.Info("接口:api/SalesShipmentDoc/Create");
log.Info("创建销售出库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
SalesShipmentDoc action = new SalesShipmentDoc();
string resultStr = action.CreateSalesShipmentDoc(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建销售出库单返回值:" + str);
return result;
}
///
/// 审核销售出库单
///
///
///
[Route("api/SalesShipmentDoc/Approve")]
[HttpPost]
public HttpResponseMessage ApproveSalesShipmentDoc([FromBody]object JsonData)
{
log.Info("接口:api/SalesShipmentDoc/Approve");
log.Info("审核销售出库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
SalesShipmentDoc action = new SalesShipmentDoc();
string resultStr = action.Approve(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核销售出库单返回值:" + str);
return result;
}
///
/// 删除销售出库单
///
///
///
[Route("api/SalesShipmentDoc/Delete")]
[HttpPost]
public HttpResponseMessage DeleteSalesShipmentDoc([FromBody]object JsonData)
{
log.Info("接口:api/SalesShipmentDoc/Delete");
log.Info("删除销售出库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
SalesShipmentDoc action = new SalesShipmentDoc();
string resultStr = action.Delete(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除销售出库单返回值:" + str);
return result;
}
#endregion
#region 销售出库红字
///
/// 获取销售出库单红字
///
///
///
[Route("api/SalesShipmentDocNegative/Get")]
[HttpPost]
public HttpResponseMessage GetSalesShipmentDocNegative([FromBody]object JsonData)
{
log.Info("接口:api/SalesShipmentDocNegative/Get");
log.Info("获取销售出库单红字传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
SalesShipmentDocNegative action = new SalesShipmentDocNegative();
string resultStr = action.Get(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取销售出库单红字返回值:" + str);
return result;
}
///
/// 创建销售出库单
///
///
///
[Route("api/SalesShipmentDocNegative/Create")]
[HttpPost]
public HttpResponseMessage CreateSalesShipmentDocNegative([FromBody]object JsonData)
{
log.Info("接口:api/SalesShipmentDocNegative/Create,");
log.Info("创建销售出库单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
SalesShipmentDocNegative action = new SalesShipmentDocNegative();
string resultStr = action.CreateSalesShipmentDocNegative(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建销售出库单返回值:" + str);
return result;
}
///
/// 审核销售出库单红字
///
///
///
[Route("api/SalesShipmentDocNegative/Approve")]
[HttpPost]
public HttpResponseMessage ApproveSalesShipmentDocNegative([FromBody]object JsonData)
{
log.Info("接口:api/SalesShipmentDocNegative/Approve");
log.Info("审核销售出库单红字传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
SalesShipmentDocNegative action = new SalesShipmentDocNegative();
string resultStr = action.Approve(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核销售出库单红字返回值:" + str);
return result;
}
///
/// 删除销售出库单红字
///
///
///
[Route("api/SalesShipmentDocNegative/Delete")]
[HttpPost]
public HttpResponseMessage DeleteSalesShipmentDocNegative([FromBody]object JsonData)
{
log.Info("接口:api/SalesShipmentDocNegative/Delete");
log.Info("删除销售出库单红字传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
SalesShipmentDocNegative action = new SalesShipmentDocNegative();
string resultStr = action.Delete(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除销售出库单红字返回值:" + str);
return result;
}
#endregion
#region 销售订单
///
/// 获取销售订单
///
///
///
[Route("api/SalesOrder/Get")]
[HttpPost]
public HttpResponseMessage GetSalesOrder([FromBody]object JsonData)
{
log.Info("接口:api/SalesOrder/Get");
log.Info("获取销售订单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
SalesOrder action = new SalesOrder();
string resultStr = action.Get(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取销售订单返回值:" + str);
return result;
}
///
/// 创建销售订单
///
///
///
[Route("api/SalesOrder/Create")]
[HttpPost]
public HttpResponseMessage CreateSalesOrder([FromBody]object JsonData)
{
log.Info("接口:api/SalesOrder/Create");
log.Info("创建销售订单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
SalesOrder action = new SalesOrder();
string resultStr = action.CerateSalesOrder(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建销售订单返回值:" + str);
return result;
}
///
/// 审核销售订单
///
///
///
[Route("api/SalesOrder/Approve")]
[HttpPost]
public HttpResponseMessage ApproveSalesOrder([FromBody]object JsonData)
{
log.Info("接口:api/SalesOrder/Approve");
log.Info("审核销售订单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
SalesOrder action = new SalesOrder();
string resultStr = action.Approve(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核销售订单返回值:" + str);
return result;
}
///
/// 删除销售订单
///
///
///
[Route("api/SalesOrder/Delete")]
[HttpPost]
public HttpResponseMessage DeleteSalesOrder([FromBody]object JsonData)
{
log.Info("接口:api/SalesOrder/Delete");
log.Info("删除销售订单传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
SalesOrder action = new SalesOrder();
string resultStr = action.Delete(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("删除销售订单返回值:" + str);
return result;
}
#endregion
#region 销售发货
///
/// 获取销售发货
///
///
///
[Route("api/SalesDeliveryNotice/Get")]
[HttpPost]
public HttpResponseMessage GetSalesDeliveryNotice([FromBody]object JsonData)
{
log.Info("接口:api/SalesDeliveryNotice/Get");
log.Info("获取销售发货传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
SalesDeliveryNotice action = new SalesDeliveryNotice();
string resultStr = action.Get(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取销售发货返回值:" + str);
return result;
}
///
/// 创建销售发货
///
///
///
[Route("api/SalesDeliveryNotice/Create")]
[HttpPost]
public HttpResponseMessage CreateSalesDeliveryNotice([FromBody]object JsonData)
{
log.Info("接口:api/SalesDeliveryNotice/Create");
log.Info("创建销售发货传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
SalesDeliveryNotice action = new SalesDeliveryNotice();
string resultStr = action.CerateSalesDeliveryNotice(infos);
if (!string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
res.Data = resultStr;
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("创建销售发货返回值:" + str);
return result;
}
///
/// 审核销售发货
///
///
///
[Route("api/SalesDeliveryNotice/Approve")]
[HttpPost]
public HttpResponseMessage ApproveSalesDeliveryNotice([FromBody]object JsonData)
{
log.Info("接口:api/SalesDeliveryNotice/Approve");
log.Info("审核销售发货传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject>(JsonData.ToString());
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = "JSON格式不正确!";
}
SalesDeliveryNotice action = new SalesDeliveryNotice();
string resultStr = action.Approve(infos);
if (string.IsNullOrWhiteSpace(resultStr))
{
res.Success = true;
res.Message = "接口调用成功!";
}
else
{
res.Success = false;
res.Message = resultStr;
}
}
catch (Exception ex)
{
log.Error("调用后台失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
}
else
{
res.Success = false;
res.Message = "请传入参数";
}
}
catch (Exception ex)
{
log.Error("参数检验失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("审核销售发货返回值:" + str);
return result;
}
///
/// 删除销售发货
///
///
///
[Route("api/SalesDeliveryNotice/Delete")]
[HttpPost]
public HttpResponseMessage DeleteSalesDeliveryNotice([FromBody]object JsonData)
{
log.Info("接口:api/SalesDeliveryNotice/Delete");
log.Info("删除销售发货传入值:" + JsonData);
HttpResponseMessage result = new HttpResponseMessage();
Result res = new Result();
string str = string.Empty;
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
try
{
List infos = new List();
try
{
infos = JsonConvert.DeserializeObject