| | |
| | | using System.Data; |
| | | using System.Data.SqlClient; |
| | | using System.Dynamic; |
| | | using System.Text; |
| | | using Gs.Toolbox; |
| | | using Gs.Toolbox; |
| | | using Gs.Toolbox.ApiCore.Abstract.Mvc; |
| | | using Gs.Toolbox.ApiCore.Common.Mvc; |
| | | using Gs.Toolbox.ApiCore.Group; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Newtonsoft.Json.Linq; |
| | | using System.Data; |
| | | using System.Data.SqlClient; |
| | | using System.Dynamic; |
| | | using System.Security.Cryptography.X509Certificates; |
| | | using System.Text; |
| | | using static Gs.Toolbox.UtilityHelper; |
| | | |
| | | namespace GS.QC.Service; |
| | | |
| | | namespace GS.QC.Service |
| | | { |
| | | [ApiGroup(ApiGroupNames.QC)] |
| | | public class FqcItemsManager : IRomteService |
| | | { |
| | |
| | | }; |
| | | try |
| | | { |
| | | dset = DbHelperSQL.RunProcedure("prc_fqc_items_lst", parameters, |
| | | "0"); |
| | | dset = DbHelperSQL.RunProcedure("prc_fqc_items_lst", parameters, "0"); |
| | | if (dset != null && dset.Tables.Count > 0 && |
| | | dset.Tables[0].Rows.Count > 0) //有数据 |
| | | { |
| | |
| | | return ReturnDto<PageList<dynamic>>.QuickReturn(_pglist, |
| | | ReturnCode.Exception, ex.Message); |
| | | } |
| | | |
| | | return ReturnDto<PageList<dynamic>>.QuickReturn(_pglist, |
| | | ReturnCode.Success, "读取成功"); |
| | | } |
| | |
| | | try |
| | | { |
| | | // 查询主表数据 |
| | | var sqlMain = |
| | | $"SELECT A.*,B.Name as OrgName FROM MES_FQC_ITEMS A LEFT JOIN SYS_ORGANIZATION b ON A.OrgId = b.FID WHERE a.GUID='{guid}'"; |
| | | string sqlMain = $"SELECT A.*,B.Name as OrgName FROM MES_FQC_ITEMS A LEFT JOIN SYS_ORGANIZATION b ON A.OrgId = b.FID WHERE a.GUID='{guid}'"; |
| | | var dsMain = DbHelperSQL.Query(sqlMain); |
| | | if (dsMain != null && dsMain.Tables.Count > 0 && |
| | | dsMain.Tables[0].Rows.Count > 0) |
| | | if (dsMain != null && dsMain.Tables.Count > 0 && dsMain.Tables[0].Rows.Count > 0) |
| | | { |
| | | var dr = dsMain.Tables[0].Rows[0]; |
| | | m = dr.RowToDynamic(); |
| | | } |
| | | |
| | | // 查询子表1数据 |
| | | var sqlDetail1 = |
| | | $"SELECT * FROM MES_FQC_ITEM_DETAIL1 WHERE PID='{guid}' ORDER BY Seq"; |
| | | string sqlDetail1 = $"SELECT * FROM MES_FQC_ITEM_DETAIL1 WHERE PID='{guid}' ORDER BY Seq"; |
| | | var dsDetail1 = DbHelperSQL.Query(sqlDetail1); |
| | | if (dsDetail1 != null && dsDetail1.Tables.Count > 0) |
| | | { |
| | |
| | | } |
| | | |
| | | // 查询子表2数据 |
| | | var sqlDetail2 = |
| | | $"SELECT * FROM MES_FQC_ITEM_DETAIL2 WHERE PID='{guid}' ORDER BY Seq"; |
| | | string sqlDetail2 = $"SELECT * FROM MES_FQC_ITEM_DETAIL2 WHERE PID='{guid}' ORDER BY Seq"; |
| | | var dsDetail2 = DbHelperSQL.Query(sqlDetail2); |
| | | if (dsDetail2 != null && dsDetail2.Tables.Count > 0) |
| | | { |
| | |
| | | } |
| | | |
| | | if (m != null) |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, |
| | | "读取成功!"); |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "读取成功!"); |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "读取失败!"); |
| | | } |
| | | |
| | |
| | | |
| | | // 处理生产日期,允许为空 |
| | | DateTime? productionDate = null; |
| | | if (model.productionDate != null && |
| | | !string.IsNullOrEmpty(model.productionDate.ToString())) |
| | | if (DateTime.TryParse(model.productionDate.ToString(), |
| | | out DateTime parsedDate)) |
| | | if (model.productionDate != null && !string.IsNullOrEmpty(model.productionDate.ToString())) |
| | | { |
| | | if (DateTime.TryParse(model.productionDate.ToString(), out DateTime parsedDate)) |
| | | { |
| | | productionDate = parsedDate; |
| | | } |
| | | } |
| | | |
| | | string acRe_A = model.acRe_A; // AC/Re A类 |
| | | string acRe_B = model.acRe_B; // AC/Re B类 |
| | |
| | | |
| | | // 处理检验日期,允许为空 |
| | | DateTime? jyDate = null; |
| | | if (model.jyDate != null && |
| | | !string.IsNullOrEmpty(model.jyDate.ToString())) |
| | | if (DateTime.TryParse(model.jyDate.ToString(), |
| | | out DateTime parsedJyDate)) |
| | | if (model.jyDate != null && !string.IsNullOrEmpty(model.jyDate.ToString())) |
| | | { |
| | | if (DateTime.TryParse(model.jyDate.ToString(), out DateTime parsedJyDate)) |
| | | { |
| | | jyDate = parsedJyDate; |
| | | } |
| | | } |
| | | |
| | | // 处理审核日期,允许为空 |
| | | DateTime? checkDate = null; |
| | | if (model.checkDate != null && |
| | | !string.IsNullOrEmpty(model.checkDate.ToString())) |
| | | if (DateTime.TryParse(model.checkDate.ToString(), |
| | | out DateTime parsedCheckDate)) |
| | | if (model.checkDate != null && !string.IsNullOrEmpty(model.checkDate.ToString())) |
| | | { |
| | | if (DateTime.TryParse(model.checkDate.ToString(), out DateTime parsedCheckDate)) |
| | | { |
| | | checkDate = parsedCheckDate; |
| | | } |
| | | } |
| | | |
| | | // 处理审批日期,允许为空 |
| | | DateTime? spDate = null; |
| | | if (model.spDate != null && |
| | | !string.IsNullOrEmpty(model.spDate.ToString())) |
| | | if (DateTime.TryParse(model.spDate.ToString(), |
| | | out DateTime parsedSpDate)) |
| | | if (model.spDate != null && !string.IsNullOrEmpty(model.spDate.ToString())) |
| | | { |
| | | if (DateTime.TryParse(model.spDate.ToString(), out DateTime parsedSpDate)) |
| | | { |
| | | spDate = parsedSpDate; |
| | | } |
| | | } |
| | | |
| | | // 构建子表1数据字符串 |
| | | var _sb1 = new StringBuilder(); |
| | |
| | | + m.RPB018 + _split |
| | | + m.RPB019 + _split |
| | | + m.Remark + _split |
| | | + (CheckGuid(_guid) |
| | | ? _guid |
| | | : Guid.Empty.ToString()); |
| | | + (CheckGuid(_guid) ? _guid : Guid.Empty.ToString()); |
| | | if (_sb1.Length > 0) |
| | | _sb1.Append("~"); |
| | | _sb1.Append(_line); |
| | |
| | | + m.CClass + _split |
| | | + m.Point + _split |
| | | + m.Remark + _split |
| | | + (CheckGuid(_guid) |
| | | ? _guid |
| | | : Guid.Empty.ToString()); |
| | | + (CheckGuid(_guid) ? _guid : Guid.Empty.ToString()); |
| | | if (_sb2.Length > 0) |
| | | _sb2.Append("~"); |
| | | _sb2.Append(_line); |
| | |
| | | new("@outSum", SqlDbType.Int), |
| | | new("@outGuid", SqlDbType.UniqueIdentifier), |
| | | new("@outNo", SqlDbType.NVarChar, 300), |
| | | new("@inOrderGuid", |
| | | CheckGuid(guid) ? guid : DBNull.Value), |
| | | new("@inOrderGuid", CheckGuid(guid) ? guid : DBNull.Value), |
| | | new("@inFQCNo", fqcNo), |
| | | new("@inWorkShop", workShop), |
| | | new("@inItemName", itemName), |
| | | new("@inItemModel", itemModel), |
| | | new("@inBrand", brand), |
| | | new("@inProductionDate", |
| | | productionDate.HasValue |
| | | ? productionDate.Value |
| | | : DBNull.Value), |
| | | new("@inProductionDate", productionDate.HasValue ? (object)productionDate.Value : DBNull.Value), |
| | | new("@inAcRe_A", acRe_A), |
| | | new("@inAcRe_B", acRe_B), |
| | | new("@inAcRe_C", acRe_C), |
| | |
| | | new("@inJyUser", jyUser), |
| | | new("@inCheckUser", checkUser), |
| | | new("@inSpUser", spUser), |
| | | new("@inJyDate", |
| | | jyDate.HasValue ? jyDate.Value : DBNull.Value), |
| | | new("@inCheckDate", |
| | | checkDate.HasValue |
| | | ? checkDate.Value |
| | | : DBNull.Value), |
| | | new("@inSpDate", |
| | | spDate.HasValue ? spDate.Value : DBNull.Value), |
| | | new("@inJyDate", jyDate.HasValue ? (object)jyDate.Value : DBNull.Value), |
| | | new("@inCheckDate", checkDate.HasValue ? (object)checkDate.Value : DBNull.Value), |
| | | new("@inSpDate", spDate.HasValue ? (object)spDate.Value : DBNull.Value), |
| | | new("@inEdtUserGuid", _userGuid), |
| | | new("@inDetail1List", _sb1.ToString()), |
| | | new("@inDetail2List", _sb2.ToString()) |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (mObj.outSum <= 0) |
| | | return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Exception, |
| | | mObj.outMsg); |
| | | return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success, |
| | | mObj.outMsg); |
| | | return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Exception, mObj.outMsg); |
| | | return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success, mObj.outMsg); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | if (CheckGuid(guid)) |
| | | { |
| | | var sql = $@" |
| | | string sql = $@" |
| | | DELETE FROM MES_FQC_ITEM_DETAIL1 WHERE PID='{guid}'; |
| | | DELETE FROM MES_FQC_ITEM_DETAIL2 WHERE PID='{guid}'; |
| | | DELETE FROM MES_FQC_ITEMS WHERE GUID='{guid}';"; |
| | |
| | | _outMsg = ex.Message; |
| | | _outSum = -1; |
| | | } |
| | | |
| | | if (_outSum <= 0) |
| | | return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Exception, |
| | | _outMsg); |
| | | return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Exception, _outMsg); |
| | | return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Success, _outMsg); |
| | | } |
| | | |
| | |
| | | new("@inEveryPageSize", everyPageSize), |
| | | new("@inSortName", sortName), |
| | | new("@inSortOrder", ""), |
| | | new("@inQueryWhere", keyWhere) |
| | | new("@inQueryWhere", keyWhere), |
| | | }; |
| | | var dset = new DataSet(); |
| | | var _pglist = new PageList<dynamic> |
| | |
| | | }; |
| | | try |
| | | { |
| | | var dsMain = |
| | | DbHelperSQL.RunProcedure("report_cprkjdDetail", parameters, |
| | | "0"); |
| | | if (dsMain != null && dsMain.Tables.Count > 0 && |
| | | dsMain.Tables[0].Rows.Count > 0) |
| | | var dsMain = DbHelperSQL.RunProcedure("report_cprkjdDetail", parameters, "0"); |
| | | if (dsMain != null && dsMain.Tables.Count > 0 && dsMain.Tables[0].Rows.Count > 0) |
| | | { |
| | | |
| | | m.list = dsMain.Tables[0].TableToDynamicList(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Debug(ToString(), ex.Message); |
| | | } |
| | | |
| | | if (m != null) |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, |
| | | "读取成功!"); |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "读取成功!"); |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "读取失败!"); |
| | | } |
| | | } |
| | | } |