| | |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.Result) && |
| | | "未完成".Equals(queryObj.Result), |
| | | a => a.Result == queryObj.Result) |
| | | a => SqlFunc.IsNull(a.Fsubmit, "0") != "1") |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.Result) && |
| | | !"未完成".Equals(queryObj.Result), |
| | | a => a.Result != "未完成") |
| | | a => a.Fsubmit == "1") |
| | | .OrderBy(a => a.BillNo, OrderByType.Desc) |
| | | .ToPageList(queryObj.PageIndex, queryObj.Limit); |
| | | |
| | | return data; |
| | | } |
| | | |
| | | //获取所有数据分页(携带总数) |
| | | public (List<SJPageResult> data, int totalCount) getPageWithTotal(SJPageResult queryObj) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | string[]? lineNo = null; |
| | | |
| | | if (StringUtil.IsNotNullOrEmpty(queryObj.StatusUser)) |
| | | lineNo = _baseService.getUserLineNo(queryObj.StatusUser); |
| | | |
| | | int totalCount = 0; |
| | | var data = db.Queryable<SJPageResult>() |
| | | .WhereIF(lineNo != null && lineNo.Length > 0, |
| | | a => lineNo.Contains(a.line)) |
| | | .WhereIF(queryObj.Id != null, a => a.Id == queryObj.Id) |
| | | .WhereIF(StringUtil.IsNotNullOrEmpty(queryObj.BillNo), |
| | | a => a.BillNo == queryObj.BillNo) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.Result) && |
| | | "未完成".Equals(queryObj.Result), |
| | | a => SqlFunc.IsNull(a.Fsubmit, "0") != "1") |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.Result) && |
| | | !"未完成".Equals(queryObj.Result), |
| | | a => a.Fsubmit == "1") |
| | | .OrderBy(a => a.BillNo, OrderByType.Desc) |
| | | .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount); |
| | | |
| | | return (data, totalCount); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | return withOracle; |
| | | } |
| | | |
| | | public int SJQaSubmit(string userNo, decimal id) |
| | | { |
| | | return SqlSugarHelper.UseTransactionWithOracle(db => |
| | | { |
| | | var commit = 0; |
| | | |
| | | // 提交首检单 |
| | | var sql = "update QS_ITEM_IPI_REQ set FSUBMIT=1, FSUBMIT_BY=:userNo, FSUBMIT_DATE=SYSDATE where ID=:id"; |
| | | var parameters = new List<SugarParameter> |
| | | { |
| | | new(":userNo", userNo), |
| | | new(":id", id) |
| | | }; |
| | | commit += db.Ado.ExecuteCommand(sql, parameters); |
| | | |
| | | // 读取首检单,取结果与计划编号 |
| | | var req = db.Queryable<QsItemIpiReq>().Single(s => s.Id == id); |
| | | if (req != null) |
| | | { |
| | | // 通过 PBAID 找到 WOMDAA 获取计划编号 DAA001 |
| | | var wom = db.Queryable<Womdaa>().Single(s => s.Id == req.Pbaid); |
| | | if (wom != null && !string.IsNullOrWhiteSpace(wom.Daa001)) |
| | | { |
| | | var resultText = req.IsPass == 1 ? "合格" : "不合格"; |
| | | // 更新 WOMDAA:首检标记与结果 |
| | | commit += db.Updateable<Womdaa>() |
| | | .SetColumns(w => w.Daa025 == "1") |
| | | .SetColumns(w => w.Daa026 == resultText) |
| | | .Where(w => w.Daa001 == wom.Daa001) |
| | | .ExecuteCommand(); |
| | | } |
| | | } |
| | | |
| | | return commit; |
| | | }); |
| | | } |
| | | |
| | | public (int code, string message) GenUpdateSJ(decimal id, string no, string userNo) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | // 输出参数 |
| | | var poResult = new SugarParameter("PO_RESULT", null, System.Data.DbType.Int32, System.Data.ParameterDirection.Output, 4000); |
| | | var poText = new SugarParameter("PO_TEXT", null, System.Data.DbType.String, System.Data.ParameterDirection.Output, 4000); |
| | | |
| | | // 输入参数 + 输出参数 |
| | | var parameters = new List<SugarParameter> |
| | | { |
| | | new("P_ID", id, System.Data.DbType.Decimal, System.Data.ParameterDirection.Input), |
| | | new("P_NO", no ?? string.Empty, System.Data.DbType.String, System.Data.ParameterDirection.Input), |
| | | new("P_USER", userNo ?? string.Empty, System.Data.DbType.String, System.Data.ParameterDirection.Input), |
| | | poResult, |
| | | poText |
| | | }; |
| | | |
| | | // 与来料检一致的调用风格 |
| | | db.Ado.ExecuteCommand( |
| | | "BEGIN PRC_GEN_UPDATE_SJ(:P_ID, :P_NO, :P_USER, :PO_RESULT, :PO_TEXT); END;", |
| | | parameters.ToArray()); |
| | | |
| | | var code = Convert.ToInt32(poResult.Value?.ToString() ?? "0"); |
| | | var message = poText.Value?.ToString() ?? ""; |
| | | return (code, message); |
| | | } |
| | | } |