Ejemplo n.º 1
0
        [AjaxPro.AjaxMethod]  //部分ok
        public static DashboardShowingInfo GetShowInfoDashboardByWinId(String id)
        {
            String WindowId = GeneralUtil.Null2String(id);

            String StageDataTableName;
            String LineDataTableName;
            String StationDataTableName;

            GetDataDatabaseTableName(WindowId, out StageDataTableName, out LineDataTableName, out StationDataTableName);

            DashboardShowingInfo result = new DashboardShowingInfo();

            DataTable DashboardMainInfo = GetShowInfoDashboardMainByWinId(WindowId, StageDataTableName);

            //!!!没有找到时的处理
            if (DashboardMainInfo.Rows.Count == 0)
            {
                ExceptionManager.Throw("The specified item has been removed.");
            }

            //还需要进一步转换添加等,注意每一位都要根据新的内容赋值
            result.CurrentWindowSettingUdt = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["Udt"]);
            DateTime NowTime = DateTime.Now;
            result.NowTimeSecond = NowTime.ToString("fff"); //DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            result.NowTimeShowString = NowTime.ToString("yyyy-MM-dd HH:mm");
            result.AlertMessage = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["AlertMessage"]);
            result.DisplayName = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["DisplayName"]);
            result.WindowName = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["WindowName"]);
            //数字字符串
            result.RefreshTime = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["RefreshTime"]);
            if (result.RefreshTime == "")
            {
                result.RefreshTime = "0";
            }

            result.StageInfo.IsStageDisplay = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["IsStageDsp"]);
            if (result.StageInfo.IsStageDisplay == "")
            {
                result.StageInfo.IsStageDisplay = "True";
            }

            result.StageInfo.StageId = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["StageId"]);

            String StageType = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["StageType"]);

            if (StageType==Constants.SA_STAGE.ToString())
            {
                //是要以显示SA的风格显示Stage部分
                result.StageInfo.IsSaStage = "True";
                result.StageInfo.Input  = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["SAInput"]);
                result.StageInfo.Output = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["SAOutput"]);
            }
            else
            {
                result.StageInfo.IsSaStage = "False";
                result.StageInfo.Input  = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["SMTInput"]);
                result.StageInfo.Output = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["SMTOutput"]);

            }
            result.StageInfo.Goal = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["Goal"]);


            String StartWorkTime = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["StartWorkTime"]);
            String StopWorkTime = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["StopWorkTime"]);

            String DisplayFields = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["DisplayFields"]);
            StageDisplayFieldInfo displayFieldInfos = new StageDisplayFieldInfo();
            displayFieldInfos = DashboardManager.StageDisplayFieldsString2Struct(DisplayFields);

            result.StageInfo.IsInputDisplay = displayFieldInfos.IsInputDisplay;
            result.StageInfo.IsOutputDisplay = displayFieldInfos.IsOutputDisplay;
            result.StageInfo.IsGoalDisplay = displayFieldInfos.IsGoalDisplay;
            result.StageInfo.IsRateDisplay = displayFieldInfos.IsRateDisplay;

            int rate = 100;

            //未包含百分号,是如56等的数字字符串
            //!!!没有四舍五入
            //如果Goal=0, 当前的rate算是0还是1,询问后定为100%
            try
            {
                double goalNum = double.Parse(result.StageInfo.Goal);
                if (goalNum != 0)
                {
                    rate = (int)(double.Parse(result.StageInfo.Output) * 100 / goalNum);
                }
            }
            catch
            {
                //不需要处理, Rate为100
            }

            
            result.StageInfo.Rate = rate.ToString();
            int targetRate = GetTargetRate(StartWorkTime, StopWorkTime, NowTime);
            result.StageInfo.TargetRate = targetRate.ToString();

            if (rate < targetRate)
            {
                result.StageInfo.IsRateOk = "False";
            }
            else
            {
                result.StageInfo.IsRateOk = "True";
            }

            /////////
            List<LineShowingInfo> LineResult = GetShowInfoLineListByWinId(WindowId, LineDataTableName, StationDataTableName, NowTime, result.StageInfo.IsSaStage);
            result.StageInfo.LineShowingInfos = LineResult;

            //////////
            return result;

        }
Ejemplo n.º 2
0
        //Display ok
        private static String Struct2StageDisplayFieldsString(StageDisplayFieldInfo DisplayFieldsInfo)
        {
            String result = "";

            if (DisplayFieldsInfo.IsGoalDisplay.ToLower() == "true")
            {
                result += "Goal=True,";
            }
            else
            {
                result += "Goal=False,";
            }

            if (DisplayFieldsInfo.IsInputDisplay.ToLower() == "true")
            {
                result += "Input=True,";
            }
            else
            {
                result += "Input=False,";
            }

            if (DisplayFieldsInfo.IsOutputDisplay.ToLower() == "true")
            {
                result += "Output=True,";
            }
            else
            {
                result += "Output=False,";
            }

            if (DisplayFieldsInfo.IsRateDisplay.ToLower() == "true")
            {
                result += "Rate=True,";
            }
            else
            {
                result += "Rate=False,";
            }

            return result;

        }
Ejemplo n.º 3
0
        public static DashboardWindowInfo GetDashboardWindowSetting(String WindowId,String StageType)
        {
            WindowId = GeneralUtil.Null2String(WindowId);

            DashboardWindowInfo result = new DashboardWindowInfo();

            if (WindowId == "")
            {
                return result;
            }
            else
            {
                DataTable DashboardMainInfo = GetEditDashboardMainByWinId(WindowId);
                if (DashboardMainInfo.Rows.Count == 0)
                {
                    ExceptionManager.Throw("The specified item has been removed.");
                }

                //还需要进一步转换添加等,注意每一位都要根据新的内容赋值
                result.WindowId = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["ID"]);
                result.WindowName = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["WindowName"]);

                result.DisplayName = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["DisplayName"]);
                result.AlertMessage = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["AlertMessage"]);
                result.RefreshTime = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["RefreshTime"]);

                TimeInfo timeInfos = new TimeInfo();
                if (result.RefreshTime != "")
                {
                    int freshTime = Int32.Parse(result.RefreshTime);
                    timeInfos = TimeInt2Struct(freshTime);

                }
                result.Hour = timeInfos.Hour;
                result.Second = timeInfos.Second;
                result.Minute = timeInfos.Minute;

                result.DataSourceType = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["DataSourceType"]);
                result.StageTargetId = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["StageTargetId"]);
                result.StageId = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["StageId"]);
                result.StageName = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["StageName"]);
                result.IsStageDisplay = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["IsStageDsp"]);
                result.StartWorkTime = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["StartWorkTime"]);

                TimeInfo startWorkInfos = new TimeInfo();
                if (result.StartWorkTime != "")
                {
                    startWorkInfos = TimeString2Struct(result.StartWorkTime);

                }

                result.StartWorkTimeHour = startWorkInfos.Hour;
                result.StartWorkTimeMinute = startWorkInfos.Minute;

                result.StopWorkTime = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["StopWorkTime"]);

                TimeInfo stopWorkInfos = new TimeInfo();
                if (result.StopWorkTime != "")
                {
                    stopWorkInfos = TimeString2Struct(result.StopWorkTime);

                }

                result.StopWorkTimeHour = stopWorkInfos.Hour;
                result.StopWorkTimeMinute = stopWorkInfos.Minute;

                result.DisplayFields = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["DisplayFields"]);

                StageDisplayFieldInfo displayFieldInfos = new StageDisplayFieldInfo();

                if (result.DisplayFields != "")
                {
                    displayFieldInfos = StageDisplayFieldsString2Struct(result.DisplayFields);

                }

                result.IsGoalDisplay = displayFieldInfos.IsGoalDisplay;
                result.IsInputDisplay = displayFieldInfos.IsInputDisplay;
                result.IsOutputDisplay = displayFieldInfos.IsOutputDisplay;
                result.IsRateDisplay = displayFieldInfos.IsRateDisplay;

                result.Cdt = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["Cdt"]);
                result.Udt = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["Udt"]);
                result.Editor = GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["Editor"]);

                DataTable LineResult = GetEditLineListByWinId(WindowId);


                for (int i = 0; i < LineResult.Rows.Count; i++)
                {
                    WindowLineInfo lineInfo = new WindowLineInfo();
                    lineInfo.LineTargetId = GeneralUtil.Null2String(LineResult.Rows[i]["LineTargetId"]);
                    lineInfo.LineID = GeneralUtil.Null2String(LineResult.Rows[i]["LineId"]);
                    lineInfo.Stage = GeneralUtil.Null2String(LineResult.Rows[i]["SatgeName"]);
                    lineInfo.Line = GeneralUtil.Null2String(LineResult.Rows[i]["LineName"]);
                    //lineInfo.FPYTarget = GeneralUtil.Null2String(LineResult.Rows[i]["FPYTarget"]);
                    //lineInfo.FPYAlert = GeneralUtil.Null2String(LineResult.Rows[i]["FPYAlert"]);
                    //lineInfo.OutputTarget = GeneralUtil.Null2String(LineResult.Rows[i]["OutputTarget"]);
                    lineInfo.StartWork = GeneralUtil.Null2String(LineResult.Rows[i]["StartWorkTime"]);
                    lineInfo.Shift = GeneralUtil.Null2String(LineResult.Rows[i]["Shift"]);

                    String FmlDspField = GeneralUtil.Null2String(LineResult.Rows[i]["FmlDspField"]);

                    if (StageType == Constants.SA_STAGE.ToString())
                    {
                        SaStationDisplayFieldInfo info = new SaStationDisplayFieldInfo();
                        info = SaStationDisplayFieldsString2Struct(FmlDspField);
                        lineInfo.IsDefectDsp = info.IsDefectDsp;
                        lineInfo.IsInputDsp = info.IsInputDsp;
                        lineInfo.IsYieldRateDsp = info.IsYieldRateDsp;
                        lineInfo.IsICTDefectDsp = info.IsICTDefectDsp;
                        lineInfo.IsICTInputDsp = info.IsICTInputDsp;
                        lineInfo.IsICTYieldRateDsp = info.IsICTYieldRateDsp;
                    }
                    else
                    {
                        SmtStationDisplayFieldInfo info = new SmtStationDisplayFieldInfo();
                        info = SmtStationDisplayFieldsString2Struct(FmlDspField);
                        lineInfo.IsDefectDsp = info.IsDefectDsp;
                        lineInfo.IsInputDsp = info.IsInputDsp;
                        lineInfo.IsYieldRateDsp = info.IsYieldRateDsp;
                        lineInfo.IsAOIDefectDsp = info.IsAOIDefectDsp;
                        lineInfo.IsAOIOutputDsp = info.IsAOIOutputDsp;
                    }


                    TimeInfo lineStartWorkInfos = new TimeInfo();
                    if (lineInfo.StartWork != "")
                    {
                        lineStartWorkInfos = TimeString2Struct(lineInfo.StartWork);

                    }
                    lineInfo.StartWorkHour = lineStartWorkInfos.Hour;
                    lineInfo.StartWorkMinute = lineStartWorkInfos.Minute;

                    lineInfo.StopWork = GeneralUtil.Null2String(LineResult.Rows[i]["StopWorkTime"]);

                    TimeInfo lineStopWorkInfos = new TimeInfo();
                    if (lineInfo.StopWork != "")
                    {
                        lineStopWorkInfos = TimeString2Struct(lineInfo.StopWork);

                    }
                    lineInfo.StopWorkHour = lineStopWorkInfos.Hour;
                    lineInfo.StopWorkMinute = lineStopWorkInfos.Minute;

                    //lineInfo.StationDisplay = GeneralUtil.Null2String(LineResult.Rows[i]["IsStationDsp"]);
                    lineInfo.Order = GeneralUtil.Null2String(LineResult.Rows[i]["SortOrder"]);
                    List<WindowLineFamilyInfo> StationResult = GetEditStationListByLineAndWinId(WindowId, lineInfo.LineID);
                    lineInfo.WindowLineFamilyInfos = StationResult;
                    result.WindowLineInfos.Add(lineInfo);
                    
                }
                return result;
            }
        }
Ejemplo n.º 4
0
        //这部分字段顺序固定 ok
        //GoalDisplay
        //InputDisplay
        //OutputDisplay
        //RateDisplay
        public static StageDisplayFieldInfo StageDisplayFieldsString2Struct(String DisplayFieldsString)
        {
            StageDisplayFieldInfo result = new StageDisplayFieldInfo();
            try
            {
                //如 "Quantilt=true". 逗号分隔
                String[] separator = { "," };
                String[] values = DisplayFieldsString.Split(separator, StringSplitOptions.None);
                String[] separatorNext = { "=" };


                String[] GoalDisplayInfos = values[0].Split(separatorNext, StringSplitOptions.None);
                if (GoalDisplayInfos[1].ToLower() == "true")
                {
                    result.IsGoalDisplay = "True";
                }
                else
                {
                    result.IsGoalDisplay = "False";
                }

                String[] InputDisplayInfos = values[1].Split(separatorNext, StringSplitOptions.None);
                if (InputDisplayInfos[1].ToLower() == "true")
                {
                    result.IsInputDisplay = "True";
                }
                else
                {
                    result.IsInputDisplay = "False";
                }

                String[] OutputDisplayInfos = values[2].Split(separatorNext, StringSplitOptions.None);
                if (OutputDisplayInfos[1].ToLower() == "true")
                {
                    result.IsOutputDisplay = "True";
                }
                else
                {
                    result.IsOutputDisplay = "False";
                }

                String[] RateDisplayInfos = values[3].Split(separatorNext, StringSplitOptions.None);
                if (RateDisplayInfos[1].ToLower() == "true")
                {
                    result.IsRateDisplay = "True";
                }
                else
                {
                    result.IsRateDisplay = "False";
                }             

            }
            catch
            {
                //不需要处理
            }
            return result;

        }
Ejemplo n.º 5
0
        public static String SaveDashboardWindowSetting(DashboardWindowInfo windowInfo, String stageType)
        {
            String connectString = DatabaseUtil.GetConnectionString();

            String windowId = GeneralUtil.Null2String(windowInfo.WindowId);
            String windowName = GeneralUtil.Null2String(windowInfo.WindowName);

            //String stage=GeneralUtil.Null2String(windowInfo.StageId);
            String sqlString = "";
            StringBuilder sqlStringBuilder = new StringBuilder();

            //同时更新全部相同的stage的start work和stop work的所有SQL
            StringBuilder sqlStageUpdateAllStringBuilder = new StringBuilder();
            //同时更新全部相同的line的start work和stop work的所有SQL
            StringBuilder sqlLineUpdateAllStringBuilder = new StringBuilder();

            List<ConditionValueSet> paramList = new List<ConditionValueSet>();
            int paramIndex = 0;

            //如果原先有数据,先删除
            if (windowId != "")
            {
                CheckWindowSettingExist(windowId);

                ConditionValueSet paramItem = new ConditionValueSet();
                String paramName = "@param" + paramIndex;
                paramIndex = paramIndex + 1;
                paramItem.ParamName = paramName;
                paramItem.DataType = "char(32)";
                paramItem.ParamValue = windowId;

                paramList.Add(paramItem);

                sqlStringBuilder.Append("DELETE FROM [Dashboard_Family_Target] WHERE WindowsID=").Append(paramName).Append(" ");
                sqlStringBuilder.Append("DELETE FROM [Dashboard_Line_Target] WHERE WindowsID=").Append(paramName).Append(" ");
                sqlStringBuilder.Append("DELETE FROM [Dashboard_Stage_Target] WHERE WindowID=").Append(paramName).Append(" ");
                sqlStringBuilder.Append("DELETE FROM [Dashboard_Window] WHERE ID=").Append(paramName).Append(" ");
            }
            else
            {
                //检查名称是否重复
                windowId = DatabaseUtil.GetUUID();
            }

            CheckWindowNameSame(windowName, windowId);

            ConditionValueSet paramItemWindowId = new ConditionValueSet();
            paramItemWindowId.ParamName = "@param" + paramIndex;
            paramIndex = paramIndex + 1;
            paramItemWindowId.DataType = "char(32)";
            paramItemWindowId.ParamValue = windowId;
            paramList.Add(paramItemWindowId);

            ConditionValueSet paramWindowName = new ConditionValueSet();
            paramWindowName.ParamName = "@param" + paramIndex;
            paramIndex = paramIndex + 1;
            paramWindowName.DataType = "nvarchar(128)";
            paramWindowName.ParamValue = windowName;
            paramList.Add(paramWindowName);

            ConditionValueSet paramDisplayName = new ConditionValueSet();
            paramDisplayName.ParamName = "@param" + paramIndex;
            paramIndex = paramIndex + 1;
            paramDisplayName.DataType = "nvarchar(128)";
            paramDisplayName.ParamValue = GeneralUtil.Null2String(windowInfo.DisplayName);
            paramList.Add(paramDisplayName);


            ConditionValueSet paramAlertMessage = new ConditionValueSet();
            paramAlertMessage.ParamName = "@param" + paramIndex;
            paramIndex = paramIndex + 1;
            paramAlertMessage.DataType = "nvarchar(512)";
            paramAlertMessage.ParamValue = GeneralUtil.Null2String(windowInfo.AlertMessage);
            paramList.Add(paramAlertMessage);

            TimeInfo timeInfos = new TimeInfo();
            timeInfos.Hour = windowInfo.Hour;
            timeInfos.Minute = windowInfo.Minute;
            timeInfos.Second = windowInfo.Second;
            int refreshTime = Struct2TimeInt(timeInfos);

            ConditionValueSet paramRefreshTime = new ConditionValueSet();
            paramRefreshTime.ParamName = "@param" + paramIndex;
            paramIndex = paramIndex + 1;
            paramRefreshTime.DataType = "bigint";
            paramRefreshTime.ParamValue = refreshTime.ToString();
            paramList.Add(paramRefreshTime);

            ConditionValueSet paramDataSourceType = new ConditionValueSet();
            paramDataSourceType.ParamName = "@param" + paramIndex;
            paramIndex = paramIndex + 1;
            paramDataSourceType.DataType = "int";
            paramDataSourceType.ParamValue = GeneralUtil.Null2String(windowInfo.DataSourceType);
            paramList.Add(paramDataSourceType);

            ConditionValueSet paramIsStageDsp = new ConditionValueSet();
            paramIsStageDsp.ParamName = "@param" + paramIndex;
            paramIndex = paramIndex + 1;
            paramIsStageDsp.DataType = "bit";
            paramIsStageDsp.ParamValue = GeneralUtil.Null2String(windowInfo.IsStageDisplay);
            paramList.Add(paramIsStageDsp);

            ConditionValueSet paramCdt = new ConditionValueSet();
            //新建时
            if (windowInfo.Cdt != "")
            {
                paramCdt.ParamName = "@param" + paramIndex;
                paramIndex = paramIndex + 1;
                paramCdt.DataType = "datetime";
                paramCdt.ParamValue = GeneralUtil.Null2String(windowInfo.Cdt);
                paramList.Add(paramCdt);
            }

            ConditionValueSet paramEditor = new ConditionValueSet();
            paramEditor.ParamName = "@param" + paramIndex;
            paramIndex = paramIndex + 1;
            paramEditor.DataType = "nvarchar(100)";
            paramEditor.ParamValue = GeneralUtil.Null2String(windowInfo.Editor);
            paramList.Add(paramEditor);


            //create time由于没有地方修改,而保留了原来的create time
            sqlStringBuilder.Append("INSERT INTO [Dashboard_Window] ([ID],[WindowName],[DisplayName],[AlertMessage],[RefreshTime]")
                .Append(",[DataSourceType],[IsStageDsp],[Cdt],[Udt],[Editor]) VALUES(")
                .Append(paramItemWindowId.ParamName).Append(",")
                .Append(paramWindowName.ParamName).Append(",")
                .Append(paramDisplayName.ParamName).Append(",")
                .Append(paramAlertMessage.ParamName).Append(",")
                .Append(paramRefreshTime.ParamName).Append(",")
                .Append(paramDataSourceType.ParamName).Append(",")
                .Append(paramIsStageDsp.ParamName).Append(",");
            if (windowInfo.Cdt != "")
            {
                sqlStringBuilder.Append(paramCdt.ParamName).Append(",");
            }
            else
            {
                sqlStringBuilder.Append("getdate()").Append(",");
            }
            sqlStringBuilder.Append("getdate()").Append(",")
                .Append(paramEditor.ParamName)
                .Append(") ");



            ConditionValueSet paramStageTargetId = new ConditionValueSet();
            paramStageTargetId.ParamName = "@param" + paramIndex;
            paramIndex = paramIndex + 1;
            paramStageTargetId.DataType = "char(32)";
            paramStageTargetId.ParamValue = DatabaseUtil.GetUUID();
            paramList.Add(paramStageTargetId);

            ConditionValueSet paramStageId = new ConditionValueSet();
            paramStageId.ParamName = "@param" + paramIndex;
            paramIndex = paramIndex + 1;
            paramStageId.DataType = "char(10)";
            paramStageId.ParamValue = GeneralUtil.Null2String(windowInfo.StageId);
            paramList.Add(paramStageId);

            //window id见上面

            TimeInfo stageStartWorkTimeInfo = new TimeInfo();
            stageStartWorkTimeInfo.Hour = windowInfo.StartWorkTimeHour;
            stageStartWorkTimeInfo.Minute = windowInfo.StartWorkTimeMinute;
            String stageStartWorkTime = Struct2TimeString(stageStartWorkTimeInfo);

            ConditionValueSet paramStartWorkTime = new ConditionValueSet();
            paramStartWorkTime.ParamName = "@param" + paramIndex;
            paramIndex = paramIndex + 1;
            paramStartWorkTime.DataType = "datetime";
            paramStartWorkTime.ParamValue = stageStartWorkTime;
            paramList.Add(paramStartWorkTime);

            TimeInfo stageStopWorkTimeInfo = new TimeInfo();
            stageStopWorkTimeInfo.Hour = windowInfo.StopWorkTimeHour;
            stageStopWorkTimeInfo.Minute = windowInfo.StopWorkTimeMinute;
            String stageStopWorkTime = Struct2TimeString(stageStopWorkTimeInfo);

            ConditionValueSet paramStopWorkTime = new ConditionValueSet();
            paramStopWorkTime.ParamName = "@param" + paramIndex;
            paramIndex = paramIndex + 1;
            paramStopWorkTime.DataType = "datetime";
            paramStopWorkTime.ParamValue = stageStopWorkTime;
            paramList.Add(paramStopWorkTime);

            StageDisplayFieldInfo stageDisplayFieldInfo = new StageDisplayFieldInfo();
            stageDisplayFieldInfo.IsGoalDisplay = windowInfo.IsGoalDisplay;
            stageDisplayFieldInfo.IsInputDisplay = windowInfo.IsInputDisplay;
            stageDisplayFieldInfo.IsOutputDisplay = windowInfo.IsOutputDisplay;
            stageDisplayFieldInfo.IsRateDisplay = windowInfo.IsRateDisplay;

            String stageDisplayFieldValue = Struct2StageDisplayFieldsString(stageDisplayFieldInfo);

            ConditionValueSet paramDisplayFields = new ConditionValueSet();
            paramDisplayFields.ParamName = "@param" + paramIndex;
            paramIndex = paramIndex + 1;
            paramDisplayFields.DataType = "varchar(100)";
            paramDisplayFields.ParamValue = stageDisplayFieldValue;
            paramList.Add(paramDisplayFields);

            StringBuilder sqlStageStringBuilder = new StringBuilder();
            sqlStageStringBuilder.Append("INSERT INTO [Dashboard_Stage_Target] ([ID],[Stage],[WindowID],[StartWorkTime],[StopWorkTime],[DisplayFields]) ")
                .Append("VALUES(")
                .Append(paramStageTargetId.ParamName).Append(",")
                .Append(paramStageId.ParamName).Append(",")
                .Append(paramItemWindowId.ParamName).Append(",")
                .Append(paramStartWorkTime.ParamName).Append(",")
                .Append(paramStopWorkTime.ParamName).Append(",")
                .Append(paramDisplayFields.ParamName)
                .Append(") ");

            sqlStageUpdateAllStringBuilder.Append("UPDATE [Dashboard_Stage_Target] SET [StartWorkTime] = ")
                .Append(paramStartWorkTime.ParamName).Append(",")
                .Append("[StopWorkTime] =")
                .Append(paramStopWorkTime.ParamName)
                .Append(" WHERE [Stage]=")
                .Append(paramStageId.ParamName).Append(" ");

            StringBuilder sqlLineStringBuilder = new StringBuilder();
            StringBuilder sqlStationStringBuilder = new StringBuilder();

            //判断windowId,如果不为空,先删除对应的station,line, stage window,再加入
            for (int i = 0; i < windowInfo.WindowLineInfos.Count; i++)
            {
                WindowLineInfo lineItem = windowInfo.WindowLineInfos[i];

                ConditionValueSet paramLineTargetId = new ConditionValueSet();
                paramLineTargetId.ParamName = "@param" + paramIndex;
                paramIndex = paramIndex + 1;
                paramLineTargetId.DataType = "char(32)";
                paramLineTargetId.ParamValue = DatabaseUtil.GetUUID();
                paramList.Add(paramLineTargetId);

                ConditionValueSet paramLineId = new ConditionValueSet();
                paramLineId.ParamName = "@param" + paramIndex;
                paramIndex = paramIndex + 1;
                paramLineId.DataType = "char(10)";
                paramLineId.ParamValue = GeneralUtil.Null2String(lineItem.LineID);
                paramList.Add(paramLineId);

                //ConditionValueSet paramOutputTarget = new ConditionValueSet();
                //paramOutputTarget.ParamName = "@param" + paramIndex;
                //paramIndex = paramIndex + 1;
                //paramOutputTarget.DataType = "int";
                //paramOutputTarget.ParamValue = GeneralUtil.Null2String(lineItem.OutputTarget);
                //paramList.Add(paramOutputTarget);

                //ConditionValueSet paramFPYTarget = new ConditionValueSet();
                //paramFPYTarget.ParamName = "@param" + paramIndex;
                //paramIndex = paramIndex + 1;
                //paramFPYTarget.DataType = "float";
                //paramFPYTarget.ParamValue = GeneralUtil.Null2String(lineItem.FPYTarget);
                //paramList.Add(paramFPYTarget);

                //ConditionValueSet paramFPYAlert = new ConditionValueSet();
                //paramFPYAlert.ParamName = "@param" + paramIndex;
                //paramIndex = paramIndex + 1;
                //paramFPYAlert.DataType = "float";
                //paramFPYAlert.ParamValue = GeneralUtil.Null2String(lineItem.FPYAlert);
                //paramList.Add(paramFPYAlert);

                TimeInfo lineStartWorkTimeInfo = new TimeInfo();
                lineStartWorkTimeInfo.Hour = lineItem.StartWorkHour;
                lineStartWorkTimeInfo.Minute = lineItem.StartWorkMinute;
                String lineStartWorkTime = Struct2TimeString(lineStartWorkTimeInfo);

                ConditionValueSet paramLineStartWorkTime = new ConditionValueSet();
                paramLineStartWorkTime.ParamName = "@param" + paramIndex;
                paramIndex = paramIndex + 1;
                paramLineStartWorkTime.DataType = "datetime";
                paramLineStartWorkTime.ParamValue = lineStartWorkTime;
                paramList.Add(paramLineStartWorkTime);

                TimeInfo lineStopWorkTimeInfo = new TimeInfo();
                lineStopWorkTimeInfo.Hour = lineItem.StopWorkHour;
                lineStopWorkTimeInfo.Minute = lineItem.StopWorkMinute;
                String lineStopWorkTime = Struct2TimeString(lineStopWorkTimeInfo);

                ConditionValueSet paramLineStopWorkTime = new ConditionValueSet();
                paramLineStopWorkTime.ParamName = "@param" + paramIndex;
                paramIndex = paramIndex + 1;
                paramLineStopWorkTime.DataType = "datetime";
                paramLineStopWorkTime.ParamValue = lineStopWorkTime;
                paramList.Add(paramLineStopWorkTime);

                ConditionValueSet paramShift = new ConditionValueSet();
                paramShift.ParamName = "@param" + paramIndex;
                paramIndex = paramIndex + 1;
                paramShift.DataType = "varchar";
                paramShift.ParamValue = lineItem.Shift;
                paramList.Add(paramShift);

                String fmlDspField="";

                if (stageType ==Constants.SA_STAGE.ToString())
                {
                    SaStationDisplayFieldInfo DisplayFieldsInfo=new SaStationDisplayFieldInfo();

                    DisplayFieldsInfo.IsDefectDsp =lineItem.IsDefectDsp;
                    DisplayFieldsInfo.IsICTDefectDsp  =lineItem.IsICTDefectDsp;
                    DisplayFieldsInfo.IsICTInputDsp  =lineItem.IsICTInputDsp;
                    DisplayFieldsInfo.IsICTYieldRateDsp  =lineItem.IsICTYieldRateDsp;
                    DisplayFieldsInfo.IsInputDsp =lineItem.IsInputDsp;
                    DisplayFieldsInfo.IsYieldRateDsp =lineItem.IsYieldRateDsp;

                    fmlDspField=Struct2SaStationDisplayFieldsString(DisplayFieldsInfo);

                }
                else
                {
                    SmtStationDisplayFieldInfo DisplayFieldsInfo=new SmtStationDisplayFieldInfo();

                    DisplayFieldsInfo.IsDefectDsp =lineItem.IsDefectDsp;
                    DisplayFieldsInfo.IsInputDsp =lineItem.IsInputDsp;
                    DisplayFieldsInfo.IsYieldRateDsp =lineItem.IsYieldRateDsp;
                    DisplayFieldsInfo.IsAOIDefectDsp =lineItem.IsAOIDefectDsp;
                    DisplayFieldsInfo.IsAOIOutputDsp  =lineItem.IsAOIOutputDsp;

                    fmlDspField=Struct2SmtStationDisplayFieldsString(DisplayFieldsInfo);
                }

                ConditionValueSet paramFmlDspField = new ConditionValueSet();
                paramFmlDspField.ParamName = "@param" + paramIndex;
                paramIndex = paramIndex + 1;
                paramFmlDspField.DataType = "varchar";
                paramFmlDspField.ParamValue = fmlDspField;
                paramList.Add(paramFmlDspField);


                ConditionValueSet paramLineOrder = new ConditionValueSet();
                paramLineOrder.ParamName = "@param" + paramIndex;
                paramIndex = paramIndex + 1;
                paramLineOrder.DataType = "int";
                paramLineOrder.ParamValue = i.ToString();
                paramList.Add(paramLineOrder);

                sqlLineStringBuilder.Append("INSERT INTO [Dashboard_Line_Target] ")
                    .Append("([Line]")
                    .Append(",[ID]")
                    .Append(",[WindowsID]")
                    .Append(",[StartWorkTime]")
                    .Append(",[StopWorkTime]")
                    .Append(",[Order]")
                    .Append(",[Shift]")
                    .Append(",[FmlDspField]) ")
                 .Append("VALUES (")
                 .Append(paramLineId.ParamName).Append(",")
                 .Append(paramLineTargetId.ParamName).Append(",")
                 .Append(paramItemWindowId.ParamName).Append(",")
                 .Append(paramLineStartWorkTime.ParamName).Append(",")
                 .Append(paramLineStopWorkTime.ParamName).Append(",")
                 .Append(paramLineOrder.ParamName).Append(",")
                 .Append(paramShift.ParamName).Append(",")
                 .Append(paramFmlDspField.ParamName)               
                 .Append(") ");

                //存盘时,相同的line的基本数据同时变
                sqlLineUpdateAllStringBuilder.Append("UPDATE [Dashboard_Line_Target] SET [StartWorkTime] = ")
                .Append(paramLineStartWorkTime.ParamName)
                .Append(",[StopWorkTime] =")
                .Append(paramLineStopWorkTime.ParamName)
                .Append(",[Shift] =")
                .Append(paramShift.ParamName)
                .Append(" WHERE [Line]=")
                .Append(paramLineId.ParamName).Append(" ");

                //存SA的目标量
               // String SA = ConfigurationManager.AppSettings["SA"].ToString();
               // ConditionValueSet paramSaStage = new ConditionValueSet();
               // paramSaStage.ParamName = "@param" + paramIndex;
               // paramIndex = paramIndex + 1;
               // paramSaStage.DataType = "char";
               // paramSaStage.ParamValue = SA;
               // paramList.Add(paramSaStage);

               // sqlLineUpdateAllStringBuilder.Append("DELETE FROM [Dashboard_StageGoal] WHERE Stage=")
               //.Append(paramSaStage.ParamName).Append(" ")
               //.Append("INSERT INTO [Dashboard_StageGoal] ([Stage],[Goal]) ")
               //.Append("SELECT a.Stage, SUM(a.OutputTarget) as GoalNum ")
               //.Append("FROM (SELECT DISTINCT [Dashboard_Line_Target].[Line] ")
               //.Append(",[Dashboard_Line_Target].[OutputTarget],[Line].Stage ")
               //.Append("FROM [Dashboard_Line_Target] INNER JOIN [Line] ")
               //.Append("ON [Dashboard_Line_Target].[Line]=[Line].[Line] ")
               //.Append("WHERE [Line].Stage=")
               //.Append(paramSaStage.ParamName).Append(" ) AS a GROUP BY a.Stage ");

                for (int j = 0; j < lineItem.WindowLineFamilyInfos.Count; j++)
                {

                    WindowLineFamilyInfo stationItem = lineItem.WindowLineFamilyInfos[j];

                    ConditionValueSet paramFamilyTargetId = new ConditionValueSet();
                    paramFamilyTargetId.ParamName = "@param" + paramIndex;
                    paramIndex = paramIndex + 1;
                    paramFamilyTargetId.DataType = "char(32)";
                    paramFamilyTargetId.ParamValue = DatabaseUtil.GetUUID();
                    paramList.Add(paramFamilyTargetId);

                    ConditionValueSet paramFamilyId = new ConditionValueSet();
                    paramFamilyId.ParamName = "@param" + paramIndex;
                    paramIndex = paramIndex + 1;
                    paramFamilyId.DataType = "varchar";  
                    paramFamilyId.ParamValue = GeneralUtil.Null2String(stationItem.Family);
                    paramList.Add(paramFamilyId);

                    ConditionValueSet paramSeries = new ConditionValueSet();
                    paramSeries.ParamName = "@param" + paramIndex;
                    paramIndex = paramIndex + 1;
                    paramSeries.DataType = "varchar";
                    paramSeries.ParamValue = GeneralUtil.Null2String(stationItem.Series);
                    paramList.Add(paramSeries);

                 
                    ConditionValueSet paramPlan = new ConditionValueSet();
                    paramPlan.ParamName = "@param" + paramIndex;
                    paramIndex = paramIndex + 1;
                    paramPlan.DataType = "int";
                    paramPlan.ParamValue = stationItem.PlanQty;
                    paramList.Add(paramPlan);

                    ConditionValueSet paramStationOrder = new ConditionValueSet();
                    paramStationOrder.ParamName = "@param" + paramIndex;
                    paramIndex = paramIndex + 1;
                    paramStationOrder.DataType = "int";
                    paramStationOrder.ParamValue = j.ToString();
                    paramList.Add(paramStationOrder);

                    sqlStationStringBuilder.Append("INSERT INTO [Dashboard_Family_Target] ")
                        .Append("([ID]")
                        .Append(",[Line]")
                        .Append(",[WindowsID]")
                        .Append(",[Family]")
                        .Append(",[Series]")
                        .Append(",[Plan]")
                        .Append(",[Order]) ")
                        .Append("VALUES (")
                        .Append(paramFamilyTargetId.ParamName).Append(",")
                        .Append(paramLineId.ParamName).Append(",")
                        .Append(paramItemWindowId.ParamName).Append(",")                        
                        .Append(paramFamilyId.ParamName).Append(",")
                        .Append(paramSeries.ParamName).Append(",")
                        .Append(paramPlan.ParamName).Append(",")
                        .Append(paramStationOrder.ParamName)
                        .Append(") ");

                }
            }

            sqlString = sqlStringBuilder.ToString() + sqlStageStringBuilder.ToString() + sqlLineStringBuilder.ToString() + sqlStationStringBuilder.ToString() + sqlStageUpdateAllStringBuilder.ToString() + sqlLineUpdateAllStringBuilder.ToString();
            DatabaseUtil.ExecSqlNonQueryWithParam(sqlString, connectString, paramList);

            return windowId;
        }