| | |
| | | public string? LotNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 送货单号 |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "PAPER_BILL_NO")] |
| | | public string? PaperBillNo { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 处理方法 |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "FNG_HANDLE")] |
| | |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 供应商搜索 |
| | | a => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 到货单号搜索 |
| | | a => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | a => a.PaperBillNo != null && a.PaperBillNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 检验单号搜索 |
| | | a => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 物料规格搜索 |
| | |
| | | ItemName = a.ItemName, |
| | | ItemModel = a.ItemModel, |
| | | SuppName = a.SuppName, |
| | | PaperBillNo = a.PaperBillNo, |
| | | LotNo = a.LotNo, |
| | | ReleaseNo = a.ReleaseNo, |
| | | FcheckResu = a.FcheckResu, |
| | |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 供应商搜索 |
| | | (a, v) => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 到货单号搜索 |
| | | (a, v) => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | (a, v) => a.PaperBillNo != null && a.PaperBillNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 检验单号搜索 |
| | | (a, v) => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 物料规格搜索 |
| | |
| | | ItemName = a.ItemName, |
| | | ItemModel = a.ItemModel, |
| | | SuppName = a.SuppName, |
| | | PaperBillNo = a.PaperBillNo, |
| | | LotNo = a.LotNo, |
| | | ReleaseNo = a.ReleaseNo, |
| | | FcheckResu = a.FcheckResu, |
| | |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 供应商搜索 |
| | | a => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 到货单号搜索 |
| | | a => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | a => a.PaperBillNo != null && a.PaperBillNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 检验单号搜索 |
| | | a => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 物料规格搜索 |
| | |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 供应商搜索 |
| | | (a, v) => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 到货单号搜索 |
| | | (a, v) => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | (a, v) => a.PaperBillNo != null && a.PaperBillNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 检验单号搜索 |
| | | (a, v) => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 物料规格搜索 |
| | |
| | | /// <param name="id">检验单ID</param> |
| | | /// <param name="userNo">提交用户</param> |
| | | /// <returns>更新结果</returns> |
| | | public int SubmitInspection(decimal id, string userNo) |
| | | public bool SubmitInspection(decimal id, string userNo) |
| | | { |
| | | return SqlSugarHelper.UseTransactionWithOracle(db => |
| | | try |
| | | { |
| | | // 获取检验单详细信息 |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | // 先获取检验单详细信息(用于钉钉推送判断) |
| | | var inspectionData = db.Queryable<QsItemOqcReq>() |
| | | .Where(it => it.Id == id) |
| | | .First(); |
| | |
| | | throw new Exception("检验单不存在"); |
| | | } |
| | | |
| | | // 定义输出参数 |
| | | var outputResult = new SugarParameter("PO_RESULT", null, |
| | | System.Data.DbType.Int32, ParameterDirection.Output, |
| | | 4000); |
| | | |
| | | var outputMessage = new SugarParameter("PO_MSG", null, |
| | | System.Data.DbType.String, |
| | | ParameterDirection.Output, 4000); |
| | | |
| | | // 定义输入参数 |
| | | var parameters = new List<SugarParameter> |
| | | { |
| | | new("P_ID", id, System.Data.DbType.Decimal, ParameterDirection.Input), |
| | | new("P_USER", userNo, System.Data.DbType.String, ParameterDirection.Input), |
| | | outputResult, |
| | | outputMessage |
| | | }; |
| | | |
| | | // 使用 SqlSugar 执行存储过程 |
| | | db.Ado.ExecuteCommand( |
| | | "BEGIN PRC_RKJ_UPDATE_SH(:P_ID, :P_USER, :PO_RESULT, :PO_MSG); END;", |
| | | parameters.ToArray()); |
| | | |
| | | // 获取输出参数的值 |
| | | var resultValue = outputResult.Value?.ToString(); |
| | | var messageValue = outputMessage.Value?.ToString(); |
| | | |
| | | // 如果返回结果不为0,表示失败 |
| | | if ("1".Equals(resultValue)) |
| | | { |
| | | throw new Exception(messageValue ?? "提交失败"); |
| | | } |
| | | |
| | | // 存储过程执行成功后,处理钉钉推送逻辑 |
| | | // 检查钉钉推送条件:PSZT为待判,且不良原因、不良描述、所属车间不为空 |
| | | bool shouldPushToDingTalk = inspectionData.Pszt == "待判" && |
| | | !string.IsNullOrEmpty(inspectionData.Blyy) && |
| | |
| | | } |
| | | } |
| | | |
| | | // 更新检验单状态 |
| | | return db.Updateable<QsItemOqcReq>() |
| | | .SetColumns(it => it.Fsubmit == 1) // 设置提交状态为1(已提交) |
| | | .SetColumns(it => it.FcheckBy == userNo) // 设置检验人 |
| | | .SetColumns(it => it.FcheckDate == DateTime.Now) // 设置检验时间 |
| | | .Where(it => it.Id == id) |
| | | .ExecuteCommand(); |
| | | }); |
| | | return true; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | 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()); |
| | | |
| | | if (result > 0) |
| | | { |
| | | // 获取输出参数的值 |
| | | var resultValue = outputResult.Value?.ToString(); |
| | | var messageValue = outputMessage.Value?.ToString(); |
| | | |
| | | if ("1".Equals(resultValue)) throw new Exception(messageValue); |
| | | |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("提交失败:未找到对应的检验单"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |