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调拨申请单接口初版结构。

---
 MES.Service/Dto/webApi/ErpTransferRequestDetail.cs                   |   25 ++++
 MESApplication/Controllers/BasicData/MesTransferRequestController.cs |  270 +++++++++++++++++++++++++++++++++++++++++++++
 MES.Service/Dto/webApi/ErpTransferRequest.cs                         |   28 ++++
 MES.Service/Dto/webApi/TransferRequest.cs                            |    7 +
 4 files changed, 330 insertions(+), 0 deletions(-)

diff --git a/MES.Service/Dto/webApi/ErpTransferRequest.cs b/MES.Service/Dto/webApi/ErpTransferRequest.cs
new file mode 100644
index 0000000..fd0fd6a
--- /dev/null
+++ b/MES.Service/Dto/webApi/ErpTransferRequest.cs
@@ -0,0 +1,28 @@
+锘縩amespace MES.Service.Dto.webApi;
+
+public class ErpTransferRequest
+{
+    public string id { get; set; }
+    public string? Type { get; set; }
+    public string? FBillNo { get; set; }
+    public string? FDocumentStatus { get; set; }
+    public string? FDate { get; set; }
+    public string? FAPPORGID { get; set; }
+    public string? FBillTypeID { get; set; }
+    public string? FBusinessType { get; set; }
+    public string? FTRANSTYPE { get; set; }
+    public string? FTransferDirect { get; set; }
+    public string? FOwnerTypeIdHead { get; set; }
+    public string? FOwnerTypeInIdHead { get; set; }
+    public string? F_UNW_Base_BOMBB { get; set; }
+    public string? F_UNW_Base_FXWLBM { get; set; }
+    public string? FRemarks { get; set; }
+    public string? FCreatorId { get; set; }
+    public string? FCreateDate { get; set; }
+    public string? FModifierId { get; set; }
+    public string? FModifyDate { get; set; }
+    public string? FAPPROVEDATE { get; set; }
+    public string? FCloseStatus { get; set; }
+    public string? FCloserId { get; set; }
+    public string? FCloseDate { get; set; }
+}
\ No newline at end of file
diff --git a/MES.Service/Dto/webApi/ErpTransferRequestDetail.cs b/MES.Service/Dto/webApi/ErpTransferRequestDetail.cs
new file mode 100644
index 0000000..37dd0a2
--- /dev/null
+++ b/MES.Service/Dto/webApi/ErpTransferRequestDetail.cs
@@ -0,0 +1,25 @@
+锘縩amespace MES.Service.Dto.webApi;
+
+public class ErpTransferRequestDetail
+{
+    public string ID { get; set; }
+    public string EID { get; set; }
+    public string? FSEQ { get; set; }
+    public string? FMATERIALID { get; set; }
+    public string? FQty { get; set; }
+    public string? FUNITID { get; set; }
+    public string? FBusinessClose { get; set; }
+    public string? FLot { get; set; }
+    public string? FProduceDate { get; set; }
+    public string? FStockOrgId { get; set; }
+    public string? FStockId { get; set; }
+    public string? FStockOrgInId { get; set; }
+    public string? FStockInId { get; set; }
+    public string? FMtoNo { get; set; }
+    public string? FOwnerId { get; set; }
+    public string? FOwnerInId { get; set; }
+    public string? FStockStatusId { get; set; }
+    public string? FStockStatusInId { get; set; }
+    public string? FNote { get; set; }
+   
+}
\ No newline at end of file
diff --git a/MES.Service/Dto/webApi/TransferRequest.cs b/MES.Service/Dto/webApi/TransferRequest.cs
new file mode 100644
index 0000000..e034f7d
--- /dev/null
+++ b/MES.Service/Dto/webApi/TransferRequest.cs
@@ -0,0 +1,7 @@
+锘縩amespace MES.Service.Dto.webApi;
+
+public class TransferRequest
+{
+    public ErpTransferRequest ErpTransferRequest { get; set; }
+    public List<ErpTransferRequestDetail> ErpTransferRequestDetail { get; set; }
+}
\ No newline at end of file
diff --git a/MESApplication/Controllers/BasicData/MesTransferRequestController.cs b/MESApplication/Controllers/BasicData/MesTransferRequestController.cs
new file mode 100644
index 0000000..566c37d
--- /dev/null
+++ b/MESApplication/Controllers/BasicData/MesTransferRequestController.cs
@@ -0,0 +1,270 @@
+锘縰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 MesTransferRequestController : ControllerBase
+{
+    private readonly MessageCenterManager _manager = new();
+    private readonly MesRohInManager m = new();
+
+    private readonly string METHOD = "POST";
+
+    private readonly string TableName = "MES_ROHIN";
+
+    private readonly string URL = "http://localhost:10054/api/MesRohIn/";
+
+    //
+    [HttpPost("Save")]
+    public ResponseResult Save(TransferRequest rohIn)
+    {
+        var entity = new MessageCenter();
+        entity.TableName = TableName;
+        entity.Url = URL + "Save";
+        entity.Method = METHOD;
+        entity.Data = JsonConvert.SerializeObject(rohIn);
+        entity.Status = 1;
+        entity.CreateBy = "PL017";
+        entity.Route = rohIn.ErpTransferRequest.FBillNo;
+        try
+        {
+            return new ResponseResult
+            {
+                status = 0,
+                message = "鎺ュ彛寮�鍙戜腑",
+                data = ""
+            };
+            //dynamic resultInfos = new ExpandoObject();
+            //var save = m.Save(rohIn);
+
+            //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<TransferRequest> 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
+        {
+            return new ResponseResult
+            {
+                status = 0,
+                message = "鎺ュ彛寮�鍙戜腑",
+                data = ""
+            };
+            //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);
+        }
+    }
+
+    /// <summary>
+    ///     鑾峰彇鎵�鏈�
+    /// </summary>
+    /// <returns></returns>
+    [HttpPost("GetList")]
+    public ResponseResult GetList()
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            resultInfos.tbBillList = m.GetList();
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+
+    /// <summary>
+    ///     鏍规嵁涓婚敭鑾峰彇
+    /// </summary>
+    /// <returns></returns>
+    [HttpPost("GetById")]
+    public ResponseResult GetById(int id)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            resultInfos.tbBillList = m.GetById(id);
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    /// <summary>
+    ///     鏍规嵁涓婚敭鍒犻櫎
+    /// </summary>
+    /// <returns></returns>
+    [HttpPost("DeleteByIds")]
+    public ResponseResult DeleteByIds([FromBody] object[] ids)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            resultInfos.tbBillList = m.DeleteByIds(ids);
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    /// <summary>
+    ///     娣诲姞
+    /// </summary>
+    /// <returns></returns>
+    [HttpPost("Insert")]
+    public ResponseResult Add([FromBody] MesRohIn data)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            resultInfos.tbBillList = m.Insert(data);
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    /// <summary>
+    ///     娣诲姞杩斿洖鑷
+    /// </summary>
+    /// <returns></returns>
+    [HttpPost("InsertReturnIdentity")]
+    public ResponseResult InsertReturnIdentity([FromBody] MesRohIn data)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            resultInfos.tbBillList = m.InsertReturnIdentity(data);
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    /// <summary>
+    ///     淇敼
+    /// </summary>
+    /// <returns></returns>
+    [HttpPost("Update")]
+    public ResponseResult Update([FromBody] MesRohIn data)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            resultInfos.tbBillList = m.Update(data);
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.3