|
|
@@ -72,51 +72,42 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
if (ma_code.Text != "")
|
|
|
{
|
|
|
- string ErrMessage = "";
|
|
|
- if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrMessage))
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select cr_code from craft left join craftdetail on cd_crid=cr_id where cr_code in (" + craftcode_condition + ") ");
|
|
|
+ sql.Append("and cr_prodcode='" + ma_prodcode.Text + "' and cr_statuscode='AUDITED' and cd_stepcode='" + User.CurrentStepCode + "'");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select cr_code from craft left join craftdetail on cd_crid=cr_id where cr_code in (" + craftcode_condition + ") ");
|
|
|
- sql.Append("and cr_prodcode='" + ma_prodcode.Text + "' and cr_statuscode='AUDITED' and cd_stepcode='" + User.CurrentStepCode + "'");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select bar_remain,bar_prodcode from barcode inner join product on pr_code=bar_prodcode where bar_code ='" + pr_batchnum.Text + "'", "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- dt = (DataTable)dh.ExecuteSql("select bar_remain,bar_prodcode from barcode inner join product on pr_code=bar_prodcode where bar_code ='" + pr_batchnum.Text + "' and bar_status = 1 ", "select");
|
|
|
+ string bar_remain = dt.Rows[0]["bar_remain"].ToString();
|
|
|
+ string bar_prodcode = dt.Rows[0]["bar_prodcode"].ToString();
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select * from stepproduct inner join product on pr_code=sp_soncode left join makematerial on mm_prodcode=sp_soncode where ");
|
|
|
+ sql.Append("sp_craftcode='" + ma_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' and sp_soncode='" + bar_prodcode + "' and sp_tracekind=2 ");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- string bar_remain = dt.Rows[0]["bar_remain"].ToString();
|
|
|
- string bar_prodcode = dt.Rows[0]["bar_prodcode"].ToString();
|
|
|
+ string mm_oneuseqty = dt.Rows[0]["mm_oneuseqty"].ToString();
|
|
|
+ string mm_prodcode = dt.Rows[0]["mm_prodcode"].ToString();
|
|
|
sql.Clear();
|
|
|
- sql.Append("select * from stepproduct inner join product on pr_code=sp_soncode left join makematerial on mm_prodcode=sp_soncode where ");
|
|
|
- sql.Append("sp_craftcode='" + ma_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' and sp_soncode='" + bar_prodcode + "' and pr_tracekind=2 ");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- string mm_oneuseqty = dt.Rows[0]["mm_oneuseqty"].ToString();
|
|
|
- string mm_prodcode = dt.Rows[0]["mm_prodcode"].ToString();
|
|
|
- if (dh.getRowCount("makesourcestock", "mss_makecode='" + ma_code.Text + "' and mss_prodcode='" + mm_prodcode + "' and mss_barcode='" + pr_batchnum.Text + "'") == 0)
|
|
|
- {
|
|
|
- sql.Clear();
|
|
|
- sql.Append("insert into makesourcestock (mss_id,mss_makecode,mss_linecode ,mss_craftcode,");
|
|
|
- sql.Append("mss_stepcode,mss_barcode,mss_fprodcode,mss_indate,mss_inman,mss_qty,");
|
|
|
- sql.Append("mss_remain,mss_baseqty,mss_prodcode,mss_maid) values(makesourcestock_seq.nextval,'" + ma_code.Text + "','" + User.UserLineCode + "',");
|
|
|
- sql.Append("'" + ma_craftcode.Text + "','" + sc_stepcode.Text + "','" + pr_batchnum.Text + "','" + mm_prodcode + "',");
|
|
|
- sql.Append("sysdate,'" + User.UserCode + "','" + bar_remain + "','" + bar_remain + "','" + mm_oneuseqty + "','" + bar_prodcode + "','" + ma_id + "')");
|
|
|
- dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
- dh.UpdateByCondition("barcode", "bar_place='" + ma_code.Text + "'", "bar_code='" + pr_batchnum.Text + "'");
|
|
|
- //数据插入成功后加载Grid的数据
|
|
|
- FillDataGridView();
|
|
|
- OperateResult.AppendText(">>条码号" + pr_batchnum.Text + "备料成功\n", Color.Green, pr_batchnum);
|
|
|
- }
|
|
|
- else OperateResult.AppendText(">>条码号" + pr_batchnum.Text + "的物料已分配\n", Color.Red, pr_batchnum);
|
|
|
- }
|
|
|
- else OperateResult.AppendText(">>条码号" + pr_batchnum.Text + "对应的物料不是当前工单当前工序需要备的物料\n", Color.Red, pr_batchnum);
|
|
|
+ sql.Append("insert into makesourcestock (mss_id,mss_makecode,mss_linecode ,mss_craftcode,");
|
|
|
+ sql.Append("mss_stepcode,mss_barcode,mss_fprodcode,mss_indate,mss_inman,mss_qty,");
|
|
|
+ sql.Append("mss_remain,mss_baseqty,mss_prodcode,mss_maid) values(makesourcestock_seq.nextval,'" + ma_code.Text + "','" + User.UserLineCode + "',");
|
|
|
+ sql.Append("'" + ma_craftcode.Text + "','" + sc_stepcode.Text + "','" + pr_batchnum.Text + "','" + mm_prodcode + "',");
|
|
|
+ sql.Append("sysdate,'" + User.UserCode + "','" + bar_remain + "','" + bar_remain + "','" + mm_oneuseqty + "','" + bar_prodcode + "','" + ma_id + "')");
|
|
|
+ dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
+ dh.UpdateByCondition("barcode", "bar_place='" + ma_code.Text + "'", "bar_code='" + pr_batchnum.Text + "'");
|
|
|
+ //数据插入成功后加载Grid的数据
|
|
|
+ FillDataGridView();
|
|
|
+ OperateResult.AppendText(">>条码号" + pr_batchnum.Text + "备料成功\n", Color.Green, pr_batchnum);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>条码号:" + pr_batchnum.Text + "不存在,或者状态无效\n", Color.Red, pr_batchnum);
|
|
|
+ else OperateResult.AppendText(">>条码号" + pr_batchnum.Text + "对应的物料不是当前工单当前工序需要备的物料\n", Color.Red, pr_batchnum);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>当前岗位资源工序不在工单对应的途程中\n", Color.Red);
|
|
|
+ else OperateResult.AppendText(">>条码号:" + pr_batchnum.Text + "不存在,或者状态无效\n", Color.Red, pr_batchnum);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>" + ErrMessage + "\n", Color.Red);
|
|
|
+ else OperateResult.AppendText(">>当前岗位资源工序不在工单对应的途程中\n", Color.Red);
|
|
|
}
|
|
|
else OperateResult.AppendText(">>工单号不能为空\n", Color.Red, pr_batchnum);
|
|
|
}
|
|
|
@@ -174,6 +165,7 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
BatchProductDGV.Rows.RemoveAt(e.RowIndex);
|
|
|
dh.ExecuteSql("delete from makesourcestock where mss_id='" + id + "'", "delete");
|
|
|
+ OperateResult.AppendText(">>删除成功\n");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -213,39 +205,41 @@ namespace UAS_MES.Make
|
|
|
|
|
|
private void BatchProductDGV_CellEndEdit(object sender, DataGridViewCellEventArgs e)
|
|
|
{
|
|
|
- string id = BatchProductDGV.Rows[e.RowIndex].Cells["mss_id"].Value.ToString();
|
|
|
- string qty = "0";
|
|
|
- if (id != "0")
|
|
|
+ if (BatchProductDGV.Columns[e.ColumnIndex].Name == "mss_qty")
|
|
|
{
|
|
|
- try
|
|
|
+ string id = BatchProductDGV.Rows[e.RowIndex].Cells["mss_id"].Value.ToString();
|
|
|
+ string qty = "0";
|
|
|
+ if (id != "0")
|
|
|
{
|
|
|
- if (int.Parse(BatchProductDGV.Rows[e.RowIndex].Cells["mss_qty"].Value.ToString()) > 0)
|
|
|
+ try
|
|
|
{
|
|
|
- qty = BatchProductDGV.Rows[e.RowIndex].Cells["mss_qty"].Value.ToString();
|
|
|
+ if (int.Parse(BatchProductDGV.Rows[e.RowIndex].Cells["mss_qty"].Value.ToString()) > 0)
|
|
|
+ {
|
|
|
+ qty = BatchProductDGV.Rows[e.RowIndex].Cells["mss_qty"].Value.ToString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>数量必须大于0\n", Color.Red);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
- else
|
|
|
+ catch (Exception)
|
|
|
{
|
|
|
OperateResult.AppendText(">>数量必须大于0\n", Color.Red);
|
|
|
return;
|
|
|
}
|
|
|
+ dh.UpdateByCondition("makesourcestock", "mss_qty='" + qty + "'", "mss_id='" + id + "'");
|
|
|
}
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
- OperateResult.AppendText(">>数量必须大于0\n", Color.Red);
|
|
|
- return;
|
|
|
- }
|
|
|
- dh.UpdateByCondition("makesourcestock", "mss_qty='" + qty + "'", "mss_id='" + id + "'");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void BatchProductDGV_DataSourceChanged(object sender, EventArgs e)
|
|
|
+ private void BatchProductDGV_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
|
|
{
|
|
|
- for (int i = 0; i < BatchProductDGV.Rows.Count; i++)
|
|
|
- {
|
|
|
- if (BatchProductDGV.Rows[i].Cells["mss_id"].Value.ToString() == "0")
|
|
|
- {
|
|
|
- (BatchProductDGV.Columns["DeleteRow"] as DataGridViewImageColumn).Image = null;
|
|
|
- }
|
|
|
+ if (BatchProductDGV.Columns[e.ColumnIndex].Name == "DeleteRow") {
|
|
|
+ if (BatchProductDGV.Rows[e.RowIndex].Cells["mss_id"].Value.ToString() == "0")
|
|
|
+ e.Value = Properties.Resources.WhiteImage;
|
|
|
+ else
|
|
|
+ e.Value = Properties.Resources.bindingNavigatorDeleteItem_Image;
|
|
|
}
|
|
|
}
|
|
|
}
|