将其转化为类似C#的排版
时间: 2025-09-06 08:44:22 AIGC 浏览: 4
以下是将给定的Delphi代码转化为类似C#排版的代码:
```csharp
private void reship_entry_cmdClick(object sender)
{
string strfile_no;
int i, n, strsort_row_no, strback_rec, strreship_rec;
string strlot_no, strback_qty, strback_box, strreship_qty, strreship_box, strsort_no;
string strfile_rec, strso_dlv_rec;
// 假设这里有一个类似TADOQuery的类,在C#中可以使用ADO.NET相关类代替
// 这里简单用一个占位类型
object query;
int count, k;
string strzaiko_ryo;
string strback_memo, strso_qty;
string strreship_file_no, strreship_file_rec, strreship_dlv_rec, strreship_lot;
strback_rec = this.pre_dlv_Grid.Row;
strreship_rec = this.reshipgrid.Row;
strfile_no = this.pre_dlv_grid.Cells[1, strback_rec].Trim();
strlot_no = this.pre_dlv_grid.Cells[2, strback_rec].Trim();
strback_qty = this.pre_dlv_grid.Cells[5, strback_rec].Trim();
strback_box = this.pre_dlv_grid.Cells[6, strback_rec].Trim();
strfile_rec = this.pre_dlv_grid.Cells[7, strback_rec].Trim();
strso_dlv_rec = this.pre_dlv_grid.Cells[8, strback_rec].Trim();
strreship_file_no = this.reshipgrid.Cells[2, strreship_rec].Trim();
strreship_lot = this.reshipgrid.Cells[6, strreship_rec].Trim();
strreship_qty = this.reshipgrid.Cells[4, strreship_rec].Trim();
strreship_box = this.reshipgrid.Cells[3, strreship_rec].Trim();
strreship_file_rec = this.reshipgrid.Cells[7, strreship_rec].Trim();
strreship_dlv_rec = this.reshipgrid.Cells[8, strreship_rec].Trim();
if (string.IsNullOrEmpty(strfile_no))
{
MessageBox.Show("请确定退/换货的数据!", "数据确认", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (string.IsNullOrEmpty(strreship_file_no))
{
MessageBox.Show("请确定补货的数据! ", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (strreship_qty != strback_qty || strback_box != strreship_box)
{
MessageBox.Show("出货数量和补货数量不一致,请确定!", "数据确认", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (MessageBox.Show("确定要进行补货处理吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
{
return;
}
// 假设这里有一个获取查询结果的方法
query = data.GetQuery($"select p_file_no from p_prod_dlv_reship_info where p_reshiped_file_rec='{strreship_file_rec}'", "connconfig");
// 假设这里有一个获取记录数的方法
count = GetRecordCount(query);
if (count > 0)
{
MessageBox.Show("补货操作已经完了,请确认.", "数据确认", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
else
{
if (string.IsNullOrEmpty(strreship_qty))
{
MessageBox.Show("补货数量不存在,请确定!", "数据确认", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
data.TransBegin("connconfig");
data.TransBegin("connsei");
strfile_no = this.pre_dlv_grid.Cells[1, strback_rec].Trim();
strlot_no = this.pre_dlv_grid.Cells[2, strback_rec].Trim();
strback_qty = this.pre_dlv_grid.Cells[3, strback_rec].Trim();
strback_box = this.pre_dlv_grid.Cells[4, strback_rec].Trim();
strfile_rec = this.pre_dlv_grid.Cells[7, strback_rec].Trim();
strso_dlv_rec = this.pre_dlv_grid.Cells[8, strback_rec].Trim();
strreship_file_no = this.reshipgrid.Cells[2, strreship_rec].Trim();
strreship_lot = this.reshipgrid.Cells[6, strreship_rec].Trim();
strreship_qty = this.reshipgrid.Cells[4, strreship_rec].Trim();
strreship_box = this.reshipgrid.Cells[3, strreship_rec].Trim();
strreship_file_rec = this.reshipgrid.Cells[7, strreship_rec].Trim();
strreship_dlv_rec = this.reshipgrid.Cells[8, strreship_rec].Trim();
n = data.execSql_int($"insert into p_prod_dlv_reship_info (p_reship_qty, p_reship_box, p_reshiped_qty, p_reshiped_box, p_file_no, p_file_rec, p_so_dlv_rec, p_lot_no, p_reshiped_file_no, p_reshiped_file_rec, p_reshiped_so_dlv_rec, p_reshiped_lot_no) values('{strreship_qty}', '{strreship_box}', '{strreship_qty}', '{strreship_box}', '{strfile_no}', '{strfile_rec}', '{strso_dlv_rec}', '{strlot_no}', '{strreship_file_no}', '{strreship_file_rec}', '{strreship_dlv_rec}', '{strreship_lot}')", "connconfig");
if (n > 9)
{
// 可以添加成功后的逻辑
}
else
{
MessageBox.Show("数据变更失败,请重试");
data.TransRollback("connconfig");
data.TransRollback("connsei");
return;
}
data.TransCommit("connconfig");
data.TransCommit("connsei");
MessageBox.Show("补货录入成功!");
}
}
// 假设的获取记录数的方法,实际需要根据具体情况实现
private int GetRecordCount(object query)
{
// 这里只是占位实现
return 0;
}
```
阅读全文
相关推荐


















