Ejemplo n.º 1
0
        /// <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="strZYX1">自由项1</param>
        /// <param name="strZYX2">自由项2</param>
        /// <param name="strGPYY">改判原因</param>
        /// <param name="strLen">定尺</param>
        /// <param name="strISSH">是否审核</param>
        /// <returns></returns>
        public string TPGP_Slab(string strs, string strGrd, string strStdCode, string strMatCode, string strMatName, string strZrdwID, string strZrdwName, string strPDDJ, string strZYX1, string strZYX2, string strGPYY, string strLen, decimal strISSH)
        {
            string result = "1";

            try
            {
                Dal_TQC_TP_SLAB_COMMUTE dalTP     = new Dal_TQC_TP_SLAB_COMMUTE();
                Dal_TSC_SLAB_MAIN       dal_slab  = new Dal_TSC_SLAB_MAIN();
                Dal_TQD_DESIGN          dalDesign = new Dal_TQD_DESIGN();

                TransactionHelper.BeginTransaction();

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

                string strDesignNo = dalDesign.Get_Design_No(strStdCode, strGrd);
                if (string.IsNullOrEmpty(strDesignNo))
                {
                    return("改判失败,没有找到对应的执行标准信息!");
                }
                string[] strs_Slab_ID = strs.Substring(0, strs.Length - 1).Split(',');

                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;
                        Mod_TQC_TP_SLAB_COMMUTE mod = new Mod_TQC_TP_SLAB_COMMUTE();
                        mod.C_STA_ID              = mod_slab.C_STA_DESC;
                        mod.C_SLAB_MAIN_ID        = strs_Slab_ID[i];
                        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_BEFORE          = 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.C_STL_GRD_AFTER       = strGrd;
                        mod.C_STD_CODE_AFTER      = strStdCode;
                        mod.C_SPEC_AFTER          = mod_matrl.C_SLAB_SIZE;
                        mod.N_LEN_AFTER           = Convert.ToDecimal(strLen);
                        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.UserName;
                        mod.C_ZYX1_AFTER          = strZYX1;
                        mod.C_ZYX2_AFTER          = strZYX2;
                        mod.C_JUDGE_LEV_BP_AFTER  = strPDDJ;
                        mod.C_COMMUTE_SQ          = strGPYY;
                        mod.N_IS_SH               = strISSH;
                        mod.C_REMARK2             = mod_slab.C_MOVE_TYPE;
                        mod.C_REMARK3             = mod_slab.C_SLABWH_CODE;
                        if (dalTP.Add_Trans(mod))
                        {
                            if (!dal_slab.UpdateTP_Trans(mod_slab.C_ID, mod_slab.C_BATCH_NO))
                            {
                                TransactionHelper.RollBack();
                                return("改判失败,修改钢坯实绩状态时错误!");
                            }
                        }
                        else
                        {
                            TransactionHelper.RollBack();
                            return("改判失败,添加改判记录时错误!");
                        }
                    }
                }

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

            return(result);
        }