示例#1
0
 //根据Type取得RunInTimeControl列表
 //SELECT ID,Code, [Type], [Hour], Remark,Editor, Cdt, Udt 
 //FROM RunInTimeControl
 //         WHERE Type = ? 
 //         ORDER BY Code   
 public IList<RunInTimeControlInfoMaintain> GetRunInTimeControlListByType(string type)
 {
     try
     {
         IList<RunInTimeControl> result = productRepository.GetRunInTimeControlListByType(type);
         IList<RunInTimeControlInfoMaintain> returnList = new List<RunInTimeControlInfoMaintain>();
         foreach (RunInTimeControl runInTimeControl in result)
         {
             RunInTimeControlInfoMaintain runInTimeControlInfoMaintain = new RunInTimeControlInfoMaintain();
             runInTimeControlInfoMaintain.ID = runInTimeControl.ID;
             runInTimeControlInfoMaintain.Code = runInTimeControl.Code;
             runInTimeControlInfoMaintain.Hour = runInTimeControl.Hour.Trim();
             runInTimeControlInfoMaintain.TestStation = runInTimeControl.TestStation;
             runInTimeControlInfoMaintain.ControlType = runInTimeControl.ControlType;
             runInTimeControlInfoMaintain.Type = runInTimeControl.Type;
             runInTimeControlInfoMaintain.Remark = runInTimeControl.Remark;
             runInTimeControlInfoMaintain.Editor = runInTimeControl.Editor;
             runInTimeControlInfoMaintain.Cdt = runInTimeControl.Cdt;
             runInTimeControlInfoMaintain.Udt = runInTimeControl.Udt;
             returnList.Add(runInTimeControlInfoMaintain);
         }
         return returnList;
     }
     catch (FisException e)
     {
         logger.Error(e.mErrmsg);
         throw e;
     }
     catch (Exception e)
     {
         logger.Error(e.Message);
         throw;
     }
 }
示例#2
0
 public int getId(string type, string code, string testCode)
 {
     RunInTimeControlInfoMaintain runintime = new RunInTimeControlInfoMaintain();
     runintime = runInTimeControlManager.getRunintimeControlByCodeTypeAndTestStation(type, code, testCode);
     if (runintime != null)
     {
         return runintime.ID;
     }
     else
         return 0;
 }
示例#3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnAdd_ServerClick(Object sender, EventArgs e)
 {
     string code = this.CmbFamily.InnerDropDownList.SelectedValue.Trim();
     string time = this.txtTime.Text;
     int id = 0;
     try
     {
         RunInTimeControlInfoMaintain rin = new RunInTimeControlInfoMaintain();
         rin.Code = code;
         rin.Hour = time;
         rin.Type = "Family";
         if (this.drpControlType.SelectedValue == "Shortest")
         {
             rin.ControlType = true;
         }
         else
         {
             rin.ControlType = false;
         }
         rin.TestStation = this.CmbStation.InnerDropDownList.SelectedValue;
         rin.Editor = this.HiddenUserName.Value;
         rin.Cdt = DateTime.Now;
         rin.Udt = DateTime.Now;
         runInTimeControlManager.InsertRunInTimeControl(rin);
         id = getId(rin.Type, rin.Code, rin.TestStation);
     }
     catch (FisException ex)
     {
         showErrorMessage(ex.mErrmsg);
         return;
     }
     catch (Exception ex)
     {
         showErrorMessage(ex.Message);
         return;
     }
     ShowRunInTimeControlList();
     this.UpdatePanel1.Update();
     ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "resetTableHeight();AddUpdateComplete('" + id + "');", true);
 }
示例#4
0
    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_ServerClick(Object sender, EventArgs e)
    {
        string type = "Family";
        string code = this.CmbFamily.InnerDropDownList.SelectedValue;
        string hour = this.txtTime.Text;
        string oldCode = this.oldCode.Value.ToString();
        string oldStation = this.hidStation.Value;
        string id = this.hidId.Value.Trim();
        try
        {
            RunInTimeControlInfoMaintain runInTimeControlInfo = new RunInTimeControlInfoMaintain();
            runInTimeControlInfo.Code = code;
            runInTimeControlInfo.Type = type;
            runInTimeControlInfo.TestStation = this.CmbStation.InnerDropDownList.SelectedValue;
            if (this.drpControlType.SelectedValue == "Longest")
            {
                runInTimeControlInfo.ControlType = false;
            }
            else
            {
                runInTimeControlInfo.ControlType = true;
            }
            runInTimeControlInfo.Hour = this.txtTime.Text;
            runInTimeControlInfo.Editor = this.HiddenUserName.Value;
            runInTimeControlInfo.Udt = DateTime.Now;

            runInTimeControlInfo.ID = Int32.Parse(id);
            runInTimeControlManager.UpdateRunInTimeControlById(runInTimeControlInfo);
            //id = getId(type, code, runInTimeControlInfo.TestStation);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            return;
        }
        ShowRunInTimeControlList();
        this.UpdatePanel1.Update();
        ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "Update", "resetTableHeight();AddUpdateComplete('" + id + "');", true);

    }
示例#5
0
        //根据CPQSNO取得RunInTimeControl列表
        //SELECT ID,Code, [Type], [Hour], Remark,Editor, Cdt, Udt 
        //FROM RunInTimeControl
        //         WHERE Type = ? 
        //         ORDER BY Code   
        public IList<RunInTimeControlInfoMaintain> GetRunInTimeControlListByCPQSNO(string type)
        {                                           
            try
            {
                string Connection = ConfigurationManager.ConnectionStrings["DBServer"].ToString().Trim();
                Connection = string.Format(Connection, "HPIMES");
                string cmdText = @"select a.*
                                    from RunInTimeControl a 
                                    join Product b  on a.Code = b.CUSTSN 
                                    join ProductStatus  c  on c.ProductID = b.ProductID 
                                    where not exists(select 1 from ConstValue d 
                                                        where c.Station = d.Value  and d.Type='SpecialRuninTime') and 
                                                        a.Type ='CPQSNO'";
                DataTable dt = new DataTable();
                dt = IMES.Infrastructure.Repository._Schema.SqlHelper.ExecuteDataFill(Connection, System.Data.CommandType.Text, cmdText);
                IList<RunInTimeControlInfoMaintain> returnList = new List<RunInTimeControlInfoMaintain>();
                for(int i = 0; i<dt.Rows.Count; i++)
                {

                    RunInTimeControlInfoMaintain runInTimeControlInfoMaintain = new RunInTimeControlInfoMaintain();

                    runInTimeControlInfoMaintain.ID = (int)dt.Rows[i]["ID"];
                    runInTimeControlInfoMaintain.Code = (string)dt.Rows[i]["Code"];
                    runInTimeControlInfoMaintain.Hour = (string)dt.Rows[i]["Hour"];
                    runInTimeControlInfoMaintain.TestStation = (string)dt.Rows[i]["TestStation"];
                    runInTimeControlInfoMaintain.ControlType = (bool)dt.Rows[i]["ControlType"];
                    runInTimeControlInfoMaintain.Type = (string)dt.Rows[i]["Type"];
                    if (dt.Rows[i]["Remark"] == DBNull.Value)
                    { runInTimeControlInfoMaintain.Remark = "";}
                    else { runInTimeControlInfoMaintain.Remark = (string)dt.Rows[i]["Remark"]; }
                    runInTimeControlInfoMaintain.Editor = (string)dt.Rows[i]["Editor"];
                    runInTimeControlInfoMaintain.Cdt = (DateTime)dt.Rows[i]["Cdt"];
                    runInTimeControlInfoMaintain.Udt = (DateTime)dt.Rows[i]["Udt"];
                    returnList.Add(runInTimeControlInfoMaintain);
                }


                return returnList;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                logger.Error(e.StackTrace);
                throw;
            }
        }
示例#6
0
        /// <summary>
        /// 根据type、code、teststation修改数据
        /// </summary>
        /// <param name="runInTimeControl"></param>
        /// <param name="type"></param>
        /// <param name="code"></param>
        /// <param name="testStation"></param>
        //public void UpdateRunInTimeControlByTypeCodeAndTestStation(RunInTimeControlInfoMaintain runInTimeControlInfoMaintain, string type, string code, string testStation)
        //{
        //    RunInTimeControl runInTimeControl = new RunInTimeControl();
        //    runInTimeControl.Code = runInTimeControlInfoMaintain.Code;
        //    runInTimeControl.Type = runInTimeControlInfoMaintain.Type;
        //    runInTimeControl.Hour = runInTimeControlInfoMaintain.Hour;
        //    runInTimeControl.Remark = runInTimeControlInfoMaintain.Remark;
        //    runInTimeControl.Editor = runInTimeControlInfoMaintain.Editor;
        //    runInTimeControl.TestStation = runInTimeControlInfoMaintain.TestStation;
        //    runInTimeControl.ControlType = runInTimeControlInfoMaintain.ControlType;
        //    runInTimeControl.Udt = runInTimeControlInfoMaintain.Udt;
        //    try
        //    {
        //        if ((!runInTimeControl.Code.Equals(code)) || (!runInTimeControl.TestStation.Equals(testStation)))
        //        {
        //            RunInTimeControlInfoMaintain runInTimeContr = productRepository.GetRunInTimeControlByTypeCodeAndStation(runInTimeControl.Type, runInTimeControl.Code, runInTimeControl.TestStation);
        //            if (runInTimeContr != null)
        //            {
        //                //已经存在具有相同runintimecontrol记录
        //                List<string> erpara = new List<string>();
        //                FisException ex;
        //                ex = new FisException("DMT102", erpara);
        //                throw ex;
        //            }
        //        }
        //        UnitOfWork uow = new UnitOfWork();
        //        productRepository.UpdateRunInTimeControlByTypeCodeAndTestStation(runInTimeControl, type, code, testStation);
        //    }
        //    catch (FisException e)
        //    {
        //        logger.Error(e.mErrmsg);
        //        throw e;
        //    }
        //    catch (Exception e)
        //    {
        //        logger.Error(e.Message);
        //        throw;
        //    }
        //}
        public void UpdateRunInTimeControlById(RunInTimeControlInfoMaintain runInTimeControlInfoMaintain)
        {
            RunInTimeControl runInTimeControl = new RunInTimeControl();
            runInTimeControl.Code = runInTimeControlInfoMaintain.Code;
            runInTimeControl.Type = runInTimeControlInfoMaintain.Type;
            runInTimeControl.Hour = runInTimeControlInfoMaintain.Hour;
            runInTimeControl.Remark = runInTimeControlInfoMaintain.Remark;
            runInTimeControl.Editor = runInTimeControlInfoMaintain.Editor;
            runInTimeControl.TestStation = runInTimeControlInfoMaintain.TestStation;
            runInTimeControl.ControlType = runInTimeControlInfoMaintain.ControlType;
            runInTimeControl.Udt = DateTime.Now;// runInTimeControlInfoMaintain.Udt;
            runInTimeControl.ID = runInTimeControlInfoMaintain.ID;

            try
            {

                RunInTimeControlInfoMaintain runInTimeContr = productRepository.GetRunInTimeControlExceptId(runInTimeControl.Type, runInTimeControl.Code, runInTimeControl.TestStation, runInTimeControl.ID);
                if (runInTimeContr != null)
                {
                    //已经存在具有相同runintimecontrol记录
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("DMT102", erpara);
                    throw ex;
                }
            
                UnitOfWork uow = new UnitOfWork();
                productRepository.InsertRunInTimeControlLogDefered(uow, runInTimeControl.ID);
                productRepository.UpdateRunInTimeControlByIdDefered(uow,runInTimeControl);
                uow.Commit();

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }
        }
示例#7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="runInTimeControlInfoMaintain"></param>
        /// <returns></returns>
        //public int UpdateRunInTimeControlByTypeAndCode(RunInTimeControlInfoMaintain runInTimeControlInfoMaintain)
        //{
        //    RunInTimeControl runInTimeControl = new RunInTimeControl();
        //    runInTimeControl.Code = runInTimeControlInfoMaintain.Code;
        //    runInTimeControl.Type = runInTimeControlInfoMaintain.Type;
        //    runInTimeControl.Hour = runInTimeControlInfoMaintain.Hour;
        //    runInTimeControl.Remark = runInTimeControlInfoMaintain.Remark;
        //    runInTimeControl.Editor = runInTimeControlInfoMaintain.Editor;
        //    runInTimeControl.TestStation = runInTimeControlInfoMaintain.TestStation;
        //    runInTimeControl.ControlType = runInTimeControlInfoMaintain.ControlType;
        //    runInTimeControl.Udt = runInTimeControlInfoMaintain.Udt;
        //    try
        //    {
        //        RunInTimeControlInfoMaintain runInTimeContr = productRepository.GetRunInTimeControlByTypeCodeAndStation(runInTimeControl.Type, runInTimeControl.Code, runInTimeControl.TestStation);
        //        if (runInTimeContr == null)
        //        {
        //            UnitOfWork uow = new UnitOfWork();
        //            productRepository.UpdateRunInTimeControlByTypeAndCodeDefered(uow, runInTimeControl);
        //            productRepository.InsertRunInTimeControlLogDefered(uow, runInTimeControl.Type, runInTimeControl.Code);
        //            uow.Commit();
        //        }
        //        else
        //        {
        //            //已经存在具有相同runintimecontrol记录
        //            List<string> erpara = new List<string>();
        //            FisException ex;
        //            ex = new FisException("DMT102", erpara);
        //            throw ex;
        //        }
        //    }
        //    catch (FisException e)
        //    {
        //        logger.Error(e.mErrmsg);
        //        throw e;
        //    }
        //    catch (Exception e)
        //    {
        //        logger.Error(e.Message);
        //        throw;
        //    }
        //    return runInTimeControlInfoMaintain.ID;
        //}
        //记录log信息
        //INSERT RunInTimeControlLog(Code, [Type], [Hour], Remark, Editor, Cdt)
        //                  SELECT Code, [Type], Hour, Remark, Editor, Udt
        //                            FROM RunInTimeControl
        //                            WHERE [Type] = ? AND Code = ?  
        //public void InsertRunInTimeControlLog(string type, string code)
        //{
        //    try
        //    {
        //        productRepository.InsertRunInTimeControlLog(type, code);
        //    }
        //    catch (FisException e)
        //    {
        //        logger.Error(e.mErrmsg);
        //        throw e;
        //    }
        //    catch (Exception e)
        //    {
        //        logger.Error(e.Message);
        //        throw;
        //    }
        //}

        //新增RunInTimeControl纪录,返回ID (对象带出)
        //INSERT RunInTimeControl(Code, [Type], [Hour], Remark, Editor, Cdt, Udt)
        //                   VALUES(?, ?, ?, ?, ?, GETDATE(), GETDATE()) 
        public int InsertRunInTimeControl(RunInTimeControlInfoMaintain runInTimeControlInfoMaintain)
        {
            RunInTimeControl runInTimeControl = new RunInTimeControl();
            runInTimeControl.Code = runInTimeControlInfoMaintain.Code;
            runInTimeControl.Type = runInTimeControlInfoMaintain.Type;
            runInTimeControl.Hour = runInTimeControlInfoMaintain.Hour;
            runInTimeControl.Remark = runInTimeControlInfoMaintain.Remark;
            runInTimeControl.Editor = runInTimeControlInfoMaintain.Editor;
            runInTimeControl.TestStation = runInTimeControlInfoMaintain.TestStation;
            runInTimeControl.ControlType = runInTimeControlInfoMaintain.ControlType;
            runInTimeControl.Cdt = runInTimeControlInfoMaintain.Cdt;
            runInTimeControl.Udt = runInTimeControlInfoMaintain.Udt;
            try
            {
                RunInTimeControlInfoMaintain runInTimeContr = productRepository.GetRunInTimeControlByTypeCodeAndStation(runInTimeControl.Type, runInTimeControl.Code, runInTimeControl.TestStation);
                if (runInTimeContr == null)
                {
                    UnitOfWork uow = new UnitOfWork();
                    productRepository.InsertRunInTimeControlDefered(uow, runInTimeControl);
                    //productRepository.InsertRunInTimeControlLogDefered(uow, runInTimeControlInfoMaintain.Type, runInTimeControlInfoMaintain.Code);
                    uow.Commit();
                }
                else
                { //已经存在具有相同runintimecontrol记录
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("DMT102", erpara);
                    throw ex;

                }
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }
            return runInTimeControl.ID;
        }
示例#8
0
 //根据Type和Code取得RunInTimeControl 
 //SELECT ID,Code, [Type], [Hour], Remark,Editor, Cdt, Udt  
 //FROM RunInTimeControl
 //         WHERE Type = ?
 //                   AND Code = ? 
 public RunInTimeControlInfoMaintain GetRunInTimeControlByTypeAndCode(string type, string code)
 {
     try
     {
         RunInTimeControl runInTimeControl = productRepository.GetRunInTimeControl(type, code);
         if (runInTimeControl == null)
         {
             return null;
         }
         RunInTimeControlInfoMaintain runInTimeControlInfoMaintain = new RunInTimeControlInfoMaintain();
         runInTimeControlInfoMaintain.ID = runInTimeControl.ID;
         runInTimeControlInfoMaintain.Code = runInTimeControl.Code;
         runInTimeControlInfoMaintain.Type = runInTimeControl.Type;
         runInTimeControlInfoMaintain.Hour = runInTimeControl.Hour.Trim();
         runInTimeControlInfoMaintain.TestStation = runInTimeControl.TestStation;
         runInTimeControlInfoMaintain.ControlType = runInTimeControl.ControlType;
         runInTimeControlInfoMaintain.Type = runInTimeControl.Type;
         runInTimeControlInfoMaintain.Remark = runInTimeControl.Remark;
         runInTimeControlInfoMaintain.Editor = runInTimeControl.Editor;
         runInTimeControlInfoMaintain.Cdt = runInTimeControl.Cdt;
         runInTimeControlInfoMaintain.Udt = runInTimeControl.Udt;
         return runInTimeControlInfoMaintain;
     }
     catch (FisException e)
     {
         logger.Error(e.mErrmsg);
         throw e;
     }
     catch (Exception e)
     {
         logger.Error(e.Message);
         throw;
     }
 }
    protected void btnAdd_ServerClick(Object sender, EventArgs e)
    {
        string type = this.hidType.Value.ToString();
        string code = this.dCode2.Text;
        string hour = this.txtTime.Text;
        int id = 0;
        try
        {
            ModelMaintainInfo model = modelManager.GetModel(code);
            if (CheckIsInModelOrCPQSNO(model, code))
            {
                RunInTimeControlInfoMaintain runintime = new RunInTimeControlInfoMaintain();
                runintime.Code = code;
                if (model != null)
                {
                    runintime.Type = "Model";
                }
                else
                {
                    runintime.Type = "CPQSNO";
                }
                runintime.TestStation = this.CmbStation.InnerDropDownList.SelectedValue;
                int index = this.drpControlType.SelectedIndex;
                if (index == 0)
                {
                    runintime.ControlType = false;
                }
                else
                {
                    runintime.ControlType = true;
                }
                runintime.Hour = hour;
                runintime.Editor = this.HiddenUserName.Value;
                runintime.Cdt = DateTime.Now;
                runintime.Udt = DateTime.Now;
                id = runInTimeControlManager.InsertRunInTimeControl(runintime);
            }
            else
            {
                showErrorMessage(pmtMessage4);
                return;
            }
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;

        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            return;

        }
        ShowRunInTimeControlList();
        this.UpdatePanel1.Update();
        ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "resetTableHeight();AddUpdateComplete('" + id + "');", true);
    }
    protected void btnSave_ServerClick(Object sender, EventArgs e)
    {
        string type = this.hidType.Value;
        string code = this.dCode2.Text;
        string hour = this.txtTime.Text;
        string oldCode = this.oldCode.Value;
        string oldStation = this.hidStation.Value;
        string id = this.hidId.Value.Trim();
        try
        {
            RunInTimeControlInfoMaintain runInTimeControlInfo = new RunInTimeControlInfoMaintain();
            runInTimeControlInfo.Code = code;
            runInTimeControlInfo.TestStation = this.CmbStation.InnerDropDownList.SelectedValue;
            if (!oldCode.Equals(code))
            {
                ModelMaintainInfo model = modelManager.GetModel(code);
                if (CheckIsInModelOrCPQSNO(model, code))
                {
                    if (model != null)
                    {
                        runInTimeControlInfo.Type = "Model";
                    }
                    else
                    {
                        runInTimeControlInfo.Type = "CPQSNO";
                    }
                }
                else
                {
                    showErrorMessage(pmtMessage4);
                    return;
                }
            }
            else
            {
                runInTimeControlInfo.Type = type;
            }

            if (this.drpControlType.SelectedIndex == 0)
            {
                runInTimeControlInfo.ControlType = false;
            }
            else
            {
                runInTimeControlInfo.ControlType = true;
            }
            
            runInTimeControlInfo.Hour = hour;
            runInTimeControlInfo.Editor = this.HiddenUserName.Value;
            runInTimeControlInfo.Udt = DateTime.Now;
            //runInTimeControlManager.UpdateRunInTimeControlByTypeCodeAndTestStation(runInTimeControlInfo, type, oldCode, oldStation);
            runInTimeControlInfo.ID = Int32.Parse(id);
            runInTimeControlManager.UpdateRunInTimeControlById(runInTimeControlInfo);
            //id = GetID(type, code, runInTimeControlInfo.TestStation);

        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            return;
        }
        ShowRunInTimeControlList();
        this.UpdatePanel1.Update();
        ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "Update", "resetTableHeight();AddUpdateComplete('" + id + "');", true);

    }