📄 slaboutformview.cpp
字号:
// slabOutFormView.cpp : implementation file
//
#include "stdafx.h"
#include "mestang.h"
#include "slabOutFormView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CslabOutFormView
IMPLEMENT_DYNCREATE(CslabOutFormView, CFormView)
CslabOutFormView::CslabOutFormView()
: CFormView(CslabOutFormView::IDD)
{
//{{AFX_DATA_INIT(CslabOutFormView)
m_furcode = _T("");
m_stack1 = _T("");
m_stack2 = _T("");
m_stack3 = _T("");
m_stackcount1 = 0;
m_stackcount2 = 0;
m_stackcount3 = 0;
m_out_date = 0;
//}}AFX_DATA_INIT
}
CslabOutFormView::~CslabOutFormView()
{
}
void CslabOutFormView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CslabOutFormView)
DDX_Control(pDX, IDC_LIST_FEED_RECORD, m_list_feed_record);
DDX_Control(pDX, IDC_CONDICTION, m_condic_out);
DDX_Control(pDX, IDC_LIST_SLAB_OUT_RECORD, m_list_slab_out_record);
DDX_Text(pDX, IDC_EDIT_FurCode, m_furcode);
DDX_Text(pDX, IDC_EDIT_STACK1, m_stack1);
DDX_Text(pDX, IDC_EDIT_STACK2, m_stack2);
DDX_Text(pDX, IDC_EDIT_STACK3, m_stack3);
DDX_Text(pDX, IDC_EDIT_STACKCOUNT1, m_stackcount1);
DDX_Text(pDX, IDC_EDIT_STACKCOUNT2, m_stackcount2);
DDX_Text(pDX, IDC_EDIT_STACKCOUNT3, m_stackcount3);
DDX_DateTimeCtrl(pDX, IDC_DATE_OUT_SEARCH, m_out_date);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CslabOutFormView, CFormView)
//{{AFX_MSG_MAP(CslabOutFormView)
ON_WM_DESTROY()
ON_NOTIFY(NM_DBLCLK, IDC_LIST_FEED_RECORD, OnDblclkListFeedRecord)
ON_BN_CLICKED(ID_SLAB_OUT_CONFIRM, OnSlabOutConfirm)
ON_BN_CLICKED(IDInPutSearch, OnInPutSearch)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CslabOutFormView diagnostics
#ifdef _DEBUG
void CslabOutFormView::AssertValid() const
{
CFormView::AssertValid();
}
void CslabOutFormView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CslabOutFormView message handlers
void CslabOutFormView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
// TODO: Add your specialized code here and/or call the base class
//设置板坯出库记录的框架大小
m_list_slab_out_record.SetWindowPos(NULL,0,0,1238,216,SWP_NOMOVE|SWP_NOZORDER | SWP_NOACTIVATE);
m_list_slab_out_record.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_INFOTIP | LVS_EDITLABELS);
m_list_slab_out_record.SetBkColor(RGB(224,255,255));
m_list_slab_out_record.SetTextBkColor(RGB(230 ,230 ,250));
m_list_slab_out_record.SetTextColor(RGB(85 ,26 ,139 ));
//设置列表框板坯出库记录标题名字
int k=0;
/*
m_list_slab_out_record.InsertColumn(k++,"炉号",LVCFMT_CENTER,200);
m_list_slab_out_record.InsertColumn(k++,"出库数(块)",LVCFMT_CENTER,200);
m_list_slab_out_record.InsertColumn(k++,"位置",LVCFMT_CENTER,200);
m_list_slab_out_record.InsertColumn(k++,"出库时间",LVCFMT_CENTER,200);
m_list_slab_out_record.InsertColumn(k++,"描述",LVCFMT_CENTER,400);
*/
m_list_slab_out_record.InsertColumn(k++,"垛位",LVCFMT_CENTER,200);
m_list_slab_out_record.InsertColumn(k++,"列",LVCFMT_CENTER,200);
m_list_slab_out_record.InsertColumn(k++,"位置",LVCFMT_CENTER,200);
m_list_slab_out_record.InsertColumn(k++,"炉号",LVCFMT_CENTER,200);
m_list_slab_out_record.InsertColumn(k++,"块数",LVCFMT_CENTER,100);
m_list_slab_out_record.InsertColumn(k++,"出库时间",LVCFMT_CENTER,400);
//设置挂料记录的框架大小
m_list_feed_record.SetWindowPos(NULL,0,0,1238,216,SWP_NOMOVE|SWP_NOZORDER | SWP_NOACTIVATE);
m_list_feed_record.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_INFOTIP | LVS_EDITLABELS);
m_list_feed_record.SetBkColor(RGB(224,255,255));
m_list_feed_record.SetTextBkColor(RGB(230 ,230 ,250));
m_list_feed_record.SetTextColor(RGB(85 ,26 ,139 ));
//设置列表框挂料记录标题名字
k=0;
m_list_feed_record.InsertColumn(k++,"炉号",LVCFMT_CENTER,120);
m_list_feed_record.InsertColumn(k++,"挂料数(块)",LVCFMT_CENTER,120);
m_list_feed_record.InsertColumn(k++,"计划号",LVCFMT_CENTER,200);
m_list_feed_record.InsertColumn(k++,"轧制批次号",LVCFMT_CENTER,140);
m_list_feed_record.InsertColumn(k++,"挂料时间",LVCFMT_CENTER,140);
//设置列表框控件字体
CFont m_ListFont;
m_ListFont.CreateFont(16,0,0,0,FW_NORMAL, 0,0,0,DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Times New Roman");
m_list_feed_record.SetFont(&m_ListFont);
m_list_slab_out_record.SetFont(&m_ListFont);
m_condic_out.SetCurSel(0);
m_out_date = CTime::GetCurrentTime();
//刷新挂料记录信息
m_list_feed_record.DeleteAllItems();
theApp.open_mes();
resultset &rs_feed = *(theApp.cn).select ("select * from CELL_INF order by TIME DESC");
Feed_List_Update(m_list_feed_record,rs_feed);
theApp.cn.close();
UpdateData(false);
}
void CslabOutFormView::OnDestroy()
{
CFormView::OnDestroy();
// TODO: Add your message handler code here
}
void CslabOutFormView::OnDblclkListFeedRecord(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
CString cast_id,ID[3];
int Amount[3];
Amount[0]=0;
Amount[1]=0;
Amount[2]=0;
int inf_row=m_list_feed_record.GetSelectionMark();
if (inf_row!=-1)
m_furcode = m_list_feed_record.GetItemText(inf_row,0);
cast_id.Format("'%s'",m_furcode);
theApp.open_mes();
resultset &rs_stack_inf = *(theApp.cn).select ("select * from STOCK_INF where CAST_ID="+cast_id+" order by ID ASC");
for(int row=0;!rs_stack_inf.eod();++rs_stack_inf,row++)
{
ID[row]=result_CString(rs_stack_inf,"ID");
ID[row].TrimRight();
Amount[row]=result_int(rs_stack_inf,"AMOUNT");
}
m_stack1=ID[0];
m_stack2=ID[1];
m_stack3=ID[2];
m_stackcount1=Amount[0];
m_stackcount2=Amount[1];
m_stackcount3=Amount[2];
theApp.cn.close();
UpdateData(false);
*pResult = 0;
}
void CslabOutFormView::OnSlabOutConfirm()
{
// TODO: Add your control notification handler code here
UpdateData(true);
//调用过程,删除板坯位置信息,写入记录表
theApp.open_mes();
statement &st_stack = *(theApp.cn).prepare ("begin RECORD_OUT_STOCK (:v_fur,:v_stack1,:v_sta_cou1,:v_stack2,:v_sta_cou2,:v_stack3,:v_sta_cou3); end;");
st_stack.bind(":v_fur", DT_TEXT) = m_furcode;
st_stack.bind(":v_stack1", DT_TEXT) = m_stack1;
st_stack.bind(":v_stack2", DT_TEXT) = m_stack2;
st_stack.bind(":v_stack3", DT_TEXT) = m_stack3;
st_stack.bind(":v_sta_cou1", DT_NUMBER) = (long) m_stackcount1;
st_stack.bind(":v_sta_cou2", DT_NUMBER) = (long) m_stackcount2;
st_stack.bind(":v_sta_cou3", DT_NUMBER) = (long) m_stackcount3;
st_stack.execute ();
st_stack.release ();
//要改成师兄给的表
m_list_slab_out_record.DeleteAllItems();
int condiction_no = m_condic_out.GetCurSel();
CString select_shift,select_date,si;
switch(condiction_no)
{
case 1:
{
select_date = m_out_date.Format("'%Y-%m-%d'"); //CTime->CString
resultset &rs_stack = *(theApp.cn).select ("select * from STOCK_INF_RECORD where TO_CHAR(OUT_TIME,'YYYY-MM-DD')="+select_date+" order by ID ASC");
Stack_List_Update(m_list_slab_out_record,rs_stack);
break;
}
default:
{
resultset &rs_stack = *(theApp.cn).select ("select * from STOCK_INF_RECORD order by ID ASC");
Stack_List_Update(m_list_slab_out_record,rs_stack);
break;
}
}
theApp.cn.close();
}
void CslabOutFormView::OnInPutSearch()
{
// TODO: Add your control notification handler code here
//查看挂料记录和出库记录情况
theApp.open_mes();
m_list_slab_out_record.DeleteAllItems();
m_list_feed_record.DeleteAllItems();
int condiction_no = m_condic_out.GetCurSel();
CString select_shift,select_date,si;
switch(condiction_no)
{
case 1:
{
select_date = m_out_date.Format("'%Y-%m-%d'"); //CTime->CString
resultset &rs_feed = *(theApp.cn).select ("select * from CELL_INF where TO_CHAR(TIME,'YYYY-MM-DD')="+select_date);
Feed_List_Update(m_list_feed_record,rs_feed);
resultset &rs_stack = *(theApp.cn).select ("select * from STOCK_INF_RECORD where TO_CHAR(OUT_TIME,'YYYY-MM-DD')="+select_date+" order by ID ASC");
Stack_List_Update(m_list_slab_out_record,rs_stack);
break;
}
default:
{
resultset &rs_feed = *(theApp.cn).select ("select * from CELL_INF order by TIME DESC");
Feed_List_Update(m_list_feed_record,rs_feed);
resultset &rs_stack = *(theApp.cn).select ("select * from STOCK_INF_RECORD order by ID ASC");
Stack_List_Update(m_list_slab_out_record,rs_stack);
break;
}
}
theApp.cn.close();
UpdateData(false);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -