|
|
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 请购单
/// <summary>
/// 获取请购单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseRequisition> infos = new List<ICSPurchaseRequisition>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseRequisition>>(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; } /// <summary>
/// 创建请购单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseRequisition> infos = new List<ICSPurchaseRequisition>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseRequisition>>(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; } /// <summary>
/// 审核请购单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseRequisition> infos = new List<ICSPurchaseRequisition>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseRequisition>>(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; } /// <summary>
/// 删除到货单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseRequisition> infos = new List<ICSPurchaseRequisition>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseRequisition>>(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 采购订单
/// <summary>
/// 获取采购订单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseOrder> infos = new List<ICSPurchaseOrder>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseOrder>>(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; } /// <summary>
/// 创建采购订单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseOrder> infos = new List<ICSPurchaseOrder>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseOrder>>(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; } /// <summary>
/// 审核采购订单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseOrder> infos = new List<ICSPurchaseOrder>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseOrder>>(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; } /// <summary>
/// 删除采购订单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseOrder> infos = new List<ICSPurchaseOrder>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseOrder>>(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 到货单
/// <summary>
/// 获取到货单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPOArrive> infos = new List<ICSPOArrive>(); try { infos = JsonConvert.DeserializeObject<List<ICSPOArrive>>(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; } /// <summary>
/// 创建到货单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPOArrive> infos = new List<ICSPOArrive>(); try { infos = JsonConvert.DeserializeObject<List<ICSPOArrive>>(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; } /// <summary>
/// 审核到货单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPOArrive> infos = new List<ICSPOArrive>(); try { infos = JsonConvert.DeserializeObject<List<ICSPOArrive>>(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; } /// <summary>
/// 删除到货单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPOArrive> infos = new List<ICSPOArrive>(); try { infos = JsonConvert.DeserializeObject<List<ICSPOArrive>>(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 拒收单
/// <summary>
/// 获取拒收单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPUArrivalVouch> infos = new List<ICSPUArrivalVouch>(); try { infos = JsonConvert.DeserializeObject<List<ICSPUArrivalVouch>>(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; } /// <summary>
/// 创建拒收单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPUArrivalVouch> infos = new List<ICSPUArrivalVouch>(); try { infos = JsonConvert.DeserializeObject<List<ICSPUArrivalVouch>>(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; } /// <summary>
/// 创建委外拒收单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOPUArrivalVouch> infos = new List<ICSOPUArrivalVouch>(); try { infos = JsonConvert.DeserializeObject<List<ICSOPUArrivalVouch>>(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; } /// <summary>
/// 审核拒收单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPUArrivalVouch> infos = new List<ICSPUArrivalVouch>(); try { infos = JsonConvert.DeserializeObject<List<ICSPUArrivalVouch>>(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; } /// <summary>
/// 删除拒收单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPUArrivalVouch> infos = new List<ICSPUArrivalVouch>(); try { infos = JsonConvert.DeserializeObject<List<ICSPUArrivalVouch>>(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 采购入库单
/// <summary>
/// 获取采购入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(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; } /// <summary>
/// 创建采购入库单(源头单据采购订单)
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(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; } /// <summary>
/// 创建采购入库单(源头单据到货单)
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(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; } /// <summary>
/// 审核采购入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(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; } /// <summary>
/// 删除采购入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(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 采购退货单
/// <summary>
/// 创建物料检验单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseReturnBack> infos = new List<ICSPurchaseReturnBack>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseReturnBack>>(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 采购红字入库单
/// <summary>
/// 获取采购红字入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(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; } /// <summary>
/// 创建采购红字入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(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; } /// <summary>
/// 审核采购红字入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(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; } /// <summary>
/// 删除采购红字入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(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 生产订单
/// <summary>
/// 获取采购订单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSManufactureOrder> infos = new List<ICSManufactureOrder>(); try { infos = JsonConvert.DeserializeObject<List<ICSManufactureOrder>>(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; } /// <summary>
/// 创建生产订单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSManufactureOrder> infos = new List<ICSManufactureOrder>(); try { infos = JsonConvert.DeserializeObject<List<ICSManufactureOrder>>(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; }
/// <summary>
/// 删除生产订单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSManufactureOrder> infos = new List<ICSManufactureOrder>(); try { infos = JsonConvert.DeserializeObject<List<ICSManufactureOrder>>(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 领料申请单
/// <summary>
/// 创建入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSMaterialAppVouch> infos = new List<ICSMaterialAppVouch>(); try { infos = JsonConvert.DeserializeObject<List<ICSMaterialAppVouch>>(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 材料出库
/// <summary>
/// 获取材料出库
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSRdrecord11> infos = new List<ICSRdrecord11>(); try { infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(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; } /// <summary>
/// 创建材料出库(生产订单)
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSRdrecord11> infos = new List<ICSRdrecord11>(); try { infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(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; } /// <summary>
/// 创建材料出库(领料申请)
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSRdrecord11> infos = new List<ICSRdrecord11>(); try { infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(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; } /// <summary>
/// 审核材料出库(生产订单)
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSRdrecord11> infos = new List<ICSRdrecord11>(); try { infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(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; } /// <summary>
/// 删除材料出库(备料表)
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSRdrecord11> infos = new List<ICSRdrecord11>(); try { infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(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 生产退料单(红字材料出库)
/// <summary>
/// 获取生产退料单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSMOIssueDocNegative> infos = new List<ICSMOIssueDocNegative>(); try { infos = JsonConvert.DeserializeObject<List<ICSMOIssueDocNegative>>(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; } /// <summary>
/// 创建生产退料单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSMOIssueDocNegative> infos = new List<ICSMOIssueDocNegative>(); try { infos = JsonConvert.DeserializeObject<List<ICSMOIssueDocNegative>>(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; }
/// <summary>
/// 审核生产退料单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSMOIssueDocNegative> infos = new List<ICSMOIssueDocNegative>(); try { infos = JsonConvert.DeserializeObject<List<ICSMOIssueDocNegative>>(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; } /// <summary>
/// 删除生产退料单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSMOIssueDocNegative> infos = new List<ICSMOIssueDocNegative>(); try { infos = JsonConvert.DeserializeObject<List<ICSMOIssueDocNegative>>(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 委外订单
/// <summary>
/// 获取委外订单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOutsourcingOrder> infos = new List<ICSOutsourcingOrder>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingOrder>>(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 委外订单备料表
/// <summary>
/// 获取委外订单备料表
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOutsourcingOrderPick> infos = new List<ICSOutsourcingOrderPick>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingOrderPick>>(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 委外发料
/// <summary>
/// 获取委外发料
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(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; } /// <summary>
/// 创建委外发料单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(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; }
/// <summary>
/// 审核委外发料单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(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; } /// <summary>
/// 删除委外发料单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(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 委外退料
/// <summary>
/// 获取委外退料
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(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; } /// <summary>
/// 创建委外退料
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(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; } /// <summary>
/// 审核委外退料
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(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; } /// <summary>
/// 删除委外退料
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(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 委外到货单
/// <summary>
/// 获取委外到货单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSDeliveryNotice> infos = new List<ICSDeliveryNotice>(); try { infos = JsonConvert.DeserializeObject<List<ICSDeliveryNotice>>(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; } /// <summary>
/// 创建委外到货单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSDeliveryNotice> infos = new List<ICSDeliveryNotice>(); try { infos = JsonConvert.DeserializeObject<List<ICSDeliveryNotice>>(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; } /// <summary>
/// 审核委外到货
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSDeliveryNotice> infos = new List<ICSDeliveryNotice>(); try { infos = JsonConvert.DeserializeObject<List<ICSDeliveryNotice>>(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; } /// <summary>
/// 删除委外到货单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSDeliveryNotice> infos = new List<ICSDeliveryNotice>(); try { infos = JsonConvert.DeserializeObject<List<ICSDeliveryNotice>>(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 委外采购入库单
/// <summary>
/// 获取委外采购入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOutsourcingReceiveDoc> infos = new List<ICSOutsourcingReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDoc>>(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; } /// <summary>
/// 创建委外采购入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOutsourcingReceiveDoc> infos = new List<ICSOutsourcingReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDoc>>(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<ICSOutsourcingReceiveDoc> infos = new List<ICSOutsourcingReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDoc>>(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; } /// <summary>
/// 审核委外采购入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOutsourcingReceiveDoc> infos = new List<ICSOutsourcingReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDoc>>(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; } /// <summary>
/// 删除采购入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(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 委外采购退货单
/// <summary>
/// 获取委外采购退货单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOutsourcingReturnBack> infos = new List<ICSOutsourcingReturnBack>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReturnBack>>(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 委外采购入库红字
/// <summary>
/// 获取委外采购入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOutsourcingReceiveDocNegative> infos = new List<ICSOutsourcingReceiveDocNegative>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDocNegative>>(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; } /// <summary>
/// 创建委外采购入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOutsourcingReceiveDocNegative> infos = new List<ICSOutsourcingReceiveDocNegative>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDocNegative>>(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; } /// <summary>
/// 审核委外采购入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(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; } /// <summary>
/// 删除采购入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSOutsourcingReceiveDocNegative> infos = new List<ICSOutsourcingReceiveDocNegative>(); try { infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDocNegative>>(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 成品入库单
/// <summary>
/// 获取成品入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSManufactureReceiveDoc> infos = new List<ICSManufactureReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSManufactureReceiveDoc>>(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; }
/// <summary>
/// 创建成品入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSManufactureReceiveDoc> infos = new List<ICSManufactureReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSManufactureReceiveDoc>>(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; }
/// <summary>
/// 连副产品入库
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSManufactureReceiveDoc> infos = new List<ICSManufactureReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSManufactureReceiveDoc>>(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; } /// <summary>
/// 审核委外退料单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSManufactureReceiveDoc> infos = new List<ICSManufactureReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSManufactureReceiveDoc>>(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; } /// <summary>
/// 删除委外退料单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSManufactureReceiveDoc> infos = new List<ICSManufactureReceiveDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSManufactureReceiveDoc>>(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 销售出库
/// <summary>
/// 获取销售出库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSSalesShipmentDoc> infos = new List<ICSSalesShipmentDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDoc>>(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; }
/// <summary>
/// 创建销售出库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSSalesShipmentDoc> infos = new List<ICSSalesShipmentDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDoc>>(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; } /// <summary>
/// 审核销售出库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSSalesShipmentDoc> infos = new List<ICSSalesShipmentDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDoc>>(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; } /// <summary>
/// 删除销售出库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSSalesShipmentDoc> infos = new List<ICSSalesShipmentDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDoc>>(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 销售出库红字
/// <summary>
/// 获取销售出库单红字
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSSalesShipmentDocNegative> infos = new List<ICSSalesShipmentDocNegative>(); try { infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDocNegative>>(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; }
/// <summary>
/// 创建销售出库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSSalesShipmentDocNegative> infos = new List<ICSSalesShipmentDocNegative>(); try { infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDocNegative>>(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; } /// <summary>
/// 审核销售出库单红字
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSSalesShipmentDocNegative> infos = new List<ICSSalesShipmentDocNegative>(); try { infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDocNegative>>(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; } /// <summary>
/// 删除销售出库单红字
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSSalesShipmentDocNegative> infos = new List<ICSSalesShipmentDocNegative>(); try { infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDocNegative>>(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 销售订单
/// <summary>
/// 获取销售订单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSSalesOrder> infos = new List<ICSSalesOrder>(); try { infos = JsonConvert.DeserializeObject<List<ICSSalesOrder>>(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; }
/// <summary>
/// 创建销售订单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSSalesOrder> infos = new List<ICSSalesOrder>(); try { infos = JsonConvert.DeserializeObject<List<ICSSalesOrder>>(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; } /// <summary>
/// 审核销售订单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSSalesOrder> infos = new List<ICSSalesOrder>(); try { infos = JsonConvert.DeserializeObject<List<ICSSalesOrder>>(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; } /// <summary>
/// 删除销售订单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSSalesOrder> infos = new List<ICSSalesOrder>(); try { infos = JsonConvert.DeserializeObject<List<ICSSalesOrder>>(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 销售发货
/// <summary>
/// 获取销售发货
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSSalesDeliveryNotice> infos = new List<ICSSalesDeliveryNotice>(); try { infos = JsonConvert.DeserializeObject<List<ICSSalesDeliveryNotice>>(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; }
/// <summary>
/// 创建销售发货
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSSalesDeliveryNotice> infos = new List<ICSSalesDeliveryNotice>(); try { infos = JsonConvert.DeserializeObject<List<ICSSalesDeliveryNotice>>(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; } /// <summary>
/// 审核销售发货
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSSalesDeliveryNotice> infos = new List<ICSSalesDeliveryNotice>(); try { infos = JsonConvert.DeserializeObject<List<ICSSalesDeliveryNotice>>(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; } /// <summary>
/// 删除销售发货
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[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<ICSSalesDeliveryNotice> infos = new List<ICSSalesDeliveryNotice>(); try { infos = JsonConvert.DeserializeObject<List<ICSSalesDeliveryNotice>>(JsonData.ToString()); } catch (Exception ex) { log.Error("转换失败:" + ex.ToString()); res.Success = false; res.Message = "JSON格式不正确!"; } SalesDeliveryNotice action = new SalesDeliveryNotice(); 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 销售退货
/// <summary>
/// 获取销售退货
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[Route("api/SalesReturnBack/Get")] [HttpPost] public HttpResponseMessage GetSalesReturnBack([FromBody]object JsonData) { log.Info("接口:api/SalesReturnBack/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<ICSSalesReturnBack> infos = new List<ICSSalesReturnBack>(); try { infos = JsonConvert.DeserializeObject<List<ICSSalesReturnBack>>(JsonData.ToString()); } catch (Exception ex) { log.Error("转换失败:" + ex.ToString()); res.Success = false; res.Message = "JSON格式不正确!"; } SalesReturnBack action = new SalesReturnBack(); 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 调拨
/// <summary>
/// 审核拆卸单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[Route("api/OneStepTransferDocIn/Approve")] [HttpPost] public HttpResponseMessage TransferDoc([FromBody]object JsonData) { log.Info("接口:api/OneStepTransferDocIn/Approve"); HttpResponseMessage result = new HttpResponseMessage(); Result res = new Result(); string str = string.Empty; try { if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]") { log.Info("\r\n 审核拆卸单 JSON数据:" + JsonData + "\r\n"); try { List<ICSTransferDoc> Bills = new List<ICSTransferDoc>(); try { Bills = JsonConvert.DeserializeObject<List<ICSTransferDoc>>(JsonData.ToString()); } catch (Exception ex) { log.Error("转换失败:" + ex.ToString()); res.Success = false; res.Message = "JSON格式不正确!"; } TransferDoc action = new TransferDoc(); bool flag = action.ConfirmTrans(Bills); if (flag == 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 = "请传入参数"; } str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } catch (Exception ex) { log.Error("参数检验失败:" + ex.ToString()); res.Success = false; res.Message = ex.Message; str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } }
#endregion
/// <summary>
/// 无源头生成调拨单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[Route("api/OneStepTransferDocIn/Create")] [HttpPost] public HttpResponseMessage TransferDocIn([FromBody]object JsonData) { log.Info("接口:api/OneStepTransferDocIn/Create"); HttpResponseMessage result = new HttpResponseMessage(); Result res = new Result(); string str = string.Empty; try { if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]") { log.Info("\r\n 生成调拨单 JSON数据:" + JsonData + "\r\n"); try { List<ICSTransfer> Bills = new List<ICSTransfer>(); try { Bills = JsonConvert.DeserializeObject<List<ICSTransfer>>(JsonData.ToString()); } catch (Exception ex) { log.Error("转换失败:" + ex.ToString()); res.Success = false; res.Message = "JSON格式不正确!"; } TransferDoc action = new TransferDoc();
string resultStr = action.ConfirmTransIN(Bills); if (!string.IsNullOrWhiteSpace(resultStr)) { res.Success = true; res.Message = "接口调用成功!"; res.Data = resultStr; } else { res.Success = false; res.Message = "接口调用失败!"; res.Data = resultStr; }
} catch (Exception ex) { log.Error("调用后台失败:" + ex.ToString()); res.Success = false; res.Message = ex.Message; } } else { res.Success = false; res.Message = "请传入参数"; } str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } catch (Exception ex) { log.Error("参数检验失败:" + ex.ToString()); res.Success = false; res.Message = ex.Message; str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } } #region 审核其他入库单(杂收)
/// <summary>
/// 其他入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[Route("api/OtherInDoc/Approve")] [HttpPost] public HttpResponseMessage APIConfirmRdrecord08([FromBody]object JsonData) { log.Info("接口:api/OtherInDoc/Approve"); HttpResponseMessage result = new HttpResponseMessage(); Result res = new Result(); string str = string.Empty; try { if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]") { log.Info("\r\n 审核其他入库单(杂收) JSON数据:" + JsonData + "\r\n"); try { List<ICSOtherInDoc> Bills = new List<ICSOtherInDoc>(); try { Bills = JsonConvert.DeserializeObject<List<ICSOtherInDoc>>(JsonData.ToString()); } catch (Exception ex) { log.Error("转换失败:" + ex.ToString()); res.Success = false; res.Message = "JSON格式不正确!"; } OtherInDoc action = new OtherInDoc(); bool flag = action.ConfirmRd08(Bills); if (flag == 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 = "请传入参数"; } str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } catch (Exception ex) { log.Error("参数检验失败:" + ex.ToString()); res.Success = false; res.Message = ex.Message; str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } } #endregion
#region 审核其他出库单(杂发)
/// <summary>
/// 审核其他出库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[Route("api/OtherOutDoc/Approve")] [HttpPost] public HttpResponseMessage APIConfirmRdrecord09([FromBody]object JsonData) { log.Info("接口:api/OtherOutDoc/Approve"); HttpResponseMessage result = new HttpResponseMessage(); Result res = new Result(); string str = string.Empty; try { if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]") {
//DBHelper.WriteLogFile("api/OtherOutDoc/Approve "+JsonData.ToString(), "Information");
log.Info("\r\n 审核其他出库单(杂发) JSON数据:" + JsonData + "\r\n"); try { List<ICSOtherOutDoc> Bills = new List<ICSOtherOutDoc>(); try { Bills = JsonConvert.DeserializeObject<List<ICSOtherOutDoc>>(JsonData.ToString()); } catch (Exception ex) { //DBHelper.WriteLogFile("api/OtherOutDoc/Approve " + ex.ToString(), "Information");
log.Error("转换失败:" + ex.ToString()); res.Success = false; res.Message = "JSON格式不正确!"; } OtherOutDoc action = new OtherOutDoc(); bool flag = action.ConfirmRd09(Bills); if (flag == 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 = "请传入参数"; } str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } catch (Exception ex) { log.Error("参数检验失败:" + ex.ToString()); res.Success = false; res.Message = ex.Message; str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } } #endregion
#region 拆卸单
/// <summary>
/// 审核拆卸单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[Route("api/DisassemblyDoc/Approve")] [HttpPost] public HttpResponseMessage APIConfirmDismrecord01([FromBody]object JsonData) { log.Info("接口:api/DisassemblyDoc/Approve"); HttpResponseMessage result = new HttpResponseMessage(); Result res = new Result(); string str = string.Empty; try { if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]") { log.Info("\r\n 审核拆卸单 JSON数据:" + JsonData + "\r\n"); try { List<ICSDisassemblyDoc> Bills = new List<ICSDisassemblyDoc>(); try { Bills = JsonConvert.DeserializeObject<List<ICSDisassemblyDoc>>(JsonData.ToString()); } catch (Exception ex) { log.Error("转换失败:" + ex.ToString()); res.Success = false; res.Message = "JSON格式不正确!"; } DisassemblyDoc action = new DisassemblyDoc(); bool flag = action.Dismrecord01(Bills); if (flag == 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 = "请传入参数"; } str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } catch (Exception ex) { log.Error("参数检验失败:" + ex.ToString()); res.Success = false; res.Message = ex.Message; str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } } #endregion
#region 审核其他入库单(两步调入)
/// <summary>
/// 其他入库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[Route("api/TwoStepTransferDocIn/Approve")] [HttpPost] public HttpResponseMessage APIConfirmRdrecord08Two([FromBody]object JsonData) { log.Info("接口:api/TwoStepTransferDocIn/Approve"); HttpResponseMessage result = new HttpResponseMessage(); Result res = new Result(); string str = string.Empty; try { if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]") { log.Info("\r\n 审核其他入库单(两步调入) JSON数据:" + JsonData + "\r\n"); try { List<ICSOtherInDoc> Bills = new List<ICSOtherInDoc>(); try { Bills = JsonConvert.DeserializeObject<List<ICSOtherInDoc>>(JsonData.ToString()); } catch (Exception ex) { log.Error("转换失败:" + ex.ToString()); res.Success = false; res.Message = "JSON格式不正确!"; } OtherInDoc action = new OtherInDoc(); bool flag = action.ConfirmRd08(Bills); if (flag == 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 = "请传入参数"; } str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } catch (Exception ex) { log.Error("参数检验失败:" + ex.ToString()); res.Success = false; res.Message = ex.Message; str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } } #endregion
#region 审核其他出库单(两步调出)
/// <summary>
/// 审核其他出库单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[Route("api/TwoStepTransferDocOut/Approve")] [HttpPost] public HttpResponseMessage APIConfirmRdrecord09Two([FromBody]object JsonData) { log.Info("接口:api/TwoStepTransferDocOut/Approve"); HttpResponseMessage result = new HttpResponseMessage(); Result res = new Result(); string str = string.Empty; try { if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]") { log.Info("\r\n 审核其他出库单(两步调出) JSON数据:" + JsonData + "\r\n"); try { List<ICSOtherOutDoc> Bills = new List<ICSOtherOutDoc>(); try { Bills = JsonConvert.DeserializeObject<List<ICSOtherOutDoc>>(JsonData.ToString()); } catch (Exception ex) { log.Error("转换失败:" + ex.ToString()); res.Success = false; res.Message = "JSON格式不正确!"; } OtherOutDoc action = new OtherOutDoc(); bool flag = action.ConfirmRd09(Bills); if (flag == 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 = "请传入参数"; } str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } catch (Exception ex) { log.Error("参数检验失败:" + ex.ToString()); res.Success = false; res.Message = ex.Message; str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } } #endregion
#region 委外材料出库(领料单)
[Route("api/OOIssueDocByPU/Create")] [HttpPost] public HttpResponseMessage CreateOOIssueDocBYPU([FromBody]object JsonData) { log.Info("接口:api/OOIssueDocByPU/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<ICSRdrecord11> infos = new List<ICSRdrecord11>(); try { infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(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; } #endregion
#region 开立材料出库
/// <summary>
/// 审核材料出库
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[Route("api/OOIssueDoc/Approve")] [HttpPost] public HttpResponseMessage MOIssueDocApprove([FromBody]object JsonData) { log.Info("接口:api/OOIssueDoc/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<ICSMOIssueDocApprove> infos = new List<ICSMOIssueDocApprove>(); try { infos = JsonConvert.DeserializeObject<List<ICSMOIssueDocApprove>>(JsonData.ToString()); } catch (Exception ex) { log.Error("转换失败:" + ex.ToString()); res.Success = false; res.Message = "JSON格式不正确!"; } MOIssueDocApprove action = new MOIssueDocApprove(); bool flag = action.ConfirmRd11(infos); if (flag == 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 = "请传入参数"; } str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } catch (Exception ex) { log.Error("参数检验失败:" + ex.ToString()); res.Success = false; res.Message = ex.Message; str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("审核材料出库返回值:" + str); return result; } } #endregion
#region 借用(生成其他出库)
/// <summary>
/// 借用
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[Route("api/BrrowDoc/Create")] [HttpPost] public HttpResponseMessage BrrowDocCreate([FromBody]object JsonData) { log.Info("接口:api/BrrowDoc/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<ICSBrrowDoc> infos = new List<ICSBrrowDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSBrrowDoc>>(JsonData.ToString()); } catch (Exception ex) { log.Error("转换失败:" + ex.ToString()); res.Success = false; res.Message = "JSON格式不正确!"; } BrrowDoc action = new BrrowDoc(); string resultStr = action.ConfirmRd09(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 = "请传入参数"; } str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } catch (Exception ex) { log.Error("参数检验失败:" + ex.ToString()); res.Success = false; res.Message = ex.Message; str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("借用(生成其他出库)返回值:" + str); return result; } } #endregion
#region 归还(生成其他入库)
/// <summary>
/// 归还(生成其他入库)
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[Route("api/ReturnDoc/Create")] [HttpPost] public HttpResponseMessage ReturnDocCreate([FromBody]object JsonData) { log.Info("接口:api/ReturnDoc/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<ICSReturnDoc> infos = new List<ICSReturnDoc>(); try { infos = JsonConvert.DeserializeObject<List<ICSReturnDoc>>(JsonData.ToString()); } catch (Exception ex) { log.Error("转换失败:" + ex.ToString()); res.Success = false; res.Message = "JSON格式不正确!"; } ReturnDoc action = new ReturnDoc(); string resultStr = action.ConfirmRd08(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 = "请传入参数"; } str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } catch (Exception ex) { log.Error("参数检验失败:" + ex.ToString()); res.Success = false; res.Message = ex.Message; str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("归还(生成其他入库)返回值:" + str); return result; } } #endregion
#region 形态转换单
/// <summary>
/// 形态转换单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[Route("api/MorphologicalTransformationDoc/Create")] [HttpPost] public HttpResponseMessage MorphologicalTransformationDocCreate([FromBody]object JsonData) { log.Info("接口:api/MorphologicalTransformationDoc/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<ICSAssemVouch> infos = new List<ICSAssemVouch>(); try { infos = JsonConvert.DeserializeObject<List<ICSAssemVouch>>(JsonData.ToString()); } catch (Exception ex) { log.Error("转换失败:" + ex.ToString()); res.Success = false; res.Message = "JSON格式不正确!"; } CreateAssemVouch action = new CreateAssemVouch(); string resultStr = action.Create(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 = "请传入参数"; } str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } catch (Exception ex) { log.Error("参数检验失败:" + ex.ToString()); res.Success = false; res.Message = ex.Message; str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("形态转换单返回值:" + str); return result; } } #endregion
#region 齐套检验接口
/// <summary>
/// 齐套检验接口
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[Route("api/Complete/Approve")] [HttpPost] public HttpResponseMessage CompleteCreate([FromBody]object JsonData) { log.Info("接口:api/ReturnDoc/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<Complete> infos = new List<Complete>(); try { infos = JsonConvert.DeserializeObject<List<Complete>>(JsonData.ToString()); } catch (Exception ex) { log.Error("转换失败:" + ex.ToString()); res.Success = false; res.Message = "JSON格式不正确!"; } ISComplete action = new ISComplete(); string resultStr = action.ConfirmRd08(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 = "请传入参数"; } str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } catch (Exception ex) { log.Error("参数检验失败:" + ex.ToString()); res.Success = false; res.Message = ex.Message; str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("齐套检验返回值:" + str); return result; } } #endregion
/// <summary>
/// 来源头生成调拨单
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[Route("api/OneStepTransferDoc/Create")] [HttpPost] public HttpResponseMessage TransferDocSIn([FromBody]object JsonData) { log.Info("接口:api/OneStepTransferDoc/Create"); HttpResponseMessage result = new HttpResponseMessage(); Result res = new Result(); string str = string.Empty; try { if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]") { log.Info("\r\n 生成调拨单 JSON数据:" + JsonData + "\r\n"); try { List<ICSTransfer> Bills = new List<ICSTransfer>(); try { Bills = JsonConvert.DeserializeObject<List<ICSTransfer>>(JsonData.ToString()); } catch (Exception ex) { log.Error("转换失败:" + ex.ToString()); res.Success = false; res.Message = "JSON格式不正确!"; } TransferDoc action = new TransferDoc();
string resultStr = action.ConfirmTrans(Bills); if (!string.IsNullOrWhiteSpace(resultStr)) { res.Success = true; res.Message = "接口调用成功!"; res.Data = resultStr; } else { res.Success = false; res.Message = "接口调用失败!"; res.Data = resultStr; } } catch (Exception ex) { log.Error("调用后台失败:" + ex.ToString()); res.Success = false; res.Message = ex.Message; } } else { res.Success = false; res.Message = "请传入参数"; } str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } catch (Exception ex) { log.Error("参数检验失败:" + ex.ToString()); res.Success = false; res.Message = ex.Message; str = JsonConvert.SerializeObject(res); result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json"); log.Debug("返回值:" + str); return result; } }
} } //BrrowDoc√
//CreatePOArrive√
//CreatePuArrivalVouch√
//DeliveryNotice√
//ManufactureReceiveDoc√
//MOIssueDoc√
//MOIssueDocNegatives√
//OutsourcingIssueDoc√
//OutsourcingIssueDoNegative√
//OutsourcingReceiveDoc√
//OutsourcingReceiveDocNegative√
//PurchaseReceiveDoc√
//PurchaseReceiveDoctNegative√
//ReturnDoc√
//SalesDeliveryNotice√
//SalesShipmentDoc√
//SalesShipmentDocNegative√
|