From b289e477c13910c2814d89915342a7edabee5a8d Mon Sep 17 00:00:00 2001 From: xwt <2740516069@qq.com> Date: 星期四, 14 八月 2025 08:45:01 +0800 Subject: [PATCH] 巡检入库检修改 --- StandardInterface/MES.Service/service/QC/XJService.cs | 93 ++++++++++++++++++++++++++-------------------- 1 files changed, 53 insertions(+), 40 deletions(-) diff --git a/StandardInterface/MES.Service/service/QC/XJService.cs b/StandardInterface/MES.Service/service/QC/XJService.cs index efcf669..af5750a 100644 --- a/StandardInterface/MES.Service/service/QC/XJService.cs +++ b/StandardInterface/MES.Service/service/QC/XJService.cs @@ -71,21 +71,43 @@ }).OrderBy("b.LINE_NO").ToList(); } - public List<Womdaa> getDaa001(string daa020, string item) + public List<Womdaa> getDaa001(string daa020) { var db = SqlSugarHelper.GetInstance(); - return db.Queryable<Womdaa, MesItems>((a, b) => - new JoinQueryInfos(JoinType.Inner, a.Daa002 == b.Id.ToString())) - .Where((a, b) => - a.Daa015 == daa020 && - b.ItemNo == item && - statusArray.Contains(a.Daa018)) - .Select<Womdaa>(a => new Womdaa + return db.Queryable<Womdaa>() + .Where(a => a.Daa015 == daa020 && statusArray.Contains(a.Daa018)) + .Select(a => new Womdaa { Id = a.Id, Daa001 = a.Daa001, Daa003 = a.Daa003, Daa008 = a.Daa008 + }).ToList(); + } + + /// <summary> + /// 鑾峰彇宸ュ崟璇︾粏淇℃伅锛堝寘鍚墿鏂欎俊鎭級 + /// </summary> + /// <param name="daa020">绾夸綋缂栧彿</param> + /// <returns>宸ュ崟鍒楄〃锛堝寘鍚墿鏂欎俊鎭級</returns> + public List<WorkOrderWithItemDto> getWorkOrderWithItem(string daa020) + { + var db = SqlSugarHelper.GetInstance(); + return db.Queryable<Womdaa, MesItems>((a, b) => + new JoinQueryInfos(JoinType.Inner, a.Daa002 == b.Id.ToString())) + .Where((a, b) => a.Daa015 == daa020 && statusArray.Contains(a.Daa018)) + .Select((a, b) => new WorkOrderWithItemDto + { + Id = a.Id, + Daa001 = a.Daa001, + Daa002 = a.Daa002, + Daa003 = a.Daa003, + Daa008 = a.Daa008, + Daa015 = a.Daa015, + Daa020 = a.Daa020, + ItemNo = b.ItemNo, + ItemName = b.ItemName, + ItemModel = b.ItemModel }).ToList(); } @@ -137,7 +159,7 @@ .WhereIF( StringUtil.IsNotNullOrEmpty(queryObj.result) && !"鏈畬鎴�".Equals(queryObj.result), - (s, a, c, b) => s.Fsubmit != 1) + (s, a, c, b) => s.Fsubmit == 1) .WhereIF(id > 0, (s, a, c, b) => s.Id == id) .Select((s, a, c, b) => new QsQaItemXj { @@ -259,6 +281,7 @@ xj.CreateBy = userNo; xj.CreateDate = DateTime.Now; + xj.Fsubmit = 0; // 璁剧疆榛樿鐘舵�佷负鏈彁浜� var pid = db.Insertable(xj).ExecuteReturnIdentity(); @@ -273,8 +296,10 @@ return commit; }); + // 閲嶆柊鑾峰彇妫�楠岄」鐩紙鍖呭惈ID锛� xjDto.items = getJYItem(xj.Id, null); + // 鑷姩涓烘病鏈変笂涓嬮檺鐨勬楠岄」鐩敓鎴愰粯璁ょ殑鍚堟牸璁板綍 xjDto.items.ForEach(s => { if (s.MaxValue != null || s.StandardValue != null || @@ -288,6 +313,9 @@ detail.count = (int?)s.LevelNum; SetQSItemDetail(detail); }); + + // 閲嶆柊鑾峰彇妫�楠岄」鐩紙鍖呭惈鑷姩鐢熸垚鐨勭粨鏋滐級 + xjDto.items = getJYItem(xj.Id, null); return Convert.ToInt32(xj.Id); } @@ -563,39 +591,24 @@ { try { - // 瀹氫箟杈撳嚭鍙傛暟 - var outputResult = new SugarParameter("c_res", null, - System.Data.DbType.Int32, ParameterDirection.Output, - 4000); - - var outputMessage = new SugarParameter("c_msg", null, - System.Data.DbType.String, - ParameterDirection.Output, 4000); - - // 瀹氫箟杈撳叆鍙傛暟锛屽浐瀹欶LAG涓�1锛堝鏍革級 - var parameters = new List<SugarParameter> - { - new("P_ID", dto.id, System.Data.DbType.Decimal, ParameterDirection.Input), - new("P_FLAG", 1, System.Data.DbType.Int32, ParameterDirection.Input), - new("P_USER", dto.userNo, System.Data.DbType.String, ParameterDirection.Input), - outputResult, - outputMessage - }; - var db = SqlSugarHelper.GetInstance(); + + // 鐩存帴鏇存柊Fsubmit瀛楁涓�1锛堝凡鎻愪氦鐘舵�侊級 + var result = db.Updateable<QsQaItemXj>() + .SetColumns(s => s.Fsubmit == 1) + .SetColumns(s => s.FsubmitBy == dto.userNo) + .SetColumns(s => s.FsubmitDate == DateTime.Now) + .Where(s => s.Id == dto.id) + .ExecuteCommand(); - // 浣跨敤 SqlSugar 鎵ц瀛樺偍杩囩▼ - db.Ado.ExecuteCommand( - "BEGIN PRC_WOMDAA_XJ_UPDATE_RES(:P_ID, :P_FLAG, :P_USER, :c_res, :c_msg); END;", - parameters.ToArray()); - - // 鑾峰彇杈撳嚭鍙傛暟鐨勫�� - var resultValue = outputResult.Value?.ToString(); - var messageValue = outputMessage.Value?.ToString(); - - if ("1".Equals(resultValue)) throw new Exception(messageValue); - - return true; + if (result > 0) + { + return true; + } + else + { + throw new Exception("鎻愪氦澶辫触锛氭湭鎵惧埌瀵瑰簲鐨勬楠屽崟"); + } } catch (Exception ex) { -- Gitblit v1.9.3