/// <summary> /// 复检确认 /// </summary> /// <param name="dr">需要确认的数据</param> /// <param name="TickNo">钩号</param> /// <returns></returns> public string Recheck_QR(DataTable dt_main, int[] rownumber, string[] str_tick_no, string strQRZT, int Type) { string result = "1"; try { TransactionHelper.BeginTransaction(); string userID = RV.UI.UserInfo.UserID; DateTime dTime = RV.UI.ServerTime.timeNow(); Dal_TQC_RECHECK dalRecheck = new Dal_TQC_RECHECK(); Dal_TQC_PHYSICS_RESULT_MAIN dalPhysicsResultMain = new Dal_TQC_PHYSICS_RESULT_MAIN(); Dal_TQB_PHYSICS_GROUP dalTqbPhysicsGroup = new Dal_TQB_PHYSICS_GROUP(); Dal_TQC_RESULT_MAIN_ZJB dalResultMainZJB = new Dal_TQC_RESULT_MAIN_ZJB(); for (int i = 0; i < rownumber.Length; i++) { Mod_TQC_RECHECK mod = dalRecheck.GetModel(str_tick_no[i]); mod.N_IS_QR = Type; mod.C_ZZ_USER_ID = userID; mod.D_ZZ_MOD = dTime; mod.C_ZZJG = strQRZT; if (!dalRecheck.Update_Trans(mod)) { TransactionHelper.RollBack(); return("0"); } } TransactionHelper.Commit(); } catch (Exception ex) { TransactionHelper.RollBack(); return("0"); } return(result); }
/// <summary> /// 修改性能值 /// </summary> /// <returns></returns> public string Edit_Result(DataRow dr, DataTable dt_result, string str_PHYSICS_GROUP_ID, string strSB, string strWD, string strSD, string strBC, string strBZ, string strSHR) { try { string result = "1"; TransactionHelper.BeginTransaction(); string strUserID = RV.UI.UserInfo.userID; DateTime time = RV.UI.ServerTime.timeNow(); Dal_TQC_PHYSICS_RESULT_MAIN dalTqcPhyResultMain = new Dal_TQC_PHYSICS_RESULT_MAIN(); Dal_TQC_PHYSICS_RESULT_LOG dalResultLog = new Dal_TQC_PHYSICS_RESULT_LOG(); Dal_TQC_COMPRE_ROLL dalTqcCompreRoll = new Dal_TQC_COMPRE_ROLL(); Dal_TQB_PHYSICS_GROUP dalGroup = new Dal_TQB_PHYSICS_GROUP(); if (dr != null) { string C_PRESENT_SAMPLES_ID = dr["取样主表主键"].ToString(); string strCheckState = dr["检验状态"].ToString(); if (strCheckState == "初检") { strCheckState = "0"; } else if (strCheckState == "复检") { strCheckState = "1"; } string strCode = dalGroup.Get_Code(str_PHYSICS_GROUP_ID); Mod_TQC_PHYSICS_RESULT_MAIN mod = dalTqcPhyResultMain.GetModel(C_PRESENT_SAMPLES_ID); DataTable dt_DB = new DataTable(); if (strCode == "R01") { dt_DB = dalTqcPhyResultMain.Get_DB_List(dr["批号"].ToString(), str_PHYSICS_GROUP_ID, strCheckState, mod.C_IS_PD).Tables[0]; } else { dt_DB = dalTqcPhyResultMain.Get_DB_List(C_PRESENT_SAMPLES_ID).Tables[0]; } for (int mm = 0; mm < dt_DB.Rows.Count; mm++) { Mod_TQC_PHYSICS_RESULT_MAIN mod_Main = dalTqcPhyResultMain.GetModel(dt_DB.Rows[mm]["C_ID"].ToString()); if (mod_Main != null) { mod_Main.C_EQ_NAME = strSB; mod_Main.C_TEMP = strWD; mod_Main.C_HUMIDITY = strSD; mod_Main.N_IS_LR = 1; mod_Main.C_BC = strBC; mod_Main.C_BZ = strBZ; mod_Main.C_CHECK_USER = strSHR; if (!dalTqcPhyResultMain.Update_Trans(mod_Main)) { TransactionHelper.RollBack(); return("保存设备信息失败!"); } } int num_Edit = dalResultLog.Get_Max_EditNum(str_PHYSICS_GROUP_ID, dt_DB.Rows[mm]["C_ID"].ToString());//修改次数 num_Edit++; DataTable dt_Old = dal.Get_XNList(strCode, dt_DB.Rows[mm]["C_ID"].ToString()).Tables[0]; for (int i = 0; i < dt_Old.Rows.Count; i++) { int strType = 0; if (dt_Old.Rows[i]["C_CODE"].ToString().Contains("000GCL")) { strType = 0; } else { strType = 1; } if (!string.IsNullOrEmpty(dt_Old.Rows[i]["C_VALUE"].ToString())) { Mod_TQC_PHYSICS_RESULT_LOG modResult_Log = new Mod_TQC_PHYSICS_RESULT_LOG(); modResult_Log.C_PHYSICS_GROUP_ID = str_PHYSICS_GROUP_ID; modResult_Log.C_PRESENT_SAMPLES_ID = dt_DB.Rows[mm]["C_ID"].ToString(); modResult_Log.C_CHARACTER_ID = dt_Old.Rows[i]["C_CHARACTER_ID"].ToString(); modResult_Log.C_CHARACTER_CODE = dt_Old.Rows[i]["C_CODE"].ToString(); modResult_Log.C_CHARACTER_NAME = dt_Old.Rows[i]["C_NAME"].ToString(); modResult_Log.C_VALUE = dt_Old.Rows[i]["C_VALUE"].ToString(); modResult_Log.C_EMP_ID = strUserID; modResult_Log.N_TYPE = strType; modResult_Log.C_TICK_NO = dr["钩号"].ToString(); modResult_Log.C_CHECK_STATE = strCheckState; modResult_Log.C_EDIT_NUM = num_Edit.ToString(); if (!dalResultLog.Add_Trans(modResult_Log)) { TransactionHelper.RollBack(); return("保存修改记录出错!"); } } } dal.Delete_Trans(str_PHYSICS_GROUP_ID, dt_DB.Rows[mm]["C_ID"].ToString()); for (int k = 0; k < dt_result.Rows.Count; k++) { int strType = 0; if (dt_result.Rows[k]["C_CODE"].ToString().Contains("000GCL")) { strType = 0; } else { strType = 1; } if (dt_result.Rows[k]["C_VALUE"].ToString() != "") { Mod_TQC_PHYSICS_RESULT modResult = new Mod_TQC_PHYSICS_RESULT(); modResult.C_PHYSICS_GROUP_ID = str_PHYSICS_GROUP_ID; modResult.C_PRESENT_SAMPLES_ID = dt_DB.Rows[mm]["C_ID"].ToString(); modResult.C_CHARACTER_ID = dt_result.Rows[k]["C_CHARACTER_ID"].ToString(); modResult.C_CHARACTER_CODE = dt_result.Rows[k]["C_CODE"].ToString(); modResult.C_CHARACTER_NAME = dt_result.Rows[k]["C_NAME"].ToString(); modResult.C_VALUE = dt_result.Rows[k]["C_VALUE"].ToString(); modResult.C_EMP_ID = strUserID; modResult.N_TYPE = strType; modResult.C_TICK_NO = dr["钩号"].ToString(); modResult.C_CHECK_STATE = strCheckState; if (!dal.Add_Trans(modResult)) { TransactionHelper.RollBack(); return("修改数据出错!"); } } } } } TransactionHelper.Commit(); dalTqcCompreRoll.JUDGE_ROLL_BATCH(dr["批号"].ToString()); return(result); } catch (Exception ex) { TransactionHelper.RollBack(); return(ex.Message); } }
/// <summary> /// 保存性能值 /// </summary> /// <returns></returns> public string Save_Result(DataTable dt_result, string strPhyCode) { try { string result = "1"; TransactionHelper.BeginTransaction(); string strUserID = RV.UI.UserInfo.userID; DateTime time = RV.UI.ServerTime.timeNow(); Dal_TQB_PHYSICS_GROUP daltqbPhysicsGroup = new Dal_TQB_PHYSICS_GROUP(); Dal_TQC_PHYSICS_RESULT_MAIN dalResultMain = new Dal_TQC_PHYSICS_RESULT_MAIN(); Mod_TQC_PHYSICS_RESULT model; DataTable dt_Character = dal.Get_Character_List(strPhyCode).Tables[0]; if (dt_Character.Rows.Count == 0) { TransactionHelper.RollBack(); return("性能基础数据有误,保存失败!"); } string str_PHYSICS_GROUP_ID = dt_Character.Rows[0]["C_PHYSICS_GROUP_ID"].ToString(); for (int irow = 0; irow < dt_result.Rows.Count; irow++) { string val = dt_result.Rows[irow]["chk"].ToString(); if (val == "False") { continue; } string C_PRESENT_SAMPLES_ID = dt_result.Rows[irow]["取样主表主键"].ToString(); dal.Delete_Trans(str_PHYSICS_GROUP_ID, C_PRESENT_SAMPLES_ID); Mod_TQC_PHYSICS_RESULT_MAIN modelMain = dalResultMain.GetModel(C_PRESENT_SAMPLES_ID); if (modelMain != null) { modelMain.N_IS_LR = 1; modelMain.C_EQ_NAME = dt_result.Rows[irow]["设备信息"].ToString(); if (!dalResultMain.Update_Trans(modelMain)) { TransactionHelper.RollBack(); return("保存失败!"); } } for (int icol = 13; icol < dt_result.Columns.Count; icol++) { int iType = 2; if (dt_Character.Rows[icol - 13]["C_CODE"].ToString().Contains("000GCL")) { iType = 0; } else { iType = 1; } if (!string.IsNullOrEmpty(dt_result.Rows[irow][icol].ToString())) { model = new Mod_TQC_PHYSICS_RESULT(); model.C_PHYSICS_GROUP_ID = str_PHYSICS_GROUP_ID; //物理分组表主键 model.C_PRESENT_SAMPLES_ID = C_PRESENT_SAMPLES_ID; //tqc_physics_result_main主键 model.C_CHARACTER_ID = dt_Character.Rows[icol - 13]["C_CHARACTER_ID"].ToString(); //检验基础数据表主键 model.C_CHARACTER_CODE = dt_Character.Rows[icol - 13]["C_CODE"].ToString(); //性能代码 model.C_CHARACTER_NAME = dt_Character.Rows[icol - 13]["C_NAME"].ToString(); //性能名称 model.C_VALUE = dt_result.Rows[irow][icol].ToString(); //性能值 model.C_EMP_ID = strUserID; //录入人 model.N_TYPE = iType; //0过程量;1检验量 model.C_CHECK_STATE = dt_result.Rows[irow]["检验状态"].ToString() == "初检" ? "0" : "1"; // 状态;0-初检;1-复检;2-评审 model.C_TICK_NO = dt_result.Rows[irow]["钩号"].ToString(); //钩号 if (!dal.Add_Trans(model)) { TransactionHelper.RollBack(); return("保存失败!"); } } } } TransactionHelper.Commit(); return(result); } catch (Exception ex) { TransactionHelper.RollBack(); return(ex.Message); } }
/// <summary> /// 保存性能值 /// </summary> /// <returns></returns> public string Save_Result_Old(DataRow dr, DataTable dt_result, string strPhyCode, string strSB, string strWD, string strSD, string strBC, string strBZ, string strSHR) { try { string result = "1"; TransactionHelper.BeginTransaction(); Dal_TQC_PHYSICS_RESULT_MAIN dalTqcPhyResultMain = new Dal_TQC_PHYSICS_RESULT_MAIN(); Dal_TQB_PHYSICS_GROUP dalTqbPhysicsGroup = new Dal_TQB_PHYSICS_GROUP(); string strUserID = RV.UI.UserInfo.userID; DateTime time = RV.UI.ServerTime.timeNow(); string C_PRESENT_SAMPLES_ID = dr["取样主表主键"].ToString(); Mod_TQC_PHYSICS_RESULT_MAIN mod = dalTqcPhyResultMain.GetModel(C_PRESENT_SAMPLES_ID); string strCheckState = dr["检验状态"].ToString(); if (strCheckState == "初检") { strCheckState = "0"; } else if (strCheckState == "复检") { strCheckState = "1"; } string str_PHYSICS_GROUP_ID = dalTqbPhysicsGroup.Get_ID(strPhyCode); DataTable dt_DB = new DataTable(); if (strPhyCode == "R01") { dt_DB = dalTqcPhyResultMain.Get_DB_List(dr["批号"].ToString(), str_PHYSICS_GROUP_ID, strCheckState, mod.C_IS_PD).Tables[0]; } else { dt_DB = dalTqcPhyResultMain.Get_DB_List(C_PRESENT_SAMPLES_ID).Tables[0]; } for (int i = 0; i < dt_DB.Rows.Count; i++) { Mod_TQC_PHYSICS_RESULT_MAIN mod_Main = dalTqcPhyResultMain.GetModel(dt_DB.Rows[i]["C_ID"].ToString()); if (mod_Main != null) { mod_Main.C_EQ_NAME = strSB; mod_Main.C_TEMP = strWD; mod_Main.C_HUMIDITY = strSD; mod_Main.N_IS_LR = 1; mod_Main.C_BC = strBC; mod_Main.C_BZ = strBZ; mod_Main.C_CHECK_USER = strSHR; if (!dalTqcPhyResultMain.Update_Trans(mod_Main)) { TransactionHelper.RollBack(); return("保存设备信息失败!"); } } dal.Delete_Trans(str_PHYSICS_GROUP_ID, dt_DB.Rows[i]["C_ID"].ToString()); for (int mm = 0; mm < dt_result.Rows.Count; mm++) { if (!string.IsNullOrEmpty(dt_result.Rows[mm]["C_VALUE"].ToString())) { int i_Type = 0; if (dt_result.Rows[mm]["C_CODE"].ToString().Contains("000GCL")) { i_Type = 0; } else { i_Type = 1; } Mod_TQC_PHYSICS_RESULT modResult = new Mod_TQC_PHYSICS_RESULT(); modResult.C_PHYSICS_GROUP_ID = str_PHYSICS_GROUP_ID; modResult.C_PRESENT_SAMPLES_ID = dt_DB.Rows[i]["C_ID"].ToString(); modResult.C_CHARACTER_ID = dt_result.Rows[mm]["C_CHARACTER_ID"].ToString(); modResult.C_CHARACTER_CODE = dt_result.Rows[mm]["C_CODE"].ToString(); modResult.C_CHARACTER_NAME = dt_result.Rows[mm]["C_NAME"].ToString(); modResult.C_VALUE = dt_result.Rows[mm]["C_VALUE"].ToString(); modResult.C_EMP_ID = strUserID; modResult.D_MOD_DT = time; modResult.N_SPLIT = 0; modResult.N_TYPE = i_Type; modResult.C_CHECK_STATE = strCheckState; modResult.C_TICK_NO = dt_DB.Rows[i]["C_TICK_NO"].ToString(); if (!dal.Add_Trans(modResult)) { TransactionHelper.RollBack(); return("保存结果失败!"); } } } } TransactionHelper.Commit(); return(result); } catch (Exception ex) { TransactionHelper.RollBack(); return(ex.Message); } }
/// <summary> /// 复检确认 /// </summary> /// <param name="dr">需要确认的数据</param> /// <param name="TickNo">钩号</param> /// <returns></returns> public string Recheck_SL(DataTable dt_main, int[] rownumber, string[] str_tick_no, string strQRZT, int Type) { string result = "1"; try { TransactionHelper.BeginTransaction(); string userID = RV.UI.UserInfo.UserID; DateTime dTime = RV.UI.ServerTime.timeNow(); Dal_TQC_RECHECK dalRecheck = new Dal_TQC_RECHECK(); Dal_TQC_PHYSICS_RESULT_MAIN dalPhysicsResultMain = new Dal_TQC_PHYSICS_RESULT_MAIN(); Dal_TQB_PHYSICS_GROUP dalTqbPhysicsGroup = new Dal_TQB_PHYSICS_GROUP(); Dal_TQC_RESULT_MAIN_ZJB dalResultMainZJB = new Dal_TQC_RESULT_MAIN_ZJB(); for (int i = 0; i < rownumber.Length; i++) { Mod_TQC_RECHECK mod = dalRecheck.GetModel(dt_main.Rows[rownumber[i]]["C_ID"].ToString()); mod.N_IS_QR = Type; mod.C_TICK_NO = str_tick_no[i]; mod.C_QR_USER_ID = userID; mod.D_QR_MOD = dTime; if (!dalRecheck.Update_Trans(mod)) { TransactionHelper.RollBack(); return("0"); } else { string str_PHYSICS_GROUP_ID = dalTqbPhysicsGroup.Get_ID(dt_main.Rows[rownumber[i]]["C_PHYSICS_CODE"].ToString()); if (str_PHYSICS_GROUP_ID == "0") { TransactionHelper.RollBack(); return("0"); } Mod_TQC_RESULT_MAIN_ZJB mod_zjb = new Mod_TQC_RESULT_MAIN_ZJB(); mod_zjb.C_BATCH_NO = dt_main.Rows[rownumber[i]]["C_BATCH_NO"].ToString(); mod_zjb.C_TICK_NO = str_tick_no[i]; mod_zjb.C_STL_GRD = dt_main.Rows[rownumber[i]]["C_STL_GRD"].ToString(); mod_zjb.C_SPEC = dt_main.Rows[rownumber[i]]["C_SPEC"].ToString(); mod_zjb.C_EMP_ID = dt_main.Rows[rownumber[i]]["C_EMP_ID"].ToString(); mod_zjb.D_MOD_DT = Convert.ToDateTime(dt_main.Rows[rownumber[i]]["D_MOD_DT"].ToString()); mod_zjb.C_EMP_ID_ZY = userID; mod_zjb.D_MOD_DT_ZY = Convert.ToDateTime(dTime); mod_zjb.C_EMP_ID_JS = userID; mod_zjb.D_MOD_DT_JS = Convert.ToDateTime(dTime); mod_zjb.C_PHYSICS_GROUP_ID = str_PHYSICS_GROUP_ID; mod_zjb.C_CHECK_STATE = "1"; mod_zjb.N_RECHECK = mod.N_RECHECK; mod_zjb.C_ITEM_NAME = mod.C_ITEM_NAME; mod_zjb.C_QRZT = strQRZT; mod_zjb.C_DISPOSAL = mod.C_DISPOSAL; if (!dalResultMainZJB.Add_Trans(mod_zjb)) { TransactionHelper.RollBack(); return("0"); } } } TransactionHelper.Commit(); } catch (Exception ex) { TransactionHelper.RollBack(); return("0"); } return(result); }