示例#1
0
 public static Updater GetCsVersion(IDomainDataProvider domainDataProvider)
 {
     object[] objs = domainDataProvider.CustomQuery(typeof(Updater),
                                                    new SQLCondition("select CSVERSION,LOCATION,LOGINUSER,LOGINPASSWORD,ISAVIABLE from TBLCSUPDATER where  ISAVIABLE = 1"));
     if (objs == null || objs.Length < 1)
     {
         return(null);
     }
     return((Updater)objs[0]);
 }
示例#2
0
 public static DBDateTime GetNowDBDateTime(IDomainDataProvider domainDataProvider)
 {
     object[] objs = domainDataProvider.CustomQuery(typeof(DBDateTime),
                                                    new SQLParamCondition("select to_char(sysdate,'yyyymmdd') as dbdate,to_char(sysdate,'hh24miss')  as dbtime from dual where $RCARD = '1'"
                                                                          , new SQLParameter[] { new SQLParameter("RCARD", typeof(string), "1") }));
     if (objs.Length == 0)
     {
         ExceptionManager.Raise(typeof(FormatHelper), "$SystemError_GetDBTimeError");
     }
     return((DBDateTime)objs[0]);
 }
示例#3
0
        //获取服务器的版本
        private Updater getServerVersion()
        {
            (_domainDataProvider as SQLDomainDataProvider).PersistBroker.CloseConnection();

            object[] objs = _domainDataProvider.CustomQuery(typeof(Updater),
                                                            new SQLCondition("select CSVERSION,LOCATION,LOGINUSER,LOGINPASSWORD,ISAVIABLE from TBLCSUPDATER where  ISAVIABLE = 1"));
            if (objs == null)
            {
                return(null);
            }
            return((Updater)objs[0]);
        }
示例#4
0
        private void CheckWorkPlan()
        {
            int              count            = this._ImportDataTable.Rows.Count;
            Hashtable        checkedRow       = new Hashtable();
            ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this._DataProvider);
            MaterialFacade   materialFacade   = new MaterialFacade(this._DataProvider);
            DBDateTime       dbDateTime       = FormatHelper.GetNowDBDateTime(this._DataProvider);

            for (int i = count - 1; i >= 0; i--)
            {
                DataRow    row           = this._ImportDataTable.Rows[i];
                GridRecord gridRow       = this._ImportGridRow[i] as GridRecord;
                string     moCode        = row["MOCODE"].ToString();
                string     bigSSCode     = row["BIGSSCODE"].ToString();
                string     planDate      = row["PLANDATE"].ToString();
                string     planSeq       = row["PLANSEQ"].ToString();
                string     moSeq         = row["MOSEQ"].ToString();
                string     planStartTime = (Convert.ToDateTime(row["PLANSTARTTIME"])).ToString("HH:mm:ss");
                string     planQty       = row["PLANQTY"].ToString();


                if (string.IsNullOrEmpty(moCode))
                {
                    if (!checkedRow.ContainsKey(moCode))
                    {
                        checkedRow.Add(moCode, false);
                    }

                    gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                    gridRow.Items.FindItemByKey("ImportResult").Text             = _LanguageComponent1.GetString("$CS_MO_NotExit");
                    gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                    this._ImportDataTable.Rows.Remove(row);
                    this._ImportGridRow.Remove(gridRow);
                    continue;
                }

                if (string.IsNullOrEmpty(bigSSCode))
                {
                    if (!checkedRow.ContainsKey(bigSSCode))
                    {
                        checkedRow.Add(bigSSCode, false);
                    }

                    gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                    gridRow.Items.FindItemByKey("ImportResult").Text             = _LanguageComponent1.GetString("$BIGSSCODE_IS_NOT_EXIT");
                    gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                    this._ImportDataTable.Rows.Remove(row);
                    this._ImportGridRow.Remove(gridRow);

                    continue;
                }

                if (string.IsNullOrEmpty(planDate))
                {
                    if (!checkedRow.ContainsKey(planDate))
                    {
                        checkedRow.Add(planDate, false);
                    }

                    gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                    gridRow.Items.FindItemByKey("ImportResult").Text             = "计划日期不能为空";
                    gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                    this._ImportDataTable.Rows.Remove(row);
                    this._ImportGridRow.Remove(gridRow);

                    continue;
                }

                try
                {
                    DateTime planDateTime = Convert.ToDateTime(FormatHelper.ToDateString(int.Parse(planDate), "-"));
                }
                catch
                {
                    if (!checkedRow.ContainsKey(planDate))
                    {
                        checkedRow.Add(planDate, false);
                    }

                    gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                    gridRow.Items.FindItemByKey("ImportResult").Text             = "计划日期错误";
                    gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                    this._ImportDataTable.Rows.Remove(row);
                    this._ImportGridRow.Remove(gridRow);

                    continue;
                }

                if (string.IsNullOrEmpty(planSeq))
                {
                    if (!checkedRow.ContainsKey(planSeq))
                    {
                        checkedRow.Add(planSeq, false);
                    }

                    gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                    gridRow.Items.FindItemByKey("ImportResult").Text             = "生产顺序不能为空";
                    gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                    this._ImportDataTable.Rows.Remove(row);
                    this._ImportGridRow.Remove(gridRow);

                    continue;
                }

                if (string.IsNullOrEmpty(moSeq))
                {
                    if (!checkedRow.ContainsKey(moSeq))
                    {
                        checkedRow.Add(moSeq, false);
                    }

                    gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                    gridRow.Items.FindItemByKey("ImportResult").Text             = "工单项次不能为空";
                    gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                    this._ImportDataTable.Rows.Remove(row);
                    this._ImportGridRow.Remove(gridRow);

                    continue;
                }

                if (string.IsNullOrEmpty(planStartTime))
                {
                    if (!checkedRow.ContainsKey(planStartTime))
                    {
                        checkedRow.Add(planStartTime, false);
                    }

                    gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                    gridRow.Items.FindItemByKey("ImportResult").Text             = "计划开始时间不能为空";
                    gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                    this._ImportDataTable.Rows.Remove(row);
                    this._ImportGridRow.Remove(gridRow);

                    continue;
                }


                try
                {
                    int numplanSeq = int.Parse(planSeq);
                    if (numplanSeq < 0)
                    {
                        if (!checkedRow.ContainsKey(planSeq))
                        {
                            checkedRow.Add(planSeq, false);
                        }

                        gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                        gridRow.Items.FindItemByKey("ImportResult").Text             = "生产顺序不应小于0";
                        gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                        this._ImportDataTable.Rows.Remove(row);
                        this._ImportGridRow.Remove(gridRow);

                        continue;
                    }
                }
                catch
                {
                    if (!checkedRow.ContainsKey(planSeq))
                    {
                        checkedRow.Add(planSeq, false);
                    }

                    gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                    gridRow.Items.FindItemByKey("ImportResult").Text             = "生产顺序格式错误";
                    gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                    this._ImportDataTable.Rows.Remove(row);
                    this._ImportGridRow.Remove(gridRow);

                    continue;
                }

                try
                {
                    int nummoSeq = int.Parse(moSeq);
                    if (nummoSeq < 0)
                    {
                        if (!checkedRow.ContainsKey(moSeq))
                        {
                            checkedRow.Add(moSeq, false);
                        }

                        gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                        gridRow.Items.FindItemByKey("ImportResult").Text             = "工单项次不应小于0";
                        gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                        this._ImportDataTable.Rows.Remove(row);
                        this._ImportGridRow.Remove(gridRow);

                        continue;
                    }
                }
                catch
                {
                    if (!checkedRow.ContainsKey(moSeq))
                    {
                        checkedRow.Add(moSeq, false);
                    }

                    gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                    gridRow.Items.FindItemByKey("ImportResult").Text             = "工单项次格式错误";
                    gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                    this._ImportDataTable.Rows.Remove(row);
                    this._ImportGridRow.Remove(gridRow);

                    continue;
                }

                try
                {
                    decimal numplanQty = decimal.Parse(planQty);
                    if (numplanQty < 0)
                    {
                        if (!checkedRow.ContainsKey(planQty))
                        {
                            checkedRow.Add(planQty, false);
                        }

                        gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                        gridRow.Items.FindItemByKey("ImportResult").Text             = "计划数量不应小于0";
                        gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                        this._ImportDataTable.Rows.Remove(row);
                        this._ImportGridRow.Remove(gridRow);

                        continue;
                    }
                }
                catch
                {
                    if (!checkedRow.ContainsKey(planQty))
                    {
                        checkedRow.Add(planQty, false);
                    }

                    gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                    gridRow.Items.FindItemByKey("ImportResult").Text             = "计划数量格式错误";
                    gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                    this._ImportDataTable.Rows.Remove(row);
                    this._ImportGridRow.Remove(gridRow);
                    continue;
                }

                //planDate
                try
                {
                    int numplanDate = FormatHelper.TODateInt(planDate.Insert(4, "-").Insert(7, "-"));
                }
                catch
                {
                    if (!checkedRow.ContainsKey(planDate))
                    {
                        checkedRow.Add(planDate, false);
                    }

                    gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                    gridRow.Items.FindItemByKey("ImportResult").Text             = "计划日期格式错误";
                    gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                    this._ImportDataTable.Rows.Remove(row);
                    this._ImportGridRow.Remove(gridRow);
                    continue;
                }

                //planStartTime
                try
                {
                    int numplanStartTime = FormatHelper.TOTimeInt(planStartTime.ToString());
                }
                catch
                {
                    if (!checkedRow.ContainsKey(planStartTime))
                    {
                        checkedRow.Add(planStartTime, false);
                    }

                    gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                    gridRow.Items.FindItemByKey("ImportResult").Text             = "计划开始时间格式错误";
                    gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                    this._ImportDataTable.Rows.Remove(row);
                    this._ImportGridRow.Remove(gridRow);
                    continue;
                }

                int shiftDay = shiftModelFacade.GetShiftDayByBigSSCode(bigSSCode, dbDateTime.DateTime);

                object[] objs = _DataProvider.CustomQuery(typeof(BenQGuru.eMES.Domain.MOModel.Model),
                                                          new SQLParamCondition(@"select mocode from tblmo where 1=1 " + GlobalVariables.CurrentOrganizations.GetSQLCondition() + @" and mocode=$MOCODE", new SQLParameter[] { new SQLParameter("$MOCODE", typeof(string), moCode.ToUpper()) }));

                if (objs == null)
                {
                    if (!checkedRow.ContainsKey(moCode))
                    {
                        checkedRow.Add(moCode, false);
                    }

                    gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                    gridRow.Items.FindItemByKey("ImportResult").Text             = _LanguageComponent1.GetString("$CS_MO_NotExit");
                    gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                    this._ImportDataTable.Rows.Remove(row);
                    this._ImportGridRow.Remove(gridRow);

                    continue;
                }

                object[] objss = _DataProvider.CustomQuery(typeof(BenQGuru.eMES.Domain.BaseSetting.StepSequence),
                                                           new SQLParamCondition(@"select distinct bigsscode from tblss where 1=1 " + GlobalVariables.CurrentOrganizations.GetSQLCondition() + @" and bigsscode=$BIGSSCODE",
                                                                                 new SQLParameter[] { new SQLParameter("$BIGSSCODE", typeof(string), bigSSCode.ToUpper()) }));

                if (objss == null)
                {
                    if (!checkedRow.ContainsKey(bigSSCode))
                    {
                        checkedRow.Add(bigSSCode, false);
                    }

                    gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                    gridRow.Items.FindItemByKey("ImportResult").Text             = _LanguageComponent1.GetString("$BIGSSCODE_IS_NOT_EXIT");
                    gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                    this._ImportDataTable.Rows.Remove(row);
                    this._ImportGridRow.Remove(gridRow);

                    continue;
                }

                if (_MaterialFacade == null)
                {
                    _MaterialFacade = new MaterialFacade(_DataProvider);
                }

                object objWorkPlanFromDB = _MaterialFacade.GetWorkPlan(bigSSCode, int.Parse(planDate), moCode, decimal.Parse(moSeq));

                if (objWorkPlanFromDB != null)
                {
                    //修改的投入数量必须大于等于实际数量
                    if (decimal.Parse(planQty) < ((WorkPlan)objWorkPlanFromDB).ActQty)
                    {
                        if (!checkedRow.ContainsKey(planQty))
                        {
                            checkedRow.Add(planQty, false);
                        }

                        gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                        gridRow.Items.FindItemByKey("ImportResult").Text             = _LanguageComponent1.GetString("$planqty_isnotequ_actqty");
                        gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                        this._ImportDataTable.Rows.Remove(row);
                        this._ImportGridRow.Remove(gridRow);

                        continue;
                    }

                    if ((((WorkPlan)objWorkPlanFromDB).ActionStatus == WorkPlanActionStatus.WorkPlanActionStatus_Close))
                    //执行状态为待投产或生产中才update
                    {
                        if (!checkedRow.ContainsKey(planDate))
                        {
                            checkedRow.Add(planDate, false);
                        }

                        gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                        gridRow.Items.FindItemByKey("ImportResult").Text             = _LanguageComponent1.GetString("$status_error");
                        gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                        this._ImportDataTable.Rows.Remove(row);
                        this._ImportGridRow.Remove(gridRow);

                        continue;
                    }
                }

                if (int.Parse(planDate) < shiftDay)
                {
                    if (!checkedRow.ContainsKey(planDate))
                    {
                        checkedRow.Add(planDate, false);
                    }

                    gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                    gridRow.Items.FindItemByKey("ImportResult").Text             = "计划日期不能早于当前日期";
                    gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                    this._ImportDataTable.Rows.Remove(row);
                    this._ImportGridRow.Remove(gridRow);

                    continue;
                }

                WorkPlan GetworkPlanByKeys    = (WorkPlan)materialFacade.GetWorkPlan(bigSSCode, int.Parse(planDate), moCode, decimal.Parse(moSeq));
                WorkPlan GetworkPlanByUniques = (WorkPlan)materialFacade.GetWorkPlan(bigSSCode, int.Parse(planDate), int.Parse(planSeq));

                if (GetworkPlanByKeys == null && GetworkPlanByUniques != null)
                {
                    if (!checkedRow.ContainsKey(moCode))
                    {
                        checkedRow.Add(moCode, false);
                    }

                    gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                    gridRow.Items.FindItemByKey("ImportResult").Text             = "请检查日期+线别+投产顺序的唯一性";
                    gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                    this._ImportDataTable.Rows.Remove(row);
                    this._ImportGridRow.Remove(gridRow);

                    continue;
                }

                if (GetworkPlanByKeys != null && GetworkPlanByUniques != null)
                {
                    if (GetworkPlanByKeys.BigSSCode != GetworkPlanByUniques.BigSSCode ||
                        GetworkPlanByKeys.PlanDate != GetworkPlanByUniques.PlanDate ||
                        GetworkPlanByKeys.MoCode != GetworkPlanByUniques.MoCode ||
                        GetworkPlanByKeys.MoSeq != GetworkPlanByUniques.MoSeq)
                    {
                        if (!checkedRow.ContainsKey(moCode))
                        {
                            checkedRow.Add(moCode, false);
                        }

                        gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = false;
                        gridRow.Items.FindItemByKey("ImportResult").Text             = "请检查日期+线别+投产顺序的唯一性";
                        gridRow.Items.FindItemByKey("ImportResult").CssClass         = "MsgYellow";
                        this._ImportDataTable.Rows.Remove(row);
                        this._ImportGridRow.Remove(gridRow);

                        continue;
                    }
                }

                if (!checkedRow.ContainsKey(moCode))
                {
                    checkedRow.Add(moCode, false);
                }

                gridRow.Items.FindItemByKey(gridHelper.CheckColumnKey).Value = true;
            }
        }
示例#5
0
 public object[] RetriveAll()
 {
     return(_domainDataProvider.CustomQuery(typeof(LanguageWord), new SQLCondition("select * from Control")));
 }
示例#6
0
        public object[] GetReportData()
        {
            string sql = GetReportSQL();

            return(_DomainDataProvider.CustomQuery(typeof(NewReportDomainObject), new SQLCondition(sql)));
        }