int UpdateQATable(out int reinspect) { reinspect = 0; DatabaseSet.產品檢驗DataTable qaTable = new DatabaseSet.產品檢驗DataTable(); foreach (DataRow row in _dataTable.Rows) { if (row.RowState != DataRowState.Added) { continue; } if (row["待驗數量"] == DBNull.Value || row["待驗數量"] == null) { continue; } int amount = (int)row["待驗數量"]; if (amount == 0) { continue; } if (row["取代編號"] != DBNull.Value) { reinspect += 產品檢驗TableAdapter.Instance.Reinspect(row["取代編號"].ToString(), row["編號"].ToString(), row["QCN"].ToString(), (int)row["待驗數量"]); } else { DatabaseSet.產品檢驗Row qaRow = qaTable.New產品檢驗Row(); qaRow["工時資料編號"] = row["編號"]; qaRow["待驗數量"] = amount; qaRow["QCN"] = row["QCN"]; qaRow["送檢次數"] = 1; qaRow["最後送檢編號"] = row["編號"]; qaRow["最後檢驗紀錄"] = false; qaRow["檢驗"] = false; qaRow["重驗"] = false; qaRow["送檢日期"] = DateTime.Now; if (Settings.BypassQA) { qaRow["檢驗"] = true; qaRow["檢驗結果"] = true; qaRow["日期"] = DateTime.Now; qaRow["最後檢驗紀錄"] = true; } qaTable.Add產品檢驗Row(qaRow); } } return(產品檢驗TableAdapter.Instance.Update(qaTable)); }
public virtual DatabaseSet.產品檢驗DataTable GetData() { this.Adapter.SelectCommand = this.CommandCollection[0]; DatabaseSet.產品檢驗DataTable dataTable = new DatabaseSet.產品檢驗DataTable(); this.Adapter.Fill(dataTable); return dataTable; }