Ejemplo n.º 1
0
        /// <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);
        }