Exemplo n.º 1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                TowelProductionPlanDtsStep MasterEntity = (TowelProductionPlanDtsStep)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM WO_TowelProductionPlanDtsStep WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID);
                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(Sql);
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(Sql);
                }

                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 检验字段值是否已存在
        /// </summary>
        /// <param name="p_TableName">表名</param>
        /// <param name="p_FieldName">字段名</param>
        /// <param name="p_FieldValue">字段值</param>
        /// <param name="p_KeyField">主键(只考虑主键为ID的情况)</param>
        /// <param name="p_KeyValue">主键值</param>
        /// <param name="p_sqlTrans"></param>
        /// <returns></returns>
        private bool CheckFieldValueIsExist(BaseEntity p_BE, string p_FieldName, string p_FieldValue, IDBTransAccess p_sqlTrans)
        {
            TowelProductionPlanDtsStep entity = (TowelProductionPlanDtsStep)p_BE;
            bool      ret = false;
            string    sql = string.Format(" SELECT {0} FROM {1} WHERE 1=1 AND {0}={2} AND {3}<>{4}", p_FieldName, TowelProductionPlanDtsStep.TableName, SysString.ToDBString(p_FieldValue), "ID", entity.ID);
            DataTable dt  = p_sqlTrans.Fill(sql);

            if (dt.Rows.Count != 0)
            {
                ret = true;
            }

            return(ret);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="p_BE">要删除的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         TowelProductionPlanDtsStep    entity  = (TowelProductionPlanDtsStep)p_BE;
         TowelProductionPlanDtsStepCtl control = new TowelProductionPlanDtsStepCtl(sqlTrans);
         control.Delete(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 新增(传入事务处理)
 /// </summary>
 /// <param name="p_BE">要新增的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         TowelProductionPlanDtsStep    entity  = (TowelProductionPlanDtsStep)p_BE;
         TowelProductionPlanDtsStepCtl control = new TowelProductionPlanDtsStepCtl(sqlTrans);
         entity.ID = (int)EntityIDTable.GetID((long)SysEntity.WO_TowelProductionPlanDtsStep, sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                TowelProductionPlanDtsStep MasterEntity = (TowelProductionPlanDtsStep)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO WO_TowelProductionPlanDtsStep(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("ID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ",");
                MasterField.Append("MainID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MainID) + ",");
                MasterField.Append("DtsID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DtsID) + ",");
                MasterField.Append("SubSeq" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SubSeq) + ",");
                MasterField.Append("StepID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.StepID) + ",");
                MasterField.Append("CardNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CardNo) + ",");
                MasterField.Append("RecQty" + ",");
                if (MasterEntity.RecQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.RecQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("RecDate" + ",");
                if (MasterEntity.RecDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.RecDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("ZPQty" + ",");
                if (MasterEntity.ZPQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.ZPQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("CPQty" + ",");
                if (MasterEntity.CPQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.CPQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("CompleteDate" + ",");
                if (MasterEntity.CompleteDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.CompleteDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("MakeOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MakeOPID) + ",");
                MasterField.Append("ProOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ProOPID) + ",");
                MasterField.Append("Remark" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ")");



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                TowelProductionPlanDtsStep MasterEntity = (TowelProductionPlanDtsStep)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE WO_TowelProductionPlanDtsStep SET ");
                UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ",");
                UpdateBuilder.Append(" MainID=" + SysString.ToDBString(MasterEntity.MainID) + ",");
                UpdateBuilder.Append(" DtsID=" + SysString.ToDBString(MasterEntity.DtsID) + ",");
                UpdateBuilder.Append(" SubSeq=" + SysString.ToDBString(MasterEntity.SubSeq) + ",");
                UpdateBuilder.Append(" StepID=" + SysString.ToDBString(MasterEntity.StepID) + ",");
                UpdateBuilder.Append(" CardNo=" + SysString.ToDBString(MasterEntity.CardNo) + ",");

                if (MasterEntity.RecQty != 0)
                {
                    UpdateBuilder.Append(" RecQty=" + SysString.ToDBString(MasterEntity.RecQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" RecQty=null,");
                }


                if (MasterEntity.RecDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" RecDate=" + SysString.ToDBString(MasterEntity.RecDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" RecDate=null,");
                }


                if (MasterEntity.ZPQty != 0)
                {
                    UpdateBuilder.Append(" ZPQty=" + SysString.ToDBString(MasterEntity.ZPQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" ZPQty=null,");
                }


                if (MasterEntity.CPQty != 0)
                {
                    UpdateBuilder.Append(" CPQty=" + SysString.ToDBString(MasterEntity.CPQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" CPQty=null,");
                }


                if (MasterEntity.CompleteDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" CompleteDate=" + SysString.ToDBString(MasterEntity.CompleteDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" CompleteDate=null,");
                }

                UpdateBuilder.Append(" MakeOPID=" + SysString.ToDBString(MasterEntity.MakeOPID) + ",");
                UpdateBuilder.Append(" ProOPID=" + SysString.ToDBString(MasterEntity.ProOPID) + ",");
                UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark));

                UpdateBuilder.Append(" WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID));



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E);
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// 检查将要操作的数据是否符合业务规则
 /// </summary>
 /// <param name="p_BE"></param>
 private void CheckCorrect(BaseEntity p_BE)
 {
     TowelProductionPlanDtsStep entity = (TowelProductionPlanDtsStep)p_BE;
 }
Exemplo n.º 8
0
        /// <summary>
        /// 退回上一站  删除本站保存的信息  将站别-1
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnBack_Click(object sender, EventArgs e)
        {
            try
            {
                this.BaseFocusLabel.Focus();
                int MainID = SysConvert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MainID"));
                int DtsID  = SysConvert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "DtsID"));
                int SubSeq = SysConvert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "SubSeq"));
                int StepID = SysConvert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "StepID"));
                int KBFlag = SysConvert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "KBFlag"));
                int ID     = 0;

                //1
                #region  除卡号信息
                string sql = " select * from WO_TowelProductionPlanDtsStep where 1=1 ";
                sql += " and MainID = " + MainID;
                sql += " and DtsID = " + DtsID;
                sql += " and SubSeq = " + SubSeq;
                sql += " and StepID = " + StepID;
                DataTable dt = SysUtils.Fill(sql);
                if (dt.Rows.Count == 1)
                {
                    ID = SysConvert.ToInt32(dt.Rows[0]["ID"]);
                    TowelProductionPlanDtsStep     entityStep = new TowelProductionPlanDtsStep();
                    TowelProductionPlanDtsStepRule Steprule   = new TowelProductionPlanDtsStepRule();
                    entityStep.ID = ID;
                    entityStep.SelectByID();
                    Steprule.RDelete(entityStep);
                }
                #endregion

                //2
                #region  除工人产量信息
                sql  = " select * from WO_TowelProductionPlanDtsStepProducts where 1=1 ";
                sql += " and MainID = " + MainID;
                sql += " and DtsID = " + DtsID;
                sql += " and SubSeq = " + SubSeq;
                sql += " and StepID = " + StepID;
                dt   = SysUtils.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    sql  = " delete from WO_TowelProductionPlanDtsStepProducts where 1=1 ";
                    sql += " and MainID = " + MainID;
                    sql += " and DtsID = " + DtsID;
                    sql += " and SubSeq = " + SubSeq;
                    sql += " and StepID = " + StepID;
                    SysUtils.ExecuteNonQuery(sql);
                }
                #endregion

                //3站别-
                TowelProductionPlanDts     entity = new TowelProductionPlanDts();
                TowelProductionPlanDtsRule rule   = new TowelProductionPlanDtsRule();
                entity.ID = DtsID;
                entity.SelectByID();
                if (entity.StepID > 1)//如果站别大于1
                {
                    if (this.FormListAID == (int)EnumWOType.拷边 || this.FormListAID == (int)EnumWOType.缝边)
                    {
                        if (KBFlag == 1)//拷边的 退一站 否则退两站
                        {
                            entity.StepID = StepID - 1;
                        }
                        else
                        {
                            entity.StepID = StepID - 2;
                        }
                    }
                    else
                    {
                        entity.StepID = StepID - 1;
                    }
                }
                rule.RUpdate(entity);

                GetCondtion();
                BindGrid();
            }
            catch (Exception E)
            {
                this.ShowMessage(E.Message);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 进入下一站  更新当前站完成日期 将站别+1
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnNext_Click(object sender, EventArgs e)
        {
            try
            {
                this.BaseFocusLabel.Focus();
                int MainID = SysConvert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MainID"));
                int DtsID  = SysConvert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "DtsID"));
                int SubSeq = SysConvert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "SubSeq"));
                int StepID = SysConvert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "StepID"));
                int KBFlag = SysConvert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "KBFlag"));
                int ID     = 0;

                string sql = " select * from WO_TowelProductionPlanDtsStep where 1=1 ";
                sql += " and MainID = " + MainID;
                sql += " and DtsID = " + DtsID;
                sql += " and SubSeq = " + SubSeq;
                sql += " and StepID = " + StepID;
                DataTable dt = SysUtils.Fill(sql);
                if (dt.Rows.Count == 1)
                {
                    ID = SysConvert.ToInt32(dt.Rows[0]["ID"]);
                    TowelProductionPlanDtsStep     entityStep = new TowelProductionPlanDtsStep();
                    TowelProductionPlanDtsStepRule Steprule   = new TowelProductionPlanDtsStepRule();
                    entityStep.ID = ID;
                    entityStep.SelectByID();

                    decimal QtyAll = SysConvert.ToDecimal(entityStep.ZPQty) + SysConvert.ToDecimal(entityStep.CPQty);
                    if (QtyAll <= 0)
                    {
                        this.ShowInfoMessage("请输入正品数、次品数");
                        txtZPQty.Focus();
                        return;
                    }

                    entityStep.CompleteDate = DateTime.Now;
                    Steprule.RUpdate(entityStep);
                }
                else
                {
                    this.ShowInfoMessage("请先保存数据");
                    return;
                }


                TowelProductionPlanDts     entity = new TowelProductionPlanDts();
                TowelProductionPlanDtsRule rule   = new TowelProductionPlanDtsRule();
                entity.ID = DtsID;
                entity.SelectByID();

                if (this.FormListAID == (int)EnumWOType.剪片) //在剪片这一站需要判断是否要拷边
                {
                    if (KBFlag == 1)                        //拷边标志=1  需要拷边 加一站
                    {
                        entity.StepID = StepID + 1;
                    }
                    else
                    {
                        entity.StepID = StepID + 2;
                    }
                }
                else
                {
                    entity.StepID = StepID + 1;
                }


                rule.RUpdate(entity);

                GetCondtion();
                BindGrid();
                ProcessGrid.GridViewFocus(gridView1, new string[] { "DtsID" }, new string[] { DtsID.ToString() });
            }
            catch (Exception E)
            {
                this.ShowMessage(E.Message);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// 保存  保存当前站输入的信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            try
            {
                this.BaseFocusLabel.Focus();
                int MainID = SysConvert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MainID"));
                int DtsID  = SysConvert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "DtsID"));
                int SubSeq = SysConvert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "SubSeq"));
                int StepID = SysConvert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "StepID"));
                int ID     = 0;

                //保存卡号等信息
                #region 保存卡号等信息
                string sql = " select * from WO_TowelProductionPlanDtsStep where 1=1 ";
                sql += " and MainID = " + MainID;
                sql += " and DtsID = " + DtsID;
                sql += " and SubSeq = " + SubSeq;
                sql += " and StepID = " + StepID;
                DataTable dt = SysUtils.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    ID = SysConvert.ToInt32(dt.Rows[0]["ID"]);
                }

                TowelProductionPlanDtsStep     entity = new TowelProductionPlanDtsStep();
                TowelProductionPlanDtsStepRule rule   = new TowelProductionPlanDtsStepRule();
                entity.ID = ID;
                entity.SelectByID();

                entity.MainID   = MainID;
                entity.DtsID    = DtsID;
                entity.SubSeq   = SubSeq;
                entity.StepID   = this.FormListAID;//站别为当前 FormListAID
                entity.CardNo   = SysConvert.ToString(txtCardNo.Text.Trim());
                entity.RecQty   = SysConvert.ToDecimal(txtRecQty.Text.Trim());
                entity.RecDate  = SysConvert.ToDateTime(txtRecDate.DateTime);
                entity.ZPQty    = SysConvert.ToDecimal(txtZPQty.Text.Trim());
                entity.CPQty    = SysConvert.ToDecimal(txtCPQty.Text.Trim());
                entity.MakeOPID = SysConvert.ToString(drpMakeOPID.EditValue);
                //entity.ProOPID = SysConvert.ToString(drpProOPID.EditValue);
                entity.Remark = SysConvert.ToString(txtRemark.Text.Trim());

                if (SysConvert.ToDecimal(entity.RecQty) == 0)
                {
                    this.ShowInfoMessage("请输入收到数量");
                    txtRecQty.Focus();
                    return;
                }

                if (entity.ID > 0)
                {
                    rule.RUpdate(entity);
                    //this.ShowInfoMessage("保存成功");
                }
                else
                {
                    rule.RAdd(entity);
                    //this.ShowInfoMessage("保存成功");
                }
                #endregion


                //2
                #region 保存工人产量表
                TowelProductionPlanDtsStepProducts     ProductsEntity = new TowelProductionPlanDtsStepProducts();
                TowelProductionPlanDtsStepProductsRule ProductsRule   = new TowelProductionPlanDtsStepProductsRule();
                int    ProductsID = 0;
                string sqlA       = " select * from WO_TowelProductionPlanDtsStepProducts where 1=1 ";
                sqlA += " and MainID = " + MainID;
                sqlA += " and DtsID = " + DtsID;
                sqlA += " and SubSeq = " + SubSeq;
                sqlA += " and StepID = " + StepID;
                DataTable dtA = SysUtils.Fill(sqlA);
                if (dtA.Rows.Count > 0)
                {
                    for (int i = 0; i < dtA.Rows.Count; i++)
                    {
                        ProductsID        = SysConvert.ToInt32(dtA.Rows[i]["ID"]);
                        ProductsEntity.ID = ProductsID;
                        ProductsEntity.SelectByID();
                        ProductsRule.RDelete(ProductsEntity);//删除现有
                    }
                }
                TowelProductionPlanDtsStepProducts[] EntityProducts = EntityProductsGet(MainID, DtsID, SubSeq, StepID, entity.CardNo);
                ProductsRule.RAdd(EntityProducts);
                #endregion

                this.ShowInfoMessage("保存成功");


                GetCondtion();
                BindGrid();

                ProcessGrid.GridViewFocus(gridView1, new string[] { "DtsID" }, new string[] { DtsID.ToString() });
            }
            catch (Exception E)
            {
                this.ShowMessage(E.Message);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// 行改变
        /// </summary>
        /// <param name="sender"></param>
        public void gridViewRowChanged1(object sender)
        {
            try
            {
                ColumnView view = sender as ColumnView;
                txtFormNo2.Text    = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "FormNo"));
                txtItemCode2.Text  = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "ItemCode"));
                txtItemModel2.Text = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "ItemModel"));
                txtColorNum2.Text  = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "ColorNum"));
                txtCardNo.Text     = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "CardNo"));
                txtCardQty.Text    = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "CardQty"));

                //1
                #region 换行将该工序里存的值赋值
                int MainID = SysConvert.ToInt32(gridView1.GetRowCellValue(view.FocusedRowHandle, "MainID"));
                int DtsID  = SysConvert.ToInt32(gridView1.GetRowCellValue(view.FocusedRowHandle, "DtsID"));
                int SubSeq = SysConvert.ToInt32(gridView1.GetRowCellValue(view.FocusedRowHandle, "SubSeq"));
                int StepID = SysConvert.ToInt32(gridView1.GetRowCellValue(view.FocusedRowHandle, "StepID"));
                int ID     = 0;

                string sql = " select * from WO_TowelProductionPlanDtsStep where 1=1 ";
                sql += " and MainID = " + MainID;
                sql += " and DtsID = " + DtsID;
                sql += " and SubSeq = " + SubSeq;
                if (this.FormListAID == (int)EnumWOType.结束)//结束 可以查看 完成状态下输入的数据
                {
                    sql += " and StepID = " + (SysConvert.ToInt32(StepID) - 1);
                }
                else
                {
                    sql += " and StepID = " + StepID;
                }
                DataTable dt = SysUtils.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    ID = SysConvert.ToInt32(dt.Rows[0]["ID"]);
                }

                TowelProductionPlanDtsStep     entity = new TowelProductionPlanDtsStep();
                TowelProductionPlanDtsStepRule rule   = new TowelProductionPlanDtsStepRule();
                entity.ID = ID;
                entity.SelectByID();
                txtRecQty.Text        = entity.RecQty.ToString();
                txtRecDate.DateTime   = SysConvert.ToDateTime(entity.RecDate);
                txtZPQty.Text         = entity.ZPQty.ToString();
                txtCPQty.Text         = entity.CPQty.ToString();
                drpMakeOPID.EditValue = SysConvert.ToString(entity.MakeOPID);
                //drpProOPID.EditValue = SysConvert.ToString(entity.ProOPID);
                txtRemark.Text = entity.Remark.ToString();

                if (ID <= 0)
                {
                    txtRecDate.DateTime = DateTime.Now;
                }
                #endregion

                //2绑定产量表
                string sqlA = " select * from WO_TowelProductionPlanDtsStepProducts where 1=1 ";
                sqlA += " and MainID = " + MainID;
                sqlA += " and DtsID = " + DtsID;
                sqlA += " and SubSeq = " + SubSeq;
                sqlA += " and StepID = " + StepID;
                DataTable dtA = SysUtils.Fill(sqlA);
                if (dtA.Rows.Count > 0)
                {
                    gridView4.GridControl.DataSource = dtA;
                    gridView4.GridControl.Show();
                }
                else//没有保存的值grid 就默认为空
                {
                    //Common.AddDtRow(gridView4.GridControl.DataSource as DataTable, 150);
                    dtA.Clear();
                    Common.AddDtRow(dtA, 150);
                    gridView4.GridControl.DataSource = dtA;
                    gridView4.GridControl.Show();
                }
            }
            catch (Exception E)
            {
                this.ShowMessage(E.Message);
            }
        }