private void cbeArkCode_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { gcArk.DataSource = null; GroupArkEntity arkEntity = new GroupArkEntity(); DataSet ds = arkEntity.GetArkNumber(cbeArkCode.Text.Trim()); if (ds.Tables[0].Rows.Count > 1) { MessageService.ShowMessage("柜号存在重复或不存在请重新输入", "${res:Global.SystemInfo}"); return; } if (ds.Tables[0].Rows.Count == 1) { //查询明细表中柜主键为同一个且托状态为可用的托号 DataSet dsCdetail = arkEntity.GetContainerDetailInf(ds.Tables[0].Rows[0]["CONTAINER_KEY"].ToString().Trim()); if (dsCdetail != null) { //根据查询出来的托号,在包装表中查询托对应的详细信息 DataSet dsWipCInf = arkEntity.GetWipConInf(dsCdetail); DataTable dt01 = new DataTable(); dt01 = dsWipCInf.Tables[0]; for (int i = 0; i < dt01.Rows.Count; i++) { DataRow dr = dt01.Rows[i]; string grade = Convert.ToString(dr[WIP_CONSIGNMENT_FIELDS.FIELDS_GRADE]); dr[WIP_CONSIGNMENT_FIELDS.FIELDS_GRADE] = GetProductGradeDisplayText(grade); } if (gvArk.DataSource == null) { if (dt01 != null) { if (!dt01.Columns.Contains("ROWNUMBER")) { dt01.Columns.Add("ROWNUMBER"); } for (int i = 0; i < dt01.Rows.Count; i++) { dt01.Rows[i]["ROWNUMBER"] = i + 1; } gcArk.DataSource = dt01; } else { gcArk.DataSource = null; } } } cbeArkCode.Enabled = false; } else if (ds.Tables[0].Rows.Count < 1) { gcArk.DataSource = null; cbeArkCode.Enabled = false; } } }
public void SelectInf() { _ArkCode = cbeArkCode.Text.ToString().Trim(); if (string.IsNullOrEmpty(_ArkCode)) { MessageService.ShowMessage("请输入柜号。", "${res:Global.SystemInfo}"); return; } gcArk.DataSource = null; GroupArkEntity arkEntity = new GroupArkEntity(); DataSet ds = arkEntity.GetArkNumber(_ArkCode); if (ds.Tables[0].Rows.Count > 1) { MessageService.ShowMessage("柜号存在重复或不存在请重新输入", "${res:Global.SystemInfo}"); return; } if (ds.Tables[0].Rows.Count == 1) { //查询明细表中柜主键为同一个且托状态为可用的托号 DataSet dsCdetail = arkEntity.GetContainerDetailInf(ds.Tables[0].Rows[0]["CONTAINER_KEY"].ToString().Trim()); if (dsCdetail.Tables[0] != null) { //根据查询出来的托号,在包装表中查询托对应的详细信息 DataSet dsWipCInf = arkEntity.GetWipConInf(dsCdetail); DataTable dt01 = new DataTable(); dt01 = dsWipCInf.Tables[0]; for (int i = 0; i < dt01.Rows.Count; i++) { DataRow dr = dt01.Rows[i]; string grade = Convert.ToString(dr[WIP_CONSIGNMENT_FIELDS.FIELDS_GRADE]); dr[WIP_CONSIGNMENT_FIELDS.FIELDS_GRADE] = GetProductGradeDisplayText(grade); } if (gvArk.DataSource == null) { if (dt01 != null) { if (!dt01.Columns.Contains("ROWNUMBER")) { dt01.Columns.Add("ROWNUMBER"); } for (int i = 0; i < dt01.Rows.Count; i++) { dt01.Rows[i]["ROWNUMBER"] = i + 1; } gcArk.DataSource = dt01; } else { gcArk.DataSource = null; } } } else { MessageService.ShowMessage("柜号中不存在托信息,请重新选择柜信息。", "${res:Global.SystemInfo}"); return; } } else { MessageService.ShowMessage("不存在柜信息。", "${res:Global.SystemInfo}"); return; } }