From 9bda2a9c4dcd6512b32a31cde6af4d5d8e80c668 Mon Sep 17 00:00:00 2001 From: 南骏 池 <chiffly@163.com> Date: 星期五, 23 五月 2025 09:59:26 +0800 Subject: [PATCH] 1.销售订单优化 2.组织新增同步时间 --- MESApplication/Controllers/BasicData/OrganizeController.cs | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 112 insertions(+), 0 deletions(-) diff --git a/MESApplication/Controllers/BasicData/OrganizeController.cs b/MESApplication/Controllers/BasicData/OrganizeController.cs new file mode 100644 index 0000000..f08a11c --- /dev/null +++ b/MESApplication/Controllers/BasicData/OrganizeController.cs @@ -0,0 +1,112 @@ +锘縰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"; + entity.Route = unit.FNumber; + 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