前端:
if (Consts.STR_ENTUPD_FLG_ENT.Equals(strEntUpdFlg))
{
DataRow[] drArr = this.dtHaisyaData.Select("JIGYOUSYO_CD = '" + this.cmbS_JIGYOUSYO_CD.SelectedValue.ToString()
+ "' and UKE_DATE = '" + this.dtpS_UKE_DATE.Value.ToString("yyyy/MM/dd")
+ "' and TORIHIKISAKI_BIO_CD = '" + this.cmbE_TORIHIKISAKI_BIO_CD.SelectedValue.ToString() + "'");
if (drArr.Count() == 0)
{
int_ROT_NO = 0;
}
else
{
int_ROT_NO = drArr.Max(s => Convert.ToInt32(s.Field<string>("ROT_NO")));//取所取数组集合里最大列名番号
}
string szRotNo = this.int_ROT_NO.ToString("00");//格式转化
DataRow dr = this.dtHaisyaData.Rows[this.dtHaisyaData.Rows.Count - 1];
// "ロットNo";
dr["ROT_NO"] = int_ROT_NO + 1;
ROT_NO_Select = (int_ROT_NO + 1).ToString();
前端2
DataRow[] drArr = this.dtHaisyaData.Select();//查询全部
if (drArr.Count() == 0)
{
int_ROT = 0;
}
else
{
int_ROT = drArr.Max(s => Convert.ToInt32(s.Field<decimal>("ROWNUM")));
}
DataRow drNew = this.dtHaisyaData.NewRow();
drNew["ACTION_FLG"] = Consts.STR_ACTION_MODE_A;
drNew["ROWNUM"] = int_ROT + 1;
SQL:
SELECT LPAD(NVL(MAX(TO_NUMBER(ROT_NO)) + 1, 1), 2, '0')AS ROT_NO
FROM T_HAISYA
WHERE UKE_DATE = TO_DATE(@UKE_DATE, 'yyyy/MM/dd') --受入日
AND JIGYOUSYO_CD = @JIGYOUSYO_CD --事業所コード
AND TORIHIKISAKI_BIO_CD = @TORIHIKISAKI_BIO_CD --取引先コード(バイオマス業者)