/// <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(); }
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="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Delete(BaseEntity p_Entity) { try { TowelProductionPlanDts MasterEntity = (TowelProductionPlanDts)p_Entity; if (MasterEntity.ID == 0) { return(0); } //删除主表数据 string Sql = ""; Sql = "DELETE FROM WO_TowelProductionPlanDts 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); } }
/// <summary> /// 修改 /// </summary> /// <param name="p_BE">要修改的实体</param> /// <param name="sqlTrans">事务类</param> public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { TowelProductionPlanDts entity = (TowelProductionPlanDts)p_BE; if (entity.CardNo != "") { string sql = "SELECT ItemCode FROM WO_TowelProductionPlanDts WHERE CardNo=" + SysString.ToDBString(entity.CardNo); sql += " and ID <> " + entity.ID; DataTable dt = sqlTrans.Fill(sql); if (dt.Rows.Count > 0) { throw new BaseException("卡号已存在,请重新输入"); } } TowelProductionPlanDtsCtl control = new TowelProductionPlanDtsCtl(sqlTrans); control.Update(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 保存(传入事务处理) /// </summary> /// <param name="p_Entity"></param> /// <param name="p_BE"></param> /// <param name="sqlTrans"></param> public void RSave(TowelProductionPlan p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans) { try { string sql = "DELETE FROM WO_TowelProductionPlanDts WHERE MainID=" + p_Entity.ID.ToString(); sql += " AND ID NOT IN" + string.Format("({0})", GetIDExist(p_BE)); sqlTrans.ExecuteNonQuery(sql); //删除原单据里应该删除的明细数据,即数据库里有但是UI里已经删除的数据 sql = "SELECT ISNULL(MAX(Seq),0)+1 As MSEQ FROM WO_TowelProductionPlanDts WHERE MainID=" + p_Entity.ID.ToString(); ////找到最大的Seq 将获得最大Seq的语句放到循环外更高效(多人操作时会有问题吗?) int MSEQ = SysConvert.ToInt32(sqlTrans.Fill(sql).Rows[0][0].ToString()); for (int i = 0; i < p_BE.Length; i++) { TowelProductionPlanDts entitydts = (TowelProductionPlanDts)p_BE[i]; if (entitydts.ID != 0)//ID不为0说明数据库中已经存在 { this.RUpdate(entitydts, sqlTrans); } else { entitydts.Seq = MSEQ; entitydts.MainID = p_Entity.ID; this.RAdd(entitydts, sqlTrans); MSEQ++;//最大值加1 } } } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private TowelProductionPlanDts[] EntityDtsGet() { int index = GetDataCompleteNum(); TowelProductionPlanDts[] entitydts = new TowelProductionPlanDts[index]; index = 0; for (int i = 0; i < gridView1.RowCount; i++) { if (CheckDataCompleteDts(i)) { entitydts[index] = new TowelProductionPlanDts(); entitydts[index].MainID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "MainID")); if (entitydts[index].MainID == HTDataID && HTDataID != 0)//已存在表示修改 { entitydts[index].ID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "ID")); entitydts[index].SelectByID(); } else//新增 { entitydts[index].MainID = HTDataID; entitydts[index].Seq = i + 1; } entitydts[index].SubSeq = 1;//作为开卡的模板第一道 entitydts[index].ItemCode = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemCode")); entitydts[index].ItemName = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemName")); entitydts[index].ItemStd = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemStd")); entitydts[index].ItemModel = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemModel")); entitydts[index].ColorNum = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorNum")); entitydts[index].ColorName = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorName")); entitydts[index].PieceQty = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "PieceQty")); entitydts[index].Qty = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "Qty")); entitydts[index].Unit = SysConvert.ToString(gridView1.GetRowCellValue(i, "Unit")); entitydts[index].SinglePrice = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "SinglePrice")); //entitydts[index].Amount = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "Amount")); entitydts[index].Amount = entitydts[index].Qty * entitydts[index].SinglePrice; entitydts[index].Batch = SysConvert.ToString(gridView1.GetRowCellValue(i, "Batch")); entitydts[index].Remark = SysConvert.ToString(gridView1.GetRowCellValue(i, "Remark")); entitydts[index].MWidth = SysConvert.ToString(gridView1.GetRowCellValue(i, "MWidth")); entitydts[index].MWeight = SysConvert.ToString(gridView1.GetRowCellValue(i, "MWeight")); entitydts[index].DtsSO = SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsSO")); entitydts[index].LoadDtsID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "LoadDtsID")); entitydts[index].KBFlag = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "KBFlag")); entitydts[index].LLQty = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "LLQty")); entitydts[index].LLUnit = SysConvert.ToString(gridView1.GetRowCellValue(i, "LLUnit")); index++; } } return(entitydts); }
/// <summary> /// 获得数据库里没有被删除的ID(即数据库里有而且UI里也没有删除的数据) /// </summary> /// <param name="p_BE"></param> /// <returns></returns> private string GetIDExist(BaseEntity[] p_BE) { string outstr = "0"; for (int i = 0; i < p_BE.Length; i++) { TowelProductionPlanDts entitydts = (TowelProductionPlanDts)p_BE[i]; if (entitydts.ID != 0) { outstr += "," + entitydts.ID; } } return(outstr); }
/// <summary> /// 删除 /// </summary> /// <param name="p_BE">要删除的实体</param> /// <param name="sqlTrans">事务类</param> public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); TowelProductionPlanDts entity = (TowelProductionPlanDts)p_BE; TowelProductionPlanDtsCtl control = new TowelProductionPlanDtsCtl(sqlTrans); control.Delete(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); TowelProductionPlanDts entity = (TowelProductionPlanDts)p_BE; TowelProductionPlanDtsCtl control = new TowelProductionPlanDtsCtl(sqlTrans); entity.ID = (int)EntityIDTable.GetID((long)SysEntity.WO_TowelProductionPlanDts, sqlTrans); control.AddNew(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(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> /// 新增 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int AddNew(BaseEntity p_Entity) { try { TowelProductionPlanDts MasterEntity = (TowelProductionPlanDts)p_Entity; if (MasterEntity.ID == 0) { return(0); } //新增主表数据 StringBuilder MasterField = new StringBuilder(); StringBuilder MasterValue = new StringBuilder(); MasterField.Append("INSERT INTO WO_TowelProductionPlanDts("); MasterValue.Append(" VALUES("); MasterField.Append("ID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ","); MasterField.Append("MainID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.MainID) + ","); MasterField.Append("Seq" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Seq) + ","); MasterField.Append("ItemCode" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ItemCode) + ","); MasterField.Append("ItemName" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ItemName) + ","); MasterField.Append("ItemStd" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ItemStd) + ","); MasterField.Append("ItemModel" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ItemModel) + ","); MasterField.Append("ColorNum" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ColorNum) + ","); MasterField.Append("ColorName" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ColorName) + ","); MasterField.Append("PieceQty" + ","); if (MasterEntity.PieceQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.PieceQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("Qty" + ","); if (MasterEntity.Qty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.Qty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("Unit" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Unit) + ","); MasterField.Append("SinglePrice" + ","); if (MasterEntity.SinglePrice != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.SinglePrice) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("Amount" + ","); if (MasterEntity.Amount != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.Amount) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("Batch" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Batch) + ","); MasterField.Append("Remark" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ","); MasterField.Append("DtsSO" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.DtsSO) + ","); MasterField.Append("LoadDtsID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.LoadDtsID) + ","); MasterField.Append("SubSeq" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.SubSeq) + ","); MasterField.Append("CardNo" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.CardNo) + ","); MasterField.Append("CardTime" + ","); if (MasterEntity.CardTime != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.CardTime.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("CardQty" + ","); if (MasterEntity.CardQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.CardQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("StepID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.StepID) + ","); MasterField.Append("CardOPID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.CardOPID) + ","); MasterField.Append("CardOPName" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.CardOPName) + ","); MasterField.Append("KBFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.KBFlag) + ","); MasterField.Append("MWidth" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.MWidth) + ","); MasterField.Append("MWeight" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.MWeight) + ","); MasterField.Append("LLQty" + ","); if (MasterEntity.LLQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.LLQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("LLUnit" + ")"); MasterValue.Append(SysString.ToDBString(MasterEntity.LLUnit) + ")"); //执行 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); } }
/// <summary> /// 修改 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Update(BaseEntity p_Entity) { try { TowelProductionPlanDts MasterEntity = (TowelProductionPlanDts)p_Entity; if (MasterEntity.ID == 0) { return(0); } //更新主表数据 StringBuilder UpdateBuilder = new StringBuilder(); UpdateBuilder.Append("UPDATE WO_TowelProductionPlanDts SET "); UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ","); UpdateBuilder.Append(" MainID=" + SysString.ToDBString(MasterEntity.MainID) + ","); UpdateBuilder.Append(" Seq=" + SysString.ToDBString(MasterEntity.Seq) + ","); UpdateBuilder.Append(" ItemCode=" + SysString.ToDBString(MasterEntity.ItemCode) + ","); UpdateBuilder.Append(" ItemName=" + SysString.ToDBString(MasterEntity.ItemName) + ","); UpdateBuilder.Append(" ItemStd=" + SysString.ToDBString(MasterEntity.ItemStd) + ","); UpdateBuilder.Append(" ItemModel=" + SysString.ToDBString(MasterEntity.ItemModel) + ","); UpdateBuilder.Append(" ColorNum=" + SysString.ToDBString(MasterEntity.ColorNum) + ","); UpdateBuilder.Append(" ColorName=" + SysString.ToDBString(MasterEntity.ColorName) + ","); if (MasterEntity.PieceQty != 0) { UpdateBuilder.Append(" PieceQty=" + SysString.ToDBString(MasterEntity.PieceQty) + ","); } else { UpdateBuilder.Append(" PieceQty=null,"); } if (MasterEntity.Qty != 0) { UpdateBuilder.Append(" Qty=" + SysString.ToDBString(MasterEntity.Qty) + ","); } else { UpdateBuilder.Append(" Qty=null,"); } UpdateBuilder.Append(" Unit=" + SysString.ToDBString(MasterEntity.Unit) + ","); if (MasterEntity.SinglePrice != 0) { UpdateBuilder.Append(" SinglePrice=" + SysString.ToDBString(MasterEntity.SinglePrice) + ","); } else { UpdateBuilder.Append(" SinglePrice=null,"); } if (MasterEntity.Amount != 0) { UpdateBuilder.Append(" Amount=" + SysString.ToDBString(MasterEntity.Amount) + ","); } else { UpdateBuilder.Append(" Amount=null,"); } UpdateBuilder.Append(" Batch=" + SysString.ToDBString(MasterEntity.Batch) + ","); UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ","); UpdateBuilder.Append(" DtsSO=" + SysString.ToDBString(MasterEntity.DtsSO) + ","); UpdateBuilder.Append(" LoadDtsID=" + SysString.ToDBString(MasterEntity.LoadDtsID) + ","); UpdateBuilder.Append(" SubSeq=" + SysString.ToDBString(MasterEntity.SubSeq) + ","); UpdateBuilder.Append(" CardNo=" + SysString.ToDBString(MasterEntity.CardNo) + ","); if (MasterEntity.CardTime != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" CardTime=" + SysString.ToDBString(MasterEntity.CardTime.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { UpdateBuilder.Append(" CardTime=null,"); } if (MasterEntity.CardQty != 0) { UpdateBuilder.Append(" CardQty=" + SysString.ToDBString(MasterEntity.CardQty) + ","); } else { UpdateBuilder.Append(" CardQty=null,"); } UpdateBuilder.Append(" StepID=" + SysString.ToDBString(MasterEntity.StepID) + ","); UpdateBuilder.Append(" CardOPID=" + SysString.ToDBString(MasterEntity.CardOPID) + ","); UpdateBuilder.Append(" CardOPName=" + SysString.ToDBString(MasterEntity.CardOPName) + ","); UpdateBuilder.Append(" KBFlag=" + SysString.ToDBString(MasterEntity.KBFlag) + ","); UpdateBuilder.Append(" MWidth=" + SysString.ToDBString(MasterEntity.MWidth) + ","); UpdateBuilder.Append(" MWeight=" + SysString.ToDBString(MasterEntity.MWeight) + ","); if (MasterEntity.LLQty != 0) { UpdateBuilder.Append(" LLQty=" + SysString.ToDBString(MasterEntity.LLQty) + ","); } else { UpdateBuilder.Append(" LLQty=null,"); } UpdateBuilder.Append(" LLUnit=" + SysString.ToDBString(MasterEntity.LLUnit)); 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); } }
/// <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> /// 进入下一站 更新当前站完成日期 将站别+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); } }
/// <summary> /// 检查将要操作的数据是否符合业务规则 /// </summary> /// <param name="p_BE"></param> private void CheckCorrect(BaseEntity p_BE) { TowelProductionPlanDts entity = (TowelProductionPlanDts)p_BE; }