110,548
社区成员
发帖
与我相关
我的任务
分享
bool p_query()
{
int v_count = this.efGrid1.Cols.Count-1;
for(int i=2;i<v_count;i++)
{
this.efGrid1.Cols.Remove(v_count-i+2);
}
if(string.Equals( this.efLabelText1.EFEnterText.Trim(),""))
{
MessageBox.Show("请填写你要查询的材料号!");
return false;
}
string out_mat_no=this.efLabelText1.EFEnterText;
if(out_mat_no.Length>7)
{
out_mat_no=out_mat_no.Substring(0,out_mat_no.Length-1);
}
EI.EIInfo inBlock = new EI.EIInfo();
EI.EIInfo outBlock;
inBlock.SetColName(1,"out_mat_no");
inBlock.SetColVal(1,"out_mat_no",out_mat_no);
outBlock = EI.EITuxedo.CallService("mm0022a1_inq", inBlock);
//判断调用是否正确
if ((outBlock.sys_info.flag != 0) ||(outBlock.sys_info.sqlcode!=0))
{
this.EFMsgInfo = outBlock.sys_info.msg;
return true;
}
//返回查询结果
if (outBlock.blk_info[0].row > 0) //查询到记录
{
string whole_backlog_act=outBlock.GetColVal(1,"whole_backlog_act");
string key =string.Empty;
string pd = "product_time_";
System.Collections.Hashtable hs= new System.Collections.Hashtable();
hs.Add("product_time_M1", "熔铸生产持续时间");
hs.Add("product_time_M4", "锯切生产持续时间");
hs.Add("product_time_H1", "铣面生产持续时间");
hs.Add("product_time_HF", "加热生产持续时间");
hs.Add("product_time_HR", "轧制生产持续时间");
hs.Add("product_time_HB", "冷却箱/区持续时间");
hs.Add("product_time_C1", "轧制道次1生产持续时间");
hs.Add("product_time_C2", "轧制道次2生产持续时间");
hs.Add("product_time_CA", "退火生产持续时间");
hs.Add("product_time_CB", "退火冷却箱/区持续时间");
hs.Add("product_time_CL", "拉矫生产持续时间");
hs.Add("product_time_CE", "切边生产持续时间");
hs.Add("product_time_CS", "纵切生产持续时间");
while (whole_backlog_act.Length > 0)
{
if (whole_backlog_act.Length > 2)
{
key = whole_backlog_act.Substring(0, 2);
whole_backlog_act = whole_backlog_act.Remove(0, 2);
}
else
{
key = whole_backlog_act;
whole_backlog_act = string.Empty;
}
if ("H2".Equals(key))
{
key = string.Concat(pd, "HF");
C1.Win.C1FlexGrid.Column col = this.efGrid1.Cols.Add();
col.Caption = hs.ContainsKey(key) ? hs[key].ToString(): string.Empty;
col.Name = key;
key = string.Concat(pd, "HR");
C1.Win.C1FlexGrid.Column colHR = this.efGrid1.Cols.Add();
colHR.Caption = hs.ContainsKey(key) ? hs[key].ToString(): string.Empty;
colHR.Name = key;
//冷却箱/区持续时间
key = string.Concat(pd, "HB");
C1.Win.C1FlexGrid.Column colHB = this.efGrid1.Cols.Add();
colHB.Caption = hs.ContainsKey(key) ? hs[key].ToString(): string.Empty;
colHB.Name = key;
}
else
{
key = string.Concat(pd, key);
C1.Win.C1FlexGrid.Column col2 = this.efGrid1.Cols.Add();
col2.Name = key;
col2.Caption = hs.ContainsKey(key) ? hs[key].ToString(): string.Empty;
if (string.Concat(pd, "CA").Equals(key))
{
//冷却箱/区持续时间
key = string.Concat(pd, "CB");
C1.Win.C1FlexGrid.Column colHB = this.efGrid1.Cols.Add();
colHB.Caption = hs.ContainsKey(key) ? hs[key].ToString(): string.Empty;
colHB.Name = key;
}
}
}
if(NEF.Utility.IsBlockHasError(outBlock, this))
{
return true;
}
//填充GRID
outBlock.GetBlockVal(efGrid1);
efGrid1.AutoSizeCols();
this.EFMsgInfo =" 查询成功, " +"共有" +outBlock.blk_info[0].Row+"条记录满足条件!";
}
else //未查询到记录
{
this.efGrid1.Rows.Count = 1;
this.EFMsgInfo ="没查询到满足条件的记录!";
}
return true;
}
#endregion