Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
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);
            }
        }