From ad75e6017901835df1cb3e18e4cc3a6d3460cbeb Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期三, 30 十月 2024 19:44:50 +0800
Subject: [PATCH] 111
---
MESApplication/Controllers/BasicData/OrganizeController.cs | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 110 insertions(+), 0 deletions(-)
diff --git a/MESApplication/Controllers/BasicData/OrganizeController.cs b/MESApplication/Controllers/BasicData/OrganizeController.cs
new file mode 100644
index 0000000..9253bec
--- /dev/null
+++ b/MESApplication/Controllers/BasicData/OrganizeController.cs
@@ -0,0 +1,110 @@
+锘縰sing System.Dynamic;
+using MES.Service.Dto.webApi;
+using MES.Service.Modes;
+using MES.Service.service;
+using MES.Service.util;
+using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json;
+
+namespace MESApplication.Controllers;
+
+[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