| | |
| | | }).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(); |
| | | } |
| | | |
| | |
| | | .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 |
| | | { |
| | |
| | | |
| | | xj.CreateBy = userNo; |
| | | xj.CreateDate = DateTime.Now; |
| | | xj.Fsubmit = 0; // 设置默认状态为未提交 |
| | | |
| | | var pid = db.Insertable(xj).ExecuteReturnIdentity(); |
| | | |
| | |
| | | return commit; |
| | | }); |
| | | |
| | | // 重新获取检验项目(包含ID) |
| | | xjDto.items = getJYItem(xj.Id, null); |
| | | |
| | | // 自动为没有上下限的检验项目生成默认的合格记录 |
| | | xjDto.items.ForEach(s => |
| | | { |
| | | if (s.MaxValue != null || s.StandardValue != null || |
| | |
| | | detail.count = (int?)s.LevelNum; |
| | | SetQSItemDetail(detail); |
| | | }); |
| | | |
| | | // 重新获取检验项目(包含自动生成的结果) |
| | | xjDto.items = getJYItem(xj.Id, null); |
| | | |
| | | return Convert.ToInt32(xj.Id); |
| | | } |
| | |
| | | { |
| | | 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); |
| | | |
| | | // 定义输入参数,固定FLAG为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) |
| | | { |