|
|
@@ -33,7 +33,7 @@ namespace UAS_MES.Make
|
|
|
int count;
|
|
|
|
|
|
//Bom版本
|
|
|
- string ms_bomversion;
|
|
|
+ string ma_bomversion;
|
|
|
|
|
|
int rowindex;
|
|
|
|
|
|
@@ -118,14 +118,14 @@ namespace UAS_MES.Make
|
|
|
BaseUtil.FillDgvWithDataTable(LabelDataGridView, dt);
|
|
|
for (int i = 0; i < LabelDataGridView.Rows.Count; i++)
|
|
|
{
|
|
|
- DataTable datatable = (DataTable)dh.ExecuteSql("select cm_barcode,cm_sncode from CRAFTMATERIAL where cm_id = '" + LabelDataGridView.Rows[i].Cells["cm_id"].Value + "'","select");
|
|
|
+ DataTable datatable = (DataTable)dh.ExecuteSql("select cm_barcode,cm_sncode from CRAFTMATERIAL where cm_id = '" + LabelDataGridView.Rows[i].Cells["cm_id"].Value + "'", "select");
|
|
|
LabelDataGridView.Rows[i].Cells["cm_barcode"].Value = datatable.Rows[0]["cm_barcode"].ToString();
|
|
|
LabelDataGridView.Rows[i].Cells["cm_sncode"].Value = datatable.Rows[0]["cm_sncode"].ToString();
|
|
|
string[] cm_sncodedetail = LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString().Split(',');
|
|
|
string pr_name = "";
|
|
|
foreach (string item in cm_sncodedetail)
|
|
|
{
|
|
|
- pr_name += "'"+item + "',";
|
|
|
+ pr_name += "'" + item + "',";
|
|
|
}
|
|
|
pr_name = pr_name.TrimEnd(',');
|
|
|
LabelDataGridView.Rows[i].Cells["pr_detail_"].Value = dh.getFieldDataByCondition("product", "wm_concat(pr_detail)", "pr_code in (" + pr_name + ")");
|
|
|
@@ -211,12 +211,12 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
if (LabelDataGridView.Rows[i].Cells["Choose"].Value != null)
|
|
|
{
|
|
|
- if ((Boolean)LabelDataGridView.Rows[i].Cells["Choose"].Value == true && change.Checked && (LabelDataGridView.Rows[i].Cells["mb_badcode"].Value == null || LabelDataGridView.Rows[i].Cells["New_BarCode"].Value == null)&& LabelDataGridView.Rows[i].Cells["cm_status"].Value.ToString() != "-1")
|
|
|
+ if ((Boolean)LabelDataGridView.Rows[i].Cells["Choose"].Value == true && change.Checked && (LabelDataGridView.Rows[i].Cells["mb_badcode"].Value == null || LabelDataGridView.Rows[i].Cells["New_BarCode"].Value == null) && LabelDataGridView.Rows[i].Cells["cm_status"].Value.ToString() != "-1")
|
|
|
{
|
|
|
OperateResult.AppendText("第" + (i + 1) + "行没有采集不良代码或新批号\n", Color.Red);
|
|
|
return;
|
|
|
}
|
|
|
- if ((Boolean)LabelDataGridView.Rows[i].Cells["Choose"].Value == true && change.Checked && LabelDataGridView.Rows[i].Cells["New_BarCode"].Value == null && LabelDataGridView.Rows[i].Cells["cm_status"].Value.ToString() == "-1")
|
|
|
+ if ((Boolean)LabelDataGridView.Rows[i].Cells["Choose"].Value == true && change.Checked && LabelDataGridView.Rows[i].Cells["New_BarCode"].Value == null && LabelDataGridView.Rows[i].Cells["cm_status"].Value.ToString() == "-1")
|
|
|
{
|
|
|
OperateResult.AppendText("第" + (i + 1) + "行没有采集新批号\n", Color.Red);
|
|
|
return;
|
|
|
@@ -250,12 +250,12 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
dt1 = new DataTable();
|
|
|
sql.Clear();
|
|
|
- sql.Append("select ms_bomversion from makeserial left join make on ma_code=ms_makecode ");
|
|
|
+ sql.Append("select ma_bomversion from makeserial left join make on ma_code=ms_makecode ");
|
|
|
sql.Append("left join product on ms_prodcode=pr_code where ms_makecode='" + LabelDataGridView.Rows[i].Cells["cm_makecode"].Value + "' order by ms_id desc");
|
|
|
dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
if (dt1.Rows.Count > 0)
|
|
|
{
|
|
|
- ms_bomversion = dt1.Rows[0][0].ToString();
|
|
|
+ ma_bomversion = dt1.Rows[0][0].ToString();
|
|
|
}
|
|
|
dtbar = new DataTable();
|
|
|
sql.Clear();
|
|
|
@@ -263,10 +263,10 @@ namespace UAS_MES.Make
|
|
|
sql.Append("sp_barcoderule, min(sp_checksalecode)sp_checksalecode,sp_tracekind,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
|
|
|
sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)");
|
|
|
sql.Append("sp_regex,max(pr_detail)pr_detail from stepproduct left join product on pr_code=sp_fsoncode where ");
|
|
|
- sql.Append("sp_bomversion='" + ms_bomversion + "' and sp_craftcode='" + LabelDataGridView.Rows[i].Cells["cm_craftcode"].Value + "'and sp_mothercode ='" + LabelDataGridView.Rows[i].Cells["cm_maprodcode"].Value + "'");
|
|
|
+ sql.Append("sp_bomversion='" + ma_bomversion + "' and sp_craftcode='" + LabelDataGridView.Rows[i].Cells["cm_craftcode"].Value + "'and sp_mothercode ='" + LabelDataGridView.Rows[i].Cells["cm_maprodcode"].Value + "'");
|
|
|
sql.Append(" group by sp_fsoncode,sp_tracekind order by SP_DETNO asc");
|
|
|
dtbar = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- DataRow[] dtrows = dtbar.Select("sp_soncode like '"+ LabelDataGridView.Rows[i].Cells["cm_soncode"].Value + "'");
|
|
|
+ DataRow[] dtrows = dtbar.Select("sp_soncode like '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value + "'");
|
|
|
dtbar = BaseUtil.ToDataTable(dtrows);
|
|
|
if (dtbar.Rows.Count > 0)
|
|
|
{
|
|
|
@@ -282,18 +282,18 @@ namespace UAS_MES.Make
|
|
|
if (sp_tracekind == "1")
|
|
|
{
|
|
|
//上料校验规则判断
|
|
|
- if (!LogicHandler.CheckSNBeforeLoad(LabelDataGridView.Rows[i].Cells["cm_makecode"].Value.ToString(), LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString(), sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, sp_checksalecode,out ErrorMessage))
|
|
|
+ if (!LogicHandler.CheckSNBeforeLoad(LabelDataGridView.Rows[i].Cells["cm_makecode"].Value.ToString(), LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString(), sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, sp_checksalecode, out ErrorMessage))
|
|
|
{
|
|
|
OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
LoadData(sncode_1, sender, new KeyEventArgs(Keys.Enter));
|
|
|
continue;
|
|
|
}
|
|
|
- dh.UpdateByCondition("makeserial", "ms_nextmacode='" + LabelDataGridView.Rows[i].Cells["cm_makecode"].Value.ToString() + "'", "ms_id=(select max(ms_id) from makeserial where ms_sncode='" + LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString() + "')");
|
|
|
+ dh.UpdateByCondition("makeserial", "ms_nextmacode='" + LabelDataGridView.Rows[i].Cells["cm_makecode"].Value.ToString() + "'", "ms_id=(select max(ms_id) from makeserial where ms_sncode='" + LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString() + "')");
|
|
|
}
|
|
|
- else if(sp_tracekind == "2")
|
|
|
+ else if (sp_tracekind == "2")
|
|
|
{
|
|
|
if (!dh.CheckExist("makesourcestock", " (MSS_FPRODCODE = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "' or MSS_PRODCODE = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "') and mss_barcode = '" + LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString() + "'"))
|
|
|
- {
|
|
|
+ {
|
|
|
OperateResult.AppendText(">>物料" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "岗位备料无条码" + LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString() + "\n", Color.Red);
|
|
|
continue;
|
|
|
}
|
|
|
@@ -317,11 +317,11 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
- {
|
|
|
+ {
|
|
|
//当前备料信息不再工序BOM中,为BOM之外的批管控物料备料
|
|
|
if (!dh.CheckExist("makesourcestock", " (MSS_FPRODCODE = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "' or MSS_PRODCODE = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "') and mss_barcode = '" + LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString() + "'"))
|
|
|
{
|
|
|
- OperateResult.AppendText(">>物料" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "不在当前工序BOM" + ms_bomversion + "中\n", Color.Black);
|
|
|
+ OperateResult.AppendText(">>物料" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "不在当前工序BOM" + ma_bomversion + "中\n", Color.Black);
|
|
|
OperateResult.AppendText(">>物料" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "岗位备料无条码" + LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString() + "\n", Color.Red);
|
|
|
continue;
|
|
|
}
|
|
|
@@ -375,13 +375,13 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //此物料上线状态更新为-1,代表被拆解
|
|
|
- sql.Clear();
|
|
|
- sql.Append("update craftmaterial set cm_status=-1,cm_lastdeco=-1,cm_dropman='" + User.UserCode + "',");
|
|
|
- sql.Append("cm_dropdate =sysdate,cm_dropstep='" + User.CurrentStepCode + "',");
|
|
|
- sql.Append("cm_dropsccode='" + User.UserSourceCode + "' where cm_id='" + LabelDataGridView.Rows[i].Cells["cm_id"].Value + "'");
|
|
|
- dh.ExecuteSql(sql.GetString(), "update");
|
|
|
-
|
|
|
+ //此物料上线状态更新为-1,代表被拆解
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("update craftmaterial set cm_status=-1,cm_lastdeco=-1,cm_dropman='" + User.UserCode + "',");
|
|
|
+ sql.Append("cm_dropdate =sysdate,cm_dropstep='" + User.CurrentStepCode + "',");
|
|
|
+ sql.Append("cm_dropsccode='" + User.UserSourceCode + "' where cm_id='" + LabelDataGridView.Rows[i].Cells["cm_id"].Value + "'");
|
|
|
+ dh.ExecuteSql(sql.GetString(), "update");
|
|
|
+
|
|
|
|
|
|
////将新批号绑定到序列号中
|
|
|
//dt = (DataTable)dh.ExecuteSql("select sp_id from stepproduct where sp_mothercode='" + LabelDataGridView.Rows[i].Cells["cm_maprodcode"].Value + "'", "select");
|
|
|
@@ -470,6 +470,6 @@ namespace UAS_MES.Make
|
|
|
|
|
|
private void LabelDataGridView_Sorted(object sender, EventArgs e)
|
|
|
{
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|