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/MES.Service/Modes/MesInvPhsy.cs                |   58 ++++
 StandardInterface/MES.Service/Dto/service/MaterialInfoDto.cs     |   44 +++
 StandardInterface/MES.Service/service/QC/LljService.cs           |  231 +++++++++++++++++++
 StandardInterface/MES.Service/Dto/service/PhsyRecordInfoDto.cs   |   50 ++++
 StandardInterface/MES.Service/Modes/MesQaItemsDetectDetail5.cs   |    5 
 StandardInterface/MESApplication/Controllers/QC/LljController.cs |  304 +++++++++++++++++++++++++
 StandardInterface/MESApplication/appsettings.json                |    2 
 7 files changed, 693 insertions(+), 1 deletions(-)

diff --git a/StandardInterface/MES.Service/Dto/service/MaterialInfoDto.cs b/StandardInterface/MES.Service/Dto/service/MaterialInfoDto.cs
new file mode 100644
index 0000000..5103e4c
--- /dev/null
+++ b/StandardInterface/MES.Service/Dto/service/MaterialInfoDto.cs
@@ -0,0 +1,44 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MES.Service.Dto.service
+{
+    /// <summary>
+    /// 鐗╂枡淇℃伅DTO
+    /// </summary>
+    public class MaterialInfoDto
+    {
+        /// <summary>
+        /// 鐗╂枡缂栫爜
+        /// </summary>
+        public string? ItemNo { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡鍚嶇О
+        /// </summary>
+        public string? ItemName { get; set; }
+
+        /// <summary>
+        /// 瑙勬牸鍨嬪彿
+        /// </summary>
+        public string? ItemModel { get; set; }
+
+        /// <summary>
+        /// 鏁伴噺
+        /// </summary>
+        public decimal? OldQty { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡ID
+        /// </summary>
+        public decimal? ItemId { get; set; }
+
+        /// <summary>
+        /// 鍒拌揣鍗曞彿
+        /// </summary>
+        public string? BillNo { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/StandardInterface/MES.Service/Dto/service/PhsyRecordInfoDto.cs b/StandardInterface/MES.Service/Dto/service/PhsyRecordInfoDto.cs
new file mode 100644
index 0000000..91c2067
--- /dev/null
+++ b/StandardInterface/MES.Service/Dto/service/PhsyRecordInfoDto.cs
@@ -0,0 +1,50 @@
+锘縰sing System;
+
+namespace MES.Service.Dto.service
+{
+    /// <summary>
+    /// 鐮村潖瀹為獙璁板綍淇℃伅DTO
+    /// </summary>
+    public class PhsyRecordInfoDto
+    {
+        /// <summary>
+        /// 鎵弿鏉$爜
+        /// </summary>
+        public string? ItemBarcode { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡缂栫爜
+        /// </summary>
+        public string? ItemNo { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡鍚嶇О
+        /// </summary>
+        public string? ItemName { get; set; }
+
+        /// <summary>
+        /// 瑙勬牸鍨嬪彿
+        /// </summary>
+        public string? ItemModel { get; set; }
+
+        /// <summary>
+        /// 鍒拌揣鍗曞彿
+        /// </summary>
+        public string? BillNo { get; set; }
+
+        /// <summary>
+        /// 鏉$爜鏁伴噺
+        /// </summary>
+        public decimal? Yqty { get; set; }
+
+        /// <summary>
+        /// 鐮村潖鏁�
+        /// </summary>
+        public decimal? Cqty { get; set; }
+
+        /// <summary>
+        /// 鍒涘缓鏃ユ湡
+        /// </summary>
+        public DateTime? CreateDate { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/StandardInterface/MES.Service/Modes/MesInvPhsy.cs b/StandardInterface/MES.Service/Modes/MesInvPhsy.cs
new file mode 100644
index 0000000..49640fa
--- /dev/null
+++ b/StandardInterface/MES.Service/Modes/MesInvPhsy.cs
@@ -0,0 +1,58 @@
+锘縰sing SqlSugar;
+
+namespace MES.Service.Modes;
+
+/// <summary>
+///     鐮村潖瀹為獙璁板綍琛�
+/// </summary>
+[SugarTable("MES_INV_PHSY")]
+public class MesInvPhsy
+{
+    /// <summary>
+    ///     ID
+    /// </summary>
+    [SugarColumn(ColumnName = "ID", IsPrimaryKey = true)]
+    public decimal Id { get; set; }
+
+    /// <summary>
+    ///     鐗╂枡鏉$爜
+    /// </summary>
+    [SugarColumn(ColumnName = "ITEM_BARCODE")]
+    public string? ItemBarcode { get; set; }
+
+    /// <summary>
+    ///     鍒拌揣鍗曞彿
+    /// </summary>
+    [SugarColumn(ColumnName = "BILL_NO")]
+    public string? BillNo { get; set; }
+
+    /// <summary>
+    ///     鏉$爜鏁伴噺
+    /// </summary>
+    [SugarColumn(ColumnName = "YQTY")]
+    public decimal? Yqty { get; set; }
+
+    /// <summary>
+    ///     鐮村潖鏁伴噺
+    /// </summary>
+    [SugarColumn(ColumnName = "CQTY")]
+    public decimal? Cqty { get; set; }
+
+    /// <summary>
+    ///     鍒涘缓鏃堕棿
+    /// </summary>
+    [SugarColumn(ColumnName = "CREATE_DATE")]
+    public DateTime? CreateDate { get; set; }
+
+    /// <summary>
+    ///     妫�楠屽崟鍙�
+    /// </summary>
+    [SugarColumn(ColumnName = "RELEASE_NO")]
+    public string? ReleaseNo { get; set; }
+
+    /// <summary>
+    ///     鐗╂枡ID
+    /// </summary>
+    [SugarColumn(ColumnName = "ITEM_ID")]
+    public decimal? ItemId { get; set; }
+}
\ No newline at end of file
diff --git a/StandardInterface/MES.Service/Modes/MesQaItemsDetectDetail5.cs b/StandardInterface/MES.Service/Modes/MesQaItemsDetectDetail5.cs
index 6f00396..7a93c3f 100644
--- a/StandardInterface/MES.Service/Modes/MesQaItemsDetectDetail5.cs
+++ b/StandardInterface/MES.Service/Modes/MesQaItemsDetectDetail5.cs
@@ -178,4 +178,9 @@
     /// </summary>
     [SugarColumn(ColumnName = "MEOM")]
     public string? Meom { get; set; }
+    /// <summary>
+    ///     璧屾ā鏁�
+    /// </summary>
+    [SugarColumn(ColumnName = "DNUM")]
+    public string? Dnum { get; set; }
 }
\ No newline at end of file
diff --git a/StandardInterface/MES.Service/service/QC/LljService.cs b/StandardInterface/MES.Service/service/QC/LljService.cs
index 01b0cbb..6f77e61 100644
--- a/StandardInterface/MES.Service/service/QC/LljService.cs
+++ b/StandardInterface/MES.Service/service/QC/LljService.cs
@@ -1264,4 +1264,235 @@
 
     }
 
+    /// <summary>
+    /// 鏍规嵁浜岀淮鐮佹煡璇㈢墿鏂欎俊鎭�
+    /// </summary>
+    /// <param name="itemBarcode">浜岀淮鐮佸唴瀹�</param>
+    /// <param name="currentBillNo">褰撳墠妫�楠屽崟鐨勫埌璐у崟鍙凤紙宸插簾寮冿紝淇濈暀鍙傛暟鍏煎鎬э級</param>
+    /// <returns>鐗╂枡淇℃伅</returns>
+    public List<MaterialInfoDto> GetMaterialByBarcode(string itemBarcode, string currentBillNo)
+    {
+        var db = SqlSugarHelper.GetInstance();
+        try
+        {
+            // 浣跨敤JOIN鏌ヨMES_INV_ITEM_BARCODES鍜孧ES_ITEMS琛�
+            var materialInfo = db.Queryable<MesInvItemBarcodes>()
+                .LeftJoin<MesItems>((b, m) => b.ItemId == m.Id)
+                .Where((b, m) => b.ItemBarcode == itemBarcode && b.ComeFlg == 1)
+                .Select((b, m) => new MaterialInfoDto
+                {
+                    ItemNo = b.ItemNo,        // 鐗╂枡缂栫爜
+                    OldQty = b.Oldqty,        // 鏁伴噺
+                    ItemId = b.ItemId,        // 鐗╂枡ID
+                    ItemName = m.ItemName,    // 鐗╂枡鍚嶇О
+                    ItemModel = m.ItemModel,  // 瑙勬牸鍨嬪彿
+                    BillNo = b.BillNo         // 鍒拌揣鍗曞彿
+                })
+                .ToList();
+            // 绉婚櫎鍒拌揣鍗曞彿鏍¢獙锛岀洿鎺ヨ繑鍥炴煡璇㈢粨鏋�
+            return materialInfo;
+        }
+        catch (Exception ex)
+        {
+            throw new Exception($"鏌ヨ鐗╂枡淇℃伅澶辫触: {ex.Message}");
+        }
+    }
+    /// <summary>
+    /// 鏌ヨ鐮村潖瀹為獙璁板綍鏄惁瀛樺湪
+    /// </summary>
+    /// <param name="billNo">鍒拌揣鍗曞彿</param>
+    /// <param name="releaseNo">妫�楠屽崟鍙�</param>
+    /// <returns>鏄惁瀛樺湪璁板綍</returns>
+    public bool CheckPhsyRecordExists(string billNo, string releaseNo)
+    {
+        var db = SqlSugarHelper.GetInstance();
+        try
+        {
+            var count = db.Queryable<MesInvPhsy>()
+                .Where(x => x.BillNo == billNo && x.ReleaseNo == releaseNo)
+                .Count();
+
+            return count > 0;
+        }
+        catch (Exception ex)
+        {
+            throw new Exception($"鏌ヨ鐮村潖瀹為獙璁板綍澶辫触: {ex.Message}");
+        }
+    }
+    /// <summary>
+    /// 鑾峰彇鐮村潖瀹為獙璁板綍璇︾粏淇℃伅
+    /// </summary>
+    /// <param name="billNo">鍒拌揣鍗曞彿</param>
+    /// <param name="releaseNo">妫�楠屽崟鍙�</param>
+    /// <returns>鐮村潖瀹為獙璁板綍淇℃伅</returns>
+    public List<PhsyRecordInfoDto> GetPhsyRecordInfo(string billNo, string releaseNo)
+    {
+        var db = SqlSugarHelper.GetInstance();
+        try
+        {
+            // 鍏堟煡璇㈢牬鍧忓疄楠岃褰�
+            var phsyRecords = db.Queryable<MesInvPhsy>()
+                .Where(x => x.BillNo == billNo && x.ReleaseNo == releaseNo)
+                .ToList();
+            var result = new List<PhsyRecordInfoDto>();
+
+            foreach (var record in phsyRecords)
+            {
+                // 灏濊瘯閫氳繃鏉$爜鏌ヨ鐗╂枡淇℃伅
+                var materialInfo = db.Queryable<MesInvItemBarcodes>()
+                    .LeftJoin<MesItems>((b, m) => b.ItemId == m.Id)
+                    .Where((b, m) => b.ItemBarcode == record.ItemBarcode)
+                    .Select((b, m) => new {
+                        ItemNo = b.ItemNo,
+                        ItemName = m.ItemName,
+                        ItemModel = m.ItemModel
+                    })
+                    .First();
+                var dto = new PhsyRecordInfoDto
+                {
+                    ItemBarcode = record.ItemBarcode,
+                    ItemNo = materialInfo?.ItemNo ?? record.ItemBarcode,
+                    ItemName = materialInfo?.ItemName ?? "宸茶褰曠墿鏂�",
+                    ItemModel = materialInfo?.ItemModel ?? "宸茶褰曡鏍�",
+                    BillNo = record.BillNo,
+                    Yqty = record.Yqty,
+                    Cqty = record.Cqty,
+                    CreateDate = record.CreateDate
+                };
+
+                result.Add(dto);
+            }
+
+            return result;
+        }
+        catch (Exception ex)
+        {
+            throw new Exception($"鑾峰彇鐮村潖瀹為獙璁板綍淇℃伅澶辫触: {ex.Message}");
+        }
+    }
+    /// <summary>
+    /// 璋冪敤鐮村潖瀹為獙瀛樺偍杩囩▼
+    /// </summary>
+    /// <param name="itemBarcode">鎵弿鐨勬潯鐮佸��</param>
+    /// <param name="yqty">鎵爜鏌ヨ鍑烘潵鐨勬潯鐮佹暟閲�</param>
+    /// <param name="cqty">濉啓鐨勭牬鍧忓疄楠屾暟閲�</param>
+    /// <param name="billNo">鏌ヨ鍒扮殑鍒拌揣鍗曞彿</param>
+    /// <param name="lx">鎿嶄綔绫诲瀷锛�1鏂板锛�2淇敼锛�3鍒犻櫎</param>
+    /// <param name="releaseNo">妫�楠屽崟鍙�</param>
+    /// <param name="itemId">鐗╂枡ID</param>
+    /// <returns>鎵ц缁撴灉</returns>
+    public (int result, string message) CallPhsyUpdateProcedure(string itemBarcode, decimal yqty, decimal cqty, string billNo, int lx, string releaseNo, decimal? itemId = null)
+    {
+        var db = SqlSugarHelper.GetInstance();
+        try
+        {
+            // 瀹氫箟杈撳叆鍙傛暟
+            var inputParam1 = new SugarParameter("P_ITEM_BARCODE", itemBarcode, DbType.String, ParameterDirection.Input);
+            var inputParam2 = new SugarParameter("P_YQTY", yqty, DbType.Decimal, ParameterDirection.Input);
+            var inputParam3 = new SugarParameter("P_CQTY", cqty, DbType.Decimal, ParameterDirection.Input);
+            var inputParam4 = new SugarParameter("P_BILL_NO", billNo, DbType.String, ParameterDirection.Input);
+            var inputParam5 = new SugarParameter("P_LX", lx, DbType.Int32, ParameterDirection.Input);
+            var inputParam6 = new SugarParameter("ITEM_ID", itemId ?? 0, DbType.Decimal, ParameterDirection.Input);
+            var inputParam7 = new SugarParameter("P_RELEASE_NO", releaseNo, DbType.String, ParameterDirection.Input);
+
+            // 瀹氫箟杈撳嚭鍙傛暟
+            var outputResult = new SugarParameter("PO_RESULT", null, DbType.Int32, ParameterDirection.Output);
+            var outputMessage = new SugarParameter("PO_MSG", null, DbType.String, ParameterDirection.Output, 4000);
+            // 浣跨敤SqlSugar鎵ц瀛樺偍杩囩▼
+            db.Ado.ExecuteCommand("BEGIN PRC_INV_PHSYUPDATE(:P_ITEM_BARCODE, :P_YQTY, :P_CQTY, :P_BILL_NO, :P_LX, :ITEM_ID, :P_RELEASE_NO, :PO_RESULT, :PO_MSG); END;",
+                inputParam1, inputParam2, inputParam3, inputParam4, inputParam5, inputParam6, inputParam7, outputResult, outputMessage);
+            // 鑾峰彇杈撳嚭鍙傛暟鐨勫��
+            var result = outputResult.Value == null ? 1 : Convert.ToInt32(outputResult.Value);
+            var message = outputMessage.Value?.ToString() ?? "";
+            return (result, message);
+        }
+        catch (Exception ex)
+        {
+            return (1, $"璋冪敤瀛樺偍杩囩▼澶辫触: {ex.Message}");
+        }
+    }
+    /// <summary>
+    /// 璁剧疆鍫电┐淇℃伅
+    /// </summary>
+    /// <param name="releaseNo">妫�楠屽崟鍙�</param>
+    /// <param name="blockedHoles">鍫电┐淇℃伅锛屾牸寮忓"1,2,3"</param>
+    /// <param name="itemId">妫�楠岄」鐩甀D</param>
+    /// <returns>鎵ц缁撴灉</returns>
+    public (int result, string message) SetBlockedHoles(string releaseNo, string blockedHoles, decimal itemId)
+    {
+        var db = SqlSugarHelper.GetInstance();
+        try
+        {
+            // 瑙f瀽鍫电┐淇℃伅
+            var blockedHolesList = blockedHoles.Split(',', '锛�')
+                .Select(s => s.Trim())
+                .Where(s => !string.IsNullOrEmpty(s))
+                .Select(s => int.Parse(s))
+                .ToList();
+            // 鑾峰彇妫�楠岄」鐩俊鎭�
+            var item = db.Queryable<MesQaItemsDetectDetail5>()
+                .Where(x => x.Id == itemId && x.ReleaseNo == releaseNo)
+                .First();
+            if (item == null)
+            {
+                return (1, "妫�楠岄」鐩笉瀛樺湪");
+            }
+            // 瑙f瀽寮�绌存暟
+            var holeCount = ParseHoleCount(item.FcheckItem);
+            if (holeCount == 0)
+            {
+                return (1, "璇ユ楠岄」鐩病鏈夌┐鏁颁俊鎭�");
+            }
+            // 楠岃瘉鍫电┐鏁伴噺涓嶈兘澶т簬绛変簬寮�绌存暟
+            if (blockedHolesList.Count >= holeCount)
+            {
+                return (1, $"鍫电┐鏁伴噺涓嶈兘澶т簬绛変簬寮�绌存暟锛坽holeCount}锛�");
+            }
+            // 楠岃瘉鍫电┐鍙锋槸鍚﹀湪鏈夋晥鑼冨洿鍐�
+            foreach (var hole in blockedHolesList)
+            {
+                if (hole < 1 || hole > holeCount)
+                {
+                    return (1, $"鍫电┐鍙峰繀椤诲湪1-{holeCount}涔嬮棿");
+                }
+            }
+            // 璁$畻鏂扮殑妫�楠屾暟閲�
+            var newCheckQyt = item.CheckQyt - (item.CheckQyt / holeCount) * blockedHolesList.Count;
+            // 鏇存柊鏁版嵁搴�
+            var result = SqlSugarHelper.UseTransactionWithOracle(db =>
+            {
+                return db.Updateable<MesQaItemsDetectDetail5>()
+                    .SetColumns(x => x.Dnum == blockedHoles)
+                    .SetColumns(x => x.CheckQyt == newCheckQyt)
+                    .Where(x => x.Id == itemId && x.ReleaseNo == releaseNo)
+                    .ExecuteCommand();
+            });
+            if (result > 0)
+            {
+                return (0, "鍫电┐璁剧疆鎴愬姛");
+            }
+            else
+            {
+                return (1, "鍫电┐璁剧疆澶辫触");
+            }
+        }
+        catch (Exception ex)
+        {
+            return (1, $"璁剧疆鍫电┐澶辫触: {ex.Message}");
+        }
+    }
+    /// <summary>
+    /// 瑙f瀽妫�楠岄」鐩悕绉颁腑鐨勭┐鏁�
+    /// </summary>
+    /// <param name="checkItemName">妫�楠岄」鐩悕绉�</param>
+    /// <returns>绌存暟锛屽鏋滄病鏈夌┐鏁颁俊鎭繑鍥�0</returns>
+    private int ParseHoleCount(string checkItemName)
+    {
+        if (string.IsNullOrEmpty(checkItemName))
+            return 0;
+        // 鍖归厤鏍煎紡锛氬昂瀵告鏌ワ紙5绌达級鎴� 灏哄妫�鏌�(5绌�)
+        var match = System.Text.RegularExpressions.Regex.Match(checkItemName, @"[锛�(](\d+)绌碵锛�)]");
+        return match.Success ? int.Parse(match.Groups[1].Value) : 0;
+    }
+
 }
\ No newline at end of file
diff --git a/StandardInterface/MESApplication/Controllers/QC/LljController.cs b/StandardInterface/MESApplication/Controllers/QC/LljController.cs
index 465fdfc..eb626a0 100644
--- a/StandardInterface/MESApplication/Controllers/QC/LljController.cs
+++ b/StandardInterface/MESApplication/Controllers/QC/LljController.cs
@@ -540,10 +540,314 @@
         }
     }
 
+    /// <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
diff --git a/StandardInterface/MESApplication/appsettings.json b/StandardInterface/MESApplication/appsettings.json
index 59a3601..28cfc2a 100644
--- a/StandardInterface/MESApplication/appsettings.json
+++ b/StandardInterface/MESApplication/appsettings.json
@@ -10,6 +10,6 @@
   "AppSettings": {
     "TestErpUrl": "http://192.168.11.120:8098/WebService1.asmx/mesToErpinfo",
     "ProductionErpUrl": "http://192.168.11.120:8098/WebService1.asmx/mesToErpinfoFormal",
-    "DataBaseConn": "Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.22)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = ORCL))); Persist Security Info=True;User ID = test_dev; Password=hmprd"
+    "DataBaseConn": "Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.22)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = ORCL))); Persist Security Info=True;User ID = hm_prd; Password=hmprd"
   }
 }

--
Gitblit v1.9.3