/// <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);
        }
Example #2
0
        /// <summary>
        /// 分库
        /// </summary>
        /// <returns></returns>
        public string Add_FK(DataRow dr, int num, string slabwhCode, string shift, string group, string strUrl, string remark)
        {
            string result = "1";

            try
            {
                Dal_TSC_SLAB_MOVE        dalSlabMove   = new Dal_TSC_SLAB_MOVE();
                Dal_Interface_NC_SLAB_A4 dalInterface  = new Dal_Interface_NC_SLAB_A4();
                Dal_TSC_SLAB_MES         dalTscSlabMes = new Dal_TSC_SLAB_MES();

                TransactionHelper.BeginTransaction();

                string   strUserID = RV.UI.UserInfo.userID;
                DateTime time      = RV.UI.ServerTime.timeNow();

                DataTable billet = new DataTable();
                if (dal.UpdateMoveType(dr["C_STOVE"].ToString(), dr["C_STL_GRD"].ToString(), dr["C_SPEC"].ToString(), dr["C_STD_CODE"].ToString(), dr["C_MAT_CODE"].ToString(), num, slabwhCode, shift, group, strUserID, time, out billet, remark) != num)
                {
                    TransactionHelper.RollBack();
                    return("0");
                }

                if (billet != null && billet.Rows.Count > 0)
                {
                    foreach (DataRow item in billet.Rows)
                    {
                        Mod_TSC_SLAB_MOVE model = new Mod_TSC_SLAB_MOVE();
                        model.C_MOVE_TYPE    = "M";
                        model.C_SLAB_MAIN_ID = item["C_ID"].ToString();
                        model.C_STA_ID       = item["C_STA_ID"].ToString();
                        model.C_STOVE        = item["C_STOVE"].ToString();
                        model.C_STL_GRD      = item["C_STL_GRD"].ToString();
                        model.C_SPEC         = item["C_SPEC"].ToString();

                        if (!string.IsNullOrEmpty(item["N_LEN"].ToString()))
                        {
                            model.N_LEN = Convert.ToDecimal(item["N_LEN"].ToString());
                        }

                        model.C_STD_CODE = item["C_STD_CODE"].ToString();
                        model.C_MAT_CODE = item["C_MAT_CODE"].ToString();
                        model.C_MAT_NAME = item["C_MAT_NAME"].ToString();

                        if (!string.IsNullOrEmpty(item["N_WGT"].ToString()))
                        {
                            model.N_WGT = Convert.ToDecimal(item["N_WGT"].ToString());
                        }

                        //model.C_STOCK_CODE = item["C_SLABWH_CODE"].ToString();
                        model.C_STOCK_CODE_TO = slabwhCode;
                        //model.C_AREA_CODE = item["C_SLABWH_AREA_CODE"].ToString();
                        //model.C_KW_CODE = item["C_SLABWH_LOC_CODE"].ToString();
                        //model.C_FLOOD_CODE = item["C_SLABWH_TIER_CODE"].ToString();
                        model.D_MOVE_DATE   = time;
                        model.C_MOVE_GROUP  = group;
                        model.C_MOVE_SHIFT  = shift;
                        model.C_MOVE_EMP_ID = strUserID;

                        if (!dalSlabMove.Add(model))
                        {
                            TransactionHelper.RollBack();
                            return("0");
                        }
                    }
                }

                //if (!dalTscSlabMes.Update_Trans(dr["C_STOVE"].ToString()))
                //{
                //    TransactionHelper.RollBack();
                //    return "0";
                //}

                //int wg_count = dalTscSlabMes.Get_Count(dr["C_STOVE"].ToString());

                //if (wg_count > 0)
                //{
                //    bool result_NC = dalInterface.SendXml_SLAB_A4(strUrl, dr["C_STOVE"].ToString(), strUserID);//上传完工报告A4

                //    if (!result_NC)
                //    {
                //        TransactionHelper.RollBack();
                //        return "0";
                //    }
                //}

                TransactionHelper.Commit();
            }
            catch (Exception ex)
            {
                TransactionHelper.RollBack();
                return("0");
            }

            return(result);
        }