private void BT_D_Click(object sender, EventArgs e) { if (productionID > 0) { if (MessageBox.Show("若删除该产品,对应配方将解绑,确认删除此产品?", "删除提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { int res = AsmProduction_BLL.DeleteAamProductionByID(productionID); if (res > 0) { // ProductionRelationBom_BLL.DeleteProductionRelationBomByCondition(" PRODUCTION_ID=" + productionID); productionID = 0; MessageBox.Show("删除产品成功......"); TB_PN.Text = ""; TB_PT.Text = ""; TB_PS.Text = ""; TB_VR.Text = ""; TB_PD.Text = ""; CB_Online.Checked = true; // TB_ET.Text = ""; //TB_GT.Text = ""; DataBind(); } else { MessageBox.Show("删除产品失败......"); } } } else { MessageBox.Show("请选择要删除的产品......"); } }
public void ProductionAndStationRefish() { productionDt = null; productionDt = AsmProduction_BLL.GetAllAsmProduction(); CB_RP.DataSource = productionDt; CB_RP.DisplayMember = "PRODUCTION_NAME"; CB_RP.ValueMember = "PRODUCTION_ID"; CB_RP.SelectedItem = null; stationDt = null; stationDt = AsmStation_BLL.GetAllStation(); CB_S.DataSource = stationDt; CB_S.DisplayMember = "STATION_NAME"; CB_S.ValueMember = "STATION_ID"; CB_S.SelectedItem = null; }
public void RefishLineAndProduction() { productionDt = null; productionDt = AsmProduction_BLL.GetAllAsmProduction(); CB_ProductionType.DataSource = productionDt; CB_ProductionType.DisplayMember = "PRODUCTION_VR"; CB_ProductionType.ValueMember = "PRODUCTION_ID"; CB_ProductionType.SelectedItem = null; stationDt = null; stationDt = AsmLine_BLL.GetAllLines(); CB_Line.DataSource = stationDt; CB_Line.DisplayMember = "NAME"; CB_Line.ValueMember = "ID"; CB_Line.SelectedItem = null; }
/// <summary> /// 加载数据 /// </summary> public void LoadSource_combobox() { try { DataTable dt = AsmProduction_BLL.GetAsmProduction(); List <string> list = new List <string>(); for (int i = 0; i < dt.Rows.Count; i++) { list.Add(dt.Rows[i]["PRODUCTION_NAME"].ToString()); } this.cB_product_name.DataSource = list; } catch (Exception e2) { } }
public void ProductionAndStationRefish() { productionDt = null; productionDt = AsmProduction_BLL.GetAllAsmProduction(); CB_Production.DataSource = productionDt; CB_Production.DisplayMember = "PRODUCTION_VR"; CB_Production.ValueMember = "PRODUCTION_ID"; if (CB_Production.Items.Count > 0) { CB_Production.SelectedIndex = 0; } stationDt = null; stationDt = AsmStation_BLL.GetAllStation(); CB_Station.DataSource = stationDt; CB_Station.DisplayMember = "STATION_NAME"; CB_Station.ValueMember = "STATION_ID"; CB_Station.SelectedIndex = 0; }
/// <summary> /// 存储数据 /// </summary> public void StoreData() { try { List <Item> list_item = addFlow.Items; DataTable dt = AsmStation_BLL.GetAllStation(); AsmProductionWayRecordObject apwo = null; AsmProductionWayRecordObject apwo_right = null; List <string> list = new List <string>(); bool judge = false; bool judge_right = false; int j = 1; List <Item> list_link = new List <Item>(); for (int i = 0; i < list_item.Count; i++) { if (list_item[i].GetType().ToString().Contains("Link")) { list_link.Add(list_item[i]); } } for (int i = 0; i < list_link.Count; i++) { string str_left = (list_link[i] as Link).Org.Text; string str_right = (list_link[i] as Link).Dst.Text; if (list.Count > 0) { for (int m = 0; m < list.Count; m++) { if (str_left.Equals(list[m])) { judge = false; } else { judge = true; } } } else { judge = true; } if (judge) { apwo = new AsmProductionWayRecordObject(); apwo.ST_NAME = str_left; AsmProductionObject apo = AsmProduction_BLL.GetAsmProductionByCondition("PRODUCTION_NAME='" + cB_product_name.SelectedItem.ToString() + "'"); if (apo != null) { apwo.PRODUCTION_NAME = apo.PRODUCTION_NAME; apwo.PRODUCTION_ID = apo.PRODUCTION_ID; } AsmStationObject aso = AsmStation_BLL.GetStationByCondition("STATION_NAME='" + apwo.ST_NAME + "'"); if (aso != null) { apwo.ST_ID = aso.STATION_ID; } apwo.DT = System.DateTime.Now; apwo.SERIAL_NO = j++; AsmproductionWayRecord_BLL.AddRecord(apwo); } if (list.Count > 0) { for (int m = 0; m < list.Count; m++) { if (str_right.Equals(list[m])) { judge_right = false; } else { judge_right = true; } } } else { judge_right = true; } if (judge_right) { apwo_right = new AsmProductionWayRecordObject(); apwo_right.ST_NAME = str_right; AsmProductionObject apoX = AsmProduction_BLL.GetAsmProductionByCondition("PRODUCTION_NAME='" + cB_product_name.SelectedItem.ToString() + "'"); apwo_right.PRODUCTION_NAME = apoX.PRODUCTION_NAME; apwo_right.PRODUCTION_ID = apoX.PRODUCTION_ID; AsmStationObject asoX = AsmStation_BLL.GetStationByCondition("STATION_NAME='" + apwo_right.ST_NAME + "'"); apwo_right.ST_ID = asoX.STATION_ID; apwo_right.DT = System.DateTime.Now; apwo_right.SERIAL_NO = j++; AsmproductionWayRecord_BLL.AddRecord(apwo_right); } } DataTable dt_way = AsmProductionWay_BLL.GetWayByCondition("PRODUCTION_NAME= '" + cB_product_name.SelectedItem.ToString().Trim() + "'"); if (!(dt_way.Rows.Count > 0)) { DataTable dt_record = AsmproductionWayRecord_BLL.GetAllRecordByCondition(cB_product_name.SelectedItem.ToString().Trim()); AsmProductionWayObject apwro = null; for (int i = 0; i < dt_record.Rows.Count; i++) { apwro = new AsmProductionWayObject(); apwro.ST_NAME = dt_record.Rows[i]["ST_NAME"].ToString(); apwro.DT = Convert.ToDateTime(dt_record.Rows[i]["DT"].ToString()); apwro.PRODUCTION_NAME = dt_record.Rows[i]["PRODUCTION_NAME"].ToString(); apwro.PRODUCTION_ID = Convert.ToInt32(dt_record.Rows[i]["PRODUCTION_ID"].ToString()); apwro.ST_NAME = dt_record.Rows[i]["ST_NAME"].ToString(); apwro.ST_ID = Convert.ToInt32(dt_record.Rows[i]["ST_ID"].ToString()); apwro.SERIAL_NO = i + 1; AsmProductionWay_BLL.AddRoutingRecord(apwro); } } else { AsmProductionWay_BLL.DeleteAllByCondition("PRODUCTION_NAME= '" + cB_product_name.SelectedItem.ToString().Trim() + "'"); DataTable dt_record = AsmproductionWayRecord_BLL.GetAllRecordByCondition(cB_product_name.SelectedItem.ToString().Trim()); AsmProductionWayObject apwro = null; for (int i = 0; i < dt_record.Rows.Count; i++) { apwro = new AsmProductionWayObject(); apwro.DT = Convert.ToDateTime(dt_record.Rows[i]["DT"]); apwro.PRODUCTION_NAME = dt_record.Rows[i]["PRODUCTION_NAME"].ToString(); apwro.PRODUCTION_ID = Convert.ToInt32(dt_record.Rows[i]["PRODUCTION_ID"].ToString()); apwro.ST_NAME = dt_record.Rows[i]["ST_NAME"].ToString(); apwro.ST_ID = Convert.ToInt32(dt_record.Rows[i]["ST_ID"].ToString()); apwro.SERIAL_NO = i + 1; AsmProductionWay_BLL.AddRoutingRecord(apwro); } } } catch (Exception) { } }
private void BT_S_Click(object sender, EventArgs e) { AsmProductionObject apo = null; if (!String.IsNullOrEmpty(TB_PN.Text.Trim()) && !String.IsNullOrEmpty(TB_PT.Text.Trim())) { apo = AsmProduction_BLL.GetAsmProductionByCondition(" PRODUCTION_TYPE= '" + TB_PT.Text.Trim() + "' AND PRODUCTION_NAME='" + TB_PN.Text.Trim() + "' AND PRODUCTION_VR='" + TB_VR.Text.Trim() + "'"); if (apo != null) { apo.PRODUCTION_NAME = TB_PN.Text.Trim(); apo.PRODUCTION_TYPE = TB_PT.Text.Trim(); apo.PRODUCTION_SERIES = TB_PS.Text.Trim(); apo.PRODUCTION_TRADEMARK = TB_PTR.Text.Trim(); apo.PRODUCTION_VR = TB_VR.Text.Trim(); apo.PRODUCTION_DISCRIPTION = TB_PD.Text.Trim(); if (CB_Online.Checked) { apo.PRODUCTION_STE = "1";//在线模式 } if (CB_Offline.Checked) { apo.PRODUCTION_STE = "2";//离线模式 } // apo.PRODUCTION_GT = TB_GT.Text.Trim(); if (AsmProduction_BLL.UpdateAsmProductionById(apo) > 0) { MessageBox.Show("更新产品信息成功......"); TB_PN.Text = ""; TB_PT.Text = ""; TB_PS.Text = ""; TB_VR.Text = ""; TB_PD.Text = ""; CB_Online.Checked = true; // TB_ET.Text = ""; // TB_GT.Text = ""; PL_D.Visible = false; DataBind(); } else { MessageBox.Show("更新产品信息失败......"); } } else { apo = new AsmProductionObject(); apo.PRODUCTION_NAME = TB_PN.Text.Trim(); apo.PRODUCTION_TYPE = TB_PT.Text.Trim(); apo.PRODUCTION_SERIES = TB_PS.Text.Trim(); apo.PRODUCTION_TRADEMARK = TB_PTR.Text.Trim(); apo.PRODUCTION_VR = TB_VR.Text.Trim(); apo.PRODUCTION_DISCRIPTION = TB_PD.Text.Trim(); if (CB_Online.Checked) { apo.PRODUCTION_STE = "1";//在线模式 } if (CB_Offline.Checked) { apo.PRODUCTION_STE = "2";//离线模式 } // apo.PRODUCTION_GT = TB_GT.Text.Trim(); if (AsmProduction_BLL.AddAsmProductionByObject(apo) > 0) { TB_PN.Text = ""; TB_PT.Text = ""; TB_PS.Text = ""; TB_VR.Text = ""; TB_PD.Text = ""; CB_Online.Checked = true; // TB_GT.Text = ""; PL_D.Visible = false; DataBind(); MessageBox.Show("添加产品信息成功......"); } else { MessageBox.Show("添加产品信息失败......"); } } } else { MessageBox.Show("输入产品信息不全....."); } }