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; } } }
private void tsbAllSplit_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(cbeArkCode.Text.ToString().Trim())) { MessageService.ShowMessage("请输入柜号。", "${res:Global.SystemInfo}"); return; } _ArkCode = cbeArkCode.Text.ToString().Trim(); //获取对应柜号主键,然后修改明细表信息,保存界面托信息,修改包装表中状态为已组柜 GroupArkEntity arkEntity = new GroupArkEntity(); DataSet ds = arkEntity.GetArkNumber(_ArkCode); SplitArkEntity splitEntity = new SplitArkEntity(); if (ds.Tables[0].Rows.Count < 1) { MessageService.ShowMessage("该柜未组柜不可拆柜。", "${res:Global.SystemInfo}"); return; } //查询明细表中柜主键为同一个且托状态为可用的托号 DataSet dsCdetail = arkEntity.GetContainerDetailInf(ds.Tables[0].Rows[0]["CONTAINER_KEY"].ToString().Trim()); DataTable dtCdetail = dsCdetail.Tables[0]; if (dtCdetail.Rows.Count < 1) { MessageService.ShowMessage("该柜不存在可拆托信息。", "${res:Global.SystemInfo}"); return; } if (MessageService.AskQuestion("你确定要整柜拆除么?", "整柜拆柜")) { if (ds != null) { if (ds.Tables[0].Rows.Count > 1) { MessageService.ShowMessage("柜号存在重复或不存在请重新输入", "${res:Global.SystemInfo}"); return; } if (ds.Tables[0].Rows.Count == 1) { bool bo = splitEntity.SplitArk(ds); if (bo) { MessageService.ShowMessage("整柜拆柜成功", "${res:Global.SystemInfo}"); BindArkCode(); gcArk.DataSource = null; } } } } }
private void tsbSave_Click(object sender, EventArgs e) { _ArkCode = cbeArkCode.Text.Trim(); if (string.IsNullOrEmpty(cbeArkCode.Text.ToString().Trim())) { MessageService.ShowMessage("柜号不能为空。", "${res:Global.SystemInfo}"); return; } //获取对应柜号主键,然后修改明细表信息,保存界面托信息,修改包装表中状态为已组柜 GroupArkEntity arkEntity = new GroupArkEntity(); DataSet ds = arkEntity.GetArkNumber(_ArkCode); if (ds.Tables[0].Rows.Count < 1) { MessageService.ShowMessage("该柜未组柜不可拆柜。", "${res:Global.SystemInfo}"); return; } if (MessageService.AskQuestion("你确定要保存吗?", "拆柜")) { int flag = 0; DataTable dt = new DataTable(); //获取界面数据表信息 if (gvArk.DataSource != null) { dt = ((DataView)gvArk.DataSource).Table.GetChanges(DataRowState.Modified); } else { dt = null; } //查询明细表中柜主键为同一个且托状态为可用的托号 DataSet dsCdetail = arkEntity.GetContainerDetailInf(ds.Tables[0].Rows[0]["CONTAINER_KEY"].ToString().Trim()); DataTable dtCdetail = dsCdetail.Tables[0]; dtCdetail.TableName = "DETAILPALLNO"; if (dtCdetail == null) { MessageService.ShowMessage("该柜不存在可拆托信息。", "${res:Global.SystemInfo}"); return; } DataSet dsIn = new DataSet(); dsIn.Merge(dtCdetail); Hashtable hashTable = new Hashtable(); hashTable.Add("CREATOR", PropertyService.Get(PROPERTY_FIELDS.USER_NAME)); hashTable.Add("CONTAINER_CODE", _ArkCode); DataTable tableParam = SolarViewer.Hemera.Share.Common.CommonUtils.ParseToDataTable(hashTable); tableParam.TableName = "HASH"; dsIn.Merge(tableParam); DataTable dtArkKey = ds.Tables[0]; dtArkKey.TableName = "ARKKEY"; dsIn.Merge(dtArkKey); bool bo = arkEntity.UpdateArkInf(dsIn, dt, flag); if (bo) { MessageService.ShowMessage("保存成功。", "${res:Global.SystemInfo}"); BindArkCode(); gcArk.DataSource = null; //清空datasource } else { MessageService.ShowMessage("保存失败。", "${res:Global.SystemInfo}"); } } }
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; } }