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

📄 serverdoc.cpp

📁 面向软件工程的Visual C++网络程序开发
💻 CPP
📖 第 1 页 / 共 5 页
字号:
			{				
				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));
						}
						pView->InsertRow("验收单",saTmp);
						saTmp.RemoveAll();
					}
					pMsg->Type = 2222;
					pMsg->ShortMessage = "success";
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1313:
			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 strSelect;
					CStringArray sResult[100];
					ULONG ulColCount;
					strSelect="select * from [送货单] where 编号 = '" + pMsg->ShortMessage + "'";
					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 = 2313;
						pMsg->ShortMessage = "";
						SendMsg(pSock, pMsg);
						break;
					}

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

					pMsg->Type = 2313;
					pMsg->ShortMessage = strReturn;
//					AfxMessageBox(strReturn);
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1340:
			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 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 = 2340;
					pMsg->ShortMessage = sResult3[0][0];
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1341:
			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,30);

//					AfxMessageBox(pMsg->ShortMessage);
					
					pView->InsertRow("调拨单",m_StrArray);

					pMsg->Type = 2341;
					pMsg->ShortMessage = "success";
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1230:
			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 [出库单]";//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 = 2230;
					pMsg->ShortMessage = sResult3[0][0];
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1231:
			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);
					CString strSelect;
					CStringArray sResult[100];
					ULONG ulColCount;
					strSelect="select * from [调拨单] where 出货部门 = '" + m_StrArray.GetAt(0) + "' and 送货单编号 = '" + 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 = 2231;
						pMsg->ShortMessage = "";
						SendMsg(pSock, pMsg);
						break;
					}

					CString sReturn="",str;
					for(int i = 0; i < pView->m_iRefresh; i++)
					{
						for(int j = 0; j < (int)ulColCount; j++)
						{
							sReturn += sResult[j][i];
							sReturn += CHARFLAG;
						}
					}

					pMsg->Type = 2231;
					pMsg->ShortMessage = sReturn;
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1232:
			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));
						}
						pView->InsertRow("出库单",saTmp);
						saTmp.RemoveAll();
					}
//					pView->InsertRow("出库单",m_StrArray);

					pMsg->Type = 2232;
					pMsg->ShortMessage = "success";
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1510:
			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);

					CStringArray sResult[100];

					CString strSelect1;

					ULONG ulColCount;
					strSelect1="select 销售部门,sum(cast(已付尾款 as float(20))) as 已付款 into tmp from 收款凭据 where 付尾款日期 >= '" + m_StrArray.GetAt(0) + "' and 付尾款日期 <= '" + m_StrArray.GetAt(1) + "' group by 销售部门 union select 销售部门,sum(cast(已付定金 AS float(20))+cast(预付金额 AS float(20))) as 已付款 from 收款凭据 where 日期 >= '" + m_StrArray.GetAt(0) + "' and 日期 <= '" + m_StrArray.GetAt(1) + "' group by 销售部门";

//					strSelect1="select 销售部门,sum(cast(已付尾款 as float(20))) as 已付款 into tmp from 收款凭据 where 付尾款日期 >= '" + m_StrArray.GetAt(0) + "' and 付尾款日期 <= '" + m_StrArray.GetAt(1) + "' group by 销售部门";
					if(!pView->OpenCurRecordset(strSelect1)) return ;
//					CString ss[100];
//					if(!pView->GetColumn(&ulColCount,ss)) return ;
//					if(0==ulColCount) return ;
//					pView->RefreshData(ulColCount,sResult);

					strSelect1 = "select 销售部门,sum(cast(已付款 AS float(20))) from tmp group by 销售部门 order by sum(cast(已付款 AS float(20))) desc";
					if(!pView->OpenCurRecordset(strSelect1)) return ;
					CStringArray sResult1[100];
					CString ss1[100];
					if(!pView->GetColumn(&ulColCount,ss1)) return ;
					if(0==ulColCount) return ;
					pView->RefreshData(ulColCount,sResult1);

					if(sResult1[0][0] == "")
					{
						pMsg->Type = 2510;
						pMsg->ShortMessage = "";
						SendMsg(pSock, pMsg);
						strSelect1="Drop table tmp";
						if(!pView->OpenCurRecordset(strSelect1)) return ;
						break;
					}

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

//					CString str = sResult1[0][0];
//					AfxMessageBox(str);
					strSelect1="Drop table tmp";
					if(!pView->OpenCurRecordset(strSelect1)) return ;

					pMsg->Type = 2510;
					pMsg->ShortMessage = sReturn;
//					AfxMessageBox(sReturn);
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1511:
			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);

					CStringArray sResult[100];

					CString strSelect1;

					ULONG ulColCount;
					strSelect1="select 营业员,sum(cast(已付尾款 as float(20))) as 已付款 into tmp from 收款凭据 where 付尾款日期 >= '" + m_StrArray.GetAt(0) + "' and 付尾款日期 <= '" + m_StrArray.GetAt(1) + "' and 合计 != '' group by 营业员 union select 营业员,sum(cast(已付定金 AS float(20))+cast(预付金额 AS float(20))) as 已付款 from 收款凭据 where 日期 >= '" + m_StrArray.GetAt(0) + "' and 日期 <= '" + m_StrArray.GetAt(1) + "' and 合计 != '' group by 营业员";
					if(!pView->OpenCurRecordset(strSelect1)) return ;

					strSelect1 = "select 营业员,sum(cast(已付款 AS float(20))) from tmp group by 营业员 order by sum(cast(已付款 AS float(20))) desc";
					if(!pView->OpenCurRecordset(strSelect1)) return ;
					CStringArray sResult1[100];
					CString ss1[100];
					if(!pView->GetColumn(&ulColCount,ss1)) return ;
					if(0==ulColCount) return ;
					pView->RefreshData(ulColCount,sResult1);

					if(sResult1[0][0] == "")
					{
						pMsg->Type = 2511;
						pMsg->ShortMessage = "";
						SendMsg(pSock, pMsg);
						strSelect1="Drop table tmp";
						if(!pView->OpenCurRecordset(strSelect1)) return ;
						break;
					}

					int i;
					CString sReturn,str;
					str.Format("%d",pView->m_iRefresh);
					sReturn = str;
					sReturn += CHARFLAG;
					str.Format("%d",3);
					sReturn += str;
					sReturn += CHARFLAG;
					int Row = pView->m_iRefresh;
					for(i = 0; i < Row; i++)
					{
						str = sResult1[0][i];
						sReturn += str;
						sReturn += CHARFLAG;
						
						strSelect1 = "select 营业员姓名 from 营业员 where 营业员代码 = '" + sResult1[0][i] + "'";
						if(!pView->OpenCurRecordset(strSelect1)) return ;
						CStringArray sResult2[100];
						CString ss2[100];
						if(!pView->GetColumn(&ulColCount,ss2)) return ;
						if(0==ulColCount) return ;
						pView->RefreshData(ulColCount,sResult2);
						
						sReturn += sResult2[0][0];
						sReturn += CHARFLAG;

						sReturn += sResult1[1][i];
						sReturn += CHARFLAG;
					}

//					CString str = sResult1[0][0];
//					AfxMessageBox(str);
					strSelect1="Drop table tmp";
					if(!pView->OpenCurRecordset(strSelect1)) return ;

					pMsg->Type = 2511;
					pMsg->ShortMessage = sReturn;
//					AfxMessageBox(sReturn);
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1512:
			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);

					CStringArray sResult[100];

					CString strSelect1;

					ULONG ulColCount;
					strSelect1="select 供货商,sum(cast(销售金额 as float(20))) as 销售金额 into tmp from 收款凭据 where 日期 >= '" + m_StrArray.GetAt(0) + "' and 日期 <= '" + m_StrArray.GetAt(1) + "' group by 供货商";// order by sum(cast(销售金额 AS float(20))) desc
					if(!pView->OpenCurRecordset(strSelect1)) return ;

					strSelect1 = "select 供货商,sum(cast(销售金额 AS float(20))) from tmp group by 供货商 order by sum(cast(销售金额 AS float(20))) desc";
					if(!pView->OpenCurRecordset(strSelect1)) return ;
					CStringArray sResult1[100];
					CString ss1[100];
					if(!pView->GetColumn(&ulColCount,ss1)) return ;
					if(0==ulColCount) return ;
					pView->RefreshData(ulColCount,sResult1);

					if(sResult1[0][0] == "")
					{
						pMsg->Type = 2512;
						pMsg->ShortMessage = "";
						SendMsg(pSock, pMsg);
						strSelect1="Drop table tmp";
						if(!pView->OpenCurRecordset(strSelect1)) return ;
						break;
					}

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

//					CString str = sResult1[0][0];
//					AfxMessageBox(str);
					strSelect1="Drop table tmp";
					if(!pView->OpenCurRecordset(strSelect1)) return ;

					pMsg->Type = 2512;
					pMsg->ShortMessage = sReturn;
//					AfxMessageBox(sReturn);
					SendMsg(pSock, pMsg);
					break;
				}
			}
            break;
		case 1513:
			for( posname=m_connectionList.GetHeadPosition();posname;)
			{				
				pSock = (CServiceSocket *)m_connectionList.GetNext(posname);
				if(pSock->Name == pMsg->To )
				{
					CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMain

⌨️ 快捷键说明

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