Exemplo n.º 1
0
/***************************************************************************************************
*FunctionName: activityFresh
*Description: 界面刷新
*Input: 
*Output: 
*Return: 
*Author: xsx
*Date: 2016年12月21日09:01:16
***************************************************************************************************/
static void activityFresh(void)
{
	S_WaitPageData->cnt++;
	
	if(S_WaitPageData->cnt % 5 == 0)
	{
		/*是否插卡*/
		if(GetCardState() == CardIN)
		{
			stopPlay();
			S_WaitPageData->currenttestdata->statues = status_preread;
			startActivity(createPreReadCardActivity, NULL);
			return;
		}
		/*时间到,未插卡,返回*/
		else if(TimeOut == timer_expired(&(S_WaitPageData->timer2)))
		{
			AddNumOfSongToList(11, 0);
			timer_restart(&(S_WaitPageData->timer2));
		}
	}
	
	
	//如果排队中,有卡接近测试时间,则删除当前测试创建任务,返回
	if(GetMinWaitTime() < 40)
	{
		stopPlay();
		MotorMoveTo(1, 2, MaxLocation, FALSE);
		DeleteCurrentTest();
		
		backToActivity(paiduiActivityName);
	}
}
Exemplo n.º 2
0
/***************************************************************************************************
*FunctionName: activityStart
*Description: 显示主界面
*Input: 
*Output: 
*Return: 
*Author: xsx
*Date: 2016年12月21日09:00:32
***************************************************************************************************/
static void activityStart(void)
{
	MotorMoveTo(1, 2, WaittingCardLocation, FALSE);
		
	S_WaitPageData->currenttestdata = GetCurrentTestItem();
	S_WaitPageData->currenttestdata->statues = status_wait1;
		
	/*间隔一段时间提示插卡*/
	timer_set(&(S_WaitPageData->timer2), 50);
		
	//如果无卡,提示插卡
	if(GetCardState() == NoCard)
		AddNumOfSongToList(11, 0);
	
	SelectPage(88);
}
Exemplo n.º 3
0
static void activityFresh(void)
{
	if(S_AdjustLedPageBuffer)
	{
		if(GetCardState() == NoCard)
		{
			if(S_AdjustLedPageBuffer->isTestting == FALSE)
			{
				dspTestStatus("Waitting\0");
			}
		}
		
		if(My_Pass == TakeTestResult(&(S_AdjustLedPageBuffer->cardpretestresult)))
		{
			analysisTestData();
		}
	}
}
Exemplo n.º 4
0
static int do_froze_onecard(TRUSERID *handle,int iRequest,ST_PACK *rPack,int *pRetCode,char *szMsg)
{
	int  ret = 0;
	int	card_id = 0;
	char logicdate[11]="";
	char sysdate[11]="";
	char systime[9]="";
	char	oper[33+1] = "";
	int	cut_id  = 0;
	int	maindevice_id = 0;
	int	device_id = 0;
	double dSerial_no = 0;
	char sCardState[5] = "";
	T_t_tif_black_sheet black_sheet;
	T_t_tif_tradeserial  tradeserial;
    T_t_tif_meslist tMesList;

	memset(&black_sheet,0,sizeof(black_sheet));
	memset(&tradeserial,0,sizeof(tradeserial));
	memset(&tMesList,0,sizeof(tMesList));

	getsysdate(sysdate);
	getsystime(systime);
	ret=GetLogicDate(logicdate);								//业务日期
	if(ret)
	{
		return ret;
	}
	//	准备输入信息
	card_id = rPack->lvol1;												//卡标识
	cut_id = rPack->lvol0;												//客户号
	des2src(oper,rPack->scust_limit);									//操作员号
	maindevice_id = rPack->lvol6;											//上传工作站标识
	device_id = rPack->lvol7;												//采集设备标识

	//	检查客户信息,判断是否可以冻结
	ret = GetCardState(card_id,sCardState);
	if (ret)
	{
		writelog(LOG_ERR,"card_id[%d]",sCardState);
		return ret;
	}
	if('2'==sCardState[CARDSTAT_TYPE_REG])
	{
		ret = E_CARDNO_LOGOUT;
		return ret;
	}
	if(STATE_TRUE==sCardState[CARDSTAT_TYPE_FREEZE])
	{
		ret = E_CARDNO_FREEZE;
		return ret;
	}
	//	修改卡状态为冻结
	ret = UpdateCardState(card_id,CARDSTAT_TYPE_FREEZE,STATE_TRUE);
	if (ret)
	{
		writelog(LOG_ERR,"SQLCODE=[%d]",ret);
		return ret;
	}

	ret=InsertToBlkList(card_id,ADD_BLACKLIST);
	if (ret)
	{
		writelog(LOG_ERR,"InsertToBlkList err[%d]",ret);
		return ret;
	}
	
	//广播黑名单
	AddXmlItemInt(tMesList.incontent, XML_KEY_CARDID,card_id);
	AddXmlItemInt(tMesList.incontent, XML_KEY_ADDDELSIGN,ADD_BLACKLIST);	//增删标志

	tMesList.funid = 930005;
	tMesList.level = 1;
	ret=AddMsgLst(&tMesList);
	if(ret)
	{
		writelog(LOG_ERR,"AddMsgLst err[%d]",ret);
		return ret;
	}
	//	准备数据插入交易流水表
	ret = getNewUniqNo(KEYTYPE_TRADESERIAL,&dSerial_no);  					//获得最大流水号
	if(ret)
	{
		writelog(LOG_ERR,"ERRCODE = [%d]",ret);
		return ret;
	}
	des2src(tradeserial.operate_date,sysdate);											//发生日期
	des2src(tradeserial.operate_time,systime);											//发生时间
	des2src(tradeserial.collect_date,sysdate);												//采集日期
	des2src(tradeserial.collect_time,systime);												//采集时间
	des2src(tradeserial.enteract_date,logicdate);											//处理日期
	des2src(tradeserial.enteract_time,systime);											//处理时间
	tradeserial.serial_no = D2I(dSerial_no);									//流水号
	tradeserial.serial_type = TXCODE_FREEZE_CARD;								//挂失
	tradeserial.serial_state = SERISTAT_NONEEDDEBT;							//流水状态
	tradeserial.maindevice_id = maindevice_id;									//上传工作站标识
	tradeserial.device_id = device_id;											//采集设备标识
	tradeserial.card_id = card_id;												//交易卡号
	tradeserial.customer_id=cut_id;											//客户号
	des2src(tradeserial.oper_code,oper);
	//	插入交易流水表
	ret = DB_t_tif_tradeserial_add(&tradeserial);
	if (ret)
	{
		writelog(LOG_ERR,"ret[%d]",ret);
		if(DB_REPEAT==ret)
			ret = E_DB_TRADESERIAL_E;
		else
			ret = E_DB_TRADESERIAL_I;
		return ret;
	}
	return 0;
}
Exemplo n.º 5
0
int F930005(TRUSERID *handle,int iRequest,ST_PACK *in_pack,int *pRetCode,char *szMsg)
{
	int ret = 0;
	int cnt=0;
	int mesid=0;
	char sCardState[5]="";
       T_t_tif_meslist tMesList;
	ST_CPACK aPack;
	ST_PACK *out_pack = &(aPack.pack);

	ResetNormalCPack(&aPack,0,1);
	SetCol(handle,0);
	SetCol(handle,F_VSVARSTR0,0);

	memset(&tMesList,0,sizeof(tMesList));

//	des2src(tMesList.devphy999_id, in_pack->sdate0);

	ret=GetCardState(in_pack->lvol0,sCardState);
	if (ret)
	{
		*pRetCode = ret;
		goto L_RETU;
	}
	if('2'==sCardState[CARDSTAT_TYPE_REG])
	{
		*pRetCode = E_CARDNO_LOGOUT;
		goto L_RETU;
	}
	AddXmlItemInt(tMesList.incontent, XML_KEY_CARDID,in_pack->lvol0);
	AddXmlItemStr(tMesList.incontent, XML_KEY_VERNUM, in_pack->sserial0);
	AddXmlItemInt(tMesList.incontent, XML_KEY_ADDDELSIGN,in_pack->lvol4);	//增删标志

	tMesList.funid = 930005;
	tMesList.level = 0;
	ret=AddMsgLst(&tMesList);
	if(ret)
	{
		*pRetCode=ret;
		writelog(LOG_ERR,"AddMsgLst err[%d]",ret);
		goto L_RETU;
	}
	if(iRequest!=930005)
		return 0;
	ret=db_commit();
	if(ret)
	{
		writelog(LOG_ERR,"db_commit ret[%d]",ret);
		*pRetCode=E_DB_COMMIT;
		goto  L_RETU;
	}
	mesid=tMesList.mesid;
	des2src(out_pack->sdate0,in_pack->sdate0);
	for(cnt=0;(cnt<10)&&(tMesList.ecode!=0);cnt++)
	{
		sleep(1);
		memset(&tMesList,0,sizeof(tMesList));
		ret=DB_t_tif_meslist_read_by_mesid(mesid, &tMesList);
		if(ret)
		{
			writelog(LOG_ERR,"DB_t_tif_meslist_read_by_mesid err[%d]",ret);
			*pRetCode=E_DB_MESLIST_R;
			goto L_RETU;
		}
	}
	switch(tMesList.ecode)
	{
		case 0:		//成功
			des2src(out_pack->vsvarstr0,"成功");
			break;
		case 9999:		//交易未处理
			des2src(out_pack->vsvarstr0,"前置机无应答");
			break;
		default:			//交易已经处理,但结果是失败
			des2src(out_pack->vsvarstr0,tMesList.emsg);
			break;
	}
	PutRow(handle,out_pack,pRetCode,szMsg);

	return 0;
L_RETU:
	return  -1;
}
Exemplo n.º 6
0
// 组装消息
void CDBCard::AddEntityDataToMsg(DB_OPERATION_TYPE opType, vector<BYTE>& pBA)
{
	// 传递来的消息前面已经加入了
	// OPEntityFlag:  1byte, 操作实体数量的标志 0: 单个, 1:多个
	// DBOP Type:     1byte, 数据库操作类型(枚举值)
	// MSG ID:        4byte, 该消息的MSGID
	// Entity Num:    2byte, 该实体个数
	if(DB_OPER_DELETE == opType) // DELETE操作
	{
		_AddToByteArray(&pBA, m_GUID); // 实体ID
		_AddToByteArray(&pBA, (long)0); // 属性种类个数

		// 发送CardNumber 字符串
		_AddToByteArray(&pBA, (WORD)1);
		_AddToByteArray(&pBA, (long)DB_CARD_ATTR_SZ_CARDNUMBER);
		_AddToByteArray(&pBA, GetCardNumber());
		return;
	}

	WORD attrNum = 0;
	for(int i = 0; i < (int)m_SendAttrEnumVector.size(); i++)
	{
		if(m_SendAttrEnumVector[i] != 0)
			attrNum++;
	}

	_AddToByteArray(&pBA, m_GUID); // 实体ID
	_AddToByteArray(&pBA, attrNum); // 属性种类个数

	for(int i = 0; i < (int)m_SendAttrEnumVector.size(); i++)
	{
		if(m_SendAttrEnumVector[i] != 0 
			&& ( DB_OPER_SAVE == opType || DB_OPER_UPDATE == opType || DB_OPER_LOAD == opType ) )// 标志打开并且为SAVE/UPDATE/LOAD操作
		{
			switch(DB_CARD_ATTR_SZ_CARDNUMBER+i)
			{
			case DB_CARD_ATTR_SZ_CARDNUMBER:
				{
					_AddToByteArray(&pBA, (WORD)1);
					_AddToByteArray(&pBA, (long)DB_CARD_ATTR_SZ_CARDNUMBER);
					if(DB_OPER_LOAD != opType)
						_AddToByteArray(&pBA, GetCardNumber());
					else
						_AddToByteArray(&pBA, (BYTE)0);
				}
				break;
			case DB_CARD_ATTR_SZ_CARDTYPE:
				{
					_AddToByteArray(&pBA, (WORD)1);
					_AddToByteArray(&pBA, (long)DB_CARD_ATTR_SZ_CARDTYPE);
					if(DB_OPER_LOAD != opType)
						_AddToByteArray(&pBA, GetCardType());
					else
						_AddToByteArray(&pBA, (BYTE)0);
				}
				break;
			case DB_CARD_ATTR_SZ_SELLERACCOUNT:
				{
					_AddToByteArray(&pBA, (WORD)1);
					_AddToByteArray(&pBA, (long)DB_CARD_ATTR_SZ_SELLERACCOUNT);
					if(DB_OPER_LOAD != opType)
						_AddToByteArray(&pBA, GetSellerAccount());
					else
						_AddToByteArray(&pBA, (BYTE)0);
				}
				break;
			case DB_CARD_ATTR_LONG_SELLERID:
				{
					_AddToByteArray(&pBA, (WORD)1);
					_AddToByteArray(&pBA, (long)DB_CARD_ATTR_LONG_SELLERID);
					if(DB_OPER_LOAD != opType)
						_AddToByteArray(&pBA, GetSellerID());
					else
						_AddToByteArray(&pBA, (BYTE)0);
				}
				break;
			case DB_CARD_ATTR_SZ_BUYERACCOUNT:
				{
					_AddToByteArray(&pBA, (WORD)1);
					_AddToByteArray(&pBA, (long)DB_CARD_ATTR_SZ_BUYERACCOUNT);
					if(DB_OPER_LOAD != opType)
						_AddToByteArray(&pBA, GetBuyerAccount());
					else
						_AddToByteArray(&pBA, (BYTE)0);
				}
				break;
			case DB_CARD_ATTR_LONG_BUYERID:
				{
					_AddToByteArray(&pBA, (WORD)1);
					_AddToByteArray(&pBA, (long)DB_CARD_ATTR_LONG_BUYERID);
					if(DB_OPER_LOAD != opType)
						_AddToByteArray(&pBA, GetBuyerID());
					else
						_AddToByteArray(&pBA, (BYTE)0);
				}
				break;
			case DB_CARD_ATTR_DWORD_PRICE:
				{
					_AddToByteArray(&pBA, (WORD)1);
					_AddToByteArray(&pBA, (long)DB_CARD_ATTR_DWORD_PRICE);
					if(DB_OPER_LOAD != opType)
						_AddToByteArray(&pBA, GetPrice());
					else
						_AddToByteArray(&pBA, (BYTE)0);
				}
				break;
			case DB_CARD_ATTR_DWORD_CHARGEPRICE:
				{
					_AddToByteArray(&pBA, (WORD)1);
					_AddToByteArray(&pBA, (long)DB_CARD_ATTR_DWORD_CHARGEPRICE);
					if(DB_OPER_LOAD != opType)
						_AddToByteArray(&pBA, GetChargePrice());
					else
						_AddToByteArray(&pBA, (BYTE)0);
				}
				break;
			case DB_CARD_ATTR_DWORD_CARDSTATE:
				{
					_AddToByteArray(&pBA, (WORD)1);
					_AddToByteArray(&pBA, (long)DB_CARD_ATTR_DWORD_CARDSTATE);
					if(DB_OPER_LOAD != opType)
						_AddToByteArray(&pBA, GetCardState());
					else
						_AddToByteArray(&pBA, (BYTE)0);
				}
				break;
			case DB_CARD_ATTR_DWORD_CARDTIME:
				{
					_AddToByteArray(&pBA, (WORD)1);
					_AddToByteArray(&pBA, (long)DB_CARD_ATTR_DWORD_CARDTIME);
					if(DB_OPER_LOAD != opType)
						_AddToByteArray(&pBA, GetCardTime());
					else
						_AddToByteArray(&pBA, (BYTE)0);
				}
				break;
			case DB_CARD_ATTR_DWORD_STARTTIME:
				{
					_AddToByteArray(&pBA, (WORD)1);
					_AddToByteArray(&pBA, (long)DB_CARD_ATTR_DWORD_STARTTIME);
					if(DB_OPER_LOAD != opType)
						_AddToByteArray(&pBA, GetStartTime());
					else
						_AddToByteArray(&pBA, (BYTE)0);
				}
				break;
			case DB_CARD_ATTR_DWORD_SERIALNUMBER:
				{
					_AddToByteArray(&pBA, (WORD)1);
					_AddToByteArray(&pBA, (long)DB_CARD_ATTR_DWORD_SERIALNUMBER);
					if(DB_OPER_LOAD != opType)
						_AddToByteArray(&pBA, GetSerialNumber());
					else
						_AddToByteArray(&pBA, (BYTE)0);
				}
				break;
			}
		}
	}

}