📄 storageview.cpp
字号:
this->OnInitialUpdate();
}
BEGIN_EVENTSINK_MAP(CStorageView, CRecordView)
//{{AFX_EVENTSINK_MAP(CStorageView)
ON_EVENT(CStorageView, IDC_storagegrid, -600 /* Click */, OnClickstoragegrid, VTS_NONE)
ON_EVENT(CStorageView, IDC_storagegrid, -601 /* DblClick */, OnDblClickstoragegrid, VTS_NONE)
ON_EVENT(CStorageView, IDC_factorygrid, -600 /* Click */, OnClickfactorygrid, VTS_NONE)
ON_EVENT(CStorageView, IDC_goodgrids, -600 /* Click */, OnClickgoodgrids, VTS_NONE)
//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()
void CStorageView::OnClickstoragegrid()
{
// TODO: Add your control notification handler code here
row=m_storagegrid.GetRow ();
// col=m_storagegrid.GetCol ();
m_storagegrid.SetRow(row);
m_storagegrid.SetCol(0);
m_storageid=m_storagegrid.GetText ();
m_storagegrid.SetRow(row);
m_storagegrid.SetCol(1);
m_storagename=m_storagegrid.GetText ();
m_storagegrid.SetRow(row);
m_storagegrid.SetCol(2);
m_storagelocate=m_storagegrid.GetText ();
m_storagegrid.SetRow(row);
m_storagegrid.SetCol(3);
m_storagearea=m_storagegrid.GetText ();
this->UpdateData (false);
}
void CStorageView::OnDblClickstoragegrid()
{
// TODO: Add your control notification handler code here
/* edit m_edit;
CString str;
col=m_storagegrid.GetCol ();
row=m_storagegrid.GetRow ();
m_storagegrid.SetRow(row);
m_storagegrid.SetCol(0);
MessageBox(m_storagegrid.GetText ());
m_edit.m_edit=m_storagegrid.GetText ();
m_storagegrid.SetRow(row);
m_storagegrid.SetCol(0);
str= m_storagegrid.GetText ();
if(m_pSet->IsOpen())
{m_pSet->Close();
}
m_pSet->Open();
m_pSet->m_strFilter .Format ("id='%s'",str);
m_pSet->Requery ();
if(m_edit.DoModal()==IDOK)
{
m_pSet->Edit();
// m_edit.UpdateData ();
m_pSet->m_id=m_storageid ;
m_pSet->m_name= m_storagename;
m_pSet->m_locate=m_storagelocate;
m_pSet->m_area=m_storagearea;
m_pSet->Update();
m_edit.UpdateData (false);
}
//StorageRefresh();
//
*/
}
void CStorageView::Onstorageadd()
{
// TODO: Add your control notification handler code here
m_pSet->AddNew();
UpdateData ();
m_pSet->m_id=m_storageid ;
m_pSet->m_name=m_storagename ;
m_pSet->m_locate=m_storagelocate ;
m_pSet->m_area=m_storagearea ;
m_pSet->Update();
m_pSet->Requery ();
UpdateData (false);
m_pSet->MoveFirst();
StorageRefresh();
}
void CStorageView::Onstoragedel()
{
// TODO: Add your control notification handler code here
UpdateData();
m_pSet->m_strFilter .Format ("id='%s'",m_storageid);
if(m_pSet->Requery ())
{
m_pSet->GetStatus(status);
m_pSet->Delete();
if(status.m_lCurrentRecord==0)
m_pSet->MoveFirst();
else
m_pSet->MoveLast();
m_pSet->Requery();
}
m_storagegrid.RemoveItem(row);
}
void CStorageView::OnClickfactorygrid()
{
// TODO: Add your control notification handler code here
row=m_factorygrid.GetRow ();
m_factorygrid.SetRow(row);
m_factorygrid.SetCol(0);
m_fatid=m_factorygrid.GetText ();
m_factorygrid.SetRow(row);
m_factorygrid.SetCol(1);
m_fatname=m_factorygrid.GetText ();
m_factorygrid.SetRow(row);
m_factorygrid.SetCol(2);
m_fataddress=m_factorygrid.GetText ();
m_factorygrid.SetRow(row);
m_factorygrid.SetCol(3);
m_fatemail=m_factorygrid.GetText ();
m_factorygrid.SetRow(row);
m_factorygrid.SetCol(4);
m_fattel=m_factorygrid.GetText ();
m_factorygrid.SetRow(row);
m_factorygrid.SetCol(5);
m_fatman=m_factorygrid.GetText ();
m_factorygrid.SetRow(row);
m_factorygrid.SetCol(6);
m_fatother=m_factorygrid.GetText ();
this->UpdateData (false);
}
void CStorageView::Onfactorageadd()
{
// TODO: Add your control notification handler code here
m_factoryset.Open();
UpdateData ();
m_factoryset.AddNew();
m_factoryset.m_id=m_fatid ;
m_factoryset.m_name=m_fatname ;
m_factoryset.m_address=m_fataddress ;
m_factoryset.m_email=m_fatemail ;
m_factoryset.m_tel=m_fattel;
m_factoryset.m_relatename=m_fatman;
m_factoryset.m_other=m_fatother;
m_factoryset.Update();
m_factoryset.Requery();
UpdateData (false);
m_factoryset.Close();
FactoryRefresh();
}
void CStorageView::Onfactorageedit()
{
// TODO: Add your control notification handler code here
m_factoryset.Open();
UpdateData ();
m_factoryset.Edit();
m_factoryset.m_id=m_fatid ;
m_factoryset.m_name=m_fatname ;
m_factoryset.m_address=m_fataddress ;
m_factoryset.m_email=m_fatemail ;
m_factoryset.m_tel=m_fattel;
m_factoryset.m_relatename=m_fatman;
m_factoryset.m_other=m_fatother;
m_factoryset.Update();
m_pSet->Requery ();
UpdateData (false);
m_factoryset.Close();
FactoryRefresh();
}
void CStorageView::Onfactoragedel()
{
// TODO: Add your control notification handler code here
CRecordsetStatus status;
m_factoryset.Open();
m_factoryset.m_strFilter .Format ("id='%s'",m_fatid);
if( m_factoryset.Requery ())
{
m_factoryset.GetStatus(status);
m_factoryset.Delete();
if(status.m_lCurrentRecord==0)
m_factoryset.MoveFirst();
else
m_factoryset.MoveLast();
m_factoryset.Requery();
}
m_factorygrid.RemoveItem(row);
// m_factorygrid.UpdateData();
UpdateData (false);
m_factoryset.Close();
}
void CStorageView::Onstorageedit()
{
// TODO: Add your control notification handler code here
//UpdateData();
storageeditdlg edit;
edit.m_id=m_storageid;
edit.m_name=m_storagename;
edit.m_locate=m_storagelocate;
edit.m_area=m_storagearea;
if(edit.DoModal()==IDOK)
{
m_pSet->Edit();
m_pSet->m_id=edit.m_id;
m_pSet->m_name= edit.m_name;
m_pSet->m_locate=edit.m_locate;
m_pSet->m_area=edit.m_area;
m_pSet->Update();
m_pSet->Requery();
UpdateData(false);
}
/* m_pSet->GetStatus(status);
if(status.m_lCurrentRecord==0)
m_pSet->MoveFirst();
else
m_pSet->MoveLast();*/
m_pSet->MoveFirst();
StorageRefresh();
}
void CStorageView::OnMENUITEMentrygood()
{
// TODO: Add your command handler code here
entrygooddlg entry;
//entry.DoMedle();
}
void CStorageView::Onentrycommand()
{
// TODO: Add your control notification handler code here
CString temp;
UpdateData();
int amount=0;
if(inout==1)//进货
{
m_pSet->m_strFilter .Format ("id='%s'",m_entrystorageid);
if(!m_pSet->Requery ())
{
MessageBox("没有这个仓库");
}
else
{
m_goodset.Open();
m_goodset.m_strFilter .Format ("good_id='%s'",m_entrygoodid);
if(!m_goodset.Requery ())
{
MessageBox("没有这个商品");
}
else
{
m_factoryset.Open();
m_factoryset.m_strFilter .Format ("id='%s'",m_entryfactoryid);
if(!m_factoryset.Requery ())
{
MessageBox("没有这个厂");
}
else
{
storeset entry;
temp="good_id="+m_entrygoodid+"storage_id="+m_entrystorageid;
entry.Open();
entry.m_strFilter =temp;
if(!entry.Requery ())
{
entry.AddNew();
entry.m_good_id =m_entrygoodid;
entry.m_storage_id =m_entrystorageid;
amount=atoi(entry.m_entryamount) +atoi(m_entryamount);
entry.m_entryamount =m_entryamount;
temp.Format("%s",amount);
entry.m_nowamount =temp;
entry.m_other ="NULL";
entry.Update();
entry.Requery ();
}
else
{
entry.Edit();
entry.m_good_id =m_entrygoodid;
entry.m_storage_id =m_entrystorageid;
amount=atoi(entry.m_entryamount) +atoi(m_entryamount);
entry.m_entryamount =m_entryamount;
temp.Format("%s",amount);
entry.m_nowamount =temp;
entry.m_other ="NULL";
entry.Update();
entry.Requery ();
}
entry.Close();
}
}
}
}
if(inout==2)//提货
{
}
}
void CStorageView::OnClickgoodgrids()
{
// TODO: Add your control notification handler code here
row=m_goodgrids.GetRow ();
// col=m_storagegrid.GetCol ();
m_goodgrids.SetRow(row);
m_goodgrids.SetCol(0);
m_goodid=m_goodgrids.GetText ();
m_goodgrids.SetRow(row);
m_goodgrids.SetCol(1);
m_goodname=m_goodgrids.GetText ();
m_goodgrids.SetRow(row);
m_goodgrids.SetCol(2);
m_goodprice=m_goodgrids.GetText ();
m_goodgrids.SetRow(row);
m_goodgrids.SetCol(3);
m_goodother=m_goodgrids.GetText ();
this->UpdateData (false);
}
void CStorageView::Ongoodadd()
{
// TODO: Add your control notification handler code here
UpdateData ();
m_goodset.Open();
m_goodset.AddNew();
m_goodset.m_id=m_goodid ;
m_goodset.m_name=m_goodname ;
m_goodset.m_price=m_goodprice ;
m_goodset.m_other=m_goodother ;
m_goodset.Update();
m_goodset.Requery();
UpdateData (false);
m_goodset.Close();
GoodRefresh();
}
void CStorageView::Ongooddel()
{
// TODO: Add your control notification handler code here
m_goodset.Open();
m_goodset.m_strFilter .Format ("good_id='%s'",m_goodid);
if(m_goodset.Requery ())
{
m_goodset.GetStatus(status);
m_goodset.Delete();
if(status.m_lCurrentRecord==0)
m_goodset.MoveFirst();
else
m_goodset.MoveLast();
m_goodset.Requery();
}
m_goodgrids.RemoveItem(row);
// m_factorygrid.UpdateData();
UpdateData (false);
m_goodset.Close();
}
void CStorageView::Ongoodedit()
{
// TODO: Add your control notification handler code here
UpdateData();
m_goodset.Open();
m_goodset.Edit();
m_goodset.m_id=m_goodid ;
m_goodset.m_name=m_goodname ;
m_goodset.m_price=m_goodprice ;
m_goodset.m_other=m_goodother ;
m_goodset.Update();
m_goodset.Requery();
UpdateData(false);
m_goodset.Close();
GoodRefresh();
}
void CStorageView::Onentrygood()
{
// TODO: Add your control notification handler code here
inout=1;
}
void CStorageView::Onoutgood()
{
// TODO: Add your control notification handler code here
inout=2;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -