/// <summary> /// 钢坯添加备注 /// </summary> /// <param name="modTqcCompreSlab">需要添加备注的实体信息</param> /// <param name="strRemark">备注</param> /// <returns></returns> public string Slab_Remark(Mod_TQC_COMPRE_SLAB modTqcCompreSlab, string strRemark) { string result = "1"; try { Dal_TSC_SLAB_MAIN dalTscSlabMain = new Dal_TSC_SLAB_MAIN(); TransactionHelper.BeginTransaction(); string strUserID = RV.UI.UserInfo.userID; DateTime time = RV.UI.ServerTime.timeNow(); string strUserAccount = RV.UI.UserInfo.userAccount; modTqcCompreSlab.C_REMARK = strRemark; if (dal.Update_Trans(modTqcCompreSlab)) { if (!dalTscSlabMain.Update_Trans(strRemark, modTqcCompreSlab.C_STOVE)) { TransactionHelper.RollBack(); return("备注添加失败"); } } else { TransactionHelper.RollBack(); return("备注添加失败"); } TransactionHelper.Commit(); } catch (Exception ex) { TransactionHelper.RollBack(); return(ex.Message); } return(result); }
/// <summary> /// 钢坯改判 /// </summary> /// <param name="row">选中的数据</param> /// <param name="strGrd">钢种</param> /// <param name="strStdCode">执行标准</param> /// <param name="strMatCode">物料编码</param> /// <param name="strMatName">物料描述</param> /// <param name="strZrdwID">责任单位代码</param> /// <param name="strZrdwName">责任代为描述</param> /// <param name="strPDDJ">判定等级</param> /// <param name="strRemark">备注</param> /// <param name="strUrl">地址</param> /// <param name="strZYX1">自由项1</param> /// <param name="strZYX2">自由项2</param> /// <param name="strGPYY">改判原因</param> /// <param name="strLen">定尺</param> /// <returns></returns> public string GP_Slab(string strs, string strGrd, string strStdCode, string strMatCode, string strMatName, string strZrdwID, string strZrdwName, string strPDDJ, string strRemark, string strUrl, string strZYX1, string strZYX2, string strGPYY, string strLen) { string result = "1"; try { Dal_TSC_SLAB_MAIN dal_slab = new Dal_TSC_SLAB_MAIN(); Dal_TQC_SLAB_COMMUTE dal_commute = new Dal_TQC_SLAB_COMMUTE(); Dal_Interface_NC_SLAB_KC4N dal_interface = new Dal_Interface_NC_SLAB_KC4N(); Dal_TPB_LGGYK dalTpbLggyk = new Dal_TPB_LGGYK(); Dal_TMO_ORDER dalTmoOrder = new Dal_TMO_ORDER(); Dal_TQD_DESIGN dalDesign = new Dal_TQD_DESIGN(); Dal_TB_STD_CONFIG dalTbStdConfig = new Dal_TB_STD_CONFIG(); TransactionHelper.BeginTransaction(); string strUserID = RV.UI.UserInfo.userID; DateTime time = RV.UI.ServerTime.timeNow(); string stove = ""; string max_C_MASTER_ID = ""; string max_C_GP_BEFORE_ID = ""; string max_C_GP_AFTER_ID = ""; string slabCode = ""; string strLGJH = ""; string strDesignNo = dalDesign.Get_Design_No(strStdCode, strGrd); if (string.IsNullOrEmpty(strDesignNo)) { return("改判失败,没有找到对应的执行标准信息!"); } string[] strs_Slab_ID = strs.Substring(0, strs.Length - 1).Split(','); //Mod_TSC_SLAB_MAIN modSlabMain = dal_slab.GetModel(strs_Slab_ID[0]); //Mod_TPB_LGGYK modLggyk = dalTpbLggyk.GetModel_Trans(modSlabMain.C_LGJH); //if (modLggyk == null) //{ // TransactionHelper.RollBack(); // return "改判失败,获取炼钢记号时错误!"; //} //DataTable dtLGJH = dalTpbLggyk.Get_LGJH(modLggyk.C_BOF_TYPE, modLggyk.C_LF_TYPE, modLggyk.C_RH_TYPE, modLggyk.C_CASTER_TYPE, strStdCode, strGrd).Tables[0]; //if (dtLGJH.Rows.Count > 1) //{ // TransactionHelper.RollBack(); // return "标准:" + strStdCode + ";钢种:" + strGrd + "找到多个炼钢记号,请核查!"; //} //else if (dtLGJH.Rows.Count == 0) //{ // TransactionHelper.RollBack(); // return "标准:" + strStdCode + ";钢种:" + strGrd + "没有找到炼钢记号!"; //} //strLGJH = dtLGJH.Rows[0]["C_STEEL_SIGN"].ToString(); DataTable dt = dal_commute.GetList_max().Tables[0]; max_C_MASTER_ID = dt.Rows[0]["C_MASTER_ID"].ToString(); max_C_GP_BEFORE_ID = dt.Rows[0]["C_GP_BEFORE_ID"].ToString(); max_C_GP_AFTER_ID = dt.Rows[0]["C_GP_AFTER_ID"].ToString(); if (string.IsNullOrEmpty(max_C_MASTER_ID)) { max_C_MASTER_ID = "GPsj" + RV.UI.ServerTime.timeNow().ToString("yyMMdd00001"); } else { max_C_MASTER_ID = "GPsj" + (Convert.ToInt64(max_C_MASTER_ID) + 1).ToString(); } if (string.IsNullOrEmpty(max_C_GP_BEFORE_ID)) { max_C_GP_BEFORE_ID = "GPpq" + RV.UI.ServerTime.timeNow().ToString("yyMMdd00001"); } else { max_C_GP_BEFORE_ID = "GPpq" + (Convert.ToInt64(max_C_GP_BEFORE_ID) + 1).ToString(); } if (string.IsNullOrEmpty(max_C_GP_AFTER_ID)) { max_C_GP_AFTER_ID = "GPph" + RV.UI.ServerTime.timeNow().ToString("yyMMdd00001"); } else { max_C_GP_AFTER_ID = "GPph" + (Convert.ToInt64(max_C_GP_AFTER_ID) + 1).ToString(); } Bll_TB_MATRL_MAIN bll_matrl = new Bll_TB_MATRL_MAIN(); for (int i = 0; i < strs_Slab_ID.Length; i++) { Mod_TSC_SLAB_MAIN mod_slab = dal_slab.GetModel(strs_Slab_ID[i]); stove = mod_slab.C_STOVE; if (mod_slab != null) { Mod_TB_MATRL_MAIN mod_matrl = bll_matrl.GetModel(strMatCode); stove = mod_slab.C_STOVE; slabCode = mod_slab.C_SLABWH_CODE; Mod_TQC_SLAB_COMMUTE mod = new Mod_TQC_SLAB_COMMUTE(); mod.C_STA_ID = mod_slab.C_STA_DESC; mod.C_STOVE = mod_slab.C_STOVE; mod.C_BATCH_NO = mod_slab.C_BATCH_NO; mod.N_WGT = mod_slab.N_WGT; mod.N_LEN = mod_slab.N_LEN; mod.C_STL_GRD_BEFORE = mod_slab.C_STL_GRD; mod.C_STD_CODE_BEFORE = mod_slab.C_STD_CODE; mod.C_SPEC_BEFORE = mod_slab.C_SPEC; mod.C_MAT_CODE_BEFORE = mod_slab.C_MAT_CODE; mod.C_MAT_DESC_BEFORE = mod_slab.C_MAT_NAME; mod.C_ZYX1_BEFORE = mod_slab.C_ZYX1; mod.C_ZYX2_BEFORE = mod_slab.C_ZYX2; mod.C_JUDGE_LEV_BP_BEFORE = mod_slab.C_MAT_TYPE; mod.D_COMMUTE_DATE = RV.UI.ServerTime.timeNow(); mod.C_STL_GRD_AFTER = strGrd; mod.C_STD_CODE_AFTER = strStdCode; mod.C_SPEC_AFTER = mod_matrl.C_SLAB_SIZE; mod.C_MAT_CODE_AFTER = strMatCode; mod.C_MAT_DESC_AFTER = strMatName; mod.C_REASON_DEPMT_ID = strZrdwID; mod.C_REASON_DEPMT_DESC = strZrdwName; mod.C_EMP_ID = RV.UI.UserInfo.UserID; mod.C_REMARK = strRemark; mod.C_MASTER_ID = max_C_MASTER_ID; mod.C_GP_BEFORE_ID = max_C_GP_BEFORE_ID; mod.C_GP_AFTER_ID = max_C_GP_AFTER_ID; mod.C_ZYX1_AFTER = strZYX1; mod.C_ZYX2_AFTER = strZYX2; mod.C_JUDGE_LEV_BP_AFTER = strPDDJ; mod.C_COMMUTE_REASON = strGPYY; if (dal_commute.Add_Trans(mod)) { if (!dal_slab.Update_Trans(mod_slab.C_ID, mod_slab.C_BATCH_NO, strGrd, strStdCode, strMatCode, strMatName, mod_matrl.C_SLAB_SIZE, max_C_MASTER_ID, max_C_GP_BEFORE_ID, max_C_GP_AFTER_ID, strLGJH, strPDDJ, strZYX1, strZYX2, strGPYY, strLen, strDesignNo)) { TransactionHelper.RollBack(); return("改判失败,请检查修改后的内容!"); } } else { TransactionHelper.RollBack(); return("改判失败,添加改判记录时错误!"); } } } string interface_nc = dal_interface.SendXml_GP(strUrl, max_C_MASTER_ID, max_C_GP_BEFORE_ID, max_C_GP_AFTER_ID, slabCode); if (interface_nc != "1") { TransactionHelper.RollBack(); return(interface_nc); } TransactionHelper.Commit(); } catch (Exception ex) { TransactionHelper.RollBack(); return(ex.Message); } return(result); }
/// <summary> /// 钢坯综合判定确认 /// </summary> /// <param name="modTqcCompreSlab">需要确认实体信息</param> /// <param name="strResult">判定结果</param> /// <returns></returns> public string Slab_Compre_OK(Mod_TQC_COMPRE_SLAB modTqcCompreSlab, string strResult) { string result = "1"; try { Dal_TSC_SLAB_MAIN dalTscSlabMain = new Dal_TSC_SLAB_MAIN(); Dal_TSC_SLAB_MES dalTscSLabMes = new Dal_TSC_SLAB_MES(); Dal_TQC_QUA_RESULT dalTqcQuaResult = new Dal_TQC_QUA_RESULT(); TransactionHelper.BeginTransaction(); string strUserID = RV.UI.UserInfo.userID; DateTime time = RV.UI.ServerTime.timeNow(); string strUserAccount = RV.UI.UserInfo.userAccount; if (strUserAccount == "system") { TransactionHelper.RollBack(); return("不能用管理员账号确认!"); } //string V_GUID = Guid.NewGuid().ToString(); string V_GUID = Guid.NewGuid().ToString("B").ToUpper(); modTqcCompreSlab.C_QR_STATE = "Y"; modTqcCompreSlab.C_EMP_ID = strUserID; modTqcCompreSlab.D_MOD_DT = time; if (dal.Update_Trans(modTqcCompreSlab)) { if (dalTscSlabMain.Update_Trans(strResult, strUserID, modTqcCompreSlab)) { Mod_TSC_SLAB_MES modTscSlabMes = dalTscSLabMes.GetModel(modTqcCompreSlab.C_STOVE); string strLGJH = dalTscSlabMain.Get_LGJH(modTqcCompreSlab.C_STOVE); #region 插入CQA_BLOOM_HOTJUDGE_DATA(表判) int count_mes_bp = dal.Get_MES_BP_Count(modTqcCompreSlab.C_STOVE); if (count_mes_bp == 0) { string sql_bp = "INSERT INTO CQA_BLOOM_HOTJUDGE_DATA@cap_mes"; sql_bp += " (GUID,"; sql_bp += " NAME, "; sql_bp += " HEATID, "; sql_bp += " CASTERID, "; sql_bp += " STEELGRADEINDEX, "; sql_bp += " LENGTH, "; sql_bp += " WIDTH, "; sql_bp += " THICKNESS,"; sql_bp += " BLOOM_COUNT,"; sql_bp += " CAL_WEIGHT, "; sql_bp += " RIGHT_COUNT, "; sql_bp += " RIGHT_WEIGHT, "; sql_bp += " WASTER_COUNT, "; sql_bp += " WASTER_WEIGHT, "; sql_bp += " WASTER_COUNT1, "; sql_bp += " WASTER_WEIGHT1, "; sql_bp += " WASTER_REASON1, "; sql_bp += " WASTER_COUNT2, "; sql_bp += " WASTER_WEIGHT2, "; sql_bp += " WASTER_REASON2, "; sql_bp += " WASTER_COUNT3, "; sql_bp += " WASTER_WEIGHT3, "; sql_bp += " WASTER_REASON3, "; sql_bp += " WRONG_COUNT, "; sql_bp += " WRONG_WEIGHT, "; sql_bp += " WRONG_COUNT1, "; sql_bp += " WRONG_WEIGHT1, "; sql_bp += " WRONG_REASON1, "; sql_bp += " WRONG_COUNT2, "; sql_bp += " WRONG_WEIGHT2, "; sql_bp += " WRONG_REASON2, "; sql_bp += " WRONG_COUNT3, "; sql_bp += " WRONG_WEIGHT3, "; sql_bp += " WRONG_REASON3, "; sql_bp += " SUFACEDEFACTDES, "; sql_bp += " HOTJUDGE_TIME, "; sql_bp += " WAITCHECKFLAG, "; sql_bp += " TEAM, "; sql_bp += " SHIFT, "; sql_bp += " OPERATOR "; sql_bp += " ) "; sql_bp += " values "; sql_bp += " ('" + V_GUID + "',"; sql_bp += " '" + modTscSlabMes.NAME + "', "; sql_bp += " '" + modTscSlabMes.MATERIALID + "', "; sql_bp += " '" + modTscSlabMes.CASTERID + "', "; sql_bp += " '" + strLGJH + "', "; sql_bp += " '" + modTscSlabMes.LENGTH + "', "; sql_bp += " '" + modTscSlabMes.WIDTH + "', "; sql_bp += " '" + modTscSlabMes.THICKNESS + "',"; sql_bp += " '" + modTscSlabMes.BLOOM_COUNT + "',"; sql_bp += " '" + modTscSlabMes.CAL_WEIGHT + "', "; sql_bp += " '" + modTscSlabMes.RIGHT_COUNT + "', "; sql_bp += " '" + modTscSlabMes.RIGHT_WEIGHT + "', "; sql_bp += " '" + modTscSlabMes.WASTER_COUNT + "', "; sql_bp += " '" + modTscSlabMes.WASTER_WEIGHT + "', "; sql_bp += " '" + modTscSlabMes.WASTER_COUNT1 + "', "; sql_bp += " '" + modTscSlabMes.WASTER_WEIGHT1 + "', "; sql_bp += " '" + modTscSlabMes.WASTER_REASON1 + "', "; sql_bp += " '" + modTscSlabMes.WASTER_COUNT2 + "', "; sql_bp += " '" + modTscSlabMes.WASTER_WEIGHT2 + "', "; sql_bp += " '" + modTscSlabMes.WASTER_REASON2 + "', "; sql_bp += " '" + modTscSlabMes.WASTER_COUNT3 + "', "; sql_bp += " '" + modTscSlabMes.WASTER_WEIGHT3 + "', "; sql_bp += " '" + modTscSlabMes.WASTER_REASON3 + "', "; sql_bp += " '" + modTscSlabMes.WRONG_COUNT + "', "; sql_bp += " '" + modTscSlabMes.WRONG_WEIGHT + "', "; sql_bp += " '" + modTscSlabMes.WRONG_COUNT1 + "', "; sql_bp += " '" + modTscSlabMes.WRONG_WEIGHT1 + "', "; sql_bp += " '" + modTscSlabMes.WRONG_REASON1 + "', "; sql_bp += " '" + modTscSlabMes.WRONG_COUNT2 + "', "; sql_bp += " '" + modTscSlabMes.WRONG_WEIGHT2 + "', "; sql_bp += " '" + modTscSlabMes.WRONG_REASON2 + "', "; sql_bp += " '" + modTscSlabMes.WRONG_COUNT3 + "', "; sql_bp += " '" + modTscSlabMes.WRONG_WEIGHT3 + "', "; sql_bp += " '" + modTscSlabMes.WRONG_REASON3 + "', "; sql_bp += " '" + modTscSlabMes.SUFACEDEFACTDES + "', "; sql_bp += " to_date('" + time + "','yyyy-mm-dd hh24:mi:ss'), "; sql_bp += " '0', "; sql_bp += " '1', "; //班组 sql_bp += " '1', "; //班次 sql_bp += " '" + strUserAccount + "' "; //操作人 sql_bp += " ) "; if (!dal.Add_Mes_Trans(sql_bp)) { TransactionHelper.RollBack(); //Transaction_MES.RollBack(); return("更新MES表判信息失败"); } } #endregion #region 插入CQA_BLOOM_FINJUDGE_DATA(综判) int count_mes_zp = dal.Get_MES_ZP_Count(modTqcCompreSlab.C_STOVE); if (count_mes_zp == 0) { string sql_zp = "INSERT INTO CQA_BLOOM_FINJUDGE_DATA@cap_mes"; sql_zp += " (GUID, "; sql_zp += " NAME, "; sql_zp += " HEATID, "; sql_zp += " CASTERID, "; sql_zp += " PRE_STEELGRADEINDEX, "; sql_zp += " STEELGRADEINDEX, "; sql_zp += " CUT_STEELGRADEINDEX,"; sql_zp += " FINAL_STEELGRADEINDEX,"; sql_zp += " LENGTH, "; sql_zp += " WIDTH, "; sql_zp += " THICKNESS,"; sql_zp += " BLOOM_COUNT, "; sql_zp += " CAL_WEIGHT, "; sql_zp += " RIGHT_COUNT, "; sql_zp += " RIGHT_WEIGHT, "; sql_zp += " WASTER_COUNT, "; sql_zp += " WASTER_WEIGHT, "; sql_zp += " WASTER_COUNT1, "; sql_zp += " WASTER_WEIGHT1, "; sql_zp += " WASTER_REASON1, "; sql_zp += " WASTER_COUNT2, "; sql_zp += " WASTER_WEIGHT2, "; sql_zp += " WASTER_REASON2, "; sql_zp += " WASTER_COUNT3, "; sql_zp += " WASTER_WEIGHT3, "; sql_zp += " WASTER_REASON3, "; sql_zp += " WRONG_COUNT, "; sql_zp += " WRONG_WEIGHT, "; sql_zp += " WRONG_COUNT1, "; sql_zp += " WRONG_WEIGHT1, "; sql_zp += " WRONG_REASON1, "; sql_zp += " WRONG_COUNT2, "; sql_zp += " WRONG_WEIGHT2, "; sql_zp += " WRONG_REASON2, "; sql_zp += " WRONG_COUNT3, "; sql_zp += " WRONG_WEIGHT3, "; sql_zp += " WRONG_REASON3, "; sql_zp += " SUFACEDEFACTDES, "; sql_zp += " FINISHEDTIME, "; sql_zp += " FINALJUDGE_TIME,"; sql_zp += " PROCESS_TYPE, "; sql_zp += " EXCEPTIONAL_CODE, "; sql_zp += " DECIDE_CODE, "; sql_zp += " TEAM, "; sql_zp += " SHIFT, "; sql_zp += " OPERATOR, "; sql_zp += " TEST_ROLL_COUNT, "; sql_zp += " TEST_ROLL_WEIGHT, "; sql_zp += " NC_CONFIRM_FLAG, "; sql_zp += " STORE_CHANGEJUDGE_FLAG"; sql_zp += " )"; sql_zp += " values"; sql_zp += " ('" + V_GUID + "', "; sql_zp += " '" + modTscSlabMes.NAME + "', "; sql_zp += " '" + modTscSlabMes.HEATID + "', "; sql_zp += " '" + modTscSlabMes.CASTERID + "', "; sql_zp += " '" + modTscSlabMes.PRE_STEELGRADEINDEX + "', "; sql_zp += " '" + modTscSlabMes.STEELGRADEINDEX + "', "; sql_zp += " '" + modTscSlabMes.CUT_STEELGRADEINDEX + "',"; sql_zp += " '" + strLGJH + "',"; sql_zp += " '" + modTscSlabMes.LENGTH + "', "; sql_zp += " '" + modTscSlabMes.WIDTH + "', "; sql_zp += " '" + modTscSlabMes.THICKNESS + "',"; sql_zp += " '" + modTscSlabMes.BLOOM_COUNT + "', "; sql_zp += " '" + modTscSlabMes.CAL_WEIGHT + "', "; sql_zp += " '" + modTscSlabMes.RIGHT_COUNT + "', "; sql_zp += " '" + modTscSlabMes.RIGHT_WEIGHT + "', "; sql_zp += " '" + modTscSlabMes.WASTER_COUNT + "', "; sql_zp += " '" + modTscSlabMes.WASTER_WEIGHT + "', "; sql_zp += " '" + modTscSlabMes.WASTER_COUNT1 + "', "; sql_zp += " '" + modTscSlabMes.WASTER_WEIGHT1 + "', "; sql_zp += " '" + modTscSlabMes.WASTER_REASON1 + "', "; sql_zp += " '" + modTscSlabMes.WASTER_COUNT2 + "', "; sql_zp += " '" + modTscSlabMes.WASTER_WEIGHT2 + "', "; sql_zp += " '" + modTscSlabMes.WASTER_REASON2 + "', "; sql_zp += " '" + modTscSlabMes.WASTER_COUNT3 + "', "; sql_zp += " '" + modTscSlabMes.WASTER_WEIGHT3 + "', "; sql_zp += " '" + modTscSlabMes.WASTER_REASON3 + "', "; sql_zp += " '" + modTscSlabMes.WRONG_COUNT + "', "; sql_zp += " '" + modTscSlabMes.WRONG_WEIGHT + "', "; sql_zp += " '" + modTscSlabMes.WRONG_COUNT1 + "', "; sql_zp += " '" + modTscSlabMes.WRONG_WEIGHT1 + "', "; sql_zp += " '" + modTscSlabMes.WRONG_REASON1 + "', "; sql_zp += " '" + modTscSlabMes.WRONG_COUNT2 + "', "; sql_zp += " '" + modTscSlabMes.WRONG_WEIGHT2 + "', "; sql_zp += " '" + modTscSlabMes.WRONG_REASON2 + "', "; sql_zp += " '" + modTscSlabMes.WRONG_COUNT3 + "', "; sql_zp += " '" + modTscSlabMes.WRONG_WEIGHT3 + "', "; sql_zp += " '" + modTscSlabMes.WRONG_REASON3 + "', "; sql_zp += " '" + modTscSlabMes.SUFACEDEFACTDES + "', "; sql_zp += " to_date('" + modTscSlabMes.FINISHEDTIME + "', 'yyyy-mm-dd hh24:mi:ss'), "; sql_zp += " to_date('" + time + "','yyyy-mm-dd hh24:mi:ss'),"; sql_zp += " '" + modTscSlabMes.PROCESS_TYPE + "', "; sql_zp += " '', "; sql_zp += " '', "; sql_zp += " '1', "; //班组 sql_zp += " '1', "; //班次 sql_zp += " '" + strUserAccount + "', "; sql_zp += " '" + modTscSlabMes.TEST_ROLL_COUNT + "', "; sql_zp += " '" + modTscSlabMes.TEST_ROLL_WEIGHT + "', "; sql_zp += " '0', "; sql_zp += " '0' "; sql_zp += " )"; if (!dal.Add_Mes_Trans(sql_zp)) { TransactionHelper.RollBack(); //Transaction_MES.RollBack(); return("更新MES综判信息失败"); } } #endregion #region 更新CBLOOM_DATA if (!dal.Update_LGJH_Trans(strLGJH, modTqcCompreSlab.C_STOVE)) { TransactionHelper.RollBack(); //Transaction_MES.RollBack(); return("更新MES收料表失败"); } #endregion #region 更新CQA_LAB_ELEMENT(综判成分) DataTable dtCF = dalTqcQuaResult.Get_PD_List(modTqcCompreSlab.C_STOVE).Tables[0]; if (dtCF.Rows.Count > 0) { int countCF = dal.Get_MES_CF_Count(dtCF.Rows[0]["C_COMMISSIONID"].ToString(), dtCF.Rows[0]["C_SAMPID"].ToString(), modTqcCompreSlab.C_STOVE); if (countCF > 0) { if (!dal.Update_CF_Trans(dtCF.Rows[0]["C_COMMISSIONID"].ToString(), dtCF.Rows[0]["C_SAMPID"].ToString(), modTqcCompreSlab.C_STOVE)) { TransactionHelper.RollBack(); //Transaction_MES.RollBack(); return("更新MES判定成分信息失败"); } } else { TransactionHelper.RollBack(); return("获取MES判定成分失败"); } } else { TransactionHelper.RollBack(); return("获取CAP判定成分失败"); } #endregion modTscSlabMes.FINAL_STEELGRADEINDEX = strLGJH; if (!dalTscSLabMes.Update_Trans(modTscSlabMes)) { TransactionHelper.RollBack(); return("确认失败"); } } else { TransactionHelper.RollBack(); return("确认失败"); } } else { TransactionHelper.RollBack(); return("确认失败"); } TransactionHelper.Commit(); } catch (Exception ex) { TransactionHelper.RollBack(); return(ex.Message); } return(result); }
/// <summary> /// 下发轧钢计划 /// </summary> /// <returns></returns> public string UpdateWgt(DataRow[] rows) { try { string result = "1"; TransactionHelper.BeginTransaction(); Dal_TSC_SLAB_MAIN dalMain = new Dal_TSC_SLAB_MAIN(); int a = 0; foreach (var item in rows) { a++; decimal cou = Convert.ToDecimal(item["NC账存支数"].ToString()); decimal wgt = Convert.ToDecimal(item["NC与CAP重量账差"].ToString()); if (cou == 0 || wgt == 0) { continue; } decimal wgt_ave = Math.Round(wgt / cou, 3); decimal wgt_sy = 0; if (cou > 1) { wgt_sy = wgt - wgt_ave * (cou - 1); } DataTable dt = dalMain.Get_List(item["炉号"].ToString(), item["钢种"].ToString(), item["开坯号"].ToString(), item["物料号"].ToString(), item["自由项1"].ToString(), item["自由项2"].ToString(), item["质量等级"].ToString(), item["仓库"].ToString()).Tables[0]; if (dt.Rows.Count == cou) { for (int kk = 0; kk < dt.Rows.Count; kk++) { Mod_TSC_SLAB_MAIN model = dalMain.GetModel_Trans(dt.Rows[kk]["C_ID"].ToString()); if (kk == dt.Rows.Count - 1) { if (cou == 1) { model.N_WGT = model.N_WGT + wgt_ave; } else { model.N_WGT = model.N_WGT + wgt_sy; } } else { model.N_WGT = model.N_WGT + wgt_ave; } if (!dalMain.Update_Trans(model)) { TransactionHelper.RollBack(); return("重量更新失败!"); } } } else { continue; } } TransactionHelper.Commit(); return(result); } catch (Exception ex) { TransactionHelper.RollBack(); return(ex.Message); } }