| | |
| | | |
| | | public string? FName { get; set; } |
| | | |
| | | //删除:放入单据头体--池南骏 2025-01-02 |
| | | //public string? FPostDept { get; set; } |
| | | /// <summary> |
| | | /// 接口字段调整:将FPost字段重命名为FPostId。 |
| | | /// 所属部门ID |
| | | /// </summary> |
| | | /// <remarks> |
| | | /// 修改人:池南骏 |
| | | /// 修改日期:2024-12-25 |
| | | /// 修改说明: |
| | | /// - 原代码:`public string? FPost { get; set; }` |
| | | /// - 修改后:`public string? FPostId { get; set; }` |
| | | /// -2025-01-02 :二次修改删除。 |
| | | /// </remarks> |
| | | /// //删除:放入单据头体--池南骏 2025-01-02 |
| | | //public string? FPostId { get; set; } |
| | | public string? fPostDept { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 所属岗位ID |
| | | /// </summary> |
| | | public string? fPostId { get; set; } |
| | | public string? FMobile { get; set; } |
| | | |
| | | /// <summary> |
| | |
| | | /// </remarks> |
| | | public string? FDocumentStatus { get; set; } |
| | | |
| | | //删除:放入单据头体--池南骏 2025-01-02 |
| | | //public string? FStaffStartDate { get; set; } |
| | | /// <summary> |
| | | /// 任岗开始日期 |
| | | /// </summary> |
| | | public string? fStaffStartDate { get; set; } |
| | | public string? FDescription { get; set; } |
| | | public string? FForbidStatus { get; set; } |
| | | public string? FCreateOrgId { get; set; } |
| | |
| | | [SugarColumn(ColumnName = "FFORBID_STATUS")] |
| | | public string? FforbidStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 所属部门ID |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "fpostdeptid")] |
| | | public decimal? FPostDeptid { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 所属岗位ID |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "fpostid")] |
| | | public decimal? FPostId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 任岗开始日期 |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "fstaffstartdate")] |
| | | public DateTime? FStaffStartDate { get; set; } |
| | | |
| | | [SugarColumn(IsIgnore = true)] public string? Type { get; set; } |
| | | } |
| | |
| | | public decimal? Tet { get; set; } |
| | | |
| | | [SugarColumn(IsIgnore = true)] public string? Type { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 部门编码 |
| | | /// </summary> |
| | | [Column("FPOSTDEPTID")] |
| | | [SugarColumn(ColumnName = "FPOSTDEPTID")] //用于SqlSugar |
| | | public decimal? fPostdeptid { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 岗位编码 |
| | | /// </summary> |
| | | [Column("FPOSTID")] |
| | | [SugarColumn(ColumnName = "FPOSTID")] //用于SqlSugar |
| | | public decimal? fPostid { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 岗位编码 |
| | | /// </summary> |
| | | [Column("FSTAFFSTARTDATE")] |
| | | [SugarColumn(ColumnName = "FSTAFFSTARTDATE")] //用于SqlSugar |
| | | public DateTime? fStaffstartdate { get; set; } |
| | | |
| | | |
| | | } |
| | |
| | | { |
| | | var insertUser = db.Insertable(sysUser).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | // 如果SysUser已存在,则更新相关字段 |
| | | var updateUser = db.Updateable<SysUser>() |
| | | .SetColumns(s => s.Fcode == sysUser.Fcode) |
| | | .SetColumns(s => s.Fname == sysUser.Fname) |
| | | .SetColumns(s => s.fPostid == sysUser.fPostid) |
| | | .SetColumns(s => s.fPostdeptid == sysUser.fPostdeptid) |
| | | .SetColumns(s => s.fStaffstartdate == sysUser.fStaffstartdate) |
| | | .SetColumns(s => s.LastupdateDate == DateTime.Now) |
| | | .Where(s => s.Sid == sysUser.Sid) |
| | | .ExecuteCommand(); |
| | | } |
| | | |
| | | |
| | | db.Deleteable<MesStaff>() |
| | | // 检查MES_STAFF记录是否存在 |
| | | var staffExists = db.Queryable<MesStaff>().Any(s => s.Id == entity.Id); |
| | | |
| | | int insertStaff; |
| | | if (staffExists) |
| | | { |
| | | // 如果记录存在,则更新 |
| | | insertStaff = db.Updateable(entity) |
| | | .Where(s => s.Id == entity.Id) |
| | | .ExecuteCommand(); |
| | | |
| | | var insertStaff = |
| | | db.Insertable(entity).IgnoreColumns(true).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | // 如果记录不存在,则插入 |
| | | insertStaff = db.Insertable(entity).ExecuteCommand(); |
| | | } |
| | | |
| | | |
| | | var insertPosition = 1; |
| | |
| | | // 将 ErpStaff 对象转换为 MesStaff 对象的方法 |
| | | private MesStaff GetMesStaff(ErpStaff staff) |
| | | { |
| | | // 从ErpStaffDetails中获取岗位和部门信息 |
| | | decimal? postId = null; |
| | | decimal? postDeptId = null; |
| | | DateTime? staffStartDate = null; |
| | | |
| | | if (staff.ErpStaffDetails != null && staff.ErpStaffDetails.Count > 0) |
| | | { |
| | | var firstDetail = staff.ErpStaffDetails.First(); |
| | | if (!string.IsNullOrEmpty(firstDetail.fPostId)) |
| | | postId = Convert.ToDecimal(firstDetail.fPostId); |
| | | if (!string.IsNullOrEmpty(firstDetail.fPostDeptid)) |
| | | postDeptId = Convert.ToDecimal(firstDetail.fPostDeptid); |
| | | if (!string.IsNullOrEmpty(firstDetail.fStaffStartDate)) |
| | | staffStartDate = DateTime.ParseExact(firstDetail.fStaffStartDate, "yyyy-MM-dd HH:mm:ss", null); |
| | | } |
| | | |
| | | var entity = new MesStaff |
| | | { |
| | | Id = Convert.ToDecimal(staff.Id), |
| | |
| | | CreateDate = DateTime.Now, |
| | | Remark = staff.FDescription, |
| | | FDOCUMENTSTATUS = staff.FDocumentStatus, |
| | | FforbidStatus = staff.FForbidStatus |
| | | FforbidStatus = staff.FForbidStatus, |
| | | // 新增字段映射 |
| | | FPostId = postId, |
| | | FPostDeptid = postDeptId, |
| | | FStaffStartDate = staffStartDate |
| | | }; |
| | | |
| | | //删除 2025-01-04 池南骏 |
| | | //if (staff.FStaffStartDate != null) |
| | | // entity.StartDate = DateTime.ParseExact(staff.FStaffStartDate, |
| | | // "yyyy-MM-dd HH:mm:ss", null); |
| | | |
| | | return entity; |
| | | } |
| | |
| | | |
| | | //string organizeName = organize.f; |
| | | |
| | | // 从ErpStaffDetails中获取岗位和部门信息 |
| | | decimal? postId = null; |
| | | decimal? postDeptId = null; |
| | | DateTime? staffStartDate = null; |
| | | |
| | | if (staff.ErpStaffDetails != null && staff.ErpStaffDetails.Count > 0) |
| | | { |
| | | var firstDetail = staff.ErpStaffDetails.First(); |
| | | if (!string.IsNullOrEmpty(firstDetail.fPostId)) |
| | | postId = Convert.ToDecimal(firstDetail.fPostId); |
| | | if (!string.IsNullOrEmpty(firstDetail.fPostDeptid)) |
| | | postDeptId = Convert.ToDecimal(firstDetail.fPostDeptid); |
| | | if (!string.IsNullOrEmpty(firstDetail.fStaffStartDate)) |
| | | staffStartDate = DateTime.ParseExact(firstDetail.fStaffStartDate, "yyyy-MM-dd HH:mm:ss", null); |
| | | } |
| | | |
| | | return new SysUser |
| | | { |
| | | Sid = Convert.ToDecimal(staff.Id), |
| | |
| | | ExpFiel12 = 0, |
| | | FirstLogin = 0, |
| | | CreateDate = DateTime.Now, |
| | | PswEditTime = DateTime.Now |
| | | PswEditTime = DateTime.Now, |
| | | // 新增字段映射 |
| | | fPostid = postId, |
| | | fPostdeptid = postDeptId, |
| | | fStaffstartdate = staffStartDate |
| | | }; |
| | | } |
| | | |
| | |
| | | /// <returns>影响行数</returns> |
| | | public int RKJQaSubmit(string userNo, decimal id) |
| | | { |
| | | return SqlSugarHelper.UseTransactionWithOracle(db => |
| | | { |
| | | var commit = 0; |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | // 提交入库检验单 - 更新QS_ITEM_OQC_REQ表 |
| | | var sql = "update QS_ITEM_OQC_REQ set FSUBMIT=1, FSUBMIT_BY=:userNo, FSUBMIT_DATE=SYSDATE where ID=:id"; |
| | | // 输出参数 |
| | | 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(":userNo", userNo), |
| | | new(":id", id) |
| | | new("P_ID", id, System.Data.DbType.Decimal, System.Data.ParameterDirection.Input), |
| | | new("P_USER", userNo ?? string.Empty, System.Data.DbType.String, System.Data.ParameterDirection.Input), |
| | | poResult, |
| | | poText |
| | | }; |
| | | commit += db.Ado.ExecuteCommand(sql, parameters); |
| | | |
| | | return commit; |
| | | }); |
| | | // 调用存储过程提交入库检验单 |
| | | db.Ado.ExecuteCommand( |
| | | "BEGIN PRC_GEN_TJQ_RKJ(:P_ID, :P_USER, :PO_RESULT, :PO_TEXT); END;", |
| | | parameters.ToArray()); |
| | | |
| | | var code = Convert.ToInt32(poResult.Value?.ToString() ?? "0"); |
| | | var message = poText.Value?.ToString() ?? ""; |
| | | |
| | | // 如果存储过程执行失败,抛出异常 |
| | | if (code != 0) |
| | | { |
| | | throw new Exception($"入库检提交失败: {message}"); |
| | | } |
| | | |
| | | return code; |
| | | } |
| | | } |
| | |
| | | |
| | | public int SJQaSubmit(string userNo, decimal id) |
| | | { |
| | | return SqlSugarHelper.UseTransactionWithOracle(db => |
| | | { |
| | | var commit = 0; |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | // 提交首检单 |
| | | var sql = "update QS_ITEM_IPI_REQ set FSUBMIT=1, FSUBMIT_BY=:userNo, FSUBMIT_DATE=SYSDATE where ID=:id"; |
| | | // 输出参数 |
| | | 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(":userNo", userNo), |
| | | new(":id", id) |
| | | new("P_ID", id, System.Data.DbType.Decimal, System.Data.ParameterDirection.Input), |
| | | new("P_USER", userNo ?? string.Empty, System.Data.DbType.String, System.Data.ParameterDirection.Input), |
| | | poResult, |
| | | poText |
| | | }; |
| | | commit += db.Ado.ExecuteCommand(sql, parameters); |
| | | |
| | | // 读取首检单,取结果与计划编号 |
| | | var req = db.Queryable<QsItemIpiReq>().Single(s => s.Id == id); |
| | | if (req != null) |
| | | // 调用存储过程提交首检单 |
| | | db.Ado.ExecuteCommand( |
| | | "BEGIN PRC_GEN_TJQ_SJ(:P_ID, :P_USER, :PO_RESULT, :PO_TEXT); END;", |
| | | parameters.ToArray()); |
| | | |
| | | var code = Convert.ToInt32(poResult.Value?.ToString() ?? "0"); |
| | | var message = poText.Value?.ToString() ?? ""; |
| | | |
| | | // 如果存储过程执行失败,抛出异常 |
| | | if (code != 0) |
| | | { |
| | | // 通过 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(); |
| | | } |
| | | throw new Exception($"首检提交失败: {message}"); |
| | | } |
| | | |
| | | return commit; |
| | | }); |
| | | return code; |
| | | } |
| | | |
| | | public (int code, string message) GenUpdateSJ(decimal id, string no, string userNo) |
| | |
| | | |
| | | public int XJQaSubmit(string userNo, decimal id) |
| | | { |
| | | return SqlSugarHelper.UseTransactionWithOracle(db => |
| | | { |
| | | var commit = 0; |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | // 提交巡检单 - 参考SJ的实现方式 |
| | | var sql = "update QS_QA_ITEM_XJ set FSUBMIT=1, FSUBMIT_BY=:userNo, FSUBMIT_DATE=SYSDATE where ID=:id"; |
| | | // 输出参数 |
| | | 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(":userNo", userNo), |
| | | new(":id", id) |
| | | new("P_ID", id, System.Data.DbType.Decimal, System.Data.ParameterDirection.Input), |
| | | new("P_USER", userNo ?? string.Empty, System.Data.DbType.String, System.Data.ParameterDirection.Input), |
| | | poResult, |
| | | poText |
| | | }; |
| | | commit += db.Ado.ExecuteCommand(sql, parameters); |
| | | |
| | | return commit; |
| | | }); |
| | | // 调用存储过程提交巡检单 |
| | | db.Ado.ExecuteCommand( |
| | | "BEGIN PRC_GEN_TJQ_XJ(:P_ID,:P_USER, :PO_RESULT, :PO_TEXT); END;", |
| | | parameters.ToArray()); |
| | | |
| | | var code = Convert.ToInt32(poResult.Value?.ToString() ?? "0"); |
| | | var message = poText.Value?.ToString() ?? ""; |
| | | |
| | | // 如果存储过程执行失败,抛出异常 |
| | | if (code != 0) |
| | | { |
| | | throw new Exception($"巡检提交失败: {message}"); |
| | | } |
| | | |
| | | return code; |
| | | } |
| | | } |
| | |
| | | var baOrUpdate = db.Insertable(mesWomcabs).PageSize(1) |
| | | .IgnoreColumnsNull() |
| | | .ExecuteCommand() > 0; |
| | | |
| | | if (orUpdate && baOrUpdate) |
| | | { |
| | | //定义输入参数 |
| | | var inputParam1 = new SugarParameter("P_WORK_NO", mesWomcaa.Caa001); |
| | | // 定义输出参数 |
| | | var outParam1 = new SugarParameter("c_Result", null, true); |
| | | var outParam2 = new SugarParameter("C_MSG", null, true); |
| | | // 使用 SqlSugar 执行存储过程 |
| | | Db.Ado.ExecuteCommand( |
| | | "BEGIN PRC_UPDATE_DAA(:P_WORK_NO,:c_Result,:C_MSG); END;", |
| | | inputParam1, outParam1, outParam2); |
| | | // 获取输出参数的值 |
| | | var result = int.Parse((string)outParam1.Value); |
| | | var message = outParam2.Value == DBNull.Value |
| | | ? string.Empty |
| | | : (string)outParam2.Value; |
| | | if (result == 1) |
| | | { |
| | | //存储过程失败则事务进行回滚 |
| | | db.Ado.RollbackTran(); |
| | | throw new Exception(message); |
| | | } |
| | | } |
| | | if (orUpdate && baOrUpdate) return true; |
| | | throw new NotImplementedException("插入或更新失败"); |
| | | } |