| | |
| | | using MES.Service.Dto.service; |
| | | using MES.Service.Modes; |
| | | using MES.Service.util; |
| | | using MySqlConnector; |
| | | using Newtonsoft.Json; |
| | | using SharpCompress.Factories; |
| | | using SqlSugar; |
| | | using System.Data; |
| | | using System.Xml.Linq; |
| | | using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; |
| | | using DbType = System.Data.DbType; |
| | | |
| | |
| | | |
| | | var pageList = db |
| | | .Queryable<LtsLlj, IqcBefore, VMesQaItemsDetect01, SysUser, |
| | | IqcBeforeFrom, SysUser>((a, b, d, e, f, g) => |
| | | IqcBeforeFrom, SysUser, InspectorChangeLog, SysUser>((a, b, d, e, f, g,h,i) => |
| | | new JoinQueryInfos(JoinType.Left, a.ItemId == b.ItemId, |
| | | JoinType.Inner, a.Id == d.Id, |
| | | JoinType.Left, a.CreateBy == e.Fcode, |
| | | JoinType.Left, f.Id == b.PID, |
| | | JoinType.Left, f.Sid == g.Fid |
| | | JoinType.Left, f.Sid == g.Fid, |
| | | JoinType.Left,a.ReleaseNo==h.InspectionNo && h.IsValid=="Y", |
| | | JoinType.Left,i.Fcode==h.Inspector |
| | | )) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.result) && |
| | |
| | | // itemIds is { Length: > 0 }, |
| | | // (a, b, c) => itemIds.Contains(a.ItemId)) |
| | | .WhereIF(id > 0, (a, b, d) => a.Id == id) |
| | | .WhereIF(true, |
| | | (a, b, d, e, f, g) => |
| | | (g.Fcode == queryObj.createUser || g.Fcode == null)) |
| | | .WhereIF(queryObj.createUser!="PL017"&& queryObj.UserIndex=="0", (a, b, d, e, f, g,h, i) => (g.Fcode == queryObj.createUser || i.Fcode == queryObj.createUser))//判断此单的检验员,或者检验为空就显示此单据 |
| | | //加筛选条件,根据供应商,物料编码,物料名称,项目搜索 |
| | | //.WhereIF(queryObj.SearchValue != null && queryObj.SearchValue != "", |
| | | //(a, b, d) => (a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower()) |
| | |
| | | //)) |
| | | |
| | | //根据下拉框搜索条件筛选(0项目, 1物料编号, 2物料名称, 3供应商, 4采购员) |
| | | .WhereIF( |
| | | queryObj.SelectedIndex == "0" && queryObj.SearchValue != null && |
| | | queryObj.SearchValue != "", |
| | | (a, b, d) => (d.ProjectCodes.ToLower() |
| | | .Contains(queryObj.SearchValue.ToLower()))) |
| | | .WhereIF( |
| | | queryObj.SelectedIndex == "1" && queryObj.SearchValue != null && |
| | | queryObj.SearchValue != "", |
| | | (a, b, d) => (a.ItemNo.ToLower() |
| | | .Contains(queryObj.SearchValue.ToLower()))) |
| | | .WhereIF( |
| | | queryObj.SelectedIndex == "2" && queryObj.SearchValue != null && |
| | | queryObj.SearchValue != "", |
| | | (a, b, d) => (a.ItemName.ToLower() |
| | | .Contains(queryObj.SearchValue.ToLower()))) |
| | | .WhereIF( |
| | | queryObj.SelectedIndex == "3" && queryObj.SearchValue != null && |
| | | queryObj.SearchValue != "", |
| | | (a, b, d) => (a.SuppName.ToLower() |
| | | .Contains(queryObj.SearchValue.ToLower()))) |
| | | .WhereIF( |
| | | queryObj.SelectedIndex == "4" && queryObj.SearchValue != null && |
| | | queryObj.SearchValue != "", |
| | | (a, b, d, e) => (e.Fname.ToLower() |
| | | .Contains(queryObj.SearchValue.ToLower()))) |
| | | .WhereIF(queryObj.SelectedIndex == "0" && queryObj.SearchValue != null && queryObj.SearchValue != "", (a, b, d) => (d.ProjectCodes.ToLower().Contains(queryObj.SearchValue.ToLower()))) |
| | | .WhereIF(queryObj.SelectedIndex == "1" && queryObj.SearchValue != null && queryObj.SearchValue != "", (a, b, d) => (a.ItemNo.ToLower().Contains(queryObj.SearchValue.ToLower()))) |
| | | .WhereIF(queryObj.SelectedIndex == "2" && queryObj.SearchValue != null && queryObj.SearchValue != "", (a, b, d) => (a.ItemName.ToLower().Contains(queryObj.SearchValue.ToLower()))) |
| | | .WhereIF(queryObj.SelectedIndex == "3" && queryObj.SearchValue != null && queryObj.SearchValue != "", (a, b, d) => (a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower()))) |
| | | .WhereIF(queryObj.SelectedIndex == "4" && queryObj.SearchValue != null && queryObj.SearchValue != "", (a, b, d, e) => (e.Fname.ToLower().Contains(queryObj.SearchValue.ToLower()))) |
| | | .OrderByDescending((a, b, d) => a.Id) |
| | | .Select((a, b, d, e, f, g) => new LtsLlj |
| | | .Select((a, b, d, e, f, g,h,i) => new LtsLlj |
| | | { |
| | | UserName = g.Fname, |
| | | //UserName = g.Fname, |
| | | //UserName = (i.Fname!=null ||i.Fname!="") ? i.Fname : g.Fname, |
| | | UserName = (i.Fname!=null ||i.Fname!="") ? i.Fname : g.Fname, |
| | | FIRST = d.First, |
| | | CreateUserName = e.Fname, |
| | | NewFngDesc = d.NewFngDesc, |
| | |
| | | var parameters = new List<SugarParameter> |
| | | { |
| | | new("P_RELEASE_NO", releaseNo, |
| | | DbType.String, ParameterDirection.Input), |
| | | outputResult, |
| | | outputMessage |
| | | DbType.String, ParameterDirection.Input), |
| | | outputResult, |
| | | outputMessage |
| | | }; |
| | | |
| | | var db = SqlSugarHelper.GetInstance(); |
| | |
| | | msg[0] = resultValue; |
| | | msg[1] = messageValue; |
| | | return msg; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 保存新检验员 |
| | | /// </summary> |
| | | /// <param name="NewStaffUserID">新检验员ID</param> |
| | | /// <param name="userID">修改人</param> |
| | | /// <param name="releaseNo">检验单号</param> |
| | | /// <returns></returns> |
| | | public string[] SaveCheckBy(string NewStaffUserID, string userID, string releaseNo) |
| | | { |
| | | // 定义输出参数 |
| | | var outputResult = new SugarParameter("o_Result", null, |
| | | DbType.Int32, ParameterDirection.Output, |
| | | 4000); |
| | | |
| | | var outputMessage = new SugarParameter("o_Msg", null, |
| | | DbType.String, |
| | | ParameterDirection.Output, 4000); |
| | | |
| | | // 定义输入参数 |
| | | var parameters = new List<SugarParameter> |
| | | { |
| | | new("P_FCHECK_BY", NewStaffUserID, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("p_Release_No", releaseNo, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("p_User", userID, |
| | | DbType.String, ParameterDirection.Input), |
| | | |
| | | outputResult, |
| | | outputMessage |
| | | }; |
| | | |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | // 使用 SqlSugar 执行存储过程 |
| | | db.Ado.ExecuteCommand( |
| | | "BEGIN Prc_Mes_Iqc_Qa_Update_CheckBy(:P_FCHECK_BY,:p_Release_No,:p_User, :o_Result, :o_Msg); END;", |
| | | parameters.ToArray()); |
| | | |
| | | // 获取输出参数的值 |
| | | var resultValue = outputResult.Value?.ToString(); |
| | | var messageValue = outputMessage.Value?.ToString(); |
| | | string[] msg = new string[2]; |
| | | msg[0] = resultValue; |
| | | msg[1] = messageValue; |
| | | return msg; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | public string[] SaveSysSubmit(SysSubmit sysSubmit) |
| | | { |
| | |
| | | var parameters = new List<SugarParameter> |
| | | { |
| | | new("PI_BILLNO", sysSubmit.PI_BILLNO, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_USER", sysSubmit.PI_USER, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_SAMPLE_STATUS", sysSubmit.PI_SAMPLE_STATUS, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_SAMPLE_TYPE", sysSubmit.PI_SAMPLE_TYPE, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_SAMPLE_REASON", sysSubmit.PI_SAMPLE_REASON, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_INSPECT_TYPE", sysSubmit.PI_INSPECT_TYPE, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_SAMPLE_PREPARATION", sysSubmit.PI_SAMPLE_PREPARATION, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_URGENCY", sysSubmit.PI_URGENCY, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_FIRMWAREVERSION", sysSubmit.PI_FIRMWAREVERSION, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_HARDWAREVERSION", sysSubmit.PI_HARDWAREVERSION, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_REMARK", sysSubmit.PI_REMARK, |
| | | DbType.String, ParameterDirection.Input), |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_USER", sysSubmit.PI_USER, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_SAMPLE_STATUS", sysSubmit.PI_SAMPLE_STATUS, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_SAMPLE_TYPE", sysSubmit.PI_SAMPLE_TYPE, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_SAMPLE_REASON", sysSubmit.PI_SAMPLE_REASON, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_INSPECT_TYPE", sysSubmit.PI_INSPECT_TYPE, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_SAMPLE_PREPARATION", sysSubmit.PI_SAMPLE_PREPARATION, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_URGENCY", sysSubmit.PI_URGENCY, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_FIRMWAREVERSION", sysSubmit.PI_FIRMWAREVERSION, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_HARDWAREVERSION", sysSubmit.PI_HARDWAREVERSION, |
| | | DbType.String, ParameterDirection.Input), |
| | | new("PI_REMARK", sysSubmit.PI_REMARK, |
| | | DbType.String, ParameterDirection.Input), |
| | | outputResult, |
| | | outputMessage |
| | | }; |
| | | }; |
| | | |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | |
| | | msg[0] = resultValue; |
| | | msg[1] = messageValue; |
| | | return msg; |
| | | } |
| | | |
| | | } |
| | | private string ExtractSubstring(string input, char startChar, char endChar) |
| | | { |
| | | var startIndex = input.IndexOf(startChar); |
| | |
| | | FcheckItemDesc = a.FcheckItemDesc |
| | | }).ToList(); |
| | | } |
| | | |
| | | |
| | | |
| | | public DataTable getAllInspectors() |
| | | { |
| | | OracleSQLHelper SQLHelper = new(); |
| | | var sql =string.Format(@"select a.USER_NAME label,U.FCODE value from IQC_BEFORE_FROM a JOIN SYS_USER U ON U.FID=A.SID"); |
| | | return SQLHelper.ExecuteQuery(sql); |
| | | } |
| | | |
| | | |
| | | public int SetQSItemDetail(MesQaItemsDetectDetail12 detail) |
| | | { |
| | |
| | | return withOracle; |
| | | } |
| | | |
| | | public bool IqcQaSubmit(LLJDto dto) |
| | | public string[] IqcQaSubmit(LLJDto dto) |
| | | { |
| | | var (factory, company) = UserUtil.GetFactory(dto.userNo); |
| | | try |
| | |
| | | // 获取输出参数的值 |
| | | var resultValue = outputResult.Value?.ToString(); |
| | | var messageValue = outputMessage.Value?.ToString(); |
| | | |
| | | if ("1".Equals(resultValue)) throw new Exception(messageValue); |
| | | |
| | | return true; |
| | | string[] msg = new string[2]; |
| | | msg[0] = resultValue; |
| | | msg[1] = messageValue; |
| | | return msg; |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |