| | |
| | | /** |
| | | * 将带有流程号和检验单号的新记录插入表中 |
| | | */ |
| | | public dynamic SaveProcessNo(string ReleaseNo,string ProcessNo) |
| | | public dynamic SaveProcessNo(string ReleaseNo, string ProcessNo, string StaffNo, string Department) |
| | | { |
| | | |
| | | var QcIssueResults = GetQcIssueResults(ReleaseNo, ProcessNo); |
| | | |
| | | var ApplicantResults = GetApplicantResults(ProcessNo, StaffNo); |
| | | |
| | | var DepartmentResults = GetDepartmentResults(ProcessNo, Department); |
| | | |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | db.Insertable(ApplicantResults).ExecuteCommand(); // 插入申请人数据 |
| | | db.Insertable(DepartmentResults).ExecuteCommand(); // 插入部门数据 |
| | | |
| | | return UseTransaction(db => |
| | | { |
| | | return SaveOrUpdateData(db, QcIssueResults) ? 1 : 0; |
| | | }) > 0; |
| | | try |
| | | { |
| | | |
| | | |
| | | // 统一使用事务db |
| | | //SaveOrUpdateApplicantData(db, ApplicantResults); |
| | | //SaveOrUpdateDepartmentData(db, DepartmentResults); |
| | | SaveOrUpdateData(db, QcIssueResults); |
| | | |
| | | return 1; |
| | | } |
| | | catch |
| | | { |
| | | db.RollbackTran(); |
| | | throw; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | public QcIssueResults GetQcIssueResults(string ReleaseNo, string ProcessNo) |
| | |
| | | }; |
| | | |
| | | return QcIssueResults; |
| | | } |
| | | |
| | | public IqcApplicant GetApplicantResults(string ProcessNo, string StaffNo) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | var stafflist = db.Queryable<DingNameCode>() |
| | | .Where(t => t.STAFF_NO == StaffNo) |
| | | .Select(t => new DingNameCode |
| | | { |
| | | STAFF_NAME = t.STAFF_NAME, |
| | | PHONE_NUMBER = t.PHONE_NUMBER |
| | | }) |
| | | .ToList(); |
| | | |
| | | var ApplicantResults = new IqcApplicant |
| | | { |
| | | INSTANCEID = ProcessNo, |
| | | APPLICANTID = StaffNo, |
| | | APPLICANTNAME = stafflist[0].STAFF_NAME |
| | | }; |
| | | |
| | | return ApplicantResults; |
| | | } |
| | | |
| | | public IqcDepartment GetDepartmentResults(string ProcessNo, string Department) |
| | | { |
| | | |
| | | var DepartmentResults = new IqcDepartment |
| | | { |
| | | INSTANCEID = ProcessNo, |
| | | DEPARTMENTNAME = Department |
| | | }; |
| | | |
| | | return DepartmentResults; |
| | | } |
| | | |
| | | /** |
| | |
| | | throw new Exception("未找到需要更新的记录"); |
| | | } |
| | | } |
| | | else{ |
| | | else |
| | | { |
| | | string ReleaseNo = mapping.FirstOrDefault().ReleaseNo; |
| | | |
| | | // 只更新 ReleaseNo 和 FReview 两个字段 |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | // 响应模型 |