diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs index 3c2946b5..a86b75ee 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs @@ -677,10 +677,38 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); await conn.OpenAsync(); } + string wip_sql = "select b.barcode_id,a.wip_type from jhames.wip_info a,jhames.barcode_info b where a.wip_id = b.wip_id and a.wip_no = '" + wipNO + "'"; + DataTable dtWip = new DataTable(); + using (var cmd = conn.CreateCommand()) + { + cmd.CommandText = wip_sql; + + using (var reader = await cmd.ExecuteReaderAsync()) + { + if (reader.HasRows) + { + dtWip = DataReaderToDataTable(reader); + } + } + } + + string wipType = ""; + int barcode_id = -1; + if (dtWip.Rows.Count > 0) + { + wipType = dtWip.Rows[0]["WIP_TYPE"].ToString(); + barcode_id = int.Parse(dtWip.Rows[0]["BARCODE_ID"].ToString()); + } + string kp_sql = "select kp_no, count(kp_seq) as kp_qty from jhames.wip_kp where wip_no = '" + wipNO + "' group by kp_no"; DataTable dtKp = new DataTable(); + if (wipType == "R") + { + kp_sql = "select item_no as kp_no,count(item_no) kp_qty from jhames.barcode_item where barcode_id = " + barcode_id + " group by item_no"; + } + using (var cmd = conn.CreateCommand()) { cmd.CommandText = kp_sql;