コード例 #1
0
 public bool LineNightInsert(LineInputNight line)
 {
     return(obj.LineInputNightInsert(line));
 }
コード例 #2
0
 public bool LineNightUpdate(LineInputNight line)
 {
     return(obj.LineInputNightUpdate(line));
 }
コード例 #3
0
        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            string color;

            if (ddlShift.SelectedValue.Equals("Day"))
            //DAY
            #region Day
            {
                LineColorDay_BLL colorLine    = new LineColorDay_BLL();
                LineInputDay     lineStocking = new LineInputDay();
                lineStocking     = inputDay_BLL.InputDay_GetStocking(planid);
                stockingPosition = lineStocking.line;

                if (e.Row.RowType == DataControlRowType.Footer)
                {
                    int         index = GridView1.Rows.Count;
                    GridViewRow row   = new GridViewRow(0, 0, DataControlRowType.Footer, DataControlRowState.Normal);
                    TableCell   cell  = new TableCell();
                    cell.Text       = "Stocking:";
                    cell.ColumnSpan = 4;
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = "-";
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = "-";
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.plan.ToString();
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.actual.ToString();
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.diff.ToString();
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.target.ToString();
                    row.Cells.Add(cell);
                    cell = new TableCell();
                    float actualrateStocking = 0;
                    if (lineStocking.target != 0)
                    {
                        actualrateStocking = (float)lineStocking.actual / lineStocking.target * 100;
                    }
                    cell.Text = actualrateStocking.ToString("F1") + "%";
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h07.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color07H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h08.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color08H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h09.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color09H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h10.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color10H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h11.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color11H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h12.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color12H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h13.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color13H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h14.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color14H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h15.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color15H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h16.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color16H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h17.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color17H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h18.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color18H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.comment.ToString();
                    row.Cells.Add(cell);
                    GridView1.Controls[0].Controls.Add(row);
                }
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    int line    = int.Parse(e.Row.Cells[0].Text);
                    int lineNew = line + 7;
                    if (line >= 44)
                    {
                        e.Row.Cells[0].Text = lineNew.ToString();
                    }
                    if (inputDay_BLL.InputDay_CheckRSbyLine(line, planid))
                    {
                        if (!e.Row.Cells[4].Text.Equals(""))
                        {
                            totalPW += common.ConvertInt(e.Row.Cells[4].Text);
                        }
                        if (!e.Row.Cells[5].Text.Equals(""))
                        {
                            totalAW += common.ConvertInt(e.Row.Cells[5].Text);
                        }
                        if (!e.Row.Cells[6].Text.Equals(""))
                        {
                            totalPl += common.ConvertInt(e.Row.Cells[6].Text);
                        }
                        if (!e.Row.Cells[7].Text.Equals(""))
                        {
                            totalAC += common.ConvertInt(e.Row.Cells[7].Text);
                        }
                        if (!e.Row.Cells[8].Text.Equals(""))
                        {
                            totalDiff += common.ConvertInt(e.Row.Cells[8].Text);
                        }
                        if (!e.Row.Cells[9].Text.Equals(""))
                        {
                            totalTarget += common.ConvertInt(e.Row.Cells[9].Text);
                        }
                        if (!e.Row.Cells[11].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color07H", line, planid);
                            e.Row.Cells[11].BackColor = setColor(color);
                            total7 += common.ConvertInt(e.Row.Cells[11].Text);
                        }
                        if (!e.Row.Cells[12].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color08H", line, planid);
                            e.Row.Cells[12].BackColor = setColor(color);
                            total8 += common.ConvertInt(e.Row.Cells[12].Text);
                        }
                        if (!e.Row.Cells[13].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color09H", line, planid);
                            e.Row.Cells[13].BackColor = setColor(color);
                            total9 += common.ConvertInt(e.Row.Cells[13].Text);
                        }
                        if (!e.Row.Cells[14].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color10H", line, planid);
                            e.Row.Cells[14].BackColor = setColor(color);
                            total10 += common.ConvertInt(e.Row.Cells[14].Text);
                        }
                        if (!e.Row.Cells[15].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color11H", line, planid);
                            e.Row.Cells[15].BackColor = setColor(color);
                            total11 += common.ConvertInt(e.Row.Cells[15].Text);
                        }
                        if (!e.Row.Cells[16].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color12H", line, planid);
                            e.Row.Cells[16].BackColor = setColor(color);
                            total12 += common.ConvertInt(e.Row.Cells[16].Text);
                        }
                        if (!e.Row.Cells[17].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color13H", line, planid);
                            e.Row.Cells[17].BackColor = setColor(color);
                            total13 += common.ConvertInt(e.Row.Cells[17].Text);
                        }
                        if (!e.Row.Cells[18].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color14H", line, planid);
                            e.Row.Cells[18].BackColor = setColor(color);
                            total14 += common.ConvertInt(e.Row.Cells[18].Text);
                        }
                        if (!e.Row.Cells[19].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color15H", line, planid);
                            e.Row.Cells[19].BackColor = setColor(color);
                            total15 += common.ConvertInt(e.Row.Cells[19].Text);
                        }
                        if (!e.Row.Cells[20].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color16H", line, planid);
                            e.Row.Cells[20].BackColor = setColor(color);
                            total16 += common.ConvertInt(e.Row.Cells[20].Text);
                        }
                        if (!e.Row.Cells[21].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color17H", line, planid);
                            e.Row.Cells[21].BackColor = setColor(color);
                            total17 += common.ConvertInt(e.Row.Cells[21].Text);
                        }
                        if (!e.Row.Cells[22].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color18H", line, planid);
                            e.Row.Cells[22].BackColor = setColor(color);
                            total18 += common.ConvertInt(e.Row.Cells[22].Text);
                        }

                        if (e.Row.Cells[23].Text.Trim().Equals("Run"))
                        {
                            e.Row.Cells[23].Text      = "R";
                            e.Row.Cells[23].BackColor = Color.FromArgb(0, 204, 0);
                        }
                        else if (e.Row.Cells[23].Text.Trim().Equals("Stop"))
                        {
                            e.Row.Cells[23].Text      = "S";
                            e.Row.Cells[23].BackColor = Color.Red;
                        }
                    }
                    else
                    {
                        for (int i = 1; i < 23; i++)
                        {
                            e.Row.Cells[i].Text = "";
                        }
                        e.Row.Cells[23].Text = "-";
                    }
                }
            }
            #endregion
            else
            //Night
            #region Night
            {
                LineColorNight_BLL colorLine    = new LineColorNight_BLL();
                LineInputNight     lineStocking = new LineInputNight();
                lineStocking = inputNight_BLL.InputNight_GetStocking(planid);
                if (e.Row.RowType == DataControlRowType.Footer)
                {
                    int         index = GridView1.Rows.Count;
                    GridViewRow row   = new GridViewRow(0, 0, DataControlRowType.Footer, DataControlRowState.Normal);
                    TableCell   cell  = new TableCell();
                    cell.Text       = "Stocking:";
                    cell.ColumnSpan = 4;
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = "-";
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = "-";
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.plan.ToString();
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.actual.ToString();
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.diff.ToString();
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.target.ToString();
                    row.Cells.Add(cell);
                    cell = new TableCell();
                    float actualrateStocking = 0;
                    if (lineStocking.target != 0)
                    {
                        actualrateStocking = (float)lineStocking.actual / lineStocking.target * 100;
                    }
                    cell.Text = actualrateStocking.ToString("F1") + "%";
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h19.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color19H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h20.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color20H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h21.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color21H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h22.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color22H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h23.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color23H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h00.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color00H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h01.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color01H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h02.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color02H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h03.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color03H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h04.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color04H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h05.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color05H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h06.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color06H", 39, planid));
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.comment.ToString();
                    row.Cells.Add(cell);
                    GridView1.Controls[0].Controls.Add(row);
                }
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    int line    = int.Parse(e.Row.Cells[0].Text);
                    int lineNew = line + 7;
                    if (line >= 44)
                    {
                        e.Row.Cells[0].Text = lineNew.ToString();
                    }
                    if (inputNight_BLL.InputNight_CheckRSbyLine(line, planid))
                    {
                        if (!e.Row.Cells[4].Text.Equals(""))
                        {
                            totalPW += common.ConvertInt(e.Row.Cells[4].Text);
                        }
                        if (!e.Row.Cells[5].Text.Equals(""))
                        {
                            totalAW += common.ConvertInt(e.Row.Cells[5].Text);
                        }
                        if (!e.Row.Cells[6].Text.Equals(""))
                        {
                            totalPl += common.ConvertInt(e.Row.Cells[6].Text);
                        }
                        if (!e.Row.Cells[7].Text.Equals(""))
                        {
                            totalAC += common.ConvertInt(e.Row.Cells[7].Text);
                        }
                        if (!e.Row.Cells[8].Text.Equals(""))
                        {
                            totalDiff += common.ConvertInt(e.Row.Cells[8].Text);
                        }
                        if (!e.Row.Cells[9].Text.Equals(""))
                        {
                            totalTarget += common.ConvertInt(e.Row.Cells[9].Text);
                        }
                        if (!e.Row.Cells[11].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color19H", line, planid);
                            e.Row.Cells[11].BackColor = setColor(color);
                            total19 += common.ConvertInt(e.Row.Cells[11].Text);
                        }
                        if (!e.Row.Cells[12].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color20H", line, planid);
                            e.Row.Cells[12].BackColor = setColor(color);
                            total20 += common.ConvertInt(e.Row.Cells[12].Text);
                        }
                        if (!e.Row.Cells[13].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color21H", line, planid);
                            e.Row.Cells[13].BackColor = setColor(color);
                            total21 += common.ConvertInt(e.Row.Cells[13].Text);
                        }
                        if (!e.Row.Cells[14].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color22H", line, planid);
                            e.Row.Cells[14].BackColor = setColor(color);
                            total22 += common.ConvertInt(e.Row.Cells[14].Text);
                        }
                        if (!e.Row.Cells[15].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color23H", line, planid);
                            e.Row.Cells[15].BackColor = setColor(color);
                            total23 += common.ConvertInt(e.Row.Cells[15].Text);
                        }
                        if (!e.Row.Cells[16].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color00H", line, planid);
                            e.Row.Cells[16].BackColor = setColor(color);
                            total0 += common.ConvertInt(e.Row.Cells[16].Text);
                        }
                        if (!e.Row.Cells[17].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color01H", line, planid);
                            e.Row.Cells[17].BackColor = setColor(color);
                            total1 += common.ConvertInt(e.Row.Cells[17].Text);
                        }
                        if (!e.Row.Cells[18].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color02H", line, planid);
                            e.Row.Cells[18].BackColor = setColor(color);
                            total2 += common.ConvertInt(e.Row.Cells[18].Text);
                        }
                        if (!e.Row.Cells[19].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color03H", line, planid);
                            e.Row.Cells[19].BackColor = setColor(color);
                            total3 += common.ConvertInt(e.Row.Cells[19].Text);
                        }
                        if (!e.Row.Cells[20].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color04H", line, planid);
                            e.Row.Cells[20].BackColor = setColor(color);
                            total4 += common.ConvertInt(e.Row.Cells[20].Text);
                        }
                        if (!e.Row.Cells[21].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color05H", line, planid);
                            e.Row.Cells[21].BackColor = setColor(color);
                            total5 += common.ConvertInt(e.Row.Cells[21].Text);
                        }
                        if (!e.Row.Cells[22].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color06H", line, planid);
                            e.Row.Cells[22].BackColor = setColor(color);
                            total6 += common.ConvertInt(e.Row.Cells[22].Text);
                        }
                        if (e.Row.Cells[23].Text.Trim().Equals("Run"))
                        {
                            e.Row.Cells[23].Text      = "R";
                            e.Row.Cells[23].BackColor = Color.FromArgb(0, 204, 0);
                        }
                        else if (e.Row.Cells[23].Text.Trim().Equals("Stop"))
                        {
                            e.Row.Cells[23].Text      = "S";
                            e.Row.Cells[23].BackColor = Color.Red;
                        }
                    }
                    else
                    {
                        for (int i = 1; i < 23; i++)
                        {
                            e.Row.Cells[i].Text = "";
                        }
                        e.Row.Cells[23].Text = "-";
                    }
                }
            }
            #endregion
        }
コード例 #4
0
        public LineInputNight LineInputSelectNightByLine(int line, int planid)
        {
            DataTable      dt      = new DataTable();
            LineInputNight objLine = new LineInputNight();

            try
            {
                using (SqlCommand command = new SqlCommand("LineInputNight_SelectByLine", openConnection()))
                {
                    command.CommandType = CommandType.StoredProcedure;

                    command.Parameters.AddWithValue("@Line", line);
                    command.Parameters.AddWithValue("@PlanId", planid);
                    SqlDataAdapter da = new SqlDataAdapter(command);
                    da.Fill(dt);

                    objLine.line          = int.Parse(dt.Rows[0]["LineName"].ToString());
                    objLine.rs            = bool.Parse(dt.Rows[0]["RS"].ToString());
                    objLine.model         = dt.Rows[0]["Model"].ToString();
                    objLine.changemodel   = dt.Rows[0]["ChangeModel"].ToString();
                    objLine.planed_woker  = commonFun.ConvertInt2(dt.Rows[0]["Planed_Worker"].ToString());
                    objLine.actual_woker  = commonFun.ConvertInt2(dt.Rows[0]["Actual_Worker"].ToString());
                    objLine.acchived_rate = (float)commonFun.ConvertDouble(dt.Rows[0]["Archived_Rate"].ToString());
                    objLine.rank          = dt.Rows[0]["Rank"].ToString();
                    objLine.plan          = commonFun.ConvertInt2(dt.Rows[0]["Plan"].ToString());
                    objLine.tact_time     = (float)commonFun.ConvertDouble(dt.Rows[0]["Tact_Time"].ToString());
                    objLine.total_min     = commonFun.ConvertInt2(dt.Rows[0]["Total_Minute"].ToString());
                    objLine.actual        = commonFun.ConvertInt2(dt.Rows[0]["Actual"].ToString());
                    objLine.diff          = commonFun.ConvertInt2(dt.Rows[0]["Diff"].ToString());
                    objLine.target        = commonFun.ConvertInt2(dt.Rows[0]["Target"].ToString());
                    objLine.h19           = commonFun.ConvertInt2(dt.Rows[0]["H19"].ToString());
                    objLine.h20           = commonFun.ConvertInt2(dt.Rows[0]["H20"].ToString());
                    objLine.h21           = commonFun.ConvertInt2(dt.Rows[0]["H21"].ToString());
                    objLine.h22           = commonFun.ConvertInt2(dt.Rows[0]["H22"].ToString());
                    objLine.h23           = commonFun.ConvertInt2(dt.Rows[0]["H23"].ToString());
                    objLine.h00           = commonFun.ConvertInt2(dt.Rows[0]["H00"].ToString());
                    objLine.h01           = commonFun.ConvertInt2(dt.Rows[0]["H01"].ToString());
                    objLine.h02           = commonFun.ConvertInt2(dt.Rows[0]["H02"].ToString());
                    objLine.h03           = commonFun.ConvertInt2(dt.Rows[0]["H03"].ToString());
                    objLine.h04           = commonFun.ConvertInt2(dt.Rows[0]["H04"].ToString());
                    objLine.h05           = commonFun.ConvertInt2(dt.Rows[0]["H05"].ToString());
                    objLine.h06           = commonFun.ConvertInt2(dt.Rows[0]["H06"].ToString());
                    objLine.from1         = dt.Rows[0]["From1"].ToString();
                    objLine.to1           = dt.Rows[0]["To1"].ToString();
                    objLine.from2         = dt.Rows[0]["From2"].ToString();
                    objLine.to2           = dt.Rows[0]["To2"].ToString();
                    objLine.from3         = dt.Rows[0]["From3"].ToString();
                    objLine.to3           = dt.Rows[0]["To3"].ToString();
                    objLine.from4         = dt.Rows[0]["From4"].ToString();
                    objLine.to4           = dt.Rows[0]["To4"].ToString();
                    objLine.from5         = dt.Rows[0]["From5"].ToString();
                    objLine.to5           = dt.Rows[0]["To5"].ToString();
                    objLine.from6         = dt.Rows[0]["From6"].ToString();
                    objLine.to6           = dt.Rows[0]["To6"].ToString();
                    objLine.comment       = dt.Rows[0]["Comments"].ToString();
                    objLine.status        = dt.Rows[0]["Status"].ToString();
                    objLine.changedActual = bool.Parse(dt.Rows[0]["ChangedPlaned"].ToString());
                }
            }
            catch (System.Exception) {
            }
            this.closeConnection();
            return(objLine);
        }
コード例 #5
0
        public bool LineInputNightUpdate(LineInputNight line)
        {
            int result = 0;

            using (SqlCommand command = new SqlCommand("LineInputNight_Update", openConnection()))
            {
                try
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter("@LineName", line.line));
                    command.Parameters.Add(new SqlParameter("@PlanId", line.planid));
                    command.Parameters.Add(new SqlParameter("@Model", line.model));
                    command.Parameters.Add(new SqlParameter("@ModelA", line.modelA));
                    command.Parameters.Add(new SqlParameter("@ModelB", line.modelB));
                    command.Parameters.Add(new SqlParameter("@ModelC", line.modelC));
                    command.Parameters.Add(new SqlParameter("@RS", line.rs));
                    command.Parameters.Add(new SqlParameter("@ChangeModel", line.changemodel));
                    //
                    if (line.planed_woker == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@Planed_Worker", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@Planed_Worker", line.planed_woker));
                    }
                    //
                    if (line.actual_woker == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@Actual_Worker", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@Actual_Worker", line.actual_woker));
                    }
                    //
                    if (line.plan == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@Plan", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@Plan", line.plan));
                    }
                    //
                    command.Parameters.Add(new SqlParameter("@Tact_Time", line.tact_time));
                    //
                    if (line.total_min == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@Total_Minute", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@Total_Minute", line.total_min));
                    }
                    //
                    if (line.actual == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@Actual", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@Actual", line.actual));
                    }
                    //
                    if (line.diff == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@Diff", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@Diff", line.diff));
                    }
                    //
                    if (line.target == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@Target", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@Target", line.target));
                    }
                    //
                    command.Parameters.Add(new SqlParameter("@Archived_Rate", line.acchived_rate));
                    command.Parameters.Add(new SqlParameter("@Rank", line.rank));
                    command.Parameters.Add(new SqlParameter("@From1", line.from1));
                    command.Parameters.Add(new SqlParameter("@To1", line.to1));
                    command.Parameters.Add(new SqlParameter("@From2", line.from2));
                    command.Parameters.Add(new SqlParameter("@To2", line.to2));
                    command.Parameters.Add(new SqlParameter("@From3", line.from3));
                    command.Parameters.Add(new SqlParameter("@To3", line.to3));
                    command.Parameters.Add(new SqlParameter("@From4", line.from4));
                    command.Parameters.Add(new SqlParameter("@To4", line.to4));
                    command.Parameters.Add(new SqlParameter("@From5", line.from5));
                    command.Parameters.Add(new SqlParameter("@To5", line.to5));
                    command.Parameters.Add(new SqlParameter("@From6", line.from6));
                    command.Parameters.Add(new SqlParameter("@To6", line.to6));
                    //
                    if (line.h19 == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@H19", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@H19", line.h19));
                    }
                    //
                    if (line.h20 == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@H20", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@H20", line.h20));
                    }
                    //
                    if (line.h21 == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@H21", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@H21", line.h21));
                    }
                    //
                    if (line.h22 == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@H22", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@H22", line.h22));
                    }
                    //
                    if (line.h23 == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@H23", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@H23", line.h23));
                    }
                    //
                    if (line.h00 == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@H00", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@H00", line.h00));
                    }
                    //
                    if (line.h01 == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@H01", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@H01", line.h01));
                    }
                    //
                    if (line.h02 == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@H02", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@H02", line.h02));
                    }
                    //
                    if (line.h03 == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@H03", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@H03", line.h03));
                    }
                    //
                    if (line.h04 == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@H04", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@H04", line.h04));
                    }
                    //
                    if (line.h05 == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@H05", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@H05", line.h05));
                    }
                    if (line.h06 == -1)
                    {
                        command.Parameters.Add(new SqlParameter("@H06", null));
                    }
                    else
                    {
                        command.Parameters.Add(new SqlParameter("@H06", line.h06));
                    }
                    command.Parameters.Add(new SqlParameter("@Comments", line.comment));
                    command.Parameters.Add(new SqlParameter("@Status", line.status));
                    result = command.ExecuteNonQuery();
                }
                catch (SqlException)
                {
                    return(false);
                }
                finally
                {
                    this.closeConnection();
                }
                return(result > 0);
            }
        }
コード例 #6
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            ImageButton    btnBack     = (ImageButton)sender;
            GridViewRow    row         = (GridViewRow)btnBack.NamingContainer;
            ImageButton    btnSave     = (ImageButton)row.FindControl("btnSave");
            LineInputNight line_       = new LineInputNight();
            int            actualcount = 0;

            line_           = input.LineNightByLine(int.Parse(row.Cells[0].Text), planid);
            btnSave.Visible = false;
            btnBack.Visible = false;
            if (DateTime.Now.Hour <= 23 && DateTime.Now.Hour >= 19)
            {
                for (int i = 19; i <= DateTime.Now.Hour; i++)
                {
                    int     a       = 0;
                    string  hourStr = this.convertIntegerLessThan10(i);
                    Label   lblhour = (Label)row.FindControl("lbl" + hourStr + "H");
                    TextBox txthour = (TextBox)row.FindControl("txt" + hourStr + "H");
                    if (int.TryParse(txthour.Text, out a))
                    {
                        actualcount += a;
                        if (i == 19)
                        {
                            line_.h19 = a;
                        }
                        else if (i == 20)
                        {
                            line_.h20 = a;
                        }
                        else if (i == 21)
                        {
                            line_.h21 = a;
                        }
                        else if (i == 22)
                        {
                            line_.h22 = a;
                        }
                        else if (i == 23)
                        {
                            line_.h23 = a;
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Error: " + txthour.ID + " is not integer type');", true);
                        return;
                    }
                }
            }
            else if (DateTime.Now.Hour <= 6)
            {
                for (int i = 19; i <= 23; i++)
                {
                    int     a       = 0;
                    string  hourStr = this.convertIntegerLessThan10(i);
                    Label   lblhour = (Label)row.FindControl("lbl" + hourStr + "H");
                    TextBox txthour = (TextBox)row.FindControl("txt" + hourStr + "H");
                    if (int.TryParse(txthour.Text, out a))
                    {
                        actualcount += a;
                        if (i == 19)
                        {
                            line_.h19 = a;
                        }
                        else if (i == 20)
                        {
                            line_.h20 = a;
                        }
                        else if (i == 21)
                        {
                            line_.h21 = a;
                        }
                        else if (i == 22)
                        {
                            line_.h22 = a;
                        }
                        else if (i == 23)
                        {
                            line_.h23 = a;
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Error: " + txthour.ID + " is not integer type');", true);
                        return;
                    }
                }
                for (int i = 0; i <= DateTime.Now.Hour; i++)
                {
                    int     a       = 0;
                    string  hourStr = this.convertIntegerLessThan10(i);
                    Label   lblhour = (Label)row.FindControl("lbl" + hourStr + "H");
                    TextBox txthour = (TextBox)row.FindControl("txt" + hourStr + "H");
                    if (int.TryParse(txthour.Text, out a))
                    {
                        actualcount += a;
                        if (i == 0)
                        {
                            line_.h00 = a;
                        }
                        else if (i == 1)
                        {
                            line_.h01 = a;
                        }
                        else if (i == 2)
                        {
                            line_.h02 = a;
                        }
                        else if (i == 3)
                        {
                            line_.h03 = a;
                        }
                        else if (i == 4)
                        {
                            line_.h04 = a;
                        }
                        else if (i == 5)
                        {
                            line_.h05 = a;
                        }
                        else if (i == 6)
                        {
                            line_.h06 = a;
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Error: " + txthour.ID + " is not integer type');", true);
                        return;
                    }
                }
            }
            else
            {
                for (int i = 19; i <= 23; i++)
                {
                    int     a       = 0;
                    string  hourStr = this.convertIntegerLessThan10(i);
                    Label   lblhour = (Label)row.FindControl("lbl" + hourStr + "H");
                    TextBox txthour = (TextBox)row.FindControl("txt" + hourStr + "H");
                    if (int.TryParse(txthour.Text, out a))
                    {
                        actualcount += a;
                        if (i == 19)
                        {
                            line_.h19 = a;
                        }
                        else if (i == 20)
                        {
                            line_.h20 = a;
                        }
                        else if (i == 21)
                        {
                            line_.h21 = a;
                        }
                        else if (i == 22)
                        {
                            line_.h22 = a;
                        }
                        else if (i == 23)
                        {
                            line_.h23 = a;
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Error: " + txthour.ID + " is not integer type');", true);
                        return;
                    }
                }
                for (int i = 0; i <= 6; i++)
                {
                    int     a       = 0;
                    string  hourStr = this.convertIntegerLessThan10(i);
                    Label   lblhour = (Label)row.FindControl("lbl" + hourStr + "H");
                    TextBox txthour = (TextBox)row.FindControl("txt" + hourStr + "H");
                    if (int.TryParse(txthour.Text, out a))
                    {
                        actualcount += a;
                        if (i == 0)
                        {
                            line_.h00 = a;
                        }
                        else if (i == 1)
                        {
                            line_.h01 = a;
                        }
                        else if (i == 2)
                        {
                            line_.h02 = a;
                        }
                        else if (i == 3)
                        {
                            line_.h03 = a;
                        }
                        else if (i == 4)
                        {
                            line_.h04 = a;
                        }
                        else if (i == 5)
                        {
                            line_.h05 = a;
                        }
                        else if (i == 6)
                        {
                            line_.h06 = a;
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Error: " + txthour.ID + " is not integer type');", true);
                        return;
                    }
                }
            }
            line_.actual = actualcount;
            line_.planid = planid;
            if (input.LineNightUpdate(line_))
            {
                if (DateTime.Now.Hour >= 7 && DateTime.Now.Hour <= 18)
                {
                    for (int i = 0; i <= 6; i++)
                    {
                        string  hourStr = this.convertIntegerLessThan10(i);
                        Label   lblhour = (Label)row.FindControl("lbl" + hourStr + "H");
                        TextBox txthour = (TextBox)row.FindControl("txt" + hourStr + "H");
                        lblhour.Text    = txthour.Text;
                        lblhour.Visible = true;
                        txthour.Visible = false;
                        setActiveRowEvent(row, false);
                    }
                    for (int i = 19; i <= 23; i++)
                    {
                        string  hourStr = this.convertIntegerLessThan10(i);
                        Label   lblhour = (Label)row.FindControl("lbl" + hourStr + "H");
                        TextBox txthour = (TextBox)row.FindControl("txt" + hourStr + "H");
                        lblhour.Text    = txthour.Text;
                        lblhour.Visible = true;
                        txthour.Visible = false;
                        setActiveRowEvent(row, false);
                    }
                    input_BLL.LineInputNight_ChangeActual(int.Parse(row.Cells[0].Text), true, planid);
                    Response.Redirect("ChangeActualInputNight.aspx");
                }
                else
                {
                    if (DateTime.Now.Hour >= 19 && DateTime.Now.Hour <= 23)
                    {
                        for (int i = 19; i <= DateTime.Now.Hour; i++)
                        {
                            string  hourStr = this.convertIntegerLessThan10(i);
                            Label   lblhour = (Label)row.FindControl("lbl" + hourStr + "H");
                            TextBox txthour = (TextBox)row.FindControl("txt" + hourStr + "H");
                            lblhour.Text    = txthour.Text;
                            lblhour.Visible = true;
                            txthour.Visible = false;
                            setActiveRowEvent(row, false);
                        }
                        input_BLL.LineInputNight_ChangeActual(int.Parse(row.Cells[0].Text), true, planid);
                        Response.Redirect("ChangeActualInputNight.aspx");
                    }
                    else
                    {
                        for (int i = 19; i <= 23; i++)
                        {
                            string  hourStr = this.convertIntegerLessThan10(i);
                            Label   lblhour = (Label)row.FindControl("lbl" + hourStr + "H");
                            TextBox txthour = (TextBox)row.FindControl("txt" + hourStr + "H");
                            lblhour.Text    = txthour.Text;
                            lblhour.Visible = true;
                            txthour.Visible = false;
                            setActiveRowEvent(row, false);
                        }
                        for (int i = 0; i <= DateTime.Now.Hour; i++)
                        {
                            string  hourStr = this.convertIntegerLessThan10(i);
                            Label   lblhour = (Label)row.FindControl("lbl" + hourStr + "H");
                            TextBox txthour = (TextBox)row.FindControl("txt" + hourStr + "H");
                            lblhour.Text    = txthour.Text;
                            lblhour.Visible = true;
                            txthour.Visible = false;
                            setActiveRowEvent(row, false);
                        }
                        input_BLL.LineInputNight_ChangeActual(int.Parse(row.Cells[0].Text), true, planid);
                        Response.Redirect("ChangeActualInputNight.aspx");
                    }
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Error: Can't save to Database, try again');", true);
                return;
            }
        }
コード例 #7
0
        public LineInputNight LineNight_GetStocking(int planid)
        {
            DataTable      dt    = new DataTable();
            LineInputNight line_ = new LineInputNight();

            using (SqlCommand command = new SqlCommand("Select * FROM  LineInputNight Where Model = @Model And PlanId= @PlanId", openConnection()))
            {
                command.Parameters.Add(new SqlParameter("@Model", "Stocking"));
                command.Parameters.Add(new SqlParameter("@PlanId", planid));
                SqlDataAdapter da = new SqlDataAdapter(command);
                da.Fill(dt);
                int i = 0;
                this.closeConnection();
                line_.line = int.Parse(dt.Rows[0]["LineName"].ToString());
                if (int.TryParse(dt.Rows[0]["Actual"].ToString(), out i))
                {
                    line_.actual = i;
                }
                if (int.TryParse(dt.Rows[0]["Plan"].ToString(), out i))
                {
                    line_.plan = i;
                }
                if (int.TryParse(dt.Rows[0]["Diff"].ToString(), out i))
                {
                    line_.diff = i;
                }
                if (int.TryParse(dt.Rows[0]["Target"].ToString(), out i))
                {
                    line_.target = i;
                }
                if (int.TryParse(dt.Rows[0]["H19"].ToString(), out i))
                {
                    line_.h19 = i;
                }
                if (int.TryParse(dt.Rows[0]["H20"].ToString(), out i))
                {
                    line_.h20 = i;
                }
                if (int.TryParse(dt.Rows[0]["H21"].ToString(), out i))
                {
                    line_.h21 = i;
                }
                if (int.TryParse(dt.Rows[0]["H22"].ToString(), out i))
                {
                    line_.h22 = i;
                }
                if (int.TryParse(dt.Rows[0]["H23"].ToString(), out i))
                {
                    line_.h23 = i;
                }
                if (int.TryParse(dt.Rows[0]["H00"].ToString(), out i))
                {
                    line_.h00 = i;
                }
                if (int.TryParse(dt.Rows[0]["H01"].ToString(), out i))
                {
                    line_.h01 = i;
                }
                if (int.TryParse(dt.Rows[0]["H02"].ToString(), out i))
                {
                    line_.h02 = i;
                }
                if (int.TryParse(dt.Rows[0]["H03"].ToString(), out i))
                {
                    line_.h03 = i;
                }
                if (int.TryParse(dt.Rows[0]["H04"].ToString(), out i))
                {
                    line_.h04 = i;
                }
                if (int.TryParse(dt.Rows[0]["H05"].ToString(), out i))
                {
                    line_.h05 = i;
                }
                if (int.TryParse(dt.Rows[0]["H06"].ToString(), out i))
                {
                    line_.h06 = i;
                }
                line_.comment = dt.Rows[0]["Comments"].ToString();
                line_.status  = dt.Rows[0]["Status"].ToString();
            }
            return(line_);
        }