消耗品モデルを選択する際に、材料規則とサプライヤーの自動変更を実現する必要があります
消耗品モデルを選択したところ、変更しても材料のルールやサプライヤーは変わらないことがわかりました。アイテムの値は常に重ね合わされているため、初回は常に0を取ることで取得されるため、後の割り当てはアイテムをクリアすると変更されます
private void cobGlueType_SelectedIndexChanged(object sender, EventArgs e)
{
string strMatType = this.cmbMatType.Text.Trim();
if (this.cmbMatType.SelectedIndex >= 0)
{
DataTable dt = conn.GetGMRule(strMatType);
foreach (DataRow item in dt.Rows)
{
this.cmbMatRule.Items.Clear();
this.cmbVendor.Items.Clear();
this.cmbMatRule.Items.Add(item["RULENAME"]);
this.cmbVendor.Items.Add(item["GLUEVENDOR"]);
cmbMatRule.SelectedIndex = 0;
cmbVendor.SelectedIndex = 0;
this.dtpEndTime.Value = dtpStartTime.Value.AddDays(Convert.ToInt32(item["EFFECTIVE_DAYS"]));
}
}
}
ドロップダウンボックス項目の値をクリアします
this.cmbMatRule.Items.Clear();
this.cmbVendor.Items.Clear();