From fba48d2d676cd9b6d493163aef9d87f6e5090aee Mon Sep 17 00:00:00 2001
From: 如洲 陈 <1278080563@qq.com>
Date: 星期五, 12 九月 2025 19:02:00 +0800
Subject: [PATCH] 出库检和退货检验
---
MESApplication/Controllers/QC/THJController.cs | 604 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 604 insertions(+), 0 deletions(-)
diff --git a/MESApplication/Controllers/QC/THJController.cs b/MESApplication/Controllers/QC/THJController.cs
new file mode 100644
index 0000000..cc46927
--- /dev/null
+++ b/MESApplication/Controllers/QC/THJController.cs
@@ -0,0 +1,604 @@
+using System.Dynamic;
+using MES.Service.Dto.service;
+using MES.Service.Modes;
+using MES.Service.service.QC;
+using MES.Service.util;
+using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json.Linq;
+
+namespace MESApplication.Controllers.QC;
+
+[Route("api/[controller]")]
+[ApiController]
+public class THJController : ControllerBase
+{
+ [HttpPost("getPage")]
+ public ResponseResult GetPage([FromBody] THJPageResult queryObj)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ var tbBillList = new THJService().getPage(queryObj);
+ resultInfos.tbBillList = tbBillList;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ [HttpPost("getMaxReleaseNo")]
+ public ResponseResult GetMaxReleaseNo()
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ var tbBillList = new THJService().getMaxReleaseNo();
+ resultInfos.tbBillList = tbBillList;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ [HttpPost("getQSItems")]
+ public ResponseResult GetQSItems([FromBody] JObject data)
+ {
+ var pid = data["pid"]?.ToString();
+ var id = data["id"]?.ToString();
+
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ var tbBillList = new THJService();
+ var detail021 = tbBillList.getQSItems(Convert.ToDecimal(pid), Convert.ToDecimal(id));
+ resultInfos.tbBillList = detail021;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ [HttpPost("saveItem")]
+ public ResponseResult SaveItem([FromBody] THJDto thjDto)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ var tbBillList = new THJService().saveItem(thjDto);
+ resultInfos.tbBillList = tbBillList;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ [HttpPost("submitTHJResult")]
+ public ResponseResult SubmitTHJResult([FromBody] JObject data)
+ {
+ try
+ {
+ var gid = Convert.ToDecimal(data["gid"]?.ToString());
+ var userNo = data["userNo"]?.ToString();
+
+ if (gid <= 0)
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "妫�楠屽崟ID涓嶈兘涓虹┖",
+ data = null
+ };
+ }
+
+ if (string.IsNullOrEmpty(userNo))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "鎿嶄綔浜轰笉鑳戒负绌�",
+ data = null
+ };
+ }
+
+ var result = new THJService().SubmitTHJResult(gid, userNo);
+
+ if (result)
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = new { success = true, message = "鎻愪氦鎴愬姛" };
+ return new ResponseResult
+ {
+ status = 0,
+ message = "鎻愪氦鎴愬姛",
+ data = resultInfos
+ };
+ }
+ else
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "鎻愪氦澶辫触",
+ data = null
+ };
+ }
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ [HttpPost("getReturnwareInfo")]
+ public ResponseResult GetReturnwareInfo([FromBody] JObject data)
+ {
+ try
+ {
+ var returnType = data["returnType"]?.ToString();
+ var returnNo = data["returnNo"]?.ToString();
+
+ if (string.IsNullOrEmpty(returnType) || string.IsNullOrEmpty(returnNo))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "閫�璐у崟鍒拰閫�璐у崟鍙蜂笉鑳戒负绌�",
+ data = null
+ };
+ }
+
+ dynamic resultInfos = new ExpandoObject();
+ var tbBillList = new THJService().getReturnwareInfo(returnType, returnNo);
+ resultInfos.tbBillList = tbBillList;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ [HttpPost("getReturnDetails")]
+ public ResponseResult GetReturnDetails([FromBody] JObject data)
+ {
+ try
+ {
+ var pid = data["pid"]?.ToString();
+
+ if (string.IsNullOrEmpty(pid))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "妫�楠屽崟ID涓嶈兘涓虹┖",
+ data = null
+ };
+ }
+
+ dynamic resultInfos = new ExpandoObject();
+ var tbBillList = new THJService().getReturnDetails(pid);
+ resultInfos.tbBillList = tbBillList;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ [HttpPost("setInspectItem")]
+ public ResponseResult SetInspectItem([FromBody] JObject data)
+ {
+ try
+ {
+ var gid = data["gid"]?.ToString();
+ var updateBy = data["updateBy"]?.ToString() ?? "绯荤粺";
+
+ if (string.IsNullOrEmpty(gid))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "妫�楠屽崟ID涓嶈兘涓虹┖",
+ data = null
+ };
+ }
+
+ dynamic resultInfos = new ExpandoObject();
+ var tbBillList = new THJService().setInspectItem(gid, updateBy);
+ resultInfos.tbBillList = tbBillList;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// 娴嬭瘯鎺ュ彛 - 楠岃瘉鍩烘湰鍔熻兘
+ /// </summary>
+ [HttpPost("testConnection")]
+ public ResponseResult TestConnection()
+ {
+ try
+ {
+ return new ResponseResult
+ {
+ status = 0,
+ message = "杩炴帴姝e父",
+ data = new { timestamp = DateTime.Now }
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// 鏍规嵁ID鑾峰彇妫�楠岄」鐩鎯�
+ /// </summary>
+ [HttpPost("getThjDetail02ById")]
+ public ResponseResult GetThjDetail02ById([FromBody] JObject data)
+ {
+ try
+ {
+ var id = Convert.ToDecimal(data["id"]);
+ var result = new THJService().getThjDetail02ById(id);
+
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = result;
+
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// 璁剧疆妫�楠岄」鐩鎯�
+ /// </summary>
+ [HttpPost("SetQSItemDetail")]
+ public ResponseResult SetQSItemDetail([FromBody] JObject data)
+ {
+ try
+ {
+ var pid = Convert.ToDecimal(data["pid"]);
+ var gid = Convert.ToDecimal(data["gid"]);
+ var fstand = data["fstand"]?.ToString();
+ var fcheckResu = data["fcheckResu"]?.ToString();
+ var updateBy = data["updateBy"]?.ToString();
+ var count = Convert.ToInt32(data["count"]);
+
+ var result = new THJService().SetQSItemDetail(pid, gid, fstand, fcheckResu, updateBy, count);
+
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = result;
+
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// 鏇存柊妫�楠岄」鐩鎯�
+ /// </summary>
+ [HttpPost("UpdateQSItemDetail")]
+ public ResponseResult UpdateQSItemDetail([FromBody] JObject data)
+ {
+ try
+ {
+ // 瀹夊叏鍦拌浆鎹ecimal鍙傛暟锛屽鐞哊ULL鍊�
+ if (!decimal.TryParse(data["id"]?.ToString(), out decimal id))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "妫�楠岀粨鏋淚D涓嶈兘涓虹┖鎴栨牸寮忎笉姝g‘",
+ data = null
+ };
+ }
+
+ if (!decimal.TryParse(data["pid"]?.ToString(), out decimal pid))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "妫�楠岄」鐩甀D涓嶈兘涓虹┖鎴栨牸寮忎笉姝g‘",
+ data = null
+ };
+ }
+
+ if (!decimal.TryParse(data["gid"]?.ToString(), out decimal gid))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "妫�楠屽崟ID涓嶈兘涓虹┖鎴栨牸寮忎笉姝g‘",
+ data = null
+ };
+ }
+
+ var fstand = data["fstand"]?.ToString();
+ var fcheckResu = data["fcheckResu"]?.ToString();
+ var updateBy = data["updateBy"]?.ToString();
+
+ var result = new THJService().UpdateQSItemDetail(id, pid, gid, fstand, fcheckResu, updateBy);
+
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = result;
+
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// 淇濆瓨妫�楠岄」鐩娉�
+ /// </summary>
+ [HttpPost("saveRemarksPid")]
+ public ResponseResult SaveRemarksPid([FromBody] JObject data)
+ {
+ try
+ {
+ var pid = Convert.ToDecimal(data["pid"]);
+ var remarks = data["remarks"]?.ToString();
+
+ var result = new THJService().saveRemarksPid(pid, remarks);
+
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = result;
+
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// 鑾峰彇閫�璐у崟鍒楄〃
+ /// </summary>
+ [HttpPost("getReturnOrders")]
+ public ResponseResult GetReturnOrders()
+ {
+ try
+ {
+ var result = new THJService().getReturnOrders();
+
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = result;
+
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// 淇濆瓨閫�璐ф槑缁�
+ /// </summary>
+ [HttpPost("SaveReturnDetails")]
+ public ResponseResult SaveReturnDetails([FromBody] JObject data)
+ {
+ try
+ {
+ var returnDetails = data["returnDetails"]?.ToString();
+ var result = new THJService().SaveReturnDetails(returnDetails);
+
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = result;
+
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// 淇濆瓨妫�楠岄」鐩�
+ /// </summary>
+ [HttpPost("saveInspectItem")]
+ public ResponseResult SaveInspectItem([FromBody] JObject data)
+ {
+ try
+ {
+ var gid = data["gid"]?.ToString();
+ var items = data["items"]?.ToString();
+ var userNo = data["userNo"]?.ToString();
+
+ var result = new THJService().saveInspectItem(gid, items, userNo);
+
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = result;
+
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// 淇濆瓨妫�楠屽崟澶囨敞锛堜笉鍚堟牸鎻忚堪锛�
+ /// </summary>
+ [HttpPost("saveRemarksGid")]
+ public ResponseResult SaveRemarksGid([FromBody] JObject data)
+ {
+ try
+ {
+ var gid = Convert.ToDecimal(data["gid"]?.ToString());
+ var remarks = data["remarks"]?.ToString();
+
+ var result = new THJService().saveRemarksGid(gid, remarks);
+
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = result;
+
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// 閫氳繃瀛樺偍杩囩▼鎻愪氦妫�楠岀粨鏋�
+ /// </summary>
+ [HttpPost("submitTHJResultByProcedure")]
+ public ResponseResult SubmitTHJResultByProcedure([FromBody] JObject data)
+ {
+ try
+ {
+ var releaseNo = data["releaseNo"]?.ToString();
+ var userNo = data["userNo"]?.ToString();
+
+ if (string.IsNullOrEmpty(releaseNo))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "妫�楠屽崟鍙蜂笉鑳戒负绌�",
+ data = null
+ };
+ }
+
+ if (string.IsNullOrEmpty(userNo))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "鎿嶄綔浜轰笉鑳戒负绌�",
+ data = null
+ };
+ }
+
+ var result = new THJService().SubmitTHJResultByProcedure(releaseNo, userNo);
+
+ if (result.success)
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = new { success = true, message = result.message };
+ return new ResponseResult
+ {
+ status = 0,
+ message = result.message,
+ data = resultInfos
+ };
+ }
+ else
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = result.message,
+ data = null
+ };
+ }
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+}
--
Gitblit v1.9.3