|
|
@@ -70,9 +70,9 @@ namespace UAS_MES.Make
|
|
|
|
|
|
|
|
|
bd_soncode.FormName = Name;
|
|
|
- bd_soncode.TableName = "bom left join bomdetail on bd_bomid=bo_id left join product on bd_soncode=pr_code";
|
|
|
+ bd_soncode.TableName = "(with temp1 as (select bd_fsoncode,bd_soncode,bd_location,pr_spec,pr_detail from bomdetail innner join bom on bo_id=bd_bomid left join product on bd_soncode = pr_code start with bo_mothercode = '" + ma_prodcode.Text + "' connect by bo_mothercode = prior bd_soncode)select* from temp1)";
|
|
|
bd_soncode.SetValueField = new string[] { "bd_soncode" };
|
|
|
- bd_soncode.SelectField = "bd_soncode # 子件编号,pr_detail # 物料名称,pr_spec # 物料规格,bd_location # 位号";
|
|
|
+ bd_soncode.SelectField = "bd_fsoncode # 首选料号,bd_soncode # 子件编号,pr_detail # 物料名称,pr_spec # 物料规格,bd_location # 位号";
|
|
|
bd_soncode.DBTitle = "不良零件";
|
|
|
bd_soncode.DbChange += Prodcode_DbChange;
|
|
|
|
|
|
@@ -828,7 +828,8 @@ namespace UAS_MES.Make
|
|
|
|
|
|
private void ma_prodcode_TextChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
- bd_soncode.Condition = "bo_mothercode = '" + ma_prodcode.Text + "'";
|
|
|
+ bd_soncode.TableName = "(with temp1 as (select bd_fsoncode,bd_soncode,bd_location,pr_spec,pr_detail from bomdetail innner join bom on bo_id=bd_bomid left join product on bd_soncode = pr_code start with bo_mothercode = '" + ma_prodcode.Text + "' connect by bo_mothercode = prior bd_soncode)select* from temp1)";
|
|
|
+ bd_soncode.Condition = "1=1";
|
|
|
}
|
|
|
|
|
|
private void Filter_UserControlTextChanged(object sender, EventArgs e)
|
|
|
@@ -926,31 +927,71 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
if (psl_location.Text != "")
|
|
|
{
|
|
|
- string psl_prodcode = dh.getFieldDataByCondition("bom left join bomdetail on bd_bomid=bo_id left join product on bd_soncode=pr_code", "bd_soncode", "bo_mothercode = '"+ma_prodcode.Text+ "' and bd_location like '%" + psl_location.Text.ToUpper() + "%'").ToString();
|
|
|
- if (psl_prodcode != "")
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select bd_soncode,bd_location,pr_spec,pr_detail from (with temp1 as (select bd_soncode,bd_location,pr_spec,pr_detail from bomdetail innner join bom on bo_id=bd_bomid left join product on bd_soncode = pr_code start with bo_mothercode= '" + ma_prodcode.Text + "' connect by bo_mothercode= prior bd_soncode)select * from temp1) where bd_location like '%" + psl_location.Text.ToUpper() + "%' ", "select");
|
|
|
+ if (dt.Rows.Count >0)
|
|
|
{
|
|
|
- for (int i = 0; i < MakeBadView.Rows.Count; i++)
|
|
|
+ if (dt.Rows.Count == 1)
|
|
|
{
|
|
|
- if (MakeBadView.Rows[i].Cells["choose1"].Value != null)
|
|
|
+ string psl_prodcode = dt.Rows[0]["bd_soncode"].ToString();
|
|
|
+ for (int i = 0; i < MakeBadView.Rows.Count; i++)
|
|
|
{
|
|
|
- if ((Boolean)MakeBadView.Rows[i].Cells["choose1"].Value == true)
|
|
|
+ if (MakeBadView.Rows[i].Cells["choose1"].Value != null)
|
|
|
{
|
|
|
- if (MakeBadView.Rows[i].Cells["mbp_part"].Value.ToString() == "")
|
|
|
+ if ((Boolean)MakeBadView.Rows[i].Cells["choose1"].Value == true)
|
|
|
{
|
|
|
- MakeBadView.Rows[i].Cells["mbp_part"].Value = psl_prodcode;
|
|
|
+ if (MakeBadView.Rows[i].Cells["mbp_part"].Value.ToString() == "")
|
|
|
+ {
|
|
|
+ MakeBadView.Rows[i].Cells["mbp_part"].Value = psl_prodcode;
|
|
|
+ }
|
|
|
+ else if (!MakeBadView.Rows[i].Cells["mbp_part"].Value.ToString().Contains(psl_prodcode))
|
|
|
+ MakeBadView.Rows[i].Cells["mbp_part"].Value += "," + psl_prodcode;
|
|
|
+
|
|
|
+ if (MakeBadView.Rows[i].Cells["mbl_loc"].Value.ToString() == "")
|
|
|
+ {
|
|
|
+ MakeBadView.Rows[i].Cells["mbl_loc"].Value = psl_location.Text.ToUpper();
|
|
|
+ }
|
|
|
+ else if (!MakeBadView.Rows[i].Cells["mbl_loc"].Value.ToString().Contains(psl_location.Text.ToUpper()))
|
|
|
+ MakeBadView.Rows[i].Cells["mbl_loc"].Value += "," + psl_location.Text.ToUpper();
|
|
|
}
|
|
|
- else if (!MakeBadView.Rows[i].Cells["mbp_part"].Value.ToString().Contains(psl_prodcode))
|
|
|
- MakeBadView.Rows[i].Cells["mbp_part"].Value += "," + psl_prodcode;
|
|
|
-
|
|
|
- if (MakeBadView.Rows[i].Cells["mbl_loc"].Value.ToString() == "")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (dt.Rows.Count > 1)
|
|
|
+ {
|
|
|
+ Boolean ifgetloc = false;
|
|
|
+ for (int j = 0; j < dt.Rows.Count; j++)
|
|
|
+ {
|
|
|
+ string psl_prodcode = dt.Rows[j]["bd_soncode"].ToString();
|
|
|
+ for (int i = 0; i < MakeBadView.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ if (MakeBadView.Rows[i].Cells["choose1"].Value != null)
|
|
|
{
|
|
|
- MakeBadView.Rows[i].Cells["mbl_loc"].Value = psl_location.Text.ToUpper();
|
|
|
+ if ((Boolean)MakeBadView.Rows[i].Cells["choose1"].Value == true)
|
|
|
+ {
|
|
|
+ if (MakeBadView.Rows[i].Cells["mbp_part"].Value.ToString() == "")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>站位"+ psl_location.Text + "有替代料,需要提前采集不良零件,第" + (i + 1) + "行不良零件为空\n", Color.Red);
|
|
|
+ }
|
|
|
+ else if (MakeBadView.Rows[i].Cells["mbp_part"].Value.ToString().Contains(psl_prodcode))
|
|
|
+ {
|
|
|
+ ifgetloc = true;
|
|
|
+ if (MakeBadView.Rows[i].Cells["mbl_loc"].Value.ToString() == "")
|
|
|
+ {
|
|
|
+ MakeBadView.Rows[i].Cells["mbl_loc"].Value = psl_location.Text.ToUpper();
|
|
|
+ }
|
|
|
+ else if (!MakeBadView.Rows[i].Cells["mbl_loc"].Value.ToString().Contains(psl_location.Text.ToUpper()))
|
|
|
+ MakeBadView.Rows[i].Cells["mbl_loc"].Value += "," + psl_location.Text.ToUpper();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- else if (!MakeBadView.Rows[i].Cells["mbl_loc"].Value.ToString().Contains(psl_location.Text.ToUpper()))
|
|
|
- MakeBadView.Rows[i].Cells["mbl_loc"].Value += "," + psl_location.Text.ToUpper();
|
|
|
}
|
|
|
}
|
|
|
+ if (!ifgetloc) {
|
|
|
+ OperateResult.AppendText(">>站位" + psl_location.Text + "有替代料,需要提前采集不良零件,当前所选行均未采集对应不良零件\n", Color.Red);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
else {
|
|
|
OperateResult.AppendText(">>站位"+ psl_location.Text.ToUpper() + "无对应物料\n", Color.Red, psl_location);
|