⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serverdoc.cpp

📁 面向软件工程的Visual C++网络程序开发
💻 CPP
📖 第 1 页 / 共 5 页
字号:
					CString strSelect3;
					CStringArray sResult3[100];
					ULONG ulColCount3;
					strSelect3="select COUNT(编号) from [送货单]";//change max to count
					if(!pView->OpenCurRecordset(strSelect3)) return ;
					CString ss3[100];
					if(!pView->GetColumn(&ulColCount3,ss3)) return ;
					if(0==ulColCount3) return ;
					pView->RefreshData(ulColCount3,sResult3);
					if(sResult3[0][0]=="")
						sResult3[0][0]="0";
					pMsg->Type = 23111;
					pMsg->ShortMessage = sResult3[0][0];
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1323:
			for( posname=m_connectionList.GetHeadPosition();posname;)
			{				
				pSock = (CServiceSocket *)m_connectionList.GetNext(posname);
				if(pSock->Name == pMsg->To )
				{
					CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
					CServerView* pView=(CServerView*)pwnd->GetActiveView();

					StringSeg(pMsg->ShortMessage,2);
					CUIntArray ua;
					CStringArray sa;
					ua.RemoveAll();
					sa.RemoveAll();

					CString strSelect;
					CStringArray sResult[100];
					ULONG ulColCount;
					strSelect="select * from [订货合约] where " + m_StrArray.GetAt(0) + " = '" + m_StrArray.GetAt(1) + "'";
					if(!pView->OpenCurRecordset(strSelect)) return ;
					CString ss[100];
					if(!pView->GetColumn(&ulColCount,ss)) return ;
					if(0==ulColCount) return ;
					pView->RefreshData(ulColCount,sResult);

					if(sResult[0][0] == "")
					{
						pMsg->Type = 2323;
						pMsg->ShortMessage = "";
						SendMsg(pSock, pMsg);
						break;
					}

					CString strReturn = "";
					int n = 0;
					for(int i = 0; i < 4; i++)
					{
						for(int j = 5; j < 16; j++)
						{
							strReturn += sResult[j+n][0];
							strReturn += CHARFLAG;
						}
						n += 11;
					}

					strReturn += sResult[51][0];//heji
					strReturn += CHARFLAG;

					pMsg->Type = 2323;
					pMsg->ShortMessage = strReturn;
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1311:
			for( posname=m_connectionList.GetHeadPosition();posname;)
			{				
				pSock = (CServiceSocket *)m_connectionList.GetNext(posname);
				if(pSock->Name == pMsg->To )
				{
					CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
					CServerView* pView=(CServerView*)pwnd->GetActiveView();
					StringSeg(pMsg->ShortMessage,62);

//					AfxMessageBox(pMsg->ShortMessage);
					
					pView->InsertRow("送货单",m_StrArray);

					pMsg->Type = 2311;
					pMsg->ShortMessage = "success";
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1331:
			for( posname=m_connectionList.GetHeadPosition();posname;)
			{				
				pSock = (CServiceSocket *)m_connectionList.GetNext(posname);
				if(pSock->Name == pMsg->To )
				{
					CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
					CServerView* pView=(CServerView*)pwnd->GetActiveView();

					StringSeg(pMsg->ShortMessage,2);
//					AfxMessageBox(m_StrArray.GetAt(0));
					CUIntArray ua;
					CStringArray sa;
					ua.RemoveAll();
					sa.RemoveAll();
					CString strSelect;
					CStringArray sResult[100];
					ULONG ulColCount;
					strSelect="select * from [收款凭据] where " + m_StrArray.GetAt(0) + " = '" + m_StrArray.GetAt(1) + "'";
					if(!pView->OpenCurRecordset(strSelect)) return ;
					CString ss[100];
					if(!pView->GetColumn(&ulColCount,ss)) return ;
					if(0==ulColCount) return ;
					pView->RefreshData(ulColCount,sResult);
					if(sResult[0][0] == "")
					{
						pMsg->Type = 2331;
						pMsg->ShortMessage = "";
						SendMsg(pSock, pMsg);
						break;
					}
					
					CString strReturn = sResult[2][0];
					strReturn += CHARFLAG;
					strReturn += sResult[13][0];
					strReturn += CHARFLAG;
					strReturn += sResult[15][0];
					strReturn += CHARFLAG;
					strReturn += sResult[16][0];
					strReturn += CHARFLAG;

					pMsg->Type = 2331;
					pMsg->ShortMessage = strReturn;
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1332:
			for( posname=m_connectionList.GetHeadPosition();posname;)
			{				
				pSock = (CServiceSocket *)m_connectionList.GetNext(posname);
				if(pSock->Name == pMsg->To )
				{
					CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
					CServerView* pView=(CServerView*)pwnd->GetActiveView();

					StringSeg(pMsg->ShortMessage,4);
					CUIntArray ua;
					CStringArray sa;
					ua.RemoveAll();
					sa.RemoveAll();
					CString strSelect;
					CStringArray sResult[100];
					ULONG ulColCount;
					strSelect="select * from [收款凭据] where 收款凭据编号 = '" + m_StrArray.GetAt(0) + "'";
					if(!pView->OpenCurRecordset(strSelect)) return ;
					CString ss[100];
					if(!pView->GetColumn(&ulColCount,ss)) return ;
					if(0==ulColCount) return ;
					pView->RefreshData(ulColCount,sResult);
					int j;
/*					for(i = 0; i < pView->m_iRefresh; i++)
					{
						sResult[17][i] = m_StrArray.GetAt(1);
						sResult[19][i] = m_StrArray.GetAt(2);
						sResult[20][i] = m_StrArray.GetAt(3);
					}
*/
					sResult[17][0] = m_StrArray.GetAt(1);
					sResult[19][0] = m_StrArray.GetAt(2);
					sResult[20][0] = m_StrArray.GetAt(3);
					CStringArray saValues;
/*					for(i = 0; i < pView->m_iRefresh; i++)
					{
						for(j = 0; j < (int)ulColCount; j++)
						{
							saValues.Add(sResult[j][i]);
						}
						pView->UpDateRow(strSelect,saValues);
						saValues.RemoveAll();
					}
*/
					for(j = 0; j < (int)ulColCount; j++)
					{
						saValues.Add(sResult[j][0]);
					}
					pView->UpDateRow(strSelect,saValues);

					pMsg->Type = 2332;
					pMsg->ShortMessage = "success";
//						AfxMessageBox(strReturn);
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1211:
			for( posname=m_connectionList.GetHeadPosition();posname;)
			{				
				pSock = (CServiceSocket *)m_connectionList.GetNext(posname);
				if(pSock->Name == pMsg->To )
				{
					CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
					CServerView* pView=(CServerView*)pwnd->GetActiveView();
					
					CString strSelect3;
					CStringArray sResult3[100];
					ULONG ulColCount3;
					strSelect3="select MAX(CAST(入库单号 AS INT(20))) from [入库单]";
					if(!pView->OpenCurRecordset(strSelect3)) return ;
					CString ss3[100];
					if(!pView->GetColumn(&ulColCount3,ss3)) return ;
					if(0==ulColCount3) return ;
					pView->RefreshData(ulColCount3,sResult3);
					if(sResult3[0][0]=="")
						sResult3[0][0]="0";
					pMsg->Type = 2211;
					pMsg->ShortMessage = sResult3[0][0];
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1210:
			for( posname=m_connectionList.GetHeadPosition();posname;)
			{				
				pSock = (CServiceSocket *)m_connectionList.GetNext(posname);
				if(pSock->Name == pMsg->To )
				{
					CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
					CServerView* pView=(CServerView*)pwnd->GetActiveView();
					StringSeg(pMsg->ShortMessage);
					CStringArray saTmp;
					for(int i = 0; i < m_iRow; i++)
					{
						for(int j = 0; j < m_iCol; j++)
						{
							saTmp.Add(m_StrArray.GetAt(j+i*m_iCol));
//							saTmp.SetAt(j,m_StrArray.GetAt(j+i*m_iCol));
						}
						pView->InsertRow("入库单",saTmp);
						saTmp.RemoveAll();
					}
					pMsg->Type = 2210;
					pMsg->ShortMessage = "success";
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1220:
			for( posname=m_connectionList.GetHeadPosition();posname;)
			{				
				pSock = (CServiceSocket *)m_connectionList.GetNext(posname);
				if(pSock->Name == pMsg->To )
				{
					CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
					CServerView* pView=(CServerView*)pwnd->GetActiveView();
					
					CString strSelect3;
					CStringArray sResult3[100];
					ULONG ulColCount3;
					strSelect3="select MAX(CAST(验收单号 AS INT(20))) from [验收单]";
					if(!pView->OpenCurRecordset(strSelect3)) return ;
					CString ss3[100];
					if(!pView->GetColumn(&ulColCount3,ss3)) return ;
					if(0==ulColCount3) return ;
					pView->RefreshData(ulColCount3,sResult3);
					if(sResult3[0][0]=="")
						sResult3[0][0]="0";
					pMsg->Type = 2220;
					pMsg->ShortMessage = sResult3[0][0];
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1221:
			for( posname=m_connectionList.GetHeadPosition();posname;)
			{				
				pSock = (CServiceSocket *)m_connectionList.GetNext(posname);
				if(pSock->Name == pMsg->To )
				{
					CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
					CServerView* pView=(CServerView*)pwnd->GetActiveView();

/*					StringSeg(pMsg->ShortMessage,5);
					CString str;
					if(m_StrArray.GetAt(2) == "与")
					{
						str = "and";
						m_StrArray.SetAt(2,str);
					}
					else if(m_StrArray.GetAt(2) == "或")
					{
						str = "or";
						m_StrArray.SetAt(2,str);
					}

					CUIntArray ua;
					CStringArray sa;
					ua.RemoveAll();
					sa.RemoveAll();
					CString strSelect;
					CStringArray sResult[100];
					ULONG ulColCount;
					strSelect="select * from [入库单] where " + m_StrArray.GetAt(0) + " = '" + m_StrArray.GetAt(1) + "' " + m_StrArray.GetAt(2) + " " + m_StrArray.GetAt(3) + " = '" + m_StrArray.GetAt(4) + "' and 商品状态 = '未验收'";
					if(!pView->OpenCurRecordset(strSelect)) return ;
					CString ss[100];
					if(!pView->GetColumn(&ulColCount,ss)) return ;
					if(0==ulColCount) return ;
					pView->RefreshData(ulColCount,sResult);
					CString sReturn;
					str.Format("%d",pView->m_iRefresh);
					sReturn = str;
					sReturn += CHARFLAG;
					str.Format("%d",14);
					sReturn += str;
					sReturn += CHARFLAG;
					for(int i = 0; i < pView->m_iRefresh; i++)
					{
						for(int j = 0; j < 14; j++)
						{
							sReturn += sResult[j][i];
							sReturn += CHARFLAG;
						}
					}
*/					StringSeg(pMsg->ShortMessage,4);

					CString sReturn,str;
					if(m_StrArray.GetAt(3) == "")
					{
						CUIntArray ua;
						CStringArray sa;
						ua.RemoveAll();
						sa.RemoveAll();
						CString strSelect;
						CStringArray sResult[100];
						ULONG ulColCount;
						strSelect="select * from [入库单] where " + m_StrArray.GetAt(0) + " = '" + m_StrArray.GetAt(1) + "' and 商品状态 = '未验收'";
						if(!pView->OpenCurRecordset(strSelect)) return ;
						CString ss[100];
						if(!pView->GetColumn(&ulColCount,ss)) return ;
						if(0==ulColCount) return ;
						pView->RefreshData(ulColCount,sResult);

						if(sResult[0][0] == "")	
						{
							pMsg->Type = 2221;
							pMsg->ShortMessage = "";
							SendMsg(pSock, pMsg);
							break;

						}
						str.Format("%d",pView->m_iRefresh);
						sReturn = str;
						sReturn += CHARFLAG;
						str.Format("%d",(int)ulColCount);
						sReturn += str;
						sReturn += CHARFLAG;
						
						for(int i = 0; i < pView->m_iRefresh; i++)
						{
							for(int j = 0; j < (int)ulColCount; j++)
							{
								sReturn += sResult[j][i];
								sReturn += CHARFLAG;
							}
						}
					}
					else if(m_StrArray.GetAt(1) == "")
					{
						CUIntArray ua;
						CStringArray sa;
						ua.RemoveAll();
						sa.RemoveAll();
						CString strSelect;
						CStringArray sResult[100];
						ULONG ulColCount;
						strSelect="select * from [入库单] where " + m_StrArray.GetAt(2) + " = '" + m_StrArray.GetAt(3) + "' and 商品状态 = '未验收'";
						if(!pView->OpenCurRecordset(strSelect)) return ;
						CString ss[100];
						if(!pView->GetColumn(&ulColCount,ss)) return ;
						if(0==ulColCount) return ;
						pView->RefreshData(ulColCount,sResult);

						if(sResult[0][0] == "")	
						{
							pMsg->Type = 2221;
							pMsg->ShortMessage = "";
							SendMsg(pSock, pMsg);
							break;

						}
						str.Format("%d",pView->m_iRefresh);
						sReturn = str;
						sReturn += CHARFLAG;
						str.Format("%d",(int)ulColCount);
						sReturn += str;
						sReturn += CHARFLAG;
						
						for(int i = 0; i < pView->m_iRefresh; i++)
						{
							for(int j = 0; j < (int)ulColCount; j++)
							{
								sReturn += sResult[j][i];
								sReturn += CHARFLAG;
							}
						}
					}
					else
					{
						CUIntArray ua;
						CStringArray sa;
						ua.RemoveAll();
						sa.RemoveAll();
						CString strSelect;
						CStringArray sResult[100];
						ULONG ulColCount;
						strSelect="select * from [入库单] where " + m_StrArray.GetAt(0) + " = '" + m_StrArray.GetAt(1) + "' and " + m_StrArray.GetAt(2) + " = '" + m_StrArray.GetAt(3) + "' and 商品状态 = '未验收'";
						if(!pView->OpenCurRecordset(strSelect)) return ;
						CString ss[100];
						if(!pView->GetColumn(&ulColCount,ss)) return ;
						if(0==ulColCount) return ;
						pView->RefreshData(ulColCount,sResult);

						if(sResult[0][0] == "")	
						{
							pMsg->Type = 2221;
							pMsg->ShortMessage = "";
							SendMsg(pSock, pMsg);
							break;

						}
						str.Format("%d",pView->m_iRefresh);
						sReturn = str;
						sReturn += CHARFLAG;
						str.Format("%d",(int)ulColCount);
						sReturn += str;
						sReturn += CHARFLAG;
						
						for(int i = 0; i < pView->m_iRefresh; i++)
						{
							for(int j = 0; j < (int)ulColCount; j++)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -