private void btnSave_Click_1(object sender, EventArgs e) { try { int DtsID = SysConvert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "DtsID")); TowelProductionPlanDts entity = new TowelProductionPlanDts(); TowelProductionPlanDtsRule rule = new TowelProductionPlanDtsRule(); entity.ID = DtsID; entity.SelectByID(); entity.CardNo = txtCardNo.Text.Trim(); entity.CardQty = SysConvert.ToDecimal(txtCardQty.Text.Trim()); entity.CardTime = SysConvert.ToDateTime(txtCardTime.DateTime); entity.CardOPID = FParamConfig.LoginID; entity.CardOPName = FParamConfig.LoginName; if (entity.CardNo != "") { entity.StepID = 1;// (int)EnumWOType.剪前检验;//保存卡号的时候就默认 第一道工序 } rule.RUpdate(entity); this.ShowInfoMessage("保存成功"); GetCondtion(); BindGrid(); ProcessGrid.GridViewFocus(gridView1, new string[] { "DtsID" }, new string[] { DtsID.ToString() }); } catch (Exception E) { this.ShowMessage(E.Message); } }
/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDel_Click(object sender, EventArgs e) { if (MessageBox.Show("确定要删除该数据", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } int DtsID = SysConvert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "DtsID")); TowelProductionPlanDts entity = new TowelProductionPlanDts(); TowelProductionPlanDtsRule rule = new TowelProductionPlanDtsRule(); entity.ID = DtsID; entity.SelectByID(); if (entity.SubSeq == 1) { this.ShowInfoMessage("源数据不可删除"); return; } else { rule.RDelete(entity); } GetCondtion(); BindGrid(); }
/// <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); } }
/// <summary> /// 开卡 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCard_Click(object sender, EventArgs e) { try { int DtsID = SysConvert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "DtsID")); int cardNums = 0;//开卡数量 if (DtsID != 0) { frmTowelProductionPlanCardNums frm = new frmTowelProductionPlanCardNums(); frm.ShowDialog(); cardNums = frm.CardNums; for (int i = 0; i < cardNums; i++) { TowelProductionPlanDts entityOld = new TowelProductionPlanDts(); entityOld.ID = DtsID; entityOld.SelectByID(); TowelProductionPlanDts entity = new TowelProductionPlanDts(); TowelProductionPlanDtsRule rule = new TowelProductionPlanDtsRule(); entity.MainID = entityOld.MainID; entity.ItemCode = entityOld.ItemCode; entity.ItemModel = entityOld.ItemModel; entity.ItemName = entityOld.ItemName; entity.ItemStd = entityOld.ItemStd; entity.ColorNum = entityOld.ColorNum; entity.ColorName = entityOld.ColorName; entity.PieceQty = entityOld.PieceQty; entity.Qty = entityOld.Qty; entity.Unit = entityOld.Unit; entity.SinglePrice = entityOld.SinglePrice; entity.Amount = entityOld.Amount; entity.Batch = entityOld.Batch; entity.Remark = entityOld.Remark; entity.DtsSO = entityOld.DtsSO; entity.LoadDtsID = entityOld.LoadDtsID; entity.KBFlag = entityOld.KBFlag;//拷边标志 entity.SubSeq = GetMaxSubSeq(entity.MainID, entity.ItemCode, entity.ColorNum); //entity.CardNo = txtCardNo.Text.Trim(); //entity.CardQty = SysConvert.ToDecimal(txtCardQty.Text.Trim()); //entity.CardTime = DateTime.Now; //entity.StepID = (int)EnumWOType.剪片;//开卡的时候默认为第一站剪片 rule.RAdd(entity); } GetCondtion(); BindGrid(); } else { this.ShowInfoMessage("请选择数据"); } } catch (Exception E) { this.ShowMessage(E.Message); } }
/// <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); } }