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

📄 serverdoc.cpp

📁 面向软件工程的Visual C++网络程序开发
💻 CPP
📖 第 1 页 / 共 5 页
字号:
					
					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 = 2212;
					pMsg->ShortMessage = sReturn;
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1920:
			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();

					CUIntArray ua;
					CStringArray sa;
					ua.RemoveAll();
					sa.RemoveAll();
					CString strSelect;
					CStringArray sResult[100];
					ULONG ulColCount;
					strSelect="select * from [供应商资料]";
					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 = 2920;
						pMsg->ShortMessage = "";
						SendMsg(pSock, pMsg);
						break;

					}
					CString sReturn,str;
					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;
						}
					}

					pMsg->Type = 2920;
					pMsg->ShortMessage = sReturn;
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1921:
			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);
					
					for(int i = 0; i < m_iRow; i++)
					{
						CStringArray sResult[100];
						CString strSelect;
						ULONG ulColCount;
						strSelect="select * from [供应商资料] where 商家编码 = '" + m_StrArray[i*m_iCol] + "'";
						if(!pView->OpenCurRecordset(strSelect)) return ;
						CString ss[100];
						if(!pView->GetColumn(&ulColCount,ss)) return ;
						if(0==ulColCount) return ;
						pView->RefreshData(ulColCount,sResult);
						CStringArray saValues;
						saValues.RemoveAll();
						if(sResult[0][0] == m_StrArray[i*m_iCol])
						{
							for(int j = 0; j < m_iCol; j++)
							{
								saValues.Add(m_StrArray.GetAt(j+i*m_iCol));
							}
							pView->UpDateRow(strSelect,saValues);

						}
						else
						{
							CStringArray saTmp;
							saTmp.RemoveAll();
							for(int j = 0; j < m_iCol; j++)
							{
								saTmp.Add(m_StrArray.GetAt(j+i*m_iCol));
							}

							pView->InsertRow("供应商资料",saTmp);
						}
					}
					pMsg->Type = 2921;
					pMsg->ShortMessage = "success";
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1922:
			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);

					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) + "'";
						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 = 2922;
							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) + "'";
						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 = 2922;
							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) + "'";
						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 = 2922;
							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;
							}
						}
					}


					pMsg->Type = 2922;
					pMsg->ShortMessage = sReturn;
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1923:
			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();

					CUIntArray ua;
					CStringArray sa;
					ua.RemoveAll();
					sa.RemoveAll();
					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 = 2923;
						pMsg->ShortMessage = "";
						SendMsg(pSock, pMsg);
						break;
					}
					pView->DeleteRow(strSelect);
					pMsg->Type = 2923;
					pMsg->ShortMessage = "success";
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1913:
			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();

					CUIntArray ua;
					CStringArray sa;
					ua.RemoveAll();
					sa.RemoveAll();
					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 = 2923;
						pMsg->ShortMessage = "";
						SendMsg(pSock, pMsg);
						break;
					}
					pView->DeleteRow(strSelect);
					pMsg->Type = 2913;
					pMsg->ShortMessage = "success";
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1223:
			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);
//					int iCol = m_iCol-4;//减去前面的查询字段,余下的为需要更新的记录数
					CString sReturn,str;
					if(m_StrArray.GetAt(3) == "")
					{
						for(int i = 4; i < m_iCol; i++)
						{
							CString strSelect;
							CStringArray sResult[100];
							ULONG ulColCount;
							strSelect="select * from [入库单] where " + m_StrArray.GetAt(0) + " = '" + m_StrArray.GetAt(1) + "' and 商品编码 = '" + m_StrArray.GetAt(i) + "'";
							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 = 2223;
								pMsg->ShortMessage = "";
								SendMsg(pSock, pMsg);
								break;
							}
							sResult[14][0] = "已验收";
							CStringArray saValues;
							for(int i = 0; i < (int)ulColCount; i++)
							{
								saValues.Add(sResult[i][0]);
							}
							pView->UpDateRow(strSelect,saValues);
						}

					}
					else if(m_StrArray.GetAt(1) == "")
					{
						for(int i = 4; i < m_iCol; i++)
						{
							CString strSelect;
							CStringArray sResult[100];
							ULONG ulColCount;
							strSelect="select * from [入库单] where " + m_StrArray.GetAt(2) + " = '" + m_StrArray.GetAt(3) + "' and 商品编码 = '" + m_StrArray.GetAt(i) + "'";
							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 = 2223;
								pMsg->ShortMessage = "";
								SendMsg(pSock, pMsg);
								break;
							}
							sResult[14][0] = "已验收";
							CStringArray saValues;
							for(int i = 0; i < (int)ulColCount; i++)
							{
								saValues.Add(sResult[i][0]);
							}
							pView->UpDateRow(strSelect,saValues);
						}

					}
					else
					{
						for(int i = 4; i < m_iCol; i++)
						{
							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 商品编码 = '" + m_StrArray.GetAt(i) + "'";
							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 = 2223;
								pMsg->ShortMessage = "";
								SendMsg(pSock, pMsg);
								break;
							}
							sResult[14][0] = "已验收";
							CStringArray saValues;
							for(int i = 0; i < (int)ulColCount; i++)
							{
								saValues.Add(sResult[i][0]);
							}
							pView->UpDateRow(strSelect,saValues);
						}

					}

					pMsg->Type = 2223;
					pMsg->ShortMessage = "success";
					SendMsg(pSock, pMsg);
					break;
				}
			}
			break;
		case 1222:
			for( posname=m_connectionList.GetHeadPosition();posname;)

⌨️ 快捷键说明

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