// DlgScanBarCode.cpp : 实现文件 // #include "stdafx.h" #include "YLGL.h" #include "DlgScanBarCode.h" #include #pragma comment(lib, "Imm32.lib") // CDlgScanBarCode 对话框 ////////////////////////////////////////////////////////////////////////// IMPLEMENT_DYNAMIC(CEnEdit, CEdit) CEnEdit::CEnEdit() { m_DefaultHKL = GetDefaultKbdLayout(); m_Save_KbdLayout = 0; m_pParent = NULL; m_nLines = 0; m_bLockKbdLayout = TRUE; } CEnEdit::~CEnEdit() { } BEGIN_MESSAGE_MAP(CEnEdit, CEdit) //{{AFX_MSG_MAP(CEditEx) //}}AFX_MSG_MAP ON_CONTROL_REFLECT(EN_KILLFOCUS, OnEnKillfocus) ON_CONTROL_REFLECT(EN_SETFOCUS, OnEnSetfocus) //ON_WM_CHAR() ON_WM_CHAR() END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CEditEx message handlers void CEnEdit::OnEnKillfocus() { if(m_Save_KbdLayout) //恢复输入法; { printf("恢复输入法\n"); if(ActivateKeyboardLayout(m_Save_KbdLayout, 0) == 0) printf( _T("Restore ActivateKeyboardLayout Err=%d"), GetLastError()); m_Save_KbdLayout = 0; } } void CEnEdit::OnEnSetfocus() { if(m_DefaultHKL) { HKL CurKbdLayout = GetKeyboardLayout(0); if(CurKbdLayout != m_DefaultHKL) { m_Save_KbdLayout = CurKbdLayout; //保存输入法 ; if(ActivateKeyboardLayout(m_DefaultHKL, 0) == 0) //设置为默认输入法 ; { printf( _T("Set ActivateKeyboardLayout Err=%d"), GetLastError()); } } } } HKL CEnEdit::GetDefaultKbdLayout() { HKL HKL_Ret= 0; int nSize = GetKeyboardLayoutList(0 , 0); if(nSize != 0) { printf("输入法数量:%d\n", nSize); HKL FAR * lpList = (HKL FAR *)new HKL[nSize]; ZeroMemory(lpList, sizeof(HKL) * nSize); if(GetKeyboardLayoutList(nSize, lpList) == nSize) { for(int i=0; iDealScanBarCode(m_nLines); m_nLines++; } CEdit::OnChar(nChar, nRepCnt, nFlags); } */ ////////////////////////////////////////////////////////////////////////// IMPLEMENT_DYNAMIC(CDlgScanBarCode, CDialog) CDlgScanBarCode::CDlgScanBarCode(CWnd* pParent /*=NULL*/) : CDialog(CDlgScanBarCode::IDD, pParent) { m_nScanMode = 0; } CDlgScanBarCode::~CDlgScanBarCode() { } void CDlgScanBarCode::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, ET_BARCODE, m_EtBarCode); DDX_Control(pDX, IDC_LIST1, m_ScanResult); } BEGIN_MESSAGE_MAP(CDlgScanBarCode, CDialog) END_MESSAGE_MAP() // CDlgScanBarCode 消息处理程序 BOOL CDlgScanBarCode::OnInitDialog() { CDialog::OnInitDialog(); // TODO: 在此添加额外的初始化 if ( m_nScanMode == 0 ) { SetWindowText(_T("请使用条码枪扫描条码来完成回件!")); } else { SetWindowText(_T("请使用条码枪扫描条码来完成取件!")); } // 获取未取件的dindanspview;同时获取shangpin;gongyingshang;dindan;dindansp; g_sendhead.code[0] = 239; g_sendhead.code[1] = 240; g_sendhead.tabcount = 2; g_sendhead.bsql = 0; g_pMainWnd->ProcessChatMessageRequest2(""); if ( g_bSendOK == FALSE) return FALSE; DataToArray(&m_AryOrderItems, &m_AryOutWarehouse); m_EtBarCode.m_pParent = this; m_EtBarCode.SetFocus(); SetWindowPos(&wndTopMost, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE); CenterWindow(); InitSortList(); return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE } void CDlgScanBarCode::InitSortList() { //m_ScanResult.m_bSortSupport = TRUE;//是否启用列头重新排序; if ( !m_nScanMode ) m_ScanResult.SetHeadings(CString("回件结果,100;扫描条码,100;订单号,100;商品类别,100;商品名,100;商品数量,100;完成数量,100;取件数量,100;")); else m_ScanResult.SetHeadings(CString("取件结果,100;扫描条码,100;订单号,100;商品类别,100;商品名,100;商品数量,100;完成数量,100;取件数量,100;")); m_ScanResult.LoadColumnInfo(1003); } void CDlgScanBarCode::OnOK() { // TODO: 在此添加专用代码和/或调用基类 printf("\tOK触发\n"); if (ET_BARCODE == GetFocus()->GetDlgCtrlID() ) { printf("\t条码回车触发\n"); DealScanBarCode(0); } //CDialog::OnOK(); } void CDlgScanBarCode::DealScanBarCode(const int& nlines) { CString strText = _T(""); UpdateData(); #if 0 //GetDlgItemText(ET_BARCODE, strText); //SetDlgItemText(ET_BARCODE,""); TCHAR szBuff[1024] = {0}; m_EtBarCode.GetLine(nlines, (LPTSTR)szBuff, 1024); strText = szBuff; UpdateData(); #else GetDlgItemText(ET_BARCODE, strText); SetDlgItemText(ET_BARCODE, _T("")); #endif int i = 0; CString strAutoId; // 商品的AutoId; CString strOrder; // 订单号; CString strSPID; // 商品ID; CString strPSName; // 商品名称; CString strSQL, strSQL2; CString strBackCot; int nSPCount = 0; // 商品数量; int nBackCot = 0; // 回件数量; int nPickupCot = 0; // 取件数量; int nIndex = -1; // #位置; int nIndex2 = -1; // \r\n位置; //CString strTemp; strText.TrimLeft(_T("#")); strText.TrimRight(_T("\r")); // 包含在#和\r\n之间的符号,才是条形码; OrderItems tagItems; OrderItems tagOldItem; OutWarehouse tagOutWarehouse; OutWarehouse tagOldOutWarehouse; CTime tm = CTime::GetCurrentTime(); printf("商品AutoId = %s\n", strText); BOOL bGet = FALSE; int nListRow = 0; BOOL bFind = FALSE; for ( i = 0; i < m_AryOrderItems.GetSize(); i++ ) { if ( strText.CompareNoCase(m_AryOrderItems.ElementAt(i).ElementAt(1)) == 0 ) { // 找出订单号和商品ID、商品名称; strOrder = m_AryOrderItems.ElementAt(i).ElementAt(0); strSPID = m_AryOrderItems.ElementAt(i).ElementAt(2); strPSName = m_AryOrderItems.ElementAt(i).ElementAt(3); tagItems.nIndex = i; tagItems.strOrder = m_AryOrderItems.ElementAt(i).ElementAt(0); tagItems.strAutoId = m_AryOrderItems.ElementAt(i).ElementAt(1); tagItems.strSPId = m_AryOrderItems.ElementAt(i).ElementAt(2); tagItems.strSPName = m_AryOrderItems.ElementAt(i).ElementAt(3); tagItems.strSPLb = m_AryOrderItems.ElementAt(i).ElementAt(4); tagItems.strBackStatus = m_AryOrderItems.ElementAt(i).ElementAt(5); tagItems.strPickupStatus = m_AryOrderItems.ElementAt(i).ElementAt(6); tagItems.strShuliang = m_AryOrderItems.ElementAt(i).ElementAt(7); tagItems.strBackCot = m_AryOrderItems.ElementAt(i).ElementAt(8); tagItems.strPickupCot = m_AryOrderItems.ElementAt(i).ElementAt(9); tagOldItem = tagItems; bFind = TRUE; break; } } if ( !bFind ) {// 没找到产品; bGet = FALSE; for ( i = 0; i < m_AryWithOut.GetSize(); i++ ) { if ( strText.CompareNoCase(m_AryWithOut.ElementAt(i)) == 0 ) { bGet = TRUE; break; } } if ( !bGet ) { m_AryWithOut.Add(strText); m_ScanResult.AddItem(_T("未找到该产品条码"),strText, "", "", "", "", "","" ); } return; } bGet = FALSE; int nCurItemIndex = 0; if ( m_nScanMode == 0 ) {// 扫描回件; // 登记完成状态; for ( i = 0; i < m_AryOrderItems.GetSize(); i++ ) { if ( strText.CompareNoCase(m_AryOrderItems.ElementAt(i).ElementAt(1)) == 0 ) { if ( m_AryOrderItems.ElementAt(i).ElementAt(5).CompareNoCase("OK") != 0 ) { tagItems.nIndex = i; tagOldItem.nIndex = i; // 完成数量 + 1 == 商品数量 ==> 更新完成状态; if ( (atoi(m_AryOrderItems.ElementAt(i).ElementAt(7)) - atoi(m_AryOrderItems.ElementAt(i).ElementAt(8))) == 1) { strSQL.Format(_T("update dindansp set status1 = 'OK', [name3] = '%s', [date3] = '%s', [BackItemsCot] = '%s' where autoid = %s "), g_user.name, tm.Format("%Y-%m-%d"), m_AryOrderItems.ElementAt(i).ElementAt(7), strText); m_AryOrderItems.ElementAt(i).SetAt(8, m_AryOrderItems.ElementAt(i).ElementAt(7)); m_AryOrderItems.ElementAt(i).SetAt(5, "OK"); tagItems.strBackCot = m_AryOrderItems.ElementAt(i).ElementAt(7); tagItems.strBackStatus = _T("OK"); } else if ( atoi(m_AryOrderItems.ElementAt(i).ElementAt(7)) > atoi(m_AryOrderItems.ElementAt(i).ElementAt(8)) ) { strSQL.Format(_T("update dindansp set [name3] = '%s', [date3] = '%s', [BackItemsCot] = '%d' where autoid = %s "), g_user.name, tm.Format("%Y-%m-%d"), atoi(m_AryOrderItems.ElementAt(i).ElementAt(8)) + 1, strText); strBackCot.Format(_T("%d"), atoi(m_AryOrderItems.ElementAt(i).ElementAt(8)) + 1); m_AryOrderItems.ElementAt(i).SetAt(8, strBackCot); tagItems.strBackCot = strBackCot; } vector::iterator it = m_vtWithIn.begin(); for ( ; it != m_vtWithIn.end(); it++ ) { if ( strText.CompareNoCase(it->strBarCode) == 0 ) { bGet = TRUE; break; } } if ( !bGet ) { WithIn tagWithIn; tagWithIn.strBarCode = strText; tagWithIn.nIndex = m_ScanResult.AddItem(tagItems.strBackStatus, strText, tagItems.strOrder, tagItems.strSPLb, tagItems.strSPName, tagItems.strShuliang, tagItems.strBackCot, tagItems.strPickupCot ); nCurItemIndex = tagWithIn.nIndex; //tagItems.nIndex = nCurItemIndex; //tagOldItem.nIndex = nCurItemIndex; m_vtWithIn.push_back(tagWithIn); } else { nCurItemIndex = it->nIndex; //tagItems.nIndex = nCurItemIndex; //tagOldItem.nIndex = nCurItemIndex; m_ScanResult.SetItemText(it->nIndex, 0, tagItems.strBackStatus); // 回件状态; m_ScanResult.SetItemText(it->nIndex, 6, tagItems.strBackCot); // 完成数量; } ////////////////////////////////////////////////////////////////////////// // 是否要出库; if ( atoi(g_cominfoarray.ElementAt(0).ElementAt(99)) == 0 ) { nSPCount = 0; //BOOL bHasOutWarehouse = FALSE; for ( i = 0; i < m_AryOrderItems.GetSize(); i++ ) {// 查找该商品在订单目录下的数量; if ( m_AryOrderItems.ElementAt(i).ElementAt(0).CompareNoCase(strOrder) == 0 && m_AryOrderItems.ElementAt(i).ElementAt(2).CompareNoCase(strSPID) == 0 ) { nSPCount += atoi(m_AryOrderItems.ElementAt(i).ElementAt(7)); // 商品数量; nBackCot += atoi(m_AryOrderItems.ElementAt(i).ElementAt(8)); // 完成数量; nPickupCot += atoi(m_AryOrderItems.ElementAt(i).ElementAt(9)); // 取件数量; } }// for; // 获取出库数量; int nOutWarehouseCount = 0; for ( i = 0; i < m_AryOutWarehouse.GetSize(); i++ ) { if ( m_AryOutWarehouse.ElementAt(i).ElementAt(0).CompareNoCase(strOrder + _T("(订单使用)")) == 0 && m_AryOutWarehouse.ElementAt(i).ElementAt(2).CompareNoCase(strPSName) == 0 ) { //bHasOutWarehouse = TRUE; nOutWarehouseCount += atoi(m_AryOutWarehouse.ElementAt(i).ElementAt(3)); tagOutWarehouse.nIndex = i; tagOutWarehouse.strOrder = m_AryOutWarehouse.ElementAt(i).ElementAt(0); tagOutWarehouse.strSPLB = m_AryOutWarehouse.ElementAt(i).ElementAt(1); tagOutWarehouse.strSPName = m_AryOutWarehouse.ElementAt(i).ElementAt(2); tagOutWarehouse.strCount = m_AryOutWarehouse.ElementAt(i).ElementAt(3); tagOutWarehouse.strDate = m_AryOutWarehouse.ElementAt(i).ElementAt(4); tagOutWarehouse.strClerk = m_AryOutWarehouse.ElementAt(i).ElementAt(5); tagOutWarehouse.strRemark = m_AryOutWarehouse.ElementAt(i).ElementAt(6); tagOldOutWarehouse = tagOutWarehouse; break; } }// for; if ( nOutWarehouseCount == 0 ) { strSQL2.Format(_T("insert into storeinfo2([id],[type],[name],[count],[date],[clerk])values('%s','%s','%s','%s','%s','%s')"), strOrder + _T("(订单使用)"), tagItems.strSPLb, tagItems.strSPName, "1", tm.Format("%Y-%m-%d"), g_user.name); strSQL += _T("***") + strSQL2; // 添加记录; int nSize = m_AryOutWarehouse.GetSize() + 1; m_AryOutWarehouse.SetSize(nSize, 1); m_AryOutWarehouse.ElementAt(nSize - 1).Add(strOrder+_T("(订单使用)")); m_AryOutWarehouse.ElementAt(nSize - 1).Add(tagItems.strSPLb); m_AryOutWarehouse.ElementAt(nSize - 1).Add(tagItems.strSPName); m_AryOutWarehouse.ElementAt(nSize - 1).Add("1"); m_AryOutWarehouse.ElementAt(nSize - 1).Add(tm.Format("%Y-%m-%d")); m_AryOutWarehouse.ElementAt(nSize - 1).Add(g_user.name); tagOutWarehouse.nIndex = -1; tagOutWarehouse.strOrder = strOrder+_T("(订单使用)"); tagOutWarehouse.strSPLB = tagItems.strSPLb; tagOutWarehouse.strSPName = tagItems.strSPName; tagOutWarehouse.strCount = "1"; tagOutWarehouse.strDate = tm.Format("%Y-%m-%d"); tagOutWarehouse.strClerk = g_user.name; tagOutWarehouse.strRemark = _T(""); } else if ( nOutWarehouseCount < ( nBackCot >= nPickupCot ? nBackCot : nPickupCot) ) { strBackCot.Format(_T("%d"), ( nBackCot >= nPickupCot ? nBackCot : nPickupCot)); strSQL2.Format(_T("update storeinfo2 set [count] = '%s',[date] = '%s', [clerk] = '%s' where id = '%s' and name = '%s'"), strBackCot, tm.Format("%Y-%m-%d"), g_user.name, strOrder + _T("(订单使用)"), strPSName ); //tagOutWarehouse.strOrder = strOrder+_T("(订单使用)"); //tagOutWarehouse.strSPLB = tagItems.strSPLb; //tagOutWarehouse.strSPName = tagItems.strSPName; tagOutWarehouse.strCount = strBackCot; tagOutWarehouse.strDate = tm.Format("%Y-%m-%d"); tagOutWarehouse.strClerk = g_user.name; //tagOutWarehouse.strRemark = _T(""); printf("m_AryOutWarehouse = %d\n", m_AryOutWarehouse.GetSize()); m_AryOutWarehouse.ElementAt(i).SetAt(3, strBackCot); strSQL += _T("***") + strSQL2; } break; } } } } // for; } else {// 扫描取件; // 登记取件状态; for ( i = 0; i < m_AryOrderItems.GetSize(); i++ ) { if ( strText.CompareNoCase(m_AryOrderItems.ElementAt(i).ElementAt(1)) == 0 ) { if ( m_AryOrderItems.ElementAt(i).ElementAt(6).CompareNoCase("OK") != 0 ) { tagItems.nIndex = i; tagOldItem.nIndex = i; // 取件数量 + 1 == 商品数量 ==> 更新完成状态; if ( (atoi(m_AryOrderItems.ElementAt(i).ElementAt(7)) - atoi(m_AryOrderItems.ElementAt(i).ElementAt(9))) == 1) { strSQL.Format(_T("update dindansp set status2 = 'OK', [name4] = '%s', [date4] = '%s', [PickupItemsCot] = '%s' where autoid = %s "), g_user.name, tm.Format("%Y-%m-%d"), m_AryOrderItems.ElementAt(i).ElementAt(7), strText); m_AryOrderItems.ElementAt(i).SetAt(9, m_AryOrderItems.ElementAt(i).ElementAt(7)); m_AryOrderItems.ElementAt(i).SetAt(6, "OK"); tagItems.strPickupCot = m_AryOrderItems.ElementAt(i).ElementAt(7); tagItems.strPickupStatus = _T("OK"); } else if (atoi(m_AryOrderItems.ElementAt(i).ElementAt(7)) > atoi(m_AryOrderItems.ElementAt(i).ElementAt(9))) { strSQL.Format(_T("update dindansp set [name4] = '%s', [date4] = '%s', [PickupItemsCot] = '%d' where autoid = %s "), g_user.name, tm.Format("%Y-%m-%d"), atoi(m_AryOrderItems.ElementAt(i).ElementAt(9)) + 1, strText); strBackCot.Format(_T("%d"), atoi(m_AryOrderItems.ElementAt(i).ElementAt(9)) + 1); m_AryOrderItems.ElementAt(i).SetAt(9, strBackCot); tagItems.strPickupCot = strBackCot; } vector::iterator it = m_vtWithIn.begin(); for ( ; it != m_vtWithIn.end(); it++ ) { if ( strText.CompareNoCase(it->strBarCode) == 0 ) { bGet = TRUE; break; } } if ( !bGet ) { WithIn tagWithIn; tagWithIn.strBarCode = strText; tagWithIn.nIndex = m_ScanResult.AddItem(tagItems.strPickupStatus, strText, tagItems.strOrder, tagItems.strSPLb, tagItems.strSPName, tagItems.strShuliang, tagItems.strBackCot, tagItems.strPickupCot ); nCurItemIndex = tagWithIn.nIndex; //tagItems.nIndex = nCurItemIndex; //tagOldItem.nIndex = nCurItemIndex; m_vtWithIn.push_back(tagWithIn); } else { nCurItemIndex = it->nIndex; //tagItems.nIndex = nCurItemIndex; //tagOldItem.nIndex = nCurItemIndex; m_ScanResult.SetItemText(it->nIndex, 0, tagItems.strPickupStatus); // 取件状态; m_ScanResult.SetItemText(it->nIndex, 7, tagItems.strPickupCot); // 取件数量; } ////////////////////////////////////////////////////////////////////////// // 全部取走,更新订单取件状态; BOOL bPickupAll = TRUE; for ( i = 0; i < m_AryOrderItems.GetSize(); i++ ) { if ( strOrder == m_AryOrderItems.ElementAt(i).ElementAt(0) ) { if ( m_AryOrderItems.ElementAt(i).ElementAt(6) != "OK") { bPickupAll = FALSE; break; } } } if ( bPickupAll ) { strSQL2.Format(_T("update dindan set status3='OK', time5='%s', datetime5 = '%s' where id = '%s'"),tm.Format("%Y-%m-%d"), tm.Format("%H:%M"), strOrder); strSQL += _T("***") + strSQL2; } ////////////////////////////////////////////////////////////////////////// // 是否要出库; if ( atoi(g_cominfoarray.ElementAt(0).ElementAt(99)) == 0 ) { nSPCount = 0; for ( i = 0; i < m_AryOrderItems.GetSize(); i++ ) {// 查找该商品在订单目录下的数量; if ( m_AryOrderItems.ElementAt(i).ElementAt(0).CompareNoCase(strOrder) == 0 && m_AryOrderItems.ElementAt(i).ElementAt(2).CompareNoCase(strSPID) == 0 ) { nSPCount += atoi(m_AryOrderItems.ElementAt(i).ElementAt(7)); // 商品数量; nBackCot += atoi(m_AryOrderItems.ElementAt(i).ElementAt(8)); // 完成数量; nPickupCot += atoi(m_AryOrderItems.ElementAt(i).ElementAt(9)); // 取件数量; } }// for; // 获取出库数量; int nOutWarehouseCount = 0; for ( i = 0; i < m_AryOutWarehouse.GetSize(); i++ ) { if ( m_AryOutWarehouse.ElementAt(i).ElementAt(0).CompareNoCase(strOrder + _T("(订单使用)")) == 0 && m_AryOutWarehouse.ElementAt(i).ElementAt(2).CompareNoCase(strPSName) == 0 ) { nOutWarehouseCount += atoi(m_AryOutWarehouse.ElementAt(i).ElementAt(3)); tagOutWarehouse.nIndex = i; tagOutWarehouse.strOrder = m_AryOutWarehouse.ElementAt(i).ElementAt(0); tagOutWarehouse.strSPLB = m_AryOutWarehouse.ElementAt(i).ElementAt(1); tagOutWarehouse.strSPName = m_AryOutWarehouse.ElementAt(i).ElementAt(2); tagOutWarehouse.strCount = m_AryOutWarehouse.ElementAt(i).ElementAt(3); tagOutWarehouse.strDate = m_AryOutWarehouse.ElementAt(i).ElementAt(4); tagOutWarehouse.strClerk = m_AryOutWarehouse.ElementAt(i).ElementAt(5); tagOutWarehouse.strRemark = m_AryOutWarehouse.ElementAt(i).ElementAt(6); tagOldOutWarehouse = tagOutWarehouse; break; } }// for; if ( nOutWarehouseCount == 0 ) { strSQL2.Format(_T("insert into storeinfo2([id],[type],[name],[count],[date],[clerk])values('%s','%s','%s','%s','%s','%s')"), strOrder + _T("(订单使用)"), tagItems.strSPLb, tagItems.strSPName, "1", tm.Format("%Y-%m-%d"), g_user.name); strSQL += _T("***") + strSQL2; // 添加记录; int nSize = m_AryOutWarehouse.GetSize() + 1; m_AryOutWarehouse.SetSize(nSize, 1); m_AryOutWarehouse.ElementAt(nSize - 1).Add(strOrder+_T("(订单使用)")); m_AryOutWarehouse.ElementAt(nSize - 1).Add(tagItems.strSPLb); m_AryOutWarehouse.ElementAt(nSize - 1).Add(tagItems.strSPName); m_AryOutWarehouse.ElementAt(nSize - 1).Add("1"); m_AryOutWarehouse.ElementAt(nSize - 1).Add(tm.Format("%Y-%m-%d")); m_AryOutWarehouse.ElementAt(nSize - 1).Add(g_user.name); tagOutWarehouse.nIndex = -1; tagOutWarehouse.strOrder = strOrder+_T("(订单使用)"); tagOutWarehouse.strSPLB = tagItems.strSPLb; tagOutWarehouse.strSPName = tagItems.strSPName; tagOutWarehouse.strCount = "1"; tagOutWarehouse.strDate = tm.Format("%Y-%m-%d"); tagOutWarehouse.strClerk = g_user.name; tagOutWarehouse.strRemark = _T(""); } else if ( nOutWarehouseCount < ( nBackCot >= nPickupCot ? nBackCot : nPickupCot) ) { strBackCot.Format(_T("%d"), ( nBackCot >= nPickupCot ? nBackCot : nPickupCot)); strSQL2.Format(_T("update storeinfo2 set [count] = '%s',[date] = '%s', [clerk] = '%s' where id = '%s' and name = '%s'"), strBackCot, tm.Format("%Y-%m-%d"), g_user.name, strOrder + _T("(订单使用)"), strPSName ); strSQL += _T("***") + strSQL2; m_AryOutWarehouse.ElementAt(i).SetAt(3, strBackCot); //tagOutWarehouse.strOrder = strOrder+_T("(订单使用)"); //tagOutWarehouse.strSPLB = tagItems.strSPLb; //tagOutWarehouse.strSPName = tagItems.strSPName; tagOutWarehouse.strCount = strBackCot; tagOutWarehouse.strDate = tm.Format("%Y-%m-%d"); tagOutWarehouse.strClerk = g_user.name; //tagOutWarehouse.strRemark = _T(""); } break; } } } } } if ( !strSQL.IsEmpty() ) { g_sendhead.bsql = 1; g_pMainWnd->ProcessChatMessageRequest2(strSQL); if ( !g_bSendOK ) {// 更新失败; if ( m_nScanMode ) { m_ScanResult.SetItemText(nCurItemIndex, 0, _T("更新取件失败")); m_ScanResult.SetItemText(nCurItemIndex, 7, tagOldItem.strPickupCot); // 是否要出库; if ( atoi(g_cominfoarray.ElementAt(0).ElementAt(99)) == 0 ) { if ( tagOutWarehouse.nIndex == -1 && !tagOutWarehouse.strOrder.IsEmpty() ) {// 新元素; m_AryOutWarehouse.RemoveAt(m_AryOutWarehouse.GetSize() - 1); } else { m_AryOutWarehouse.ElementAt(tagOutWarehouse.nIndex).SetAt(3, tagOldOutWarehouse.strCount); m_AryOutWarehouse.ElementAt(tagOutWarehouse.nIndex).SetAt(4, tagOldOutWarehouse.strDate); m_AryOutWarehouse.ElementAt(tagOutWarehouse.nIndex).SetAt(5, tagOldOutWarehouse.strClerk); } } m_AryOrderItems.ElementAt(tagOldItem.nIndex).SetAt(6, tagOldItem.strPickupStatus); // 取件状态; m_AryOrderItems.ElementAt(tagOldItem.nIndex).SetAt(9, tagOldItem.strPickupCot); // 取件数量; } else { m_ScanResult.SetItemText(nCurItemIndex, 0, _T("更新回件失败")); m_ScanResult.SetItemText(nCurItemIndex, 6, tagOldItem.strBackCot); // 是否要出库; if ( atoi(g_cominfoarray.ElementAt(0).ElementAt(99)) == 0 ) { if ( tagOutWarehouse.nIndex == -1 && !tagOutWarehouse.strOrder.IsEmpty() ) {// 新元素; m_AryOutWarehouse.RemoveAt(m_AryOutWarehouse.GetSize() - 1); } else { m_AryOutWarehouse.ElementAt(tagOutWarehouse.nIndex).SetAt(3, tagOldOutWarehouse.strCount); m_AryOutWarehouse.ElementAt(tagOutWarehouse.nIndex).SetAt(4, tagOldOutWarehouse.strDate); m_AryOutWarehouse.ElementAt(tagOutWarehouse.nIndex).SetAt(5, tagOldOutWarehouse.strClerk); } } m_AryOrderItems.ElementAt(tagOldItem.nIndex).SetAt(5, tagOldItem.strBackStatus); // 回件状态; m_AryOrderItems.ElementAt(tagOldItem.nIndex).SetAt(8, tagOldItem.strBackCot); // 回件数量; } } printf("SQL:%s\n", strSQL); } } void CDlgScanBarCode::OnCancel() { // 退出扫描时,进行出入库及订单商品状态更新; CDialog::OnCancel(); }