protected override void SetEditObject(object obj)
        {
            if (obj == null)
            {
                this.dateDateFrom.Date_String = FormatHelper.ToDateString(FormatHelper.TODateInt(DateTime.Now));
                this.txtBigSSCodeGroup.Text   = "";
                this.txtMactureSeq.Text       = "";
                this.txtMOEdit.Text           = "";
                this.txtMOSeqEdit.Text        = "";
                this.txtPlanInQTYEdit.Text    = "";
                this.timeFrom.Text            = "";
                this.txtBigSSCodeGroup.Text   = "";
                this.txtMat.Text    = "";
                this.txtAct.Text    = "";
                this.txtActQty.Text = "";

                return;
            }

            //	执行状态为“待投产”、“生产中”状态的计划信息可以修改除主键之外的其他信息【包括导入过程中的修改】,如果计划日期早于当前日期,则不允许修改计划信息
            ShiftModelFacade shiftModelFacade = new ShiftModelFacade(base.DataProvider);
            DBDateTime       dbDateTime       = FormatHelper.GetNowDBDateTime(base.DataProvider);

            int shiftDay = shiftModelFacade.GetShiftDayByBigSSCode(((WorkPlan)obj).BigSSCode, dbDateTime.DateTime);

            if (((WorkPlan)obj).PlanDate < shiftDay)
            {
                WebInfoPublish.PublishInfo(this, "$if_date_cannotmodify", languageComponent1);

                return;
            }

            if (((WorkPlan)obj).ActionStatus == WorkPlanActionStatus.WorkPlanActionStatus_Close)
            {
                WebInfoPublish.PublishInfo(this, "$status_error", languageComponent1);
                return;
            }



            this.dateDateFrom.Date_String = FormatHelper.ToDateString(((WorkPlan)obj).PlanDate);
            this.txtBigSSCodeGroup.Text   = ((WorkPlan)obj).BigSSCode;
            this.txtMactureSeq.Text       = ((WorkPlan)obj).PlanSeq.ToString();
            this.txtMOEdit.Text           = ((WorkPlan)obj).MoCode;
            this.txtMOSeqEdit.Text        = ((WorkPlan)obj).MoSeq.ToString();
            this.txtPlanInQTYEdit.Text    = ((WorkPlan)obj).PlanQty.ToString();
            this.timeFrom.Text            = FormatHelper.ToTimeString(((WorkPlan)obj).PlanStartTime);
            this.txtAct.Text    = ((WorkPlan)obj).ActionStatus.ToString();
            this.txtMat.Text    = ((WorkPlan)obj).MaterialStatus.ToString();
            this.txtActQty.Text = ((WorkPlan)obj).ActQty.ToString();
        }
        protected override void DeleteDomainObjects(ArrayList domainObjects)
        {
            if (_Facade == null)
            {
                _Facade = new MaterialFacade(base.DataProvider);
            }

            ShiftModelFacade shiftModelFacade = new ShiftModelFacade(base.DataProvider);
            DBDateTime       dbDateTime       = FormatHelper.GetNowDBDateTime(base.DataProvider);

            List <WorkPlan> mKeyPartList = new List <WorkPlan>();

            WorkPlan[] deliveryNotes = (WorkPlan[])domainObjects.ToArray(typeof(WorkPlan));

            if (deliveryNotes != null)
            {
                this.DataProvider.BeginTransaction();

                try
                {
                    foreach (WorkPlan deliveryNote in deliveryNotes)
                    {
                        int shiftDay = shiftModelFacade.GetShiftDayByBigSSCode(deliveryNote.BigSSCode, dbDateTime.DateTime);
                        if (deliveryNote.PlanDate < shiftDay)
                        {
                            WebInfoPublish.Publish(this, "$if_date_cannotmodify", languageComponent1);

                            return;
                        }

                        if (deliveryNote.ActionStatus == WorkPlanActionStatus.WorkPlanActionStatus_Open || deliveryNote.ActionStatus == WorkPlanActionStatus.WorkPlanActionStatus_Close)
                        {
                            WebInfoPublish.Publish(this, "$STATUS_ERROR_DELETE", languageComponent1);
                            return;
                        }

                        this._Facade.DeleteWorkPlan(deliveryNote);
                    }

                    this.DataProvider.CommitTransaction();
                }
                catch (Exception ex)
                {
                    this.DataProvider.RollbackTransaction();

                    ExceptionManager.Raise(deliveryNotes[0].GetType(), "$Error_Delete_Domain_Object", ex);
                }
            }
        }
示例#3
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;
            }
        }
示例#4
0
        public void ImportWorkPlan(bool isRollBack)
        {
            ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this._DataProvider);
            DBDateTime       now = FormatHelper.GetNowDBDateTime(this._DataProvider);

            object[] objs  = ConvertArrayListToObjectArray(_ImportDataTable);
            object[] objDt = ConvertArrayListToObjectArray(_ImportDataTable);

            try
            {
                _DataProvider.BeginTransaction();

                if (objs != null && objDt != null)
                {
                    for (int i = 0; i < objs.Length; i++)
                    {
                        try
                        {
                            GridRecord row = _ImportGridRow[i] as GridRecord;
                            WorkPlan   workPlanFromExcel = objs[i] as WorkPlan;
                            int        shiftDay          = shiftModelFacade.GetShiftDayByBigSSCode(workPlanFromExcel.BigSSCode, now.DateTime);
                            if (_MaterialFacade == null)
                            {
                                _MaterialFacade = new MaterialFacade(_DataProvider);
                            }

                            WorkPlan objWorkPlanFromDB = (WorkPlan)_MaterialFacade.GetWorkPlan(workPlanFromExcel.BigSSCode, workPlanFromExcel.PlanDate,
                                                                                               workPlanFromExcel.MoCode, workPlanFromExcel.MoSeq);

                            if (objWorkPlanFromDB != null)
                            {
                                ((WorkPlan)objs[i]).MaterialQty      = objWorkPlanFromDB.MaterialQty;
                                ((WorkPlan)objs[i]).ActQty           = objWorkPlanFromDB.ActQty;
                                ((WorkPlan)objs[i]).MaterialStatus   = objWorkPlanFromDB.MaterialStatus;
                                ((WorkPlan)objs[i]).ActionStatus     = objWorkPlanFromDB.ActionStatus;
                                ((WorkPlan)objs[i]).ItemCode         = objWorkPlanFromDB.ItemCode;
                                ((WorkPlan)objs[i]).PromiseTime      = objWorkPlanFromDB.PromiseTime;
                                ((WorkPlan)objs[i]).LastReqTime      = objWorkPlanFromDB.LastReqTime;
                                ((WorkPlan)objs[i]).LastReceiveTime  = objWorkPlanFromDB.LastReceiveTime;
                                ((WorkPlan)objs[i]).PlanEndTime      = objWorkPlanFromDB.PlanEndTime;
                                ((WorkPlan)objDt[i]).MaterialQty     = objWorkPlanFromDB.MaterialQty;
                                ((WorkPlan)objDt[i]).ActQty          = objWorkPlanFromDB.ActQty;
                                ((WorkPlan)objDt[i]).MaterialStatus  = objWorkPlanFromDB.MaterialStatus;
                                ((WorkPlan)objDt[i]).ActionStatus    = objWorkPlanFromDB.ActionStatus;
                                ((WorkPlan)objDt[i]).ItemCode        = objWorkPlanFromDB.ItemCode;
                                ((WorkPlan)objDt[i]).PromiseTime     = objWorkPlanFromDB.PromiseTime;
                                ((WorkPlan)objDt[i]).LastReqTime     = objWorkPlanFromDB.LastReqTime;
                                ((WorkPlan)objDt[i]).LastReceiveTime = objWorkPlanFromDB.LastReceiveTime;
                                ((WorkPlan)objDt[i]).PlanEndTime     = objWorkPlanFromDB.PlanEndTime;

                                _DataProvider.Update(objs[i]);
                                _DataProvider.Update(objDt[i]);
                                row.Items.FindItemByKey("ImportResult").Text     = _LanguageComponent1.GetString("$CycleImport_Success");
                                row.Items.FindItemByKey("ImportResult").CssClass = "LinkColorBlue";
                            }
                            else
                            {
                                if ((workPlanFromExcel.PlanDate) >= shiftDay)
                                {
                                    _DataProvider.Insert(objDt[i]);
                                    row.Items.FindItemByKey("ImportResult").Text     = _LanguageComponent1.GetString("$CycleImport_Success");
                                    row.Items.FindItemByKey("ImportResult").CssClass = "LinkColorBlue";
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            GridRecord row = _ImportGridRow[i] as GridRecord;
                            row.Items.FindItemByKey("ImportResult").Text     = _LanguageComponent1.GetString("$CycleImport_Error");
                            row.Items.FindItemByKey("ImportResult").CssClass = "ForeColorRed";
                            this.ErrorArray.Add(ex);
                        }
                    }
                }

                _DataProvider.CommitTransaction();
            }
            catch (Exception ex)
            {
                _DataProvider.RollbackTransaction();
                this.ErrorArray.Add(ex);
            }
        }
        protected override bool ValidateInput()
        {
            PageCheckManager manager = new PageCheckManager();

            manager.Add(new DateCheck(this.lblDate, this.dateDateFrom.Text, true));
            manager.Add(new LengthCheck(lblBigSSCodeGroup, txtBigSSCodeGroup, 40, true));
            manager.Add(new LengthCheck(lblMOEdit, txtMOEdit, 40, true));
            manager.Add(new LengthCheck(lblMactureSeq, txtMactureSeq, 10, true));
            manager.Add(new LengthCheck(lblMOSeqEdit, txtMOSeqEdit, 10, true));
            manager.Add(new DecimalCheck(lblPlanInQTYEdit, txtPlanInQTYEdit, 0, 9999999999, true));


            manager.Add(new TimeRangeCheck(this.lblPlanInStartDateEdit, this.timeFrom.Text, this.timeFrom.Text, true));

            if (this.txtMOSeqEdit.Text.Trim().Length > 0)
            {
                manager.Add(new NumberCheck(lblMOSeqEdit, txtMOSeqEdit, 0, 9999999999, true));
            }

            if (this.txtMactureSeq.Text.Trim().Length > 0)
            {
                manager.Add(new NumberCheck(lblMactureSeq, txtMactureSeq, 0, 9999999999, true));
            }

            if (!manager.Check())
            {
                WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1);
                return(false);
            }

            if (_MoFacade == null)
            {
                _MoFacade = new MOFacade(base.DataProvider);
            }

            object objMo = _MoFacade.GetMO(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMOEdit.Text)));

            if (objMo == null)
            {
                WebInfoPublish.Publish(this, "$CS_MO_Not_Exist", languageComponent1);
                return(false);
            }

            if (_Facade == null)
            {
                _Facade = new MaterialFacade(base.DataProvider);
            }

            ShiftModelFacade shiftModelFacade = new ShiftModelFacade(base.DataProvider);
            DBDateTime       dbDateTime       = FormatHelper.GetNowDBDateTime(base.DataProvider);

            WorkPlan GetWorkPlanByKeys = (WorkPlan)_Facade.GetWorkPlan(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(txtBigSSCodeGroup.Text)),
                                                                       FormatHelper.TODateInt(FormatHelper.CleanString(this.dateDateFrom.Date_String)),
                                                                       FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMOEdit.Text)),
                                                                       int.Parse(FormatHelper.CleanString(this.txtMOSeqEdit.Text)));

            WorkPlan GetWorkPlanByUnipues = (WorkPlan)_Facade.GetWorkPlan(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(txtBigSSCodeGroup.Text)),
                                                                          FormatHelper.TODateInt(FormatHelper.CleanString(this.dateDateFrom.Date_String)),
                                                                          int.Parse(FormatHelper.CleanString(this.txtMactureSeq.Text)));

            if (GetWorkPlanByKeys == null && GetWorkPlanByUnipues != null)
            {
                WebInfoPublish.PublishInfo(this, "$date__isunique", languageComponent1);
                return(false);
            }

            if (GetWorkPlanByKeys != null && GetWorkPlanByUnipues != null)
            {
                if (GetWorkPlanByKeys.BigSSCode != GetWorkPlanByUnipues.BigSSCode ||
                    GetWorkPlanByKeys.PlanDate != GetWorkPlanByUnipues.PlanDate ||
                    GetWorkPlanByKeys.MoCode != GetWorkPlanByUnipues.MoCode ||
                    GetWorkPlanByKeys.MoSeq != GetWorkPlanByUnipues.MoSeq)
                {
                    WebInfoPublish.PublishInfo(this, "$date__isunique", languageComponent1);
                    return(false);
                }
            }

            int shiftDay = shiftModelFacade.GetShiftDayByBigSSCode(
                FormatHelper.PKCapitalFormat(FormatHelper.CleanString(txtBigSSCodeGroup.Text)),
                dbDateTime.DateTime);

            if (FormatHelper.TODateInt(FormatHelper.CleanString(this.dateDateFrom.Date_String)) < shiftDay)
            {
                WebInfoPublish.PublishInfo(this, "$if_date_cannotmodify", languageComponent1);
                return(false);
            }

            return(true);
        }