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