#include "syInc.h"
#ifdef 窗口交易点
/*****************************
点击事件
******************************/
class CPosUiTypeAddBtnClickListener:public CSyViewClickListener{
public:
// 构造
CPosUiTypeAddBtnClickListener(CPosUiTypeAddDlg * lpclObj){
m_lpclOuterDlg = lpclObj;
}
virtual ~CPosUiTypeAddBtnClickListener(){
}
// 点击
syMsgRetE onClick(CSyView * lpclView){
CPosUiTypeAddDlg * lpclDlg = m_lpclOuterDlg;
if(NULL != lpclView && NULL != lpclDlg){
switch(lpclView->getID()){
// 功能选择
case(CPosUiTypeAddDlg::CTRL_ID_FUNCTION):{
lpclDlg->clickFunction();
break;
}
// 管理主页
case(CPosUiTypeAddDlg::CTRL_ID_ADMIN_INDEX):{
lpclDlg->clickAdminIndex();
break;
}
// 商店管理
case(CPosUiTypeAddDlg::CTRL_ID_STORE_ADMIN):{
lpclDlg->clickStoreAdmin();
break;
}
// 商品类别
case(CPosUiTypeAddDlg::CTRL_ID_GOODS_TYPE):{
lpclDlg->clickGoodsType();
break;
}
// 重置按钮
case(CPosUiTypeAddDlg::CTRL_ID_RESET):{
lpclDlg->clickReset();
break;
}
// 退格按钮
case(CPosUiTypeAddDlg::CTRL_ID_BACKSPACE):{
lpclDlg->clickBackspace();
break;
}
// 保存按钮
case(CPosUiTypeAddDlg::CTRL_ID_SAVE):{
lpclDlg->clickSave();
break;
}
// 返回按钮
case(CPosUiTypeAddDlg::CTRL_ID_RETURN):{
lpclDlg->clickReturn();
break;
}
// 关闭按钮
case(CPosUiTypeAddDlg::CTRL_ID_CLOSE):{
lpclDlg->clickClose();
break;
}
// 类别显示框
case(CPosUiTypeAddDlg::CTRL_ID_TYPE_SHOW_FRAME):{
lpclDlg->clickTypeShowFrame();
break;
}
// 类别编辑框
case(CPosUiTypeAddDlg::CTRL_ID_TYPE_EDIT_FRAME):{
lpclDlg->clickEditFrame(lpclView);
break;
}
// 是否启用按钮
case(CPosUiTypeAddDlg::CTRL_ID_IS_ENABLE):{
lpclDlg->clickIsEnable(lpclView);
break;
}
default:
break;
}
}
return SY_MSG_RET_PROC_OK;
}
private:
CPosUiTypeAddDlg * m_lpclOuterDlg;
};
/*****************************
构造
******************************/
CPosUiTypeAddDlgInstanceState::CPosUiTypeAddDlgInstanceState(){
m_bIsFocusShowed = CPosUiGoodsTypeDlg::FOCUS_SHOW_FLG_VALUE_ERR_NOT_EXIST;
m_bTypeFlg = CPosUiGoodsTypeDlg::GOODS_TYPE_VALUE_ERR_NOT_EXIST;
m_bTypeValue = CPosUiGoodsTypeDlg::TYPE_VALUE_ERR_NOT_EXIST;
m_bGoodsTypeFirstGradeFocusViewItemCnt = 0;
m_bGoodsTypeFirstGradeFocusPage = 0;
m_bCurrentFocusID = 0;
m_bCurrentParentedFocusID = 0;
m_bGoodsTypeLastViewItemCnt = 0;
m_bGoodsTypeLastPage = 0;
}
/*****************************
析构
******************************/
CPosUiTypeAddDlgInstanceState::~CPosUiTypeAddDlgInstanceState(){
}
/*****************************
构造
******************************/
CPosUiTypeAddDlg::CPosUiTypeAddDlg(CSyViewCtx * lpclCtx):CSyViewDlg(lpclCtx){
m_bStatusValue = ENABLE_VALUE;
}
/*****************************
析构
******************************/
CPosUiTypeAddDlg::~CPosUiTypeAddDlg(){
}
/*****************************
获得返回信息实例状态
******************************/
CSyViewDlgInstanceState * CPosUiTypeAddDlg::obtainBackInfoInstanceState(){
CPosUiTypeAddDlgInstanceState * lpclState = new CPosUiTypeAddDlgInstanceState();
if(NULL != lpclState){
CPosUiTypeAddDlgInstanceState * lpclTypeAddState = dynamic_cast
if(NULL != lpclTypeAddState){
// 类别值
syDbgMsg("m_bTypeValue = %d\n", lpclTypeAddState->getTypeValue());
lpclState->setTypeValue(lpclTypeAddState->getTypeValue());
// 显示标志
syDbgMsg("m_bIsFocusShowed = %d\n", lpclTypeAddState->getFocusShowFlg());
lpclState->setFocusShowFlg(lpclTypeAddState->getFocusShowFlg());
if(CPosUiGoodsTypeDlg::FIRST_GRADE_FOCUS_SHOW_FLG_ENABLE_VALUE == lpclState->getFocusShowFlg()
|| CPosUiGoodsTypeDlg::SECOND_GRADE_FOCUS_SHOW_FLG_ENABLE_VALUE == lpclState->getFocusShowFlg()){
lpclState->setCurrentFocusID(lpclTypeAddState->getCurrentFocusID());
}
if(CPosUiGoodsTypeDlg::SECOND_GRADE_FOCUS_SHOW_FLG_UNABLE_VALUE == lpclState->getFocusShowFlg()){
lpclState->setCurrentParentedFocusID(lpclTypeAddState->getCurrentParentedFocusID());
}
if(CPosUiGoodsTypeDlg::FIRST_GRADE_FOCUS_SHOW_FLG_UNABLE_VALUE == lpclState->getFocusShowFlg()
|| CPosUiGoodsTypeDlg::SECOND_GRADE_FOCUS_SHOW_FLG_UNABLE_VALUE == lpclState->getFocusShowFlg()){
lpclState->setGoodsTypeLastPage(lpclTypeAddState->getGoodsTypeLastPage());
lpclState->setGoodsTypeLastViewItemCnt(lpclTypeAddState->getGoodsTypeLastViewItemCnt());
}
}
// 类别显示框
CSyViewText* lpclTypeShowFrameText = dynamic_cast
if(NULL != lpclTypeShowFrameText){
lpclState->m_clstrTypeShowFrame.setStr(lpclTypeShowFrameText->getString());
}
// 类别名称编辑区
CSyViewText* lpclTypeEditFrameText = dynamic_cast
if(NULL != lpclTypeEditFrameText){
lpclState->m_clstrTypeEditFrame.setStr(lpclTypeEditFrameText->getString());
}
}
return lpclState;
}
/*****************************
获得实例状态
******************************/
CPosUiTypeAddDlgInstanceState * CPosUiTypeAddDlg::obtainInstanceState(){
CPosUiTypeAddDlgInstanceState * lpclState = new CPosUiTypeAddDlgInstanceState();
return lpclState;
}
/*****************************
创建资源
******************************/
void CPosUiTypeAddDlg::onCreateRes(CSyViewDlgInstanceState * lpclInstanceState){
// 超类
CSyViewDlg::onCreateRes(lpclInstanceState);
// TODO ...
// 设定DLG尺寸
CPosUiTypeAddDlgBuildParam * lpclBuildPara = getAppCtx()->getSkin()->getUiTypeAddDlgBuildParam();
if(NULL != lpclBuildPara){
lpclBuildPara->initDlgPara(this);
lpclBuildPara->createView(this);
// 创建解码数据,提高操作性能.
createImgDecodeData();
// 点击监听器
CSyView * lpclBtn = getFstChild();
while(NULL != lpclBtn){
lpclBtn->setClickListener(new CPosUiTypeAddBtnClickListener(this));
lpclBtn = lpclBtn->getNextBrother();
}
// 获得分类添加界面变量实例状态
getTypeAddInstanceState(lpclInstanceState);
}
}
/*****************************
释放资源
******************************/
void CPosUiTypeAddDlg::onReleaseRes(){
// 超类
CSyViewDlg::onReleaseRes();
// TODO ...
// 释放解码数据
releaseImgDecodeData();
}
/*****************************
打开完成
******************************/
void CPosUiTypeAddDlg::onOpenComplete(CSyViewDlgInstanceState * lpclInstanceState){
// 超类
CSyViewDlg::onOpenComplete(lpclInstanceState);
// TODO ...
// 类别编辑框获得焦点
CSyView * lpclFocusView = this->getChildByID(CPosUiTypeAddDlg::CTRL_ID_TYPE_EDIT_FRAME);
this->focusChildAndRedrawShow(lpclFocusView);
CSyViewEdit* lpViewTypeEditFrame= dynamic_cast
lpViewTypeEditFrame->createCaretTimer();
this->postSwitchToNumberDlgWhenUnopened();
}
/*****************************
创建图片解码数据
******************************/
void CPosUiTypeAddDlg::createImgDecodeData(){
this->createBgImgDecSurface(SY_TRUE, SY_TRUE, SY_FALSE);
}
/*****************************
释放图片解码数据
******************************/
void CPosUiTypeAddDlg::releaseImgDecodeData(){
this->deleteBgImgDecSurfaceWhenHasOtherSrc(SY_TRUE, SY_TRUE, SY_TRUE);
}
/*****************************
点击功能选择按钮
******************************/
void CPosUiTypeAddDlg::clickFunction(){
// 点击返回按钮切换到功能选择页面
// 页面管理器
CSyViewDlgMgr * lpclDlgMgr = this->getViewDlgMgr();
// 目的页面
CPosUiFunctionDlg * lpclDstDlg = dynamic_cast
if(NULL == lpclDstDlg){
return ;
}
// 切换窗口
CPosUiFunctionDlgInstanceState * lpclState = lpclDstDlg->obtainInstanceState();
lpclState->m_enOpenMode = CSyViewDlg::OPEN_MODE_ENTER;
this->postSwitchDlg(this, lpclDstDlg, lpclState);
lpclDlgMgr->delDlgReturnInfo(CSyViewDlg::ID_UI_FUNCTION);
lpclDlgMgr->delDlgReturnInfo(CSyViewDlg::ID_UI_ADMIN_INDEX);
lpclDlgMgr->delDlgReturnInfo(CSyViewDlg::ID_UI_STORE_ADMIN);
lpclDlgMgr->delDlgReturnInfo(CSyViewDlg::ID_UI_GOODS_TYPE);
this->closeInputInterfaceWhenOpened();
}
/*****************************
点击管理主页按钮
******************************/
void CPosUiTypeAddDlg::clickAdminIndex(){
// 点击管理主页按钮切换到管理主页页面
// 页面管理器
CSyViewDlgMgr * lpclDlgMgr = this->getViewDlgMgr();
// 目的页面
CPosUiAdminIndexDlg * lpclDstDlg = dynamic_cast
if(NULL == lpclDstDlg){
return ;
}
// 切换窗口
CPosUiAdminIndexDlgInstanceState * lpclState = lpclDstDlg->obtainInstanceState();
lpclState->m_enOpenMode = CSyViewDlg::OPEN_MODE_ENTER;
this->postSwitchDlg(this, lpclDstDlg, lpclState);
lpclDlgMgr->delDlgReturnInfo(CSyViewDlg::ID_UI_ADMIN_INDEX);
lpclDlgMgr->delDlgReturnInfo(CSyViewDlg::ID_UI_STORE_ADMIN);
lpclDlgMgr->delDlgReturnInfo(CSyViewDlg::ID_UI_GOODS_TYPE);
this->closeInputInterfaceWhenOpened();
}
/*****************************
点击商店管理按钮
******************************/
void CPosUiTypeAddDlg::clickStoreAdmin(){
// 点击商店管理按钮切换到商店管理页面
// 页面管理器
CSyViewDlgMgr * lpclDlgMgr = this->getViewDlgMgr();
// 目的页面
CPosUiStoreAdminDlg * lpclDstDlg = dynamic_cast
if(NULL == lpclDstDlg){
return ;
}
// 切换窗口
CPosUiStoreAdminDlgInstanceState * lpclState = lpclDstDlg->obtainInstanceState();
lpclState->m_enOpenMode = CSyViewDlg::OPEN_MODE_ENTER;
this->postSwitchDlg(this, lpclDstDlg, lpclState);
lpclDlgMgr->delDlgReturnInfo(CSyViewDlg::ID_UI_STORE_ADMIN);
lpclDlgMgr->delDlgReturnInfo(CSyViewDlg::ID_UI_GOODS_TYPE);
this->closeInputInterfaceWhenOpened();
}
/*****************************
点击商品类型按钮
******************************/
void CPosUiTypeAddDlg::clickGoodsType(){
this->postSwitchDlgBackAndCloseInputInterface();
}
/*****************************
点击重置按钮
******************************/
void CPosUiTypeAddDlg::clickReset(){
CSyViewEdit * lpclFocusView = dynamic_cast
if(NULL != lpclFocusView){
// 清空
lpclFocusView->setText(NULL);
// 重画
lpclFocusView->reDraw();
// 显示到屏幕
showViewToScrn(lpclFocusView);
}
}
/*****************************
点击退格按钮
******************************/
void CPosUiTypeAddDlg::clickBackspace(){
CSyViewEdit * lpclFocusView = dynamic_cast
if(NULL != lpclFocusView){
CSyString * lpclDstStr = lpclFocusView->getString();
// 退格
lpclDstStr->backSpace();
// 重画
lpclFocusView->reDraw();
// 显示到屏幕
showViewToScrn(lpclFocusView);
}
}
/*****************************
点击保存按钮
******************************/
void CPosUiTypeAddDlg::clickSave(){
syUpdateFileCategoryDatabaseRecordT stCategoryRecord;
syZero(&stCategoryRecord, sizeof(syUpdateFileCategoryDatabaseRecordT));
//获取输入的商品类别名称
CSyViewEdit* lpViewTypeEditFrame = dynamic_cast
CSyString clUtf8TypeEditFrame;
clUtf8TypeEditFrame.chgCharset(SY_CHARSET_UTF8);
clUtf8TypeEditFrame.setStr(lpViewTypeEditFrame->getString());
syDbgMsg("TypeEditFrame is :%s\n", clUtf8TypeEditFrame.getchStr());
stCategoryRecord.lpCategoryName = clUtf8TypeEditFrame.getchStr();
stCategoryRecord.iIsEnable = m_bStatusValue;
INT32 isFocusShowFlg = this->getInstanceStateFocusShowFlg();
if( CPosUiGoodsTypeDlg::FIRST_GRADE_FOCUS_SHOW_FLG_UNABLE_VALUE == isFocusShowFlg ){
stCategoryRecord.iParentedId = 0;
}
if( CPosUiGoodsTypeDlg::SECOND_GRADE_FOCUS_SHOW_FLG_UNABLE_VALUE == isFocusShowFlg ){
CPosUiTypeAddDlgInstanceState * lpclState = dynamic_cast
INT32 iGoodsTypeFirstGradeCurrentFocusID = lpclState->getCurrentParentedFocusID();
stCategoryRecord.iParentedId = iGoodsTypeFirstGradeCurrentFocusID;
}
if( CPosUiGoodsTypeDlg::FIRST_GRADE_FOCUS_SHOW_FLG_ENABLE_VALUE == isFocusShowFlg
|| CPosUiGoodsTypeDlg::SECOND_GRADE_FOCUS_SHOW_FLG_ENABLE_VALUE == isFocusShowFlg ){
this->UpdateGoodsType(&stCategoryRecord, isFocusShowFlg);
}
if( CPosUiGoodsTypeDlg::FIRST_GRADE_FOCUS_SHOW_FLG_UNABLE_VALUE == isFocusShowFlg
|| CPosUiGoodsTypeDlg::SECOND_GRADE_FOCUS_SHOW_FLG_UNABLE_VALUE == isFocusShowFlg ){
this->InsertIntoGoodsType(&stCategoryRecord, isFocusShowFlg);
}
}
/*****************************
点击返回按钮
******************************/
void CPosUiTypeAddDlg::clickReturn(){
this->postSwitchDlgBackAndCloseInputInterface();
}
/*****************************
点击关闭按钮
******************************/
void CPosUiTypeAddDlg::clickClose(){
this->postSwitchDlgBackAndCloseInputInterface();
}
/*****************************
点击功能选择按钮
******************************/
void CPosUiTypeAddDlg::clickTypeShowFrame(){
}
// 点击编辑框的相应操作
void CPosUiTypeAddDlg::clickEditFrame(CSyView * lpclView){
this->focusChildAndRedrawShow(lpclView);
CSyViewEdit* lpclViewEdit = dynamic_cast
lpclViewEdit->createCaretTimer();
this->postSwitchToNumberDlgWhenUnopened();
}
//是否启用
void CPosUiTypeAddDlg::clickIsEnable(CSyView * lpclView){
SY_BOOL bIsSelected = lpclView->getSelected();
bIsSelected = (SY_TRUE == bIsSelected)?SY_FALSE:SY_TRUE;
if( SY_TRUE == bIsSelected ){
m_bStatusValue = UNABLE_VALUE;
}
if( SY_FALSE == bIsSelected ){
m_bStatusValue = ENABLE_VALUE;
}
lpclView->setSelectedReDraw(bIsSelected);
lpclView->showSelfToScrn();
syDbgMsg("m_bStatusValue = %d\n\n", m_bStatusValue);
}
/***********************************************
添加获得焦点行的工号到收银员增加界面的工号框内
***********************************************/
void CPosUiTypeAddDlg::addTypeShowFrameText(CSyLangRes::LangItemIdxE iItemIdx){
CSyViewText* lpclTypeShowFrameText = dynamic_cast
if(NULL != lpclTypeShowFrameText){
// 选择语言
CSyLangRes * lpclLangRes = lpclTypeShowFrameText->getAppCtx()->getLangRes();
if(NULL != lpclLangRes){
//lpclTipsText->setText("是否删除 ?", sizeof("是否删除 ?"), SY_CHARSET_UTF8);
if( NULL != lpclLangRes->getStrByItemIdx(iItemIdx) ){
lpclTypeShowFrameText->setText(
lpclLangRes->getStrByItemIdx(iItemIdx),
lpclLangRes->getStrSizeByItemIdx(iItemIdx),
lpclLangRes->getCharsetByItemIdx(iItemIdx)
);
}
else{
lpclTypeShowFrameText->setText(NULL);
}
}
//对齐方式为居中显示
lpclTypeShowFrameText->setAlign(SY_TEXT_ALIGN_CENTER);
// 重画
lpclTypeShowFrameText->reDraw();
// 显示到屏幕
showViewToScrn(lpclTypeShowFrameText);
}
}
/***********************************************
添加获得焦点行的密码到收银员增加界面的密码框内
***********************************************/
void CPosUiTypeAddDlg::addTypeEditFrameText(const char * lpchStr){
CSyViewText* lpclTypeEditFrameText = dynamic_cast
if(NULL != lpclTypeEditFrameText){
if(NULL != lpchStr){
lpclTypeEditFrameText->setText(lpchStr, syChStrLen(lpchStr), SY_CHARSET_UTF8);
}
else{
lpclTypeEditFrameText->setText(NULL);
}
}
}
// 获得分类添加界面变量实例状态
void CPosUiTypeAddDlg::getTypeAddInstanceState(CSyViewDlgInstanceState * lpclInstanceState){
CPosUiTypeAddDlgInstanceState * lpclState = dynamic_cast
if(NULL != lpclState){
// 获取类别显示框和类别编辑区实例
CSyViewText* lpclTypeShowFrameText = dynamic_cast
if(NULL != lpclTypeShowFrameText){
lpclTypeShowFrameText->setText(&(lpclState->m_clstrTypeShowFrame));
}
CSyViewText* lpclTypeEditFrameText = dynamic_cast
if(NULL != lpclTypeEditFrameText){
lpclTypeEditFrameText->setText(&(lpclState->m_clstrTypeEditFrame));
}
// 依据类别值获取类别显示区的显示内容
syDbgMsg("m_bTypeFlg = %d.\n", lpclState->getTypeFlg());
if(lpclState->getTypeFlg() == CPosUiGoodsTypeDlg::FIRST_GRADE_VALUE){
this->addTypeShowFrameText(CSyLangRes::lang_posFirstGradeGoodsType);
}
if(lpclState->getTypeFlg() == CPosUiGoodsTypeDlg::SECOND_GRADE_VALUE){
this->addTypeShowFrameText(CSyLangRes::lang_posSecondGradeGoodsType);
}
// 依据显示标志值获取类别名称编辑框的显示内容
INT32 currentFocusID = lpclState->getCurrentFocusID();
syDbgMsg("currentFocusID = %d.\n", currentFocusID);
INT32 isFocusShowFlg = lpclState->getFocusShowFlg();
syDbgMsg("isFocusShowFlg = %d\n", isFocusShowFlg);
if( CPosUiGoodsTypeDlg::FIRST_GRADE_FOCUS_SHOW_FLG_ENABLE_VALUE == isFocusShowFlg ){
this->showGoodsTypeFirstGradeFocusItemInformation(currentFocusID);
}
if( CPosUiGoodsTypeDlg::SECOND_GRADE_FOCUS_SHOW_FLG_ENABLE_VALUE == isFocusShowFlg ){
this->showGoodsTypeSecondGradeFocusItemInformation(currentFocusID);
}
}
}
/*********************************************
获取获得一级分类焦点行的信息并显示出来
*********************************************/
void CPosUiTypeAddDlg::showGoodsTypeFirstGradeFocusItemInformation(INT32 currentFocusID){
// 页面管理器
CSyViewDlgMgr * lpclDlgMgr = this->getViewDlgMgr();
if(NULL != lpclDlgMgr){
// 商品类别目的页面
CPosUiGoodsTypeDlg * lpclDstDlg = dynamic_cast
if(NULL == lpclDstDlg){
return ;
}
CPosUiTypeAddDlgInstanceState * lpclState = dynamic_cast
if(NULL != lpclState){
INT32 isTypeValue = lpclState->getTypeValue();
if( isTypeValue == CPosUiGoodsTypeDlg::TYPE_VALUE
|| isTypeValue == CPosUiGoodsTypeDlg::TYPE_UNABLE_VALUE ){
lpclDstDlg->getGoodsTypeFirstGradeByID(currentFocusID);
}
if( isTypeValue == CPosUiGoodsTypeDlg::SUPPLIER_VALUE
|| isTypeValue == CPosUiGoodsTypeDlg::SUPPLIER_UNABLE_VALUE ){
lpclDstDlg->getGoodsTypeFirstGradeSupplierByID(currentFocusID);
}
syDbgMsg("goodsTypeResTab[1] = %s.\n", lpclDstDlg->getGoodsTypeResTab(1));
this->addTypeEditFrameText(lpclDstDlg->getGoodsTypeResTab(1));
syDbgMsg("goodsTypeResTab[3] = %s.\n", lpclDstDlg->getGoodsTypeResTab(3));
if( syAtoi(lpclDstDlg->getGoodsTypeResTab(3)) == CPosUiTypeAddDlg::UNABLE_VALUE ){
// 男性复选框
CSyView * lpclIsEnableView = this->getChildByID(CPosUiTypeAddDlg::CTRL_ID_IS_ENABLE);
if(NULL != lpclIsEnableView){
clickIsEnable(lpclIsEnableView);
}
}
}
}
}
/*********************************************
获取获得二级分类焦点行的信息并显示出来
*********************************************/
void CPosUiTypeAddDlg::showGoodsTypeSecondGradeFocusItemInformation(INT32 currentFocusID){
// 页面管理器
CSyViewDlgMgr * lpclDlgMgr = this->getViewDlgMgr();
if(NULL != lpclDlgMgr){
// 商品类别目的页面
CPosUiGoodsTypeDlg * lpclDstDlg = dynamic_cast
if(NULL == lpclDstDlg){
return ;
}
CPosUiTypeAddDlgInstanceState * lpclState = dynamic_cast
if(NULL != lpclState){
INT32 isTypeValue = lpclState->getTypeValue();
if( isTypeValue == CPosUiGoodsTypeDlg::TYPE_VALUE
|| isTypeValue == CPosUiGoodsTypeDlg::TYPE_UNABLE_VALUE ){
lpclDstDlg->getGoodsTypeSecondGradeByID(currentFocusID);
}
if( isTypeValue == CPosUiGoodsTypeDlg::SUPPLIER_VALUE
|| isTypeValue == CPosUiGoodsTypeDlg::SUPPLIER_UNABLE_VALUE ){
lpclDstDlg->getGoodsTypeSecondGradeSupplierByID(currentFocusID);
}
syDbgMsg("goodsTypeResTab[1] = %s.\n", lpclDstDlg->getGoodsTypeResTab(1));
this->addTypeEditFrameText(lpclDstDlg->getGoodsTypeResTab(1));
syDbgMsg("goodsTypeResTab[3] = %s.\n", lpclDstDlg->getGoodsTypeResTab(3));
if( syAtoi(lpclDstDlg->getGoodsTypeResTab(3)) == CPosUiTypeAddDlg::UNABLE_VALUE ){
// 男性复选框
CSyView * lpclIsEnableView = this->getChildByID(CPosUiTypeAddDlg::CTRL_ID_IS_ENABLE);
if(NULL != lpclIsEnableView){
clickIsEnable(lpclIsEnableView);
}
}
}
}
}
// 更新修改获得焦点条项
void CPosUiTypeAddDlg::UpdateGoodsType(syUpdateFileCategoryDatabaseRecordT * lpstRecord, INT32 isFocusShowFlg){
if( CPosUiGoodsTypeDlg::FIRST_GRADE_FOCUS_SHOW_FLG_ENABLE_VALUE == isFocusShowFlg ){
UpdateGoodsTypeFirstGrade(lpstRecord);
}
if( CPosUiGoodsTypeDlg::SECOND_GRADE_FOCUS_SHOW_FLG_ENABLE_VALUE == isFocusShowFlg ){
UpdateGoodsTypeSecondGrade(lpstRecord);
}
this->postSwitchDlgBackAndCloseInputInterface();
}
// 更新修改一级分类中获得焦点条项
INT32 CPosUiTypeAddDlg::UpdateGoodsTypeFirstGrade(syUpdateFileCategoryDatabaseRecordT * lpstRecord){
CPosUiTypeAddDlgInstanceState * lpclState = dynamic_cast
// 获取获得焦点行的ID
INT32 currentFocusID = lpclState->getCurrentFocusID();
syDbgMsg("currentFocusID = %d.\n",currentFocusID);
if( lpclState->getTypeValue() == CPosUiGoodsTypeDlg::TYPE_VALUE
|| lpclState->getTypeValue() == CPosUiGoodsTypeDlg::TYPE_UNABLE_VALUE ){
this->UpdateGoodsTypeFirstGradeByID(lpstRecord, currentFocusID);
this->UpdateGoodsTypeSecondGradeByParentedID(lpstRecord,currentFocusID);
this->UpdateGoodsByParentedFirstGradeCategoryID(lpstRecord,currentFocusID);
}
if( lpclState->getTypeValue() == CPosUiGoodsTypeDlg::SUPPLIER_VALUE
|| lpclState->getTypeValue() == CPosUiGoodsTypeDlg::SUPPLIER_UNABLE_VALUE ){
this->UpdateGoodsTypeFirstGradeSupplierByID(lpstRecord, currentFocusID);
this->UpdateGoodsTypeSecondGradeSupplierByParentedID(lpstRecord, currentFocusID);
this->UpdateGoodsByParentedFirstGradeSupplierID(lpstRecord, currentFocusID);
}
return SY_TRUE;
}
// 更新修改二级分类中获得焦点条项
INT32 CPosUiTypeAddDlg::UpdateGoodsTypeSecondGrade(syUpdateFileCategoryDatabaseRecordT * lpstRecord){
CPosUiTypeAddDlgInstanceState * lpclState = dynamic_cast
// 获取获得焦点行的ID
INT32 currentFocusID = lpclState->getCurrentFocusID();
syDbgMsg("currentFocusID = %d.\n",currentFocusID);
if( lpclState->getTypeValue() == CPosUiGoodsTypeDlg::TYPE_VALUE
|| lpclState->getTypeValue() == CPosUiGoodsTypeDlg::TYPE_UNABLE_VALUE ){
this->UpdateGoodsTypeSecondGradeByID(lpstRecord, currentFocusID);
this->UpdateGoodsByParentedSecondGradeCategoryID(lpstRecord, currentFocusID);
}
if( lpclState->getTypeValue() == CPosUiGoodsTypeDlg::SUPPLIER_VALUE
|| lpclState->getTypeValue() == CPosUiGoodsTypeDlg::SUPPLIER_UNABLE_VALUE ){
this->UpdateGoodsTypeSecondGradeSupplierByID(lpstRecord, currentFocusID);
this->UpdateGoodsByParentedSecondGradeSupplierID(lpstRecord, currentFocusID);
}
return SY_TRUE;
}
// 调用数据库,修改获得焦点条项对应数据库表项
INT32 CPosUiTypeAddDlg::UpdateGoodsTypeFirstGradeByID(syUpdateFileCategoryDatabaseRecordT * lpstRecord, int categoryID){
// 创建SQL
CPosSqlApp * lpPosSql = new CPosSqlApp();
if(NULL != lpPosSql){
// 修改数据库表中获取指定ID 的一级类型
if(SY_FALSE == lpPosSql->UpdateGoodsTypeFirstGradeByID(lpstRecord, categoryID)){
syDbgMsg("UpdateGoodsTypeFirstGradeByID function Failed.\n");
return SY_FALSE;
}
delete lpPosSql;
lpPosSql = NULL;
}
return SY_TRUE;
}
// 依据获得的二级分类父焦点ID刷新对应的二级分类
INT32 CPosUiTypeAddDlg::UpdateGoodsTypeSecondGradeByParentedID(syUpdateFileCategoryDatabaseRecordT * lpstRecord, int categoryID){
// 创建SQL
CPosSqlApp * lpPosSql = new CPosSqlApp();
if(NULL != lpPosSql){
// 依据所属父类别ID刷新对应的二级类别
if(SY_FALSE == lpPosSql->UpdateGoodsTypeSecondGradeByParentedID(lpstRecord, categoryID)){
syDbgMsg("UpdateGoodsTypeSecondGradeByParentedID function Failed.\n");
return SY_FALSE;
}
delete lpPosSql;
lpPosSql = NULL;
}
return SY_TRUE;
}
// 依据获得的商品父一级分类焦点ID刷新对应的商品表项
INT32 CPosUiTypeAddDlg::UpdateGoodsByParentedFirstGradeCategoryID(syUpdateFileCategoryDatabaseRecordT * lpstRecord, int categoryID){
// 创建SQL
CPosSqlApp * lpPosSql = new CPosSqlApp();
if(NULL != lpPosSql){
// 依据所属父一级分类ID刷新对应的商品表项
if(SY_FALSE == lpPosSql->UpdateGoodsByParentedFirstGradeCategoryID(lpstRecord, categoryID)){
syDbgMsg("UpdateGoodsByParentedFirstGradeCategoryID function Failed.\n");
return SY_FALSE;
}
delete lpPosSql;
lpPosSql = NULL;
}
return SY_TRUE;
}
// 调用数据库,修改获得焦点条项对应数据库表项
INT32 CPosUiTypeAddDlg::UpdateGoodsTypeSecondGradeByID(syUpdateFileCategoryDatabaseRecordT * lpstRecord, int categoryID){
// 创建SQL
CPosSqlApp * lpPosSql = new CPosSqlApp();
if(NULL != lpPosSql){
syDbgMsg("m_bStatusValue = %d.\n", m_bStatusValue);
// 修改数据库表中获取指定ID 的二级类型
if(SY_FALSE == lpPosSql->UpdateGoodsTypeSecondGradeByID(lpstRecord, categoryID)){
syDbgMsg("UpdateGoodsTypeSecondGradeByID function Failed.\n");
return SY_FALSE;
}
delete lpPosSql;
lpPosSql = NULL;
}
return SY_TRUE;
}
// 依据获得的商品父二级分类焦点ID刷新对应的商品表项
INT32 CPosUiTypeAddDlg::UpdateGoodsByParentedSecondGradeCategoryID(syUpdateFileCategoryDatabaseRecordT * lpstRecord, int categoryID){
// 创建SQL
CPosSqlApp * lpPosSql = new CPosSqlApp();
if(NULL != lpPosSql){
// 依据所属父二级分类ID刷新对应的商品表项
if(SY_FALSE == lpPosSql->UpdateGoodsByParentedSecondGradeCategoryID(lpstRecord, categoryID)){
syDbgMsg("UpdateGoodsByParentedSecondGradeCategoryID function Failed.\n");
return SY_FALSE;
}
delete lpPosSql;
lpPosSql = NULL;
}
return SY_TRUE;
}
// 调用数据库,修改获得焦点条项对应数据库表项
INT32 CPosUiTypeAddDlg::UpdateGoodsTypeFirstGradeSupplierByID(syUpdateFileCategoryDatabaseRecordT * lpstRecord, int categoryID){
// 创建SQL
CPosSqlApp * lpPosSql = new CPosSqlApp();
if(NULL != lpPosSql){
// 修改数据库表中获取指定ID 的一级供应商
if(SY_FALSE == lpPosSql->UpdateGoodsTypeFirstGradeSupplierByID(lpstRecord, categoryID)){
syDbgMsg("UpdateGoodsTypeFirstGradeSupplierByID function Failed.\n");
return SY_FALSE;
}
delete lpPosSql;
lpPosSql = NULL;
}
return SY_TRUE;
}
// 依据获得的二级供应商父焦点ID刷新对应的二级供应商
INT32 CPosUiTypeAddDlg::UpdateGoodsTypeSecondGradeSupplierByParentedID(syUpdateFileCategoryDatabaseRecordT * lpstRecord, int categoryID){
// 创建SQL
CPosSqlApp * lpPosSql = new CPosSqlApp();
if(NULL != lpPosSql){
// 依据所属父类别ID刷新对应的二级供应商
if(SY_FALSE == lpPosSql->UpdateGoodsTypeSecondGradeSupplierByParentedID(lpstRecord, categoryID)){
syDbgMsg("UpdateGoodsTypeSecondGradeSupplierByParentedID function Failed.\n");
return SY_FALSE;
}
delete lpPosSql;
lpPosSql = NULL;
}
return SY_TRUE;
}
// 依据获得的商品父一级供应商焦点ID刷新对应的商品表项
INT32 CPosUiTypeAddDlg::UpdateGoodsByParentedFirstGradeSupplierID(syUpdateFileCategoryDatabaseRecordT * lpstRecord, int categoryID){
// 创建SQL
CPosSqlApp * lpPosSql = new CPosSqlApp();
if(NULL != lpPosSql){
// 依据所属父一级供应商ID刷新对应的商品表项
if(SY_FALSE == lpPosSql->UpdateGoodsByParentedFirstGradeSupplierID(lpstRecord, categoryID)){
syDbgMsg("UpdateGoodsByParentedFirstGradeSupplierID function Failed.\n");
return SY_FALSE;
}
delete lpPosSql;
lpPosSql = NULL;
}
return SY_TRUE;
}
// 调用数据库,修改获得焦点条项对应数据库表项
INT32 CPosUiTypeAddDlg::UpdateGoodsTypeSecondGradeSupplierByID(syUpdateFileCategoryDatabaseRecordT * lpstRecord, int categoryID){
// 创建SQL
CPosSqlApp * lpPosSql = new CPosSqlApp();
if(NULL != lpPosSql){
// 修改数据库表中获取指定ID 的二级供应商
if(SY_FALSE == lpPosSql->UpdateGoodsTypeSecondGradeSupplierByID(lpstRecord, categoryID)){
syDbgMsg("UpdateGoodsTypeSecondGradeSupplierByID function Failed.\n");
return SY_FALSE;
}
delete lpPosSql;
lpPosSql = NULL;
}
return SY_TRUE;
}
// 依据获得的商品父二级供应商焦点ID刷新对应的商品表项
INT32 CPosUiTypeAddDlg::UpdateGoodsByParentedSecondGradeSupplierID(syUpdateFileCategoryDatabaseRecordT * lpstRecord, int categoryID){
// 创建SQL
CPosSqlApp * lpPosSql = new CPosSqlApp();
if(NULL != lpPosSql){
// 依据所属父二级供应商ID刷新对应的商品表项
if(SY_FALSE == lpPosSql->UpdateGoodsByParentedSecondGradeSupplierID(lpstRecord, categoryID)){
syDbgMsg("UpdateGoodsByParentedSecondGradeSupplierID function Failed.\n");
return SY_FALSE;
}
delete lpPosSql;
lpPosSql = NULL;
}
return SY_TRUE;
}
// 插入新的一行
void CPosUiTypeAddDlg::InsertIntoGoodsType(syUpdateFileCategoryDatabaseRecordT * lpstRecord, INT32 isFocusShowFlg){
if( CPosUiGoodsTypeDlg::FIRST_GRADE_FOCUS_SHOW_FLG_UNABLE_VALUE == isFocusShowFlg ){
InsertIntoGoodsTypeFirstGrade(lpstRecord);
}
if( CPosUiGoodsTypeDlg::SECOND_GRADE_FOCUS_SHOW_FLG_UNABLE_VALUE == isFocusShowFlg ){
InsertIntoGoodsTypeSecondGrade(lpstRecord);
}
this->getLastPosViewAndLastPage(isFocusShowFlg);
this->postSwitchToGoodsTypeDlg(isFocusShowFlg);
this->closeInputInterfaceWhenOpened();
}
// 插入一级分类中新的一行
INT32 CPosUiTypeAddDlg::InsertIntoGoodsTypeFirstGrade(syUpdateFileCategoryDatabaseRecordT * lpstRecord){
CPosUiTypeAddDlgInstanceState * lpclState = dynamic_cast
if( lpclState->getTypeValue() == CPosUiGoodsTypeDlg::TYPE_VALUE
|| lpclState->getTypeValue() == CPosUiGoodsTypeDlg::TYPE_UNABLE_VALUE ){
this->InsertOneRowToGoodsTypeFirstGrade(lpstRecord);
}
if( lpclState->getTypeValue() == CPosUiGoodsTypeDlg::SUPPLIER_VALUE
|| lpclState->getTypeValue() == CPosUiGoodsTypeDlg::SUPPLIER_UNABLE_VALUE ){
this->InsertOneRowToGoodsTypeFirstGradeSupplier(lpstRecord);
}
return SY_TRUE;
}
// 插入二级分类中新的一行
INT32 CPosUiTypeAddDlg::InsertIntoGoodsTypeSecondGrade(syUpdateFileCategoryDatabaseRecordT * lpstRecord){
CPosUiTypeAddDlgInstanceState * lpclState = dynamic_cast
if( lpclState->getTypeValue() == CPosUiGoodsTypeDlg::TYPE_VALUE
|| lpclState->getTypeValue() == CPosUiGoodsTypeDlg::TYPE_UNABLE_VALUE ){
this->InsertOneRowToGoodsTypeSecondGrade(lpstRecord);
}
if( lpclState->getTypeValue() == CPosUiGoodsTypeDlg::SUPPLIER_VALUE
|| lpclState->getTypeValue() == CPosUiGoodsTypeDlg::SUPPLIER_UNABLE_VALUE ){
this->InsertOneRowToGoodsTypeSecondGradeSupplier(lpstRecord);
}
return SY_TRUE;
}
// 调用数据库,插入一行到数据库的最后一行的下一行
INT32 CPosUiTypeAddDlg::InsertOneRowToGoodsTypeFirstGrade(syUpdateFileCategoryDatabaseRecordT * lpstRecord){
// 创建SQL
CPosSqlApp * lpPosSql = new CPosSqlApp();
if(NULL != lpPosSql){
// 插入新的一级类型
if(SY_FALSE == lpPosSql->InsertOneRowToGoodsTypeFirstGrade(lpstRecord)){
syDbgMsg("InsertOneRowToGoodsTypeFirstGrade function Failed.\n");
return SY_FALSE;
}
delete lpPosSql;
lpPosSql = NULL;
}
return SY_TRUE;
}
// 调用数据库,插入一行到数据库的最后一行的下一行
INT32 CPosUiTypeAddDlg::InsertOneRowToGoodsTypeSecondGrade(syUpdateFileCategoryDatabaseRecordT * lpstRecord){
// 创建SQL
CPosSqlApp * lpPosSql = new CPosSqlApp();
if(NULL != lpPosSql){
// 插入新的二级类型
if(SY_FALSE == lpPosSql->InsertOneRowToGoodsTypeSecondGrade(lpstRecord)){
syDbgMsg("InsertOneRowToGoodsTypeSecondGrade function Failed.\n");
return SY_FALSE;
}
delete lpPosSql;
lpPosSql = NULL;
}
return SY_TRUE;
}
// 调用数据库,插入一行到数据库的最后一行的下一行
INT32 CPosUiTypeAddDlg::InsertOneRowToGoodsTypeFirstGradeSupplier(syUpdateFileCategoryDatabaseRecordT * lpstRecord){
// 创建SQL
CPosSqlApp * lpPosSql = new CPosSqlApp();
if(NULL != lpPosSql){
// 插入新的一级供应商
if(SY_FALSE == lpPosSql->InsertOneRowToGoodsTypeFirstGradeSupplier(lpstRecord)){
syDbgMsg("InsertOneRowToGoodsTypeFirstGradeSupplier function Failed.\n");
return SY_FALSE;
}
delete lpPosSql;
lpPosSql = NULL;
}
return SY_TRUE;
}
// 调用数据库,插入一行到数据库的最后一行的下一行
INT32 CPosUiTypeAddDlg::InsertOneRowToGoodsTypeSecondGradeSupplier(syUpdateFileCategoryDatabaseRecordT * lpstRecord){
// 创建SQL
CPosSqlApp * lpPosSql = new CPosSqlApp();
if(NULL != lpPosSql){
// 插入新的二级供应商
if(SY_FALSE == lpPosSql->InsertOneRowToGoodsTypeSecondGradeSupplier(lpstRecord)){
syDbgMsg("InsertOneRowToGoodsTypeSecondGradeSupplier function Failed.\n");
return SY_FALSE;
}
delete lpPosSql;
lpPosSql = NULL;
}
return SY_TRUE;
}
void CPosUiTypeAddDlgInstanceState::setFocusShowFlg(INT32 iIsFocusShowed){
m_bIsFocusShowed = iIsFocusShowed;
}
INT32 CPosUiTypeAddDlgInstanceState::getFocusShowFlg(){
return m_bIsFocusShowed;
}
void CPosUiTypeAddDlgInstanceState::setTypeFlg(INT32 iTypeFlg){
m_bTypeFlg = iTypeFlg;
}
INT32 CPosUiTypeAddDlgInstanceState::getTypeFlg(){
return m_bTypeFlg;
}
void CPosUiTypeAddDlgInstanceState::setTypeValue(INT32 iTypeValue){
m_bTypeValue = iTypeValue;
}
INT32 CPosUiTypeAddDlgInstanceState::getTypeValue(){
return m_bTypeValue;
}
void CPosUiTypeAddDlgInstanceState::setGoodsTypeFirstGradeFocusViewItemCnt(INT32 iGoodsTypeFirstGradeFocusViewItemCnt){
m_bGoodsTypeFirstGradeFocusViewItemCnt = iGoodsTypeFirstGradeFocusViewItemCnt;
}
INT32 CPosUiTypeAddDlgInstanceState::getGoodsTypeFirstGradeFocusViewItemCnt(){
return m_bGoodsTypeFirstGradeFocusViewItemCnt;
}
void CPosUiTypeAddDlgInstanceState::setGoodsTypeFirstGradeFocusPage(INT32 iGoodsTypeFirstGradeFocusPage){
m_bGoodsTypeFirstGradeFocusPage = iGoodsTypeFirstGradeFocusPage;
}
INT32 CPosUiTypeAddDlgInstanceState::getGoodsTypeFirstGradeFocusPage(){
return m_bGoodsTypeFirstGradeFocusPage;
}
void CPosUiTypeAddDlgInstanceState::setCurrentFocusID(INT32 iCurrentFocusID){
m_bCurrentFocusID = iCurrentFocusID;
}
INT32 CPosUiTypeAddDlgInstanceState::getCurrentFocusID(){
return m_bCurrentFocusID;
}
void CPosUiTypeAddDlgInstanceState::setCurrentParentedFocusID(INT32 iCurrentParentedFocusID){
m_bCurrentParentedFocusID = iCurrentParentedFocusID;
}
INT32 CPosUiTypeAddDlgInstanceState::getCurrentParentedFocusID(){
return m_bCurrentParentedFocusID;
}
void CPosUiTypeAddDlgInstanceState::setGoodsTypeLastViewItemCnt(INT32 iGoodsTypeLastViewItemCnt){
m_bGoodsTypeLastViewItemCnt = iGoodsTypeLastViewItemCnt;
}
INT32 CPosUiTypeAddDlgInstanceState::getGoodsTypeLastViewItemCnt(){
return m_bGoodsTypeLastViewItemCnt;
}
void CPosUiTypeAddDlgInstanceState::setGoodsTypeLastPage(INT32 iGoodsTypeLastPage){
m_bGoodsTypeLastPage = iGoodsTypeLastPage;
}
INT32 CPosUiTypeAddDlgInstanceState::getGoodsTypeLastPage(){
return m_bGoodsTypeLastPage;
}
// 切换到商品类别列表界面
void CPosUiTypeAddDlg::postSwitchToGoodsTypeDlg(INT32 isFocusShowFlg){
// 切换到商品类别页面
// 页面管理器
CSyViewDlgMgr * lpclDlgMgr = this->getViewDlgMgr();
// 目的页面
CPosUiGoodsTypeDlg * lpclDstDlg = dynamic_cast
if(NULL == lpclDstDlg){
return ;
}
// 切换窗口
CPosUiGoodsTypeDlgInstanceState * lpclDstState = lpclDstDlg->obtainInstanceState();
lpclDstState->m_enOpenMode = CSyViewDlg::OPEN_MODE_ENTER;
CPosUiTypeAddDlgInstanceState * lpclState = dynamic_cast
if( CPosUiGoodsTypeDlg::FIRST_GRADE_FOCUS_SHOW_FLG_UNABLE_VALUE == isFocusShowFlg ){
syDbgMsg("m_bGoodsTypeLastPage = %d\n", lpclState->getGoodsTypeLastPage());
lpclDstState->setGoodsTypeFirstGradeLastPage(lpclState->getGoodsTypeLastPage());
syDbgMsg("m_bGoodsTypeLastViewItemCnt = %d\n", lpclState->getGoodsTypeLastViewItemCnt());
lpclDstState->setGoodsTypeFirstGradeLastViewItemCnt(lpclState->getGoodsTypeLastViewItemCnt());
}
if( CPosUiGoodsTypeDlg::SECOND_GRADE_FOCUS_SHOW_FLG_UNABLE_VALUE == isFocusShowFlg ){
syDbgMsg("m_bGoodsTypeFirstGradeFocusPage = %d\n", lpclState->getGoodsTypeFirstGradeFocusPage());
lpclDstState->setGoodsTypeFirstGradeFocusPage(lpclState->getGoodsTypeFirstGradeFocusPage());
lpclState->setGoodsTypeFirstGradeFocusPage(0);
syDbgMsg("m_bGoodsTypeFirstGradeFocusViewItemCnt = %d\n", lpclState->getGoodsTypeFirstGradeFocusViewItemCnt());
lpclDstState->setGoodsTypeFirstGradeFocusViewItemCnt(lpclState->getGoodsTypeFirstGradeFocusViewItemCnt());
lpclState->setGoodsTypeFirstGradeFocusViewItemCnt(0);
syDbgMsg("m_bGoodsTypeLastPage = %d\n", lpclState->getGoodsTypeLastPage());
lpclDstState->setGoodsTypeSecondGradeLastPage(lpclState->getGoodsTypeLastPage());
syDbgMsg("m_bGoodsTypeLastViewItemCnt = %d\n", lpclState->getGoodsTypeLastViewItemCnt());
lpclDstState->setGoodsTypeSecondGradeLastViewItemCnt(lpclState->getGoodsTypeLastViewItemCnt());
}
syDbgMsg("m_bIsFocusShowed = %d\n", lpclState->getFocusShowFlg());
lpclDstState->setFocusShowFlg(lpclState->getFocusShowFlg());
syDbgMsg("m_bTypeValue = %d\n", lpclState->getTypeValue());
lpclDstState->setTypeValue(lpclState->getTypeValue());
this->postSwitchDlg(this, lpclDstDlg, lpclDstState);
lpclDlgMgr->delDlgReturnInfo(CSyViewDlg::ID_UI_GOODS_TYPE);
}
// 切换到数字输入法界面
void CPosUiTypeAddDlg::postSwitchToNumberDlg(){
// 页面管理器
CSyViewDlgMgr * lpclDlgMgr = this->getViewDlgMgr();
// 目的页面
CPosUiNumberDlg * lpclDstDlg = dynamic_cast
if(NULL == lpclDstDlg){
return ;
}
// 添加返回页面信息
CSyDlgReturnInfo * lpclNewReturnInfo = lpclDlgMgr->obtainDlgReturnInfo();
if(NULL != lpclNewReturnInfo){
lpclNewReturnInfo->setDlgID(this->getDlgID());
lpclNewReturnInfo->setInstanceState(this->obtainBackInfoInstanceState());
lpclDlgMgr->addTailDlgReturnInfo(lpclNewReturnInfo);
}
// 切换窗口
CPosUiNumberDlgInstanceState * lpclState = lpclDstDlg->obtainInstanceState();
lpclState->m_enOpenMode = CSyViewDlg::OPEN_MODE_ENTER;
lpclState->setEditDstDlg( lpclDlgMgr->getTailReturnInfoDlg() );
//lpclState->setEditDstDlg( this );
this->postSwitchDlg(NULL, lpclDstDlg, lpclState);
}
// 当输入法没有打开时切换到数字输入法界面
void CPosUiTypeAddDlg::postSwitchToNumberDlgWhenUnopened(){
INT32 iDlgID = this->getTailReturnInfoDlgID();
if( CSyViewDlg::ID_UI_NUMBER != iDlgID
&& CSyViewDlg::ID_UI_SPELL != iDlgID
&& CSyViewDlg::ID_UI_WORD != iDlgID
&& CSyViewDlg::ID_UI_HANDWRITTEN != iDlgID ){
this->postSwitchToNumberDlg();
}
}
// 关闭最后一项对应的界面
void CPosUiTypeAddDlg::postCloseTailReturnInfoDlg(){
CSyViewDlg * lpclTailDstDlg = this->getTailReturnInfoDlg();
if(NULL == lpclTailDstDlg){
return ;
}
// 删除最后一项
this->delTailDlgReturnInfo();
// 关闭最后一行所对应的界面
lpclTailDstDlg->postSwitchDlg(lpclTailDstDlg, NULL, NULL);
}
// 当输入法打开时关闭输入法界面
void CPosUiTypeAddDlg::closeInputInterfaceWhenOpened(){
INT32 iDlgID = this->getTailReturnInfoDlgID();
if( CSyViewDlg::ID_UI_NUMBER == iDlgID
|| CSyViewDlg::ID_UI_SPELL == iDlgID
|| CSyViewDlg::ID_UI_WORD == iDlgID
|| CSyViewDlg::ID_UI_HANDWRITTEN == iDlgID ){
this->postCloseTailReturnInfoDlg();
}
}
// 关闭输入法并返回上一次页面
void CPosUiTypeAddDlg::postSwitchDlgBackAndCloseInputInterface(){
INT32 iDlgID = this->getTailReturnInfoDlgID();
if( CSyViewDlg::ID_UI_NUMBER == iDlgID
|| CSyViewDlg::ID_UI_SPELL == iDlgID
|| CSyViewDlg::ID_UI_WORD == iDlgID
|| CSyViewDlg::ID_UI_HANDWRITTEN == iDlgID ){
CSyViewDlg * lpclTailDstDlg = this->getTailReturnInfoDlg();
if(NULL == lpclTailDstDlg){
return ;
}
// 删除最后一项
this->delTailDlgReturnInfo();
// 点击商品列表按钮切换到商品列表页面
this->postSwitchDlgBack(this, SY_TRUE);
// 关闭数字输入法界面
lpclTailDstDlg->postSwitchDlg(lpclTailDstDlg, NULL, NULL);
}
else{
// 点击返回按钮返回到上一次页面
this->postSwitchDlgBack(this, SY_TRUE);
}
}
// 获得最后一项对应的窗口
CSyViewDlg * CPosUiTypeAddDlg::getTailReturnInfoDlg(){
// 页面管理器
CSyViewDlgMgr * lpclDlgMgr = this->getViewDlgMgr();
if( NULL == lpclDlgMgr ){
return NULL;
}
CSyViewDlg * lpclTailDstDlg = lpclDlgMgr->getTailReturnInfoDlg();
return lpclTailDstDlg;
}
// 获得最后一项对应的窗口ID
INT32 CPosUiTypeAddDlg::getTailReturnInfoDlgID(){
CSyViewDlg * lpclTailDstDlg = this->getTailReturnInfoDlg();
if(NULL == lpclTailDstDlg){
return SY_FALSE;
}
INT32 iDlgID = lpclTailDstDlg->getDlgID();
return iDlgID;
}
// 删除最后一项
void CPosUiTypeAddDlg::delTailDlgReturnInfo(){
// 页面管理器
CSyViewDlgMgr * lpclDlgMgr = this->getViewDlgMgr();
if( NULL == lpclDlgMgr ){
return ;
}
// 删除最后一项
lpclDlgMgr->delTailDlgReturnInfo();
}
// 获得是否显示焦点项信息的标志值实例
INT32 CPosUiTypeAddDlg::getInstanceStateFocusShowFlg(){
CPosUiTypeAddDlgInstanceState * lpclState = dynamic_cast
if(NULL == lpclState){
return SY_ERR_NOT_EXIST;
}
INT32 isFocusShowFlg = lpclState->getFocusShowFlg();
return isFocusShowFlg;
}
// 获得列表视图上的最后一行和最后一页值
void CPosUiTypeAddDlg::getLastPosViewAndLastPage(INT32 isFocusShowFlg){
// 处理列表界面显示的最后页数和条项
// 设定DLG尺寸
CPosUiGoodsTypeDlgBuildParam * lpclGoodsTypeBuildParam = getAppCtx()->getSkin()->getUiGoodsTypeDlgBuildParam();
if(NULL != lpclGoodsTypeBuildParam){
INT32 iPageItemCnt = 0;
if( CPosUiGoodsTypeDlg::FIRST_GRADE_FOCUS_SHOW_FLG_UNABLE_VALUE == isFocusShowFlg ){
iPageItemCnt = lpclGoodsTypeBuildParam->getGoodsTypeFirstGradeListItemCnt();
}
if( CPosUiGoodsTypeDlg::SECOND_GRADE_FOCUS_SHOW_FLG_UNABLE_VALUE == isFocusShowFlg ){
iPageItemCnt = lpclGoodsTypeBuildParam->getGoodsTypeSecondGradeListItemCnt();
}
CPosUiTypeAddDlgInstanceState * lpclState = dynamic_cast
if(NULL != lpclState){
if(lpclState->getGoodsTypeLastViewItemCnt() == iPageItemCnt - 1){
lpclState->setGoodsTypeLastPage(lpclState->getGoodsTypeLastPage() + 1);
lpclState->setGoodsTypeLastViewItemCnt(0);
}
else{
lpclState->setGoodsTypeLastViewItemCnt(lpclState->getGoodsTypeLastViewItemCnt() + 1);
}
syDbgMsg("m_bGoodsTypeLastPage = %d.\n",lpclState->getGoodsTypeLastPage());
syDbgMsg("m_bGoodsTypeLastViewItemCnt = %d.\n",lpclState->getGoodsTypeLastViewItemCnt());
}
}
}
#endif //#ifdef SUPPORT 小商场架构