From bf1d6f240c9df40f1c7b4593e87750dbf15cbbde Mon Sep 17 00:00:00 2001 From: 南骏 池 <chiffly@163.com> Date: 星期三, 19 二月 2025 16:56:24 +0800 Subject: [PATCH] 1.新增ERP->MES调拨申请单接口初版结构。 --- MESApplication/Controllers/BasicData/OrganizeController.cs | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 111 insertions(+), 0 deletions(-) diff --git a/MESApplication/Controllers/BasicData/OrganizeController.cs b/MESApplication/Controllers/BasicData/OrganizeController.cs new file mode 100644 index 0000000..cd3a95e --- /dev/null +++ b/MESApplication/Controllers/BasicData/OrganizeController.cs @@ -0,0 +1,111 @@ +锘縰sing System.Dynamic; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using MES.Service.service; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class OrganizeController : ControllerBase +{ + private readonly MessageCenterManager _manager = new(); + + private readonly OrganizeManager m = new(); + + private readonly string METHOD = "POST"; + + private readonly string TableName = "Organize"; + + private readonly string URL = "http://localhost:10054/api/Organize/"; + + [HttpPost("Save")] + public ResponseResult Save(ErpOrganize unit) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "Save"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(unit); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.Save(unit); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + [HttpPost("SaveList")] + public ResponseResult SaveList(List<ErpOrganize> units) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "SaveList"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(units); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.SaveList(units); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file -- Gitblit v1.9.3