public int EndTechnology(BaseProductionScheduleProductionProcessTable psppTable)
        {
            int result = 0;
            List <CommandInfo> listSql = new List <CommandInfo>();
            StringBuilder      strSql  = new StringBuilder();

            foreach (BaseProductionTechnologyTable lineModel in psppTable.ProductionTechnology)
            {
                strSql = new StringBuilder();
                strSql.Append("update BLL_PRODUCTION_SCHEDULE_TECHNOLOGY set ");
                strSql.Append("ACTUAL_END_TIME=@ACTUAL_END_TIME,");
                strSql.Append("STATUS_FLAG=@STATUS_FLAG");
                strSql.Append(" where SLIP_NUMBER=@SLIP_NUMBER");
                strSql.Append(" AND SCHEDULE_LINE_NUMBER=@SCHEDULE_LINE_NUMBER");
                strSql.Append(" AND SCHEDULE_PRODUCTION_PROCESS_LINE_NUNBER=@SCHEDULE_PRODUCTION_PROCESS_LINE_NUNBER");
                strSql.Append(" AND TECHNOLOGY_LINE_NUMBER=@TECHNOLOGY_LINE_NUMBER");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@ACTUAL_END_TIME",                         SqlDbType.DateTime),
                    new SqlParameter("@STATUS_FLAG",                             SqlDbType.Int,        9),
                    new SqlParameter("@SLIP_NUMBER",                             SqlDbType.VarChar,   50),
                    new SqlParameter("@SCHEDULE_LINE_NUMBER",                    SqlDbType.Int,        9),
                    new SqlParameter("@SCHEDULE_PRODUCTION_PROCESS_LINE_NUNBER", SqlDbType.Int,        9),
                    new SqlParameter("@TECHNOLOGY_LINE_NUMBER",                  SqlDbType.Int, 9)
                };
                parameters[0].Value = lineModel.ACTUAL_END_TIME;
                parameters[1].Value = lineModel.STATUS_FLAG;
                parameters[2].Value = lineModel.SLIP_NUMBER;
                parameters[3].Value = lineModel.SCHEDULE_LINE_NUMBER;
                parameters[4].Value = lineModel.SCHEDULE_PRODUCTION_PROCESS_LINE_NUNBER;
                parameters[5].Value = lineModel.LINE_NUMBER;
                listSql.Add(new CommandInfo(strSql.ToString(), parameters));
            }
            try
            {
                result = DbHelperSQL.ExecuteSqlTran(listSql);
            }
            catch (Exception ex)
            { }
            return(result);
        }
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (dgvData.Rows.Count < 1)
     {
         MessageBox.Show("工序不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     foreach (DataGridViewRow dr in dgvData.Rows)
     {
         if (CConvert.ToDateTime(CConvert.ToDateTime(dr.Cells["END_DATE"].Value).ToShortDateString()) > CConvert.ToDateTime(CConvert.ToDateTime(planTable.PLAN_END_DATE).ToShortDateString()))
         {
             if (DialogResult.OK == MessageBox.Show("此部件预定日期超出此工单预定完成日期,确定要调整吗,确定后不能返回?", this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1))
             {
                 foreach (BaseProductionPlanLineTable lineTable in planTable.Items)
                 {
                     if (lineTable.PARTS_CODE == PARTS_CODE)
                     {
                         lineTable.ProductionProcess.Clear();
                         lineTable.PLAN_START_DATE = CConvert.ToDateTime(dgvData.Rows[0].Cells["START_DATE"].Value.ToString());
                         lineTable.PLAN_END_DATE   = CConvert.ToDateTime(dgvData.Rows[dgvData.Rows.Count - 1].Cells["END_DATE"].Value.ToString());
                         int ProductionProcessLineNumber = 1;
                         foreach (DataGridViewRow dr2 in dgvData.Rows)
                         {
                             BaseProductionScheduleProductionProcessTable productionProcessTable = new BaseProductionScheduleProductionProcessTable();
                             productionProcessTable.PRODUCTION_PROCESS_CODE = CConvert.ToString(dr2.Cells["PRODUCTION_PROCESS_CODE"].Value);
                             productionProcessTable.PRODUCTION_PROCESS_NAME = CConvert.ToString(dr2.Cells["PRODUCTION_PROCESS_NAME"].Value);
                             productionProcessTable.DEPARTMENT_CODE         = CConvert.ToString(dr2.Cells["DEPARTMENT_CODE"].Value);
                             productionProcessTable.DEPARTMENT_NAME         = CConvert.ToString(dr2.Cells["DEPARTMENT_NAME"].Value);
                             productionProcessTable.PLAN_START_DATE         = CConvert.ToDateTime(dr2.Cells["START_DATE"].Value);
                             productionProcessTable.PLAN_END_DATE           = CConvert.ToDateTime(dr2.Cells["END_DATE"].Value);
                             productionProcessTable.LINE_NUMBER             = ProductionProcessLineNumber++;
                             productionProcessTable.SCHEDULE_LINE_NUNBER    = lineTable.LINE_NUMBER;
                             productionProcessTable.PRODUCTION_CYCLE        = CConvert.ToInt32(dr2.Cells["PRODUCTION_CYCLE"].Value);
                             lineTable.AddProductionProcess(productionProcessTable);
                         }
                     }
                 }
                 result = DialogResult.OK;
                 this.Close();
             }
             else
             {
                 dgvData.Rows.Clear();
                 foreach (BaseProductionPlanLineTable lineTable in planTable.Items)
                 {
                     if (lineTable.PARTS_CODE == PARTS_CODE)
                     {
                         foreach (BaseProductionScheduleProductionProcessTable productionProcessTable in lineTable.ProductionProcess)
                         {
                             object[] dgvr = { "", productionProcessTable.PRODUCTION_PROCESS_CODE, productionProcessTable.PRODUCTION_PROCESS_NAME, productionProcessTable.DEPARTMENT_CODE, productionProcessTable.DEPARTMENT_NAME, productionProcessTable.PLAN_START_DATE, productionProcessTable.PLAN_END_DATE, productionProcessTable.STATUS_FLAG };
                             dgvData.Rows.Add(dgvr);
                         }
                     }
                 }
                 foreach (DataGridViewRow dr1 in dgvData.Rows)
                 {
                     string   dateDiff = null;
                     TimeSpan ts1      = new TimeSpan(CConvert.ToDateTime(CConvert.ToDateTime(dr1.Cells["START_DATE"].Value).ToShortDateString()).Ticks);
                     TimeSpan ts2      = new TimeSpan(CConvert.ToDateTime(CConvert.ToDateTime(dr1.Cells["END_DATE"].Value).ToShortDateString()).Ticks);
                     TimeSpan ts       = ts1.Subtract(ts2).Duration();
                     dateDiff = ts.Days.ToString();
                     dr1.Cells["PRODUCTION_CYCLE"].Value = CConvert.ToInt32(dateDiff);
                     if (CConstant.PRODUCTIONPLAN_OPERATE.Equals(CTag) || CConstant.PRODUCTIONPLAN_MODIFY.Equals(CTag))
                     {
                         if (CConvert.ToInt32(dr1.Cells["FLAG"].Value).Equals(2))
                         {
                             dr1.Cells["STATUS_FLAG"].Value         = "已结束";
                             dr1.Cells["PRODUCTION_CYCLE"].ReadOnly = true;
                         }
                         else
                         {
                             dr1.Cells["STATUS_FLAG"].Value = "未结束";
                         }
                     }
                 }
             }
             break;
         }
     }
 }
        private void btnEndDrawing_Click(object sender, EventArgs e)
        {
            BaseProductionPlanLineTable planline  = new BaseProductionPlanLineTable();
            BaseProductionPlanTable     planTable = new BaseProductionPlanTable();
            BaseProductionScheduleProductionProcessTable bpsppmodel = null;
            int CHKchooseCount = 0;

            foreach (DataGridViewRow dr in dgvData.Rows)
            {
                if (Convert.ToBoolean(dr.Cells["CHK"].Value) == true)
                {
                    CHKchooseCount++;
                }
            }
            if (CHKchooseCount < 1)
            {
                MessageBox.Show("请选择数据!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string CHKSLIPNUMBER = "";

            for (int i = 0; i < dgvData.Rows.Count; i++)
            {
                bpsppmodel = new BaseProductionScheduleProductionProcessTable();
                if (Convert.ToBoolean(dgvData.Rows[i].Cells["CHK"].Value) == true)
                {
                    DataGridViewRow row = dgvData.Rows[i];
                    if (CHKSLIPNUMBER == "")
                    {
                        CHKSLIPNUMBER = row.Cells["PSDL_SLIP_NUMBER"].Value.ToString();
                    }
                    else if (CHKSLIPNUMBER != row.Cells["PSDL_SLIP_NUMBER"].Value.ToString())
                    {
                        MessageBox.Show("您选择的生产工单不相同,请重新选择!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    if (row.Cells["PSDL_STATUS_FLAG"].Value.ToString() == CConvert.ToString(CConstant.STATUS))
                    {
                        if (row.Cells["PSDL_ACTUAL_END_TIME"].Value.ToString() != "")
                        {
                            bpsppmodel.ACTUAL_END_TIME = Convert.ToDateTime(row.Cells["PSDL_ACTUAL_END_TIME"].Value.ToString());
                        }
                        else
                        {
                            MessageBox.Show("您选择的生产工单图纸加工结束日期不能为空!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }

                        bpsppmodel.STATUS_FLAG = 1;
                        bpsppmodel.SLIP_NUMBER = row.Cells["PSDL_SLIP_NUMBER"].Value.ToString();
                        bpsppmodel.LINE_NUMBER = Convert.ToInt32(row.Cells["PSDL_LINE_NUMBER"].Value.ToString());
                        //planTable.a
                        planline.AddProductionProcess(bpsppmodel);
                    }

                    else if (row.Cells["PSDL_STATUS_FLAG"].Value.ToString() == CConvert.ToString(CConstant.STATUS_START))
                    {
                        MessageBox.Show("您选择的生产工单图纸加工已结束!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
            }
            try
            {
                int result = bProductionDrawing.EndDrawing(planline);
                if (result < 1)
                {
                    MessageBox.Show("您选择的生产工单图纸加工结束失败,请检查数据。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("您选择的生产工单图纸加工结束成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Search();
                }
            }
            catch (Exception ex)
            { }
        }
示例#4
0
        private void btnEnd_Click(object sender, EventArgs e)
        {
            BaseProductionPlanLineTable planline  = new BaseProductionPlanLineTable();
            BaseProductionPlanTable     PlanTable = new BaseProductionPlanTable();
            BaseProductionScheduleProductionProcessTable psppTable = new BaseProductionScheduleProductionProcessTable();
            BaseProductionTechnologyTable productionTechnology     = null;
            int CHKchooseCount = 0;

            foreach (DataGridViewRow dr in dgvData.Rows)
            {
                if (Convert.ToBoolean(dr.Cells["CHK"].Value) == true)
                {
                    CHKchooseCount++;
                }
            }
            if (CHKchooseCount < 1)
            {
                MessageBox.Show("请选择结束的数据!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string CHKSLIPNUMBER = "";

            for (int i = 0; i < dgvData.Rows.Count; i++)
            {
                productionTechnology = new BaseProductionTechnologyTable();
                if (Convert.ToBoolean(dgvData.Rows[i].Cells["CHK"].Value) == true)
                {
                    DataGridViewRow row = dgvData.Rows[i];
                    if (CHKSLIPNUMBER == "")
                    {
                        CHKSLIPNUMBER = row.Cells["SLIP_NUMBER"].Value.ToString();
                    }
                    else if (CHKSLIPNUMBER != row.Cells["SLIP_NUMBER"].Value.ToString())
                    {
                        MessageBox.Show("您选择的生产工单不相同,请重新选择!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    if (row.Cells["PST_STATUS_FLAG"].Value.ToString() == CConvert.ToString(CConstant.STATUS))
                    {
                        if (row.Cells["END_DATE"].Value.ToString() != "")
                        {
                            productionTechnology.ACTUAL_END_TIME = CConvert.ToDateTime(row.Cells["END_DATE"].Value.ToString());
                        }
                        else
                        {
                            MessageBox.Show("您选择的生产工单技术结束日期不能为空!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }

                        productionTechnology.STATUS_FLAG          = CConvert.ToInt32(CConstant.STATUS_START);
                        productionTechnology.SLIP_NUMBER          = row.Cells["SLIP_NUMBER"].Value.ToString();
                        productionTechnology.SCHEDULE_LINE_NUMBER = CConvert.ToInt32(row.Cells["PST_SCHEDULE_LINE_NUMBER"].Value.ToString());
                        productionTechnology.SCHEDULE_PRODUCTION_PROCESS_LINE_NUNBER = CConvert.ToInt32(row.Cells["PST_SCHEDULE_PRODUCTION_PROCESS_LINE_NUNBER"].Value.ToString());
                        productionTechnology.LINE_NUMBER = CConvert.ToInt32(row.Cells["PST_TECHNOLOGY_LINE_NUMBER"].Value.ToString());
                        psppTable.AddProductionTechnology(productionTechnology);
                    }

                    else if (row.Cells["PST_STATUS_FLAG"].Value.ToString() == CConvert.ToString(CConstant.STATUS_START))
                    {
                        MessageBox.Show("您选择的生产工单技术已结束!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
            }

            try
            {
                int result = bProductionPlanSearch.EndTechnology(psppTable);
                if (result < 1)
                {
                    MessageBox.Show("您选择的生产工单技术结束失败,请检查数据。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("您选择的生产工单技术结束成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtSlipNumber.Text      = "";
                    cboStatus.SelectedIndex = 0;
                    Search();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("您选择的生产工单技术结束失败,请检查数据。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#5
0
 public int EndTechnology(BaseProductionScheduleProductionProcessTable psppTable)
 {
     return(dal.EndTechnology(psppTable));
 }
示例#6
0
        private void btnEnd_Click(object sender, EventArgs e)
        {
            BaseProductionPlanLineTable planline  = new BaseProductionPlanLineTable();
            BaseProductionPlanTable     PlanTable = new BaseProductionPlanTable();
            BaseProductionScheduleProductionProcessTable bpsppmodel = null;
            int CHKchooseCount = 0;

            foreach (DataGridViewRow dr in dgvData.Rows)
            {
                if (Convert.ToBoolean(dr.Cells["CHK"].Value) == true)
                {
                    CHKchooseCount++;
                }
            }
            if (CHKchooseCount < 1)
            {
                MessageBox.Show("请选择加工结束的数据!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string CHKSLIPNUMBER = "";

            for (int i = 0; i < dgvData.Rows.Count; i++)
            {
                bpsppmodel = new BaseProductionScheduleProductionProcessTable();
                if (Convert.ToBoolean(dgvData.Rows[i].Cells["CHK"].Value) == true)
                {
                    DataGridViewRow row = dgvData.Rows[i];
                    if (CHKSLIPNUMBER == "")
                    {
                        CHKSLIPNUMBER = row.Cells["SLIP_NUMBER"].Value.ToString();
                    }
                    else if (CHKSLIPNUMBER != row.Cells["SLIP_NUMBER"].Value.ToString())
                    {
                        MessageBox.Show("您选择的生产工单不相同,请重新选择!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    if (row.Cells["PSPP_STATUS_FLAG"].Value.ToString() == CConvert.ToString(CConstant.STATUS_START))
                    {
                        bpsppmodel.ACTUAL_START_TIME = Convert.ToDateTime(row.Cells["PSPP_ACTUAL_START_TIME"].Value.ToString());
                        if (row.Cells["PSPP_ACTUAL_END_TIME"].Value.ToString() != "")
                        {
                            bpsppmodel.ACTUAL_END_TIME = Convert.ToDateTime(row.Cells["PSPP_ACTUAL_END_TIME"].Value.ToString());
                        }
                        else
                        {
                            MessageBox.Show("您选择的生产工单加工结束日期不能为空!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }

                        if (DateTime.Compare(Convert.ToDateTime(bpsppmodel.ACTUAL_START_TIME), Convert.ToDateTime(bpsppmodel.ACTUAL_END_TIME)) > 0)
                        {
                            MessageBox.Show("您选择的生产工单加工开始日期不能大于加工结束日期!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                        bpsppmodel.STATUS_FLAG          = 2;
                        bpsppmodel.SLIP_NUMBER          = row.Cells["SLIP_NUMBER"].Value.ToString();
                        bpsppmodel.SCHEDULE_LINE_NUNBER = Convert.ToInt32(row.Cells["SCHEDULE_LINE_NUNBER"].Value.ToString());
                        bpsppmodel.LINE_NUMBER          = Convert.ToInt32(row.Cells["PSPP_LINE_NUMBER"].Value.ToString());
                        if (row.Cells["WEIGHT"].Value != null)
                        {
                            bpsppmodel.WEIGHT = row.Cells["WEIGHT"].Value.ToString();
                        }
                        PlanTable.AddItemProductionProcess(bpsppmodel);
                    }
                    else if (row.Cells["PSPP_STATUS_FLAG"].Value.ToString() == CConvert.ToString(CConstant.STATUS))
                    {
                        MessageBox.Show("您选择的生产工单加工未开始!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    else if (row.Cells["PSPP_STATUS_FLAG"].Value.ToString() == CConvert.ToString(CConstant.STATUS_END))
                    {
                        MessageBox.Show("您选择的生产工单加工已结束!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
            }

            try
            {
                int result = bProductionPlanSearch.StartProcessing(PlanTable);
                if (result < 1)
                {
                    MessageBox.Show("您选择的生产工单加工结束失败,请检查数据。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    foreach (BaseProductionScheduleProductionProcessTable bpspptable in PlanTable.ItemsProductionProcess)
                    {//+ " AND SCHEDULE_LINE_NUNBER=" + bpspptable.SCHEDULE_LINE_NUNBER
                        string  strWhere  = "SLIP_NUMBER=" + bpspptable.SLIP_NUMBER;
                        DataSet ds        = bProductionPlanSearch.GetProductionPlan(strWhere);
                        int     status    = 0;
                        int     endstatus = 0;
                        int     count     = ds.Tables[0].Rows.Count;
                        foreach (DataRow dt in ds.Tables[0].Rows)
                        {
                            if (Convert.ToInt32(dt["PSPP_STATUS_FLAG"]) == CConvert.ToInt32(CConstant.STATUS))
                            {
                                status++;
                            }
                            else if (Convert.ToInt32(dt["PSPP_STATUS_FLAG"]) == CConvert.ToInt32(CConstant.STATUS_END))
                            {
                                endstatus++;
                            }
                        }
                        if (status == count)
                        {
                        }
                        else if (endstatus == count)
                        {
                            planline             = new BaseProductionPlanLineTable();
                            planline.SLIP_NUMBER = bpspptable.SLIP_NUMBER;
                            planline.LINE_NUMBER = Convert.ToInt32(bpspptable.SCHEDULE_LINE_NUNBER);
                            planline.STATUS_FLAG = CConvert.ToInt32(CConstant.STATUS_END);
                            PlanTable.AddItem(planline);
                        }
                        else
                        {
                            planline             = new BaseProductionPlanLineTable();
                            planline.SLIP_NUMBER = bpspptable.SLIP_NUMBER;
                            planline.LINE_NUMBER = Convert.ToInt32(bpspptable.SCHEDULE_LINE_NUNBER);
                            planline.STATUS_FLAG = CConvert.ToInt32(CConstant.STATUS_START);
                            PlanTable.AddItem(planline);
                        }
                    }

                    try
                    {
                        int resultstatus = bProductionPlanSearch.LineStatus(PlanTable);
                    }
                    catch (Exception ex)
                    {
                    }
                    foreach (BaseProductionScheduleProductionProcessTable bpspptable in PlanTable.ItemsProductionProcess)
                    {
                        //更改status
                        string  strWhere1         = "SLIP_NUMBER=" + bpspptable.SLIP_NUMBER;
                        DataSet scheduleds        = bProductionPlanSearch.GetProductionPlan(strWhere1);
                        int     schedulestatus    = 0;
                        int     scheduleendstatus = 0;
                        int     schedulecount     = scheduleds.Tables[0].Rows.Count;
                        foreach (DataRow dt in scheduleds.Tables[0].Rows)
                        {
                            if (Convert.ToInt32(dt["PSL_STATUS_FLAG"]) == CConvert.ToInt32(CConstant.STATUS))
                            {
                                schedulestatus++;
                            }
                            else if (Convert.ToInt32(dt["PSL_STATUS_FLAG"]) == CConvert.ToInt32(CConstant.STATUS_END))
                            {
                                scheduleendstatus++;
                            }
                        }
                        if (schedulestatus == schedulecount)
                        {
                        }
                        else if (scheduleendstatus == schedulecount)
                        {
                            PlanTable.SLIP_NUMBER = bpspptable.SLIP_NUMBER;
                            PlanTable.STATUS_FLAG = CConvert.ToInt32(CConstant.STATUS_END);

                            PlanTable.ACTUAL_END_TIME = CConvert.ToDateTime(scheduleds.Tables[0].Compute("Max(PSPP_ACTUAL_END_TIME)", "true"));
                        }
                        else
                        {
                            PlanTable.SLIP_NUMBER = bpspptable.SLIP_NUMBER;
                            PlanTable.STATUS_FLAG = CConvert.ToInt32(CConstant.STATUS_START);
                        }
                    }
                    try
                    {
                        int resultschedule = bProductionPlanSearch.Status(PlanTable);
                    }
                    catch (Exception ex)
                    {
                    }

                    MessageBox.Show("您选择的生产工单加工结束成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtSlipNumber.Text      = "";
                    cboStatus.SelectedIndex = 0;
                    Search();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("您选择的生产工单加工结束失败,请检查数据。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#7
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BaseProductionPlanTable GetModel(string SLIP_NUMBER)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  * from bll_production_schedule_model_view ");
            strSql.Append(" where SLIP_NUMBER=@SLIP_NUMBER ");
            strSql.Append(" order by LINE_NUMBER ,PSPP_LINE_NUMBER ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SLIP_NUMBER", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = SLIP_NUMBER;
            BaseProductionPlanTable     model     = null;
            BaseProductionPlanLineTable modelLine = new BaseProductionPlanLineTable();
            DataSet ds                = DbHelperSQL.Query(strSql.ToString(), parameters);
            bool    isFirst           = true;
            int     currentLineNumber = 0;

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                if (isFirst)
                {
                    isFirst                 = false;
                    model                   = new BaseProductionPlanTable();
                    model.SLIP_NUMBER       = dr["SLIP_NUMBER"].ToString();
                    model.ORDER_SLIP_NUNBER = dr["ORDER_SLIP_NUNBER"].ToString();
                    if (dr["SLIP_DATE"].ToString() != "")
                    {
                        model.SLIP_DATE = DateTime.Parse(dr["SLIP_DATE"].ToString());
                    }
                    model.SLIP_TYPE_CODE = dr["SLIP_TYPE_CODE"].ToString();
                    model.SPEC           = dr["DESCRIPTION"].ToString();
                    if (dr["PLAN_NUMBER"].ToString() != "")
                    {
                        model.PLAN_QUANTITY = decimal.Parse(dr["PLAN_NUMBER"].ToString());
                    }
                    if (dr["PLAN_START_DATE"].ToString() != "")
                    {
                        model.PLAN_START_DATE = DateTime.Parse(dr["PLAN_START_DATE"].ToString());
                    }
                    if (dr["PLAN_END_DATE"].ToString() != "")
                    {
                        model.PLAN_END_DATE = DateTime.Parse(dr["PLAN_END_DATE"].ToString());
                    }
                    if (dr["ACTUAL_START_TIME"].ToString() != "")
                    {
                        model.ACTUAL_START_TIME = DateTime.Parse(dr["ACTUAL_START_TIME"].ToString());
                    }
                    if (dr["ACTUAL_END_TIME"].ToString() != "")
                    {
                        model.ACTUAL_END_TIME = DateTime.Parse(dr["ACTUAL_END_TIME"].ToString());
                    }
                    model.MEMO  = dr["MEMO"].ToString();
                    model.MEMO1 = dr["MEMO1"].ToString();
                    model.MEMO2 = dr["MEMO2"].ToString();
                    model.MEMO3 = dr["MEMO3"].ToString();
                    if (dr["STATUS_FLAG"].ToString() != "")
                    {
                        model.STATUS_FLAG = int.Parse(dr["STATUS_FLAG"].ToString());
                    }
                    model.CREATE_USER = dr["CREATE_USER"].ToString();
                    if (dr["CREATE_DATE_TIME"].ToString() != "")
                    {
                        model.CREATE_DATE_TIME = DateTime.Parse(dr["CREATE_DATE_TIME"].ToString());
                    }
                    if (dr["LAST_UPDATE_TIME"].ToString() != "")
                    {
                        model.LAST_UPDATE_TIME = DateTime.Parse(dr["LAST_UPDATE_TIME"].ToString());
                    }
                    model.LAST_UPDATE_USER = dr["LAST_UPDATE_USER"].ToString();
                    model.SLIP_TYPE_NAME   = dr["SLIP_TYPE_NAME"].ToString();
                }
                int lineNumber = CConvert.ToInt32(dr["LINE_NUMBER"]);
                if (currentLineNumber != lineNumber)
                {
                    if (currentLineNumber != 0)
                    {
                        model.AddItem(modelLine);
                    }
                    currentLineNumber     = lineNumber;
                    modelLine             = new BaseProductionPlanLineTable();
                    modelLine.LINE_NUMBER = lineNumber;
                    modelLine.PARTS_CODE  = dr["PARTS_CODE"].ToString();
                    if (dr["PSL_PLAN_START_DATE"].ToString() != "")
                    {
                        modelLine.PLAN_START_DATE = DateTime.Parse(dr["PSL_PLAN_START_DATE"].ToString());
                    }
                    if (dr["PSL_PLAN_END_DATE"].ToString() != "")
                    {
                        modelLine.PLAN_END_DATE = DateTime.Parse(dr["PSL_PLAN_END_DATE"].ToString());
                    }
                    if (dr["PSL_PLAN_NUMBER"].ToString() != "")
                    {
                        modelLine.PLAN_NUMBER = decimal.Parse(dr["PSL_PLAN_NUMBER"].ToString());
                    }
                    if (dr["SCHEDULE_FLAG"].ToString() != "")
                    {
                        modelLine.SCHEDULE_FLAG = int.Parse(dr["SCHEDULE_FLAG"].ToString());
                    }
                    if (dr["PSL_ACTUAL_START_TIME"].ToString() != "")
                    {
                        modelLine.ACTUAL_START_TIME = DateTime.Parse(dr["PSL_ACTUAL_START_TIME"].ToString());
                    }
                    if (dr["PSL_ACTUAL_END_TIME"].ToString() != "")
                    {
                        modelLine.ACTUAL_END_TIME = DateTime.Parse(dr["PSL_ACTUAL_END_TIME"].ToString());
                    }
                    if (dr["PSL_STATUS_FLAG"].ToString() != "")
                    {
                        modelLine.STATUS_FLAG = int.Parse(dr["PSL_STATUS_FLAG"].ToString());
                    }
                    modelLine.PARTS_NAME = dr["PARTS_NAME"].ToString();
                }

                BaseProductionScheduleProductionProcessTable productionprocessTable = new BaseProductionScheduleProductionProcessTable();
                if (dr["PSPP_LINE_NUMBER"].ToString() != "")
                {
                    productionprocessTable.LINE_NUMBER = int.Parse(dr["PSPP_LINE_NUMBER"].ToString());
                }
                if (dr["SCHEDULE_LINE_NUNBER"].ToString() != "")
                {
                    productionprocessTable.SCHEDULE_LINE_NUNBER = int.Parse(dr["SCHEDULE_LINE_NUNBER"].ToString());
                }
                productionprocessTable.PRODUCTION_PROCESS_CODE = dr["PRODUCTION_PROCESS_CODE"].ToString();
                if (dr["PSPP_PLAN_START_DATE"].ToString() != "")
                {
                    productionprocessTable.PLAN_START_DATE = DateTime.Parse(dr["PSPP_PLAN_START_DATE"].ToString());
                }
                if (dr["PSPP_PLAN_END_DATE"].ToString() != "")
                {
                    productionprocessTable.PLAN_END_DATE = DateTime.Parse(dr["PSPP_PLAN_END_DATE"].ToString());
                }
                if (dr["PSPP_STATUS_FLAG"].ToString() != "")
                {
                    productionprocessTable.STATUS_FLAG = int.Parse(dr["PSPP_STATUS_FLAG"].ToString());
                }
                if (dr["PSPP_ACTUAL_START_TIME"].ToString() != "")
                {
                    productionprocessTable.ACTUAL_START_TIME = DateTime.Parse(dr["PSPP_ACTUAL_START_TIME"].ToString());
                }
                if (dr["PSPP_ACTUAL_END_TIME"].ToString() != "")
                {
                    productionprocessTable.ACTUAL_END_TIME = DateTime.Parse(dr["PSPP_ACTUAL_END_TIME"].ToString());
                }
                productionprocessTable.PRODUCTION_PROCESS_NAME = dr["PRODUCTION_PROCESS_NAME"].ToString();
                productionprocessTable.DEPARTMENT_CODE         = dr["DEPARTMENT_CODE"].ToString();
                productionprocessTable.DEPARTMENT_NAME         = dr["DEPARTMENT_NAME"].ToString();
                productionprocessTable.PRODUCTION_CYCLE        = CConvert.ToDecimal(dr["PRODUCTION_CYCLE"].ToString());
                modelLine.AddProductionProcess(productionprocessTable);
            }

            if (model != null)
            {
                model.AddItem(modelLine);
            }

            return(model);
        }