From 707e8f07abb295629f73557759cf0e708ca6b5fa Mon Sep 17 00:00:00 2001
From: xwt <2740516069@qq.com>
Date: 星期五, 17 十月 2025 13:26:31 +0800
Subject: [PATCH] IQC破坏实验,IQC堵穴号
---
StandardInterface/MESApplication/Controllers/QC/LljController.cs | 579 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 578 insertions(+), 1 deletions(-)
diff --git a/StandardInterface/MESApplication/Controllers/QC/LljController.cs b/StandardInterface/MESApplication/Controllers/QC/LljController.cs
index 529ba55..eb626a0 100644
--- a/StandardInterface/MESApplication/Controllers/QC/LljController.cs
+++ b/StandardInterface/MESApplication/Controllers/QC/LljController.cs
@@ -39,7 +39,7 @@
[HttpPost("setJYItem")]
public ResponseResult setJYItem([FromBody] JObject data)
{
- var itemNo = data["itemNo"].ToString();
+ var itemNo = Convert.ToDecimal(data["itemNo"].ToString());
var quantity = Convert.ToDecimal(data["quantity"].ToString());
var releaseNo = data["releaseNo"].ToString();
try
@@ -204,6 +204,51 @@
}
}
+ //savePhsyGid 涓昏〃娣诲姞鐮村潖瀹為獙
+ [HttpPost("savePhsyGid")]
+ public ResponseResult savePhsyGid([FromBody] LLJDto rkjDto)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ var tbBillList =
+ new LljService().savePhsyGid(rkjDto);
+ resultInfos.tbBillList = tbBillList;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+ [HttpPost("saveDropdownFields")]
+ public ResponseResult saveDropdownFields([FromBody] LLJDto rkjDto)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ var tbBillList =
+ new LljService().saveDropdownFields(rkjDto);
+ resultInfos.tbBillList = tbBillList;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
//saveRemarksPid 瀛愯〃娣诲姞涓嶅悎鏍兼弿杩�
[HttpPost("saveRemarksPid")]
public ResponseResult saveRemarksPid([FromBody] LLJDto rkjDto)
@@ -273,4 +318,536 @@
return ResponseResult.ResponseError(ex);
}
}
+ [HttpPost("EmergencyRelease")]
+ public ResponseResult EmergencyRelease([FromBody] JObject data)
+ {
+ var id = Convert.ToInt32(data["id"].ToString());
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ var tbBillList = new LljService().EmergencyRelease(id);
+ resultInfos.tbBillList = tbBillList;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ [HttpPost("WithdrawEmergencyRelease")]
+ public ResponseResult WithdrawEmergencyRelease([FromBody] JObject data)
+ {
+ var id = Convert.ToInt32(data["id"].ToString());
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ var tbBillList = new LljService().WithdrawEmergencyRelease(id);
+ resultInfos.tbBillList = tbBillList;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ [HttpPost("getAttachments")]
+ public ResponseResult GetAttachments([FromBody] JObject data)
+ {
+ var itemNo = data["itemNo"]?.ToString();
+ try
+ {
+ dynamic resultInfos = new System.Dynamic.ExpandoObject();
+ var tbBillList = new LljService().GetAttachments(itemNo);
+ if (tbBillList == null || tbBillList.Count == 0)
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "璇ユ楠屽崟鏈笂浼犻檮浠朵俊鎭紒",
+ data = null
+ };
+ }
+ resultInfos.tbBillList = tbBillList;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ [HttpGet("PreviewFtpFile")]
+ public IActionResult PreviewFtpFile([FromQuery] string itemNo, [FromQuery] string fileName, [FromQuery] string ftpServer)
+ {
+ try
+ {
+ // 娣诲姞CORS鍝嶅簲澶�
+ Response.Headers.Add("Access-Control-Allow-Origin", "*");
+ Response.Headers.Add("Access-Control-Allow-Methods", "GET, OPTIONS");
+ Response.Headers.Add("Access-Control-Allow-Headers", "Content-Type");
+ Response.Headers.Add("Access-Control-Expose-Headers", "Content-Type, Content-Length");
+
+ var service = new LljService();
+ var fileBytes = service.GetFtpFile(itemNo, fileName, ftpServer);
+
+ if (fileBytes == null || fileBytes.Length == 0)
+ {
+ return NotFound("鏂囦欢鍦‵TP鏈嶅姟鍣ㄤ笂涓嶅瓨鍦�");
+ }
+
+ var contentType = service.GetContentType(fileName);
+ fileName = fileName?.Trim().Replace("\r", "").Replace("\n", "");
+
+ return File(fileBytes, contentType);
+ }
+ catch (Exception ex)
+ {
+ return StatusCode(500, $"棰勮鏂囦欢澶辫触锛歿ex.Message}");
+ }
+ }
+
+ [HttpGet("DownloadFtpFile")]
+ public IActionResult DownloadFtpFile([FromQuery] string itemNo, [FromQuery] string fileName, [FromQuery] string ftpServer)
+ {
+ try
+ {
+ // 娣诲姞CORS鍝嶅簲澶� - 鍏抽敭閰嶇疆鐢ㄤ簬瑙e喅璺ㄥ煙闂
+ Response.Headers.Add("Access-Control-Allow-Origin", "*");
+ Response.Headers.Add("Access-Control-Allow-Methods", "GET, OPTIONS");
+ Response.Headers.Add("Access-Control-Allow-Headers", "Content-Type, Authorization");
+ Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition, Content-Length, Content-Type");
+
+ var service = new LljService();
+ var fileBytes = service.GetFtpFile(itemNo, fileName, ftpServer);
+
+ if (fileBytes == null || fileBytes.Length == 0)
+ {
+ return NotFound("鏂囦欢鍦‵TP鏈嶅姟鍣ㄤ笂涓嶅瓨鍦�");
+ }
+
+ var contentType = service.GetContentType(fileName);
+ fileName = fileName?.Trim().Replace("\r", "").Replace("\n", "");
+
+ // 璁剧疆姝g‘鐨凜ontent-Disposition鍝嶅簲澶翠互鏀寔鏂囦欢涓嬭浇
+ var result = File(fileBytes, "application/octet-stream", fileName);
+
+ // 纭繚Content-Disposition澶存纭缃紝鏀寔涓枃鏂囦欢鍚�
+ if (!string.IsNullOrEmpty(fileName))
+ {
+ var encodedFileName = System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8);
+ Response.Headers.Add("Content-Disposition", $"attachment; filename*=UTF-8''{encodedFileName}");
+ }
+
+ return result;
+ }
+ catch (Exception ex)
+ {
+ return StatusCode(500, $"涓嬭浇鏂囦欢澶辫触锛歿ex.Message}");
+ }
+ }
+
+ [HttpOptions("PreviewFtpFile")]
+ [HttpOptions("DownloadFtpFile")]
+ public IActionResult HandleOptions()
+ {
+ // 澶勭悊CORS棰勬璇锋眰
+ Response.Headers.Add("Access-Control-Allow-Origin", "*");
+ Response.Headers.Add("Access-Control-Allow-Methods", "GET, OPTIONS");
+ Response.Headers.Add("Access-Control-Allow-Headers", "Content-Type, Authorization");
+ Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition, Content-Length, Content-Type");
+ Response.Headers.Add("Access-Control-Max-Age", "86400");
+
+ return Ok();
+ }
+[HttpPost("getWomdab")]
+ public ResponseResult getWomdab([FromBody] GetWomdabRequest data)
+ {
+ var daa001 = data.daa001?.ToString();
+ try
+ {
+ dynamic resultInfos = new System.Dynamic.ExpandoObject();
+ var tbBillList = new LljService().GetWomdab(daa001);
+ if (tbBillList == null || tbBillList.Count == 0)
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "璇ユ楠屽崟鏈笂浼犻檮浠朵俊鎭紒",
+ data = null
+ };
+ }
+ resultInfos.tbBillList = tbBillList;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+
+ [HttpPost("GetWomdabById")]
+ public ResponseResult GetWomdabById([FromBody] GetWomdabRequest data)
+ {
+ var daa001 = data.daa001?.ToString();
+ var ItemNo = data.ItemNo?.ToString();
+ try
+ {
+ dynamic resultInfos = new System.Dynamic.ExpandoObject();
+ var tbBillList = new LljService().GetWomdabById(daa001,ItemNo);
+ if (tbBillList == null || tbBillList.Count == 0)
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "璇ユ楠屽崟鏈笂浼犻檮浠朵俊鎭紒",
+ data = null
+ };
+ }
+ resultInfos.tbBillList = tbBillList;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// 鏍规嵁浜岀淮鐮佹煡璇㈢墿鏂欎俊鎭�
+ /// </summary>
+ /// <param name="data">鍖呭惈浜岀淮鐮佸唴瀹瑰拰褰撳墠鍒拌揣鍗曞彿鐨勮姹傚璞�</param>
+ /// <returns>鐗╂枡淇℃伅</returns>
+ [HttpPost("GetMaterialByBarcode")]
+ public ResponseResult GetMaterialByBarcode([FromBody] GetMaterialByBarcodeRequest data)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(data.itemBarcode))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "浜岀淮鐮佸唴瀹逛笉鑳戒负绌�",
+ data = null
+ };
+ }
+ dynamic resultInfos = new System.Dynamic.ExpandoObject();
+ var materialInfo = new LljService().GetMaterialByBarcode(data.itemBarcode, data.currentBillNo);
+
+ if (materialInfo == null || materialInfo.Count == 0)
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "鏈壘鍒板搴旂殑鐗╂枡淇℃伅锛岃妫�鏌ヤ簩缁寸爜鏄惁姝g‘",
+ data = null
+ };
+ }
+ resultInfos.tbBillList = materialInfo;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "鏌ヨ鎴愬姛",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = ex.Message, // 鐩存帴杩斿洖寮傚父淇℃伅锛屽寘鍚�"璇ユ潯鐮佷笉鏄妫�楠屽崟鏉$爜锛�"
+ data = null
+ };
+ }
+ }
+ /// <summary>
+ /// 鏌ヨ鐮村潖瀹為獙璁板綍鏄惁瀛樺湪
+ /// </summary>
+ /// <param name="data">鏌ヨ璇锋眰鏁版嵁</param>
+ /// <returns>鏌ヨ缁撴灉</returns>
+ [HttpPost("CheckPhsyRecord")]
+ public ResponseResult CheckPhsyRecord([FromBody] CheckPhsyRecordRequest data)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(data.billNo))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "鍒拌揣鍗曞彿涓嶈兘涓虹┖",
+ data = null
+ };
+ }
+ if (string.IsNullOrEmpty(data.releaseNo))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "妫�楠屽崟鍙蜂笉鑳戒负绌�",
+ data = null
+ };
+ }
+ var exists = new LljService().CheckPhsyRecordExists(data.billNo, data.releaseNo);
+ dynamic resultInfos = new System.Dynamic.ExpandoObject();
+ resultInfos.exists = exists;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "鏌ヨ鎴愬姛",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = $"鏌ヨ澶辫触: {ex.Message}",
+ data = null
+ };
+ }
+ }
+ /// <summary>
+ /// 璋冪敤鐮村潖瀹為獙瀛樺偍杩囩▼
+ /// </summary>
+ /// <param name="data">鐮村潖瀹為獙璇锋眰鏁版嵁</param>
+ /// <returns>鎵ц缁撴灉</returns>
+ [HttpPost("CallPhsyUpdateProcedure")]
+ public ResponseResult CallPhsyUpdateProcedure([FromBody] PhsyUpdateRequest data)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(data.itemBarcode))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "鏉$爜涓嶈兘涓虹┖",
+ data = null
+ };
+ }
+ if (string.IsNullOrEmpty(data.billNo))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "鍒拌揣鍗曞彿涓嶈兘涓虹┖",
+ data = null
+ };
+ }
+ if (data.yqty <= 0)
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "鏉$爜鏁伴噺蹇呴』澶т簬0",
+ data = null
+ };
+ }
+ if (data.cqty <= 0)
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "鐮村潖瀹為獙鏁伴噺蹇呴』澶т簬0",
+ data = null
+ };
+ }
+ if (string.IsNullOrEmpty(data.releaseNo))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "妫�楠屽崟鍙蜂笉鑳戒负绌�",
+ data = null
+ };
+ }
+ var (result, message) = new LljService().CallPhsyUpdateProcedure(
+ data.itemBarcode,
+ data.yqty,
+ data.cqty,
+ data.billNo,
+ data.lx,
+ data.releaseNo,
+ data.itemId);
+ dynamic resultInfos = new System.Dynamic.ExpandoObject();
+ resultInfos.result = result;
+ resultInfos.message = message;
+ return new ResponseResult
+ {
+ status = result,
+ message = message,
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = $"璋冪敤瀛樺偍杩囩▼澶辫触: {ex.Message}",
+ data = null
+ };
+ }
+ }
+ public class GetWomdabRequest
+ {
+ public string daa001 { get; set; }
+ public string ItemNo { get; set; }
+ }
+
+ public class GetMaterialByBarcodeRequest
+ {
+ public string itemBarcode { get; set; }
+ public string currentBillNo { get; set; }
+ }
+ public class PhsyUpdateRequest
+ {
+ public string itemBarcode { get; set; }
+ public decimal yqty { get; set; }
+ public decimal cqty { get; set; }
+ public string billNo { get; set; }
+ public int lx { get; set; } // 鎿嶄綔绫诲瀷锛�1鏂板锛�2淇敼锛�3鍒犻櫎
+ public string releaseNo { get; set; } // 妫�楠屽崟鍙�
+ public decimal? itemId { get; set; } // 鐗╂枡ID
+ }
+ public class CheckPhsyRecordRequest
+ {
+ public string billNo { get; set; }
+ public string releaseNo { get; set; }
+ }
+ [HttpPost("GetPhsyRecordInfo")]
+ public ResponseResult GetPhsyRecordInfo([FromBody] CheckPhsyRecordRequest data)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(data.billNo))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "鍒拌揣鍗曞彿涓嶈兘涓虹┖",
+ data = null
+ };
+ }
+ if (string.IsNullOrEmpty(data.releaseNo))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "妫�楠屽崟鍙蜂笉鑳戒负绌�",
+ data = null
+ };
+ }
+ var records = new LljService().GetPhsyRecordInfo(data.billNo, data.releaseNo);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "鏌ヨ鎴愬姛",
+ data = new { tbBillList = records }
+ };
+ }
+ catch (Exception ex)
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = $"鏌ヨ澶辫触: {ex.Message}",
+ data = null
+ };
+ }
+ }
+ /// <summary>
+ /// 璁剧疆鍫电┐淇℃伅
+ /// </summary>
+ /// <param name="data">鍫电┐璁剧疆璇锋眰鏁版嵁</param>
+ /// <returns>鎵ц缁撴灉</returns>
+ [HttpPost("SetBlockedHoles")]
+ public ResponseResult SetBlockedHoles([FromBody] SetBlockedHolesRequest data)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(data.releaseNo))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "妫�楠屽崟鍙蜂笉鑳戒负绌�",
+ data = null
+ };
+ }
+ if (string.IsNullOrEmpty(data.blockedHoles))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "鍫电┐淇℃伅涓嶈兘涓虹┖",
+ data = null
+ };
+ }
+ if (data.itemId <= 0)
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "妫�楠岄」鐩甀D涓嶈兘涓虹┖",
+ data = null
+ };
+ }
+ var (result, message) = new LljService().SetBlockedHoles(data.releaseNo, data.blockedHoles, data.itemId);
+ return new ResponseResult
+ {
+ status = result,
+ message = message,
+ data = new { result = result, message = message }
+ };
+ }
+ catch (Exception ex)
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = $"璁剧疆鍫电┐澶辫触: {ex.Message}",
+ data = null
+ };
+ }
+ }
+ public class SetBlockedHolesRequest
+ {
+ public string releaseNo { get; set; }
+ public string blockedHoles { get; set; }
+ public decimal itemId { get; set; }
+ }
+
+
}
\ No newline at end of file
--
Gitblit v1.9.3